opencastle 0.10.1 → 0.10.3

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.
Files changed (39) hide show
  1. package/README.md +8 -17
  2. package/dist/cli/detect.d.ts +6 -0
  3. package/dist/cli/detect.d.ts.map +1 -1
  4. package/dist/cli/detect.js +133 -0
  5. package/dist/cli/detect.js.map +1 -1
  6. package/dist/cli/detect.test.js +119 -1
  7. package/dist/cli/detect.test.js.map +1 -1
  8. package/dist/cli/init.d.ts.map +1 -1
  9. package/dist/cli/init.js +7 -9
  10. package/dist/cli/init.js.map +1 -1
  11. package/dist/cli/prompt.d.ts +8 -0
  12. package/dist/cli/prompt.d.ts.map +1 -1
  13. package/dist/cli/prompt.js +81 -20
  14. package/dist/cli/prompt.js.map +1 -1
  15. package/dist/cli/prompt.test.d.ts +2 -0
  16. package/dist/cli/prompt.test.d.ts.map +1 -0
  17. package/dist/cli/prompt.test.js +58 -0
  18. package/dist/cli/prompt.test.js.map +1 -0
  19. package/dist/cli/types.d.ts +1 -1
  20. package/dist/cli/types.d.ts.map +1 -1
  21. package/dist/cli/update.d.ts.map +1 -1
  22. package/dist/cli/update.js +2 -8
  23. package/dist/cli/update.js.map +1 -1
  24. package/dist/orchestrator/plugins/figma/config.d.ts.map +1 -1
  25. package/dist/orchestrator/plugins/figma/config.js +1 -3
  26. package/dist/orchestrator/plugins/figma/config.js.map +1 -1
  27. package/package.json +1 -1
  28. package/src/cli/detect.test.ts +133 -1
  29. package/src/cli/detect.ts +144 -0
  30. package/src/cli/init.ts +8 -9
  31. package/src/cli/prompt.test.ts +66 -0
  32. package/src/cli/prompt.ts +100 -22
  33. package/src/cli/types.ts +1 -1
  34. package/src/cli/update.ts +2 -8
  35. package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
  36. package/src/orchestrator/agents/team-lead.agent.md +18 -12
  37. package/src/orchestrator/instructions/general.instructions.md +12 -8
  38. package/src/orchestrator/plugins/figma/config.ts +1 -3
  39. package/src/orchestrator/skills/agent-hooks/SKILL.md +6 -4
package/src/cli/update.ts CHANGED
@@ -7,7 +7,7 @@ import { TECH_PLUGINS, TEAM_PLUGINS } from '../orchestrator/plugins/index.js'
7
7
  import { IDE_ADAPTERS, VALID_IDES } from './adapters/index.js'
8
8
  import { getRequiredMcpEnvVars, updateSkillMatrixFile } from './stack-config.js'
9
9
  import { rebuildMcpConfig } from './mcp.js'
10
- import { detectRepoInfo, mergeStackIntoRepoInfo } from './detect.js'
10
+ import { detectRepoInfo, mergeStackIntoRepoInfo, buildDetectedToolsSet } from './detect.js'
11
11
  import type { CliContext, IdeChoice, TechTool, TeamTool, StackConfig } from './types.js'
12
12
 
