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
package/src/cli/dashboard.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* GET /api/runs runs, newest first, the event categories, and the overview of every run
|
|
13
13
|
* GET /api/runs/:id one run with its tasks, and what its events and side tables add
|
|
14
14
|
* GET /api/runs/:id/events?since=<n> that run's events after cursor n (&limit, at most 2000)
|
|
15
|
-
* GET /api/sessions agent sessions:
|
|
15
|
+
* GET /api/sessions agent sessions: the engine's, one per task a convoy finished
|
|
16
16
|
*/
|
|
17
17
|
import { createServer } from 'node:http'
|
|
18
18
|
import type { IncomingMessage, Server, ServerResponse } from 'node:http'
|
|
@@ -211,7 +211,7 @@ export async function startDashboard(opts: DashboardOptions): Promise<DashboardH
|
|
|
211
211
|
// ── command ───────────────────────────────────────────────────────────────────
|
|
212
212
|
|
|
213
213
|
const HELP = `
|
|
214
|
-
opencastle convoy dashboard [options]
|
|
214
|
+
npx opencastle convoy dashboard [options]
|
|
215
215
|
|
|
216
216
|
Open the Observability dashboard: a live, read-only view of this project's
|
|
217
217
|
convoy runs. Totals across every run; and for each run its tasks and what
|
|
@@ -253,7 +253,7 @@ export default async function dashboard({ args }: CliContext): Promise<void> {
|
|
|
253
253
|
const parsed = parseDashboardArgs(args)
|
|
254
254
|
if ('error' in parsed) {
|
|
255
255
|
console.error(` ✗ ${parsed.error}`)
|
|
256
|
-
console.error(' Run "opencastle convoy dashboard --help" for usage.')
|
|
256
|
+
console.error(' Run "npx opencastle convoy dashboard --help" for usage.')
|
|
257
257
|
process.exit(1)
|
|
258
258
|
}
|
|
259
259
|
if (parsed.help) {
|
|
@@ -66,11 +66,15 @@ describe('visible command surface', () => {
|
|
|
66
66
|
|
|
67
67
|
describe('hidden commands', () => {
|
|
68
68
|
it('keeps the agent-invoked commands reachable', () => {
|
|
69
|
-
// Generated instructions call
|
|
70
|
-
expect(HIDDEN).toContain('log')
|
|
69
|
+
// Generated instructions call it; removing it would break installs.
|
|
71
70
|
expect(HIDDEN).toContain('lesson')
|
|
72
71
|
})
|
|
73
72
|
|
|
73
|
+
it('answers log, which agents no longer call, as removed', () => {
|
|
74
|
+
expect(HIDDEN).not.toContain('log')
|
|
75
|
+
expect(source).toMatch(/\n log: null,\n/)
|
|
76
|
+
})
|
|
77
|
+
|
|
74
78
|
it('keeps update working as the previous name for sync', () => {
|
|
75
79
|
expect(HIDDEN).toContain('update')
|
|
76
80
|
expect(source).toMatch(/update: \(\) => import\('\.\.\/dist\/cli\/sync\.js'\)/)
|
|
@@ -99,8 +103,8 @@ describe('removed commands', () => {
|
|
|
99
103
|
})
|
|
100
104
|
|
|
101
105
|
it('maps the destructive commands to their replacement flags', () => {
|
|
102
|
-
expect(source).toContain("eject: 'opencastle remove --keep-files'")
|
|
103
|
-
expect(source).toContain("destroy: 'opencastle remove --all'")
|
|
106
|
+
expect(source).toContain("eject: 'npx opencastle remove --keep-files'")
|
|
107
|
+
expect(source).toContain("destroy: 'npx opencastle remove --all'")
|
|
104
108
|
})
|
|
105
109
|
|
|
106
110
|
it('routes convoy execution commands into the namespace', () => {
|
|
@@ -165,7 +165,11 @@ describe('shipped content instructs only commands that exist', () => {
|
|
|
165
165
|
// "every opencastle command" is English, not a command called `command`. Keeping
|
|
166
166
|
// the fuzzy check on the fuzzy-safe corpus is the honest split; widening it would
|
|
167
167
|
// have meant a whitelist of English words, which is a worse test.
|
|
168
|
-
const instructionFiles = load(
|
|
168
|
+
const instructionFiles = load([
|
|
169
|
+
...contentFilesFor(orchestratorRoot, ['.md']),
|
|
170
|
+
// The planner's templates: not compiled, but agents read them all the same.
|
|
171
|
+
...contentFilesFor(join(repoRoot, 'src', 'cli', 'convoy', 'prompts'), ['.md']),
|
|
172
|
+
])
|
|
169
173
|
|
|
170
174
|
it('has content to check', () => {
|
|
171
175
|
expect(files.length).toBeGreaterThan(0)
|
package/src/cli/doctor.ts
CHANGED
|
@@ -85,7 +85,7 @@ async function checkGitignoreBlock(projectRoot: string): Promise<CheckResult> {
|
|
|
85
85
|
label,
|
|
86
86
|
ok: false,
|
|
87
87
|
detail: '.gitignore is missing — .env and the run artefacts are not ignored',
|
|
88
|
-
fix: 'opencastle sync',
|
|
88
|
+
fix: 'npx opencastle sync',
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -103,7 +103,7 @@ async function checkGitignoreBlock(projectRoot: string): Promise<CheckResult> {
|
|
|
103
103
|
|
|
104
104
|
const { gitignoreNeedsRebuild } = await import('./gitignore.js');
|
|
105
105
|
const why = gitignoreNeedsRebuild(content);
|
|
106
|
-
if (why) return { label, ok: false, detail: why, fix: 'opencastle sync' };
|
|
106
|
+
if (why) return { label, ok: false, detail: why, fix: 'npx opencastle sync' };
|
|
107
107
|
return { label, ok: true, warning: false };
|
|
108
108
|
}
|
|
109
109
|
|
|
@@ -117,7 +117,7 @@ function checkManifest(manifest: Manifest | null): CheckResult {
|
|
|
117
117
|
ok: false,
|
|
118
118
|
label: 'OpenCastle manifest (.opencastle/manifest.json)',
|
|
119
119
|
detail: 'Not found. Run "npx opencastle init" first.',
|
|
120
|
-
fix: 'opencastle init',
|
|
120
|
+
fix: 'npx opencastle init',
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
// A manifest that parses but names no recognised target is not a healthy
|
|
@@ -130,7 +130,7 @@ function checkManifest(manifest: Manifest | null): CheckResult {
|
|
|
130
130
|
ok: false,
|
|
131
131
|
label: 'OpenCastle manifest (.opencastle/manifest.json)',
|
|
132
132
|
detail: `names no target this release recognises (valid: ${VALID_IDES.join(', ')})`,
|
|
133
|
-
fix: 'fix the "ides" field, or re-run opencastle init; this one needs a person',
|
|
133
|
+
fix: 'fix the "ides" field, or re-run npx opencastle init; this one needs a person',
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
return { ok: true, label: 'OpenCastle manifest (.opencastle/manifest.json)', detail: `v${manifest.version}, IDE: ${known.join(', ')}` };
|
|
@@ -153,7 +153,7 @@ async function checkCustomizations(projectRoot: string): Promise<CheckResult> {
|
|
|
153
153
|
ok: false,
|
|
154
154
|
label: 'Customizations directory',
|
|
155
155
|
detail: `.opencastle/ cannot be read — ${(err as Error).message}`,
|
|
156
|
-
fix: 'fix the permissions on .opencastle/, then run opencastle sync; this one needs a person',
|
|
156
|
+
fix: 'fix the permissions on .opencastle/, then run npx opencastle sync; this one needs a person',
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
159
|
return { ok: true, label: 'Customizations directory', detail: `${files.length} entries` };
|
|
@@ -222,7 +222,7 @@ export async function checkSkillMatrix(projectRoot: string): Promise<CheckResult
|
|
|
222
222
|
ok: false,
|
|
223
223
|
label: 'Skill matrix',
|
|
224
224
|
detail: `.opencastle/agents/ cannot be read — ${(err as Error).message}`,
|
|
225
|
-
fix: 'fix the permissions on .opencastle/agents/, then run opencastle sync; this one needs a person',
|
|
225
|
+
fix: 'fix the permissions on .opencastle/agents/, then run npx opencastle sync; this one needs a person',
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
228
|
}
|
|
@@ -242,7 +242,7 @@ export async function checkSkillMatrix(projectRoot: string): Promise<CheckResult
|
|
|
242
242
|
ok: false,
|
|
243
243
|
label: 'Skill matrix',
|
|
244
244
|
detail: `Cannot read .opencastle/agents/skill-matrix.json — ${(err as Error).message}`,
|
|
245
|
-
fix: 'fix or delete the file, then run opencastle sync; this one needs a person',
|
|
245
|
+
fix: 'fix or delete the file, then run npx opencastle sync; this one needs a person',
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
248
|
try {
|
|
@@ -287,31 +287,6 @@ export async function checkSkillMatrix(projectRoot: string): Promise<CheckResult
|
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
async function checkLogs(projectRoot: string): Promise<CheckResult> {
|
|
291
|
-
const dir = resolve(projectRoot, '.opencastle', 'logs');
|
|
292
|
-
if (!existsSync(dir)) {
|
|
293
|
-
// A local run artefact, not part of the project, so a fresh clone has none —
|
|
294
|
-
// and calling that a failure made `doctor` exit 1 on every clone. The first
|
|
295
|
-
// `opencastle log` creates it; until then "none yet" is the honest reading,
|
|
296
|
-
// and not something to warn about on every new install.
|
|
297
|
-
return {
|
|
298
|
-
ok: true,
|
|
299
|
-
label: 'Observability logs',
|
|
300
|
-
detail: 'none yet — created when an agent first logs a session',
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
// A diagnostic does not write. This used to create five empty `.ndjson` files
|
|
304
|
-
// as a side effect — files nothing on this branch reads, and exactly the ones
|
|
305
|
-
// `migrateLegacyLogs` exists to move aside.
|
|
306
|
-
const entries = existsSync(dir) ? await readdir(dir) : [];
|
|
307
|
-
const events = entries.filter((f) => f.endsWith('.ndjson'));
|
|
308
|
-
return {
|
|
309
|
-
ok: true,
|
|
310
|
-
label: 'Observability logs',
|
|
311
|
-
detail: events.length > 0 ? `${events.length} log file(s)` : 'no runs recorded yet',
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
|
|
315
290
|
async function checkMcpEnvVars(
|
|
316
291
|
projectRoot: string,
|
|
317
292
|
manifest: Manifest | null,
|
|
@@ -410,7 +385,7 @@ function verifySubtree(
|
|
|
410
385
|
ok: false,
|
|
411
386
|
label: check.label,
|
|
412
387
|
detail: `${check.path}${shown} cannot be read — ${(err as Error).message}`,
|
|
413
|
-
fix: `fix the permissions or replace ${check.path}${shown}, then run opencastle sync; this one needs a person`,
|
|
388
|
+
fix: `fix the permissions or replace ${check.path}${shown}, then run npx opencastle sync; this one needs a person`,
|
|
414
389
|
});
|
|
415
390
|
|
|
416
391
|
for (const entry of entries) {
|
|
@@ -441,7 +416,7 @@ function verifySubtree(
|
|
|
441
416
|
ok: false,
|
|
442
417
|
label: check.label,
|
|
443
418
|
detail: `${check.path}${shown} is a file, not a directory of generated files`,
|
|
444
|
-
fix: `remove ${check.path}${shown}, then run opencastle sync; this one needs a person`,
|
|
419
|
+
fix: `remove ${check.path}${shown}, then run npx opencastle sync; this one needs a person`,
|
|
445
420
|
};
|
|
446
421
|
}
|
|
447
422
|
if (isDir) {
|
|
@@ -450,7 +425,7 @@ function verifySubtree(
|
|
|
450
425
|
ok: false,
|
|
451
426
|
label: check.label,
|
|
452
427
|
detail: `${check.path}${shown} is a directory, not a generated file`,
|
|
453
|
-
fix: `remove ${check.path}${shown}, then run opencastle sync; this one needs a person`,
|
|
428
|
+
fix: `remove ${check.path}${shown}, then run npx opencastle sync; this one needs a person`,
|
|
454
429
|
};
|
|
455
430
|
}
|
|
456
431
|
let kids: string[];
|
|
@@ -501,7 +476,7 @@ export async function runDoctorCheck(projectRoot: string, check: DoctorCheck): P
|
|
|
501
476
|
ok: false,
|
|
502
477
|
label: check.label,
|
|
503
478
|
detail: `${check.path} cannot be read — ${(err as Error).message}`,
|
|
504
|
-
fix: `remove or fix ${check.path}, then run opencastle sync; this one needs a person`,
|
|
479
|
+
fix: `remove or fix ${check.path}, then run npx opencastle sync; this one needs a person`,
|
|
505
480
|
};
|
|
506
481
|
}
|
|
507
482
|
|
|
@@ -540,7 +515,7 @@ export function checkMcpFromPaths(projectRoot: string, mcpPaths: string[]): Chec
|
|
|
540
515
|
ok: false,
|
|
541
516
|
label: 'MCP configuration',
|
|
542
517
|
detail: `${p} cannot be read — ${(err as Error).message}`,
|
|
543
|
-
fix: `fix or delete ${p}, then run opencastle sync; this one needs a person`,
|
|
518
|
+
fix: `fix or delete ${p}, then run npx opencastle sync; this one needs a person`,
|
|
544
519
|
};
|
|
545
520
|
}
|
|
546
521
|
}
|
|
@@ -593,7 +568,7 @@ function teamStateOrFailure(
|
|
|
593
568
|
// ── Main doctor command ───────────────────────────────────────
|
|
594
569
|
|
|
595
570
|
const DOCTOR_HELP = `
|
|
596
|
-
opencastle doctor [options]
|
|
571
|
+
npx opencastle doctor [options]
|
|
597
572
|
|
|
598
573
|
Validate your OpenCastle setup — checks manifest, customizations, skills,
|
|
599
574
|
logs, MCP configuration, and IDE-specific rules. MCP servers are audited too:
|
|
@@ -656,7 +631,7 @@ async function checkGitignoredOutput(
|
|
|
656
631
|
// and doctor fails again with the same advice. Asking about the offending
|
|
657
632
|
// lines is the whole difference.
|
|
658
633
|
fix: (await syncWouldClearThis(projectRoot, hidden))
|
|
659
|
-
? 'opencastle sync — those entries are in a block this tool maintains'
|
|
634
|
+
? 'npx opencastle sync — those entries are in a block this tool maintains'
|
|
660
635
|
: `remove those entries from ${await whereIgnored(projectRoot, hidden)}; OpenCastle only ignores .env and run artefacts`,
|
|
661
636
|
};
|
|
662
637
|
}
|
|
@@ -901,7 +876,7 @@ async function checkTornBlocks(
|
|
|
901
876
|
|
|
902
877
|
const needsAPerson = found.filter(({ diagnosis }) => !diagnosis.fixable)
|
|
903
878
|
if (needsAPerson.length === 0) {
|
|
904
|
-
return { label, ok: false, warning: false, detail, fix: 'opencastle sync' }
|
|
879
|
+
return { label, ok: false, warning: false, detail, fix: 'npx opencastle sync' }
|
|
905
880
|
}
|
|
906
881
|
return {
|
|
907
882
|
label,
|
|
@@ -933,7 +908,7 @@ function checkRootFileClassification(manifest: Manifest | null): CheckResult {
|
|
|
933
908
|
label,
|
|
934
909
|
ok: true,
|
|
935
910
|
warning: true,
|
|
936
|
-
detail: `${misfiled.join(', ')} recorded as generated — run "opencastle sync" to repair`,
|
|
911
|
+
detail: `${misfiled.join(', ')} recorded as generated — run "npx opencastle sync" to repair`,
|
|
937
912
|
};
|
|
938
913
|
}
|
|
939
914
|
|
|
@@ -1013,7 +988,6 @@ export async function runSharedChecks(
|
|
|
1013
988
|
await checkCustomizations(projectRoot),
|
|
1014
989
|
await checkProjectContext(projectRoot),
|
|
1015
990
|
await checkSkillMatrix(projectRoot),
|
|
1016
|
-
await checkLogs(projectRoot),
|
|
1017
991
|
await checkMcpEnvVars(projectRoot, manifest, state),
|
|
1018
992
|
await checkDotEnv(projectRoot, manifest),
|
|
1019
993
|
await checkGitignoredOutput(projectRoot, manifest),
|
|
@@ -1038,7 +1012,7 @@ export async function runSharedChecks(
|
|
|
1038
1012
|
if (!manifest) {
|
|
1039
1013
|
for (const r of results) {
|
|
1040
1014
|
if (!r.ok && (r.fix === undefined || /opencastle sync/.test(r.fix))) {
|
|
1041
|
-
r.fix = 'opencastle init — nothing is installed, so there is nothing to sync';
|
|
1015
|
+
r.fix = 'npx opencastle init — nothing is installed, so there is nothing to sync';
|
|
1042
1016
|
}
|
|
1043
1017
|
}
|
|
1044
1018
|
}
|
package/src/cli/explain.ts
CHANGED
|
@@ -26,7 +26,7 @@ import { isWorkflowTemplate } from './adapters/workflows.js'
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
const HELP = `
|
|
29
|
-
opencastle explain [options]
|
|
29
|
+
npx opencastle explain [options]
|
|
30
30
|
|
|
31
31
|
Show what every assistant in this repository is given, where each piece comes
|
|
32
32
|
from (OpenCastle, a baseline, or this project), and what you still need to
|
|
@@ -53,7 +53,7 @@ function by(from: string): string {
|
|
|
53
53
|
|
|
54
54
|
async function build(pkgRoot: string, projectRoot: string): Promise<ExplainReport> {
|
|
55
55
|
const manifest = await readManifest(projectRoot)
|
|
56
|
-
if (!manifest) throw new Error('OpenCastle is not set up here — run opencastle init')
|
|
56
|
+
if (!manifest) throw new Error('OpenCastle is not set up here — run npx opencastle init')
|
|
57
57
|
refuseOlderCli(pkgRoot, manifest.version)
|
|
58
58
|
const ides = (manifest.ides?.length ? manifest.ides : [manifest.ide]).filter((i): i is string => Boolean(i) && i in IDE_ADAPTERS)
|
|
59
59
|
const stack = resolveStack({ ...manifest, ides })
|
package/src/cli/fleet.ts
CHANGED
|
@@ -16,7 +16,7 @@ import type { CliContext } from './types.js'
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
const HELP = `
|
|
19
|
-
opencastle fleet <dir...> [options]
|
|
19
|
+
npx opencastle fleet <dir...> [options]
|
|
20
20
|
|
|
21
21
|
Read the committed .opencastle/lock.json of each repository given and show
|
|
22
22
|
which OpenCastle and baseline versions they run, which lag behind the newest,
|
package/src/cli/github-report.ts
CHANGED
|
@@ -48,15 +48,15 @@ function explain(d: Drift): string {
|
|
|
48
48
|
// after, and blaming an edit that never happened sends people looking for it.
|
|
49
49
|
case 'changed':
|
|
50
50
|
if (d.path === LOCK_REL) {
|
|
51
|
-
return `${d.path}: the sources changed and nobody has run sync since. Run \`opencastle sync\` and commit the result; \`opencastle review\` explains the change.`
|
|
51
|
+
return `${d.path}: the sources changed and nobody has run sync since. Run \`npx opencastle sync\` and commit the result; \`npx opencastle review\` explains the change.`
|
|
52
52
|
}
|
|
53
|
-
return `${where} differs from a fresh compile of its source. Run \`opencastle sync\` and commit the result. If the difference is a hand edit you want to keep, move it into .opencastle/ first — sync overwrites generated files.`
|
|
53
|
+
return `${where} differs from a fresh compile of its source. Run \`npx opencastle sync\` and commit the result. If the difference is a hand edit you want to keep, move it into .opencastle/ first — sync overwrites generated files.`
|
|
54
54
|
case 'missing':
|
|
55
|
-
return `${where} should exist but does not. Run \`opencastle sync\` and commit the result; generated config is committed like a lockfile.`
|
|
55
|
+
return `${where} should exist but does not. Run \`npx opencastle sync\` and commit the result; generated config is committed like a lockfile.`
|
|
56
56
|
case 'extra':
|
|
57
|
-
return `${where} ${d.detail ? `was ${d.detail}` : 'sits in generated output but no source produces it'}, so the next \`opencastle sync\` deletes it.`
|
|
57
|
+
return `${where} ${d.detail ? `was ${d.detail}` : 'sits in generated output but no source produces it'}, so the next \`npx opencastle sync\` deletes it.`
|
|
58
58
|
case 'outdated':
|
|
59
|
-
return `${where}: ${d.detail ?? 'an MCP server entry sync would change'}. Run \`opencastle sync\` and commit — it touches only entries OpenCastle wrote and nobody edited.`
|
|
59
|
+
return `${where}: ${d.detail ?? 'an MCP server entry sync would change'}. Run \`npx opencastle sync\` and commit — it touches only entries OpenCastle wrote and nobody edited.`
|
|
60
60
|
case 'unreducible':
|
|
61
61
|
if (isComparisonFailure(d)) return `The comparison could not run: ${d.path}.${d.fix ? ` Fix: ${d.fix}` : ''}`
|
|
62
62
|
return [`${where}: ${d.detail ?? 'needs a person'}`, d.fix && `Fix: ${d.fix}`].filter(Boolean).join('. ')
|
package/src/cli/gitignore.ts
CHANGED
|
@@ -83,7 +83,7 @@ function buildBlock(): string {
|
|
|
83
83
|
return [
|
|
84
84
|
START_MARKER,
|
|
85
85
|
'# Generated assistant config is committed on purpose, so teammates get',
|
|
86
|
-
'# working rules on clone and `opencastle sync --check` can verify it in CI.',
|
|
86
|
+
'# working rules on clone and `npx opencastle sync --check` can verify it in CI.',
|
|
87
87
|
'# Only local artefacts are ignored.',
|
|
88
88
|
...LOCAL_ONLY,
|
|
89
89
|
END_MARKER,
|
package/src/cli/init.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isAbsolute, resolve, relative } from 'node:path'
|
|
2
2
|
import { readFile, unlink } from 'node:fs/promises'
|
|
3
3
|
import { existsSync } from 'node:fs'
|
|
4
|
+
import { execFileSync } from 'node:child_process'
|
|
4
5
|
import { multiselect, confirm, closePrompts, c } from './prompt.js'
|
|
5
6
|
import { readManifest, writeManifest, createManifest } from './manifest.js'
|
|
6
7
|
import { removeDirIfExists, copyDir, getOrchestratorRoot } from './copy.js'
|
|
@@ -24,7 +25,7 @@ import { parseVersion, compareVersions } from './version-range.js'
|
|
|
24
25
|
import { COMMAND_NAMESPACE } from './command-namespace.js'
|
|
25
26
|
|
|
26
27
|
const INIT_HELP = `
|
|
27
|
-
opencastle init [options]
|
|
28
|
+
npx opencastle init [options]
|
|
28
29
|
|
|
29
30
|
Set up this project: detects your stack and any assistant config you already
|
|
30
31
|
have, shows what it will do, and asks once.
|
|
@@ -275,7 +276,7 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
275
276
|
if (!assumeYes && !dryRun) {
|
|
276
277
|
const ok = await confirm('Set this up?', true)
|
|
277
278
|
if (!ok) {
|
|
278
|
-
console.log(`\n Aborted. Run ${c.cyan('opencastle init --customize')} to choose manually.\n`)
|
|
279
|
+
console.log(`\n Aborted. Run ${c.cyan('npx opencastle init --customize')} to choose manually.\n`)
|
|
279
280
|
closePrompts()
|
|
280
281
|
return
|
|
281
282
|
}
|
|
@@ -717,7 +718,7 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
717
718
|
for (const { ide, message } of failedTargets) {
|
|
718
719
|
console.log(` ${c.red('✗')} ${IDE_LABELS[ide as IdeChoice] ?? ide} could not be installed:`)
|
|
719
720
|
console.log(` ${c.dim(message)}`)
|
|
720
|
-
console.log(` ${c.dim('Fix that, then run opencastle sync.')}`)
|
|
721
|
+
console.log(` ${c.dim('Fix that, then run npx opencastle sync.')}`)
|
|
721
722
|
}
|
|
722
723
|
for (const file of unreadable) {
|
|
723
724
|
const [abs, why] = file.split('\u0000')
|
|
@@ -742,8 +743,8 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
742
743
|
console.log(
|
|
743
744
|
` ${c.dim(
|
|
744
745
|
isMcp
|
|
745
|
-
? 'Fix the file, then run opencastle sync --force to add the MCP servers.'
|
|
746
|
-
: 'Fix the file, then run opencastle sync --force to generate it.',
|
|
746
|
+
? 'Fix the file, then run npx opencastle sync --force to add the MCP servers.'
|
|
747
|
+
: 'Fix the file, then run npx opencastle sync --force to generate it.',
|
|
747
748
|
)}`,
|
|
748
749
|
)
|
|
749
750
|
}
|
|
@@ -861,7 +862,7 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
861
862
|
for (const p of new Set(tornRoots)) {
|
|
862
863
|
console.log(` ${c.bold(relative(projectRoot, p))}`)
|
|
863
864
|
console.log(
|
|
864
|
-
` ${c.dim('└')} ${c.dim('text beside it may be stale generated output; only you can tell. Run')} ${c.cyan('opencastle doctor')}\n`,
|
|
865
|
+
` ${c.dim('└')} ${c.dim('text beside it may be stale generated output; only you can tell. Run')} ${c.cyan('npx opencastle doctor')}\n`,
|
|
865
866
|
)
|
|
866
867
|
}
|
|
867
868
|
}
|
|
@@ -879,6 +880,7 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
879
880
|
}
|
|
880
881
|
|
|
881
882
|
// ── Env var notice + .env file generation ────────────────────
|
|
883
|
+
const envCommitted = envVars.length > 0 && isTrackedByGit(projectRoot, '.env')
|
|
882
884
|
if (envVars.length > 0) {
|
|
883
885
|
console.log(`\n ${c.yellow('⚠')} Required environment variables for MCP servers:\n`)
|
|
884
886
|
for (const { envVar, hint } of envVars) {
|
|
@@ -888,7 +890,11 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
888
890
|
|
|
889
891
|
// Offer to create .env if it doesn't exist
|
|
890
892
|
const envPath = resolve(projectRoot, '.env')
|
|
891
|
-
if (
|
|
893
|
+
if (envCommitted) {
|
|
894
|
+
// Some projects commit a `.env` of shared defaults. A placeholder there,
|
|
895
|
+
// and the "commit what this wrote" below, is how a token gets pushed.
|
|
896
|
+
console.log(` ${c.yellow('⚠')} .env is committed in this repository, so nothing was added to it — set these in your shell`)
|
|
897
|
+
} else if (!dryRun && !existsSync(envPath)) {
|
|
892
898
|
// `--yes` means every question, not most of them. This one blocked a TTY
|
|
893
899
|
// run and any CI runner that keeps stdin open.
|
|
894
900
|
const createEnv =
|
|
@@ -948,7 +954,7 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
948
954
|
if (envVars.length > 0) {
|
|
949
955
|
step++
|
|
950
956
|
console.log(
|
|
951
|
-
` ${step}. Set the environment variable${envVars.length > 1 ? 's' : ''} listed above (in .env or your shell)`
|
|
957
|
+
` ${step}. Set the environment variable${envVars.length > 1 ? 's' : ''} listed above (${envCommitted ? 'in your shell — .env is committed here' : 'in .env or your shell'})`
|
|
952
958
|
)
|
|
953
959
|
}
|
|
954
960
|
// The commands are namespaced, and a name nobody tells you is a name nobody
|
|
@@ -968,13 +974,13 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
968
974
|
step++
|
|
969
975
|
console.log(` ${step}. Commit what this wrote, .opencastle/ included — teammates get the same setup on clone`)
|
|
970
976
|
step++
|
|
971
|
-
console.log(` ${step}. ${c.cyan('opencastle ci')} — fail a pull request whose generated config no longer matches`)
|
|
977
|
+
console.log(` ${step}. ${c.cyan('npx opencastle ci')} — fail a pull request whose generated config no longer matches`)
|
|
972
978
|
|
|
973
979
|
// Name the assistants not yet being compiled for — the reason to come back.
|
|
974
980
|
const configured = new Set(ides)
|
|
975
981
|
const otherIdes = (Object.keys(IDE_ADAPTERS) as IdeChoice[]).filter((id) => !configured.has(id))
|
|
976
982
|
if (otherIdes.length > 0) {
|
|
977
|
-
console.log(`\n ${c.dim('Also used by your team?')} ${c.cyan('opencastle init --customize')}`)
|
|
983
|
+
console.log(`\n ${c.dim('Also used by your team?')} ${c.cyan('npx opencastle init --customize')}`)
|
|
978
984
|
console.log(` ${c.dim(`compiles the same config for ${otherIdes.map((id) => IDE_LABELS[id]).join(', ')}`)}`)
|
|
979
985
|
}
|
|
980
986
|
console.log()
|
|
@@ -999,3 +1005,13 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
999
1005
|
const couldNotRead = unreadable.filter((e) => e.split('\u0000')[1] === 'unreadable')
|
|
1000
1006
|
if (couldNotRead.length > 0 || failedTargets.length > 0) process.exit(1)
|
|
1001
1007
|
}
|
|
1008
|
+
|
|
1009
|
+
/** Whether git tracks `rel` here. False outside a repository or without git. */
|
|
1010
|
+
function isTrackedByGit(projectRoot: string, rel: string): boolean {
|
|
1011
|
+
try {
|
|
1012
|
+
execFileSync('git', ['-C', projectRoot, 'ls-files', '--error-unmatch', '--', rel], { stdio: 'ignore' })
|
|
1013
|
+
return true
|
|
1014
|
+
} catch {
|
|
1015
|
+
return false
|
|
1016
|
+
}
|
|
1017
|
+
}
|
package/src/cli/layers.ts
CHANGED
|
@@ -545,7 +545,7 @@ function loadExtends(
|
|
|
545
545
|
if (!declared && !isAgentPlugin(pkgDir)) {
|
|
546
546
|
fail(
|
|
547
547
|
`extends "${spec}", which is neither an OpenCastle baseline nor an Agent Plugin`,
|
|
548
|
-
`a baseline declares itself in its package.json: "opencastle": { "baseline": "." } (opencastle baseline init creates one); an Agent Plugin has a plugin.json at its root`,
|
|
548
|
+
`a baseline declares itself in its package.json: "opencastle": { "baseline": "." } (npx opencastle baseline init creates one); an Agent Plugin has a plugin.json at its root`,
|
|
549
549
|
)
|
|
550
550
|
return
|
|
551
551
|
}
|
|
@@ -617,7 +617,7 @@ function loadPluginLayer(
|
|
|
617
617
|
level: 'error',
|
|
618
618
|
where: declaredIn,
|
|
619
619
|
message: `extends ${id}, which is not a valid Agent Plugin: ${report.errors[0] ?? 'its plugin.json cannot be read'}`,
|
|
620
|
-
fix: `run opencastle plugin check on it`,
|
|
620
|
+
fix: `run npx opencastle plugin check on it`,
|
|
621
621
|
})
|
|
622
622
|
return null
|
|
623
623
|
}
|
|
@@ -784,7 +784,7 @@ export function resolveSources(opts: ResolveOptions): ResolvedSources {
|
|
|
784
784
|
level: 'warning',
|
|
785
785
|
where,
|
|
786
786
|
message: `excludes ${ref}, which no layer below provides`,
|
|
787
|
-
fix: 'check the spelling — opencastle explain lists everything that is compiled',
|
|
787
|
+
fix: 'check the spelling — npx opencastle explain lists everything that is compiled',
|
|
788
788
|
})
|
|
789
789
|
}
|
|
790
790
|
}
|
|
@@ -914,7 +914,7 @@ export function resolveSources(opts: ResolveOptions): ResolvedSources {
|
|
|
914
914
|
level: 'warning',
|
|
915
915
|
where,
|
|
916
916
|
message: `excludes ${ref}, which no layer below defines and no integration brings`,
|
|
917
|
-
fix: 'check the spelling — opencastle explain lists every MCP server',
|
|
917
|
+
fix: 'check the spelling — npx opencastle explain lists every MCP server',
|
|
918
918
|
})
|
|
919
919
|
}
|
|
920
920
|
if (servers.has(k)) servers.delete(k)
|
package/src/cli/lesson.ts
CHANGED
|
@@ -22,9 +22,9 @@ import {
|
|
|
22
22
|
} from './lessons.js'
|
|
23
23
|
|
|
24
24
|
const HELP = `
|
|
25
|
-
opencastle lesson [add] --title <text> --category <cat> --severity <level> --problem <text> [options]
|
|
26
|
-
opencastle lesson verify <id> [--cite <path[:line]>]...
|
|
27
|
-
opencastle lesson archive <id> --into <file>
|
|
25
|
+
npx opencastle lesson [add] --title <text> --category <cat> --severity <level> --problem <text> [options]
|
|
26
|
+
npx opencastle lesson verify <id> [--cite <path[:line]>]...
|
|
27
|
+
npx opencastle lesson archive <id> --into <file>
|
|
28
28
|
|
|
29
29
|
Record what an agent learned the hard way, as a file in .opencastle/lessons/,
|
|
30
30
|
and rewrite the index agents read before they start (.opencastle/${LESSONS_INDEX}).
|
|
@@ -55,7 +55,7 @@ const HELP = `
|
|
|
55
55
|
--help, -h Show this help
|
|
56
56
|
|
|
57
57
|
Examples:
|
|
58
|
-
opencastle lesson \\
|
|
58
|
+
npx opencastle lesson \\
|
|
59
59
|
--title "Always quote shell variables" \\
|
|
60
60
|
--category terminal \\
|
|
61
61
|
--severity medium \\
|
|
@@ -64,8 +64,8 @@ const HELP = `
|
|
|
64
64
|
--correct 'rm -rf "$DIR/old"' \\
|
|
65
65
|
--cite scripts/clean.sh:12
|
|
66
66
|
|
|
67
|
-
opencastle lesson verify 2026-10-02-always-quote-shell-variables
|
|
68
|
-
opencastle lesson archive 2026-10-02-always-quote-shell-variables \\
|
|
67
|
+
npx opencastle lesson verify 2026-10-02-always-quote-shell-variables
|
|
68
|
+
npx opencastle lesson archive 2026-10-02-always-quote-shell-variables \\
|
|
69
69
|
--into .opencastle/skills/git-workflow/SKILL.md
|
|
70
70
|
`
|
|
71
71
|
|
|
@@ -124,7 +124,7 @@ function parse(args: string[]): Parsed {
|
|
|
124
124
|
if (a === '--cite') out.cites.push(value.trim())
|
|
125
125
|
else out.values.set(a, value)
|
|
126
126
|
} else if (a.startsWith('-')) {
|
|
127
|
-
fail(`unknown option ${a} — run "opencastle lesson --help"`)
|
|
127
|
+
fail(`unknown option ${a} — run "npx opencastle lesson --help"`)
|
|
128
128
|
} else {
|
|
129
129
|
out.positional.push(a)
|
|
130
130
|
}
|
|
@@ -185,7 +185,7 @@ async function add(dir: string, projectRoot: string, p: Parsed): Promise<void> {
|
|
|
185
185
|
!severity && '--severity',
|
|
186
186
|
!problem && '--problem',
|
|
187
187
|
].filter(Boolean)
|
|
188
|
-
if (missing.length > 0) fail(`Missing required flags: ${missing.join(', ')}\n Run "opencastle lesson --help" for usage.`)
|
|
188
|
+
if (missing.length > 0) fail(`Missing required flags: ${missing.join(', ')}\n Run "npx opencastle lesson --help" for usage.`)
|
|
189
189
|
if (!isLessonCategory(category!)) fail(`Invalid --category "${category}". Must be one of: ${LESSON_CATEGORIES.join(', ')}`)
|
|
190
190
|
if (!isLessonSeverity(severity!)) fail(`Invalid --severity "${severity}". Must be one of: ${LESSON_SEVERITIES.join(', ')}`)
|
|
191
191
|
checkCitations(projectRoot, p.cites)
|
|
@@ -220,7 +220,7 @@ async function add(dir: string, projectRoot: string, p: Parsed): Promise<void> {
|
|
|
220
220
|
|
|
221
221
|
async function verify(dir: string, projectRoot: string, p: Parsed): Promise<void> {
|
|
222
222
|
const [ref] = p.positional
|
|
223
|
-
if (!ref) fail('verify needs the id of a lesson, e.g. opencastle lesson verify 2026-10-02-always-quote-shell-variables')
|
|
223
|
+
if (!ref) fail('verify needs the id of a lesson, e.g. npx opencastle lesson verify 2026-10-02-always-quote-shell-variables')
|
|
224
224
|
checkCitations(projectRoot, p.cites)
|
|
225
225
|
if (!p.dryRun) reindex(dir)
|
|
226
226
|
const { lessons } = readLessons(dir)
|
|
@@ -241,7 +241,7 @@ async function verify(dir: string, projectRoot: string, p: Parsed): Promise<void
|
|
|
241
241
|
async function archive(dir: string, projectRoot: string, p: Parsed): Promise<void> {
|
|
242
242
|
const [ref] = p.positional
|
|
243
243
|
const into = p.values.get('--into')
|
|
244
|
-
if (!ref) fail('archive needs the id of a lesson, e.g. opencastle lesson archive 2026-10-02-always-quote-shell-variables --into <file>')
|
|
244
|
+
if (!ref) fail('archive needs the id of a lesson, e.g. npx opencastle lesson archive 2026-10-02-always-quote-shell-variables --into <file>')
|
|
245
245
|
if (!into) fail('archive needs --into <file>: the skill or instruction file the lesson was merged into')
|
|
246
246
|
const problem = citationProblem(projectRoot, into)
|
|
247
247
|
if (problem) fail(`--into: ${problem}`)
|
|
@@ -267,10 +267,10 @@ export default async function lesson({ args }: CliContext): Promise<void> {
|
|
|
267
267
|
try {
|
|
268
268
|
await stat(dir)
|
|
269
269
|
} catch {
|
|
270
|
-
fail(`no .opencastle/ directory at ${dir} — run opencastle init first`)
|
|
270
|
+
fail(`no .opencastle/ directory at ${dir} — run npx opencastle init first`)
|
|
271
271
|
}
|
|
272
272
|
if (sub === 'add' && p.positional.length > 0) {
|
|
273
|
-
fail(`unexpected argument "${p.positional[0]}" — did you mean opencastle lesson verify or archive?`)
|
|
273
|
+
fail(`unexpected argument "${p.positional[0]}" — did you mean npx opencastle lesson verify or archive?`)
|
|
274
274
|
}
|
|
275
275
|
if (sub === 'add') return add(dir, projectRoot, p)
|
|
276
276
|
if (sub === 'verify') return verify(dir, projectRoot, p)
|
package/src/cli/lessons.ts
CHANGED
|
@@ -238,9 +238,13 @@ export function renderIndex(lessons: Lesson[]): string {
|
|
|
238
238
|
// A path, not a link: the folder is created with the first lesson, and a
|
|
239
239
|
// link to it led nowhere until then.
|
|
240
240
|
'Each lesson is a file in `.opencastle/lessons/`. Add one with',
|
|
241
|
-
'`opencastle lesson --title ... --category ... --severity ... --problem ...`',
|
|
242
|
-
'(and `--cite <path>` for the code it is about).
|
|
243
|
-
|
|
241
|
+
'`npx opencastle lesson --title ... --category ... --severity ... --problem ...`',
|
|
242
|
+
'(and `--cite <path>` for the code it is about). The category is one of',
|
|
243
|
+
// Spelled out: "--category ..." alone had agents guess, and a guess like
|
|
244
|
+
// `tooling` is refused.
|
|
245
|
+
`${LESSON_CATEGORIES.map((x) => `\`${x}\``).join(', ')};`,
|
|
246
|
+
`the severity ${LESSON_SEVERITIES.map((x) => `\`${x}\``).join(', ').replace(/, ([^,]+)$/, ' or $1')}. Do not edit this index:`,
|
|
247
|
+
'it is rewritten from those files by every `npx opencastle sync`.',
|
|
244
248
|
]
|
|
245
249
|
if (active.length === 0) out.push('', 'No lessons yet.')
|
|
246
250
|
const categories = [...new Set(active.map((l) => l.category))].sort()
|
|
@@ -512,7 +516,7 @@ export function checkLessons(projectRoot: string): {
|
|
|
512
516
|
const dir = join(projectRoot, '.opencastle')
|
|
513
517
|
const drift = lessonsIndexDrift(dir)
|
|
514
518
|
if (drift) {
|
|
515
|
-
return { ok: true, warning: true, label, detail: `.opencastle/${LESSONS_INDEX} ${drift}`, fix: 'opencastle sync' }
|
|
519
|
+
return { ok: true, warning: true, label, detail: `.opencastle/${LESSONS_INDEX} ${drift}`, fix: 'npx opencastle sync' }
|
|
516
520
|
}
|
|
517
521
|
const { lessons, problems } = readLessons(dir)
|
|
518
522
|
if (problems.length > 0) {
|
|
@@ -540,8 +544,8 @@ export function checkLessons(projectRoot: string): {
|
|
|
540
544
|
label,
|
|
541
545
|
detail: said.join('; '),
|
|
542
546
|
fix:
|
|
543
|
-
`check that each still holds, then opencastle lesson verify ${ids[0]}${ids.length > 1 ? ' (and the others)' : ''} — ` +
|
|
544
|
-
'with --cite <path> for a file that moved — or retire it with opencastle lesson archive <id> --into <file>',
|
|
547
|
+
`check that each still holds, then npx opencastle lesson verify ${ids[0]}${ids.length > 1 ? ' (and the others)' : ''} — ` +
|
|
548
|
+
'with --cite <path> for a file that moved — or retire it with npx opencastle lesson archive <id> --into <file>',
|
|
545
549
|
}
|
|
546
550
|
}
|
|
547
551
|
// Active lessons only: archiving is the remedy, and it does not shrink the
|
|
@@ -554,7 +558,7 @@ export function checkLessons(projectRoot: string): {
|
|
|
554
558
|
warning: true,
|
|
555
559
|
label,
|
|
556
560
|
detail: `${active.length} active lessons, ~${indexTokens} tokens in the index agents read before every task`,
|
|
557
|
-
fix: 'merge the lessons that recur into the skill or instruction file they are about, then opencastle lesson archive <id> --into <file>',
|
|
561
|
+
fix: 'merge the lessons that recur into the skill or instruction file they are about, then npx opencastle lesson archive <id> --into <file>',
|
|
558
562
|
}
|
|
559
563
|
}
|
|
560
564
|
const cited = active.filter((l) => l.citations.length > 0).length
|
package/src/cli/managed-block.ts
CHANGED
|
@@ -565,7 +565,7 @@ export function diagnoseManagedFile(
|
|
|
565
565
|
state: 'doubled',
|
|
566
566
|
fixable: true,
|
|
567
567
|
detail: `holds ${blocks} OpenCastle blocks`,
|
|
568
|
-
fix: 'opencastle sync',
|
|
568
|
+
fix: 'npx opencastle sync',
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
571
|
// A stray marker with no block is not the same as a stray marker beside one.
|
|
@@ -206,7 +206,7 @@ describe('checkMcpSupplyChain', () => {
|
|
|
206
206
|
write('.cursor/mcp.json', { mcpServers: { Playwright: { command: 'npx', args: ['-y', '@playwright/mcp@latest'] } } })
|
|
207
207
|
const r = checkMcpSupplyChain(root, 'cursor')
|
|
208
208
|
expect(r).toMatchObject({ ok: true, warning: true })
|
|
209
|
-
expect(r.fix).toMatch(/^opencastle sync/)
|
|
209
|
+
expect(r.fix).toMatch(/^npx opencastle sync/)
|
|
210
210
|
})
|
|
211
211
|
|
|
212
212
|
it('does not send the user to sync for a server sync will not touch', () => {
|
|
@@ -218,8 +218,8 @@ describe('checkMcpSupplyChain', () => {
|
|
|
218
218
|
it('does not say sync fixes a server that sync will delete', () => {
|
|
219
219
|
write('.mcp.json', { mcpServers: { Supabase: { url: 'https://mcp.supabase.com/mcp' } } })
|
|
220
220
|
const r = checkMcpSupplyChain(root, 'claude-code', new Set())
|
|
221
|
-
expect(r.fix).toContain('opencastle sync removes Supabase')
|
|
222
|
-
expect(r.fix).toContain('opencastle add supabase')
|
|
221
|
+
expect(r.fix).toContain('npx opencastle sync removes Supabase')
|
|
222
|
+
expect(r.fix).toContain('npx opencastle add supabase')
|
|
223
223
|
expect(r.fix).not.toContain('fixes')
|
|
224
224
|
})
|
|
225
225
|
|
|
@@ -238,9 +238,9 @@ describe('checkMcpSupplyChain', () => {
|
|
|
238
238
|
},
|
|
239
239
|
})
|
|
240
240
|
const r = checkMcpSupplyChain(root, 'cursor')
|
|
241
|
-
expect(r.fix).toContain('opencastle sync fixes chrome-devtools')
|
|
241
|
+
expect(r.fix).toContain('npx opencastle sync fixes chrome-devtools')
|
|
242
242
|
expect(r.fix).toContain('Playwright changed since OpenCastle wrote them')
|
|
243
|
-
expect(r.fix).toContain('opencastle sync --force')
|
|
243
|
+
expect(r.fix).toContain('npx opencastle sync --force')
|
|
244
244
|
})
|
|
245
245
|
|
|
246
246
|
it('fails on a server that cannot load', () => {
|