@thatix.io/context-first-agents-cli 0.2.1 → 0.2.2

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.
@@ -93,6 +93,39 @@ See `agents/CONTEXT-CONTRACT.md` for the exact shape. In short:
93
93
  - **limits**: `contextPolicy` (default `select-do-not-dump`), `maxFilesPerWorker`
94
94
  - **return**: summary, changes, evidence, tests, unresolved questions, confidence
95
95
 
96
+ ## Step 5b — Prepare the session worktrees (via git, not Node)
97
+
98
+ Before spawning any agent, create an **isolated git worktree per impacted repository**
99
+ (only the ones in the graph), so each implementer has a place to write without touching
100
+ the main repo. Use `base_path` (from `ai.properties.md`) and the `<ISSUE-ID>`.
101
+
102
+ For each impacted repository `<repo>`:
103
+
104
+ 1. If `.sessions/<ISSUE-ID>/<repo>/` already exists, **skip** (worktree ready).
105
+ 2. Check whether branch `feature/<ISSUE-ID>` already exists in the repo:
106
+ ```bash
107
+ git -C "{base_path}/<repo>" rev-parse --verify --quiet "feature/<ISSUE-ID>"
108
+ ```
109
+ 3. Create the worktree from the main repo:
110
+ - if the branch does **not** exist (create it in the worktree):
111
+ ```bash
112
+ git -C "{base_path}/<repo>" worktree add -b "feature/<ISSUE-ID>" \
113
+ "$(pwd)/.sessions/<ISSUE-ID>/<repo>"
114
+ ```
115
+ - if the branch **already** exists (reuse it):
116
+ ```bash
117
+ git -C "{base_path}/<repo>" worktree add \
118
+ "$(pwd)/.sessions/<ISSUE-ID>/<repo>" "feature/<ISSUE-ID>"
119
+ ```
120
+
121
+ Rules:
122
+ - **Never** `checkout` in the main repo (`{base_path}/<repo>`) — the worktree isolates everything.
123
+ - If `git worktree add` fails with "already exists", treat it as ready and continue.
124
+ - Only prepare worktrees for the **impacted** repos in the graph, not every repo in the manifest.
125
+ - Record in `execution-plan.md` which worktrees were created (path + branch).
126
+
127
+ After this, each agent's `writeBoundary` (`.sessions/<ISSUE-ID>/<repo>/`) actually exists.
128
+
96
129
  ## Step 6 — Spawn ephemeral agents (Task tool)
97
130
 
98
131
  Execute the DAG respecting `dependsOn`:
@@ -94,6 +94,39 @@ Ver `agents/CONTEXT-CONTRACT.md` para el formato exacto. En resumen:
94
94
  - **limits**: `contextPolicy` (por defecto `select-do-not-dump`), `maxFilesPerWorker`
95
95
  - **return**: summary, changes, evidence, tests, unresolved, confidence
96
96
 
