opencastle 1.3.0 → 1.3.1
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 +90 -125
- package/bin/cli.mjs +12 -1
- package/dist/cli/adapters/claude-code.d.ts +5 -3
- package/dist/cli/adapters/claude-code.d.ts.map +1 -1
- package/dist/cli/adapters/claude-code.js +7 -3
- package/dist/cli/adapters/claude-code.js.map +1 -1
- package/dist/cli/adapters/single-file-base.d.ts +18 -0
- package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
- package/dist/cli/adapters/single-file-base.js +29 -4
- package/dist/cli/adapters/single-file-base.js.map +1 -1
- package/dist/cli/agent-plugin.test.js +12 -0
- package/dist/cli/agent-plugin.test.js.map +1 -1
- package/dist/cli/bootstrap.d.ts.map +1 -1
- package/dist/cli/bootstrap.js +20 -0
- package/dist/cli/bootstrap.js.map +1 -1
- package/dist/cli/ci.d.ts.map +1 -1
- package/dist/cli/ci.js +6 -4
- package/dist/cli/ci.js.map +1 -1
- package/dist/cli/command-namespace.test.js +33 -0
- package/dist/cli/command-namespace.test.js.map +1 -1
- package/dist/cli/convoy-cmd.d.ts.map +1 -1
- package/dist/cli/convoy-cmd.js +2 -1
- package/dist/cli/convoy-cmd.js.map +1 -1
- package/dist/cli/dispatcher.test.js +6 -0
- package/dist/cli/dispatcher.test.js.map +1 -1
- package/dist/cli/docs-accuracy.test.js +33 -8
- package/dist/cli/docs-accuracy.test.js.map +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +9 -6
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/init-own-files.test.d.ts +2 -0
- package/dist/cli/init-own-files.test.d.ts.map +1 -0
- package/dist/cli/init-own-files.test.js +133 -0
- package/dist/cli/init-own-files.test.js.map +1 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +106 -7
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/init.test.js +5 -4
- package/dist/cli/init.test.js.map +1 -1
- package/dist/cli/layers.d.ts.map +1 -1
- package/dist/cli/layers.js +13 -4
- package/dist/cli/layers.js.map +1 -1
- package/dist/cli/lesson.d.ts.map +1 -1
- package/dist/cli/lesson.js +6 -5
- package/dist/cli/lesson.js.map +1 -1
- package/dist/cli/prompt.d.ts.map +1 -1
- package/dist/cli/prompt.js +9 -7
- package/dist/cli/prompt.js.map +1 -1
- package/dist/cli/prompt.test.js +20 -2
- package/dist/cli/prompt.test.js.map +1 -1
- package/dist/cli/remove.d.ts.map +1 -1
- package/dist/cli/remove.js +3 -1
- package/dist/cli/remove.js.map +1 -1
- package/dist/cli/review.d.ts.map +1 -1
- package/dist/cli/review.js +7 -1
- package/dist/cli/review.js.map +1 -1
- package/dist/cli/sync-check.d.ts.map +1 -1
- package/dist/cli/sync-check.js +12 -3
- package/dist/cli/sync-check.js.map +1 -1
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +3 -2
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +4 -3
- package/dist/cli/update.js.map +1 -1
- package/dist/cli/website-plugins.test.js +51 -2
- package/dist/cli/website-plugins.test.js.map +1 -1
- package/dist/orchestrator/plugins/coolify/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/coolify/config.js +13 -0
- package/dist/orchestrator/plugins/coolify/config.js.map +1 -1
- package/dist/orchestrator/plugins/sentry/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/sentry/config.js +13 -0
- package/dist/orchestrator/plugins/sentry/config.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/adapters/claude-code.ts +7 -3
- package/src/cli/adapters/single-file-base.ts +47 -4
- package/src/cli/agent-plugin.test.ts +14 -0
- package/src/cli/bootstrap.ts +23 -0
- package/src/cli/ci.ts +6 -4
- package/src/cli/command-namespace.test.ts +35 -0
- package/src/cli/convoy/TELEMETRY.md +64 -62
- package/src/cli/convoy-cmd.ts +2 -1
- package/src/cli/dispatcher.test.ts +7 -0
- package/src/cli/docs-accuracy.test.ts +34 -7
- package/src/cli/doctor.ts +9 -6
- package/src/cli/init-own-files.test.ts +156 -0
- package/src/cli/init.test.ts +5 -4
- package/src/cli/init.ts +104 -7
- package/src/cli/layers.ts +13 -4
- package/src/cli/lesson.ts +6 -5
- package/src/cli/prompt.test.ts +21 -2
- package/src/cli/prompt.ts +11 -7
- package/src/cli/remove.ts +3 -0
- package/src/cli/review.ts +7 -1
- package/src/cli/sync-check.ts +12 -3
- package/src/cli/sync.ts +3 -2
- package/src/cli/update.ts +4 -3
- package/src/cli/website-plugins.test.ts +55 -5
- package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
- package/src/orchestrator/agents/team-lead.agent.md +2 -2
- package/src/orchestrator/customizations/README.md +58 -13
- package/src/orchestrator/customizations/logs/README.md +23 -18
- package/src/orchestrator/instructions/general.instructions.md +1 -1
- package/src/orchestrator/plugins/coolify/config.ts +13 -0
- package/src/orchestrator/plugins/sentry/config.ts +13 -0
- package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +44 -49
- package/src/orchestrator/prompts/brainstorm.prompt.md +2 -2
- package/src/orchestrator/prompts/bug-fix.prompt.md +5 -4
- package/src/orchestrator/prompts/create-skill.prompt.md +29 -39
- package/src/orchestrator/prompts/generate-convoy.prompt.md +1 -1
- package/src/orchestrator/prompts/generate-prd.prompt.md +1 -1
- package/src/orchestrator/prompts/implement-feature.prompt.md +7 -6
|
@@ -51,6 +51,49 @@ export interface SingleFileAdapterConfig {
|
|
|
51
51
|
* present on disk now, relative to the project root. Removed on update.
|
|
52
52
|
*/
|
|
53
53
|
legacyOutputs?: (_projectRoot: string) => string[]
|
|
54
|
+
/**
|
|
55
|
+
* Prompts and workflows become slash commands that list a description.
|
|
56
|
+
* Claude Code takes it from frontmatter and otherwise from the first line,
|
|
57
|
+
* which once frontmatter was stripped was the managed-file banner — every
|
|
58
|
+
* `/oc:` command described as "This file is managed by OpenCastle".
|
|
59
|
+
*/
|
|
60
|
+
commandDescriptions?: boolean
|
|
61
|
+
/**
|
|
62
|
+
* Agent files are the assistant's own subagents, which it registers only
|
|
63
|
+
* with a `name` and a `description` in frontmatter. Claude Code reads
|
|
64
|
+
* `.claude/agents/`; written bare, every agent there was a file it never
|
|
65
|
+
* offered to delegate to. Everything else in the source frontmatter (VS Code
|
|
66
|
+
* tool names, handoffs, the tier) means nothing to it and is left out, so the
|
|
67
|
+
* agent inherits the session's tools and model.
|
|
68
|
+
*/
|
|
69
|
+
agentFrontmatter?: boolean
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** An agent's name as a subagent: its file name, lower-case and hyphenated. */
|
|
73
|
+
function subagentName(file: string): string {
|
|
74
|
+
return basename(file).replace(/\.agent\.md$|\.md$/, '').toLowerCase().replace(/[^a-z0-9-]+/g, '-')
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** An agent file: the body, under a name and description when the assistant registers subagents. */
|
|
78
|
+
function agentFile(file: string, content: string, withFrontmatter: boolean): string {
|
|
79
|
+
const body = stripFrontmatter(content) + '\n'
|
|
80
|
+
if (!withFrontmatter) return body
|
|
81
|
+
const description = commandDescription(content) ?? subagentName(file)
|
|
82
|
+
return `---\nname: ${subagentName(file)}\ndescription: ${JSON.stringify(description)}\n---\n\n${body}`
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** The frontmatter `description`, or the first heading, as a command's one line. */
|
|
86
|
+
function commandDescription(content: string): string | undefined {
|
|
87
|
+
const fromMeta = parseFrontmatterMeta(content).description
|
|
88
|
+
if (fromMeta) return fromMeta
|
|
89
|
+
return stripFrontmatter(content).match(/^#\s+(.+)$/m)?.[1]?.trim()
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** A command file: the body, under a description when the assistant lists one. */
|
|
93
|
+
function commandFile(content: string, withDescription: boolean): string {
|
|
94
|
+
const body = stripFrontmatter(content) + '\n'
|
|
95
|
+
const description = withDescription ? commandDescription(content) : undefined
|
|
96
|
+
return description ? `---\ndescription: ${JSON.stringify(description)}\n---\n\n${body}` : body
|
|
54
97
|
}
|
|
55
98
|
|
|
56
99
|
/**
|
|
@@ -355,7 +398,7 @@ export function createSingleFileAdapter(
|
|
|
355
398
|
if (!file.endsWith('.md')) continue
|
|
356
399
|
const destPath = resolve(destAgents, file)
|
|
357
400
|
const content = await readFile(resolve(agentsDir, file), 'utf8')
|
|
358
|
-
await emit(projectRoot, destPath,
|
|
401
|
+
await emit(projectRoot, destPath, agentFile(file, content, config.agentFrontmatter === true), overwrite, results)
|
|
359
402
|
}
|
|
360
403
|
}
|
|
361
404
|
|
|
@@ -399,7 +442,7 @@ export function createSingleFileAdapter(
|
|
|
399
442
|
const name = basename(file, '.prompt.md') || basename(file, '.md')
|
|
400
443
|
const destPath = resolve(destPrompts, `${name}.md`)
|
|
401
444
|
const content = await readFile(resolve(promptDir, file), 'utf8')
|
|
402
|
-
await emit(projectRoot, destPath,
|
|
445
|
+
await emit(projectRoot, destPath, commandFile(content, config.commandDescriptions === true), overwrite, results)
|
|
403
446
|
}
|
|
404
447
|
}
|
|
405
448
|
|
|
@@ -414,7 +457,7 @@ export function createSingleFileAdapter(
|
|
|
414
457
|
const name = basename(file, '.md')
|
|
415
458
|
const destPath = resolve(destWf, `${config.workflowPrefix}${name}.md`)
|
|
416
459
|
const content = await readFile(resolve(wfDir, file), 'utf8')
|
|
417
|
-
await emit(projectRoot, destPath,
|
|
460
|
+
await emit(projectRoot, destPath, commandFile(content, config.commandDescriptions === true), overwrite, results)
|
|
418
461
|
}
|
|
419
462
|
}
|
|
420
463
|
|
|
@@ -595,7 +638,7 @@ function pruneEmptied(root: string, dirs: Set<string>): void {
|
|
|
595
638
|
}
|
|
596
639
|
|
|
597
640
|
/** Every file under a directory, relative to it. */
|
|
598
|
-
function filesUnderDir(root: string): string[] {
|
|
641
|
+
export function filesUnderDir(root: string): string[] {
|
|
599
642
|
const out: string[] = []
|
|
600
643
|
const walk = (dir: string, prefix: string): void => {
|
|
601
644
|
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
@@ -231,6 +231,20 @@ describe('a plugin as a team’s baseline', () => {
|
|
|
231
231
|
}
|
|
232
232
|
})
|
|
233
233
|
|
|
234
|
+
it('moves its integrity when anything it contributes changes, not only its skills', () => {
|
|
235
|
+
plugin('standard')
|
|
236
|
+
write(project, { '.opencastle/config.json': JSON.stringify({ extends: ['../standard'] }) })
|
|
237
|
+
const integrity = (): string | undefined =>
|
|
238
|
+
resolveSources({ pkgRoot, projectRoot: project, stack: noTools }).layers.find((l) => l.id === 'standard')?.integrity
|
|
239
|
+
const before = integrity()
|
|
240
|
+
expect(before).toMatch(/^sha256-/)
|
|
241
|
+
write(join(project, 'standard'), { 'dev.opencastle/instructions/standards.md': '# Standards\n\nBe brief.\n' })
|
|
242
|
+
const afterInstruction = integrity()
|
|
243
|
+
expect(afterInstruction).not.toBe(before)
|
|
244
|
+
write(join(project, 'standard'), { 'mcp.json': mcp({ docs: { type: 'streamable-http', url: 'https://docs.acme.example/v2/mcp' } }) })
|
|
245
|
+
expect(integrity()).not.toBe(afterInstruction)
|
|
246
|
+
})
|
|
247
|
+
|
|
234
248
|
it('extends one published to npm as it is, with no OpenCastle declaration', () => {
|
|
235
249
|
plugin('node_modules/@acme/standard', { 'package.json': JSON.stringify({ name: '@acme/standard', version: '1.2.0' }) })
|
|
236
250
|
write(project, { '.opencastle/config.json': JSON.stringify({ extends: ['@acme/standard'] }) })
|
package/src/cli/bootstrap.ts
CHANGED
|
@@ -471,6 +471,29 @@ export async function bootstrapCustomizations(
|
|
|
471
471
|
await handleApiConfig(opencastleDir, repoInfo, result)
|
|
472
472
|
await removeDataPipelineConfig(opencastleDir, result)
|
|
473
473
|
await handleTrackerConfig(opencastleDir, repoInfo, stack, result)
|
|
474
|
+
await removeUnusedProviderTemplates(opencastleDir, repoInfo, result)
|
|
474
475
|
|
|
475
476
|
return result
|
|
476
477
|
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* The provider templates shipped beside the generic ones — `supabase-config.md`,
|
|
481
|
+
* `sanity-config.md` — for a project that uses neither. The generic templates
|
|
482
|
+
* were removed when nothing was detected; these two stayed, so a project with
|
|
483
|
+
* no database and no CMS was given notes for both.
|
|
484
|
+
*/
|
|
485
|
+
async function removeUnusedProviderTemplates(
|
|
486
|
+
opencastleDir: string,
|
|
487
|
+
info: RepoInfo,
|
|
488
|
+
result: BootstrapResult,
|
|
489
|
+
): Promise<void> {
|
|
490
|
+
const inUse = new Set<string>([...(info.databases ?? []), ...(info.cms ?? [])])
|
|
491
|
+
for (const provider of ['supabase', 'sanity']) {
|
|
492
|
+
if (inUse.has(provider)) continue
|
|
493
|
+
const rel = `stack/${provider}-config.md`
|
|
494
|
+
const abs = join(opencastleDir, rel)
|
|
495
|
+
if (!existsSync(abs)) continue
|
|
496
|
+
await unlink(abs)
|
|
497
|
+
result.removed.push(rel)
|
|
498
|
+
}
|
|
499
|
+
}
|
package/src/cli/ci.ts
CHANGED
|
@@ -18,8 +18,9 @@ import type { CliContext } from './types.js'
|
|
|
18
18
|
* workflow that installs the project's dependencies (baselines come from
|
|
19
19
|
* there), runs the project's own OpenCastle version, fails on drift, and on a
|
|
20
20
|
* pull request writes what the change does to the assistants beside it. With
|
|
21
|
-
* `--owners`, CODEOWNERS routes every change
|
|
22
|
-
*
|
|
21
|
+
* `--owners`, CODEOWNERS routes every change the lock records — instructions,
|
|
22
|
+
* skills, agents, prompts, MCP servers, policy — to the people who own it.
|
|
23
|
+
* Lessons are not in the lock, and the comment it writes says so.
|
|
23
24
|
*/
|
|
24
25
|
|
|
25
26
|
const HELP = `
|
|
@@ -218,8 +219,9 @@ export function planCi(projectRoot: string, cliVersion: string, owners?: string,
|
|
|
218
219
|
path: existing ?? join(repoRoot, '.github', 'CODEOWNERS'),
|
|
219
220
|
block: [
|
|
220
221
|
'',
|
|
221
|
-
'# What every AI assistant is given (opencastle ci).
|
|
222
|
-
'#
|
|
222
|
+
'# What every AI assistant is given (opencastle ci). A change to its instructions,',
|
|
223
|
+
'# skills, agents, prompts, MCP servers or policy moves the lock, so these two',
|
|
224
|
+
'# lines route all of them to the owners. Lessons (.opencastle/lessons/) do not.',
|
|
223
225
|
`${at}${LOCK_REL} ${owners}`,
|
|
224
226
|
`${at}${TEAM_CONFIG_REL} ${owners}`,
|
|
225
227
|
'',
|
|
@@ -120,6 +120,41 @@ describe('Claude Code: /oc:<name>', () => {
|
|
|
120
120
|
expect(existsSync(join(project, '.claude/commands/oc/workflow-bug-fix.md'))).toBe(true)
|
|
121
121
|
})
|
|
122
122
|
|
|
123
|
+
it('gives each command the one line Claude Code lists beside it, and nothing else', async () => {
|
|
124
|
+
write(project, {
|
|
125
|
+
'.opencastle/prompts/release.prompt.md': "---\ndescription: 'Cut a release'\nagent: 'Team Lead (OpenCastle)'\n---\n\nRELEASE-PROMPT\n",
|
|
126
|
+
})
|
|
127
|
+
const src = materialize(resolveSources({ pkgRoot, projectRoot: project, stack }), pkgRoot)
|
|
128
|
+
try {
|
|
129
|
+
await (await IDE_ADAPTERS['claude-code']()).install(pkgRoot, project, stack, undefined, src)
|
|
130
|
+
} finally {
|
|
131
|
+
src.dispose()
|
|
132
|
+
}
|
|
133
|
+
const release = readFileSync(join(project, '.claude/commands/oc/release.md'), 'utf8')
|
|
134
|
+
// Without it Claude Code shows the first line, which was the managed-file banner.
|
|
135
|
+
expect(release.startsWith('---\ndescription: "Cut a release"\n---\n')).toBe(true)
|
|
136
|
+
expect(release).not.toContain('agent:')
|
|
137
|
+
// A workflow has no frontmatter; its heading is the description.
|
|
138
|
+
expect(readFileSync(join(project, '.claude/commands/oc/workflow-bug-fix.md'), 'utf8')).toMatch(
|
|
139
|
+
/^---\ndescription: "Workflow: Bug Fix"\n---\n/,
|
|
140
|
+
)
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
it('writes each agent as a subagent Claude Code registers: a name and a description', 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 lead = readFileSync(join(project, '.claude/agents/team-lead.agent.md'), 'utf8')
|
|
151
|
+
// Without frontmatter Claude Code never listed one of them.
|
|
152
|
+
expect(lead).toMatch(/^---\nname: team-lead\ndescription: "Task orchestrator[^\n]*"\n---\n/)
|
|
153
|
+
// VS Code's tool names and handoffs mean nothing to it.
|
|
154
|
+
expect(lead).not.toContain('handoffs:')
|
|
155
|
+
expect(lead).not.toContain('tools:')
|
|
156
|
+
})
|
|
157
|
+
|
|
123
158
|
it('leaves a command someone wrote alone: not swept, not overwritten, not drift', async () => {
|
|
124
159
|
write(project, { '.claude/commands/deploy.md': OWN_COMMAND, '.claude/commands/bug-fix.md': OWN_COMMAND })
|
|
125
160
|
const adapter = await IDE_ADAPTERS['claude-code']()
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Convoy Telemetry Model
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The events the convoy engine (experimental) records, and how its concepts map
|
|
4
|
+
to [OpenTelemetry](https://opentelemetry.io/) semantics. OpenCastle does not
|
|
5
|
+
export OpenTelemetry; the mapping is for anyone writing an exporter.
|
|
4
6
|
|
|
5
7
|
## Conceptual Mapping
|
|
6
8
|
|
|
@@ -24,10 +26,12 @@ Every event carries `convoy_id`, `task_id`, and `worker_id` (all nullable) to en
|
|
|
24
26
|
|
|
25
27
|
## Storage
|
|
26
28
|
|
|
27
|
-
- **Primary**: SQLite (
|
|
28
|
-
- **Supplementary**: NDJSON (
|
|
29
|
+
- **Primary**: SQLite (`.opencastle/convoy.db`) — durable, queryable, crash-safe
|
|
30
|
+
- **Supplementary**: NDJSON, one file per convoy (`.opencastle/logs/convoys/<convoy-id>.ndjson`) — append-only log for streaming/grep
|
|
29
31
|
|
|
30
|
-
SQLite is the source of truth.
|
|
32
|
+
SQLite is the source of truth. On resume, `recoverNdjson()` truncates a partial last line and replays the SQLite events missing from the NDJSON file.
|
|
33
|
+
|
|
34
|
+
These are separate from the agent log, `.opencastle/logs/events.ndjson`, which `opencastle log` appends to ([schema](../../orchestrator/customizations/logs/README.md)).
|
|
31
35
|
|
|
32
36
|
### Write Strategy (v1)
|
|
33
37
|
|
|
@@ -37,103 +41,108 @@ NDJSON writes use synchronous `appendFileSync` + `fsyncSync` per event. This ens
|
|
|
37
41
|
- **Throughput**: Not suitable for >10,000 events/second workloads.
|
|
38
42
|
- **Crash-safety**: Every event is fsynced before the engine continues, so a crash never loses the last event.
|
|
39
43
|
|
|
40
|
-
An async buffered writer is deferred
|
|
44
|
+
An async buffered writer is deferred until profiling shows sync writes are a bottleneck.
|
|
41
45
|
|
|
42
46
|
## Event Type Reference
|
|
43
47
|
|
|
44
|
-
All
|
|
48
|
+
All 46 canonical event types in `KNOWN_EVENT_TYPES` ([`types.ts`](types.ts)). Sources are relative to `src/cli/`.
|
|
45
49
|
|
|
46
50
|
### Convoy Lifecycle
|
|
47
51
|
|
|
48
52
|
| Event Type | Source | Data Fields |
|
|
49
53
|
|-----------|--------|-------------|
|
|
50
|
-
| `convoy_started` | engine.ts | `name?: string` |
|
|
51
|
-
| `convoy_finished` | engine.ts | `status: string` |
|
|
52
|
-
| `convoy_failed` | engine.ts | `status: string; reason?: string` |
|
|
53
|
-
| `convoy_guard` | engine.ts | `checks?: string[]` |
|
|
54
|
+
| `convoy_started` | convoy/engine.ts | `name?: string` |
|
|
55
|
+
| `convoy_finished` | convoy/engine.ts | `status: string` |
|
|
56
|
+
| `convoy_failed` | convoy/engine.ts | `status: string; reason?: string` |
|
|
57
|
+
| `convoy_guard` | convoy/engine.ts | `checks?: string[]` |
|
|
58
|
+
| `convoy_resumed` | convoy/engine.ts | `original_created_at?: string` |
|
|
54
59
|
|
|
55
60
|
### Task Lifecycle
|
|
56
61
|
|
|
57
62
|
| Event Type | Source | Data Fields |
|
|
58
63
|
|-----------|--------|-------------|
|
|
59
|
-
| `task_started` | engine.ts | `worker_id?: string` |
|
|
60
|
-
| `task_done` | engine.ts | `status?: string; retries?: number; worker_id?: string` |
|
|
61
|
-
| `task_failed` | engine.ts | `reason: string; worker_id?: string; gate?: string; hook?: string` |
|
|
62
|
-
| `task_skipped` | engine.ts | `reason: string` |
|
|
63
|
-
| `task_retried` | engine.ts | `previous_status: string` |
|
|
64
|
-
| `task_waiting_input` | engine.ts | `task_id?: string; reason?: string` |
|
|
64
|
+
| `task_started` | convoy/engine.ts | `worker_id?: string` |
|
|
65
|
+
| `task_done` | convoy/engine.ts | `status?: string; retries?: number; worker_id?: string` |
|
|
66
|
+
| `task_failed` | convoy/engine.ts | `reason: string; worker_id?: string; gate?: string; hook?: string` |
|
|
67
|
+
| `task_skipped` | convoy/engine.ts | `reason: string` |
|
|
68
|
+
| `task_retried` | convoy/engine.ts | `previous_status: string` |
|
|
69
|
+
| `task_waiting_input` | convoy/engine.ts | `task_id?: string; reason?: string` |
|
|
65
70
|
|
|
66
71
|
### Review & Disputes
|
|
67
72
|
|
|
68
73
|
| Event Type | Source | Data Fields |
|
|
69
74
|
|-----------|--------|-------------|
|
|
70
|
-
| `review_started` | engine.ts | `level: string; task_id?: string; model?: string` |
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
75
|
+
| `review_started` | convoy/engine.ts | `level: string; task_id?: string; model?: string` |
|
|
76
|
+
| `review_stage_completed` | convoy/engine.ts | `stage: string; verdict: string; tokens: number; task_id?: string; model?: string` |
|
|
77
|
+
| `review_verdict` | convoy/engine.ts | `level: string; verdict: string; tokens: number; model?: string; feedback_length?: number; budget_exceeded?: boolean; budget_downgrade?: boolean; budget_skip?: boolean; passes?: number; blocks?: number` |
|
|
78
|
+
| `dispute_opened` | convoy/engine.ts | `dispute_id: string; task_id: string; agent?: string; reason?: string` |
|
|
79
|
+
| `dlq_entry_created` | convoy/engine.ts | `dlq_id: string; task_id: string; agent?: string; attempts?: number` |
|
|
74
80
|
|
|
75
81
|
### Drift Detection
|
|
76
82
|
|
|
77
83
|
| Event Type | Source | Data Fields |
|
|
78
84
|
|-----------|--------|-------------|
|
|
79
|
-
| `drift_check_result` | engine.ts | `score?: number; threshold?: number; passed?: boolean` |
|
|
80
|
-
| `drift_detected` | engine.ts | `score?: number; files?: string[]` |
|
|
85
|
+
| `drift_check_result` | convoy/engine.ts | `score?: number; threshold?: number; passed?: boolean` |
|
|
86
|
+
| `drift_detected` | convoy/engine.ts | `score?: number; files?: string[]` |
|
|
81
87
|
|
|
82
88
|
### Circuit Breaker
|
|
83
89
|
|
|
84
90
|
| Event Type | Source | Data Fields |
|
|
85
91
|
|-----------|--------|-------------|
|
|
86
|
-
| `circuit_breaker_tripped` | engine.ts | `agent?: string; failure_count?: number; threshold?: number` |
|
|
87
|
-
| `circuit_breaker_fallback` | engine.ts | `original_agent?: string; fallback_agent?: string; task_id?: string` |
|
|
88
|
-
| `circuit_breaker_blocked` | engine.ts | `agent?: string; task_id?: string` |
|
|
92
|
+
| `circuit_breaker_tripped` | convoy/engine.ts | `agent?: string; failure_count?: number; threshold?: number` |
|
|
93
|
+
| `circuit_breaker_fallback` | convoy/engine.ts | `original_agent?: string; fallback_agent?: string; task_id?: string` |
|
|
94
|
+
| `circuit_breaker_blocked` | convoy/engine.ts | `agent?: string; task_id?: string` |
|
|
89
95
|
|
|
90
96
|
### Merge & Worktree
|
|
91
97
|
|
|
92
98
|
| Event Type | Source | Data Fields |
|
|
93
99
|
|-----------|--------|-------------|
|
|
94
|
-
| `merge_conflict_detected` | engine.ts | `task_id?: string; files?: string[]` |
|
|
95
|
-
| `merge_conflict_failed` | engine.ts | `task_id?: string; error?: string` |
|
|
100
|
+
| `merge_conflict_detected` | convoy/engine.ts | `task_id?: string; files?: string[]` |
|
|
101
|
+
| `merge_conflict_failed` | convoy/engine.ts | `task_id?: string; error?: string` |
|
|
96
102
|
|
|
97
103
|
### Artifacts & Injection
|
|
98
104
|
|
|
99
105
|
| Event Type | Source | Data Fields |
|
|
100
106
|
|-----------|--------|-------------|
|
|
101
|
-
| `file_injection_received` | engine.ts | `task_id?: string; from_task?: string; name?: string` |
|
|
102
|
-
| `artifact_limit_reached` | engine.ts | `task_id?: string; limit?: number; current?: number` |
|
|
107
|
+
| `file_injection_received` | convoy/engine.ts | `task_id?: string; from_task?: string; name?: string` |
|
|
108
|
+
| `artifact_limit_reached` | convoy/engine.ts | `task_id?: string; limit?: number; current?: number` |
|
|
109
|
+
| `artifacts_extracted` | convoy/engine.ts | `task_id?: string; count?: number; artifacts?: Array<{ filename: string; summary?: string }>` |
|
|
103
110
|
|
|
104
111
|
### Agent Intelligence
|
|
105
112
|
|
|
106
113
|
| Event Type | Source | Data Fields |
|
|
107
114
|
|-----------|--------|-------------|
|
|
108
|
-
| `agent_identity_captured` | engine.ts | `agent?: string; task_id?: string` |
|
|
109
|
-
| `agent_identity_rejected` | engine.ts | `agent?: string; task_id?: string; reason?: string` |
|
|
110
|
-
| `swarm_concurrency_update` | engine.ts | `new_concurrency?: number; reason?: string` |
|
|
115
|
+
| `agent_identity_captured` | convoy/engine.ts | `agent?: string; task_id?: string` |
|
|
116
|
+
| `agent_identity_rejected` | convoy/engine.ts | `agent?: string; task_id?: string; reason?: string` |
|
|
117
|
+
| `swarm_concurrency_update` | convoy/engine.ts | `new_concurrency?: number; reason?: string` |
|
|
111
118
|
|
|
112
119
|
### Hooks
|
|
113
120
|
|
|
114
121
|
| Event Type | Source | Data Fields |
|
|
115
122
|
|-----------|--------|-------------|
|
|
116
|
-
| `post_convoy_hook_failed` | engine.ts | `hook?: string; error?: string` |
|
|
123
|
+
| `post_convoy_hook_failed` | convoy/engine.ts | `hook?: string; error?: string` |
|
|
117
124
|
|
|
118
125
|
### Observability / Session
|
|
119
126
|
|
|
120
127
|
| Event Type | Source | Data Fields |
|
|
121
128
|
|-----------|--------|-------------|
|
|
122
|
-
| `session` | engine.ts | `agent?: string; model?: string; task?: string; outcome?: string; duration_min?: number` |
|
|
123
|
-
| `delegation` | engine.ts | `agent?: string; model?: string; tier?: string; mechanism?: string; outcome?: string` |
|
|
129
|
+
| `session` | convoy/engine.ts | `agent?: string; model?: string; task?: string; outcome?: string; duration_min?: number` |
|
|
130
|
+
| `delegation` | convoy/engine.ts | `agent?: string; model?: string; tier?: string; mechanism?: string; outcome?: string` |
|
|
131
|
+
|
|
132
|
+
`run/reporter.ts` also writes `session` and `delegation` records, to the agent log rather than the convoy's events.
|
|
124
133
|
|
|
125
134
|
### Security & Reliability
|
|
126
135
|
|
|
127
136
|
| Event Type | Source | Data Fields |
|
|
128
137
|
|-----------|--------|-------------|
|
|
129
|
-
| `secret_leak_prevented` | engine.ts, events.ts | `original_type?: string; patterns?: string[]; task_id?: string; findings_count?: number; context?: string` |
|
|
130
|
-
| `ndjson_write_failed` | events.ts | `original_type?: string` |
|
|
138
|
+
| `secret_leak_prevented` | convoy/engine.ts, convoy/events.ts | `original_type?: string; patterns?: string[]; task_id?: string; findings_count?: number; context?: string` |
|
|
139
|
+
| `ndjson_write_failed` | convoy/events.ts | `original_type?: string` |
|
|
131
140
|
|
|
132
141
|
### Built-in Gates
|
|
133
142
|
|
|
134
143
|
| Event Type | Source | Data Fields |
|
|
135
144
|
|-----------|--------|-------------|
|
|
136
|
-
| `built_in_gate_result` | engine.ts | `gate: string; passed: boolean; output?: string; level?: string` |
|
|
145
|
+
| `built_in_gate_result` | convoy/engine.ts | `gate: string; passed: boolean; output?: string; level?: string` |
|
|
137
146
|
|
|
138
147
|
### Watch Mode
|
|
139
148
|
|
|
@@ -148,12 +157,23 @@ All 39 canonical event types emitted by the convoy engine.
|
|
|
148
157
|
|
|
149
158
|
| Event Type | Source | Data Fields |
|
|
150
159
|
|-----------|--------|-------------|
|
|
151
|
-
| `worker_killed` | health.ts | `reason?: string; worker_id?: string; task_id?: string` |
|
|
160
|
+
| `worker_killed` | convoy/health.ts | `reason?: string; worker_id?: string; task_id?: string` |
|
|
152
161
|
|
|
153
|
-
###
|
|
162
|
+
### Contracts & Partitions
|
|
154
163
|
|
|
155
164
|
| Event Type | Source | Data Fields |
|
|
156
165
|
|-----------|--------|-------------|
|
|
166
|
+
| `contract_violation` | convoy/engine.ts | `task_id?: string; agent?: string; missing?: string[]; warnings?: string[]` |
|
|
167
|
+
| `partition_violation` | convoy/engine.ts | `task_id?: string; allowed?: string[]; actual?: string[]; violations?: string[]` |
|
|
168
|
+
| `file_partition_conflict` | convoy/engine.ts | `conflicts?: Array<{ phase: number; taskA: string; taskB: string; overlapping: string[] }>` |
|
|
169
|
+
|
|
170
|
+
### TDD Gate
|
|
171
|
+
|
|
172
|
+
| Event Type | Source | Data Fields |
|
|
173
|
+
|-----------|--------|-------------|
|
|
174
|
+
| `tdd_check_passed` | convoy/engine.ts | `task_id?: string; new_source_files?: number; existing_test_files?: number` |
|
|
175
|
+
| `tdd_check_failed` | convoy/engine.ts | `task_id?: string; missing_test_files?: string[]; new_source_files?: number` |
|
|
176
|
+
| `tdd_check_skipped` | convoy/engine.ts | `task_id?: string; reason?: string; agent?: string` |
|
|
157
177
|
|
|
158
178
|
## Derived Metrics
|
|
159
179
|
|
|
@@ -176,26 +196,8 @@ These are computed from raw events, not emitted directly.
|
|
|
176
196
|
|
|
177
197
|
Both validators are called at emit time in [`events.ts`](events.ts).
|
|
178
198
|
|
|
179
|
-
##
|
|
180
|
-
|
|
181
|
-
To build the dashboard with real convoy data:
|
|
182
|
-
|
|
183
|
-
```sh
|
|
184
|
-
# 1. Run ETL to extract data from SQLite → JSON
|
|
185
|
-
npm run dashboard:etl
|
|
186
|
-
|
|
187
|
-
# 2. Build the Astro dashboard (reads from public/data/*.json)
|
|
188
|
-
npx astro build --root src/dashboard
|
|
189
|
-
|
|
190
|
-
# 3. Serve locally (optional)
|
|
191
|
-
npx astro preview --root src/dashboard
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
In CI, add these steps after tests pass:
|
|
195
|
-
|
|
196
|
-
```yaml
|
|
197
|
-
- run: npm run dashboard:etl
|
|
198
|
-
- run: npx astro build --root src/dashboard
|
|
199
|
-
```
|
|
199
|
+
## Viewing events
|
|
200
200
|
|
|
201
|
-
|
|
201
|
+
`opencastle convoy dashboard` (experimental) serves a project's runs from
|
|
202
|
+
`.opencastle/convoy.db`. Building the dashboard itself from the demo database is
|
|
203
|
+
described in [CONTRIBUTING.md](../../../CONTRIBUTING.md#the-dashboard).
|
package/src/cli/convoy-cmd.ts
CHANGED
|
@@ -30,7 +30,8 @@ const CONVOY_HELP = `
|
|
|
30
30
|
opencastle convoy run -f <spec> Execute a spec you wrote by hand
|
|
31
31
|
|
|
32
32
|
Options:
|
|
33
|
-
--dry-run
|
|
33
|
+
--dry-run With a task: print the first planning prompt and stop.
|
|
34
|
+
With run: show the execution plan
|
|
34
35
|
--verbose Stream agent output
|
|
35
36
|
--adapter, -a <name> Agent runtime to plan and run with
|
|
36
37
|
--skip-validation Skip PRD and spec validation passes
|
|
@@ -132,4 +132,11 @@ describe('global behavior', () => {
|
|
|
132
132
|
// Everything else must still reach the user.
|
|
133
133
|
expect(source).toMatch(/console\.error\(`\$\{warning\.name\}: \$\{warning\.message\}`\)/)
|
|
134
134
|
})
|
|
135
|
+
|
|
136
|
+
it('stops quietly when the reader closes the pipe early', () => {
|
|
137
|
+
// `opencastle init | head` printed an EPIPE stack trace after the lines that
|
|
138
|
+
// were wanted. Whether a run reaches that write depends on timing, so the
|
|
139
|
+
// handler is asserted here rather than raced in a test.
|
|
140
|
+
expect(source).toMatch(/stream\.on\('error'[\s\S]{0,80}err\.code === 'EPIPE'\) process\.exit\(0\)/)
|
|
141
|
+
})
|
|
135
142
|
})
|
|
@@ -43,10 +43,12 @@ const actual = {
|
|
|
43
43
|
skills: countDirEntries(join(orchestrator, 'skills'), () => true),
|
|
44
44
|
plugins: countDirEntries(join(orchestrator, 'plugins'), (n) => !n.endsWith('.ts')),
|
|
45
45
|
// README.md documents the directory for contributors; it is not a template,
|
|
46
|
-
// and no adapter installs it.
|
|
46
|
+
// and no adapter installs it. shared-delivery-phase.md is installed, but it is
|
|
47
|
+
// the phase every template ends with, not a template of its own — counting it
|
|
48
|
+
// made the README say 9 while the template tables everywhere else list 8.
|
|
47
49
|
workflows: countDirEntries(
|
|
48
50
|
join(orchestrator, 'agent-workflows'),
|
|
49
|
-
(n) => n.endsWith('.md') && n !== 'README.md',
|
|
51
|
+
(n) => n.endsWith('.md') && n !== 'README.md' && n !== 'shared-delivery-phase.md',
|
|
50
52
|
),
|
|
51
53
|
}
|
|
52
54
|
|
|
@@ -76,8 +78,11 @@ function contentFilesFor(dir: string, exts: string[], out: string[] = []): strin
|
|
|
76
78
|
if (!existsSync(dir)) return out
|
|
77
79
|
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
78
80
|
const p = join(dir, entry.name)
|
|
79
|
-
if (entry.isDirectory())
|
|
80
|
-
|
|
81
|
+
if (entry.isDirectory()) {
|
|
82
|
+
// Installed dependencies are not our instructions, and a tool's own
|
|
83
|
+
// node_modules would make every scan here read thousands of files.
|
|
84
|
+
if (entry.name !== 'node_modules') contentFilesFor(p, exts, out)
|
|
85
|
+
} else if (exts.some((e) => entry.name.endsWith(e))) out.push(p)
|
|
81
86
|
}
|
|
82
87
|
return out
|
|
83
88
|
}
|
|
@@ -166,12 +171,34 @@ describe('shipped content instructs only commands that exist', () => {
|
|
|
166
171
|
expect(files.length).toBeGreaterThan(0)
|
|
167
172
|
})
|
|
168
173
|
|
|
174
|
+
// The demo video is built by scripts that call the entrypoint directly, and its
|
|
175
|
+
// narration is plain text. Neither shape was read: the build ran
|
|
176
|
+
// `node "$SCRIPT_DIR/../bin/cli.mjs" dashboard`, a removed command, and only
|
|
177
|
+
// `opencastle <cmd>` was ever matched. Scripts and narration are read for that
|
|
178
|
+
// check alone — the model and invention checks are written for prose.
|
|
179
|
+
const toolScripts = load(contentFilesFor(join(repoRoot, 'tools'), ['.mjs', '.cjs', '.js', '.ts', '.txt']))
|
|
180
|
+
|
|
181
|
+
/** Invocations of a removed command: by name, or through `bin/cli.mjs`. */
|
|
182
|
+
const removedUsages = (cmd: string): RegExp[] => [
|
|
183
|
+
new RegExp(`(?:npx )?opencastle ${cmd}(?![a-z-])`, 'g'),
|
|
184
|
+
new RegExp(`cli\\.mjs["']?[ \\t]+${cmd}(?![a-z-])`, 'g'),
|
|
185
|
+
]
|
|
186
|
+
|
|
187
|
+
it('recognises a removed command called through bin/cli.mjs', () => {
|
|
188
|
+
// The line that went unnoticed, so the pattern is held to it.
|
|
189
|
+
const line = 'node "$SCRIPT_DIR/../bin/cli.mjs" dashboard --seed --no-open &'
|
|
190
|
+
expect(removedUsages('dashboard').some((re) => new RegExp(re.source).test(line))).toBe(true)
|
|
191
|
+
// A subcommand of a real command is not the removed top-level one.
|
|
192
|
+
expect(removedUsages('dashboard').some((re) => new RegExp(re.source).test('node bin/cli.mjs convoy dashboard'))).toBe(false)
|
|
193
|
+
})
|
|
194
|
+
|
|
169
195
|
it('names no removed command', () => {
|
|
170
196
|
const offenders: string[] = []
|
|
171
197
|
for (const cmd of replacedCommands()) {
|
|
172
|
-
const usage
|
|
173
|
-
|
|
174
|
-
|
|
198
|
+
for (const usage of removedUsages(cmd)) {
|
|
199
|
+
for (const file of [...files, ...toolScripts]) {
|
|
200
|
+
for (const hit of file.text.matchAll(usage)) offenders.push(`${file.rel}: ${hit[0]}`)
|
|
201
|
+
}
|
|
175
202
|
}
|
|
176
203
|
}
|
|
177
204
|
expect(offenders).toEqual([])
|
package/src/cli/doctor.ts
CHANGED
|
@@ -30,14 +30,17 @@ import {
|
|
|
30
30
|
import { cliVersionOf, requiredEnvVars } from './layers.js';
|
|
31
31
|
import type { CliContext, DoctorCheck, IdeChoice, Manifest } from './types.js';
|
|
32
32
|
import { IDE_LABELS } from './types.js';
|
|
33
|
+
import { c } from './prompt.js';
|
|
33
34
|
|
|
34
35
|
// ── Styled output helpers ─────────────────────────────────────
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
37
|
+
// The shared helpers, so `NO_COLOR` holds here too; these were the one set of
|
|
38
|
+
// colours written by hand.
|
|
39
|
+
const PASS = c.green('✓');
|
|
40
|
+
const FAIL = c.red('✗');
|
|
41
|
+
const WARN = c.yellow('!');
|
|
42
|
+
const DIM = c.dim;
|
|
43
|
+
const BOLD = c.bold;
|
|
41
44
|
|
|
42
45
|
interface CheckResult {
|
|
43
46
|
ok: boolean;
|
|
@@ -529,7 +532,7 @@ const DOCTOR_HELP = `
|
|
|
529
532
|
|
|
530
533
|
Validate your OpenCastle setup — checks manifest, customizations, skills,
|
|
531
534
|
logs, MCP configuration, and IDE-specific rules. MCP servers are audited too:
|
|
532
|
-
a package run without an exact version, one
|
|
535
|
+
a package run without an exact version, one OpenCastle knows is not on npm, a
|
|
533
536
|
remote server Claude Code cannot load, a credential written into the file, or
|
|
534
537
|
a server the team's policy does not allow.
|
|
535
538
|
|