13
13
  export default async function update({
@@ -75,13 +75,7 @@ export default async function update({
75
75
  let removedTools: string[] = []
76
76
 
77
77
  if (wantsReconfigure) {
78
- const detectedTools = new Set([
79
- ...(repoInfo.cms ?? []),
80
- ...(repoInfo.databases ?? []),
81
- ...(repoInfo.deployment ?? []),
82
- ...(repoInfo.monorepo ? [repoInfo.monorepo] : []),
83
- ...((repoInfo.frameworks ?? []).map((f) => (f === 'next' ? 'nextjs' : f))),
84
- ])
78
+ const detectedTools = buildDetectedToolsSet(repoInfo)
85
79
 
86
80
  const currentTech = new Set(oldStack?.techTools ?? [])
87
81
  const currentTeam = new Set(oldStack?.teamTools ?? [])
@@ -1,25 +1,25 @@
1
1
  {
2
- "hash": "3f0edba6",
2
+ "hash": "815792e6",
3
3
  "configHash": "30f8ea04",
4
- "lockfileHash": "46ec4540",
5
- "browserHash": "a491603a",
4
+ "lockfileHash": "44ee7e5a",
5
+ "browserHash": "2bd8086a",
6
6
  "optimized": {
7
7
  "astro > cssesc": {
8
8
  "src": "../../../../../node_modules/cssesc/cssesc.js",
9
9
  "file": "astro___cssesc.js",
10
- "fileHash": "53bab571",
10
+ "fileHash": "de3913dc",
11
11
  "needsInterop": true
12
12
  },
13
13
  "astro > aria-query": {
14
14
  "src": "../../../../../node_modules/aria-query/lib/index.js",
15
15
  "file": "astro___aria-query.js",
16
- "fileHash": "b89dc7f1",
16
+ "fileHash": "4d9cf017",
17
17
  "needsInterop": true
18
18
  },
19
19
  "astro > axobject-query": {
20
20
  "src": "../../../../../node_modules/axobject-query/lib/index.js",
21
21
  "file": "astro___axobject-query.js",
22
- "fileHash": "184eaa9e",
22
+ "fileHash": "fe9c9069",
23
23
  "needsInterop": true
24
24
  }
25
25
  },
@@ -97,10 +97,11 @@ Synchronous — blocks until result. Use when:
97
97
 
98
98
  Call with a detailed prompt including objective, file paths, acceptance criteria, and what to return in the result.
99
99
 
100
- **After each sub-agent returns**, log immediately:
100
+ **After each sub-agent returns**, log the delegation record before doing anything else (before review, before verification):
101
101
  ```bash
102
- echo '{"timestamp":"...","session_id":"<branch>","agent":"...","model":"...","tier":"...","mechanism":"sub-agent","outcome":"...","retries":0,"phase":N,"file_partition":["..."]}' >> .github/customizations/logs/delegations.ndjson
102
+ echo '{"timestamp":"<ISO-NOW>","session_id":"<branch>","agent":"<name>","model":"<model>","tier":"<tier>","mechanism":"sub-agent","linear_issue":"<issue-or-N/A>","outcome":"<success|partial|failed>","retries":0,"phase":<N>,"file_partition":["<paths>"]}' >> .github/customizations/logs/delegations.ndjson
103
103
  ```
104
+ Verify: `tail -1 .github/customizations/logs/delegations.ndjson`
104
105
 
105
106
  ### Background Agents — Delegate Session
106
107
 
@@ -112,10 +113,11 @@ Async in isolated Git worktree. Use when:
112
113
 
113
114
  Spawn via: Delegate Session → Background → Select agent → Enter prompt with full self-contained context (they cannot ask follow-ups).
114
115
 
115
- **After spawning**, log immediately (with `"outcome":"pending"`):
116
+ **After spawning**, log the delegation record before spawning another agent or doing any other work:
116
117
  ```bash
117
- echo '{"timestamp":"...","session_id":"<branch>","agent":"...","model":"...","tier":"...","mechanism":"background","outcome":"pending","retries":0,"phase":N,"file_partition":["..."]}' >> .github/customizations/logs/delegations.ndjson
118
+ echo '{"timestamp":"<ISO-NOW>","session_id":"<branch>","agent":"<name>","model":"<model>","tier":"<tier>","mechanism":"background","linear_issue":"<issue-or-N/A>","outcome":"pending","retries":0,"phase":<N>,"file_partition":["<paths>"]}' >> .github/customizations/logs/delegations.ndjson
118
119
  ```
120
+ Verify: `tail -1 .github/customizations/logs/delegations.ndjson`
119
121
 
120
122
  **Rule of thumb:** Sub-agents for the critical path. Background agents for parallel work off the critical path.
121
123
 
@@ -196,7 +198,7 @@ For complex tasks (score 5+), load the **decomposition** skill for the Delegatio
196
198
  For each task:
197
199
  1. Move issue → In Progress
198
200
  2. Delegate to specialist agent
199
- 3. Log delegation to delegations.ndjson (immediately)
201
+ 3. Log delegation to delegations.ndjson (immediately — verify with `tail -1`)
200
202
  4. Monitor for drift (load orchestration-protocols skill)
201
203
  5. Verify output:
202
204
  - Changed files within partition
@@ -239,14 +241,18 @@ See [shared-delivery-phase.md](../agent-workflows/shared-delivery-phase.md) for
239
241
 
240
242
  ## Observability
241
243
 
242
- Delegation logging happens **inline with each delegation** (see § Delegation above). Additionally:
244
+ > **⛔ HARD GATE ALL observability logging is mandatory.** No record type is optional.
245
+ > The Session Guard will flag missing records, but do not rely on it — log inline as you go.
243
246
 
244
- - Session records `sessions.ndjson` (one per task, before yielding to user)
245
- - Fast reviews → `reviews.ndjson`
246
- - Panel reviews `panels.ndjson`
247
- - Disputes `disputes.ndjson`
247
+ | Record | File | When to log | Timing |
248
+ |--------|------|-------------|--------|
249
+ | **Session** | `sessions.ndjson` | Every session — always | Before yielding to user |
250
+ | **Delegation** | `delegations.ndjson` | After each `runSubagent` / background spawn | **Inline** — immediately after each delegation, before review |
251
+ | **Fast review** | `reviews.ndjson` | After each fast review | After review completes |
252
+ | **Panel** | `panels.ndjson` | After each panel majority vote | After panel completes |
253
+ | **Dispute** | `disputes.ndjson` | After each dispute is created | When dispute is filed |
248
254
 
249
- The **Session Guard** verifies completeness as your last action. Pass it: task description, delegation list, whether reviews/panels ran, retries, discoveries, files changed, commit/branch status.
255
+ **Self-check before calling Session Guard:** Count delegations, reviews, and panels performed count records written numbers must match for each type. If any count is off, fix it before calling the guard.
250
256
 
251
257
  ## Rules
252
258
 
@@ -260,7 +266,7 @@ The **Session Guard** verifies completeness as your last action. Pass it: task d
260
266
  8. Never proceed to dependent task until prerequisite is verified
261
267
  9. Sub-agents must not spawn other sub-agents (no recursive delegation)
262
268
  10. Never push to `main` — feature branch → PR → human merges
263
- 11. Log every delegation inline — do not defer to session end
269
+ 11. Log every delegation inline — immediately after each `runSubagent` or background spawn, not at session end
264
270
  12. Steer early — don't wait until an agent finishes to redirect when you spot drift
265
271
  13. Never exceed session budget without checkpointing — context degrades after 8+ delegations
266
272
  14. Read `LESSONS-LEARNED.md` before delegating — include relevant lessons in prompts
@@ -181,35 +181,39 @@ Append one JSON line per task using `echo '...' >> <file>`. When the Team Lead w
181
181
  echo '{"timestamp":"2026-03-01T14:00:00Z","agent":"Developer","model":"claude-opus-4-6","task":"Fix login redirect bug","outcome":"success","duration_min":15,"files_changed":3,"retries":0,"lessons_added":[],"discoveries":[]}' >> .github/customizations/logs/sessions.ndjson
182
182
  ```
183
183
 
184
- **Delegation record** (Team Lead only, after each delegation):
184
+ **Delegation record** (Team Lead only, **immediately after each delegation — not at session end**):
185
185
  ```bash
186
186
  echo '{"timestamp":"2026-03-01T14:00:00Z","session_id":"feat/prj-57","agent":"Developer","model":"gpt-5.3-codex","tier":"fast","mechanism":"sub-agent","linear_issue":"PRJ-57","outcome":"success","retries":0,"phase":2,"file_partition":["src/components/"]}' >> .github/customizations/logs/delegations.ndjson
187
187
  ```
188
+ Verify: `tail -1 .github/customizations/logs/delegations.ndjson`
188
189
 
189
- **Fast review record** (Team Lead, after each fast review):
190
+ **Fast review record** (Team Lead, **immediately after each fast review**):
190
191
  ```bash
191
192
  echo '{"timestamp":"2026-03-01T14:30:00Z","linear_issue":"PRJ-42","agent":"Developer","reviewer_model":"gpt-5-mini","verdict":"pass","attempt":1,"issues_critical":0,"issues_major":0,"issues_minor":2,"confidence":"high","escalated":false,"duration_sec":45}' >> .github/customizations/logs/reviews.ndjson
192
193
  ```
194
+ Verify: `tail -1 .github/customizations/logs/reviews.ndjson`
193
195
 
194
- **Panel record** (after each panel majority vote):
196
+ **Panel record** (Panel runner, **immediately after each panel majority vote**):
195
197
  ```bash
196
198
  echo '{"timestamp":"2026-03-01T15:00:00Z","panel_key":"auth-review","verdict":"pass","pass_count":2,"block_count":1,"must_fix":0,"should_fix":3,"reviewer_model":"claude-opus-4-6","weighted":false,"attempt":1,"linear_issue":"PRJ-42","artifacts_count":5}' >> .github/customizations/logs/panels.ndjson
197
199
  ```
200
+ Verify: `tail -1 .github/customizations/logs/panels.ndjson`
198
201
 
199
- **Dispute record** (Team Lead, after each dispute):
202
+ **Dispute record** (Team Lead, **immediately after each dispute**):
200
203
  ```bash
201
204
  echo '{"timestamp":"2026-03-01T16:00:00Z","dispute_id":"DSP-001","linear_issue":"PRJ-42","priority":"high","trigger":"panel-3x-block","implementing_agent":"Developer","reviewing_agents":["Reviewer","Panel (3x)"],"total_attempts":6,"est_tokens_spent":120000,"status":"pending","resolution_option_chosen":null,"resolved_at":null}' >> .github/customizations/logs/disputes.ndjson
202
205
  ```
206
+ Verify: `tail -1 .github/customizations/logs/disputes.ndjson`
203
207
 
204
208
  ### Pre-Response Logging Checklist
205
209
 
206
210
  **STOP before responding to the user.** Verify each applicable item:
207
211
 
208
212
  - [ ] **Session logged** — `sessions.ndjson` has a new line for this session (ALWAYS required)
209
- - [ ] **Delegations logged** — `delegations.ndjson` has a line for each delegation (Team Lead only)
210
- - [ ] **Reviews logged** — `reviews.ndjson` has a line for each fast review performed (if any)
211
- - [ ] **Panels logged** — `panels.ndjson` has a line for each panel review performed (if any)
212
- - [ ] **Disputes logged** — `disputes.ndjson` has a line for each dispute created (if any)
213
+ - [ ] **Delegations logged** — `delegations.ndjson` has a line for **each** delegation (Team Lead only). Count delegations → count records → must match
214
+ - [ ] **Reviews logged** — `reviews.ndjson` has a line for **each** fast review performed. Count reviews → count records → must match
215
+ - [ ] **Panels logged** — `panels.ndjson` has a line for **each** panel review performed. Count panels → count records → must match
216
+ - [ ] **Disputes logged** — `disputes.ndjson` has a line for **each** dispute created. Count disputes → count records → must match
213
217
 
214
218
  If ANY required log is missing, append it NOW before responding.
215
219
 
@@ -13,9 +13,7 @@ export const config: PluginConfig = {
13
13
  type: 'stdio',
14
14
  command: 'npx',
15
15
  args: ['-y', '@anthropic/figma-mcp@latest'],
16
- env: {
17
- FIGMA_ACCESS_TOKEN: '${FIGMA_ACCESS_TOKEN}',
18
- },
16
+ envFile: '${workspaceFolder}/.env'
19
17
  },
20
18
  authType: 'env-token',
21
19
  envVars: [
@@ -111,11 +111,12 @@ Pre-Delegate:
111
111
 
112
112
  ### Actions
113
113
 
114
- 0. **Log the delegation NOW** — Append a record to `.github/customizations/logs/delegations.ndjson` immediately. Do this BEFORE review or verification — logging must not depend on review passing.
114
+ 0. **Log the delegation** — Append a record to `.github/customizations/logs/delegations.ndjson` **before** proceeding to review or verification.
115
115
  ```bash
116
- echo '{"timestamp":"...","session_id":"<branch>","agent":"...","model":"...","tier":"...","mechanism":"sub-agent","outcome":"...","retries":0,"phase":N,"file_partition":["..."]}' >> .github/customizations/logs/delegations.ndjson
116
+ echo '{"timestamp":"...","session_id":"<branch>","agent":"...","model":"...","tier":"...","mechanism":"sub-agent","linear_issue":"<issue-or-N/A>","outcome":"...","retries":0,"phase":N,"file_partition":["..."]}' >> .github/customizations/logs/delegations.ndjson
117
117
  ```
118
- 1. **Fast review (mandatory)** — Run the `fast-review` skill against the agent's output. This is a **non-skippable gate**. See the fast-review skill for the full procedure (single reviewer sub-agent, automatic retry, escalation). Only after the fast review passes do you proceed to the remaining post-delegate actions below.
118
+ Verify: `tail -1 .github/customizations/logs/delegations.ndjson`
119
+ 1. **Fast review (mandatory)** — Run the `fast-review` skill against the agent's output. This is a **non-skippable gate**. See the fast-review skill for the full procedure (single reviewer sub-agent, automatic retry, escalation). Log the review to `reviews.ndjson` immediately after. Only after the fast review passes do you proceed to the remaining post-delegate actions below.
119
120
  2. **Verify output** — Read changed files. Check that changes stay within the agent's file partition.
120
121
  2. **Run verification** — Execute appropriate checks: lint, type-check, tests, or visual inspection.
121
122
  3. **Check acceptance criteria** — Compare output against the tracker issue's acceptance criteria. Each criterion must be independently verified.
@@ -127,11 +128,12 @@ Pre-Delegate:
127
128
 
128
129
  ```
129
130
  Post-Delegate:
130
- ☐ Delegation logged to delegations.ndjson (FIRSTbefore anything else)
131
+ ☐ Delegation logged to delegations.ndjson (before review verify with tail -1)
131
132
  ☐ Changed files reviewed
132
133
  ☐ Files within partition
133
134
  ☐ Lint/test/build passes
134
135
  ☐ Fast review PASS (mandatory — load fast-review skill)
136
+ ☐ Review logged to reviews.ndjson (verify with tail -1)
135
137
  ☐ Acceptance criteria met
136
138
  ☐ Discovered issues tracked (not ignored)
137
139
  ☐ Lessons captured (if retries occurred)