97
+ ## Paso 5b — Preparar los worktrees de la sesión (vía git, no Node)
98
+
99
+ Antes de spawnear cualquier agente, crea un **git worktree aislado por repositorio
100
+ impactado** (sólo los del grafo), para que cada implementer tenga dónde escribir sin tocar
101
+ el repo principal. Usa `base_path` (de `ai.properties.md`) y el `<ISSUE-ID>`.
102
+
103
+ Para cada repositorio impactado `<repo>`:
104
+
105
+ 1. Si `.sessions/<ISSUE-ID>/<repo>/` ya existe, **sáltalo** (worktree listo).
106
+ 2. Chequea si la branch `feature/<ISSUE-ID>` ya existe en el repo:
107
+ ```bash
108
+ git -C "{base_path}/<repo>" rev-parse --verify --quiet "feature/<ISSUE-ID>"
109
+ ```
110
+ 3. Crea el worktree desde el repo principal:
111
+ - si la branch **no** existe (créala en el worktree):
112
+ ```bash
113
+ git -C "{base_path}/<repo>" worktree add -b "feature/<ISSUE-ID>" \
114
+ "$(pwd)/.sessions/<ISSUE-ID>/<repo>"
115
+ ```
116
+ - si la branch **ya** existe (reutilízala):
117
+ ```bash
118
+ git -C "{base_path}/<repo>" worktree add \
119
+ "$(pwd)/.sessions/<ISSUE-ID>/<repo>" "feature/<ISSUE-ID>"
120
+ ```
121
+
122
+ Reglas:
123
+ - **Nunca** hagas `checkout` en el repo principal (`{base_path}/<repo>`) — el worktree aísla todo.
124
+ - Si `git worktree add` falla con "already exists", trátalo como listo y continúa.
125
+ - Sólo prepara worktrees de los repos **impactados** del grafo, no de todos los del manifiesto.
126
+ - Registra en `execution-plan.md` qué worktrees se crearon (path + branch).
127
+
128
+ Tras esto, el `writeBoundary` de cada agente (`.sessions/<ISSUE-ID>/<repo>/`) existe de verdad.
129
+
97
130
  ## Paso 6 — Spawnear los agentes efímeros (Task tool)
98
131
 
99
132
  Ejecuta el DAG respetando `dependsOn`:
@@ -94,6 +94,39 @@ Veja `agents/CONTEXT-CONTRACT.md` para o formato exato. Em resumo:
94
94
  - **limits**: `contextPolicy` (padrão `select-do-not-dump`), `maxFilesPerWorker`
95
95
  - **return**: summary, changes, evidence, tests, unresolved, confidence
96
96
 
97
+ ## Passo 5b — Preparar os worktrees da sessão (via git, não Node)
98
+
99
+ Antes de spawnar qualquer agente, crie um **git worktree isolado por repositório
100
+ impactado** (só os do grafo), para que cada implementer tenha onde escrever sem tocar no
101
+ repo principal. Use `base_path` (de `ai.properties.md`) e o `<ISSUE-ID>`.
102
+
103
+ Para cada repositório impactado `<repo>`:
104
+
105
+ 1. Se `.sessions/<ISSUE-ID>/<repo>/` já existir, **pule** (worktree já preparado).
106
+ 2. Descubra se a branch `feature/<ISSUE-ID>` já existe no repo:
107
+ ```bash
108
+ git -C "{base_path}/<repo>" rev-parse --verify --quiet "feature/<ISSUE-ID>"
109
+ ```
110
+ 3. Crie o worktree a partir do repo principal:
111
+ - se a branch **não** existe (cria a branch no worktree):
112
+ ```bash
113
+ git -C "{base_path}/<repo>" worktree add -b "feature/<ISSUE-ID>" \
114
+ "$(pwd)/.sessions/<ISSUE-ID>/<repo>"
115
+ ```
116
+ - se a branch **já** existe (reaproveita):
117
+ ```bash
118
+ git -C "{base_path}/<repo>" worktree add \
119
+ "$(pwd)/.sessions/<ISSUE-ID>/<repo>" "feature/<ISSUE-ID>"
120
+ ```
121
+
122
+ Regras:
123
+ - **Nunca** faça `checkout` no repo principal (`{base_path}/<repo>`) — o worktree isola tudo.
124
+ - Se `git worktree add` falhar por "already exists", trate como já preparado e siga.
125
+ - Só prepare worktrees dos repos **impactados** pelo grafo, não de todos do manifesto.
126
+ - Registre no `execution-plan.md` quais worktrees foram criados (path + branch).
127
+
128
+ Depois disso, o `writeBoundary` de cada agente (`.sessions/<ISSUE-ID>/<repo>/`) existe de fato.
129
+
97
130
  ## Passo 6 — Spawnar os agentes efêmeros (Task tool)
98
131
 
