opencastle 1.2.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/antigravity.d.ts +0 -1
- package/dist/cli/adapters/antigravity.d.ts.map +1 -1
- package/dist/cli/adapters/antigravity.js +2 -1
- package/dist/cli/adapters/antigravity.js.map +1 -1
- package/dist/cli/adapters/claude-code.d.ts +5 -4
- package/dist/cli/adapters/claude-code.d.ts.map +1 -1
- package/dist/cli/adapters/claude-code.js +7 -4
- package/dist/cli/adapters/claude-code.js.map +1 -1
- package/dist/cli/adapters/cursor.d.ts.map +1 -1
- package/dist/cli/adapters/cursor.js +8 -1
- package/dist/cli/adapters/cursor.js.map +1 -1
- package/dist/cli/adapters/opencode.d.ts +12 -5
- package/dist/cli/adapters/opencode.d.ts.map +1 -1
- package/dist/cli/adapters/opencode.js +17 -5
- package/dist/cli/adapters/opencode.js.map +1 -1
- package/dist/cli/adapters/rules-dir-base.d.ts +12 -1
- package/dist/cli/adapters/rules-dir-base.d.ts.map +1 -1
- package/dist/cli/adapters/rules-dir-base.js +43 -57
- package/dist/cli/adapters/rules-dir-base.js.map +1 -1
- package/dist/cli/adapters/rules-dir-base.test.js +27 -18
- package/dist/cli/adapters/rules-dir-base.test.js.map +1 -1
- package/dist/cli/adapters/single-file-base.d.ts +29 -0
- package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
- package/dist/cli/adapters/single-file-base.js +49 -16
- package/dist/cli/adapters/single-file-base.js.map +1 -1
- package/dist/cli/adapters/vscode.d.ts +2 -1
- package/dist/cli/adapters/vscode.d.ts.map +1 -1
- package/dist/cli/adapters/vscode.js +2 -1
- package/dist/cli/adapters/vscode.js.map +1 -1
- package/dist/cli/adapters/windsurf.d.ts.map +1 -1
- package/dist/cli/adapters/windsurf.js +11 -1
- package/dist/cli/adapters/windsurf.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/baseline.d.ts.map +1 -1
- package/dist/cli/baseline.js +15 -8
- package/dist/cli/baseline.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 +24 -8
- package/dist/cli/ci.js.map +1 -1
- package/dist/cli/codex-target.test.js +14 -1
- package/dist/cli/codex-target.test.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/doctor.test.js +2 -2
- package/dist/cli/doctor.test.js.map +1 -1
- package/dist/cli/explain.d.ts +5 -0
- package/dist/cli/explain.d.ts.map +1 -1
- package/dist/cli/explain.js +38 -2
- package/dist/cli/explain.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 +52 -27
- 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/managed-paths.d.ts.map +1 -1
- package/dist/cli/managed-paths.js +3 -1
- package/dist/cli/managed-paths.js.map +1 -1
- package/dist/cli/mcp-audit.d.ts.map +1 -1
- package/dist/cli/mcp-audit.js +2 -0
- package/dist/cli/mcp-audit.js.map +1 -1
- package/dist/cli/mcp-upgrade.test.js +24 -1
- package/dist/cli/mcp-upgrade.test.js.map +1 -1
- package/dist/cli/mcp.d.ts.map +1 -1
- package/dist/cli/mcp.js +22 -3
- package/dist/cli/mcp.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-check.test.js +5 -4
- package/dist/cli/sync-check.test.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/team-commands.test.js +12 -0
- package/dist/cli/team-commands.test.js.map +1 -1
- package/dist/cli/team-sources.test.js +10 -0
- package/dist/cli/team-sources.test.js.map +1 -1
- package/dist/cli/types.d.ts +1 -1
- package/dist/cli/types.d.ts.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/cli/windsurf-target.test.d.ts +2 -0
- package/dist/cli/windsurf-target.test.d.ts.map +1 -0
- package/dist/cli/windsurf-target.test.js +62 -0
- package/dist/cli/windsurf-target.test.js.map +1 -0
- 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/registry.test.d.ts +2 -0
- package/dist/orchestrator/plugins/registry.test.d.ts.map +1 -0
- package/dist/orchestrator/plugins/registry.test.js +37 -0
- package/dist/orchestrator/plugins/registry.test.js.map +1 -0
- 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/antigravity.ts +2 -1
- package/src/cli/adapters/claude-code.ts +7 -4
- package/src/cli/adapters/cursor.ts +8 -1
- package/src/cli/adapters/opencode.ts +18 -6
- package/src/cli/adapters/rules-dir-base.test.ts +28 -18
- package/src/cli/adapters/rules-dir-base.ts +51 -90
- package/src/cli/adapters/single-file-base.ts +77 -16
- package/src/cli/adapters/vscode.ts +2 -1
- package/src/cli/adapters/windsurf.ts +11 -1
- package/src/cli/agent-plugin.test.ts +14 -0
- package/src/cli/baseline.ts +16 -6
- package/src/cli/bootstrap.ts +23 -0
- package/src/cli/ci.ts +25 -8
- package/src/cli/codex-target.test.ts +15 -1
- 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.test.ts +2 -2
- package/src/cli/doctor.ts +9 -6
- package/src/cli/explain.ts +36 -2
- package/src/cli/init-own-files.test.ts +156 -0
- package/src/cli/init.test.ts +55 -27
- package/src/cli/init.ts +104 -7
- package/src/cli/layers.ts +13 -4
- package/src/cli/lesson.ts +6 -5
- package/src/cli/managed-paths.ts +3 -1
- package/src/cli/mcp-audit.ts +2 -0
- package/src/cli/mcp-upgrade.test.ts +26 -1
- package/src/cli/mcp.ts +22 -3
- 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.test.ts +5 -4
- package/src/cli/sync-check.ts +12 -3
- package/src/cli/sync.ts +3 -2
- package/src/cli/team-commands.test.ts +16 -0
- package/src/cli/team-sources.test.ts +11 -0
- package/src/cli/types.ts +1 -1
- package/src/cli/update.ts +4 -3
- package/src/cli/website-plugins.test.ts +55 -5
- package/src/cli/windsurf-target.test.ts +70 -0
- 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/registry.test.ts +42 -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
package/src/cli/baseline.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { existsSync, mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync
|
|
|
2
2
|
import { mkdir, writeFile } from 'node:fs/promises'
|
|
3
3
|
import { tmpdir } from 'node:os'
|
|
4
4
|
import { isAbsolute, join, relative, resolve } from 'node:path'
|
|
5
|
-
import { resolveSources, materialize, cliVersionOf,
|
|
5
|
+
import { resolveSources, materialize, cliVersionOf, hasErrors } from './layers.js'
|
|
6
|
+
import type { TeamIssue } from './team-config.js'
|
|
6
7
|
import { contentReport, tokensOf } from './lock.js'
|
|
7
8
|
import { CONFIG_SCHEMA_URL } from './team-config.js'
|
|
8
9
|
import { EXTENSION_NAMESPACE, claudeManifestFor, isAgentPlugin, mcpSchemaUrl, pluginNameFrom, pluginSchemaUrl, readAgentPlugin, type PluginManifest } from './agent-plugin.js'
|
|
@@ -303,9 +304,17 @@ function check(pkgRoot: string, dir: string): CheckReport {
|
|
|
303
304
|
const spec = relative(join(project, '.opencastle'), layerRoot).split('\\').join('/')
|
|
304
305
|
writeFileSync(join(project, '.opencastle', 'config.json'), JSON.stringify({ extends: [spec.startsWith('.') ? spec : `./${spec}`] }))
|
|
305
306
|
const resolved = resolveSources({ pkgRoot, projectRoot: project, stack: { ides: [], techTools: [], teamTools: [] } })
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
307
|
+
// The scratch project names the baseline by its path from there —
|
|
308
|
+
// `../../../../Users/ana/base` — and stripping the `../` left an absolute
|
|
309
|
+
// path with its leading slash gone. Named instead as it was given here.
|
|
310
|
+
const id = relative(project, layerRoot).split('\\').join('/') || '.'
|
|
311
|
+
const here = dir === '.' ? '' : `${dir.replace(/\/$/, '')}/`
|
|
312
|
+
const shown = (text: string): string =>
|
|
313
|
+
text.split(`${id}/`).join(here).split(id).join(name).split(project).join('<repository>')
|
|
314
|
+
// One string per problem, its remedy on the line below — not the icons
|
|
315
|
+
// `formatIssues` prints, which the report below adds again.
|
|
316
|
+
const said = (i: TeamIssue): string => shown(`${i.where}: ${i.message}${i.fix ? `\n→ ${i.fix}` : ''}`)
|
|
317
|
+
for (const i of resolved.issues) (i.level === 'error' ? errors : warnings).push(said(i))
|
|
309
318
|
for (const item of resolved.items.values()) {
|
|
310
319
|
if (item.layer !== 'opencastle') contributes[item.kind]++
|
|
311
320
|
}
|
|
@@ -354,8 +363,9 @@ export default async function baseline({ pkgRoot, args }: CliContext): Promise<v
|
|
|
354
363
|
const parts = Object.entries(k).filter(([, n]) => n > 0).map(([kind, n]) => `${n} ${kind === 'mcpServers' ? 'MCP server(s)' : kind}`)
|
|
355
364
|
console.log(` Contributes: ${parts.length > 0 ? parts.join(', ') : c.dim('nothing yet')}`)
|
|
356
365
|
if (report.contextTokens) console.log(` A repository extending it loads ~${report.contextTokens} tokens up front, with OpenCastle's own content`)
|
|
357
|
-
|
|
358
|
-
for (const
|
|
366
|
+
const indent = (text: string): string => text.split('\n').join('\n ')
|
|
367
|
+
for (const e of report.errors) console.log(` ${c.red('✗')} ${indent(e)}`)
|
|
368
|
+
for (const w of report.warnings) console.log(` ${c.yellow('!')} ${c.dim(indent(w))}`)
|
|
359
369
|
console.log(report.errors.length === 0 ? `\n ${c.green('✓')} Ready to publish.\n` : `\n ${c.red(`${report.errors.length} problem(s) to fix before publishing.`)}\n`)
|
|
360
370
|
}
|
|
361
371
|
if (report.errors.length > 0) process.exit(1)
|
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { execFileSync } from 'node:child_process'
|
|
2
2
|
import { existsSync, readFileSync } from 'node:fs'
|
|
3
3
|
import { mkdir, writeFile, appendFile } from 'node:fs/promises'
|
|
4
|
-
import { basename, dirname, join, relative, sep } from 'node:path'
|
|
4
|
+
import { basename, dirname, join, relative, resolve, sep } from 'node:path'
|
|
5
5
|
import { readManifest } from './manifest.js'
|
|
6
6
|
import { cliVersionOf, resolveSources } from './layers.js'
|
|
7
7
|
import { resolveStack } from './stack-config.js'
|
|
@@ -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 = `
|
|
@@ -48,6 +49,21 @@ function git(cwd: string, args: string[]): string | null {
|
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
/**
|
|
53
|
+
* The repository's root, spelled the way the project's path is.
|
|
54
|
+
*
|
|
55
|
+
* `--show-toplevel` follows links, so on macOS a project under `/var/…` had a
|
|
56
|
+
* root under `/private/var/…`: every path compared against the project's own
|
|
57
|
+
* spelling fell outside the repository, a baseline kept beside the project was
|
|
58
|
+
* left out of the workflow's paths, and the CODEOWNERS found was named by a
|
|
59
|
+
* path the user never typed. `--show-cdup` is the way up from the project,
|
|
60
|
+
* applied to the project's own path.
|
|
61
|
+
*/
|
|
62
|
+
function repoRootOf(projectRoot: string): string {
|
|
63
|
+
const up = git(projectRoot, ['rev-parse', '--show-cdup'])
|
|
64
|
+
return up === null ? projectRoot : resolve(projectRoot, up || '.')
|
|
65
|
+
}
|
|
66
|
+
|
|
51
67
|
function packageManagerOf(root: string): PackageManager {
|
|
52
68
|
if (existsSync(join(root, 'pnpm-lock.yaml'))) return 'pnpm'
|
|
53
69
|
if (existsSync(join(root, 'yarn.lock'))) return 'yarn'
|
|
@@ -79,7 +95,7 @@ function findUp(start: string, names: string[], stop: string): string | null {
|
|
|
79
95
|
* baseline kept elsewhere in the repository, whose change must run it too.
|
|
80
96
|
*/
|
|
81
97
|
export function planCi(projectRoot: string, cliVersion: string, owners?: string, extraPaths: string[] = []): Plan {
|
|
82
|
-
const repoRoot =
|
|
98
|
+
const repoRoot = repoRootOf(projectRoot)
|
|
83
99
|
const prefix = (git(projectRoot, ['rev-parse', '--show-prefix']) ?? '').replace(/\/$/, '')
|
|
84
100
|
const branch = (git(projectRoot, ['symbolic-ref', '--short', 'refs/remotes/origin/HEAD']) ?? 'origin/main').replace(/^origin\//, '')
|
|
85
101
|
|
|
@@ -203,8 +219,9 @@ export function planCi(projectRoot: string, cliVersion: string, owners?: string,
|
|
|
203
219
|
path: existing ?? join(repoRoot, '.github', 'CODEOWNERS'),
|
|
204
220
|
block: [
|
|
205
221
|
'',
|
|
206
|
-
'# What every AI assistant is given (opencastle ci).
|
|
207
|
-
'#
|
|
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.',
|
|
208
225
|
`${at}${LOCK_REL} ${owners}`,
|
|
209
226
|
`${at}${TEAM_CONFIG_REL} ${owners}`,
|
|
210
227
|
'',
|
|
@@ -234,7 +251,7 @@ export default async function ci({ pkgRoot, args }: CliContext): Promise<void> {
|
|
|
234
251
|
const manifest = await readManifest(projectRoot)
|
|
235
252
|
const manifestVersion = manifest?.version
|
|
236
253
|
// Baselines kept elsewhere in this repository: a change there must run the check.
|
|
237
|
-
const repoRoot =
|
|
254
|
+
const repoRoot = repoRootOf(projectRoot)
|
|
238
255
|
const extra: string[] = []
|
|
239
256
|
try {
|
|
240
257
|
const resolved = resolveSources({ pkgRoot, projectRoot, stack: resolveStack(manifest!), repoInfo: manifest?.repoInfo })
|
|
@@ -247,7 +264,7 @@ export default async function ci({ pkgRoot, args }: CliContext): Promise<void> {
|
|
|
247
264
|
// The workflow is still right without them; sync --check will name the problem.
|
|
248
265
|
}
|
|
249
266
|
const plan = planCi(projectRoot, manifestVersion ?? cliVersionOf(pkgRoot), owners, extra)
|
|
250
|
-
const rel = (p: string): string => p.
|
|
267
|
+
const rel = (p: string): string => relative(repoRoot, p).split(sep).join('/')
|
|
251
268
|
|
|
252
269
|
if (args.includes('--dry-run')) {
|
|
253
270
|
console.log(`\n ${c.dim(`[dry-run] ${rel(plan.workflowPath)}:`)}\n`)
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* because each compared the project against the same wrong paths.
|
|
9
9
|
*/
|
|
10
10
|
import { execFileSync } from 'node:child_process'
|
|
11
|
-
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs'
|
|
11
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
|
|
12
12
|
import { tmpdir } from 'node:os'
|
|
13
13
|
import { dirname, join, resolve } from 'node:path'
|
|
14
14
|
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
@@ -169,6 +169,20 @@ describe.skipIf(!built)('Codex CLI as a target', () => {
|
|
|
169
169
|
run(project, 'sync', '--check')
|
|
170
170
|
})
|
|
171
171
|
|
|
172
|
+
it('explain says whether Codex trusts the project, since it reads config.toml only then', () => {
|
|
173
|
+
run(project, 'init', '--yes')
|
|
174
|
+
const codexHome = join(project, '..', `${project.split('/').pop()}-codex-home`)
|
|
175
|
+
const explain = (): { setup: Array<{ need: string; ok: boolean }> } =>
|
|
176
|
+
JSON.parse(execFileSync('node', [cli, 'explain', '--json'], { cwd: project, encoding: 'utf8', env: { ...process.env, CODEX_HOME: codexHome } }))
|
|
177
|
+
try {
|
|
178
|
+
expect(explain().setup).toContainEqual(expect.objectContaining({ need: 'trust', ok: false }))
|
|
179
|
+
write(codexHome, { 'config.toml': `[projects.${JSON.stringify(realpathSync(project))}]\ntrust_level = "trusted"\n` })
|
|
180
|
+
expect(explain().setup).toContainEqual(expect.objectContaining({ need: 'trust', ok: true }))
|
|
181
|
+
} finally {
|
|
182
|
+
rmSync(codexHome, { recursive: true, force: true })
|
|
183
|
+
}
|
|
184
|
+
})
|
|
185
|
+
|
|
172
186
|
it('remove --all takes our servers out of config.toml and leaves the user’s setup', () => {
|
|
173
187
|
run(project, 'init', '--yes')
|
|
174
188
|
run(project, 'remove', '--all', '--yes')
|
|
@@ -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.test.ts
CHANGED
|
@@ -193,7 +193,7 @@ describe('cursor adapter getDoctorChecks', () => {
|
|
|
193
193
|
expect(checks.length).toBeGreaterThan(0)
|
|
194
194
|
expect(checks.find((c) => c.path === '.cursorrules')?.type).toBe('file')
|
|
195
195
|
expect(checks.find((c) => c.path === '.cursor/rules/agents/')?.countFilter).toBe('.mdc')
|
|
196
|
-
expect(checks.find((c) => c.path === '.
|
|
196
|
+
expect(checks.find((c) => c.path === '.agents/skills/')?.type).toBe('dir')
|
|
197
197
|
})
|
|
198
198
|
})
|
|
199
199
|
|
|
@@ -218,7 +218,7 @@ describe('opencode adapter getDoctorChecks', () => {
|
|
|
218
218
|
expect(checks.length).toBeGreaterThan(0)
|
|
219
219
|
expect(checks.find((c) => c.path === 'AGENTS.md')?.type).toBe('file')
|
|
220
220
|
expect(checks.find((c) => c.path === '.opencode/agents/')).toBeDefined()
|
|
221
|
-
expect(checks.find((c) => c.path === '.
|
|
221
|
+
expect(checks.find((c) => c.path === '.agents/skills/')).toBeDefined()
|
|
222
222
|
// opencode: separate prompts and workflows dirs
|
|
223
223
|
expect(checks.find((c) => c.path === '.opencode/prompts/')).toBeDefined()
|
|
224
224
|
expect(checks.find((c) => c.path === '.opencode/workflows/')).toBeDefined()
|
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
|
|