opencastle 0.38.0 → 0.38.2
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/adapters/rules-dir-base.d.ts.map +1 -1
- package/dist/cli/adapters/rules-dir-base.js +28 -4
- package/dist/cli/adapters/rules-dir-base.js.map +1 -1
- package/dist/cli/adapters/rules-dir-base.test.js +17 -1
- package/dist/cli/adapters/rules-dir-base.test.js.map +1 -1
- package/dist/cli/bootstrap-on-init.test.d.ts +2 -0
- package/dist/cli/bootstrap-on-init.test.d.ts.map +1 -0
- package/dist/cli/bootstrap-on-init.test.js +90 -0
- package/dist/cli/bootstrap-on-init.test.js.map +1 -0
- package/dist/cli/bootstrap.d.ts +1 -0
- package/dist/cli/bootstrap.d.ts.map +1 -1
- package/dist/cli/bootstrap.js +1 -1
- package/dist/cli/bootstrap.js.map +1 -1
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +9 -2
- package/dist/cli/init.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/adapters/rules-dir-base.test.ts +21 -1
- package/src/cli/adapters/rules-dir-base.ts +42 -6
- package/src/cli/bootstrap-on-init.test.ts +106 -0
- package/src/cli/bootstrap.ts +1 -1
- package/src/cli/init.ts +10 -2
- package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
- package/src/orchestrator/agents/team-lead.agent.md +1 -1
- package/src/orchestrator/customizations/README.md +1 -1
- package/src/orchestrator/plugins/astro/SKILL.md +1 -1
- package/src/orchestrator/plugins/chrome-devtools/SKILL.md +1 -1
- package/src/orchestrator/plugins/contentful/SKILL.md +1 -1
- package/src/orchestrator/plugins/convex/SKILL.md +1 -1
- package/src/orchestrator/plugins/cypress/SKILL.md +1 -1
- package/src/orchestrator/plugins/jira/SKILL.md +2 -2
- package/src/orchestrator/plugins/linear/SKILL.md +3 -3
- package/src/orchestrator/plugins/netlify/SKILL.md +1 -1
- package/src/orchestrator/plugins/nx/SKILL.md +7 -7
- package/src/orchestrator/plugins/playwright/SKILL.md +1 -1
- package/src/orchestrator/plugins/prisma/SKILL.md +1 -1
- package/src/orchestrator/plugins/sanity/SKILL.md +1 -1
- package/src/orchestrator/plugins/strapi/SKILL.md +2 -2
- package/src/orchestrator/plugins/supabase/SKILL.md +1 -1
- package/src/orchestrator/plugins/trello/SKILL.md +1 -1
- package/src/orchestrator/plugins/vercel/SKILL.md +1 -1
- package/src/orchestrator/plugins/vitest/SKILL.md +1 -1
- package/src/orchestrator/skill-config-links.test.ts +30 -0
- package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +1 -1
- package/src/orchestrator/skills/agent-hooks/SKILL.md +2 -2
- package/src/orchestrator/skills/api-patterns/SKILL.md +1 -1
- package/src/orchestrator/skills/context-map/SKILL.md +11 -9
- package/src/orchestrator/skills/deployment-infrastructure/SKILL.md +1 -1
- package/src/orchestrator/skills/documentation-standards/SKILL.md +5 -2
- package/src/orchestrator/skills/fast-review/SKILL.md +8 -3
- package/src/orchestrator/skills/frontend-design/SKILL.md +0 -1
- package/src/orchestrator/skills/git-workflow/SKILL.md +1 -1
- package/src/orchestrator/skills/orchestration-protocols/SKILL.md +9 -11
- package/src/orchestrator/skills/panel-majority-vote/SKILL.md +1 -1
- package/src/orchestrator/skills/performance-optimization/SKILL.md +2 -1
- package/src/orchestrator/skills/project-consistency/SKILL.md +2 -2
- package/src/orchestrator/skills/react-development/SKILL.md +4 -7
- package/src/orchestrator/skills/security-hardening/SKILL.md +1 -1
- package/src/orchestrator/skills/session-checkpoints/CHECKPOINT-TEMPLATE.md +1 -1
- package/src/orchestrator/skills/session-checkpoints/SKILL.md +2 -2
- package/src/orchestrator/skills/team-lead-reference/SKILL.md +2 -2
- package/src/orchestrator/skills/validation-gates/REFERENCE.md +1 -1
- package/src/orchestrator/skills/validation-gates/SKILL.md +3 -3
|
@@ -32,7 +32,11 @@ function makePkgRoot(): string {
|
|
|
32
32
|
join(src, 'agents', 'developer.agent.md'),
|
|
33
33
|
'---\ndescription: Writes code\n---\n\n# Developer\n\nDo dev work.\n',
|
|
34
34
|
)
|
|
35
|
-
writeFileSync(
|
|
35
|
+
writeFileSync(
|
|
36
|
+
join(src, 'skills', 'demo-skill', 'SKILL.md'),
|
|
37
|
+
'# Demo Skill\n\nSkill body. Details in [REFERENCE.md](./REFERENCE.md), and more in REFERENCE.md.\n',
|
|
38
|
+
)
|
|
39
|
+
writeFileSync(join(src, 'skills', 'demo-skill', 'REFERENCE.md'), '# Reference\n\nExtra detail.\n')
|
|
36
40
|
writeFileSync(join(src, 'agent-workflows', 'bug-fix.md'), '# Bug Fix\n\nTriage then fix.\n')
|
|
37
41
|
writeFileSync(join(src, 'agent-workflows', 'README.md'), '# Index\n\nShould be excluded.\n')
|
|
38
42
|
writeFileSync(join(src, 'prompts', 'generate.prompt.md'), '# Generate\n\nPrompt body.\n')
|
|
@@ -106,6 +110,22 @@ describe.each([
|
|
|
106
110
|
expect(existsSync(join(rules(), 'prompts', `generate${ext}`))).toBe(true)
|
|
107
111
|
})
|
|
108
112
|
|
|
113
|
+
it('points a skill at where its sibling actually lands', async () => {
|
|
114
|
+
// The sibling is written to `skills/<skill>/REFERENCE<ext>` while the skill
|
|
115
|
+
// itself is `skills/<skill><ext>`, so the source's own `./REFERENCE.md` is
|
|
116
|
+
// wrong in both directory and extension. Fourteen shipped skills point at a
|
|
117
|
+
// sibling this way, and every one of those pointers used to lead nowhere.
|
|
118
|
+
await adapter.install(pkgRoot, projectRoot)
|
|
119
|
+
const skill = readFileSync(join(rules(), 'skills', `demo-skill${ext}`), 'utf8')
|
|
120
|
+
expect(skill).not.toMatch(/(?<![\w/-])(?:\.\/)?REFERENCE\.md(?![\w-])/)
|
|
121
|
+
// Both the markdown link and the bare prose mention are retargeted.
|
|
122
|
+
expect(skill).toContain(`[demo-skill/REFERENCE${ext}](demo-skill/REFERENCE${ext})`)
|
|
123
|
+
expect(skill).toContain(`more in demo-skill/REFERENCE${ext}`)
|
|
124
|
+
// And the retargeted path resolves, read from the rules root where the
|
|
125
|
+
// skill file sits.
|
|
126
|
+
expect(existsSync(join(rules(), 'skills', 'demo-skill', `REFERENCE${ext}`))).toBe(true)
|
|
127
|
+
})
|
|
128
|
+
|
|
109
129
|
it('excludes agent-workflows/README.md', async () => {
|
|
110
130
|
await adapter.install(pkgRoot, projectRoot)
|
|
111
131
|
expect(existsSync(join(rules(), 'agent-workflows', `README${ext}`))).toBe(false)
|
|
@@ -116,11 +116,21 @@ export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
|
|
|
116
116
|
interface ConvertFileOptions {
|
|
117
117
|
alwaysApply?: boolean
|
|
118
118
|
descriptionFallback?: string
|
|
119
|
+
/**
|
|
120
|
+
* Rewrites the body before the rule is assembled.
|
|
121
|
+
*
|
|
122
|
+
* A skill's siblings land at `skills/<skill>/<NAME><ruleExt>` while the skill
|
|
123
|
+
* itself is `skills/<skill><ruleExt>`, so a pointer the source writes as
|
|
124
|
+
* `REFERENCE.md` is wrong twice over here: wrong directory and wrong
|
|
125
|
+
* extension. Fourteen skills point at a sibling this way, and on Cursor and
|
|
126
|
+
* Windsurf every one of those pointers led nowhere.
|
|
127
|
+
*/
|
|
128
|
+
rewriteBody?: (_body: string) => string
|
|
119
129
|
}
|
|
120
130
|
|
|
121
131
|
async function convertFile(
|
|
122
132
|
srcPath: string,
|
|
123
|
-
{ alwaysApply = false, descriptionFallback = '' }: ConvertFileOptions = {},
|
|
133
|
+
{ alwaysApply = false, descriptionFallback = '', rewriteBody }: ConvertFileOptions = {},
|
|
124
134
|
): Promise<string> {
|
|
125
135
|
const content = await readFile(srcPath, 'utf8')
|
|
126
136
|
const { frontmatter, body } = splitFrontmatter(content)
|
|
@@ -138,7 +148,7 @@ export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
|
|
|
138
148
|
applyTo: meta['applyTo'],
|
|
139
149
|
alwaysApply,
|
|
140
150
|
tier: meta['tier'],
|
|
141
|
-
}), '---', '', body.trim(), '']
|
|
151
|
+
}), '---', '', (rewriteBody ? rewriteBody(body) : body).trim(), '']
|
|
142
152
|
return lines.join('\n')
|
|
143
153
|
}
|
|
144
154
|
|
|
@@ -221,6 +231,26 @@ export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
|
|
|
221
231
|
}
|
|
222
232
|
}
|
|
223
233
|
|
|
234
|
+
/**
|
|
235
|
+
* Points a skill's sibling references at where this adapter actually puts them.
|
|
236
|
+
*
|
|
237
|
+
* `REFERENCE.md` and `./REFERENCE.md` both become `<skill>/REFERENCE<ruleExt>`,
|
|
238
|
+
* which covers the markdown links most skills use and the bare prose mentions
|
|
239
|
+
* a few of them use instead.
|
|
240
|
+
*/
|
|
241
|
+
function retargetSiblings(body: string, skill: string, extras: string[]): string {
|
|
242
|
+
let out = body
|
|
243
|
+
for (const extra of extras) {
|
|
244
|
+
const target = `${skill}/${ruleName(extra)}`
|
|
245
|
+
// Escaped because sibling names carry dots, and one carries two
|
|
246
|
+
// (`panel-report.template.md`), each of which would otherwise match any
|
|
247
|
+
// character and retarget text that is not a path.
|
|
248
|
+
const escaped = extra.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
249
|
+
out = out.replace(new RegExp(`(?<![\\w/-])(?:\\./)?${escaped}(?![\\w-])`, 'g'), target)
|
|
250
|
+
}
|
|
251
|
+
return out
|
|
252
|
+
}
|
|
253
|
+
|
|
224
254
|
async function convertSkills(
|
|
225
255
|
srcRoot: string,
|
|
226
256
|
destDir: string,
|
|
@@ -239,17 +269,23 @@ export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
|
|
|
239
269
|
const skillFile = resolve(skillsDir, entry.name, 'SKILL.md')
|
|
240
270
|
if (!existsSync(skillFile)) continue
|
|
241
271
|
|
|
272
|
+
// Extra files in the skill directory (e.g. templates). Resolved before the
|
|
273
|
+
// skill is written, because the skill's own pointers at them have to be
|
|
274
|
+
// rewritten to where they actually land.
|
|
275
|
+
const files = await readdir(resolve(skillsDir, entry.name))
|
|
276
|
+
const extras = files.filter((f) => f !== 'SKILL.md' && f.endsWith('.md'))
|
|
277
|
+
|
|
242
278
|
await writeConverted(
|
|
243
279
|
skillFile,
|
|
244
280
|
resolve(destDir, `${entry.name}${ruleExt}`),
|
|
245
|
-
{
|
|
281
|
+
{
|
|
282
|
+
descriptionFallback: `Skill: ${entry.name}`,
|
|
283
|
+
rewriteBody: (body) => retargetSiblings(body, entry.name, extras),
|
|
284
|
+
},
|
|
246
285
|
results,
|
|
247
286
|
overwrite,
|
|
248
287
|
)
|
|
249
288
|
|
|
250
|
-
// Extra files in the skill directory (e.g. templates)
|
|
251
|
-
const files = await readdir(resolve(skillsDir, entry.name))
|
|
252
|
-
const extras = files.filter((f) => f !== 'SKILL.md' && f.endsWith('.md'))
|
|
253
289
|
if (extras.length > 0) {
|
|
254
290
|
const subDest = resolve(destDir, entry.name)
|
|
255
291
|
await mkdir(subDest, { recursive: true })
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `init` must actually scan the project it is initialising.
|
|
3
|
+
*
|
|
4
|
+
* `bootstrapCustomizations` fills `.opencastle/` in from what the repo turned
|
|
5
|
+
* out to be: the project name, the tech-stack table, and the key-commands block
|
|
6
|
+
* that records which package manager to use. It is guarded so that a re-run
|
|
7
|
+
* cannot overwrite notes the user has since written, because its stack-config
|
|
8
|
+
* step writes unconditionally.
|
|
9
|
+
*
|
|
10
|
+
* That guard read `.opencastle/agents`, and the scaffold step eighteen lines
|
|
11
|
+
* above it creates `.opencastle/agents`. So it was true on the first run too,
|
|
12
|
+
* and the scan never executed for anybody: every marker in
|
|
13
|
+
* `project.instructions.md` stayed bare. The visible symptom was six skills
|
|
14
|
+
* hardcoding `pnpm`, having no populated file to read it from.
|
|
15
|
+
*
|
|
16
|
+
* Both halves are asserted here, because fixing the first by deleting the guard
|
|
17
|
+
* would destroy user content on the second.
|
|
18
|
+
*/
|
|
19
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
20
|
+
import { execFileSync } from 'node:child_process'
|
|
21
|
+
import { mkdtempSync, rmSync, writeFileSync, readFileSync, existsSync, appendFileSync } from 'node:fs'
|
|
22
|
+
import { tmpdir } from 'node:os'
|
|
23
|
+
import { join, resolve } from 'node:path'
|
|
24
|
+
|
|
25
|
+
const repoRoot = resolve(import.meta.dirname, '..', '..')
|
|
26
|
+
const cli = join(repoRoot, 'bin', 'cli.mjs')
|
|
27
|
+
|
|
28
|
+
// `bin/cli.mjs` loads the command modules from `dist/`, so with no build these
|
|
29
|
+
// would all fail on a missing import rather than on anything they assert. CI
|
|
30
|
+
// builds before `npm test`, so nothing here is skipped there.
|
|
31
|
+
const cliBuilt = existsSync(join(repoRoot, 'dist', 'cli', 'init.js'))
|
|
32
|
+
|
|
33
|
+
function run(cwd: string, ...args: string[]): string {
|
|
34
|
+
try {
|
|
35
|
+
return execFileSync('node', [cli, ...args], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] })
|
|
36
|
+
} catch (err) {
|
|
37
|
+
return String((err as { stdout?: string }).stdout ?? '')
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
describe.skipIf(!cliBuilt)('init scans the project it initialises', () => {
|
|
42
|
+
let projectRoot: string
|
|
43
|
+
|
|
44
|
+
beforeEach(() => {
|
|
45
|
+
projectRoot = mkdtempSync(join(tmpdir(), 'oc-bootstrap-'))
|
|
46
|
+
execFileSync('git', ['init', '-q'], { cwd: projectRoot })
|
|
47
|
+
writeFileSync(join(projectRoot, 'CLAUDE.md'), '# House rules\n')
|
|
48
|
+
writeFileSync(
|
|
49
|
+
join(projectRoot, 'package.json'),
|
|
50
|
+
JSON.stringify({
|
|
51
|
+
name: 'demo-app',
|
|
52
|
+
description: 'a demo app',
|
|
53
|
+
scripts: { dev: 'next dev', build: 'next build', test: 'vitest run', lint: 'eslint .' },
|
|
54
|
+
}),
|
|
55
|
+
)
|
|
56
|
+
// The lockfile is how the package manager is detected.
|
|
57
|
+
writeFileSync(join(projectRoot, 'pnpm-lock.yaml'), '')
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
afterEach(() => {
|
|
61
|
+
rmSync(projectRoot, { recursive: true, force: true })
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const instructions = (): string =>
|
|
65
|
+
readFileSync(join(projectRoot, '.opencastle', 'project.instructions.md'), 'utf8')
|
|
66
|
+
|
|
67
|
+
it('records the detected package manager and its commands', () => {
|
|
68
|
+
run(projectRoot, 'init', '--yes')
|
|
69
|
+
const text = instructions()
|
|
70
|
+
expect(text).toContain('**Package manager:** `pnpm`')
|
|
71
|
+
expect(text).toContain('pnpm run test')
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
it('records what the repo is, not just what the template says', () => {
|
|
75
|
+
run(projectRoot, 'init', '--yes')
|
|
76
|
+
const text = instructions()
|
|
77
|
+
expect(text).toContain('**Project:** demo-app')
|
|
78
|
+
expect(text).toContain('**Description:** a demo app')
|
|
79
|
+
expect(text).toMatch(/\|\s*Package Manager\s*\|\s*pnpm\s*\|/)
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('leaves the user’s own notes alone when init is re-run', () => {
|
|
83
|
+
run(projectRoot, 'init', '--yes')
|
|
84
|
+
const stackFile = join(projectRoot, '.opencastle', 'stack', 'testing-config.md')
|
|
85
|
+
expect(existsSync(stackFile)).toBe(true)
|
|
86
|
+
appendFileSync(stackFile, '\nNOTES THE USER WROTE\n')
|
|
87
|
+
|
|
88
|
+
run(projectRoot, 'init', '--yes')
|
|
89
|
+
expect(readFileSync(stackFile, 'utf8')).toContain('NOTES THE USER WROTE')
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
it('leaves them alone after remove --keep-files, which drops only the manifest', () => {
|
|
93
|
+
run(projectRoot, 'init', '--yes')
|
|
94
|
+
const stackFile = join(projectRoot, '.opencastle', 'stack', 'testing-config.md')
|
|
95
|
+
appendFileSync(stackFile, '\nNOTES THE USER WROTE\n')
|
|
96
|
+
|
|
97
|
+
run(projectRoot, 'remove', '--keep-files', '--yes')
|
|
98
|
+
// No manifest means `isReinit` is false, so only the directory check stands
|
|
99
|
+
// between the user's notes and bootstrap's unconditional writes.
|
|
100
|
+
expect(existsSync(join(projectRoot, '.opencastle', 'manifest.json'))).toBe(false)
|
|
101
|
+
expect(existsSync(join(projectRoot, '.opencastle', 'agents'))).toBe(true)
|
|
102
|
+
|
|
103
|
+
run(projectRoot, 'init', '--yes')
|
|
104
|
+
expect(readFileSync(stackFile, 'utf8')).toContain('NOTES THE USER WROTE')
|
|
105
|
+
})
|
|
106
|
+
})
|
package/src/cli/bootstrap.ts
CHANGED
|
@@ -413,7 +413,7 @@ async function removeDataPipelineConfig(
|
|
|
413
413
|
result.removed.push('stack/data-pipeline-config.md')
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
const TRACKER_TOOLS = new Set<string>(['linear', 'jira', 'trello'])
|
|
416
|
+
export const TRACKER_TOOLS = new Set<string>(['linear', 'jira', 'trello'])
|
|
417
417
|
|
|
418
418
|
async function handleTrackerConfig(
|
|
419
419
|
opencastleDir: string,
|
package/src/cli/init.ts
CHANGED
|
@@ -495,6 +495,14 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
495
495
|
}
|
|
496
496
|
|
|
497
497
|
// ── Scaffold customizations to .opencastle/ ──────────────────────────────
|
|
498
|
+
// Sampled before the copy below, which creates `.opencastle/agents` itself.
|
|
499
|
+
// Read after it, this was true on every run including the first, so the
|
|
500
|
+
// bootstrap guard downstream never let the project scan execute at all: no
|
|
501
|
+
// tech-stack table, no key commands, not even the project name. Every skill
|
|
502
|
+
// that wanted the package manager hardcoded one instead, because the file
|
|
503
|
+
// that was supposed to record it was never filled in.
|
|
504
|
+
const alreadyScaffolded = existsSync(resolve(projectRoot, '.opencastle', 'agents'))
|
|
505
|
+
|
|
498
506
|
const custSrcDir = resolve(getOrchestratorRoot(pkgRoot), 'customizations')
|
|
499
507
|
if (existsSync(custSrcDir)) {
|
|
500
508
|
const custDestDir = resolve(projectRoot, '.opencastle')
|
|
@@ -516,8 +524,8 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
516
524
|
// the manifest, by design) and a manifest with merge-conflict markers, which
|
|
517
525
|
// `readManifest` reports as "no install". Both then ran bootstrap's
|
|
518
526
|
// unconditional renames over a populated `.opencastle/` and replaced the
|
|
519
|
-
// user's own stack notes with a blank template.
|
|
520
|
-
|
|
527
|
+
// user's own stack notes with a blank template. `alreadyScaffolded` is
|
|
528
|
+
// sampled above, before the scaffold step supplies its own answer.
|
|
521
529
|
const bootstrapResult = isReinit || alreadyScaffolded
|
|
522
530
|
? { populated: [], removed: [], renamed: [] }
|
|
523
531
|
: await bootstrapCustomizations(projectRoot, combinedRepoInfo, stack)
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
"hash": "
|
|
2
|
+
"hash": "7154735a",
|
|
3
3
|
"configHash": "30f8ea04",
|
|
4
|
-
"lockfileHash": "
|
|
5
|
-
"browserHash": "
|
|
4
|
+
"lockfileHash": "074a6123",
|
|
5
|
+
"browserHash": "b62fc278",
|
|
6
6
|
"optimized": {
|
|
7
7
|
"astro > cssesc": {
|
|
8
8
|
"src": "../../../../../node_modules/cssesc/cssesc.js",
|
|
9
9
|
"file": "astro___cssesc.js",
|
|
10
|
-
"fileHash": "
|
|
10
|
+
"fileHash": "3d315c43",
|
|
11
11
|
"needsInterop": true
|
|
12
12
|
},
|
|
13
13
|
"astro > aria-query": {
|
|
14
14
|
"src": "../../../../../node_modules/aria-query/lib/index.js",
|
|
15
15
|
"file": "astro___aria-query.js",
|
|
16
|
-
"fileHash": "
|
|
16
|
+
"fileHash": "dceac4a8",
|
|
17
17
|
"needsInterop": true
|
|
18
18
|
},
|
|
19
19
|
"astro > axobject-query": {
|
|
20
20
|
"src": "../../../../../node_modules/axobject-query/lib/index.js",
|
|
21
21
|
"file": "astro___axobject-query.js",
|
|
22
|
-
"fileHash": "
|
|
22
|
+
"fileHash": "2cf3c3b4",
|
|
23
23
|
"needsInterop": true
|
|
24
24
|
}
|
|
25
25
|
},
|
|
@@ -59,7 +59,7 @@ Developer | UI/UX Expert | Content Engineer | Data Engineer | Testing Expert | S
|
|
|
59
59
|
|
|
60
60
|
## Delegation
|
|
61
61
|
|
|
62
|
-
**Sub-agents
|
|
62
|
+
**Sub-agents**: synchronous, critical-path, dispatched through whichever sub-agent mechanism the assistant exposes. **Background agents**: async in isolated worktrees, parallel work. Always name agent explicitly. Include: issue ID, objective, file paths, acceptance criteria, self-improvement reminder.
|
|
63
63
|
|
|
64
64
|
**⛔ Hard gates:**
|
|
65
65
|
- Log delegation record immediately after each return/spawn — **observability-logging** (`--mechanism sub-agent` or `--mechanism background`).
|
|
@@ -6,7 +6,7 @@ Project-specific configuration for the AI agent framework. Everything in this fo
|
|
|
6
6
|
|
|
7
7
|
Skills and instructions contain generic methodology (how to write migrations, how to test in a browser, how to run a panel review). This folder holds the concrete values those skills operate on — project IDs, table schemas, team UUIDs, endpoint inventories, and similar configuration that changes per project.
|
|
8
8
|
|
|
9
|
-
Skills reference these files
|
|
9
|
+
Skills reference these files by root-relative path, like `.opencastle/stack/api-config.md`, so agents automatically load project context when they load a skill.
|
|
10
10
|
|
|
11
11
|
## Contents
|
|
12
12
|
|
|
@@ -27,6 +27,6 @@ Docs: https://docs.astro.build
|
|
|
27
27
|
1. Declare it in `src/content.config.ts` via `defineCollection` + Zod schema; export from `collections`.
|
|
28
28
|
2. Add `src/content/<name>/` with one sample file.
|
|
29
29
|
3. Query with `getCollection('<name>', filterFn)`.
|
|
30
|
-
4.
|
|
30
|
+
4. The build must exit zero — collection types are generated at build time, so type errors only surface after a build.
|
|
31
31
|
|
|
32
32
|
Integrations: `astro add react tailwind mdx sitemap` etc. — never hand-edit the integrations array.
|
|
@@ -7,7 +7,7 @@ description: "Drive real browsers via Chrome DevTools MCP: navigate pages, captu
|
|
|
7
7
|
|
|
8
8
|
# Browser Testing with Chrome DevTools MCP
|
|
9
9
|
|
|
10
|
-
Project test app, selectors, suites, and breakpoints:
|
|
10
|
+
Project test app, selectors, suites, and breakpoints: `.opencastle/stack/testing-config.md`. Docs: https://developer.chrome.com/docs/devtools
|
|
11
11
|
|
|
12
12
|
## Context budget — the main constraint
|
|
13
13
|
|
|
@@ -5,7 +5,7 @@ description: "Creates Contentful content types, queries entries via GraphQL/REST
|
|
|
5
5
|
|
|
6
6
|
# Contentful CMS
|
|
7
7
|
|
|
8
|
-
Project config, content types, and API keys:
|
|
8
|
+
Project config, content types, and API keys: `.opencastle/stack/cms-config.md`. Docs: https://www.contentful.com/developers/docs/
|
|
9
9
|
|
|
10
10
|
## Gotchas
|
|
11
11
|
|
|
@@ -7,7 +7,7 @@ description: "Convex reactive database patterns, schema design, real-time querie
|
|
|
7
7
|
|
|
8
8
|
# Convex Database
|
|
9
9
|
|
|
10
|
-
Project-specific schema, functions, and deployment details:
|
|
10
|
+
Project-specific schema, functions, and deployment details: `.opencastle/stack/database-config.md`.
|
|
11
11
|
Official docs: https://docs.convex.dev/
|
|
12
12
|
|
|
13
13
|
## Hard limits per transaction
|
|
@@ -5,7 +5,7 @@ description: "Writes Cypress E2E/component tests, configures `cy.intercept()` an
|
|
|
5
5
|
|
|
6
6
|
# Cypress Testing
|
|
7
7
|
|
|
8
|
-
Project test config and breakpoints:
|
|
8
|
+
Project test config and breakpoints: `.opencastle/stack/testing-config.md`. Docs: https://docs.cypress.io
|
|
9
9
|
|
|
10
10
|
## Layout
|
|
11
11
|
|
|
@@ -7,11 +7,11 @@ description: "Create and update Jira issues, epics, and sprints; manage backlog
|
|
|
7
7
|
|
|
8
8
|
# Task Management with Jira
|
|
9
9
|
|
|
10
|
-
Project keys, workflow state IDs, and board config:
|
|
10
|
+
Project keys, workflow state IDs, and board config: `.opencastle/project/jira-config.md`. Docs: https://developer.atlassian.com/cloud/jira/platform/
|
|
11
11
|
|
|
12
12
|
## Gotchas
|
|
13
13
|
|
|
14
|
-
- Transitions are constrained by the project's workflow — a jump the board does not allow fails even with a valid status name. Read the workflow state IDs from `
|
|
14
|
+
- Transitions are constrained by the project's workflow — a jump the board does not allow fails even with a valid status name. Read the workflow state IDs from `jira-config.md` before transitioning; retry once, then stop.
|
|
15
15
|
- Status names in JQL must be quoted when they contain spaces: `status = "In Progress"`.
|
|
16
16
|
- A `create` call is only successful if it returns an issue key. Verify before treating the issue as tracked.
|
|
17
17
|
- PR-driven status updates only happen when the GitHub/Jira integration is configured; link by putting the key (`PROJ-123`) in the branch or PR title.
|
|
@@ -7,20 +7,20 @@ description: "Creates and names Linear issues, assigns labels and priorities, ma
|
|
|
7
7
|
|
|
8
8
|
# Task Management with Linear
|
|
9
9
|
|
|
10
|
-
Team ID, workflow state UUIDs, and label UUIDs:
|
|
10
|
+
Team ID, workflow state UUIDs, and label UUIDs: `.opencastle/project/linear-config.md`. Docs: https://linear.app/docs
|
|
11
11
|
|
|
12
12
|
## The `stateId` UUID trap
|
|
13
13
|
|
|
14
14
|
`update_issue` requires a workflow state **UUID**. Passing a display name like `"In Progress"` always fails with `stateId must be a UUID`. The names returned by `list_issues` / `get_issue` are display-only and are *not* valid `stateId` values.
|
|
15
15
|
|
|
16
16
|
```json
|
|
17
|
-
// works — UUID read from
|
|
17
|
+
// works — UUID read from linear-config.md
|
|
18
18
|
{ "issueId": "TAS-42", "stateId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }
|
|
19
19
|
// fails — name, not UUID
|
|
20
20
|
{ "issueId": "TAS-42", "status": "In Progress" }
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
If `
|
|
23
|
+
If `linear-config.md` has no state UUIDs: skip status updates and log a warning. To populate them, ask the user for Linear *Settings → Teams → Workflow* (the UUID is in the browser URL per state) or the GraphQL `workflowStates { nodes { id name } }` query. Labels and teams are UUIDs too (`teamId`, `labelIds`).
|
|
24
24
|
|
|
25
25
|
## Other gotchas
|
|
26
26
|
|
|
@@ -5,7 +5,7 @@ description: "Deploy sites, configure serverless and edge functions, and verify
|
|
|
5
5
|
|
|
6
6
|
# Netlify Deployment
|
|
7
7
|
|
|
8
|
-
Project deployment architecture, env vars, and key files:
|
|
8
|
+
Project deployment architecture, env vars, and key files: `.opencastle/stack/deployment-config.md`. Docs: https://docs.netlify.com
|
|
9
9
|
|
|
10
10
|
`main` → production (auto). `feature/*`, `fix/*` → deploy preview at a unique URL (auto).
|
|
11
11
|
|
|
@@ -17,13 +17,13 @@ npm test | npm run test | npm run lint | npm run build | npm run dev | npm start
|
|
|
17
17
|
npx jest | npx eslint | jest --coverage | eslint --fix
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Always `
|
|
20
|
+
Always `npx nx run <project>:<target>` for one project, `npx nx affected -t <target>` for multi-project changes.
|
|
21
21
|
|
|
22
22
|
## Requirements
|
|
23
23
|
|
|
24
24
|
- Minimum coverage **95%** for new components/functions. Reports land in `reports/coverage/jest/`.
|
|
25
|
-
- Lint always with `--fix`. CSS/SCSS uses a separate target: `
|
|
26
|
-
- `
|
|
25
|
+
- Lint always with `--fix`. CSS/SCSS uses a separate target: `npx nx run <project>:lint-styles --fix`.
|
|
26
|
+
- `npx nx run <project>:test -u` updates snapshots. `npx nx format --fix` after any generation.
|
|
27
27
|
|
|
28
28
|
## MCP tools — query, don't guess
|
|
29
29
|
|
|
@@ -44,15 +44,15 @@ Always `yarn nx run <project>:<target>` for one project, `yarn nx affected -t <t
|
|
|
44
44
|
Prefer **local** generators over plugin generators — they encode repo conventions. Manual file creation is a last resort after `nx_generators` and `nx_available_plugins` both come up empty. Read `nx_generator_schema`, then read the generator source for side effects (config edits, dep installs).
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
npx nx generate <generator> <options> --dry-run --no-interactive # preview
|
|
48
|
+
npx nx generate <generator> <options> --no-interactive
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
- **`--no-interactive` is mandatory** — prompts hang the run with no output.
|
|
52
52
|
- **Verify cwd first** — generators derive file placement from it.
|
|
53
53
|
|
|
54
|
-
After generating: `
|
|
54
|
+
After generating: `npx nx format --fix`, then lint/test/build the affected projects.
|
|
55
55
|
|
|
56
56
|
## Running tasks
|
|
57
57
|
|
|
58
|
-
Check `nx_current_running_tasks_details` before starting anything. **Continuous targets (`serve`, `dev`) are already running — read their output instead of re-running.** To rerun, use `
|
|
58
|
+
Check `nx_current_running_tasks_details` before starting anything. **Continuous targets (`serve`, `dev`) are already running — read their output instead of re-running.** To rerun, use `npx nx run <taskId>` so NX context is preserved.
|
|
@@ -7,7 +7,7 @@ description: "Playwright E2E testing patterns, cross-browser configuration, page
|
|
|
7
7
|
|
|
8
8
|
# Playwright Testing
|
|
9
9
|
|
|
10
|
-
Project test config and breakpoints:
|
|
10
|
+
Project test config and breakpoints: `.opencastle/stack/testing-config.md`. Docs: https://playwright.dev/docs/intro
|
|
11
11
|
|
|
12
12
|
Layout: specs `tests/e2e/{feature}/`, page objects `tests/pages/`, fixtures `tests/fixtures/`.
|
|
13
13
|
|
|
@@ -7,7 +7,7 @@ description: "Prisma ORM schema design, migrations, client generation, and query
|
|
|
7
7
|
|
|
8
8
|
# Prisma Database
|
|
9
9
|
|
|
10
|
-
Project schema and connection details:
|
|
10
|
+
Project schema and connection details: `.opencastle/stack/database-config.md`. Docs: https://www.prisma.io/docs
|
|
11
11
|
|
|
12
12
|
## Migration rules
|
|
13
13
|
|
|
@@ -7,7 +7,7 @@ description: "Manages Sanity CMS schemas, GROQ queries, dataset exports/imports,
|
|
|
7
7
|
|
|
8
8
|
# Sanity CMS
|
|
9
9
|
|
|
10
|
-
Project config, schemas, plugins, document types, and GROQ examples:
|
|
10
|
+
Project config, schemas, plugins, document types, and GROQ examples: `.opencastle/stack/sanity-config.md`. Docs: https://www.sanity.io/docs
|
|
11
11
|
|
|
12
12
|
## Rules that prevent silent failures
|
|
13
13
|
|
|
@@ -7,7 +7,7 @@ description: "Builds Strapi content types, extends controllers and services, imp
|
|
|
7
7
|
|
|
8
8
|
# Strapi CMS
|
|
9
9
|
|
|
10
|
-
Project config, content types, and deployment details:
|
|
10
|
+
Project config, content types, and deployment details: `.opencastle/stack/cms-config.md`. Docs: https://docs.strapi.io/
|
|
11
11
|
|
|
12
12
|
## File placement is load-bearing
|
|
13
13
|
|
|
@@ -32,4 +32,4 @@ Strapi discovers code by path — a correct file in the wrong place is simply ig
|
|
|
32
32
|
|
|
33
33
|
## Verify
|
|
34
34
|
|
|
35
|
-
`
|
|
35
|
+
the `develop` script, confirm the type appears in admin, create a test entry, then assert `GET /api/<type>?pagination[page]=1` returns 200 with a `data` array and `GET /api/<type>?populate=*` returns the expected relations. Schema errors surface under the `build` script.
|
|
@@ -7,7 +7,7 @@ description: "Generates Supabase database migrations, writes RLS policies with a
|
|
|
7
7
|
|
|
8
8
|
# Supabase Database
|
|
9
9
|
|
|
10
|
-
Project schema, roles, migration history, auth flow, and key files:
|
|
10
|
+
Project schema, roles, migration history, auth flow, and key files: `.opencastle/stack/supabase-config.md`. Docs: https://supabase.com/docs
|
|
11
11
|
|
|
12
12
|
## RLS gotchas
|
|
13
13
|
|
|
@@ -5,7 +5,7 @@ description: "Create and manage Trello cards, checklists, and boards for kanban
|
|
|
5
5
|
|
|
6
6
|
# Task Management with Trello
|
|
7
7
|
|
|
8
|
-
For project-specific board IDs and list IDs, see
|
|
8
|
+
For project-specific board IDs and list IDs, see `.opencastle/project/trello-config.md`.
|
|
9
9
|
|
|
10
10
|
## MCP Server
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@ description: "Vercel deployment workflows, environment management, domain config
|
|
|
5
5
|
|
|
6
6
|
# Vercel Deployment
|
|
7
7
|
|
|
8
|
-
Vercel-specific deployment patterns and MCP tool usage. For project-specific deployment architecture, environment variables, and key files, see
|
|
8
|
+
Vercel-specific deployment patterns and MCP tool usage. For project-specific deployment architecture, environment variables, and key files, see `.opencastle/stack/deployment-config.md`.
|
|
9
9
|
|
|
10
10
|
## Deployment Model
|
|
11
11
|
|
|
@@ -7,7 +7,7 @@ description: "Vitest unit and integration testing patterns, commands, mocking (v
|
|
|
7
7
|
|
|
8
8
|
# Vitest Testing
|
|
9
9
|
|
|
10
|
-
For project-specific test configuration, see
|
|
10
|
+
For project-specific test configuration, see `.opencastle/stack/testing-config.md`.
|
|
11
11
|
|
|
12
12
|
## Commands
|
|
13
13
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { readFileSync, readdirSync } from 'node:fs'
|
|
3
|
+
import { join, relative, resolve } from 'node:path'
|
|
4
|
+
import { TRACKER_TOOLS } from '../cli/bootstrap.js'
|
|
5
|
+
|
|
6
|
+
const ORCHESTRATOR = resolve(import.meta.dirname)
|
|
7
|
+
|
|
8
|
+
const markdown = readdirSync(ORCHESTRATOR, { recursive: true, withFileTypes: true })
|
|
9
|
+
.filter(entry => entry.isFile() && entry.name.endsWith('.md'))
|
|
10
|
+
.map(entry => join(entry.parentPath, entry.name))
|
|
11
|
+
|
|
12
|
+
describe('skill references to project config', () => {
|
|
13
|
+
// Skills compile into nested folders such as .claude/skills/<name>/SKILL.md,
|
|
14
|
+
// where ../../ lands inside the assistant's own directory. A root-relative
|
|
15
|
+
// path reads the same from every target.
|
|
16
|
+
it('never links to .opencastle/ through ../../', () => {
|
|
17
|
+
const offenders = markdown
|
|
18
|
+
.filter(file => /\]\(\.\.\/\.\.\/\.opencastle\//.test(readFileSync(file, 'utf8')))
|
|
19
|
+
.map(file => relative(ORCHESTRATOR, file))
|
|
20
|
+
expect(offenders).toEqual([])
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
// bootstrap renames project/tracker-config.md to <tracker>-config.md, so a
|
|
24
|
+
// skill that names the template's filename points at a file no project has.
|
|
25
|
+
it.each([...TRACKER_TOOLS])('%s skill names the config file bootstrap writes', tracker => {
|
|
26
|
+
const skill = readFileSync(join(ORCHESTRATOR, 'plugins', tracker, 'SKILL.md'), 'utf8')
|
|
27
|
+
expect(skill).toContain(`.opencastle/project/${tracker}-config.md`)
|
|
28
|
+
expect(skill).not.toContain('tracker-config.md')
|
|
29
|
+
})
|
|
30
|
+
})
|
|
@@ -30,7 +30,7 @@ Log delegation: `opencastle log --type=delegation --issue=TAS-123 --status=start
|
|
|
30
30
|
|---|--------|---------|
|
|
31
31
|
| 1 | Log completion | `opencastle log --type=delegation --issue=TAS-XX --status=complete` |
|
|
32
32
|
| 2 | Fast review | `opencastle log --type=review --issue=TAS-XX --verdict=PASS` |
|
|
33
|
-
| 3 | CI checks |
|
|
33
|
+
| 3 | CI checks | Lint, typecheck, and test (commands via the **codebase-tool** slot) |
|
|
34
34
|
| 4 | Verify ACs | Check each acceptance criterion against tracker issue |
|
|
35
35
|
| 5 | Track issues | `rg -n "Discovered issue" KNOWN-ISSUES.md || gh issue create` |
|
|
36
36
|
| 6 | Lesson check | If agent retried, verify lesson added via **self-improvement** |
|
|
@@ -55,7 +55,7 @@ See [HOOKS-REFERENCE.md](HOOKS-REFERENCE.md) for extended startup checks (approv
|
|
|
55
55
|
| 5 | Prompt includes "Read LESSONS-LEARNED.md first" |
|
|
56
56
|
| 6 | 5+ files → load **context-map** skill |
|
|
57
57
|
|
|
58
|
-
All 6 must pass before
|
|
58
|
+
All 6 must pass before the sub-agent is dispatched. See [HOOKS-REFERENCE.md](HOOKS-REFERENCE.md) for example commands per check.
|
|
59
59
|
|
|
60
60
|
## on-post-delegate — Team Lead only
|
|
61
61
|
|
|
@@ -63,7 +63,7 @@ All 6 must pass before `runSubagent`. See [HOOKS-REFERENCE.md](HOOKS-REFERENCE.m
|
|
|
63
63
|
|---|--------|
|
|
64
64
|
| 1 | **⛔** `opencastle log --type=delegation --issue=TAS-XX --status=complete` |
|
|
65
65
|
| 2 | Run **fast-review** skill |
|
|
66
|
-
| 3 |
|
|
66
|
+
| 3 | Lint, typecheck, and test (commands via the **codebase-tool** slot) |
|
|
67
67
|
| 4 | `gh issue view TAS-XX --json body -q '.body'` — verify each AC met |
|
|
68
68
|
| 5 | If agent retried → verify lesson added via **self-improvement** |
|
|
69
69
|
| 6 | Move to Done or re-delegate; 3rd failure → `.opencastle/AGENT-FAILURES.md` |
|
|
@@ -5,7 +5,7 @@ description: "Creates API route handlers, implements Server Actions with Zod sch
|
|
|
5
5
|
|
|
6
6
|
# API Patterns
|
|
7
7
|
|
|
8
|
-
Project-specific config:
|
|
8
|
+
Project-specific config: `.opencastle/stack/api-config.md`.
|
|
9
9
|
|
|
10
10
|
## Architecture
|
|
11
11
|
|