99
132
  Execute o DAG respeitando `dependsOn`:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thatix.io/context-first-agents-cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -93,6 +93,39 @@ See `agents/CONTEXT-CONTRACT.md` for the exact shape. In short:
93
93
  - **limits**: `contextPolicy` (default `select-do-not-dump`), `maxFilesPerWorker`
94
94
  - **return**: summary, changes, evidence, tests, unresolved questions, confidence
95
95
 
96
+ ## Step 5b — Prepare the session worktrees (via git, not Node)
97
+
98
+ Before spawning any agent, create an **isolated git worktree per impacted repository**
99
+ (only the ones in the graph), so each implementer has a place to write without touching
100
+ the main repo. Use `base_path` (from `ai.properties.md`) and the `<ISSUE-ID>`.
101
+
102
+ For each impacted repository `<repo>`:
103
+
104
+ 1. If `.sessions/<ISSUE-ID>/<repo>/` already exists, **skip** (worktree ready).
105
+ 2. Check whether branch `feature/<ISSUE-ID>` already exists in the repo:
106
+ ```bash
107
+ git -C "{base_path}/<repo>" rev-parse --verify --quiet "feature/<ISSUE-ID>"
108
+ ```
109
+ 3. Create the worktree from the main repo:
110
+ - if the branch does **not** exist (create it in the worktree):
111
+ ```bash
112
+ git -C "{base_path}/<repo>" worktree add -b "feature/<ISSUE-ID>" \
113
+ "$(pwd)/.sessions/<ISSUE-ID>/<repo>"
114
+ ```
115
+ - if the branch **already** exists (reuse it):
116
+ ```bash
117
+ git -C "{base_path}/<repo>" worktree add \
118
+ "$(pwd)/.sessions/<ISSUE-ID>/<repo>" "feature/<ISSUE-ID>"
119
+ ```
120
+
121
+ Rules:
122
+ - **Never** `checkout` in the main repo (`{base_path}/<repo>`) — the worktree isolates everything.
123
+ - If `git worktree add` fails with "already exists", treat it as ready and continue.
124
+ - Only prepare worktrees for the **impacted** repos in the graph, not every repo in the manifest.
125
+ - Record in `execution-plan.md` which worktrees were created (path + branch).
126
+
127
+ After this, each agent's `writeBoundary` (`.sessions/<ISSUE-ID>/<repo>/`) actually exists.
128
+
96
129
  ## Step 6 — Spawn ephemeral agents (Task tool)
97
130
 
98
131
  Execute the DAG respecting `dependsOn`:
@@ -94,6 +94,39 @@ Ver `agents/CONTEXT-CONTRACT.md` para el formato exacto. En resumen:
94
94
  - **limits**: `contextPolicy` (por defecto `select-do-not-dump`), `maxFilesPerWorker`
95
95
  - **return**: summary, changes, evidence, tests, unresolved, confidence
96
96
 
