opencastle 1.4.2 → 1.5.0
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/dist/cli/bootstrap-on-init.test.js +5 -5
- package/dist/cli/bootstrap-on-init.test.js.map +1 -1
- package/dist/cli/bootstrap.d.ts +17 -0
- package/dist/cli/bootstrap.d.ts.map +1 -1
- package/dist/cli/bootstrap.js +284 -312
- package/dist/cli/bootstrap.js.map +1 -1
- package/dist/cli/bootstrap.test.js +22 -16
- package/dist/cli/bootstrap.test.js.map +1 -1
- package/dist/cli/convoy/engine.d.ts.map +1 -1
- package/dist/cli/convoy/engine.js +8 -2
- package/dist/cli/convoy/engine.js.map +1 -1
- package/dist/cli/convoy/spec-types.d.ts +15 -0
- package/dist/cli/convoy/spec-types.d.ts.map +1 -1
- package/dist/cli/detect.d.ts +4 -0
- package/dist/cli/detect.d.ts.map +1 -1
- package/dist/cli/detect.js +1 -1
- package/dist/cli/detect.js.map +1 -1
- package/dist/cli/doctor.js +4 -4
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/init.test.js +4 -5
- package/dist/cli/init.test.js.map +1 -1
- package/dist/cli/log.d.ts +2 -2
- package/dist/cli/log.d.ts.map +1 -1
- package/dist/cli/log.js +1 -1
- package/dist/cli/log.js.map +1 -1
- package/dist/cli/log.test.js +1 -1
- package/dist/cli/log.test.js.map +1 -1
- package/dist/cli/managed-paths.d.ts +1 -1
- package/dist/cli/managed-paths.d.ts.map +1 -1
- package/dist/cli/managed-paths.js +0 -1
- package/dist/cli/managed-paths.js.map +1 -1
- package/dist/cli/pipeline.d.ts.map +1 -1
- package/dist/cli/pipeline.flow.test.js +134 -27
- package/dist/cli/pipeline.flow.test.js.map +1 -1
- package/dist/cli/pipeline.js +113 -34
- package/dist/cli/pipeline.js.map +1 -1
- package/dist/cli/plan.d.ts +22 -0
- package/dist/cli/plan.d.ts.map +1 -1
- package/dist/cli/plan.js +43 -6
- package/dist/cli/plan.js.map +1 -1
- package/dist/cli/project-facts.d.ts +103 -0
- package/dist/cli/project-facts.d.ts.map +1 -0
- package/dist/cli/project-facts.js +577 -0
- package/dist/cli/project-facts.js.map +1 -0
- package/dist/cli/project-facts.test.d.ts +2 -0
- package/dist/cli/project-facts.test.d.ts.map +1 -0
- package/dist/cli/project-facts.test.js +209 -0
- package/dist/cli/project-facts.test.js.map +1 -0
- package/dist/cli/run/adapters/claude.d.ts +13 -0
- package/dist/cli/run/adapters/claude.d.ts.map +1 -1
- package/dist/cli/run/adapters/claude.js +30 -1
- package/dist/cli/run/adapters/claude.js.map +1 -1
- package/dist/cli/run/adapters/claude.test.js +34 -1
- package/dist/cli/run/adapters/claude.test.js.map +1 -1
- package/dist/cli/run/adapters/codex.d.ts.map +1 -1
- package/dist/cli/run/adapters/codex.js +4 -0
- package/dist/cli/run/adapters/codex.js.map +1 -1
- package/dist/cli/run/adapters/codex.test.js +8 -0
- package/dist/cli/run/adapters/codex.test.js.map +1 -1
- package/dist/cli/run/adapters/copilot.d.ts.map +1 -1
- package/dist/cli/run/adapters/copilot.js +4 -1
- package/dist/cli/run/adapters/copilot.js.map +1 -1
- package/dist/cli/run/adapters/copilot.test.js +9 -0
- package/dist/cli/run/adapters/copilot.test.js.map +1 -1
- package/dist/cli/run/adapters/stub-cli.test-helper.d.ts +2 -0
- package/dist/cli/run/adapters/stub-cli.test-helper.d.ts.map +1 -1
- package/dist/cli/run/adapters/stub-cli.test-helper.js +16 -1
- package/dist/cli/run/adapters/stub-cli.test-helper.js.map +1 -1
- package/dist/cli/run/platform.d.ts +12 -0
- package/dist/cli/run/platform.d.ts.map +1 -1
- package/dist/cli/run/platform.js +49 -0
- package/dist/cli/run/platform.js.map +1 -1
- package/dist/cli/run/platform.test.js +21 -1
- package/dist/cli/run/platform.test.js.map +1 -1
- package/dist/cli/stack-config.js +1 -1
- package/dist/cli/stack-config.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/bootstrap-on-init.test.ts +5 -5
- package/src/cli/bootstrap.test.ts +22 -16
- package/src/cli/bootstrap.ts +361 -373
- package/src/cli/convoy/engine.ts +9 -2
- package/src/cli/convoy/spec-types.ts +15 -0
- package/src/cli/detect.ts +1 -1
- package/src/cli/doctor.ts +4 -4
- package/src/cli/init.test.ts +4 -5
- package/src/cli/log.test.ts +1 -1
- package/src/cli/log.ts +2 -2
- package/src/cli/managed-paths.ts +0 -1
- package/src/cli/pipeline.flow.test.ts +143 -28
- package/src/cli/pipeline.ts +141 -34
- package/src/cli/plan.ts +51 -6
- package/src/cli/project-facts.test.ts +228 -0
- package/src/cli/project-facts.ts +647 -0
- package/src/cli/run/adapters/claude.test.ts +39 -1
- package/src/cli/run/adapters/claude.ts +27 -1
- package/src/cli/run/adapters/codex.test.ts +9 -0
- package/src/cli/run/adapters/codex.ts +3 -0
- package/src/cli/run/adapters/copilot.test.ts +11 -0
- package/src/cli/run/adapters/copilot.ts +3 -1
- package/src/cli/run/adapters/stub-cli.test-helper.ts +16 -1
- package/src/cli/run/platform.test.ts +23 -1
- package/src/cli/run/platform.ts +50 -0
- package/src/cli/stack-config.ts +1 -1
- package/src/orchestrator/agent-workflows/data-pipeline.md +2 -2
- package/src/orchestrator/agent-workflows/feature-implementation.md +1 -1
- package/src/orchestrator/agent-workflows/schema-changes.md +1 -1
- package/src/orchestrator/agents/team-lead.agent.md +1 -1
- package/src/orchestrator/customizations/README.md +27 -84
- package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +38 -238
- package/src/orchestrator/prompts/brainstorm.prompt.md +1 -1
- package/src/orchestrator/prompts/implement-feature.prompt.md +6 -6
- package/src/orchestrator/skills/agent-memory/KNOWLEDGE-GRAPH.md +1 -1
- package/src/orchestrator/skills/agent-memory/SKILL.md +7 -16
- package/src/orchestrator/skills/documentation-standards/SKILL.md +1 -1
- package/src/orchestrator/skills/observability-logging/SKILL.md +1 -1
- package/src/orchestrator/skills/panel-majority-vote/REFERENCE.md +1 -1
- package/src/orchestrator/skills/team-lead-reference/SKILL.md +2 -2
- package/src/orchestrator/customizations/AGENT-EXPERTISE.md +0 -325
- package/src/orchestrator/customizations/AGENT-FAILURES.md +0 -69
- package/src/orchestrator/customizations/AGENT-PERFORMANCE.md +0 -55
- package/src/orchestrator/customizations/DISPUTES.md +0 -162
- package/src/orchestrator/customizations/KNOWLEDGE-GRAPH.md +0 -10
- package/src/orchestrator/customizations/agents/skill-matrix.md +0 -111
- package/src/orchestrator/customizations/logs/events.ndjson +0 -0
- package/src/orchestrator/customizations/project/decisions.md +0 -31
- package/src/orchestrator/customizations/project/docs-structure.md +0 -34
- package/src/orchestrator/customizations/project/roadmap.md +0 -24
- /package/src/orchestrator/{customizations/logs/README.md → skills/observability-logging/LOG-SCHEMA.md} +0 -0
|
@@ -3,7 +3,7 @@ import { existsSync, readFileSync, writeFileSync, readdirSync } from 'node:fs'
|
|
|
3
3
|
import { join } from 'node:path'
|
|
4
4
|
import type { Task } from '../../convoy/spec-types.js'
|
|
5
5
|
import { installStubCli, type StubCli } from './stub-cli.test-helper.js'
|
|
6
|
-
import { execute, isAvailable, kill, parseClaudeOutput } from './claude.js'
|
|
6
|
+
import { claudeSessionArgs, execute, isAvailable, kill, parseClaudeOutput } from './claude.js'
|
|
7
7
|
|
|
8
8
|
const posix = process.platform !== 'win32'
|
|
9
9
|
|
|
@@ -182,6 +182,44 @@ describe.skipIf(!posix)('claude adapter — against a stub `claude`', () => {
|
|
|
182
182
|
expect(argv).not.toContain('plan')
|
|
183
183
|
})
|
|
184
184
|
|
|
185
|
+
/** What `claude --help` lists for these flags in a version that has them. */
|
|
186
|
+
const HELP = [
|
|
187
|
+
' --effort <level> Effort level for the current session',
|
|
188
|
+
' --strict-mcp-config Only use MCP servers from --mcp-config',
|
|
189
|
+
' --disable-slash-commands Disable all skills',
|
|
190
|
+
' --tools <tools...> Specify the list of available tools',
|
|
191
|
+
].join('\n')
|
|
192
|
+
|
|
193
|
+
it('asks for less effort and a lean session when this version has the flags', async () => {
|
|
194
|
+
stub.help(HELP)
|
|
195
|
+
await execute(makeTask(), { cwd: stub.work, permissionMode: 'plan', effort: 'low', lean: true, model: 'sonnet' })
|
|
196
|
+
const argv = stub.argv()
|
|
197
|
+
expect(argv[argv.indexOf('--effort') + 1]).toBe('low')
|
|
198
|
+
expect(argv).toContain('--strict-mcp-config')
|
|
199
|
+
expect(argv).toContain('--disable-slash-commands')
|
|
200
|
+
expect(argv[argv.indexOf('--tools') + 1]).toBe('Read,Grep,Glob')
|
|
201
|
+
expect(argv[argv.indexOf('--model') + 1]).toBe('sonnet')
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
it('leaves out a flag an older version does not list, rather than fail the session', async () => {
|
|
205
|
+
stub.help(' --model <model> Model for the current session')
|
|
206
|
+
const result = await execute(makeTask(), { cwd: stub.work, effort: 'low', lean: true })
|
|
207
|
+
expect(result.success).toBe(true)
|
|
208
|
+
expect(stub.argv().filter((a) => /^--(effort|strict-mcp-config|disable-slash-commands|tools)$/.test(a))).toEqual([])
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
it('passes none of them to a worker that asks for neither', async () => {
|
|
212
|
+
stub.help(HELP)
|
|
213
|
+
await execute(makeTask(), { cwd: stub.work })
|
|
214
|
+
expect(stub.argv().filter((a) => /^--(effort|strict-mcp-config|disable-slash-commands|tools)$/.test(a))).toEqual([])
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
it('matches a flag by its whole name', () => {
|
|
218
|
+
expect(claudeSessionArgs({ effort: 'medium' }, ' --effort <level> x')).toEqual(['--effort', 'medium'])
|
|
219
|
+
expect(claudeSessionArgs({ effort: 'medium' }, ' --effortless x')).toEqual([])
|
|
220
|
+
expect(claudeSessionArgs({ lean: true }, ' --tools-extra x')).toEqual([])
|
|
221
|
+
})
|
|
222
|
+
|
|
185
223
|
it('does not cap turns: the timeout bounds a session', async () => {
|
|
186
224
|
await execute(makeTask(), { cwd: stub.work })
|
|
187
225
|
expect(stub.argv()).not.toContain('--max-turns')
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Task, ExecuteOptions, ExecuteResult, TokenUsage } from '../../convoy/spec-types.js'
|
|
2
|
-
import { commandExists } from '../platform.js'
|
|
2
|
+
import { commandExists, helpText } from '../platform.js'
|
|
3
3
|
import { runAgent, stopTask, promptOf, interruptedMessage, OUTPUT_LIMIT } from './agent-process.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -134,11 +134,37 @@ export function claudePermissionArgs(mode: ExecuteOptions['permissionMode']): st
|
|
|
134
134
|
return ['--permission-mode', mode ?? 'acceptEdits']
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/** The tools a lean session keeps: reading files, nothing else. */
|
|
138
|
+
export const LEAN_TOOLS = 'Read,Grep,Glob'
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The flags that make a session cheaper and faster, each passed only when the
|
|
142
|
+
* installed Claude Code lists it in `--help`: a version without one fails the
|
|
143
|
+
* whole session on the unknown flag.
|
|
144
|
+
*
|
|
145
|
+
* A lean session starts no MCP server, loads no skill or command, and keeps
|
|
146
|
+
* only the tools that read files. Measured on a planning step it cost less than
|
|
147
|
+
* half as much — the skills, MCP tool schemas and sub-agent definitions no
|
|
148
|
+
* longer went into its context — and it could not wander into a web search.
|
|
149
|
+
*/
|
|
150
|
+
export function claudeSessionArgs(options: Pick<ExecuteOptions, 'effort' | 'lean'>, help: string): string[] {
|
|
151
|
+
const has = (flag: string) => new RegExp(`(^|\\s)${flag}(\\s|,|=|$)`, 'm').test(help)
|
|
152
|
+
const args: string[] = []
|
|
153
|
+
if (options.effort && has('--effort')) args.push('--effort', options.effort)
|
|
154
|
+
if (options.lean) {
|
|
155
|
+
if (has('--strict-mcp-config')) args.push('--strict-mcp-config')
|
|
156
|
+
if (has('--disable-slash-commands')) args.push('--disable-slash-commands')
|
|
157
|
+
if (has('--tools')) args.push('--tools', LEAN_TOOLS)
|
|
158
|
+
}
|
|
159
|
+
return args
|
|
160
|
+
}
|
|
161
|
+
|
|
137
162
|
export async function execute(task: Task, options: ExecuteOptions = {}): Promise<ExecuteResult> {
|
|
138
163
|
// A worker has no terminal, so a permission prompt is a refusal it cannot
|
|
139
164
|
// answer: without a mode it tries to write, is denied, and exits 0 having
|
|
140
165
|
// written nothing. `acceptEdits` is the least that lets it do the work.
|
|
141
166
|
const args = ['-p', '--output-format', 'json', ...claudePermissionArgs(options.permissionMode)]
|
|
167
|
+
if (options.effort || options.lean) args.push(...claudeSessionArgs(options, await helpText('claude')))
|
|
142
168
|
if (options.model) args.push('--model', options.model)
|
|
143
169
|
// No --max-turns: the task's timeout bounds a session, and a turn cap only
|
|
144
170
|
// cut long tasks short with a result that looked like an ordinary failure.
|
|
@@ -125,6 +125,15 @@ describe.skipIf(!posix)('codex adapter — against a stub `codex`', () => {
|
|
|
125
125
|
expect(argv[argv.indexOf('-m') + 1]).toBe('gpt-5.1-codex')
|
|
126
126
|
})
|
|
127
127
|
|
|
128
|
+
it('sets the reasoning effort as a config override, quoted as TOML', async () => {
|
|
129
|
+
await execute(makeTask(), { cwd: stub.work })
|
|
130
|
+
expect(stub.argv()).not.toContain('-c')
|
|
131
|
+
await execute(makeTask(), { cwd: stub.work, effort: 'medium' })
|
|
132
|
+
const argv = stub.argv()
|
|
133
|
+
expect(argv[argv.indexOf('-c') + 1]).toBe('model_reasoning_effort="medium"')
|
|
134
|
+
expect(argv.at(-1)).toBe('-')
|
|
135
|
+
})
|
|
136
|
+
|
|
128
137
|
it('reports the failure messages on a non-zero exit', async () => {
|
|
129
138
|
process.env.STUB_EXIT = '1'
|
|
130
139
|
delete process.env.STUB_LAST_MESSAGE
|
|
@@ -119,6 +119,9 @@ export async function execute(task: Task, options: ExecuteOptions = {}): Promise
|
|
|
119
119
|
'-o', lastMessagePath,
|
|
120
120
|
]
|
|
121
121
|
if (options.model) args.push('-m', options.model)
|
|
122
|
+
// A config override, which every `codex exec` takes; the value is TOML, so
|
|
123
|
+
// the string is quoted. No shell is involved, so the quotes reach codex.
|
|
124
|
+
if (options.effort) args.push('-c', `model_reasoning_effort="${options.effort}"`)
|
|
122
125
|
args.push('-') // the prompt, from stdin
|
|
123
126
|
|
|
124
127
|
try {
|
|
@@ -124,6 +124,17 @@ describe.skipIf(!posix)('copilot adapter — against a stub `copilot`', () => {
|
|
|
124
124
|
expect(argv[argv.indexOf('--model') + 1]).toBe('gpt-5.2')
|
|
125
125
|
})
|
|
126
126
|
|
|
127
|
+
it('asks for less effort only when this version has --effort', async () => {
|
|
128
|
+
stub.help(' --effort, --reasoning-effort <level> Set the reasoning effort level')
|
|
129
|
+
await execute(makeTask(), { cwd: stub.work, effort: 'low' })
|
|
130
|
+
const argv = stub.argv()
|
|
131
|
+
expect(argv[argv.indexOf('--effort') + 1]).toBe('low')
|
|
132
|
+
|
|
133
|
+
stub.help(' --model <model> Set the AI model to use')
|
|
134
|
+
await execute(makeTask(), { cwd: stub.work, effort: 'low' })
|
|
135
|
+
expect(stub.argv()).not.toContain('--effort')
|
|
136
|
+
})
|
|
137
|
+
|
|
127
138
|
it('lets Copilot load the project\'s MCP config from an untrusted worktree', async () => {
|
|
128
139
|
const script = join(stub.bin, 'copilot')
|
|
129
140
|
writeFileSync(script, readFileSync(script, 'utf8').replace('pwd > "$log/cwd"', 'pwd > "$log/cwd"; printf %s "$GITHUB_COPILOT_PROMPT_MODE_WORKSPACE_MCP" > "$log/mcp"'))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Task, ExecuteOptions, ExecuteResult } from '../../convoy/spec-types.js'
|
|
2
|
-
import { commandExists } from '../platform.js'
|
|
2
|
+
import { commandExists, helpText } from '../platform.js'
|
|
3
3
|
import { copilotPermissionArgs } from './permission-modes.js'
|
|
4
4
|
import { runAgent, stopTask, promptOf, interruptedMessage, OUTPUT_LIMIT } from './agent-process.js'
|
|
5
5
|
|
|
@@ -91,6 +91,8 @@ export function parseCopilotOutput(stdout: string): ParsedCopilot {
|
|
|
91
91
|
export async function execute(task: Task, options: ExecuteOptions = {}): Promise<ExecuteResult> {
|
|
92
92
|
const args = ['--output-format', 'json', '--no-ask-user', '--no-auto-update']
|
|
93
93
|
if (options.model) args.push('--model', options.model)
|
|
94
|
+
// Only when this version has it: an unknown flag fails the session.
|
|
95
|
+
if (options.effort && /(^|\s)--effort[\s,]/m.test(await helpText('copilot'))) args.push('--effort', options.effort)
|
|
94
96
|
args.push(...copilotPermissionArgs(options.permissionMode))
|
|
95
97
|
|
|
96
98
|
const exit = await runAgent(task, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mkdtempSync, mkdirSync, writeFileSync, chmodSync, readFileSync, rmSync, realpathSync, existsSync } from 'node:fs'
|
|
2
2
|
import { tmpdir } from 'node:os'
|
|
3
3
|
import { join, delimiter } from 'node:path'
|
|
4
|
+
import { forgetHelpText } from '../platform.js'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* A stand-in agent CLI for adapter tests: a POSIX shell script put on a
|
|
@@ -10,6 +11,9 @@ import { join, delimiter } from 'node:path'
|
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
const SCRIPT = `#!/bin/sh
|
|
14
|
+
# The adapters read --help to learn which flags this version has. It is
|
|
15
|
+
# answered here and not recorded, so argv is still the session's.
|
|
16
|
+
if [ "$1" = "--help" ]; then printf '%s\\n' "$STUB_HELP"; exit 0; fi
|
|
13
17
|
log="$STUB_LOG"
|
|
14
18
|
pwd > "$log/cwd"
|
|
15
19
|
: > "$log/argv"
|
|
@@ -37,6 +41,8 @@ export interface StubCli {
|
|
|
37
41
|
work: string
|
|
38
42
|
/** What the stub prints on stdout (and stderr) next time it runs. */
|
|
39
43
|
respond(stdout: string, stderr?: string): void
|
|
44
|
+
/** What it prints for `--help`; nothing until set. */
|
|
45
|
+
help(text: string): void
|
|
40
46
|
argv(): string[]
|
|
41
47
|
cwd(): string
|
|
42
48
|
stdin(): string
|
|
@@ -59,7 +65,9 @@ export function installStubCli(...names: string[]): StubCli {
|
|
|
59
65
|
writeFileSync(join(bin, name), SCRIPT)
|
|
60
66
|
chmodSync(join(bin, name), 0o755)
|
|
61
67
|
}
|
|
62
|
-
const saved = { PATH: process.env.PATH, STUB_LOG: process.env.STUB_LOG }
|
|
68
|
+
const saved = { PATH: process.env.PATH, STUB_LOG: process.env.STUB_LOG, STUB_HELP: process.env.STUB_HELP }
|
|
69
|
+
delete process.env.STUB_HELP
|
|
70
|
+
forgetHelpText()
|
|
63
71
|
process.env.PATH = [bin, '/usr/bin', '/bin'].join(delimiter)
|
|
64
72
|
process.env.STUB_LOG = log
|
|
65
73
|
const read = (f: string) => (existsSync(join(log, f)) ? readFileSync(join(log, f), 'utf8') : '')
|
|
@@ -67,6 +75,10 @@ export function installStubCli(...names: string[]): StubCli {
|
|
|
67
75
|
bin,
|
|
68
76
|
log,
|
|
69
77
|
work,
|
|
78
|
+
help(text) {
|
|
79
|
+
process.env.STUB_HELP = text
|
|
80
|
+
forgetHelpText()
|
|
81
|
+
},
|
|
70
82
|
respond(stdout, stderr) {
|
|
71
83
|
writeFileSync(join(log, 'stdout.txt'), stdout)
|
|
72
84
|
if (stderr !== undefined) writeFileSync(join(log, 'stderr.txt'), stderr)
|
|
@@ -78,6 +90,9 @@ export function installStubCli(...names: string[]): StubCli {
|
|
|
78
90
|
process.env.PATH = saved.PATH
|
|
79
91
|
if (saved.STUB_LOG === undefined) delete process.env.STUB_LOG
|
|
80
92
|
else process.env.STUB_LOG = saved.STUB_LOG
|
|
93
|
+
if (saved.STUB_HELP === undefined) delete process.env.STUB_HELP
|
|
94
|
+
else process.env.STUB_HELP = saved.STUB_HELP
|
|
95
|
+
forgetHelpText()
|
|
81
96
|
delete process.env.STUB_EXIT
|
|
82
97
|
delete process.env.STUB_LAST_MESSAGE
|
|
83
98
|
delete process.env.STUB_SLEEP
|
|
@@ -2,7 +2,7 @@ import { mkdtempSync, writeFileSync, chmodSync, rmSync, existsSync } from 'node:
|
|
|
2
2
|
import { tmpdir } from 'node:os'
|
|
3
3
|
import { join } from 'node:path'
|
|
4
4
|
import { describe, it, expect, afterEach } from 'vitest'
|
|
5
|
-
import { resolveCommand, commandExists, quoteForCmd, runShell, spawnCommand, killTree } from './platform.js'
|
|
5
|
+
import { resolveCommand, commandExists, quoteForCmd, runShell, spawnCommand, killTree, helpText, forgetHelpText } from './platform.js'
|
|
6
6
|
|
|
7
7
|
const posix = process.platform !== 'win32'
|
|
8
8
|
|
|
@@ -26,6 +26,28 @@ describe('finding a command without `which`', () => {
|
|
|
26
26
|
})
|
|
27
27
|
})
|
|
28
28
|
|
|
29
|
+
describe('reading a CLI\'s --help', () => {
|
|
30
|
+
afterEach(() => forgetHelpText())
|
|
31
|
+
|
|
32
|
+
it('is empty for a command that is not there, and asks only once', async () => {
|
|
33
|
+
const missing = 'opencastle-no-such-cli-' + process.pid
|
|
34
|
+
expect(await helpText(missing)).toBe('')
|
|
35
|
+
expect(helpText(missing)).toBe(helpText(missing))
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it.skipIf(!posix)('reads what the command prints', async () => {
|
|
39
|
+
const dir = mkdtempSync(join(tmpdir(), 'oc-help-'))
|
|
40
|
+
const cli = join(dir, 'fake-cli')
|
|
41
|
+
writeFileSync(cli, '#!/bin/sh\necho " --effort <level> Effort"\n')
|
|
42
|
+
chmodSync(cli, 0o755)
|
|
43
|
+
try {
|
|
44
|
+
expect(await helpText(cli)).toContain('--effort <level>')
|
|
45
|
+
} finally {
|
|
46
|
+
rmSync(dir, { recursive: true, force: true })
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
|
|
29
51
|
describe('quoting for cmd.exe', () => {
|
|
30
52
|
// The same output cross-spawn produces for these inputs.
|
|
31
53
|
it('quotes and caret-escapes metacharacters', () => {
|
package/src/cli/run/platform.ts
CHANGED
|
@@ -130,6 +130,56 @@ export function killTree(pid: number | undefined, graceMs = 5000): void {
|
|
|
130
130
|
timer.unref()
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
/** Help text by the resolved path of the command that printed it. */
|
|
134
|
+
const helpCache = new Map<string, Promise<string>>()
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* What `<command> --help` prints, read once per process.
|
|
138
|
+
*
|
|
139
|
+
* An agent CLI fails a whole session on a flag it does not know, and the flags
|
|
140
|
+
* that make a session faster arrive release by release. An adapter passes one
|
|
141
|
+
* only when the installed version lists it. Keyed by the path the command
|
|
142
|
+
* resolves to, so a different install on PATH is asked again. Empty when the
|
|
143
|
+
* command cannot be run or does not answer within `timeoutMs`.
|
|
144
|
+
*/
|
|
145
|
+
export function helpText(command: string, timeoutMs = 10_000): Promise<string> {
|
|
146
|
+
const key = resolveCommand(command) ?? command
|
|
147
|
+
const known = helpCache.get(key)
|
|
148
|
+
if (known) return known
|
|
149
|
+
const asked = new Promise<string>((done) => {
|
|
150
|
+
let out = ''
|
|
151
|
+
let child: ChildProcess
|
|
152
|
+
try {
|
|
153
|
+
child = spawnCommand(command, ['--help'], { stdio: ['ignore', 'pipe', 'pipe'] })
|
|
154
|
+
} catch {
|
|
155
|
+
done('')
|
|
156
|
+
return
|
|
157
|
+
}
|
|
158
|
+
const timer = setTimeout(() => {
|
|
159
|
+
killTree(child.pid, 0)
|
|
160
|
+
done(out)
|
|
161
|
+
}, timeoutMs)
|
|
162
|
+
timer.unref()
|
|
163
|
+
child.stdout?.on('data', (d) => (out += String(d)))
|
|
164
|
+
child.stderr?.on('data', (d) => (out += String(d)))
|
|
165
|
+
child.on('error', () => {
|
|
166
|
+
clearTimeout(timer)
|
|
167
|
+
done('')
|
|
168
|
+
})
|
|
169
|
+
child.on('close', () => {
|
|
170
|
+
clearTimeout(timer)
|
|
171
|
+
done(out)
|
|
172
|
+
})
|
|
173
|
+
})
|
|
174
|
+
helpCache.set(key, asked)
|
|
175
|
+
return asked
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Forget every help text read so far — for tests that swap a CLI. */
|
|
179
|
+
export function forgetHelpText(): void {
|
|
180
|
+
helpCache.clear()
|
|
181
|
+
}
|
|
182
|
+
|
|
133
183
|
export interface ShellResult {
|
|
134
184
|
code: number
|
|
135
185
|
stdout: string
|
package/src/cli/stack-config.ts
CHANGED
|
@@ -393,7 +393,7 @@ export function updateSkillMatrixContent(content: string, stack: StackConfig): s
|
|
|
393
393
|
.filter((e): e is SkillMatrixEntry => e !== null);
|
|
394
394
|
|
|
395
395
|
if (data.bindings[slotName]) {
|
|
396
|
-
// Merge, not replace. `skill-matrix.md`
|
|
396
|
+
// Merge, not replace. `skill-matrix.md` told users "to switch tech, update
|
|
397
397
|
// only the binding entries", and this ran on every sync, so the edit the
|
|
398
398
|
// documentation asks for was erased by the next recompile — in the
|
|
399
399
|
// directory the drift checker calls theirs.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Standard execution plan for crawling, processing, and importing data.
|
|
6
6
|
|
|
7
|
-
> **Project config:** For project-specific paths, data schema, CLI commands, and processing rules, see `data-pipeline-config.md`. For data model docs, see
|
|
7
|
+
> **Project config:** For project-specific paths, data schema, CLI commands, and processing rules, see `data-pipeline-config.md`. For data model docs, see Key Documentation in `.opencastle/project.instructions.md`.
|
|
8
8
|
|
|
9
9
|
## Phases
|
|
10
10
|
|
|
@@ -34,7 +34,7 @@ The Team Lead creates the branch before any delegation and delivers it as the De
|
|
|
34
34
|
|
|
35
35
|
1. Analyze the target data source (website, API, file)
|
|
36
36
|
2. Identify data fields available and their mapping to the place schema
|
|
37
|
-
3. Check the data model documentation (
|
|
37
|
+
3. Check the data model documentation (Key Documentation in `.opencastle/project.instructions.md`) for required fields
|
|
38
38
|
4. Estimate record count
|
|
39
39
|
5. Check for existing scraper patterns (see **data-engineering** skill)
|
|
40
40
|
6. Create tracker issue with data source details
|
|
@@ -212,7 +212,7 @@ If there are no open questions, explicitly state: "No open questions — plan is
|
|
|
212
212
|
- Final responsive sweep at all breakpoints (if UI changes)
|
|
213
213
|
7. Move all issues to Done
|
|
214
214
|
8. Update session checkpoint → delete checkpoint
|
|
215
|
-
9. Update `.opencastle/project/roadmap.md
|
|
215
|
+
9. Update `.opencastle/project/roadmap.md`, when the project keeps one
|
|
216
216
|
|
|
217
217
|
### Exit Criteria
|
|
218
218
|
|
|
@@ -33,7 +33,7 @@ The Team Lead creates the branch before any delegation and delivers it as the De
|
|
|
33
33
|
### Steps
|
|
34
34
|
|
|
35
35
|
1. Read current CMS schema to understand existing types
|
|
36
|
-
2. Check the data model documentation (
|
|
36
|
+
2. Check the data model documentation (Key Documentation in `.opencastle/project.instructions.md`) for field documentation
|
|
37
37
|
3. Check the query library (see CMS customization) for queries that will be affected
|
|
38
38
|
4. Verify schema changes don't conflict with existing content in the CMS
|
|
39
39
|
5. Document field mapping (new vs existing fields)
|
|
@@ -87,7 +87,7 @@ Developer | UI/UX Expert | Content Engineer | Data Engineer | Testing Expert | S
|
|
|
87
87
|
|
|
88
88
|
**Step 5 — Deliver:** Follow the workflow template's Delivery phase. Verify all Done → build/lint/test → commit feature branch → `GH_PAGER=cat gh pr create` — do NOT merge → link PR → clean checkpoint → call **Reviewer**.
|
|
89
89
|
|
|
90
|
-
**On Resume:** Read `SESSION-CHECKPOINT.md`. Check
|
|
90
|
+
**On Resume:** Read `SESSION-CHECKPOINT.md`. Check `.opencastle/AGENT-FAILURES.md` and `.opencastle/DISPUTES.md` when they exist. List In Progress / Todo → continue.
|
|
91
91
|
|
|
92
92
|
## Observability
|
|
93
93
|
|
|
@@ -1,47 +1,33 @@
|
|
|
1
1
|
# .opencastle/
|
|
2
2
|
|
|
3
|
-
This directory is yours. It holds the
|
|
4
|
-
the team's own instructions, skills, agents, prompts and workflows, and
|
|
5
|
-
config. `opencastle sync` compiles it,
|
|
3
|
+
This directory is yours. It holds what the assistants need to know about this
|
|
4
|
+
project, the team's own instructions, skills, agents, prompts and workflows, and
|
|
5
|
+
the team config. `opencastle sync` compiles it, with OpenCastle's own content and
|
|
6
6
|
any baseline the team extends, into the config every assistant reads.
|
|
7
7
|
|
|
8
8
|
To change what the assistants are told, edit here — not the generated files.
|
|
9
|
-
`opencastle sync --check` fails when someone edits a generated file in place
|
|
10
|
-
adds one by hand to a generated directory.
|
|
9
|
+
`opencastle sync --check` fails when someone edits a generated file in place.
|
|
11
10
|
|
|
12
|
-
##
|
|
11
|
+
## What is here
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
| Path | What it is |
|
|
14
|
+
|------|------------|
|
|
15
|
+
| `project.instructions.md` | The project: stack, structure, commands, routes, environment, and which skill covers which part. `init` wrote it from the code; correct it and add what the code cannot say |
|
|
16
|
+
| `stack/*.md` | Details the stack's skills read: the API's endpoints, the database's models and migrations, how tests and browser checks run, how it deploys |
|
|
17
|
+
| `KNOWN-ISSUES.md` | Problems and accepted risks found while working, checked before starting a task |
|
|
18
|
+
| `LESSONS-LEARNED.md` | Index of `lessons/`, one file per lesson, written by `opencastle lesson`. Rewritten by `sync`; never edit it by hand |
|
|
19
|
+
| `agents/agent-registry.md` | Which agent is for what, and on which tier |
|
|
20
|
+
| `agents/skill-matrix.json` | Which skills each agent loads, per capability slot |
|
|
21
|
+
| `config.json` | Team config, when you add one: `extends`, `exclude`, `mcpServers`, `policy`. Schema: <https://www.opencastle.dev/schema/config.json> |
|
|
22
|
+
| `lock.json`, `manifest.json` | What is installed and what every assistant is given. Written by `sync`; commit both |
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
Created when there is something to put in them: `AGENT-FAILURES.md` and
|
|
25
|
+
`DISPUTES.md` (a delegation that failed for good, and a disagreement for a
|
|
26
|
+
person to decide), `project/decisions.md` and `project/roadmap.md`, and the
|
|
27
|
+
agent-memory files. `logs/`, the convoy database and worktrees are local and
|
|
28
|
+
gitignored.
|
|
22
29
|
|
|
23
|
-
##
|
|
24
|
-
|
|
25
|
-
| File | Purpose |
|
|
26
|
-
|------|---------|
|
|
27
|
-
| `README.md` | This file |
|
|
28
|
-
| `config.json` | Team config, when you add one: `extends` (baselines), `exclude`, `mcpServers`, `policy`. Schema: <https://www.opencastle.dev/schema/config.json> |
|
|
29
|
-
| `project.instructions.md` | High-level project context — apps, libraries, tech stack, ports, URLs |
|
|
30
|
-
| `LESSONS-LEARNED.md` | Index of the lessons in `lessons/` — read before every session. Rewritten by `opencastle sync`; never edited by hand |
|
|
31
|
-
| `lessons/` | One file per lesson: retries, workarounds and gotchas, written by `opencastle lesson` |
|
|
32
|
-
| `KNOWN-ISSUES.md` | Tracked issues, limitations, and accepted risks discovered during sessions |
|
|
33
|
-
| `DISPUTES.md` | Disagreements automated review could not settle, packaged for a person to decide |
|
|
34
|
-
| `AGENT-FAILURES.md` | Dead letter queue for failed agent delegations |
|
|
35
|
-
| `AGENT-PERFORMANCE.md` | Agent success tracking, log query recipes, performance metrics |
|
|
36
|
-
| `AGENT-EXPERTISE.md` | Structured tracking of agent strengths/weaknesses across sessions |
|
|
37
|
-
| `KNOWLEDGE-GRAPH.md` | Append-only relationship log for file dependencies, patterns, decisions |
|
|
38
|
-
| `lock.json` | What every assistant is given. Written by every `sync`; commit it |
|
|
39
|
-
| `manifest.json` | What is installed, and for which assistants. Written by `init` and `sync` |
|
|
40
|
-
|
|
41
|
-
`sync` rewrites `LESSONS-LEARNED.md`, `lock.json` and `manifest.json`. It keeps
|
|
42
|
-
your edits to everything else here.
|
|
43
|
-
|
|
44
|
-
### The team's own sources
|
|
30
|
+
## The team's own sources
|
|
45
31
|
|
|
46
32
|
`opencastle sync` compiles these into every assistant, in each one's own
|
|
47
33
|
format. One with the same name as an item OpenCastle or a baseline ships
|
|
@@ -55,53 +41,10 @@ replaces it; `exclude` in `config.json` drops one.
|
|
|
55
41
|
| `prompts/*.md` | A prompt — `/oc:<name>` in Claude Code and Copilot Chat |
|
|
56
42
|
| `workflows/*.md` | A workflow template |
|
|
57
43
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
Beside any agents of your own:
|
|
61
|
-
|
|
62
|
-
| File | Purpose |
|
|
63
|
-
|------|---------|
|
|
64
|
-
| `agent-registry.md` | Specialist agents with model tier assignments and scope examples |
|
|
65
|
-
| `skill-matrix.json` | Maps capability slots to concrete skill names per agent role (machine-readable) |
|
|
66
|
-
| `skill-matrix.md` | Documentation companion explaining the skill matrix concept |
|
|
67
|
-
|
|
68
|
-
### `stack/` — Tech stack config
|
|
69
|
-
|
|
70
|
-
Notes on the stack that the skills read. `opencastle init` writes the ones for
|
|
71
|
-
what it detected, such as `testing-config.md`, or `supabase-config.md` when the
|
|
72
|
-
project uses Supabase.
|
|
73
|
-
|
|
74
|
-
### `project/` — Project management config
|
|
75
|
-
|
|
76
|
-
| File | Purpose |
|
|
77
|
-
|------|---------|
|
|
78
|
-
| `docs-structure.md` | Project documentation directory tree and practices |
|
|
79
|
-
| `roadmap.md` | Project roadmap with planned features and their status |
|
|
80
|
-
| `decisions.md` | Architecture Decision Records (ADRs) for the project |
|
|
81
|
-
| `tracker-config.md` | Task tracker settings, when a tracker is set up |
|
|
82
|
-
|
|
83
|
-
### `logs/` — Append-only NDJSON session logs
|
|
84
|
-
|
|
85
|
-
Structured logs agents append with `opencastle log` during sessions,
|
|
86
|
-
delegations, reviews, panels and disputes. Gitignored, like the other run
|
|
87
|
-
artefacts here.
|
|
88
|
-
|
|
89
|
-
| File | Purpose |
|
|
90
|
-
|------|---------|
|
|
91
|
-
| `README.md` | The record schema |
|
|
92
|
-
| `events.ndjson` | Every record, one JSON object per line |
|
|
93
|
-
|
|
94
|
-
## When to update
|
|
95
|
-
|
|
96
|
-
Update these files when the project changes — new tables, new API routes, new
|
|
97
|
-
apps, new tracker labels, etc. The skills themselves should rarely need editing;
|
|
98
|
-
changing a project ID or adding a table column is a customization change, not a
|
|
99
|
-
skill change.
|
|
100
|
-
|
|
101
|
-
## Bootstrap
|
|
44
|
+
## Keeping it current
|
|
102
45
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
in
|
|
46
|
+
Update these files when the project changes — a new table, route, app or
|
|
47
|
+
environment. A file's "Still to describe" list is what `init` could not read
|
|
48
|
+
from the code; `/oc:bootstrap-customizations` (in Claude Code or Copilot Chat;
|
|
49
|
+
elsewhere, ask for the bootstrap-customizations prompt by name) has an agent fill
|
|
50
|
+
it in.
|