opencastle 1.6.2 → 1.6.4
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.
- package/README.md +9 -9
- package/bin/cli.mjs +19 -12
- package/dist/cli/adapters/adapter-contract.test.js +1 -1
- package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
- package/dist/cli/adapters/single-file-base.js +2 -12
- package/dist/cli/adapters/single-file-base.js.map +1 -1
- package/dist/cli/add.js +7 -7
- package/dist/cli/add.js.map +1 -1
- package/dist/cli/baseline.js +6 -6
- package/dist/cli/baseline.js.map +1 -1
- package/dist/cli/bootstrap.d.ts.map +1 -1
- package/dist/cli/bootstrap.js +15 -6
- package/dist/cli/bootstrap.js.map +1 -1
- package/dist/cli/bootstrap.test.js +8 -0
- package/dist/cli/bootstrap.test.js.map +1 -1
- package/dist/cli/ci.d.ts.map +1 -1
- package/dist/cli/ci.js +19 -9
- package/dist/cli/ci.js.map +1 -1
- package/dist/cli/command-namespace.test.js +4 -21
- package/dist/cli/command-namespace.test.js.map +1 -1
- package/dist/cli/convoy/engine.js +3 -3
- package/dist/cli/convoy/engine.js.map +1 -1
- package/dist/cli/convoy/engine.test.js +1 -1
- package/dist/cli/convoy/engine.test.js.map +1 -1
- package/dist/cli/convoy/read-model.d.ts +8 -15
- package/dist/cli/convoy/read-model.d.ts.map +1 -1
- package/dist/cli/convoy/read-model.js +9 -68
- package/dist/cli/convoy/read-model.js.map +1 -1
- package/dist/cli/convoy/read-model.test.js +6 -25
- package/dist/cli/convoy/read-model.test.js.map +1 -1
- package/dist/cli/convoy/spec-builder.d.ts +2 -2
- package/dist/cli/convoy/spec-builder.d.ts.map +1 -1
- package/dist/cli/convoy/spec-builder.js +3 -3
- package/dist/cli/convoy/spec-builder.js.map +1 -1
- package/dist/cli/convoy/spec-builder.test.js +2 -2
- package/dist/cli/convoy/spec-builder.test.js.map +1 -1
- package/dist/cli/convoy-cmd.js +16 -16
- package/dist/cli/convoy-cmd.js.map +1 -1
- package/dist/cli/convoy-cmd.test.js +11 -11
- package/dist/cli/convoy-cmd.test.js.map +1 -1
- package/dist/cli/dashboard.js +3 -3
- package/dist/cli/dashboard.js.map +1 -1
- package/dist/cli/dashboard.test.js +10 -2
- package/dist/cli/dashboard.test.js.map +1 -1
- package/dist/cli/dispatcher.test.js +7 -4
- package/dist/cli/dispatcher.test.js.map +1 -1
- package/dist/cli/docs-accuracy.test.js +5 -1
- package/dist/cli/docs-accuracy.test.js.map +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +17 -42
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/explain.js +2 -2
- package/dist/cli/explain.js.map +1 -1
- package/dist/cli/fleet.js +1 -1
- package/dist/cli/github-report.js +5 -5
- package/dist/cli/github-report.js.map +1 -1
- package/dist/cli/gitignore.js +1 -1
- package/dist/cli/gitignore.js.map +1 -1
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +27 -10
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/layers.js +4 -4
- package/dist/cli/layers.js.map +1 -1
- package/dist/cli/lesson.js +12 -12
- package/dist/cli/lesson.js.map +1 -1
- package/dist/cli/lessons.d.ts.map +1 -1
- package/dist/cli/lessons.js +11 -7
- package/dist/cli/lessons.js.map +1 -1
- package/dist/cli/managed-block.js +1 -1
- package/dist/cli/managed-block.js.map +1 -1
- package/dist/cli/mcp-audit.js +6 -6
- package/dist/cli/mcp-audit.js.map +1 -1
- package/dist/cli/mcp-audit.test.js +5 -5
- package/dist/cli/mcp-audit.test.js.map +1 -1
- package/dist/cli/pipeline.d.ts +1 -1
- package/dist/cli/pipeline.flow.test.js +77 -77
- package/dist/cli/pipeline.flow.test.js.map +1 -1
- package/dist/cli/pipeline.js +30 -30
- package/dist/cli/pipeline.js.map +1 -1
- package/dist/cli/plan.d.ts +8 -2
- package/dist/cli/plan.d.ts.map +1 -1
- package/dist/cli/plan.js +18 -12
- package/dist/cli/plan.js.map +1 -1
- package/dist/cli/plan.test.js +17 -19
- package/dist/cli/plan.test.js.map +1 -1
- package/dist/cli/plugin.js +8 -8
- package/dist/cli/plugin.js.map +1 -1
- package/dist/cli/promote.js +5 -5
- package/dist/cli/promote.js.map +1 -1
- package/dist/cli/prompt.d.ts.map +1 -1
- package/dist/cli/prompt.js +15 -2
- package/dist/cli/prompt.js.map +1 -1
- package/dist/cli/prompt.test.js +33 -8
- package/dist/cli/prompt.test.js.map +1 -1
- package/dist/cli/remove.js +1 -1
- package/dist/cli/review.js +3 -3
- package/dist/cli/review.js.map +1 -1
- package/dist/cli/run/adapters/index.js +3 -3
- package/dist/cli/run/adapters/index.js.map +1 -1
- package/dist/cli/run/adapters/index.test.js +3 -3
- package/dist/cli/run/adapters/index.test.js.map +1 -1
- package/dist/cli/run/schema.js +3 -3
- package/dist/cli/run/schema.js.map +1 -1
- package/dist/cli/run.js +21 -21
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/run.test.js +3 -3
- package/dist/cli/run.test.js.map +1 -1
- package/dist/cli/stack-config-update.test.js +18 -1
- package/dist/cli/stack-config-update.test.js.map +1 -1
- package/dist/cli/stack-config.d.ts.map +1 -1
- package/dist/cli/stack-config.js +10 -1
- package/dist/cli/stack-config.js.map +1 -1
- package/dist/cli/status.js +9 -9
- package/dist/cli/status.js.map +1 -1
- package/dist/cli/status.test.js +3 -3
- package/dist/cli/status.test.js.map +1 -1
- package/dist/cli/sync-check.js +16 -16
- package/dist/cli/sync-check.js.map +1 -1
- package/dist/cli/sync.js +1 -1
- package/dist/cli/team-ci.test.js +3 -3
- package/dist/cli/team-ci.test.js.map +1 -1
- package/dist/cli/team-commands.test.js +30 -1
- package/dist/cli/team-commands.test.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +34 -66
- package/dist/cli/update.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/adapters/adapter-contract.test.ts +1 -1
- package/src/cli/adapters/single-file-base.ts +2 -11
- package/src/cli/add.ts +7 -7
- package/src/cli/baseline.ts +6 -6
- package/src/cli/bootstrap.test.ts +9 -0
- package/src/cli/bootstrap.ts +16 -6
- package/src/cli/ci.ts +17 -9
- package/src/cli/command-namespace.test.ts +5 -22
- package/src/cli/convoy/engine.test.ts +1 -1
- package/src/cli/convoy/engine.ts +3 -3
- package/src/{orchestrator/prompts/assess-complexity.prompt.md → cli/convoy/prompts/convoy-assess.prompt.md} +0 -3
- package/src/{orchestrator/prompts/fix-convoy.prompt.md → cli/convoy/prompts/convoy-plan-fix.prompt.md} +0 -3
- package/src/{orchestrator/prompts/validate-convoy.prompt.md → cli/convoy/prompts/convoy-plan-review.prompt.md} +0 -3
- package/src/{orchestrator/prompts/generate-convoy.prompt.md → cli/convoy/prompts/convoy-plan.prompt.md} +0 -2
- package/src/{orchestrator/prompts/fix-prd.prompt.md → cli/convoy/prompts/convoy-prd-fix.prompt.md} +0 -3
- package/src/{orchestrator/prompts/validate-prd.prompt.md → cli/convoy/prompts/convoy-prd-review.prompt.md} +0 -3
- package/src/{orchestrator/prompts/generate-prd.prompt.md → cli/convoy/prompts/convoy-prd.prompt.md} +0 -3
- package/src/cli/convoy/read-model.test.ts +5 -29
- package/src/cli/convoy/read-model.ts +11 -71
- package/src/cli/convoy/spec-builder.test.ts +2 -2
- package/src/cli/convoy/spec-builder.ts +4 -4
- package/src/cli/convoy-cmd.test.ts +11 -11
- package/src/cli/convoy-cmd.ts +18 -18
- package/src/cli/dashboard/dashboard.js +2 -4
- package/src/cli/dashboard.test.ts +10 -2
- package/src/cli/dashboard.ts +3 -3
- package/src/cli/dispatcher.test.ts +8 -4
- package/src/cli/docs-accuracy.test.ts +5 -1
- package/src/cli/doctor.ts +17 -43
- package/src/cli/explain.ts +2 -2
- package/src/cli/fleet.ts +1 -1
- package/src/cli/github-report.ts +5 -5
- package/src/cli/gitignore.ts +1 -1
- package/src/cli/init.ts +26 -10
- package/src/cli/layers.ts +4 -4
- package/src/cli/lesson.ts +12 -12
- package/src/cli/lessons.ts +11 -7
- package/src/cli/managed-block.ts +1 -1
- package/src/cli/mcp-audit.test.ts +5 -5
- package/src/cli/mcp-audit.ts +6 -6
- package/src/cli/pipeline.flow.test.ts +78 -78
- package/src/cli/pipeline.ts +31 -31
- package/src/cli/plan.test.ts +18 -20
- package/src/cli/plan.ts +18 -12
- package/src/cli/plugin.ts +8 -8
- package/src/cli/promote.ts +5 -5
- package/src/cli/prompt.test.ts +41 -13
- package/src/cli/prompt.ts +14 -2
- package/src/cli/remove.ts +1 -1
- package/src/cli/review.ts +3 -3
- package/src/cli/run/adapters/index.test.ts +3 -3
- package/src/cli/run/adapters/index.ts +3 -3
- package/src/cli/run/schema.ts +3 -3
- package/src/cli/run.test.ts +3 -3
- package/src/cli/run.ts +21 -21
- package/src/cli/stack-config-update.test.ts +22 -1
- package/src/cli/stack-config.ts +9 -1
- package/src/cli/status.test.ts +3 -3
- package/src/cli/status.ts +9 -9
- package/src/cli/sync-check.ts +16 -16
- package/src/cli/sync.ts +1 -1
- package/src/cli/team-ci.test.ts +3 -3
- package/src/cli/team-commands.test.ts +32 -1
- package/src/cli/update.ts +32 -74
- package/src/orchestrator/agent-workflows/README.md +10 -18
- package/src/orchestrator/agent-workflows/data-pipeline.md +7 -140
- package/src/orchestrator/agent-workflows/database-migration.md +7 -153
- package/src/orchestrator/agent-workflows/performance-optimization.md +6 -119
- package/src/orchestrator/agent-workflows/refactoring.md +8 -137
- package/src/orchestrator/agent-workflows/schema-changes.md +8 -159
- package/src/orchestrator/agent-workflows/security-audit.md +7 -142
- package/src/orchestrator/agent-workflows/shared-delivery-phase.md +8 -25
- package/src/orchestrator/agents/architect.agent.md +2 -14
- package/src/orchestrator/agents/content-engineer.agent.md +8 -10
- package/src/orchestrator/agents/data-engineer.agent.md +8 -8
- package/src/orchestrator/agents/developer.agent.md +3 -10
- package/src/orchestrator/agents/devops-expert.agent.md +0 -3
- package/src/orchestrator/agents/performance-expert.agent.md +2 -3
- package/src/orchestrator/agents/security-expert.agent.md +10 -12
- package/src/orchestrator/agents/team-lead.agent.md +31 -75
- package/src/orchestrator/agents/testing-expert.agent.md +3 -6
- package/src/orchestrator/agents/ui-ux-expert.agent.md +1 -4
- package/src/orchestrator/agents/writer.agent.md +0 -3
- package/src/orchestrator/customizations/LESSONS-LEARNED.md +5 -3
- package/src/orchestrator/customizations/README.md +3 -4
- package/src/orchestrator/customizations/agents/agent-registry.md +3 -3
- package/src/orchestrator/customizations/agents/skill-matrix.json +6 -42
- package/src/orchestrator/instructions/general.instructions.md +10 -37
- package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +4 -6
- package/src/orchestrator/prompts/brainstorm.prompt.md +7 -12
- package/src/orchestrator/prompts/bug-fix.prompt.md +19 -100
- package/src/orchestrator/prompts/convoy.prompt.md +20 -0
- package/src/orchestrator/prompts/create-skill.prompt.md +1 -5
- package/src/orchestrator/prompts/implement-feature.prompt.md +22 -93
- package/src/orchestrator/prompts/resolve-pr-comments.prompt.md +1 -5
- package/src/orchestrator/skills/api-patterns/SKILL.md +21 -18
- package/src/orchestrator/skills/deployment-infrastructure/SKILL.md +1 -1
- package/src/orchestrator/skills/fast-review/SKILL.md +28 -65
- package/src/orchestrator/skills/frontend-design/REFERENCE.md +0 -1
- package/src/orchestrator/skills/frontend-design/SKILL.md +3 -1
- package/src/orchestrator/skills/git-workflow/SKILL.md +18 -34
- package/src/orchestrator/skills/panel-majority-vote/SKILL.md +16 -46
- package/src/orchestrator/skills/security-hardening/SKILL.md +20 -19
- package/src/orchestrator/skills/self-improvement/LESSON-CATEGORIES.md +2 -2
- package/src/orchestrator/skills/self-improvement/SKILL.md +21 -46
- package/src/orchestrator/skills/technical-writing/SKILL.md +3 -1
- package/src/orchestrator/skills/technical-writing/TEMPLATES.md +23 -0
- package/src/orchestrator/skills/testing-workflow/SKILL.md +21 -23
- package/src/orchestrator/skills/validation-gates/REFERENCE.md +2 -14
- package/src/orchestrator/skills/validation-gates/SKILL.md +10 -88
- package/dist/cli/log.d.ts +0 -44
- package/dist/cli/log.d.ts.map +0 -1
- package/dist/cli/log.js +0 -336
- package/dist/cli/log.js.map +0 -1
- package/dist/cli/log.test.d.ts +0 -2
- package/dist/cli/log.test.d.ts.map +0 -1
- package/dist/cli/log.test.js +0 -208
- package/dist/cli/log.test.js.map +0 -1
- package/src/cli/log.test.ts +0 -228
- package/src/cli/log.ts +0 -374
- package/src/orchestrator/agent-workflows/bug-fix.md +0 -130
- package/src/orchestrator/agent-workflows/feature-implementation.md +0 -232
- package/src/orchestrator/instructions/ai-optimization.instructions.md +0 -17
- package/src/orchestrator/prompts/quick-refinement.prompt.md +0 -110
- package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +0 -44
- package/src/orchestrator/skills/agent-hooks/SKILL.md +0 -80
- package/src/orchestrator/skills/agent-memory/KNOWLEDGE-GRAPH.md +0 -49
- package/src/orchestrator/skills/agent-memory/SKILL.md +0 -50
- package/src/orchestrator/skills/code-commenting/SKILL.md +0 -18
- package/src/orchestrator/skills/context-map/REFERENCE.md +0 -67
- package/src/orchestrator/skills/context-map/SKILL.md +0 -71
- package/src/orchestrator/skills/decomposition/SKILL.md +0 -103
- package/src/orchestrator/skills/documentation-standards/SKILL.md +0 -33
- package/src/orchestrator/skills/fast-review/REFERENCE.md +0 -28
- package/src/orchestrator/skills/memory-merger/SKILL.md +0 -77
- package/src/orchestrator/skills/observability-logging/LOG-SCHEMA.md +0 -238
- package/src/orchestrator/skills/observability-logging/SKILL.md +0 -73
- package/src/orchestrator/skills/orchestration-protocols/REFERENCE.md +0 -38
- package/src/orchestrator/skills/orchestration-protocols/SKILL.md +0 -120
- package/src/orchestrator/skills/panel-majority-vote/REFERENCE.md +0 -49
- package/src/orchestrator/skills/panel-majority-vote/panel-report.template.md +0 -38
- package/src/orchestrator/skills/performance-optimization/SKILL.md +0 -23
- package/src/orchestrator/skills/project-consistency/SKILL.md +0 -80
- package/src/orchestrator/skills/project-consistency/TEMPLATES.md +0 -35
- package/src/orchestrator/skills/react-development/SKILL.md +0 -24
- package/src/orchestrator/skills/session-checkpoints/CHECKPOINT-TEMPLATE.md +0 -56
- package/src/orchestrator/skills/session-checkpoints/SKILL.md +0 -40
- package/src/orchestrator/skills/team-lead-reference/SKILL.md +0 -126
|
@@ -117,7 +117,7 @@ describe('Claude Code: /oc:<name>', () => {
|
|
|
117
117
|
}
|
|
118
118
|
expect(readFileSync(join(project, '.claude/commands/oc/release.md'), 'utf8')).toContain('RELEASE-PROMPT')
|
|
119
119
|
expect(existsSync(join(project, '.claude/commands/oc/bug-fix.md'))).toBe(true)
|
|
120
|
-
expect(existsSync(join(project, '.claude/commands/oc/workflow-
|
|
120
|
+
expect(existsSync(join(project, '.claude/commands/oc/workflow-refactoring.md'))).toBe(true)
|
|
121
121
|
})
|
|
122
122
|
|
|
123
123
|
it('gives each command the one line Claude Code lists beside it, and nothing else', async () => {
|
|
@@ -135,28 +135,11 @@ describe('Claude Code: /oc:<name>', () => {
|
|
|
135
135
|
expect(release.startsWith('---\ndescription: "Cut a release"\n---\n')).toBe(true)
|
|
136
136
|
expect(release).not.toContain('agent:')
|
|
137
137
|
// A workflow has no frontmatter; its heading is the description.
|
|
138
|
-
expect(readFileSync(join(project, '.claude/commands/oc/workflow-
|
|
139
|
-
/^---\ndescription: "Workflow:
|
|
138
|
+
expect(readFileSync(join(project, '.claude/commands/oc/workflow-refactoring.md'), 'utf8')).toMatch(
|
|
139
|
+
/^---\ndescription: "Workflow: Refactoring"\n---\n/,
|
|
140
140
|
)
|
|
141
141
|
})
|
|
142
142
|
|
|
143
|
-
it('keeps the convoy pipeline steps out of what the model is told it can run', async () => {
|
|
144
|
-
const src = materialize(resolveSources({ pkgRoot, projectRoot: project, stack }), pkgRoot)
|
|
145
|
-
try {
|
|
146
|
-
await (await IDE_ADAPTERS['claude-code']()).install(pkgRoot, project, stack, undefined, src)
|
|
147
|
-
} finally {
|
|
148
|
-
src.dispose()
|
|
149
|
-
}
|
|
150
|
-
const hidden = readdirSync(join(project, '.claude/commands/oc'))
|
|
151
|
-
.filter((f) => readFileSync(join(project, '.claude/commands/oc', f), 'utf8').includes('\ndisable-model-invocation: true\n'))
|
|
152
|
-
.sort()
|
|
153
|
-
// The CLI runs these with their input filled in; nobody chooses them.
|
|
154
|
-
expect(hidden).toEqual(['assess-complexity.md', 'fix-convoy.md', 'fix-prd.md', 'generate-prd.md', 'validate-convoy.md', 'validate-prd.md'])
|
|
155
|
-
// generate-convoy stays listed: the Team Lead plans in the editor by its rules.
|
|
156
|
-
expect(readFileSync(join(project, '.claude/commands/oc/generate-convoy.md'), 'utf8')).not.toContain('disable-model-invocation')
|
|
157
|
-
expect(readFileSync(join(project, '.claude/commands/oc/fix-prd.md'), 'utf8')).toMatch(/^---\ndescription: ".+"\ndisable-model-invocation: true\n---\n/)
|
|
158
|
-
})
|
|
159
|
-
|
|
160
143
|
it('writes each agent as a subagent Claude Code registers: a name and a description', async () => {
|
|
161
144
|
const src = materialize(resolveSources({ pkgRoot, projectRoot: project, stack }), pkgRoot)
|
|
162
145
|
try {
|
|
@@ -166,7 +149,7 @@ describe('Claude Code: /oc:<name>', () => {
|
|
|
166
149
|
}
|
|
167
150
|
const lead = readFileSync(join(project, '.claude/agents/team-lead.agent.md'), 'utf8')
|
|
168
151
|
// Without frontmatter Claude Code never listed one of them.
|
|
169
|
-
expect(lead).toMatch(/^---\nname: team-lead\ndescription: "
|
|
152
|
+
expect(lead).toMatch(/^---\nname: team-lead\ndescription: "Coordinates work[^\n]*"\n---\n/)
|
|
170
153
|
// VS Code's tool names and handoffs mean nothing to it.
|
|
171
154
|
expect(lead).not.toContain('handoffs:')
|
|
172
155
|
expect(lead).not.toContain('tools:')
|
|
@@ -183,7 +166,7 @@ describe('Claude Code: /oc:<name>', () => {
|
|
|
183
166
|
// Their `/bug-fix` and ours, `/oc:bug-fix`, side by side.
|
|
184
167
|
expect(readFileSync(join(project, '.claude/commands/deploy.md'), 'utf8')).toBe(OWN_COMMAND)
|
|
185
168
|
expect(readFileSync(join(project, '.claude/commands/bug-fix.md'), 'utf8')).toBe(OWN_COMMAND)
|
|
186
|
-
expect(readFileSync(join(project, '.claude/commands/oc/bug-fix.md'), 'utf8')).toContain('# Fix Bug')
|
|
169
|
+
expect(readFileSync(join(project, '.claude/commands/oc/bug-fix.md'), 'utf8')).toContain('# Fix a Bug')
|
|
187
170
|
expect(swept.deleted ?? []).toEqual([])
|
|
188
171
|
|
|
189
172
|
const report = await buildCheckReport(pkgRoot, project)
|
|
@@ -1922,7 +1922,7 @@ describe('progress reporting', () => {
|
|
|
1922
1922
|
const text = out.text()
|
|
1923
1923
|
expect(text).toContain('• task-a (failed): compile error in a.ts')
|
|
1924
1924
|
expect(text).toContain('• task-b (skipped): dependency "task-a" failed')
|
|
1925
|
-
expect(text).toContain('Resume with: opencastle convoy resume')
|
|
1925
|
+
expect(text).toContain('Resume with: npx opencastle convoy resume')
|
|
1926
1926
|
})
|
|
1927
1927
|
|
|
1928
1928
|
it('prints gate results with pass/fail indicators', async () => {
|
package/src/cli/convoy/engine.ts
CHANGED
|
@@ -401,8 +401,8 @@ function buildDlqMarkdownEntry(
|
|
|
401
401
|
|
|
402
402
|
/** The heading a ledger starts with: `init` no longer installs the files empty, so the first entry creates them. */
|
|
403
403
|
const LEDGER_TITLE: Record<string, string> = {
|
|
404
|
-
'AGENT-FAILURES.md': '# Agent Failures\n\
|
|
405
|
-
'DISPUTES.md': '# Disputes\n\
|
|
404
|
+
'AGENT-FAILURES.md': '# Agent Failures\n\nConvoy tasks that failed for good, written by the convoy engine; `npx opencastle convoy dashboard` shows each with its run.\n',
|
|
405
|
+
'DISPUTES.md': '# Disputes\n\nConvoy reviews that could not settle on a verdict, written by the convoy engine for a person to decide.\n',
|
|
406
406
|
}
|
|
407
407
|
|
|
408
408
|
function appendLedger(repoRoot: string, file: string, marker: string, entry: string): void {
|
|
@@ -2208,7 +2208,7 @@ function printSummary(progress: Progress, result: ConvoyResult, store: ConvoySto
|
|
|
2208
2208
|
lines.push(` Log: ${rel.startsWith('..') ? result.logPath : rel}`)
|
|
2209
2209
|
}
|
|
2210
2210
|
if (result.status !== 'done') {
|
|
2211
|
-
lines.push(` Resume with: ${c.cyan('opencastle convoy resume')}`)
|
|
2211
|
+
lines.push(` Resume with: ${c.cyan('npx opencastle convoy resume')}`)
|
|
2212
2212
|
}
|
|
2213
2213
|
for (const l of lines) progress.line(l)
|
|
2214
2214
|
}
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
description: 'Size the work in a PRD, score each workstream, and say whether to plan it in one go or as groups planned side by side. Returns JSON.'
|
|
3
3
|
agent: 'Reviewer'
|
|
4
4
|
output: json
|
|
5
|
-
pipeline: true
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
<!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
|
|
9
|
-
|
|
10
7
|
# Assess PRD Complexity
|
|
11
8
|
|
|
12
9
|
Analyze the PRD at the end of this prompt — or, before a PRD exists, the request itself — and answer with a **single JSON object**.
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
description: 'Fix the problems found in a convoy task plan with targeted JSON patches. Goal is the plan as JSON, context is the list of problems.'
|
|
3
3
|
agent: 'Team Lead (OpenCastle)'
|
|
4
4
|
output: json
|
|
5
|
-
pipeline: true
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
<!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
|
|
9
|
-
|
|
10
7
|
# Fix Task Plan
|
|
11
8
|
|
|
12
9
|
You are the Team Lead. The task plan at the end of this prompt has problems. Fix every one with targeted JSON patches.
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
description: 'Review a convoy spec for what code cannot check: missing dependencies, missing or redundant tasks. Answers with a JSON verdict.'
|
|
3
3
|
agent: 'Reviewer'
|
|
4
4
|
output: validation
|
|
5
|
-
pipeline: true
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
<!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
|
|
9
|
-
|
|
10
7
|
# Validate Task Plan
|
|
11
8
|
|
|
12
9
|
You are a senior technical reviewer. Review the convoy spec at the end of this prompt before agents run it.
|
|
@@ -4,8 +4,6 @@ agent: 'Team Lead (OpenCastle)'
|
|
|
4
4
|
output: json
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
<!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
|
|
8
|
-
|
|
9
7
|
# Generate Task Plan
|
|
10
8
|
|
|
11
9
|
You are the Team Lead. Break the work described at the end of this prompt into tasks that agents carry out on their own, several at a time, under OpenCastle's convoy engine (experimental). Answer with a JSON task plan.
|
package/src/{orchestrator/prompts/fix-prd.prompt.md → cli/convoy/prompts/convoy-prd-fix.prompt.md}
RENAMED
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
description: 'Fix the issues a PRD review found. Goal is the PRD, context is the list of issues; answers with the whole corrected PRD.'
|
|
3
3
|
agent: 'Team Lead (OpenCastle)'
|
|
4
4
|
output: prd
|
|
5
|
-
pipeline: true
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
<!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
|
|
9
|
-
|
|
10
7
|
# Fix PRD
|
|
11
8
|
|
|
12
9
|
You are the Team Lead. The PRD at the end of this prompt failed review. Fix **every reported issue** and return the complete, corrected PRD.
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
description: 'Check a PRD for the structure the convoy planner needs. Answers with a JSON verdict: valid, or the issues to fix.'
|
|
3
3
|
agent: 'Reviewer'
|
|
4
4
|
output: validation
|
|
5
|
-
pipeline: true
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
<!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
|
|
9
|
-
|
|
10
7
|
# Validate PRD
|
|
11
8
|
|
|
12
9
|
You are a senior technical reviewer. Check the PRD at the end of this prompt before it is broken into automated agent tasks. A PRD that passes produces clean tasks; one that fails produces bad ones.
|
package/src/{orchestrator/prompts/generate-prd.prompt.md → cli/convoy/prompts/convoy-prd.prompt.md}
RENAMED
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
description: 'Write a Product Requirements Document (PRD) from a feature request. The convoy planner breaks the PRD into agent tasks.'
|
|
3
3
|
agent: 'Team Lead (OpenCastle)'
|
|
4
4
|
output: prd
|
|
5
|
-
pipeline: true
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
<!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
|
|
9
|
-
|
|
10
7
|
# Generate PRD
|
|
11
8
|
|
|
12
9
|
You are the Team Lead. Turn the feature request at the end of this prompt into a Product Requirements Document (PRD) that an automated planner can break into agent tasks. Every section must be **concrete**, **specific** and **implementation-ready**.
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
readRunInsights,
|
|
25
25
|
readRunSpec,
|
|
26
26
|
readRuns,
|
|
27
|
-
readSessions,
|
|
28
27
|
} from './read-model.js'
|
|
29
28
|
|
|
30
29
|
let root: string
|
|
@@ -108,7 +107,7 @@ describe('with no database', () => {
|
|
|
108
107
|
expect(readRun(root, 'x')).toBeNull()
|
|
109
108
|
expect(readEventsSince(root, 'x', 0)).toEqual([])
|
|
110
109
|
expect(isRunAlive(root, 'x')).toBe(false)
|
|
111
|
-
expect(
|
|
110
|
+
expect(readAllSessions(root)).toEqual([])
|
|
112
111
|
expect(readdirSync(join(root, '.opencastle'))).toEqual([])
|
|
113
112
|
})
|
|
114
113
|
})
|
|
@@ -388,28 +387,6 @@ describe('isRunAlive', () => {
|
|
|
388
387
|
})
|
|
389
388
|
})
|
|
390
389
|
|
|
391
|
-
describe('sessions', () => {
|
|
392
|
-
it('reads session records newest first and skips everything else', () => {
|
|
393
|
-
const logs = join(root, '.opencastle', 'logs')
|
|
394
|
-
mkdirSync(logs, { recursive: true })
|
|
395
|
-
writeFileSync(
|
|
396
|
-
join(logs, 'events.ndjson'),
|
|
397
|
-
[
|
|
398
|
-
JSON.stringify({ type: 'session', timestamp: T0, agent: 'Developer', task: 'first', outcome: 'success', duration_min: 3 }),
|
|
399
|
-
'not json',
|
|
400
|
-
JSON.stringify({ type: 'review', timestamp: T1, agent: 'Developer', verdict: 'pass' }),
|
|
401
|
-
JSON.stringify({ type: 'session', timestamp: T2, agent: 'Writer', task: 'second', outcome: 'partial', model: 'm' }),
|
|
402
|
-
'',
|
|
403
|
-
].join('\n'),
|
|
404
|
-
)
|
|
405
|
-
const sessions = readSessions(root)
|
|
406
|
-
expect(sessions.map((s) => s.task)).toEqual(['second', 'first'])
|
|
407
|
-
expect(sessions[0]).toMatchObject({ agent: 'Writer', outcome: 'partial', model: 'm', duration_min: null })
|
|
408
|
-
expect(sessions[1]).toMatchObject({ duration_min: 3, model: null })
|
|
409
|
-
expect(readSessions(root, 1)).toHaveLength(1)
|
|
410
|
-
})
|
|
411
|
-
})
|
|
412
|
-
|
|
413
390
|
describe('findProjectRoot', () => {
|
|
414
391
|
it('walks up to the nearest .opencastle directory', () => {
|
|
415
392
|
const deep = join(root, 'src', 'a', 'b')
|
|
@@ -670,16 +647,15 @@ describe('run insights', () => {
|
|
|
670
647
|
})
|
|
671
648
|
})
|
|
672
649
|
|
|
673
|
-
describe('sessions
|
|
674
|
-
it('
|
|
650
|
+
describe('sessions', () => {
|
|
651
|
+
it('are the engine’s session events, newest first — a log written by hand is not read', () => {
|
|
675
652
|
seedHistory()
|
|
676
653
|
const logs = join(root, '.opencastle', 'logs')
|
|
677
654
|
mkdirSync(logs, { recursive: true })
|
|
678
655
|
writeFileSync(join(logs, 'events.ndjson'), JSON.stringify({ type: 'session', timestamp: at(D1, 45), agent: 'Developer', task: 'by hand', outcome: 'success' }) + '\n')
|
|
679
656
|
const all = readAllSessions(root)
|
|
680
|
-
expect(all.map((s) => [s.source, s.task])).toEqual([['convoy', 'b'], ['
|
|
681
|
-
expect(all[1]).toMatchObject({ convoy_id: null, agent: 'Developer' })
|
|
657
|
+
expect(all.map((s) => [s.source, s.task])).toEqual([['convoy', 'b'], ['convoy', 'a']])
|
|
682
658
|
expect(readEngineSessions(root, 'r2')).toEqual([])
|
|
683
|
-
expect(readAllSessions(root,
|
|
659
|
+
expect(readAllSessions(root, 1)).toHaveLength(1)
|
|
684
660
|
})
|
|
685
661
|
})
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* flag, cache token counts, an adapter column) reads without this file knowing
|
|
17
17
|
* about every addition first.
|
|
18
18
|
*/
|
|
19
|
-
import {
|
|
19
|
+
import { existsSync, statSync } from 'node:fs'
|
|
20
20
|
import { hostname } from 'node:os'
|
|
21
21
|
import { dirname, join, resolve } from 'node:path'
|
|
22
22
|
import { DatabaseSync } from 'node:sqlite'
|
|
@@ -133,13 +133,9 @@ export interface EventRow {
|
|
|
133
133
|
problem: boolean
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
/**
|
|
137
|
-
* A session: a `type: "session"` record appended with `opencastle log`
|
|
138
|
-
* (`source: 'log'`), or the `session` event the engine writes for each task it
|
|
139
|
-
* finishes (`source: 'convoy'`, with the run's id).
|
|
140
|
-
*/
|
|
136
|
+
/** A session: the `session` event the engine writes for each task a convoy finishes. */
|
|
141
137
|
export interface SessionRow {
|
|
142
|
-
source: '
|
|
138
|
+
source: 'convoy'
|
|
143
139
|
convoy_id: string | null
|
|
144
140
|
timestamp: string | null
|
|
145
141
|
agent: string | null
|
|
@@ -159,9 +155,9 @@ type Row = Record<string, unknown>
|
|
|
159
155
|
/**
|
|
160
156
|
* The nearest directory at or above `start` holding `.opencastle/`.
|
|
161
157
|
*
|
|
162
|
-
* The
|
|
163
|
-
*
|
|
164
|
-
*
|
|
158
|
+
* The dashboard used to read the current directory only, so started from
|
|
159
|
+
* `proj/src` it showed nothing while a run from the same place was writing to
|
|
160
|
+
* `proj/.opencastle`.
|
|
165
161
|
*/
|
|
166
162
|
export function findProjectRoot(start: string): string | null {
|
|
167
163
|
let dir = resolve(start)
|
|
@@ -663,71 +659,15 @@ export function isRunAlive(projectRoot: string, convoyId: string): boolean {
|
|
|
663
659
|
})
|
|
664
660
|
}
|
|
665
661
|
|
|
666
|
-
// ── Agent sessions
|
|
667
|
-
|
|
668
|
-
/** Read at most this much of the end of the log; sessions are shown newest first. */
|
|
669
|
-
const SESSION_LOG_TAIL_BYTES = 2 * 1024 * 1024
|
|
670
|
-
|
|
671
|
-
function readTail(path: string, bytes: number): string {
|
|
672
|
-
const fd = openSync(path, 'r')
|
|
673
|
-
try {
|
|
674
|
-
const size = fstatSync(fd).size
|
|
675
|
-
const start = Math.max(0, size - bytes)
|
|
676
|
-
const buf = Buffer.alloc(size - start)
|
|
677
|
-
readSync(fd, buf, 0, buf.length, start)
|
|
678
|
-
const text = buf.toString('utf8')
|
|
679
|
-
// Starting mid-file means the first line is a fragment.
|
|
680
|
-
return start > 0 ? text.slice(text.indexOf('\n') + 1) : text
|
|
681
|
-
} finally {
|
|
682
|
-
closeSync(fd)
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
/** Session records from `.opencastle/logs/events.ndjson`, newest first. */
|
|
687
|
-
export function readSessions(projectRoot: string, limit = 50): SessionRow[] {
|
|
688
|
-
const path = join(projectRoot, '.opencastle', 'logs', 'events.ndjson')
|
|
689
|
-
if (!existsSync(path)) return []
|
|
690
|
-
const out: SessionRow[] = []
|
|
691
|
-
const lines = readTail(path, SESSION_LOG_TAIL_BYTES).split('\n')
|
|
692
|
-
for (let i = lines.length - 1; i >= 0 && out.length < limit; i--) {
|
|
693
|
-
const line = lines[i].trim()
|
|
694
|
-
if (!line) continue
|
|
695
|
-
let rec: unknown
|
|
696
|
-
try {
|
|
697
|
-
rec = JSON.parse(line)
|
|
698
|
-
} catch {
|
|
699
|
-
continue
|
|
700
|
-
}
|
|
701
|
-
if (typeof rec !== 'object' || rec === null) continue
|
|
702
|
-
const r = rec as Row
|
|
703
|
-
if (r.type !== 'session') continue
|
|
704
|
-
out.push({
|
|
705
|
-
source: 'log',
|
|
706
|
-
convoy_id: null,
|
|
707
|
-
timestamp: str(r.timestamp),
|
|
708
|
-
agent: str(r.agent),
|
|
709
|
-
task: str(r.task),
|
|
710
|
-
tracker_issue: str(r.tracker_issue),
|
|
711
|
-
outcome: str(r.outcome),
|
|
712
|
-
model: str(r.model),
|
|
713
|
-
duration_min: num(r.duration_min),
|
|
714
|
-
files_changed: num(r.files_changed),
|
|
715
|
-
retries: num(r.retries),
|
|
716
|
-
})
|
|
717
|
-
}
|
|
718
|
-
return out
|
|
719
|
-
}
|
|
662
|
+
// ── Agent sessions ────────────────────────────────────────────────────────────
|
|
720
663
|
|
|
721
664
|
/**
|
|
722
|
-
* Agent sessions
|
|
723
|
-
*
|
|
724
|
-
*
|
|
725
|
-
* page can say which is which.
|
|
665
|
+
* Agent sessions, newest first: the engine's `session` event for each task a
|
|
666
|
+
* convoy finished. Agents outside a convoy no longer log their sessions by
|
|
667
|
+
* hand — it never happened consistently — so this is the only record.
|
|
726
668
|
*/
|
|
727
669
|
export function readAllSessions(projectRoot: string, limit = 50): SessionRow[] {
|
|
728
|
-
|
|
729
|
-
merged.sort((a, b) => String(b.timestamp ?? '').localeCompare(String(a.timestamp ?? '')))
|
|
730
|
-
return merged.slice(0, limit)
|
|
670
|
+
return readEngineSessions(projectRoot, null, limit)
|
|
731
671
|
}
|
|
732
672
|
|
|
733
673
|
/** The engine's `session` events, newest first: of one run, or of every run when `convoyId` is null. */
|
|
@@ -139,8 +139,8 @@ describe('buildConvoyYaml', () => {
|
|
|
139
139
|
|
|
140
140
|
it('starts with a comment saying how to run it', () => {
|
|
141
141
|
const yaml = buildConvoyYaml(minimalPlan(), SETTINGS)
|
|
142
|
-
expect(yaml.startsWith('# Written by `opencastle convoy`.')).toBe(true)
|
|
143
|
-
expect(yaml).toContain('opencastle convoy run <this file>')
|
|
142
|
+
expect(yaml.startsWith('# Written by `npx opencastle convoy`.')).toBe(true)
|
|
143
|
+
expect(yaml).toContain('npx opencastle convoy run <this file>')
|
|
144
144
|
})
|
|
145
145
|
|
|
146
146
|
it('ensures prompt appears last in each task YAML block', () => {
|
|
@@ -35,7 +35,7 @@ export interface TaskPlan {
|
|
|
35
35
|
tasks: TaskPlanTask[]
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
/** A patch to apply to a task plan — output of the fix
|
|
38
|
+
/** A patch to apply to a task plan — output of the convoy-plan-fix prompt */
|
|
39
39
|
export interface TaskPatch {
|
|
40
40
|
task_id: string // task ID to patch, or "_plan" for top-level fields
|
|
41
41
|
field: string // field name (e.g., "prompt", "files", "depends_on")
|
|
@@ -210,8 +210,8 @@ export function buildConvoyYaml(plan: TaskPlan, settings: SpecSettings): string
|
|
|
210
210
|
spec.tasks = tasks
|
|
211
211
|
|
|
212
212
|
const header =
|
|
213
|
-
'# Written by `opencastle convoy`. Edit it if you like, then run it with:\n' +
|
|
214
|
-
'# opencastle convoy run <this file>\n'
|
|
213
|
+
'# Written by `npx opencastle convoy`. Edit it if you like, then run it with:\n' +
|
|
214
|
+
'# npx opencastle convoy run <this file>\n'
|
|
215
215
|
return header + stringify(spec, { lineWidth: 120, defaultKeyType: 'PLAIN', defaultStringType: 'PLAIN' })
|
|
216
216
|
}
|
|
217
217
|
|
|
@@ -431,7 +431,7 @@ export function checkPlan(plan: TaskPlan, settings: SpecSettings): string[] {
|
|
|
431
431
|
/**
|
|
432
432
|
* Make the later of each conflicting pair wait for the earlier.
|
|
433
433
|
*
|
|
434
|
-
* The last resort, after fix
|
|
434
|
+
* The last resort, after convoy-plan-fix has had its rounds: it costs parallelism,
|
|
435
435
|
* never correctness, and it cannot create a cycle — an edge is only added
|
|
436
436
|
* between two tasks that do not yet wait for each other in either direction.
|
|
437
437
|
*/
|
|
@@ -70,23 +70,23 @@ describe('readLastRun', () => {
|
|
|
70
70
|
|
|
71
71
|
it('counts every failed status as failed', () => {
|
|
72
72
|
seed([{ id: 'a', status: 'failed', created: '2026-10-01T00:00:00Z', tasks: ['done', 'failed', 'gate-failed', 'timed-out', 'review-blocked', 'disputed', 'hook-failed'] }])
|
|
73
|
-
expect(readLastRun(root)).toMatchObject({ total: 7, done: 1, failed: 6, next: 'opencastle convoy resume' })
|
|
73
|
+
expect(readLastRun(root)).toMatchObject({ total: 7, done: 1, failed: 6, next: 'npx opencastle convoy resume' })
|
|
74
74
|
})
|
|
75
75
|
|
|
76
76
|
it('does not call a run finished while a task was skipped, even when it says "done"', () => {
|
|
77
77
|
seed([{ id: 'a', status: 'done', created: '2026-10-01T00:00:00Z', tasks: ['done', 'skipped'] }])
|
|
78
|
-
expect(readLastRun(root)).toMatchObject({ done: 1, skipped: 1, failed: 0, next: 'opencastle convoy resume' })
|
|
78
|
+
expect(readLastRun(root)).toMatchObject({ done: 1, skipped: 1, failed: 0, next: 'npx opencastle convoy resume' })
|
|
79
79
|
})
|
|
80
80
|
|
|
81
81
|
it('treats a running task in a dead run as not done', () => {
|
|
82
82
|
seed([{ id: 'a', status: 'running', created: '2026-10-01T00:00:00Z', tasks: ['done', 'running'] }])
|
|
83
|
-
expect(readLastRun(root)).toMatchObject({ running: 1, alive: false, next: 'opencastle convoy resume' })
|
|
83
|
+
expect(readLastRun(root)).toMatchObject({ running: 1, alive: false, next: 'npx opencastle convoy resume' })
|
|
84
84
|
})
|
|
85
85
|
|
|
86
86
|
it('points at the live view while a process is working on the run', () => {
|
|
87
87
|
seed([{ id: 'a', status: 'running', created: new Date().toISOString(), tasks: ['running', 'pending'] }])
|
|
88
88
|
holdLock()
|
|
89
|
-
expect(readLastRun(root)).toMatchObject({ alive: true, next: 'opencastle convoy dashboard' })
|
|
89
|
+
expect(readLastRun(root)).toMatchObject({ alive: true, next: 'npx opencastle convoy dashboard' })
|
|
90
90
|
})
|
|
91
91
|
|
|
92
92
|
it('offers a new run when every task is done, and names an older run with work left', () => {
|
|
@@ -95,7 +95,7 @@ describe('readLastRun', () => {
|
|
|
95
95
|
{ id: 'new', status: 'done', created: '2026-10-02T00:00:00Z', tasks: ['done', 'done'] },
|
|
96
96
|
])
|
|
97
97
|
expect(readLastRun(root)).toMatchObject({
|
|
98
|
-
id: 'new', done: 2, total: 2, next: 'opencastle convoy "<task>"', older_unfinished: { id: 'old', name: 'Run old' },
|
|
98
|
+
id: 'new', done: 2, total: 2, next: 'npx opencastle convoy "<task>"', older_unfinished: { id: 'old', name: 'Run old' },
|
|
99
99
|
})
|
|
100
100
|
})
|
|
101
101
|
|
|
@@ -112,14 +112,14 @@ describe('opencastle convoy (status)', () => {
|
|
|
112
112
|
seed([{ id: 'a', status: 'done', created: '2026-10-01T00:00:00Z', tasks: ['done', 'skipped'] }])
|
|
113
113
|
await convoy({ args: [], pkgRoot: root })
|
|
114
114
|
expect(text()).toMatch(/1\/2 done, 1 skipped/)
|
|
115
|
-
expect(text()).toContain('Next: opencastle convoy resume')
|
|
115
|
+
expect(text()).toContain('Next: npx opencastle convoy resume')
|
|
116
116
|
expect(text()).not.toMatch(/every task is done|Nothing outstanding/)
|
|
117
117
|
})
|
|
118
118
|
|
|
119
119
|
it('prints JSON with --json', async () => {
|
|
120
120
|
seed([{ id: 'a', status: 'done', created: '2026-10-01T00:00:00Z', tasks: ['done'] }])
|
|
121
121
|
await convoy({ args: ['--json'], pkgRoot: root })
|
|
122
|
-
expect(JSON.parse(text())).toMatchObject({ id: 'a', done: 1, total: 1, next: 'opencastle convoy "<task>"' })
|
|
122
|
+
expect(JSON.parse(text())).toMatchObject({ id: 'a', done: 1, total: 1, next: 'npx opencastle convoy "<task>"' })
|
|
123
123
|
})
|
|
124
124
|
|
|
125
125
|
it('says how to start when there are no runs', async () => {
|
|
@@ -135,17 +135,17 @@ describe('opencastle convoy (what it refuses before planning anything)', () => {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
it('reads a mistyped subcommand as a typo, not a task', async () => {
|
|
138
|
-
expect(await refused(['resum'])).toContain('Did you mean opencastle convoy resume?')
|
|
138
|
+
expect(await refused(['resum'])).toContain('Did you mean npx opencastle convoy resume?')
|
|
139
139
|
})
|
|
140
140
|
|
|
141
141
|
it('does not plan a one-word task such as "status"', async () => {
|
|
142
142
|
const said = await refused(['status'])
|
|
143
143
|
expect(said).toContain('"status" is one word')
|
|
144
|
-
expect(said).toContain('For the last run: opencastle convoy')
|
|
144
|
+
expect(said).toContain('For the last run: npx opencastle convoy')
|
|
145
145
|
})
|
|
146
146
|
|
|
147
147
|
it('names what replaced a removed flag', async () => {
|
|
148
|
-
expect(await refused(['--retry-failed'])).toContain('--retry-failed was removed. Use: opencastle convoy resume')
|
|
148
|
+
expect(await refused(['--retry-failed'])).toContain('--retry-failed was removed. Use: npx opencastle convoy resume')
|
|
149
149
|
expect(await refused(['add', 'rate', 'limiting', '--status'])).toContain('--status was removed')
|
|
150
150
|
})
|
|
151
151
|
|
|
@@ -158,6 +158,6 @@ describe('opencastle convoy (what it refuses before planning anything)', () => {
|
|
|
158
158
|
})
|
|
159
159
|
|
|
160
160
|
it('sends a subcommand flag to its subcommand', async () => {
|
|
161
|
-
expect(await refused(['-f', 'spec.yml'])).toContain('-f belongs to `opencastle convoy run`')
|
|
161
|
+
expect(await refused(['-f', 'spec.yml'])).toContain('-f belongs to `npx opencastle convoy run`')
|
|
162
162
|
})
|
|
163
163
|
})
|
package/src/cli/convoy-cmd.ts
CHANGED
|
@@ -14,17 +14,17 @@ import type { CliContext } from './types.js'
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
const CONVOY_HELP = `
|
|
17
|
-
opencastle convoy [task] [options]
|
|
17
|
+
npx opencastle convoy [task] [options]
|
|
18
18
|
|
|
19
19
|
Experimental: plan multi-step work and run it with agents in parallel.
|
|
20
20
|
|
|
21
21
|
Usage:
|
|
22
|
-
opencastle convoy The last run and the one next step
|
|
23
|
-
opencastle convoy "<task>" Plan it, show the plan, ask, then run it
|
|
24
|
-
opencastle convoy run <spec.yml> Run a spec you wrote
|
|
25
|
-
opencastle convoy resume Continue whatever is not done
|
|
26
|
-
opencastle convoy dashboard The Observability dashboard, live
|
|
27
|
-
opencastle convoy plan --prd <file> Plan again from a PRD you edited
|
|
22
|
+
npx opencastle convoy The last run and the one next step
|
|
23
|
+
npx opencastle convoy "<task>" Plan it, show the plan, ask, then run it
|
|
24
|
+
npx opencastle convoy run <spec.yml> Run a spec you wrote
|
|
25
|
+
npx opencastle convoy resume Continue whatever is not done
|
|
26
|
+
npx opencastle convoy dashboard The Observability dashboard, live
|
|
27
|
+
npx opencastle convoy plan --prd <file> Plan again from a PRD you edited
|
|
28
28
|
|
|
29
29
|
Options:
|
|
30
30
|
--yes, -y With a task: run the plan without asking
|
|
@@ -163,7 +163,7 @@ export function readLastRun(projectRoot: string): LastRun | null {
|
|
|
163
163
|
running: count((s) => s === 'running' || s === 'assigned'),
|
|
164
164
|
skipped: count((s) => s === 'skipped'),
|
|
165
165
|
pending: count((s) => s === 'pending'),
|
|
166
|
-
next: last.alive ? 'opencastle convoy dashboard' : notDone ? 'opencastle convoy resume' : 'opencastle convoy "<task>"',
|
|
166
|
+
next: last.alive ? 'npx opencastle convoy dashboard' : notDone ? 'npx opencastle convoy resume' : 'npx opencastle convoy "<task>"',
|
|
167
167
|
older_unfinished: older ? { id: older.id, name: older.name } : null,
|
|
168
168
|
}
|
|
169
169
|
}
|
|
@@ -178,11 +178,11 @@ function renderStatus(last: LastRun | null, json: boolean): void {
|
|
|
178
178
|
console.log(`\n 🚚 ${c.bold('Convoy')} ${c.dim('(experimental)')}\n`)
|
|
179
179
|
if (!last) {
|
|
180
180
|
console.log(' No runs yet.\n')
|
|
181
|
-
console.log(` ${c.bold('Start one:')} ${c.cyan('opencastle convoy "add rate limiting to the API"')}\n`)
|
|
181
|
+
console.log(` ${c.bold('Start one:')} ${c.cyan('npx opencastle convoy "add rate limiting to the API"')}\n`)
|
|
182
182
|
return
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
const resumable = last.next === 'opencastle convoy resume'
|
|
185
|
+
const resumable = last.next === 'npx opencastle convoy resume'
|
|
186
186
|
const mark = last.alive ? c.cyan('▶') : resumable ? c.yellow('!') : c.green('✓')
|
|
187
187
|
const state = last.alive ? 'running now' : last.status
|
|
188
188
|
console.log(` ${mark} ${c.bold(last.name)} ${c.dim(`— ${state}`)}`)
|
|
@@ -203,7 +203,7 @@ function renderStatus(last: LastRun | null, json: boolean): void {
|
|
|
203
203
|
console.log(` ${c.bold('Next:')} ${c.cyan(last.next)}`)
|
|
204
204
|
console.log(` ${c.dim(why)}`)
|
|
205
205
|
if (last.older_unfinished) {
|
|
206
|
-
console.log(` ${c.dim(`An earlier run, ${last.older_unfinished.name}, has work left; opencastle convoy resume continues it.`)}`)
|
|
206
|
+
console.log(` ${c.dim(`An earlier run, ${last.older_unfinished.name}, has work left; npx opencastle convoy resume continues it.`)}`)
|
|
207
207
|
}
|
|
208
208
|
console.log('')
|
|
209
209
|
}
|
|
@@ -273,8 +273,8 @@ export default async function convoy(ctx: CliContext): Promise<void> {
|
|
|
273
273
|
if (misplaced) {
|
|
274
274
|
const owner = SUBCOMMAND_FLAGS.get(misplaced)!
|
|
275
275
|
refuse(
|
|
276
|
-
`${misplaced} belongs to \`opencastle convoy ${owner}\`.`,
|
|
277
|
-
`Try: opencastle convoy ${owner} ${args.slice(args.indexOf(misplaced)).join(' ')}`,
|
|
276
|
+
`${misplaced} belongs to \`npx opencastle convoy ${owner}\`.`,
|
|
277
|
+
`Try: npx opencastle convoy ${owner} ${args.slice(args.indexOf(misplaced)).join(' ')}`,
|
|
278
278
|
)
|
|
279
279
|
}
|
|
280
280
|
|
|
@@ -284,8 +284,8 @@ export default async function convoy(ctx: CliContext): Promise<void> {
|
|
|
284
284
|
const stray = args.find((a) => a.startsWith('-') && a !== '--json')
|
|
285
285
|
if (stray) {
|
|
286
286
|
refuse(
|
|
287
|
-
TASK_FLAGS.has(stray) ? `${stray} goes with a task: opencastle convoy "<task>" ${stray}` : await unknownFlag(stray, ['--json', ...TASK_FLAGS]),
|
|
288
|
-
'Run "opencastle convoy --help" for usage.',
|
|
287
|
+
TASK_FLAGS.has(stray) ? `${stray} goes with a task: npx opencastle convoy "<task>" ${stray}` : await unknownFlag(stray, ['--json', ...TASK_FLAGS]),
|
|
288
|
+
'Run "npx opencastle convoy --help" for usage.',
|
|
289
289
|
)
|
|
290
290
|
}
|
|
291
291
|
renderStatus(readLastRun(findProjectRoot(process.cwd()) ?? process.cwd()), args.includes('--json'))
|
|
@@ -299,10 +299,10 @@ export default async function convoy(ctx: CliContext): Promise<void> {
|
|
|
299
299
|
if (words.length === 1 && !words[0].includes(' ')) {
|
|
300
300
|
const near = nearest(words[0], SUBCOMMANDS)
|
|
301
301
|
refuse(
|
|
302
|
-
near ? `Unknown subcommand "${words[0]}". Did you mean opencastle convoy ${near}?` : `"${words[0]}" is one word; describe the task in a few.`,
|
|
302
|
+
near ? `Unknown subcommand "${words[0]}". Did you mean npx opencastle convoy ${near}?` : `"${words[0]}" is one word; describe the task in a few.`,
|
|
303
303
|
near
|
|
304
|
-
? 'To plan a task, describe it in a few words: opencastle convoy "add rate limiting to the API"'
|
|
305
|
-
: 'For example: opencastle convoy "add rate limiting to the API". For the last run: opencastle convoy',
|
|
304
|
+
? 'To plan a task, describe it in a few words: npx opencastle convoy "add rate limiting to the API"'
|
|
305
|
+
: 'For example: npx opencastle convoy "add rate limiting to the API". For the last run: npx opencastle convoy',
|
|
306
306
|
)
|
|
307
307
|
}
|
|
308
308
|
|
|
@@ -842,9 +842,7 @@
|
|
|
842
842
|
return `<div class="table-wrap"><table class="sessions-table cards">
|
|
843
843
|
<thead><tr>${withSource ? '<th scope="col">Source</th>' : ''}<th scope="col">When</th><th scope="col">Task</th><th scope="col">Agent</th><th scope="col">Outcome</th><th scope="col" class="td-num">Minutes</th><th scope="col" class="td-num">Files</th><th scope="col" class="td-num">Retries</th><th scope="col">Model</th></tr></thead>
|
|
844
844
|
<tbody>${rows.map((s) => {
|
|
845
|
-
const src = s.
|
|
846
|
-
? `<span class="kind-badge" title="The engine's session event for a finished task">convoy run</span>${s.convoy_id ? `<span class="td-sub"><a href="#run=${encodeURIComponent(s.convoy_id)}" title="${esc(s.convoy_id)}">${esc(runName(s.convoy_id))}</a></span>` : ''}`
|
|
847
|
-
: '<span class="kind-badge" title="Appended with opencastle log">opencastle log</span>'
|
|
845
|
+
const src = `<span class="kind-badge" title="The engine's session event for a finished task">convoy run</span>${s.convoy_id ? `<span class="td-sub"><a href="#run=${encodeURIComponent(s.convoy_id)}" title="${esc(s.convoy_id)}">${esc(runName(s.convoy_id))}</a></span>` : ''}`
|
|
848
846
|
const num = (v) => (v == null ? nr() : esc(v))
|
|
849
847
|
return `<tr>
|
|
850
848
|
${withSource ? `<td data-label="Source">${src}</td>` : ''}
|
|
@@ -872,7 +870,7 @@
|
|
|
872
870
|
return
|
|
873
871
|
}
|
|
874
872
|
if (!state.sessions.length) {
|
|
875
|
-
el.innerHTML = `<div style="padding:16px 24px">${empty('table', 'No sessions recorded yet', '
|
|
873
|
+
el.innerHTML = `<div style="padding:16px 24px">${empty('table', 'No sessions recorded yet', 'A convoy run records one per task it finishes.')}</div>`
|
|
876
874
|
return
|
|
877
875
|
}
|
|
878
876
|
el.innerHTML = sessionsTable(state.sessions.slice(0, 20), true)
|
|
@@ -123,10 +123,11 @@ describe('startDashboard', () => {
|
|
|
123
123
|
|
|
124
124
|
it('serves runs with the overview, one run with its insights, events after a cursor, and sessions', async () => {
|
|
125
125
|
seed()
|
|
126
|
+
// A log an earlier release had agents write by hand: no longer read.
|
|
126
127
|
mkdirSync(join(root, '.opencastle', 'logs'), { recursive: true })
|
|
127
128
|
writeFileSync(
|
|
128
129
|
join(root, '.opencastle', 'logs', 'events.ndjson'),
|
|
129
|
-
JSON.stringify({ type: 'session', timestamp: '2026-10-
|
|
130
|
+
JSON.stringify({ type: 'session', timestamp: '2026-10-01T11:00:00.000Z', agent: 'Writer', task: 'by hand', outcome: 'success' }) + '\n',
|
|
130
131
|
)
|
|
131
132
|
const v = await dashboard()
|
|
132
133
|
|
|
@@ -155,8 +156,15 @@ describe('startDashboard', () => {
|
|
|
155
156
|
expect((rest.body.events as Array<{ type: string }>).map((e) => e.type)).toEqual(['convoy_finished'])
|
|
156
157
|
expect(rest.body.more).toBe(false)
|
|
157
158
|
|
|
159
|
+
// Recorded last, so the event pages above stay the run's own four.
|
|
160
|
+
const store = createConvoyStore(join(root, '.opencastle', 'convoy.db'))
|
|
161
|
+
store.insertEvent({
|
|
162
|
+
convoy_id: 'convoy-1', task_id: 'a', worker_id: null, type: 'session',
|
|
163
|
+
data: JSON.stringify({ agent: 'Developer', task: 'a', outcome: 'success' }), created_at: '2026-10-01T10:00:00.000Z',
|
|
164
|
+
})
|
|
165
|
+
store.close()
|
|
158
166
|
const sessions = await json(`${v.url}/api/sessions`)
|
|
159
|
-
expect(sessions.body.sessions).toMatchObject([{ source: '
|
|
167
|
+
expect(sessions.body.sessions).toMatchObject([{ source: 'convoy', convoy_id: 'convoy-1', agent: 'Developer', outcome: 'success' }])
|
|
160
168
|
})
|
|
161
169
|
|
|
162
170
|
it('answers unknown runs and paths with 404, and a bad cursor with 400', async () => {
|