opencastle 1.2.0 → 1.3.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/README.md +4 -4
- package/dist/cli/adapters/antigravity.d.ts +0 -1
- package/dist/cli/adapters/antigravity.d.ts.map +1 -1
- package/dist/cli/adapters/antigravity.js +2 -1
- package/dist/cli/adapters/antigravity.js.map +1 -1
- package/dist/cli/adapters/claude-code.d.ts +0 -1
- package/dist/cli/adapters/claude-code.d.ts.map +1 -1
- package/dist/cli/adapters/claude-code.js +0 -1
- package/dist/cli/adapters/claude-code.js.map +1 -1
- package/dist/cli/adapters/cursor.d.ts.map +1 -1
- package/dist/cli/adapters/cursor.js +8 -1
- package/dist/cli/adapters/cursor.js.map +1 -1
- package/dist/cli/adapters/opencode.d.ts +12 -5
- package/dist/cli/adapters/opencode.d.ts.map +1 -1
- package/dist/cli/adapters/opencode.js +17 -5
- package/dist/cli/adapters/opencode.js.map +1 -1
- package/dist/cli/adapters/rules-dir-base.d.ts +12 -1
- package/dist/cli/adapters/rules-dir-base.d.ts.map +1 -1
- package/dist/cli/adapters/rules-dir-base.js +43 -57
- package/dist/cli/adapters/rules-dir-base.js.map +1 -1
- package/dist/cli/adapters/rules-dir-base.test.js +27 -18
- package/dist/cli/adapters/rules-dir-base.test.js.map +1 -1
- package/dist/cli/adapters/single-file-base.d.ts +11 -0
- package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
- package/dist/cli/adapters/single-file-base.js +20 -12
- package/dist/cli/adapters/single-file-base.js.map +1 -1
- package/dist/cli/adapters/vscode.d.ts +2 -1
- package/dist/cli/adapters/vscode.d.ts.map +1 -1
- package/dist/cli/adapters/vscode.js +2 -1
- package/dist/cli/adapters/vscode.js.map +1 -1
- package/dist/cli/adapters/windsurf.d.ts.map +1 -1
- package/dist/cli/adapters/windsurf.js +11 -1
- package/dist/cli/adapters/windsurf.js.map +1 -1
- package/dist/cli/baseline.d.ts.map +1 -1
- package/dist/cli/baseline.js +15 -8
- package/dist/cli/baseline.js.map +1 -1
- package/dist/cli/ci.d.ts.map +1 -1
- package/dist/cli/ci.js +18 -4
- package/dist/cli/ci.js.map +1 -1
- package/dist/cli/codex-target.test.js +14 -1
- package/dist/cli/codex-target.test.js.map +1 -1
- package/dist/cli/doctor.test.js +2 -2
- package/dist/cli/doctor.test.js.map +1 -1
- package/dist/cli/explain.d.ts +5 -0
- package/dist/cli/explain.d.ts.map +1 -1
- package/dist/cli/explain.js +38 -2
- package/dist/cli/explain.js.map +1 -1
- package/dist/cli/init.test.js +47 -23
- package/dist/cli/init.test.js.map +1 -1
- package/dist/cli/managed-paths.d.ts.map +1 -1
- package/dist/cli/managed-paths.js +3 -1
- package/dist/cli/managed-paths.js.map +1 -1
- package/dist/cli/mcp-audit.d.ts.map +1 -1
- package/dist/cli/mcp-audit.js +2 -0
- package/dist/cli/mcp-audit.js.map +1 -1
- package/dist/cli/mcp-upgrade.test.js +24 -1
- package/dist/cli/mcp-upgrade.test.js.map +1 -1
- package/dist/cli/mcp.d.ts.map +1 -1
- package/dist/cli/mcp.js +22 -3
- package/dist/cli/mcp.js.map +1 -1
- package/dist/cli/sync-check.test.js +5 -4
- package/dist/cli/sync-check.test.js.map +1 -1
- package/dist/cli/team-commands.test.js +12 -0
- package/dist/cli/team-commands.test.js.map +1 -1
- package/dist/cli/team-sources.test.js +10 -0
- package/dist/cli/team-sources.test.js.map +1 -1
- package/dist/cli/types.d.ts +1 -1
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli/windsurf-target.test.d.ts +2 -0
- package/dist/cli/windsurf-target.test.d.ts.map +1 -0
- package/dist/cli/windsurf-target.test.js +62 -0
- package/dist/cli/windsurf-target.test.js.map +1 -0
- package/dist/orchestrator/plugins/registry.test.d.ts +2 -0
- package/dist/orchestrator/plugins/registry.test.d.ts.map +1 -0
- package/dist/orchestrator/plugins/registry.test.js +37 -0
- package/dist/orchestrator/plugins/registry.test.js.map +1 -0
- package/package.json +1 -1
- package/src/cli/adapters/antigravity.ts +2 -1
- package/src/cli/adapters/claude-code.ts +0 -1
- package/src/cli/adapters/cursor.ts +8 -1
- package/src/cli/adapters/opencode.ts +18 -6
- package/src/cli/adapters/rules-dir-base.test.ts +28 -18
- package/src/cli/adapters/rules-dir-base.ts +51 -90
- package/src/cli/adapters/single-file-base.ts +30 -12
- package/src/cli/adapters/vscode.ts +2 -1
- package/src/cli/adapters/windsurf.ts +11 -1
- package/src/cli/baseline.ts +16 -6
- package/src/cli/ci.ts +19 -4
- package/src/cli/codex-target.test.ts +15 -1
- package/src/cli/doctor.test.ts +2 -2
- package/src/cli/explain.ts +36 -2
- package/src/cli/init.test.ts +50 -23
- package/src/cli/managed-paths.ts +3 -1
- package/src/cli/mcp-audit.ts +2 -0
- package/src/cli/mcp-upgrade.test.ts +26 -1
- package/src/cli/mcp.ts +22 -3
- package/src/cli/sync-check.test.ts +5 -4
- package/src/cli/team-commands.test.ts +16 -0
- package/src/cli/team-sources.test.ts +11 -0
- package/src/cli/types.ts +1 -1
- package/src/cli/windsurf-target.test.ts +70 -0
- package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
- package/src/orchestrator/plugins/registry.test.ts +42 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windsurf-target.test.js","sourceRoot":"","sources":["../../src/cli/windsurf-target.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACjG,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAA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AC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.test.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/plugins/registry.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { TECH_PLUGINS, TEAM_PLUGINS } from './index.js';
|
|
5
|
+
import { getMcpConfigRelPath } from '../../cli/mcp.js';
|
|
6
|
+
import { IDE_ADAPTERS, VALID_IDES } from '../../cli/adapters/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Facts written down twice, held to each other.
|
|
9
|
+
*
|
|
10
|
+
* `TechTool` and `TeamTool` are hand-written unions beside the registry, and
|
|
11
|
+
* `hetzner` was in the registry and missing from `TechTool`. Each target's MCP
|
|
12
|
+
* config path is in its adapter and again in `getMcpConfigRelPath`, which the
|
|
13
|
+
* rebuild, strip and audit read — the two must name the same file, or `sync`
|
|
14
|
+
* writes one file and `remove` cleans another.
|
|
15
|
+
*/
|
|
16
|
+
const types = readFileSync(join(import.meta.dirname, '..', '..', 'cli', 'types.ts'), 'utf8');
|
|
17
|
+
function union(name) {
|
|
18
|
+
const m = new RegExp(`export type ${name} = ([^;]+);`).exec(types);
|
|
19
|
+
expect(m, `${name} not found in types.ts`).toBeTruthy();
|
|
20
|
+
return [...m[1].matchAll(/'([^']+)'/g)].map((x) => x[1]).sort();
|
|
21
|
+
}
|
|
22
|
+
describe('the plugin registry and the types that name it', () => {
|
|
23
|
+
it('TechTool names every tech integration', () => {
|
|
24
|
+
expect(union('TechTool')).toEqual(TECH_PLUGINS.map((p) => p.id).sort());
|
|
25
|
+
});
|
|
26
|
+
it('TeamTool names every team integration', () => {
|
|
27
|
+
expect(union('TeamTool')).toEqual(TEAM_PLUGINS.map((p) => p.id).sort());
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
describe('MCP config paths', () => {
|
|
31
|
+
it.each(VALID_IDES)('%s: the adapter and getMcpConfigRelPath name the same file', async (ide) => {
|
|
32
|
+
const adapter = await IDE_ADAPTERS[ide]();
|
|
33
|
+
const configs = adapter.getManagedPaths().customizable.filter((p) => !p.endsWith('/'));
|
|
34
|
+
expect(configs).toEqual([getMcpConfigRelPath(ide)]);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=registry.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.test.js","sourceRoot":"","sources":["../../../src/orchestrator/plugins/registry.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAGtE;;;;;;;;GAQG;AACH,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,CAAA;AAE5F,SAAS,KAAK,CAAC,IAAY;IACzB,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,eAAe,IAAI,aAAa,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClE,MAAM,CAAC,CAAC,EAAE,GAAG,IAAI,wBAAwB,CAAC,CAAC,UAAU,EAAE,CAAA;IACvD,OAAO,CAAC,GAAG,CAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAA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,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencastle",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Write your AI config once, for every assistant and every teammate: compiles instructions, agents, skills, commands and MCP servers for Claude Code, Copilot, Cursor, Windsurf, OpenCode, Codex and Antigravity, shared across your team's repositories.",
|
|
6
6
|
"bin": {
|
|
@@ -11,7 +11,6 @@ import { createSingleFileAdapter } from './single-file-base.js'
|
|
|
11
11
|
* agents/*.agent.md -> .agents/agents/<name>.md
|
|
12
12
|
* agent-workflows/*.md -> .agents/workflows/<name>.md
|
|
13
13
|
* prompts/*.prompt.md -> .agents/prompts/<name>.md
|
|
14
|
-
* customizations/ -> .agents/customizations/ (scaffolded once)
|
|
15
14
|
* mcp.json -> .agents/mcp_config.json (mcpServers format)
|
|
16
15
|
*
|
|
17
16
|
* Note: Antigravity's MCP integration officially reads ~/.gemini/antigravity/mcp_config.json
|
|
@@ -31,6 +30,8 @@ const { install, update, getManagedPaths, getDoctorChecks } = createSingleFileAd
|
|
|
31
30
|
workflowsDir: 'workflows',
|
|
32
31
|
workflowPrefix: '',
|
|
33
32
|
frameworkDirs: ['agents', 'skills', 'prompts', 'workflows'],
|
|
33
|
+
// Antigravity reads AGENTS.md as well as GEMINI.md, cumulatively.
|
|
34
|
+
alsoReads: { rootFile: 'AGENTS.md', writtenBy: ['codex', 'opencode'] },
|
|
34
35
|
})
|
|
35
36
|
|
|
36
37
|
export { install, update, getManagedPaths, getDoctorChecks }
|
|
@@ -10,7 +10,6 @@ import { CLAUDE_COMMANDS_DIR, legacyClaudeCommands } from '../command-namespace.
|
|
|
10
10
|
* skills/<name>/SKILL.md → .claude/skills/<name>/SKILL.md (+ sibling resources, frontmatter preserved)
|
|
11
11
|
* agent-workflows/*.md → .claude/commands/oc/workflow-<name>.md (/oc:workflow-<name>)
|
|
12
12
|
* prompts/*.prompt.md → .claude/commands/oc/<name>.md (/oc:<name>)
|
|
13
|
-
* customizations/ → .claude/customizations/ (scaffolded once)
|
|
14
13
|
*
|
|
15
14
|
* Commands go under `oc/`, which Claude Code turns into the `oc:` namespace.
|
|
16
15
|
* The rest of `.claude/commands/` belongs to whoever writes there; `sync` never
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { createRulesDirAdapter } from './rules-dir-base.js'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Cursor adapter — a rules-directory IDE writing `.mdc` files
|
|
4
|
+
* Cursor adapter — a rules-directory IDE writing `.mdc` files, and skills as
|
|
5
|
+
* Agent Skills.
|
|
5
6
|
*
|
|
6
7
|
* Cursor expresses scoping with an `alwaysApply` boolean plus an optional
|
|
7
8
|
* `globs` array; a rule with neither is matched on its description.
|
|
9
|
+
*
|
|
10
|
+
* Skills go to `.agents/skills/`, the cross-assistant location Cursor reads
|
|
11
|
+
* beside `.cursor/skills/` — so with Codex or Antigravity also selected, all
|
|
12
|
+
* three read one copy. Releases before this one flattened each skill into
|
|
13
|
+
* `.cursor/rules/skills/<name>.mdc`; `sync` removes those.
|
|
8
14
|
*/
|
|
9
15
|
const adapter = createRulesDirAdapter({
|
|
10
16
|
ideId: 'cursor',
|
|
@@ -12,6 +18,7 @@ const adapter = createRulesDirAdapter({
|
|
|
12
18
|
rootRulesFile: '.cursorrules',
|
|
13
19
|
configDir: '.cursor',
|
|
14
20
|
ruleExt: '.mdc',
|
|
21
|
+
skillsDir: '.agents/skills',
|
|
15
22
|
renderFrontmatter({ description, applyTo, alwaysApply, tier }) {
|
|
16
23
|
const lines: string[] = []
|
|
17
24
|
if (description) lines.push(`description: "${description}"`)
|
|
@@ -1,31 +1,43 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs'
|
|
2
|
+
import { resolve } from 'node:path'
|
|
1
3
|
import { createSingleFileAdapter } from './single-file-base.js'
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* OpenCode adapter.
|
|
5
7
|
*
|
|
6
|
-
* Generates AGENTS.md (root instructions)
|
|
8
|
+
* Generates AGENTS.md (root instructions), the cross-assistant skills
|
|
9
|
+
* directory, and .opencode/ structure.
|
|
7
10
|
*
|
|
8
11
|
* copilot-instructions.md → AGENTS.md (combined with instructions/)
|
|
9
|
-
* skills/<name>/SKILL.md → .
|
|
12
|
+
* skills/<name>/SKILL.md → .agents/skills/<name>/SKILL.md (+ sibling resources, frontmatter preserved)
|
|
10
13
|
* agents/*.agent.md → .opencode/agents/<name>.md
|
|
11
14
|
* agent-workflows/*.md → .opencode/workflows/<name>.md
|
|
12
15
|
* prompts/*.prompt.md → .opencode/prompts/<name>.md
|
|
13
|
-
* customizations/ → .opencode/customizations/ (scaffolded once)
|
|
14
16
|
* mcp.json → opencode.json (OpenCode format: type local/remote)
|
|
17
|
+
*
|
|
18
|
+
* OpenCode reads skills from `.opencode/skills/`, `.claude/skills/` and
|
|
19
|
+
* `.agents/skills/`. Writing them to `.agents/skills/` shares one copy with
|
|
20
|
+
* Codex, Cursor, Windsurf and Antigravity; OpenCode keeps one copy of a name it
|
|
21
|
+
* finds twice, unpredictably, so every extra directory was a chance of a stale
|
|
22
|
+
* one winning. Releases before this one wrote `.opencode/skills/`; `sync`
|
|
23
|
+
* removes it.
|
|
15
24
|
*/
|
|
16
25
|
|
|
17
26
|
export const IDE_ID = 'opencode'
|
|
18
27
|
|
|
19
|
-
const
|
|
28
|
+
const LEGACY_SKILLS = '.opencode/skills/'
|
|
29
|
+
|
|
30
|
+
const { install, update, getManagedPaths, getDoctorChecks, getLegacyOutputs } = createSingleFileAdapter({
|
|
20
31
|
rootFile: 'AGENTS.md',
|
|
21
32
|
dotDir: '.opencode',
|
|
33
|
+
skillsDir: '.agents/skills',
|
|
22
34
|
mcpConfigPath: 'opencode.json',
|
|
23
35
|
mcpFormat: 'opencode',
|
|
24
36
|
promptsDir: 'prompts',
|
|
25
37
|
workflowsDir: 'workflows',
|
|
26
38
|
workflowPrefix: '',
|
|
27
39
|
frameworkDirs: ['agents', 'skills', 'prompts', 'workflows'],
|
|
40
|
+
legacyOutputs: (projectRoot) => (existsSync(resolve(projectRoot, LEGACY_SKILLS)) ? [LEGACY_SKILLS] : []),
|
|
28
41
|
})
|
|
29
42
|
|
|
30
|
-
export { install, update, getManagedPaths, getDoctorChecks }
|
|
31
|
-
|
|
43
|
+
export { install, update, getManagedPaths, getDoctorChecks, getLegacyOutputs }
|
|
@@ -50,6 +50,7 @@ describe.each([
|
|
|
50
50
|
ext: '.mdc',
|
|
51
51
|
configDir: '.cursor',
|
|
52
52
|
rootFile: '.cursorrules',
|
|
53
|
+
mcpPath: '.cursor/mcp.json',
|
|
53
54
|
},
|
|
54
55
|
{
|
|
55
56
|
name: 'windsurf',
|
|
@@ -57,8 +58,11 @@ describe.each([
|
|
|
57
58
|
ext: '.md',
|
|
58
59
|
configDir: '.windsurf',
|
|
59
60
|
rootFile: '.windsurfrules',
|
|
61
|
+
mcpPath: '.devin/mcp_config.json',
|
|
60
62
|
},
|
|
61
|
-
])('$name adapter', ({ adapter, ext, configDir, rootFile }) => {
|
|
63
|
+
])('$name adapter', ({ adapter, ext, configDir, rootFile, mcpPath }) => {
|
|
64
|
+
// Both read Agent Skills natively, from the cross-assistant location.
|
|
65
|
+
const skillsDir = '.agents/skills'
|
|
62
66
|
let pkgRoot: string
|
|
63
67
|
let projectRoot: string
|
|
64
68
|
|
|
@@ -73,6 +77,7 @@ describe.each([
|
|
|
73
77
|
})
|
|
74
78
|
|
|
75
79
|
const rules = () => join(projectRoot, configDir, 'rules')
|
|
80
|
+
const skillFile = () => join(projectRoot, skillsDir, 'demo-skill', 'SKILL.md')
|
|
76
81
|
|
|
77
82
|
it('writes the root rules file pointing at the rules directory', async () => {
|
|
78
83
|
await adapter.install(pkgRoot, projectRoot)
|
|
@@ -105,25 +110,29 @@ describe.each([
|
|
|
105
110
|
await adapter.install(pkgRoot, projectRoot)
|
|
106
111
|
expect(existsSync(join(rules(), `general${ext}`))).toBe(true)
|
|
107
112
|
expect(existsSync(join(rules(), 'agents', `developer${ext}`))).toBe(true)
|
|
108
|
-
expect(existsSync(
|
|
113
|
+
expect(existsSync(skillFile())).toBe(true)
|
|
109
114
|
expect(existsSync(join(rules(), 'agent-workflows', `bug-fix${ext}`))).toBe(true)
|
|
110
115
|
expect(existsSync(join(rules(), 'prompts', `generate${ext}`))).toBe(true)
|
|
111
116
|
})
|
|
112
117
|
|
|
113
|
-
it('
|
|
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
|
+
it('writes skills as Agent Skills, with every file and no rule copy', async () => {
|
|
118
119
|
await adapter.install(pkgRoot, projectRoot)
|
|
119
|
-
const
|
|
120
|
-
expect(
|
|
121
|
-
//
|
|
122
|
-
expect(
|
|
123
|
-
expect(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
const dir = join(projectRoot, skillsDir, 'demo-skill')
|
|
121
|
+
expect(readdirSync(dir).sort()).toEqual(['REFERENCE.md', 'SKILL.md'])
|
|
122
|
+
// Copied as written: the sibling sits beside it, so its pointer is right as it is.
|
|
123
|
+
expect(readFileSync(join(dir, 'SKILL.md'), 'utf8')).toContain('[REFERENCE.md](./REFERENCE.md)')
|
|
124
|
+
expect(existsSync(join(rules(), 'skills'))).toBe(false)
|
|
125
|
+
expect(readFileSync(join(projectRoot, rootFile), 'utf8')).toContain(`Skills are in \`${skillsDir}/\``)
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('moves skills an earlier release wrote as rules, and leaves no empty folder', async () => {
|
|
129
|
+
mkdirSync(join(rules(), 'skills', 'demo-skill'), { recursive: true })
|
|
130
|
+
writeFileSync(join(rules(), 'skills', `demo-skill${ext}`), 'old rule')
|
|
131
|
+
writeFileSync(join(rules(), 'skills', 'demo-skill', `REFERENCE${ext}`), 'old sibling')
|
|
132
|
+
const result = await adapter.update(pkgRoot, projectRoot)
|
|
133
|
+
expect(existsSync(join(rules(), 'skills'))).toBe(false)
|
|
134
|
+
expect(result.deleted).toContain(`${configDir}/rules/skills/demo-skill${ext}`)
|
|
135
|
+
expect(existsSync(skillFile())).toBe(true)
|
|
127
136
|
})
|
|
128
137
|
|
|
129
138
|
it('excludes agent-workflows/README.md', async () => {
|
|
@@ -146,7 +155,7 @@ describe.each([
|
|
|
146
155
|
|
|
147
156
|
it('preserves the body after the frontmatter', async () => {
|
|
148
157
|
await adapter.install(pkgRoot, projectRoot)
|
|
149
|
-
expect(readFileSync(
|
|
158
|
+
expect(readFileSync(skillFile(), 'utf8')).toContain('Skill body.')
|
|
150
159
|
})
|
|
151
160
|
|
|
152
161
|
it('skips existing files on install but overwrites them on update', async () => {
|
|
@@ -197,10 +206,11 @@ describe.each([
|
|
|
197
206
|
// Co-owned, not framework — `remove --all` may only strip its own block from it.
|
|
198
207
|
expect(managed.merged).toContain(rootFile)
|
|
199
208
|
expect(managed.framework).not.toContain(rootFile)
|
|
200
|
-
expect(managed.customizable).toContain(
|
|
209
|
+
expect(managed.customizable).toContain(mcpPath)
|
|
201
210
|
for (const check of adapter.getDoctorChecks()) {
|
|
202
|
-
expect(check.path === rootFile || check.path.startsWith(`${configDir}/`)).toBe(true)
|
|
211
|
+
expect(check.path === rootFile || check.path.startsWith(`${configDir}/`) || check.path === `${skillsDir}/`).toBe(true)
|
|
203
212
|
}
|
|
213
|
+
expect(managed.framework).toContain(`${skillsDir}/`)
|
|
204
214
|
})
|
|
205
215
|
|
|
206
216
|
it('generates only files with the IDE extension in the rules root', async () => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { resolve, join, basename } from 'node:path'
|
|
1
|
+
import { resolve, join, basename, dirname } from 'node:path'
|
|
2
2
|
import { mkdir, writeFile, readdir, readFile, unlink, rename } from 'node:fs/promises'
|
|
3
|
-
import { existsSync, readdirSync, realpathSync } from 'node:fs'
|
|
3
|
+
import { existsSync, readdirSync, realpathSync, rmdirSync } from 'node:fs'
|
|
4
4
|
import { withSource, type CompileSource } from '../layers.js'
|
|
5
|
+
import { copyDir, mergeCopyResults } from '../copy.js'
|
|
5
6
|
import { scaffoldMcpConfigInto } from '../mcp.js'
|
|
6
7
|
import type { CopyResults, DoctorCheck, IdeChoice, ManagedPaths, RepoInfo, StackConfig } from '../types.js'
|
|
7
8
|
import { splitFrontmatter, parseFrontmatterString } from './frontmatter.js'
|
|
@@ -14,7 +15,7 @@ import { writeManagedBlock, recordMerge } from '../managed-block.js'
|
|
|
14
15
|
* copilot-instructions.md → <rootRulesFile>
|
|
15
16
|
* instructions/*.md → <configDir>/rules/*<ruleExt> (always applies)
|
|
16
17
|
* agents/*.agent.md → <configDir>/rules/agents/*<ruleExt>
|
|
17
|
-
* skills/{star}/SKILL.md → <
|
|
18
|
+
* skills/{star}/SKILL.md → <skillsDir>/<name>/SKILL.md, as Agent Skills
|
|
18
19
|
* agent-workflows/*.md → <configDir>/rules/agent-workflows/*<ruleExt>
|
|
19
20
|
* prompts/*.prompt.md → <configDir>/rules/prompts/*<ruleExt>
|
|
20
21
|
*
|
|
@@ -50,6 +51,17 @@ export interface RulesDirConfig {
|
|
|
50
51
|
ruleExt: string
|
|
51
52
|
/** Renders the YAML frontmatter lines (without the `---` fences). */
|
|
52
53
|
renderFrontmatter(scope: RuleScope): string[]
|
|
54
|
+
/**
|
|
55
|
+
* Where the IDE reads Agent Skills, relative to the project root.
|
|
56
|
+
*
|
|
57
|
+
* Cursor and Windsurf both read `SKILL.md` folders natively now. Flattened
|
|
58
|
+
* into rules, as every release before this one did, a skill lost its scripts
|
|
59
|
+
* and assets, could not be invoked by name, and was matched on its
|
|
60
|
+
* description as a rule instead of loaded as a skill.
|
|
61
|
+
*/
|
|
62
|
+
skillsDir: string
|
|
63
|
+
/** The project MCP config, when it is not `<configDir>/mcp.json`. */
|
|
64
|
+
mcpConfigPath?: string
|
|
53
65
|
}
|
|
54
66
|
|
|
55
67
|
export interface RulesDirAdapter {
|
|
@@ -96,12 +108,13 @@ async function reconcileCase(onDisk: string, visited: Set<string>): Promise<bool
|
|
|
96
108
|
export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
|
|
97
109
|
const { ideId, ideLabel, rootRulesFile, configDir, ruleExt, renderFrontmatter } = config
|
|
98
110
|
const rulesPrefix = `${configDir}/rules`
|
|
99
|
-
const mcpPath = `${configDir}/mcp.json`
|
|
111
|
+
const mcpPath = config.mcpConfigPath ?? `${configDir}/mcp.json`
|
|
100
112
|
|
|
101
113
|
const rootIntro = [
|
|
102
114
|
'# Project Instructions',
|
|
103
115
|
'',
|
|
104
|
-
`All conventions, architecture, and project context live in \`${rulesPrefix}/\`. Read those files before making changes
|
|
116
|
+
`All conventions, architecture, and project context live in \`${rulesPrefix}/\`. Read those files before making changes. ` +
|
|
117
|
+
`Skills are in \`${config.skillsDir}/\` — load one when a task matches its description.`,
|
|
105
118
|
'',
|
|
106
119
|
].join('\n')
|
|
107
120
|
|
|
@@ -115,21 +128,11 @@ export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
|
|
|
115
128
|
interface ConvertFileOptions {
|
|
116
129
|
alwaysApply?: boolean
|
|
117
130
|
descriptionFallback?: string
|
|
118
|
-
/**
|
|
119
|
-
* Rewrites the body before the rule is assembled.
|
|
120
|
-
*
|
|
121
|
-
* A skill's siblings land at `skills/<skill>/<NAME><ruleExt>` while the skill
|
|
122
|
-
* itself is `skills/<skill><ruleExt>`, so a pointer the source writes as
|
|
123
|
-
* `REFERENCE.md` is wrong twice over here: wrong directory and wrong
|
|
124
|
-
* extension. Fourteen skills point at a sibling this way, and on Cursor and
|
|
125
|
-
* Windsurf every one of those pointers led nowhere.
|
|
126
|
-
*/
|
|
127
|
-
rewriteBody?: (_body: string) => string
|
|
128
131
|
}
|
|
129
132
|
|
|
130
133
|
async function convertFile(
|
|
131
134
|
srcPath: string,
|
|
132
|
-
{ alwaysApply = false, descriptionFallback = ''
|
|
135
|
+
{ alwaysApply = false, descriptionFallback = '' }: ConvertFileOptions = {},
|
|
133
136
|
): Promise<string> {
|
|
134
137
|
const content = await readFile(srcPath, 'utf8')
|
|
135
138
|
const { frontmatter, body } = splitFrontmatter(content)
|
|
@@ -147,7 +150,7 @@ export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
|
|
|
147
150
|
applyTo: meta['applyTo'],
|
|
148
151
|
alwaysApply,
|
|
149
152
|
tier: meta['tier'],
|
|
150
|
-
}), '---', '',
|
|
153
|
+
}), '---', '', body.trim(), '']
|
|
151
154
|
return lines.join('\n')
|
|
152
155
|
}
|
|
153
156
|
|
|
@@ -230,74 +233,15 @@ export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
|
|
|
230
233
|
}
|
|
231
234
|
}
|
|
232
235
|
|
|
233
|
-
/**
|
|
234
|
-
|
|
235
|
-
*
|
|
236
|
-
* `REFERENCE.md` and `./REFERENCE.md` both become `<skill>/REFERENCE<ruleExt>`,
|
|
237
|
-
* which covers the markdown links most skills use and the bare prose mentions
|
|
238
|
-
* a few of them use instead.
|
|
239
|
-
*/
|
|
240
|
-
function retargetSiblings(body: string, skill: string, extras: string[]): string {
|
|
241
|
-
let out = body
|
|
242
|
-
for (const extra of extras) {
|
|
243
|
-
const target = `${skill}/${ruleName(extra)}`
|
|
244
|
-
// Escaped because sibling names carry dots, and one carries two
|
|
245
|
-
// (`panel-report.template.md`), each of which would otherwise match any
|
|
246
|
-
// character and retarget text that is not a path.
|
|
247
|
-
const escaped = extra.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
248
|
-
out = out.replace(new RegExp(`(?<![\\w/-])(?:\\./)?${escaped}(?![\\w-])`, 'g'), target)
|
|
249
|
-
}
|
|
250
|
-
return out
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
async function convertSkills(
|
|
254
|
-
srcRoot: string,
|
|
255
|
-
destDir: string,
|
|
256
|
-
results: CopyResults,
|
|
257
|
-
overwrite = false,
|
|
258
|
-
excludedSkills?: Set<string>,
|
|
259
|
-
): Promise<void> {
|
|
236
|
+
/** Skills as Agent Skills: each `<name>/` folder, every file in it, frontmatter kept. */
|
|
237
|
+
async function copySkills(srcRoot: string, projectRoot: string, results: CopyResults, overwrite: boolean): Promise<void> {
|
|
260
238
|
const skillsDir = resolve(srcRoot, 'skills')
|
|
261
239
|
if (!existsSync(skillsDir)) return
|
|
262
|
-
|
|
263
|
-
await mkdir(
|
|
264
|
-
|
|
240
|
+
const dest = resolve(projectRoot, config.skillsDir)
|
|
241
|
+
await mkdir(dest, { recursive: true })
|
|
265
242
|
for (const entry of await readdir(skillsDir, { withFileTypes: true })) {
|
|
266
|
-
if (!entry.isDirectory()) continue
|
|
267
|
-
|
|
268
|
-
const skillFile = resolve(skillsDir, entry.name, 'SKILL.md')
|
|
269
|
-
if (!existsSync(skillFile)) continue
|
|
270
|
-
|
|
271
|
-
// Extra files in the skill directory (e.g. templates). Resolved before the
|
|
272
|
-
// skill is written, because the skill's own pointers at them have to be
|
|
273
|
-
// rewritten to where they actually land.
|
|
274
|
-
const files = await readdir(resolve(skillsDir, entry.name))
|
|
275
|
-
const extras = files.filter((f) => f !== 'SKILL.md' && f.endsWith('.md'))
|
|
276
|
-
|
|
277
|
-
await writeConverted(
|
|
278
|
-
skillFile,
|
|
279
|
-
resolve(destDir, `${entry.name}${ruleExt}`),
|
|
280
|
-
{
|
|
281
|
-
descriptionFallback: `Skill: ${entry.name}`,
|
|
282
|
-
rewriteBody: (body) => retargetSiblings(body, entry.name, extras),
|
|
283
|
-
},
|
|
284
|
-
results,
|
|
285
|
-
overwrite,
|
|
286
|
-
)
|
|
287
|
-
|
|
288
|
-
if (extras.length > 0) {
|
|
289
|
-
const subDest = resolve(destDir, entry.name)
|
|
290
|
-
await mkdir(subDest, { recursive: true })
|
|
291
|
-
for (const file of extras) {
|
|
292
|
-
await writeConverted(
|
|
293
|
-
resolve(skillsDir, entry.name, file),
|
|
294
|
-
resolve(subDest, ruleName(file)),
|
|
295
|
-
{ descriptionFallback: `${entry.name}: ${basename(file, '.md')}` },
|
|
296
|
-
results,
|
|
297
|
-
overwrite,
|
|
298
|
-
)
|
|
299
|
-
}
|
|
300
|
-
}
|
|
243
|
+
if (!entry.isDirectory() || !existsSync(resolve(skillsDir, entry.name, 'SKILL.md'))) continue
|
|
244
|
+
mergeCopyResults(results, await copyDir(resolve(skillsDir, entry.name), resolve(dest, entry.name), { overwrite }))
|
|
301
245
|
}
|
|
302
246
|
}
|
|
303
247
|
|
|
@@ -336,7 +280,7 @@ export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
|
|
|
336
280
|
descriptionPrefix: 'Agent: ',
|
|
337
281
|
removeExt: '.agent.md',
|
|
338
282
|
})
|
|
339
|
-
await
|
|
283
|
+
await copySkills(srcRoot, projectRoot, results, false)
|
|
340
284
|
await convertDir(srcRoot, 'agent-workflows', resolve(rulesRoot, 'agent-workflows'), results, {
|
|
341
285
|
descriptionPrefix: 'Workflow: ',
|
|
342
286
|
excludeFiles: new Set(['README.md']),
|
|
@@ -380,10 +324,12 @@ export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
|
|
|
380
324
|
// Note what is here, so the sweep below can name what it removes. A file
|
|
381
325
|
// disappearing with no line of output is not a warning the user saw.
|
|
382
326
|
const beforeSweep = new Map<string, string>()
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
327
|
+
for (const [root, label] of [
|
|
328
|
+
[rulesRoot, `${configDir}/rules`],
|
|
329
|
+
[resolve(projectRoot, config.skillsDir), config.skillsDir],
|
|
330
|
+
]) {
|
|
331
|
+
if (!existsSync(root)) continue
|
|
332
|
+
for (const rel of filesUnderDir(root)) beforeSweep.set(resolve(root, rel), `${label}/${rel}`)
|
|
387
333
|
}
|
|
388
334
|
|
|
389
335
|
await convertDir(srcRoot, 'instructions', rulesRoot, results, {
|
|
@@ -395,7 +341,7 @@ export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
|
|
|
395
341
|
removeExt: '.agent.md',
|
|
396
342
|
overwrite: true,
|
|
397
343
|
})
|
|
398
|
-
await
|
|
344
|
+
await copySkills(srcRoot, projectRoot, results, true)
|
|
399
345
|
await convertDir(srcRoot, 'agent-workflows', resolve(rulesRoot, 'agent-workflows'), results, {
|
|
400
346
|
descriptionPrefix: 'Workflow: ',
|
|
401
347
|
overwrite: true,
|
|
@@ -417,10 +363,25 @@ export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
|
|
|
417
363
|
// reported as a stray first and removed here. That is what makes
|
|
418
364
|
// `sync --check` clearable.
|
|
419
365
|
const visited = new Set(results.visited ?? [])
|
|
366
|
+
const emptied = new Set<string>()
|
|
420
367
|
for (const [abs, rel] of beforeSweep) {
|
|
421
368
|
if (await reconcileCase(abs, visited)) continue
|
|
422
369
|
await unlink(abs)
|
|
423
370
|
;(results.deleted ??= []).push(rel)
|
|
371
|
+
emptied.add(dirname(abs))
|
|
372
|
+
}
|
|
373
|
+
// Folders this sweep emptied — a skill moved out of `rules/skills/`, or one
|
|
374
|
+
// with no source left — go too; the roots themselves stay.
|
|
375
|
+
const roots = [rulesRoot, resolve(projectRoot, config.skillsDir)]
|
|
376
|
+
for (const start of [...emptied].sort((a, b) => b.length - a.length)) {
|
|
377
|
+
for (let dir = start; !roots.includes(dir) && roots.some((r) => dir.startsWith(r)); dir = dirname(dir)) {
|
|
378
|
+
try {
|
|
379
|
+
if (readdirSync(dir).length > 0) break
|
|
380
|
+
rmdirSync(dir)
|
|
381
|
+
} catch {
|
|
382
|
+
break
|
|
383
|
+
}
|
|
384
|
+
}
|
|
424
385
|
}
|
|
425
386
|
|
|
426
387
|
// Customizations are NEVER overwritten.
|
|
@@ -438,7 +399,7 @@ export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
|
|
|
438
399
|
// `.cursor/rules/team-conventions.mdc` and reported "all clear" moments
|
|
439
400
|
// before `sync` removed it. This is Cursor's documented place for project
|
|
440
401
|
// rules, so that file is one people really do write.
|
|
441
|
-
framework: [`${rulesPrefix}/`],
|
|
402
|
+
framework: [`${rulesPrefix}/`, `${config.skillsDir}/`],
|
|
442
403
|
customizable: ['.opencastle/', mcpPath],
|
|
443
404
|
}
|
|
444
405
|
}
|
|
@@ -448,7 +409,7 @@ export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
|
|
|
448
409
|
{ label: `${ideLabel} rules file`, path: rootRulesFile, type: 'file' },
|
|
449
410
|
{ label: 'Instruction rules', path: `${rulesPrefix}/`, type: 'dir', countContents: true, countFilter: ruleExt },
|
|
450
411
|
{ label: 'Agent rules', path: `${rulesPrefix}/agents/`, type: 'dir', countContents: true, countFilter: ruleExt },
|
|
451
|
-
{ label: '
|
|
412
|
+
{ label: 'Skills directory', path: `${config.skillsDir}/`, type: 'dir', countContents: true },
|
|
452
413
|
{ label: 'Workflow rules', path: `${rulesPrefix}/agent-workflows/`, type: 'dir', countContents: true },
|
|
453
414
|
{ label: 'Prompt rules', path: `${rulesPrefix}/prompts/`, type: 'dir', countContents: true },
|
|
454
415
|
]
|
|
@@ -38,6 +38,14 @@ export interface SingleFileAdapterConfig {
|
|
|
38
38
|
* `.codex/skills/` this wrote was never loaded.
|
|
39
39
|
*/
|
|
40
40
|
skillsDir?: string
|
|
41
|
+
/**
|
|
42
|
+
* Another root file this assistant also reads, and the targets that write
|
|
43
|
+
* it. With one of them selected the instructions are already in context
|
|
44
|
+
* through that file, so this one says where they are instead of repeating
|
|
45
|
+
* them: Antigravity reads `AGENTS.md` and `GEMINI.md` together, and with
|
|
46
|
+
* Codex or OpenCode also selected it loaded every instruction twice.
|
|
47
|
+
*/
|
|
48
|
+
alsoReads?: { rootFile: string; writtenBy: IdeChoice[] }
|
|
41
49
|
/**
|
|
42
50
|
* Output an earlier release wrote outside today's framework directories,
|
|
43
51
|
* present on disk now, relative to the project root. Removed on update.
|
|
@@ -48,16 +56,17 @@ export interface SingleFileAdapterConfig {
|
|
|
48
56
|
/**
|
|
49
57
|
* Creates install/update/getManagedPaths functions from a config object.
|
|
50
58
|
*
|
|
51
|
-
*
|
|
52
|
-
* 1. A single root .md file with
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
+
* Claude Code, OpenCode, Codex CLI and Antigravity share one structure:
|
|
60
|
+
* 1. A single root .md file — a managed block with the instructions, the agent
|
|
61
|
+
* index and the skill index
|
|
62
|
+
* 2. Agent definitions, frontmatter stripped
|
|
63
|
+
* 3. Skills as `<name>/SKILL.md` folders with their files, frontmatter kept —
|
|
64
|
+
* assistants find a skill by its `name` and `description`
|
|
65
|
+
* 4. Prompts and workflows, frontmatter stripped
|
|
66
|
+
* 5. The MCP config, merged into whatever the file already holds
|
|
59
67
|
*
|
|
60
|
-
* The
|
|
68
|
+
* The differences are directory names, the skills directory, and file naming.
|
|
69
|
+
* `.opencastle/` is scaffolded by `init`, not by an adapter.
|
|
61
70
|
*/
|
|
62
71
|
/**
|
|
63
72
|
* Targets that compile to the same root file, in resolution order.
|
|
@@ -72,7 +81,7 @@ export interface SingleFileAdapterConfig {
|
|
|
72
81
|
*/
|
|
73
82
|
const SHARED_ROOT_OWNERS: Record<string, Array<{ ide: string; dotDir: string; skillsDir: string }>> = {
|
|
74
83
|
'AGENTS.md': [
|
|
75
|
-
{ ide: 'opencode', dotDir: '.opencode', skillsDir: '.
|
|
84
|
+
{ ide: 'opencode', dotDir: '.opencode', skillsDir: '.agents/skills' },
|
|
76
85
|
{ ide: 'codex', dotDir: '.codex', skillsDir: '.agents/skills' },
|
|
77
86
|
],
|
|
78
87
|
}
|
|
@@ -96,7 +105,9 @@ function referenceDir(config: SingleFileAdapterConfig, stack?: StackConfig): {
|
|
|
96
105
|
const present = owners.filter((o) => selected.has(o.ide))
|
|
97
106
|
if (present.length < 2) return { dir: config.dotDir, skills: skillsDirOf(config), sharedWith: [] }
|
|
98
107
|
const [first, ...rest] = present
|
|
99
|
-
const elsewhere = rest.flatMap((o) =>
|
|
108
|
+
const elsewhere = rest.flatMap((o) =>
|
|
109
|
+
o.skillsDir.startsWith(`${o.dotDir}/`) || o.skillsDir === first.skillsDir ? [o.dotDir] : [o.dotDir, o.skillsDir],
|
|
110
|
+
)
|
|
100
111
|
return { dir: first.dotDir, skills: first.skillsDir, sharedWith: elsewhere }
|
|
101
112
|
}
|
|
102
113
|
|
|
@@ -322,7 +333,14 @@ export function createSingleFileAdapter(
|
|
|
322
333
|
sections.push(skillLines.join('\n'))
|
|
323
334
|
}
|
|
324
335
|
|
|
325
|
-
const
|
|
336
|
+
const deferTo = config.alsoReads && stack?.ides.some((i) => config.alsoReads!.writtenBy.includes(i)) ? config.alsoReads.rootFile : null
|
|
337
|
+
const body = deferTo
|
|
338
|
+
? '# Project Instructions\n\n' +
|
|
339
|
+
`This project's instructions, agent index and skill index are in \`${deferTo}\`, which this assistant also reads — ` +
|
|
340
|
+
'they are not repeated here, so they load once. ' +
|
|
341
|
+
`Skills are in \`${skillsDirOf(config)}/\`; agent definitions are in \`${config.dotDir}/agents/\`.`
|
|
342
|
+
: sections.join('\n')
|
|
343
|
+
const merge = await writeManagedBlock(rootPath, body)
|
|
326
344
|
recordMerge(results, rootPath, merge)
|
|
327
345
|
}
|
|
328
346
|
|
|
@@ -20,7 +20,8 @@ import { isOurVscodePrompt, legacyVscodePrompts, vscodePromptFile, withCommandNa
|
|
|
20
20
|
* skills/ → .github/skills/
|
|
21
21
|
* agent-workflows/ → .github/agent-workflows/
|
|
22
22
|
* prompts/<name>.prompt.md → .github/prompts/oc.<name>.prompt.md (/oc:<name>)
|
|
23
|
-
*
|
|
23
|
+
*
|
|
24
|
+
* `.opencastle/` is scaffolded by `init`, not here.
|
|
24
25
|
*/
|
|
25
26
|
|
|
26
27
|
export const IDE_ID = 'vscode'
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { createRulesDirAdapter } from './rules-dir-base.js'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Windsurf adapter —
|
|
4
|
+
* Windsurf adapter — Windsurf is now Devin Desktop. A rules-directory IDE
|
|
5
|
+
* writing `.md` files, with skills as Agent Skills.
|
|
5
6
|
*
|
|
6
7
|
* Windsurf replaces Cursor's boolean with a single `trigger` enum, so the glob
|
|
7
8
|
* case and the always-on case are mutually exclusive rather than combinable.
|
|
9
|
+
*
|
|
10
|
+
* Both of Devin Desktop's agents read skills from `.agents/skills/`, so skills
|
|
11
|
+
* go there, shared with every other target that reads it. MCP servers go to
|
|
12
|
+
* `.devin/mcp_config.json`, the project file the default Devin Local agent
|
|
13
|
+
* reads; the legacy Cascade agent reads only its global config. Releases
|
|
14
|
+
* before this one wrote `.windsurf/mcp.json`, which nothing reads — `sync`
|
|
15
|
+
* takes our servers back out of it.
|
|
8
16
|
*/
|
|
9
17
|
const adapter = createRulesDirAdapter({
|
|
10
18
|
ideId: 'windsurf',
|
|
@@ -12,6 +20,8 @@ const adapter = createRulesDirAdapter({
|
|
|
12
20
|
rootRulesFile: '.windsurfrules',
|
|
13
21
|
configDir: '.windsurf',
|
|
14
22
|
ruleExt: '.md',
|
|
23
|
+
skillsDir: '.agents/skills',
|
|
24
|
+
mcpConfigPath: '.devin/mcp_config.json',
|
|
15
25
|
renderFrontmatter({ description, applyTo, alwaysApply, tier }) {
|
|
16
26
|
let trigger: 'always_on' | 'model_decision' | 'glob'
|
|
17
27
|
let globs: string[] | undefined
|