97
+ ## Paso 5b — Preparar los worktrees de la sesión (vía git, no Node)
98
+
99
+ Antes de spawnear cualquier agente, crea un **git worktree aislado por repositorio
100
+ impactado** (sólo los del grafo), para que cada implementer tenga dónde escribir sin tocar
101
+ el repo principal. Usa `base_path` (de `ai.properties.md`) y el `<ISSUE-ID>`.
102
+
103
+ Para cada repositorio impactado `<repo>`:
104
+
105
+ 1. Si `.sessions/<ISSUE-ID>/<repo>/` ya existe, **sáltalo** (worktree listo).
106
+ 2. Chequea si la branch `feature/<ISSUE-ID>` ya existe en el repo:
107
+ ```bash
108
+ git -C "{base_path}/<repo>" rev-parse --verify --quiet "feature/<ISSUE-ID>"
109
+ ```
110
+ 3. Crea el worktree desde el repo principal:
111
+ - si la branch **no** existe (créala en el worktree):
112
+ ```bash
113
+ git -C "{base_path}/<repo>" worktree add -b "feature/<ISSUE-ID>" \
114
+ "$(pwd)/.sessions/<ISSUE-ID>/<repo>"
115
+ ```
116
+ - si la branch **ya** existe (reutilízala):
117
+ ```bash
118
+ git -C "{base_path}/<repo>" worktree add \
119
+ "$(pwd)/.sessions/<ISSUE-ID>/<repo>" "feature/<ISSUE-ID>"
120
+ ```
121
+
122
+ Reglas:
123
+ - **Nunca** hagas `checkout` en el repo principal (`{base_path}/<repo>`) — el worktree aísla todo.
124
+ - Si `git worktree add` falla con "already exists", trátalo como listo y continúa.
125
+ - Sólo prepara worktrees de los repos **impactados** del grafo, no de todos los del manifiesto.
126
+ - Registra en `execution-plan.md` qué worktrees se crearon (path + branch).
127
+
128
+ Tras esto, el `writeBoundary` de cada agente (`.sessions/<ISSUE-ID>/<repo>/`) existe de verdad.
129
+
97
130
  ## Paso 6 — Spawnear los agentes efímeros (Task tool)
98
131
 
99
132
  Ejecuta el DAG respetando `dependsOn`:
@@ -94,6 +94,39 @@ Veja `agents/CONTEXT-CONTRACT.md` para o formato exato. Em resumo:
94
94
  - **limits**: `contextPolicy` (padrão `select-do-not-dump`), `maxFilesPerWorker`
95
95
  - **return**: summary, changes, evidence, tests, unresolved, confidence
96
96
 
97
+ ## Passo 5b — Preparar os worktrees da sessão (via git, não Node)
98
+
99
+ Antes de spawnar qualquer agente, crie um **git worktree isolado por repositório
100
+ impactado** (só os do grafo), para que cada implementer tenha onde escrever sem tocar no
101
+ repo principal. Use `base_path` (de `ai.properties.md`) e o `<ISSUE-ID>`.
102
+
103
+ Para cada repositório impactado `<repo>`:
104
+
105
+ 1. Se `.sessions/<ISSUE-ID>/<repo>/` já existir, **pule** (worktree já preparado).
106
+ 2. Descubra se a branch `feature/<ISSUE-ID>` já existe no repo:
107
+ ```bash
108
+ git -C "{base_path}/<repo>" rev-parse --verify --quiet "feature/<ISSUE-ID>"
109
+ ```
110
+ 3. Crie o worktree a partir do repo principal:
111
+ - se a branch **não** existe (cria a branch no worktree):
112
+ ```bash
113
+ git -C "{base_path}/<repo>" worktree add -b "feature/<ISSUE-ID>" \
114
+ "$(pwd)/.sessions/<ISSUE-ID>/<repo>"
115
+ ```
116
+ - se a branch **já** existe (reaproveita):
117
+ ```bash
118
+ git -C "{base_path}/<repo>" worktree add \
119
+ "$(pwd)/.sessions/<ISSUE-ID>/<repo>" "feature/<ISSUE-ID>"
120
+ ```
121
+
122
+ Regras:
123
+ - **Nunca** faça `checkout` no repo principal (`{base_path}/<repo>`) — o worktree isola tudo.
124
+ - Se `git worktree add` falhar por "already exists", trate como já preparado e siga.
125
+ - Só prepare worktrees dos repos **impactados** pelo grafo, não de todos do manifesto.
126
+ - Registre no `execution-plan.md` quais worktrees foram criados (path + branch).
127
+
128
+ Depois disso, o `writeBoundary` de cada agente (`.sessions/<ISSUE-ID>/<repo>/`) existe de fato.
129
+
97
130
  ## Passo 6 — Spawnar os agentes efêmeros (Task tool)
98
131
 
99
132
  Execute o DAG respeitando `dependsOn`: