igarape 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- igarape-0.2.0/.gitignore +11 -0
- igarape-0.2.0/LICENSE +21 -0
- igarape-0.2.0/PKG-INFO +206 -0
- igarape-0.2.0/README.md +194 -0
- igarape-0.2.0/pyproject.toml +45 -0
- igarape-0.2.0/src/igarape/__init__.py +1 -0
- igarape-0.2.0/src/igarape/cli.py +144 -0
igarape-0.2.0/.gitignore
ADDED
igarape-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sérgio Passos
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
igarape-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: igarape
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Generate Python services with an agentic SDLC for Codex, Claude Code, GitHub Copilot and OpenCode
|
|
5
|
+
Project-URL: Repository, https://github.com/spassos/igarape
|
|
6
|
+
Project-URL: Issues, https://github.com/spassos/igarape/issues
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Python: >=3.12
|
|
10
|
+
Requires-Dist: copier<10,>=9.4
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<img src="docs/assets/logo.svg" alt="igarapé — o caminho da ideia até a produção" width="560">
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<a href="https://github.com/spassos/igarape/actions/workflows/template-ci.yml"><img src="https://github.com/spassos/igarape/actions/workflows/template-ci.yml/badge.svg?branch=main" alt="Template CI"></a>
|
|
19
|
+
<a href="https://scorecard.dev/viewer/?uri=github.com/spassos/igarape"><img src="https://api.scorecard.dev/projects/github.com/spassos/igarape/badge" alt="OpenSSF Scorecard"></a>
|
|
20
|
+
<!-- PyPI badge goes here once `igarape` is published (docs/pypi.md):
|
|
21
|
+
<a href="https://pypi.org/project/igarape/"><img src="https://img.shields.io/pypi/v/igarape" alt="PyPI"></a>
|
|
22
|
+
-->
|
|
23
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="License: MIT"></a>
|
|
24
|
+
<a href="copier.yml"><img src="https://img.shields.io/badge/python-3.12%20%7C%203.13%20%7C%203.14-3776AB?logo=python&logoColor=white" alt="Python 3.12 | 3.13 | 3.14"></a>
|
|
25
|
+
<br>
|
|
26
|
+
<a href="#agent-support"><img src="https://img.shields.io/badge/agents-Codex%20%C2%B7%20Claude%20Code%20%C2%B7%20GitHub%20Copilot%20%C2%B7%20OpenCode-6E40C9" alt="Agents: Codex, Claude Code, GitHub Copilot, OpenCode"></a>
|
|
27
|
+
<a href="https://copier.readthedocs.io/"><img src="https://img.shields.io/badge/built%20with-Copier-FF6F00" alt="Built with Copier"></a>
|
|
28
|
+
<a href="https://docs.astral.sh/uv/"><img src="https://img.shields.io/badge/uv-managed-DE5FE9?logo=uv&logoColor=white" alt="uv"></a>
|
|
29
|
+
<a href="https://docs.astral.sh/ruff/"><img src="https://img.shields.io/badge/lint-Ruff-D7FF64?logo=ruff&logoColor=black" alt="Ruff"></a>
|
|
30
|
+
<a href="https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-strict"><img src="https://img.shields.io/badge/generated%20code-mypy%20--strict-2A6DB2" alt="Generated code: mypy --strict"></a>
|
|
31
|
+
<a href="https://www.conventionalcommits.org/en/v1.0.0/"><img src="https://img.shields.io/badge/Conventional%20Commits-1.0.0-FE5196?logo=conventionalcommits&logoColor=white" alt="Conventional Commits"></a>
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
# Igarapé
|
|
35
|
+
|
|
36
|
+
**Igarapé** is a CLI that generates Python service repositories ready for coding agents.
|
|
37
|
+
|
|
38
|
+
> **Status:** early development, not yet on PyPI. Install from Git (below). See the
|
|
39
|
+
> [Roadmap](#roadmap).
|
|
40
|
+
|
|
41
|
+
## Why Igarapé
|
|
42
|
+
|
|
43
|
+
Coding agents write code fast. Without a shared process they also ship unspecified behavior,
|
|
44
|
+
untested requirements and unreviewed security, and every team configures its agent differently.
|
|
45
|
+
|
|
46
|
+
Igarapé is a **golden path for Python services built with coding agents**: one command creates a
|
|
47
|
+
production-ready repository where the process, the quality bar and the delivery pipeline are
|
|
48
|
+
already in place, whichever agent the team uses.
|
|
49
|
+
|
|
50
|
+
| What you get | How it is enforced |
|
|
51
|
+
|---|---|
|
|
52
|
+
| **One SDLC for every agent.** Six phases (Discovery → Specify → Plan → Implement → Review → Ship), each a skill that produces a versioned artifact and ends at a gate: human approval of the PRD, spec, plan and merge; a green `make check` and no blocking review findings in between. `AGENTS.md`, seven skills (`discovery`, `specify`, `plan`, `implement`, `integrate`, `review`, `ship`) and four subagent roles (`architect`, `test_engineer`, `reviewer`, `security_auditor`). | The same `AGENTS.md` and `.agents/skills/` are read by Codex, Claude Code, GitHub Copilot and OpenCode; each agent gets only a thin adapter generated from the same source, and the subagents are read-only except `test_engineer`. |
|
|
53
|
+
| **A real service, not a blank repo.** FastAPI with hexagonal architecture, in memory by default. PostgreSQL (SQLAlchemy async + Alembic), Redis and Kafka or RabbitMQ (FastStream publisher + consumer worker) are opt-in; an outbound HTTP client with timeouts and retries is always included. | import-linter keeps the layers apart (`domain` and `application` import no framework); integrations are generated only when chosen, with no dead code. |
|
|
54
|
+
| **Quality gates the agent cannot talk its way around.** | `make check` runs Ruff (PEP 8/257 and Bandit rules), `mypy --strict`, import-linter, pip-audit on the locked tree and pytest with branch coverage ≥ 90%, identically on a laptop, in an agent session and in CI. Tests cover unit, API and integration (testcontainers) levels, plus a migration round-trip. |
|
|
55
|
+
| **Security by default.** OWASP API Security Top 10 controls: versioned `/v1` routes, generic JWT/OIDC authentication (JWKS, scopes, deny by default), object-level authorization (another owner's item returns 404), RFC 9457 problem details, security headers, a request-body size limit, `/docs` disabled in production and an SSRF guard for outbound HTTP. The mapping lives in the generated docs. | Security, contract (Schemathesis) and property (Hypothesis) tests ship with the service. CI runs gitleaks, zizmor and Trivy, with actions pinned by commit SHA and least-privilege permissions. |
|
|
56
|
+
| **Delivery verified in production (optional).** Opt-in CD (`ENABLE_CD=true`) pushes an image to GHCR with build-provenance attestation, deploys to staging, runs an OWASP ZAP baseline scan there, then deploys to production behind an environment approval. Opt-in release-please (`ENABLE_RELEASES=true`) keeps a release PR with the next semantic version and CHANGELOG; merging it tags `vX.Y.Z`, publishes the GitHub release and, with CD, ships that version. | A deploy is done only when the smoke test confirms the deployed version (the release version, else the commit SHA) and readiness; otherwise it rolls back automatically. PR titles must follow Conventional Commits. |
|
|
57
|
+
| **Projects keep improving.** | Generated repositories stay linked to the template; `copier update` brings later improvements. |
|
|
58
|
+
|
|
59
|
+
Igarapé does not replace your coding agent or invent new tooling. It combines established tools
|
|
60
|
+
(uv, Ruff, mypy, pytest, FastAPI, SQLAlchemy, FastStream, Copier, GitHub Actions) into one lean,
|
|
61
|
+
agent-neutral path from idea to production.
|
|
62
|
+
|
|
63
|
+
## Quick start
|
|
64
|
+
|
|
65
|
+
Requirements: [uv](https://docs.astral.sh/uv/), Git and `make`. Docker is needed only for the
|
|
66
|
+
optional integrations.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
uvx --from 'git+https://github.com/spassos/igarape.git@main' igarape new orders-api
|
|
70
|
+
cd orders-api && make bootstrap && make run # in-memory API on http://127.0.0.1:8000
|
|
71
|
+
make check # the Definition of Done gate
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Then open the directory with your coding agent. It reads `AGENTS.md` first.
|
|
75
|
+
|
|
76
|
+
## How it works
|
|
77
|
+
|
|
78
|
+
`igarape new` validates the options, renders the Copier template, locks the dependencies with
|
|
79
|
+
`uv lock`, initializes a Git repository and commits the scaffold (skipped with a hint when Git
|
|
80
|
+
has no user identity). The agent guidance is written once in a shared core; each selected agent
|
|
81
|
+
gets only a thin adapter in the format it reads. Details:
|
|
82
|
+
[`docs/architecture.md`](docs/architecture.md).
|
|
83
|
+
|
|
84
|
+
```mermaid
|
|
85
|
+
flowchart LR
|
|
86
|
+
CLI["igarape new DIR<br/>--agent, --postgres, --redis,<br/>--broker, --mcp"] --> COP["Copier<br/>copier.yml + template/"]
|
|
87
|
+
ROLES["includes/roles.jinja<br/>4 subagent roles, written once"] --> COP
|
|
88
|
+
COP --> REPO
|
|
89
|
+
subgraph REPO["Generated repository"]
|
|
90
|
+
direction TB
|
|
91
|
+
CORE["Shared core<br/>AGENTS.md, .agents/skills/ (7 skills)"]
|
|
92
|
+
ADAPT["Per-agent adapters<br/>CLAUDE.md, .claude/, .codex/,<br/>.github/agents/, .opencode/"]
|
|
93
|
+
SVC["FastAPI service<br/>hexagonal, make check"]
|
|
94
|
+
CICD["GitHub Actions<br/>CI, CD, release"]
|
|
95
|
+
CORE --> ADAPT
|
|
96
|
+
end
|
|
97
|
+
REPO -. "copier update" .-> COP
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## The agentic SDLC
|
|
101
|
+
|
|
102
|
+
Every generated project ships the same six-phase process as skills in `.agents/skills/`. Each
|
|
103
|
+
phase produces a versioned artifact and ends at a gate. A well-scoped local fix may start at
|
|
104
|
+
`implement` with a regression test.
|
|
105
|
+
|
|
106
|
+
```mermaid
|
|
107
|
+
flowchart LR
|
|
108
|
+
D["1. Discovery<br/>$discovery<br/>PRD"] -- "problem and<br/>metrics approved" --> S["2. Specify<br/>$specify<br/>spec.md"]
|
|
109
|
+
S -- "acceptance criteria<br/>approved" --> P["3. Plan<br/>$plan + architect<br/>plan.md, ADRs"]
|
|
110
|
+
P -- "plan approved" --> I["4. Implement<br/>$implement, $integrate<br/>+ test_engineer"]
|
|
111
|
+
I -- "make check<br/>green" --> R["5. Review<br/>$review + reviewer,<br/>security_auditor"]
|
|
112
|
+
R -- "no blocking<br/>findings" --> SH["6. Ship<br/>$ship<br/>CI, merge, optional CD"]
|
|
113
|
+
SH -. "smoke test sees the new SHA;<br/>measure PRD metrics" .-> D
|
|
114
|
+
FIX(["Local fix"]) -- "regression test" --> I
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Skills are written `$skill` (Codex syntax); in Claude Code they are `/skill`, and in Copilot and
|
|
118
|
+
OpenCode you ask for the skill by name. The seventh skill, `$integrate`, adds a new external
|
|
119
|
+
system as a port, adapter, in-memory fake and integration test.
|
|
120
|
+
|
|
121
|
+
## Agent support
|
|
122
|
+
|
|
123
|
+
`AGENTS.md`, the skills and the four roles are written once; each selected agent only gets the
|
|
124
|
+
adapter its format requires.
|
|
125
|
+
|
|
126
|
+
| Agent | Instructions | Skills | Subagents | MCP | PR review |
|
|
127
|
+
|---|---|---|---|---|---|
|
|
128
|
+
| Codex | `AGENTS.md` | `.agents/skills` | `.codex/agents/*.toml` | `.codex/config.toml` | `codex-review.yml` (opt-in) |
|
|
129
|
+
| Claude Code | `CLAUDE.md` → `@AGENTS.md` | `.claude/skills` (symlinks) | `.claude/agents/*.md` | `.mcp.json` | `claude-review.yml` (opt-in) |
|
|
130
|
+
| GitHub Copilot | `AGENTS.md` (+ pointer in `.github/copilot-instructions.md`) | `.agents/skills` | `.github/agents/*.agent.md` | `.vscode/mcp.json`, `.github/mcp.json` | Native code review |
|
|
131
|
+
| OpenCode (V2) | `AGENTS.md` | `.agents/skills` | `.opencode/agents/*.md` | `opencode.json` | — |
|
|
132
|
+
|
|
133
|
+
The Copilot cloud agent gets `copilot-setup-steps.yml` so it can run `make check`; its MCP servers
|
|
134
|
+
are configured in the repository settings.
|
|
135
|
+
|
|
136
|
+
## Why you can trust it
|
|
137
|
+
|
|
138
|
+
[Template CI](.github/workflows/template-ci.yml) runs on every pull request and every push to
|
|
139
|
+
`main`:
|
|
140
|
+
|
|
141
|
+
| Check | What it proves |
|
|
142
|
+
|---|---|
|
|
143
|
+
| `ruff check` + `ruff format --check` | The CLI and tests are clean. |
|
|
144
|
+
| `uv run pytest` | All 6 scenarios render with the expected layout; every agent adapter renders the shared roles with the right permissions; the CLI rejects invalid input without touching the destination; the CD, release, deploy and rollback policy behaves as documented; release-please bumps `pyproject.toml` and `uv.lock` together, here and in generated services. |
|
|
145
|
+
| `uv run pytest -m smoke` | The built wheel generates the default service, which starts, becomes ready and creates and reads an item over HTTP. |
|
|
146
|
+
| zizmor | The workflows of a project generated with all four agents, and this repository's own, have no medium+ findings. |
|
|
147
|
+
| Property-based tests (Hypothesis) | The CLI's external input (`--mcp NAME=URL`) only accepts credential-free HTTPS endpoints, and nothing it accepts can break out of the generated TOML/JSON config. |
|
|
148
|
+
| Pinned base images | The generated `Dockerfile` pins both base images by digest for Python 3.12, 3.13 and 3.14. |
|
|
149
|
+
| `make check` × 6 scenarios | Each generated project passes its own gate: `all-agents`, `full-kafka`, `minimal`, `postgres-rabbit`, `redis-only`, `with-mcp`, with real PostgreSQL, Redis, Kafka and RabbitMQ in containers. |
|
|
150
|
+
| Generated images | The Dockerfile builds for the in-memory and full (Postgres + Redis + Kafka) profiles; the in-memory container starts and reports the build version; the full image packages its entrypoints and migrations; Trivy fails on fixable HIGH/CRITICAL CVEs. |
|
|
151
|
+
|
|
152
|
+
Repository controls: actions pinned by commit SHA, `permissions: {}` by default, checkout without
|
|
153
|
+
persisted credentials, Dependabot for actions and Python dependencies,
|
|
154
|
+
[CodeQL](.github/workflows/codeql.yml) static analysis of the Python code and workflows,
|
|
155
|
+
[OpenSSF Scorecard](.github/workflows/scorecard.yml), release-please releases (version, tag,
|
|
156
|
+
GitHub release and CHANGELOG from Conventional Commits) and PyPI publishing through trusted
|
|
157
|
+
publishing (OIDC) only after the release wheel generates and tests a service. See
|
|
158
|
+
[`SECURITY.md`](SECURITY.md).
|
|
159
|
+
|
|
160
|
+
## Usage
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
igarape new inventory --postgres --redis --broker rabbit
|
|
164
|
+
igarape new ai-service --agent claude --agent copilot --mcp docs=https://example.com/mcp
|
|
165
|
+
igarape --help
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
| Option | Default | Effect |
|
|
169
|
+
|---|---|---|
|
|
170
|
+
| `--agent` (repeatable) | `codex` | `claude`, `codex`, `copilot`, `opencode` |
|
|
171
|
+
| `--name` / `--description` / `--author` | derived | Project metadata |
|
|
172
|
+
| `--python` | `3.13` | `3.12`, `3.13` or `3.14` |
|
|
173
|
+
| `--postgres`, `--redis` | off | Optional integrations, tested against real containers |
|
|
174
|
+
| `--broker` | `none` | `kafka` or `rabbit` (publisher + consumer worker) |
|
|
175
|
+
| `--mcp NAME=URL` (repeatable) | none | Project MCP server (HTTPS, no credentials, query or fragment) |
|
|
176
|
+
| `--template` / `--ref` | upstream `main` | Use a local checkout or a specific revision |
|
|
177
|
+
|
|
178
|
+
Install it for repeated use with `uv tool install git+https://github.com/spassos/igarape.git`.
|
|
179
|
+
Generated projects record their template revision in `.copier-answers.yml`; run
|
|
180
|
+
`uvx copier update` inside one to bring later template improvements.
|
|
181
|
+
|
|
182
|
+
## Roadmap
|
|
183
|
+
|
|
184
|
+
1. **Portable core** — CLI, `--agent`, agent-neutral roles. ✅
|
|
185
|
+
2. **Adapters** — Codex, Claude Code, GitHub Copilot and OpenCode. ✅
|
|
186
|
+
3. **Images** — generated Dockerfiles built, smoke-tested and scanned in CI. ✅
|
|
187
|
+
4. **Drift check** — `make agents-check` so edits to one agent's files cannot silently diverge.
|
|
188
|
+
5. **Evidence** — pilot comparing agents with and without the guidance, on the same tasks.
|
|
189
|
+
6. **Release** — publish `igarape` on PyPI.
|
|
190
|
+
|
|
191
|
+
## Contributing
|
|
192
|
+
|
|
193
|
+
Read [`CONTRIBUTING.md`](CONTRIBUTING.md) and [`AGENTS.md`](AGENTS.md) before changing the
|
|
194
|
+
template. In short: every scenario must pass `uv run pytest -m slow`, a new option needs a new
|
|
195
|
+
scenario, and workflows pin actions by SHA. Report vulnerabilities privately as described in
|
|
196
|
+
[`SECURITY.md`](SECURITY.md).
|
|
197
|
+
|
|
198
|
+
## License
|
|
199
|
+
|
|
200
|
+
[MIT](LICENSE)
|
|
201
|
+
|
|
202
|
+
## Why the name
|
|
203
|
+
|
|
204
|
+
*Igarapé* comes from Tupi: *igara* (canoe) + *pé* (path), "the canoe's path", the narrow
|
|
205
|
+
waterways that cross the Amazon forest. The process is the igarapé; every coding agent is an
|
|
206
|
+
*igara* travelling the same path to production.
|
igarape-0.2.0/README.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/assets/logo.svg" alt="igarapé — o caminho da ideia até a produção" width="560">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://github.com/spassos/igarape/actions/workflows/template-ci.yml"><img src="https://github.com/spassos/igarape/actions/workflows/template-ci.yml/badge.svg?branch=main" alt="Template CI"></a>
|
|
7
|
+
<a href="https://scorecard.dev/viewer/?uri=github.com/spassos/igarape"><img src="https://api.scorecard.dev/projects/github.com/spassos/igarape/badge" alt="OpenSSF Scorecard"></a>
|
|
8
|
+
<!-- PyPI badge goes here once `igarape` is published (docs/pypi.md):
|
|
9
|
+
<a href="https://pypi.org/project/igarape/"><img src="https://img.shields.io/pypi/v/igarape" alt="PyPI"></a>
|
|
10
|
+
-->
|
|
11
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="License: MIT"></a>
|
|
12
|
+
<a href="copier.yml"><img src="https://img.shields.io/badge/python-3.12%20%7C%203.13%20%7C%203.14-3776AB?logo=python&logoColor=white" alt="Python 3.12 | 3.13 | 3.14"></a>
|
|
13
|
+
<br>
|
|
14
|
+
<a href="#agent-support"><img src="https://img.shields.io/badge/agents-Codex%20%C2%B7%20Claude%20Code%20%C2%B7%20GitHub%20Copilot%20%C2%B7%20OpenCode-6E40C9" alt="Agents: Codex, Claude Code, GitHub Copilot, OpenCode"></a>
|
|
15
|
+
<a href="https://copier.readthedocs.io/"><img src="https://img.shields.io/badge/built%20with-Copier-FF6F00" alt="Built with Copier"></a>
|
|
16
|
+
<a href="https://docs.astral.sh/uv/"><img src="https://img.shields.io/badge/uv-managed-DE5FE9?logo=uv&logoColor=white" alt="uv"></a>
|
|
17
|
+
<a href="https://docs.astral.sh/ruff/"><img src="https://img.shields.io/badge/lint-Ruff-D7FF64?logo=ruff&logoColor=black" alt="Ruff"></a>
|
|
18
|
+
<a href="https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-strict"><img src="https://img.shields.io/badge/generated%20code-mypy%20--strict-2A6DB2" alt="Generated code: mypy --strict"></a>
|
|
19
|
+
<a href="https://www.conventionalcommits.org/en/v1.0.0/"><img src="https://img.shields.io/badge/Conventional%20Commits-1.0.0-FE5196?logo=conventionalcommits&logoColor=white" alt="Conventional Commits"></a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
# Igarapé
|
|
23
|
+
|
|
24
|
+
**Igarapé** is a CLI that generates Python service repositories ready for coding agents.
|
|
25
|
+
|
|
26
|
+
> **Status:** early development, not yet on PyPI. Install from Git (below). See the
|
|
27
|
+
> [Roadmap](#roadmap).
|
|
28
|
+
|
|
29
|
+
## Why Igarapé
|
|
30
|
+
|
|
31
|
+
Coding agents write code fast. Without a shared process they also ship unspecified behavior,
|
|
32
|
+
untested requirements and unreviewed security, and every team configures its agent differently.
|
|
33
|
+
|
|
34
|
+
Igarapé is a **golden path for Python services built with coding agents**: one command creates a
|
|
35
|
+
production-ready repository where the process, the quality bar and the delivery pipeline are
|
|
36
|
+
already in place, whichever agent the team uses.
|
|
37
|
+
|
|
38
|
+
| What you get | How it is enforced |
|
|
39
|
+
|---|---|
|
|
40
|
+
| **One SDLC for every agent.** Six phases (Discovery → Specify → Plan → Implement → Review → Ship), each a skill that produces a versioned artifact and ends at a gate: human approval of the PRD, spec, plan and merge; a green `make check` and no blocking review findings in between. `AGENTS.md`, seven skills (`discovery`, `specify`, `plan`, `implement`, `integrate`, `review`, `ship`) and four subagent roles (`architect`, `test_engineer`, `reviewer`, `security_auditor`). | The same `AGENTS.md` and `.agents/skills/` are read by Codex, Claude Code, GitHub Copilot and OpenCode; each agent gets only a thin adapter generated from the same source, and the subagents are read-only except `test_engineer`. |
|
|
41
|
+
| **A real service, not a blank repo.** FastAPI with hexagonal architecture, in memory by default. PostgreSQL (SQLAlchemy async + Alembic), Redis and Kafka or RabbitMQ (FastStream publisher + consumer worker) are opt-in; an outbound HTTP client with timeouts and retries is always included. | import-linter keeps the layers apart (`domain` and `application` import no framework); integrations are generated only when chosen, with no dead code. |
|
|
42
|
+
| **Quality gates the agent cannot talk its way around.** | `make check` runs Ruff (PEP 8/257 and Bandit rules), `mypy --strict`, import-linter, pip-audit on the locked tree and pytest with branch coverage ≥ 90%, identically on a laptop, in an agent session and in CI. Tests cover unit, API and integration (testcontainers) levels, plus a migration round-trip. |
|
|
43
|
+
| **Security by default.** OWASP API Security Top 10 controls: versioned `/v1` routes, generic JWT/OIDC authentication (JWKS, scopes, deny by default), object-level authorization (another owner's item returns 404), RFC 9457 problem details, security headers, a request-body size limit, `/docs` disabled in production and an SSRF guard for outbound HTTP. The mapping lives in the generated docs. | Security, contract (Schemathesis) and property (Hypothesis) tests ship with the service. CI runs gitleaks, zizmor and Trivy, with actions pinned by commit SHA and least-privilege permissions. |
|
|
44
|
+
| **Delivery verified in production (optional).** Opt-in CD (`ENABLE_CD=true`) pushes an image to GHCR with build-provenance attestation, deploys to staging, runs an OWASP ZAP baseline scan there, then deploys to production behind an environment approval. Opt-in release-please (`ENABLE_RELEASES=true`) keeps a release PR with the next semantic version and CHANGELOG; merging it tags `vX.Y.Z`, publishes the GitHub release and, with CD, ships that version. | A deploy is done only when the smoke test confirms the deployed version (the release version, else the commit SHA) and readiness; otherwise it rolls back automatically. PR titles must follow Conventional Commits. |
|
|
45
|
+
| **Projects keep improving.** | Generated repositories stay linked to the template; `copier update` brings later improvements. |
|
|
46
|
+
|
|
47
|
+
Igarapé does not replace your coding agent or invent new tooling. It combines established tools
|
|
48
|
+
(uv, Ruff, mypy, pytest, FastAPI, SQLAlchemy, FastStream, Copier, GitHub Actions) into one lean,
|
|
49
|
+
agent-neutral path from idea to production.
|
|
50
|
+
|
|
51
|
+
## Quick start
|
|
52
|
+
|
|
53
|
+
Requirements: [uv](https://docs.astral.sh/uv/), Git and `make`. Docker is needed only for the
|
|
54
|
+
optional integrations.
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
uvx --from 'git+https://github.com/spassos/igarape.git@main' igarape new orders-api
|
|
58
|
+
cd orders-api && make bootstrap && make run # in-memory API on http://127.0.0.1:8000
|
|
59
|
+
make check # the Definition of Done gate
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Then open the directory with your coding agent. It reads `AGENTS.md` first.
|
|
63
|
+
|
|
64
|
+
## How it works
|
|
65
|
+
|
|
66
|
+
`igarape new` validates the options, renders the Copier template, locks the dependencies with
|
|
67
|
+
`uv lock`, initializes a Git repository and commits the scaffold (skipped with a hint when Git
|
|
68
|
+
has no user identity). The agent guidance is written once in a shared core; each selected agent
|
|
69
|
+
gets only a thin adapter in the format it reads. Details:
|
|
70
|
+
[`docs/architecture.md`](docs/architecture.md).
|
|
71
|
+
|
|
72
|
+
```mermaid
|
|
73
|
+
flowchart LR
|
|
74
|
+
CLI["igarape new DIR<br/>--agent, --postgres, --redis,<br/>--broker, --mcp"] --> COP["Copier<br/>copier.yml + template/"]
|
|
75
|
+
ROLES["includes/roles.jinja<br/>4 subagent roles, written once"] --> COP
|
|
76
|
+
COP --> REPO
|
|
77
|
+
subgraph REPO["Generated repository"]
|
|
78
|
+
direction TB
|
|
79
|
+
CORE["Shared core<br/>AGENTS.md, .agents/skills/ (7 skills)"]
|
|
80
|
+
ADAPT["Per-agent adapters<br/>CLAUDE.md, .claude/, .codex/,<br/>.github/agents/, .opencode/"]
|
|
81
|
+
SVC["FastAPI service<br/>hexagonal, make check"]
|
|
82
|
+
CICD["GitHub Actions<br/>CI, CD, release"]
|
|
83
|
+
CORE --> ADAPT
|
|
84
|
+
end
|
|
85
|
+
REPO -. "copier update" .-> COP
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## The agentic SDLC
|
|
89
|
+
|
|
90
|
+
Every generated project ships the same six-phase process as skills in `.agents/skills/`. Each
|
|
91
|
+
phase produces a versioned artifact and ends at a gate. A well-scoped local fix may start at
|
|
92
|
+
`implement` with a regression test.
|
|
93
|
+
|
|
94
|
+
```mermaid
|
|
95
|
+
flowchart LR
|
|
96
|
+
D["1. Discovery<br/>$discovery<br/>PRD"] -- "problem and<br/>metrics approved" --> S["2. Specify<br/>$specify<br/>spec.md"]
|
|
97
|
+
S -- "acceptance criteria<br/>approved" --> P["3. Plan<br/>$plan + architect<br/>plan.md, ADRs"]
|
|
98
|
+
P -- "plan approved" --> I["4. Implement<br/>$implement, $integrate<br/>+ test_engineer"]
|
|
99
|
+
I -- "make check<br/>green" --> R["5. Review<br/>$review + reviewer,<br/>security_auditor"]
|
|
100
|
+
R -- "no blocking<br/>findings" --> SH["6. Ship<br/>$ship<br/>CI, merge, optional CD"]
|
|
101
|
+
SH -. "smoke test sees the new SHA;<br/>measure PRD metrics" .-> D
|
|
102
|
+
FIX(["Local fix"]) -- "regression test" --> I
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Skills are written `$skill` (Codex syntax); in Claude Code they are `/skill`, and in Copilot and
|
|
106
|
+
OpenCode you ask for the skill by name. The seventh skill, `$integrate`, adds a new external
|
|
107
|
+
system as a port, adapter, in-memory fake and integration test.
|
|
108
|
+
|
|
109
|
+
## Agent support
|
|
110
|
+
|
|
111
|
+
`AGENTS.md`, the skills and the four roles are written once; each selected agent only gets the
|
|
112
|
+
adapter its format requires.
|
|
113
|
+
|
|
114
|
+
| Agent | Instructions | Skills | Subagents | MCP | PR review |
|
|
115
|
+
|---|---|---|---|---|---|
|
|
116
|
+
| Codex | `AGENTS.md` | `.agents/skills` | `.codex/agents/*.toml` | `.codex/config.toml` | `codex-review.yml` (opt-in) |
|
|
117
|
+
| Claude Code | `CLAUDE.md` → `@AGENTS.md` | `.claude/skills` (symlinks) | `.claude/agents/*.md` | `.mcp.json` | `claude-review.yml` (opt-in) |
|
|
118
|
+
| GitHub Copilot | `AGENTS.md` (+ pointer in `.github/copilot-instructions.md`) | `.agents/skills` | `.github/agents/*.agent.md` | `.vscode/mcp.json`, `.github/mcp.json` | Native code review |
|
|
119
|
+
| OpenCode (V2) | `AGENTS.md` | `.agents/skills` | `.opencode/agents/*.md` | `opencode.json` | — |
|
|
120
|
+
|
|
121
|
+
The Copilot cloud agent gets `copilot-setup-steps.yml` so it can run `make check`; its MCP servers
|
|
122
|
+
are configured in the repository settings.
|
|
123
|
+
|
|
124
|
+
## Why you can trust it
|
|
125
|
+
|
|
126
|
+
[Template CI](.github/workflows/template-ci.yml) runs on every pull request and every push to
|
|
127
|
+
`main`:
|
|
128
|
+
|
|
129
|
+
| Check | What it proves |
|
|
130
|
+
|---|---|
|
|
131
|
+
| `ruff check` + `ruff format --check` | The CLI and tests are clean. |
|
|
132
|
+
| `uv run pytest` | All 6 scenarios render with the expected layout; every agent adapter renders the shared roles with the right permissions; the CLI rejects invalid input without touching the destination; the CD, release, deploy and rollback policy behaves as documented; release-please bumps `pyproject.toml` and `uv.lock` together, here and in generated services. |
|
|
133
|
+
| `uv run pytest -m smoke` | The built wheel generates the default service, which starts, becomes ready and creates and reads an item over HTTP. |
|
|
134
|
+
| zizmor | The workflows of a project generated with all four agents, and this repository's own, have no medium+ findings. |
|
|
135
|
+
| Property-based tests (Hypothesis) | The CLI's external input (`--mcp NAME=URL`) only accepts credential-free HTTPS endpoints, and nothing it accepts can break out of the generated TOML/JSON config. |
|
|
136
|
+
| Pinned base images | The generated `Dockerfile` pins both base images by digest for Python 3.12, 3.13 and 3.14. |
|
|
137
|
+
| `make check` × 6 scenarios | Each generated project passes its own gate: `all-agents`, `full-kafka`, `minimal`, `postgres-rabbit`, `redis-only`, `with-mcp`, with real PostgreSQL, Redis, Kafka and RabbitMQ in containers. |
|
|
138
|
+
| Generated images | The Dockerfile builds for the in-memory and full (Postgres + Redis + Kafka) profiles; the in-memory container starts and reports the build version; the full image packages its entrypoints and migrations; Trivy fails on fixable HIGH/CRITICAL CVEs. |
|
|
139
|
+
|
|
140
|
+
Repository controls: actions pinned by commit SHA, `permissions: {}` by default, checkout without
|
|
141
|
+
persisted credentials, Dependabot for actions and Python dependencies,
|
|
142
|
+
[CodeQL](.github/workflows/codeql.yml) static analysis of the Python code and workflows,
|
|
143
|
+
[OpenSSF Scorecard](.github/workflows/scorecard.yml), release-please releases (version, tag,
|
|
144
|
+
GitHub release and CHANGELOG from Conventional Commits) and PyPI publishing through trusted
|
|
145
|
+
publishing (OIDC) only after the release wheel generates and tests a service. See
|
|
146
|
+
[`SECURITY.md`](SECURITY.md).
|
|
147
|
+
|
|
148
|
+
## Usage
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
igarape new inventory --postgres --redis --broker rabbit
|
|
152
|
+
igarape new ai-service --agent claude --agent copilot --mcp docs=https://example.com/mcp
|
|
153
|
+
igarape --help
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
| Option | Default | Effect |
|
|
157
|
+
|---|---|---|
|
|
158
|
+
| `--agent` (repeatable) | `codex` | `claude`, `codex`, `copilot`, `opencode` |
|
|
159
|
+
| `--name` / `--description` / `--author` | derived | Project metadata |
|
|
160
|
+
| `--python` | `3.13` | `3.12`, `3.13` or `3.14` |
|
|
161
|
+
| `--postgres`, `--redis` | off | Optional integrations, tested against real containers |
|
|
162
|
+
| `--broker` | `none` | `kafka` or `rabbit` (publisher + consumer worker) |
|
|
163
|
+
| `--mcp NAME=URL` (repeatable) | none | Project MCP server (HTTPS, no credentials, query or fragment) |
|
|
164
|
+
| `--template` / `--ref` | upstream `main` | Use a local checkout or a specific revision |
|
|
165
|
+
|
|
166
|
+
Install it for repeated use with `uv tool install git+https://github.com/spassos/igarape.git`.
|
|
167
|
+
Generated projects record their template revision in `.copier-answers.yml`; run
|
|
168
|
+
`uvx copier update` inside one to bring later template improvements.
|
|
169
|
+
|
|
170
|
+
## Roadmap
|
|
171
|
+
|
|
172
|
+
1. **Portable core** — CLI, `--agent`, agent-neutral roles. ✅
|
|
173
|
+
2. **Adapters** — Codex, Claude Code, GitHub Copilot and OpenCode. ✅
|
|
174
|
+
3. **Images** — generated Dockerfiles built, smoke-tested and scanned in CI. ✅
|
|
175
|
+
4. **Drift check** — `make agents-check` so edits to one agent's files cannot silently diverge.
|
|
176
|
+
5. **Evidence** — pilot comparing agents with and without the guidance, on the same tasks.
|
|
177
|
+
6. **Release** — publish `igarape` on PyPI.
|
|
178
|
+
|
|
179
|
+
## Contributing
|
|
180
|
+
|
|
181
|
+
Read [`CONTRIBUTING.md`](CONTRIBUTING.md) and [`AGENTS.md`](AGENTS.md) before changing the
|
|
182
|
+
template. In short: every scenario must pass `uv run pytest -m slow`, a new option needs a new
|
|
183
|
+
scenario, and workflows pin actions by SHA. Report vulnerabilities privately as described in
|
|
184
|
+
[`SECURITY.md`](SECURITY.md).
|
|
185
|
+
|
|
186
|
+
## License
|
|
187
|
+
|
|
188
|
+
[MIT](LICENSE)
|
|
189
|
+
|
|
190
|
+
## Why the name
|
|
191
|
+
|
|
192
|
+
*Igarapé* comes from Tupi: *igara* (canoe) + *pé* (path), "the canoe's path", the narrow
|
|
193
|
+
waterways that cross the Amazon forest. The process is the igarapé; every coding agent is an
|
|
194
|
+
*igara* travelling the same path to production.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "igarape"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "Generate Python services with an agentic SDLC for Codex, Claude Code, GitHub Copilot and OpenCode"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
requires-python = ">=3.12"
|
|
8
|
+
dependencies = ["copier>=9.4,<10"]
|
|
9
|
+
|
|
10
|
+
[project.urls]
|
|
11
|
+
Repository = "https://github.com/spassos/igarape"
|
|
12
|
+
Issues = "https://github.com/spassos/igarape/issues"
|
|
13
|
+
|
|
14
|
+
[project.scripts]
|
|
15
|
+
igarape = "igarape.cli:main"
|
|
16
|
+
|
|
17
|
+
[build-system]
|
|
18
|
+
requires = ["hatchling>=1.26"]
|
|
19
|
+
build-backend = "hatchling.build"
|
|
20
|
+
|
|
21
|
+
[tool.hatch.build.targets.sdist]
|
|
22
|
+
include = ["/src/igarape", "/pyproject.toml", "/README.md", "/LICENSE"]
|
|
23
|
+
|
|
24
|
+
[tool.hatch.build.targets.wheel]
|
|
25
|
+
packages = ["src/igarape"]
|
|
26
|
+
|
|
27
|
+
[dependency-groups]
|
|
28
|
+
dev = [
|
|
29
|
+
"hypothesis>=6.140",
|
|
30
|
+
"pytest>=8.3",
|
|
31
|
+
"pyyaml>=6",
|
|
32
|
+
"ruff>=0.8",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[tool.ruff]
|
|
36
|
+
line-length = 110
|
|
37
|
+
extend-exclude = ["template"]
|
|
38
|
+
|
|
39
|
+
[tool.pytest.ini_options]
|
|
40
|
+
addopts = "-ra --strict-markers -m 'not slow and not smoke'"
|
|
41
|
+
testpaths = ["tests"]
|
|
42
|
+
markers = [
|
|
43
|
+
"slow: runs make check in each generated project (Docker for integration profiles)",
|
|
44
|
+
"smoke: generates and exercises the default API over HTTP without Docker",
|
|
45
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Igarapé: generate Python services with an agentic SDLC for coding agents."""
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"""Igarapé CLI: generate a Python service ready for coding agents (`igarape new orders-api`)."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import importlib.metadata
|
|
5
|
+
import keyword
|
|
6
|
+
import re
|
|
7
|
+
import subprocess
|
|
8
|
+
import sys
|
|
9
|
+
import tempfile
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from urllib.parse import urlsplit
|
|
12
|
+
|
|
13
|
+
from copier import run_copy
|
|
14
|
+
from copier.errors import CopierError
|
|
15
|
+
|
|
16
|
+
TEMPLATE = "https://github.com/spassos/igarape.git"
|
|
17
|
+
AGENTS = ("claude", "codex", "copilot", "opencode")
|
|
18
|
+
INITIAL_COMMIT = "chore: initial scaffold from igarape"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def initial_commit(project: Path) -> bool:
|
|
22
|
+
"""Commit the generated files so the first agent change has a clean diff; False if git can't."""
|
|
23
|
+
subprocess.run(["git", "add", "-A"], cwd=project, check=True)
|
|
24
|
+
result = subprocess.run(
|
|
25
|
+
["git", "commit", "-q", "-m", INITIAL_COMMIT], cwd=project, capture_output=True, check=False
|
|
26
|
+
)
|
|
27
|
+
return result.returncode == 0
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def mcp_server(value: str) -> tuple[str, str]:
|
|
31
|
+
name, _, url = value.partition("=")
|
|
32
|
+
if not re.fullmatch(r"[A-Za-z0-9_-]+", name):
|
|
33
|
+
raise argparse.ArgumentTypeError(
|
|
34
|
+
"use NAME=HTTPS_URL with a server name containing letters, digits, - or _"
|
|
35
|
+
)
|
|
36
|
+
try:
|
|
37
|
+
endpoint = urlsplit(url)
|
|
38
|
+
valid = endpoint.scheme == "https" and endpoint.hostname and endpoint.username is None
|
|
39
|
+
# Only endpoints suitable for committing to project configuration are supported.
|
|
40
|
+
valid = (
|
|
41
|
+
valid
|
|
42
|
+
# An empty "?" or "#" parses as no query/fragment, so check the raw text.
|
|
43
|
+
and "?" not in url
|
|
44
|
+
and "#" not in url
|
|
45
|
+
and not any(c.isspace() or not c.isprintable() for c in url)
|
|
46
|
+
)
|
|
47
|
+
_ = endpoint.port
|
|
48
|
+
except ValueError:
|
|
49
|
+
valid = False
|
|
50
|
+
if not valid:
|
|
51
|
+
raise argparse.ArgumentTypeError("use an HTTPS endpoint URL without credentials, query or fragment")
|
|
52
|
+
return name, url
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def build_parser() -> tuple[argparse.ArgumentParser, argparse.ArgumentParser]:
|
|
56
|
+
parser = argparse.ArgumentParser(prog="igarape", description=__doc__)
|
|
57
|
+
parser.add_argument(
|
|
58
|
+
"--version", action="version", version=f"igarape {importlib.metadata.version('igarape')}"
|
|
59
|
+
)
|
|
60
|
+
commands = parser.add_subparsers(dest="command", required=True, metavar="COMMAND")
|
|
61
|
+
new = commands.add_parser("new", help="generate a new service repository", description=__doc__)
|
|
62
|
+
new.add_argument("destination", type=Path, help="new directory, e.g. orders-api")
|
|
63
|
+
new.add_argument(
|
|
64
|
+
"--agent",
|
|
65
|
+
action="append",
|
|
66
|
+
choices=AGENTS,
|
|
67
|
+
metavar="AGENT",
|
|
68
|
+
help=f"coding agent to configure (repeatable; choices: {', '.join(AGENTS)}; default: codex)",
|
|
69
|
+
)
|
|
70
|
+
new.add_argument("--name", help="project display name (default: directory name)")
|
|
71
|
+
new.add_argument("--description", help="one-line service description")
|
|
72
|
+
new.add_argument("--author", help="owning person or team")
|
|
73
|
+
new.add_argument("--python", choices=["3.12", "3.13", "3.14"], help="service Python version")
|
|
74
|
+
new.add_argument("--postgres", action="store_true", help="include PostgreSQL and migrations")
|
|
75
|
+
new.add_argument("--redis", action="store_true", help="include Redis")
|
|
76
|
+
new.add_argument("--broker", choices=["none", "kafka", "rabbit"], default="none")
|
|
77
|
+
new.add_argument(
|
|
78
|
+
"--mcp",
|
|
79
|
+
action="append",
|
|
80
|
+
type=mcp_server,
|
|
81
|
+
default=[],
|
|
82
|
+
metavar="NAME=HTTPS_URL",
|
|
83
|
+
help="register a project MCP server (repeatable)",
|
|
84
|
+
)
|
|
85
|
+
new.add_argument("--template", type=Path, help="use a local template checkout")
|
|
86
|
+
new.add_argument(
|
|
87
|
+
"--ref", help="template Git revision (default: main upstream, HEAD for a local checkout)"
|
|
88
|
+
)
|
|
89
|
+
return parser, new
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def main() -> int:
|
|
93
|
+
root, parser = build_parser()
|
|
94
|
+
args = root.parse_args()
|
|
95
|
+
path = args.destination.expanduser().absolute()
|
|
96
|
+
slug = path.name.lower().replace("_", "-").replace(" ", "-")
|
|
97
|
+
if not re.fullmatch(r"[a-z][a-z0-9]*(?:-[a-z0-9]+)*", slug) or keyword.iskeyword(slug.replace("-", "_")):
|
|
98
|
+
parser.error("choose a directory name that can be used as a Python package, e.g. orders-api")
|
|
99
|
+
servers = dict(args.mcp)
|
|
100
|
+
if len(servers) != len(args.mcp):
|
|
101
|
+
parser.error("each MCP server must have a unique name")
|
|
102
|
+
answers = {
|
|
103
|
+
"project_name": args.name if args.name is not None else path.name,
|
|
104
|
+
"project_slug": slug,
|
|
105
|
+
"use_postgres": args.postgres,
|
|
106
|
+
"use_redis": args.redis,
|
|
107
|
+
"event_broker": args.broker,
|
|
108
|
+
"mcp_servers": servers,
|
|
109
|
+
"agents": sorted(set(args.agent or ["codex"])),
|
|
110
|
+
}
|
|
111
|
+
for key, value in (
|
|
112
|
+
("description", args.description),
|
|
113
|
+
("author_name", args.author),
|
|
114
|
+
("python_version", args.python),
|
|
115
|
+
):
|
|
116
|
+
if value is not None:
|
|
117
|
+
answers[key] = value
|
|
118
|
+
|
|
119
|
+
source = str(args.template.expanduser().resolve()) if args.template else TEMPLATE
|
|
120
|
+
revision = args.ref or ("HEAD" if args.template else "main")
|
|
121
|
+
try:
|
|
122
|
+
if path.exists() or path.is_symlink():
|
|
123
|
+
parser.error("destination already exists; choose a new directory")
|
|
124
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
125
|
+
with tempfile.TemporaryDirectory(dir=path.parent) as temp:
|
|
126
|
+
project = Path(temp) / "project"
|
|
127
|
+
run_copy(source, project, vcs_ref=revision, data=answers, defaults=True, unsafe=False, quiet=True)
|
|
128
|
+
subprocess.run(["uv", "lock"], cwd=project, check=True)
|
|
129
|
+
subprocess.run(["git", "init", "-q", "-b", "main"], cwd=project, check=True)
|
|
130
|
+
committed = initial_commit(project)
|
|
131
|
+
project.rename(path)
|
|
132
|
+
except (CopierError, OSError, ValueError, subprocess.CalledProcessError) as exc:
|
|
133
|
+
print(f"igarape: {exc}", file=sys.stderr)
|
|
134
|
+
return 1
|
|
135
|
+
|
|
136
|
+
if not committed:
|
|
137
|
+
print(
|
|
138
|
+
"igarape: initial commit skipped (set git user.name and user.email, then run "
|
|
139
|
+
f'`git -C {path} add -A && git -C {path} commit -m "{INITIAL_COMMIT}"`)',
|
|
140
|
+
file=sys.stderr,
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
print(f"Created {path}. Open it with your coding agent; README.md has the startup and test commands.")
|
|
144
|
+
return 0
|