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
package/src/cli/baseline.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { existsSync, mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync
|
|
|
2
2
|
import { mkdir, writeFile } from 'node:fs/promises'
|
|
3
3
|
import { tmpdir } from 'node:os'
|
|
4
4
|
import { isAbsolute, join, relative, resolve } from 'node:path'
|
|
5
|
-
import { resolveSources, materialize, cliVersionOf,
|
|
5
|
+
import { resolveSources, materialize, cliVersionOf, hasErrors } from './layers.js'
|
|
6
|
+
import type { TeamIssue } from './team-config.js'
|
|
6
7
|
import { contentReport, tokensOf } from './lock.js'
|
|
7
8
|
import { CONFIG_SCHEMA_URL } from './team-config.js'
|
|
8
9
|
import { EXTENSION_NAMESPACE, claudeManifestFor, isAgentPlugin, mcpSchemaUrl, pluginNameFrom, pluginSchemaUrl, readAgentPlugin, type PluginManifest } from './agent-plugin.js'
|
|
@@ -303,9 +304,17 @@ function check(pkgRoot: string, dir: string): CheckReport {
|
|
|
303
304
|
const spec = relative(join(project, '.opencastle'), layerRoot).split('\\').join('/')
|
|
304
305
|
writeFileSync(join(project, '.opencastle', 'config.json'), JSON.stringify({ extends: [spec.startsWith('.') ? spec : `./${spec}`] }))
|
|
305
306
|
const resolved = resolveSources({ pkgRoot, projectRoot: project, stack: { ides: [], techTools: [], teamTools: [] } })
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
307
|
+
// The scratch project names the baseline by its path from there —
|
|
308
|
+
// `../../../../Users/ana/base` — and stripping the `../` left an absolute
|
|
309
|
+
// path with its leading slash gone. Named instead as it was given here.
|
|
310
|
+
const id = relative(project, layerRoot).split('\\').join('/') || '.'
|
|
311
|
+
const here = dir === '.' ? '' : `${dir.replace(/\/$/, '')}/`
|
|
312
|
+
const shown = (text: string): string =>
|
|
313
|
+
text.split(`${id}/`).join(here).split(id).join(name).split(project).join('<repository>')
|
|
314
|
+
// One string per problem, its remedy on the line below — not the icons
|
|
315
|
+
// `formatIssues` prints, which the report below adds again.
|
|
316
|
+
const said = (i: TeamIssue): string => shown(`${i.where}: ${i.message}${i.fix ? `\n→ ${i.fix}` : ''}`)
|
|
317
|
+
for (const i of resolved.issues) (i.level === 'error' ? errors : warnings).push(said(i))
|
|
309
318
|
for (const item of resolved.items.values()) {
|
|
310
319
|
if (item.layer !== 'opencastle') contributes[item.kind]++
|
|
311
320
|
}
|
|
@@ -354,8 +363,9 @@ export default async function baseline({ pkgRoot, args }: CliContext): Promise<v
|
|
|
354
363
|
const parts = Object.entries(k).filter(([, n]) => n > 0).map(([kind, n]) => `${n} ${kind === 'mcpServers' ? 'MCP server(s)' : kind}`)
|
|
355
364
|
console.log(` Contributes: ${parts.length > 0 ? parts.join(', ') : c.dim('nothing yet')}`)
|
|
356
365
|
if (report.contextTokens) console.log(` A repository extending it loads ~${report.contextTokens} tokens up front, with OpenCastle's own content`)
|
|
357
|
-
|
|
358
|
-
for (const
|
|
366
|
+
const indent = (text: string): string => text.split('\n').join('\n ')
|
|
367
|
+
for (const e of report.errors) console.log(` ${c.red('✗')} ${indent(e)}`)
|
|
368
|
+
for (const w of report.warnings) console.log(` ${c.yellow('!')} ${c.dim(indent(w))}`)
|
|
359
369
|
console.log(report.errors.length === 0 ? `\n ${c.green('✓')} Ready to publish.\n` : `\n ${c.red(`${report.errors.length} problem(s) to fix before publishing.`)}\n`)
|
|
360
370
|
}
|
|
361
371
|
if (report.errors.length > 0) process.exit(1)
|
package/src/cli/ci.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { execFileSync } from 'node:child_process'
|
|
2
2
|
import { existsSync, readFileSync } from 'node:fs'
|
|
3
3
|
import { mkdir, writeFile, appendFile } from 'node:fs/promises'
|
|
4
|
-
import { basename, dirname, join, relative, sep } from 'node:path'
|
|
4
|
+
import { basename, dirname, join, relative, resolve, sep } from 'node:path'
|
|
5
5
|
import { readManifest } from './manifest.js'
|
|
6
6
|
import { cliVersionOf, resolveSources } from './layers.js'
|
|
7
7
|
import { resolveStack } from './stack-config.js'
|
|
@@ -48,6 +48,21 @@ function git(cwd: string, args: string[]): string | null {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* The repository's root, spelled the way the project's path is.
|
|
53
|
+
*
|
|
54
|
+
* `--show-toplevel` follows links, so on macOS a project under `/var/…` had a
|
|
55
|
+
* root under `/private/var/…`: every path compared against the project's own
|
|
56
|
+
* spelling fell outside the repository, a baseline kept beside the project was
|
|
57
|
+
* left out of the workflow's paths, and the CODEOWNERS found was named by a
|
|
58
|
+
* path the user never typed. `--show-cdup` is the way up from the project,
|
|
59
|
+
* applied to the project's own path.
|
|
60
|
+
*/
|
|
61
|
+
function repoRootOf(projectRoot: string): string {
|
|
62
|
+
const up = git(projectRoot, ['rev-parse', '--show-cdup'])
|
|
63
|
+
return up === null ? projectRoot : resolve(projectRoot, up || '.')
|
|
64
|
+
}
|
|
65
|
+
|
|
51
66
|
function packageManagerOf(root: string): PackageManager {
|
|
52
67
|
if (existsSync(join(root, 'pnpm-lock.yaml'))) return 'pnpm'
|
|
53
68
|
if (existsSync(join(root, 'yarn.lock'))) return 'yarn'
|
|
@@ -79,7 +94,7 @@ function findUp(start: string, names: string[], stop: string): string | null {
|
|
|
79
94
|
* baseline kept elsewhere in the repository, whose change must run it too.
|
|
80
95
|
*/
|
|
81
96
|
export function planCi(projectRoot: string, cliVersion: string, owners?: string, extraPaths: string[] = []): Plan {
|
|
82
|
-
const repoRoot =
|
|
97
|
+
const repoRoot = repoRootOf(projectRoot)
|
|
83
98
|
const prefix = (git(projectRoot, ['rev-parse', '--show-prefix']) ?? '').replace(/\/$/, '')
|
|
84
99
|
const branch = (git(projectRoot, ['symbolic-ref', '--short', 'refs/remotes/origin/HEAD']) ?? 'origin/main').replace(/^origin\//, '')
|
|
85
100
|
|
|
@@ -234,7 +249,7 @@ export default async function ci({ pkgRoot, args }: CliContext): Promise<void> {
|
|
|
234
249
|
const manifest = await readManifest(projectRoot)
|
|
235
250
|
const manifestVersion = manifest?.version
|
|
236
251
|
// Baselines kept elsewhere in this repository: a change there must run the check.
|
|
237
|
-
const repoRoot =
|
|
252
|
+
const repoRoot = repoRootOf(projectRoot)
|
|
238
253
|
const extra: string[] = []
|
|
239
254
|
try {
|
|
240
255
|
const resolved = resolveSources({ pkgRoot, projectRoot, stack: resolveStack(manifest!), repoInfo: manifest?.repoInfo })
|
|
@@ -247,7 +262,7 @@ export default async function ci({ pkgRoot, args }: CliContext): Promise<void> {
|
|
|
247
262
|
// The workflow is still right without them; sync --check will name the problem.
|
|
248
263
|
}
|
|
249
264
|
const plan = planCi(projectRoot, manifestVersion ?? cliVersionOf(pkgRoot), owners, extra)
|
|
250
|
-
const rel = (p: string): string => p.
|
|
265
|
+
const rel = (p: string): string => relative(repoRoot, p).split(sep).join('/')
|
|
251
266
|
|
|
252
267
|
if (args.includes('--dry-run')) {
|
|
253
268
|
console.log(`\n ${c.dim(`[dry-run] ${rel(plan.workflowPath)}:`)}\n`)
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* because each compared the project against the same wrong paths.
|
|
9
9
|
*/
|
|
10
10
|
import { execFileSync } from 'node:child_process'
|
|
11
|
-
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs'
|
|
11
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
|
|
12
12
|
import { tmpdir } from 'node:os'
|
|
13
13
|
import { dirname, join, resolve } from 'node:path'
|
|
14
14
|
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
@@ -169,6 +169,20 @@ describe.skipIf(!built)('Codex CLI as a target', () => {
|
|
|
169
169
|
run(project, 'sync', '--check')
|
|
170
170
|
})
|
|
171
171
|
|
|
172
|
+
it('explain says whether Codex trusts the project, since it reads config.toml only then', () => {
|
|
173
|
+
run(project, 'init', '--yes')
|
|
174
|
+
const codexHome = join(project, '..', `${project.split('/').pop()}-codex-home`)
|
|
175
|
+
const explain = (): { setup: Array<{ need: string; ok: boolean }> } =>
|
|
176
|
+
JSON.parse(execFileSync('node', [cli, 'explain', '--json'], { cwd: project, encoding: 'utf8', env: { ...process.env, CODEX_HOME: codexHome } }))
|
|
177
|
+
try {
|
|
178
|
+
expect(explain().setup).toContainEqual(expect.objectContaining({ need: 'trust', ok: false }))
|
|
179
|
+
write(codexHome, { 'config.toml': `[projects.${JSON.stringify(realpathSync(project))}]\ntrust_level = "trusted"\n` })
|
|
180
|
+
expect(explain().setup).toContainEqual(expect.objectContaining({ need: 'trust', ok: true }))
|
|
181
|
+
} finally {
|
|
182
|
+
rmSync(codexHome, { recursive: true, force: true })
|
|
183
|
+
}
|
|
184
|
+
})
|
|
185
|
+
|
|
172
186
|
it('remove --all takes our servers out of config.toml and leaves the user’s setup', () => {
|
|
173
187
|
run(project, 'init', '--yes')
|
|
174
188
|
run(project, 'remove', '--all', '--yes')
|
package/src/cli/doctor.test.ts
CHANGED
|
@@ -193,7 +193,7 @@ describe('cursor adapter getDoctorChecks', () => {
|
|
|
193
193
|
expect(checks.length).toBeGreaterThan(0)
|
|
194
194
|
expect(checks.find((c) => c.path === '.cursorrules')?.type).toBe('file')
|
|
195
195
|
expect(checks.find((c) => c.path === '.cursor/rules/agents/')?.countFilter).toBe('.mdc')
|
|
196
|
-
expect(checks.find((c) => c.path === '.
|
|
196
|
+
expect(checks.find((c) => c.path === '.agents/skills/')?.type).toBe('dir')
|
|
197
197
|
})
|
|
198
198
|
})
|
|
199
199
|
|
|
@@ -218,7 +218,7 @@ describe('opencode adapter getDoctorChecks', () => {
|
|
|
218
218
|
expect(checks.length).toBeGreaterThan(0)
|
|
219
219
|
expect(checks.find((c) => c.path === 'AGENTS.md')?.type).toBe('file')
|
|
220
220
|
expect(checks.find((c) => c.path === '.opencode/agents/')).toBeDefined()
|
|
221
|
-
expect(checks.find((c) => c.path === '.
|
|
221
|
+
expect(checks.find((c) => c.path === '.agents/skills/')).toBeDefined()
|
|
222
222
|
// opencode: separate prompts and workflows dirs
|
|
223
223
|
expect(checks.find((c) => c.path === '.opencode/prompts/')).toBeDefined()
|
|
224
224
|
expect(checks.find((c) => c.path === '.opencode/workflows/')).toBeDefined()
|
package/src/cli/explain.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from 'node:fs'
|
|
2
|
-
import {
|
|
1
|
+
import { existsSync, readFileSync, realpathSync } from 'node:fs'
|
|
2
|
+
import { homedir } from 'node:os'
|
|
3
|
+
import { join, resolve } from 'node:path'
|
|
4
|
+
import { parse as parseToml } from 'smol-toml'
|
|
3
5
|
import { readManifest } from './manifest.js'
|
|
4
6
|
import { resolveStack, isEnvVarSatisfied } from './stack-config.js'
|
|
5
7
|
import { resolveSources, materialize, hasErrors, formatIssues, requiredEnvVars, refuseOlderCli } from './layers.js'
|
|
@@ -92,10 +94,41 @@ async function build(pkgRoot: string, projectRoot: string): Promise<ExplainRepor
|
|
|
92
94
|
setup.push({ server: key, need: 'sign-in', ok: true, how: 'your assistant opens a browser to sign in the first time it starts the server' })
|
|
93
95
|
}
|
|
94
96
|
}
|
|
97
|
+
// Codex loads a project's `.codex/config.toml` only once the user has
|
|
98
|
+
// trusted the project, so every server written there waits on that.
|
|
99
|
+
if (ides.includes('codex') && Object.keys(lock.mcp).length > 0) {
|
|
100
|
+
setup.push({
|
|
101
|
+
server: 'Codex CLI',
|
|
102
|
+
need: 'trust',
|
|
103
|
+
ok: codexTrusts(projectRoot),
|
|
104
|
+
how: 'Codex reads .codex/config.toml, and so every MCP server here, only in a project you trust — run codex in this directory and trust it when it asks',
|
|
105
|
+
})
|
|
106
|
+
}
|
|
95
107
|
const notes = resolved.issues.filter((i) => i.level === 'warning').map((i) => `${i.where}: ${i.message}`)
|
|
96
108
|
return { targets, lock, setup, notes }
|
|
97
109
|
}
|
|
98
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Whether Codex has been told to trust this project: `trust_level = "trusted"`
|
|
113
|
+
* under `[projects."<path>"]` in its own config, `$CODEX_HOME/config.toml`.
|
|
114
|
+
*/
|
|
115
|
+
export function codexTrusts(projectRoot: string): boolean {
|
|
116
|
+
const file = join(process.env.CODEX_HOME || join(process.env.HOME || homedir(), '.codex'), 'config.toml')
|
|
117
|
+
let projects: Record<string, { trust_level?: unknown }>
|
|
118
|
+
try {
|
|
119
|
+
projects = ((parseToml(readFileSync(file, 'utf8')) as { projects?: Record<string, { trust_level?: unknown }> }).projects ?? {})
|
|
120
|
+
} catch {
|
|
121
|
+
return false
|
|
122
|
+
}
|
|
123
|
+
const spellings = new Set([projectRoot])
|
|
124
|
+
try {
|
|
125
|
+
spellings.add(realpathSync(projectRoot))
|
|
126
|
+
} catch {
|
|
127
|
+
// The path as given is the only spelling there is.
|
|
128
|
+
}
|
|
129
|
+
return [...spellings].some((p) => projects[p]?.trust_level === 'trusted')
|
|
130
|
+
}
|
|
131
|
+
|
|
99
132
|
function render(report: ExplainReport, all: boolean): void {
|
|
100
133
|
const { lock } = report
|
|
101
134
|
const out = (s = ''): void => console.log(s)
|
|
@@ -191,6 +224,7 @@ function render(report: ExplainReport, all: boolean): void {
|
|
|
191
224
|
if (report.setup.length === 0) out(` ${c.green('✓')} Nothing to set up — every server works without a variable or a sign-in.`)
|
|
192
225
|
for (const s of report.setup) {
|
|
193
226
|
if (s.need === 'sign-in') out(` ${c.cyan('→')} ${s.server}: ${s.how}`)
|
|
227
|
+
else if (s.need === 'trust') out(` ${s.ok ? c.green('✓') : c.red('✗')} ${s.ok ? 'Codex trusts this project' : 'Codex does not trust this project yet'} ${c.dim(`— ${s.how}`)}`)
|
|
194
228
|
else out(` ${s.ok ? c.green('✓') : c.red('✗')} ${s.need} ${c.dim(`— ${s.how}${s.ok ? '' : '; set it in .env or your shell'}`)}`)
|
|
195
229
|
}
|
|
196
230
|
out('')
|
package/src/cli/init.test.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
18
|
-
import { mkdtemp, readFile, readdir, rename, rm, unlink, writeFile } from 'node:fs/promises'
|
|
18
|
+
import { mkdir, mkdtemp, readFile, readdir, rename, rm, unlink, writeFile } from 'node:fs/promises'
|
|
19
19
|
import { join, resolve } from 'node:path'
|
|
20
20
|
import { tmpdir } from 'node:os'
|
|
21
21
|
import { existsSync } from 'node:fs'
|
|
@@ -660,24 +660,28 @@ describe('Cursor adapter install', () => {
|
|
|
660
660
|
expect(agents).toContain('content-engineer.mdc')
|
|
661
661
|
})
|
|
662
662
|
|
|
663
|
-
it('
|
|
663
|
+
it('writes skills as Agent Skills in .agents/skills/, which Cursor reads', async () => {
|
|
664
664
|
const adapter = await IDE_ADAPTERS['cursor']()
|
|
665
665
|
await adapter.install(PKG_ROOT, tempDir, STACK_SANITY_LINEAR, EMPTY_REPO_INFO)
|
|
666
666
|
|
|
667
|
-
const skillsDir = join(tempDir, '.
|
|
667
|
+
const skillsDir = join(tempDir, '.agents', 'skills')
|
|
668
668
|
const skills = await readdir(skillsDir)
|
|
669
669
|
|
|
670
670
|
// Core skills should be present
|
|
671
|
-
expect(skills).toContain('self-improvement
|
|
672
|
-
expect(skills).toContain('testing-workflow
|
|
671
|
+
expect(skills).toContain('self-improvement')
|
|
672
|
+
expect(skills).toContain('testing-workflow')
|
|
673
|
+
expect(existsSync(join(skillsDir, 'testing-workflow', 'SKILL.md'))).toBe(true)
|
|
673
674
|
|
|
674
|
-
// Selected plugin skills
|
|
675
|
-
expect(skills).toContain('sanity-cms
|
|
676
|
-
expect(skills).toContain('linear-task-management
|
|
675
|
+
// Selected plugin skills
|
|
676
|
+
expect(skills).toContain('sanity-cms')
|
|
677
|
+
expect(skills).toContain('linear-task-management')
|
|
677
678
|
|
|
678
679
|
// Unselected plugin skills should not be present
|
|
679
|
-
expect(skills).not.toContain('supabase-database
|
|
680
|
-
expect(skills).not.toContain('slack-notifications
|
|
680
|
+
expect(skills).not.toContain('supabase-database')
|
|
681
|
+
expect(skills).not.toContain('slack-notifications')
|
|
682
|
+
|
|
683
|
+
// Not as rules any more
|
|
684
|
+
expect(existsSync(join(tempDir, '.cursor', 'rules', 'skills'))).toBe(false)
|
|
681
685
|
})
|
|
682
686
|
|
|
683
687
|
it('generates Cursor MCP config with mcpServers format', async () => {
|
|
@@ -915,16 +919,27 @@ describe('OpenCode adapter install', () => {
|
|
|
915
919
|
|
|
916
920
|
const content = await readFile(join(tempDir, 'AGENTS.md'), 'utf8')
|
|
917
921
|
expect(content).toContain('# Project Instructions')
|
|
918
|
-
expect(content).toContain('.
|
|
922
|
+
expect(content).toContain('.agents/skills/')
|
|
919
923
|
expect(content).toContain('.opencode/agents/')
|
|
920
924
|
})
|
|
921
925
|
|
|
926
|
+
it('removes the .opencode/skills/ an earlier release wrote', async () => {
|
|
927
|
+
const adapter = await IDE_ADAPTERS['opencode']()
|
|
928
|
+
await adapter.install(PKG_ROOT, tempDir, STACK_EMPTY, EMPTY_REPO_INFO)
|
|
929
|
+
await mkdir(join(tempDir, '.opencode', 'skills', 'testing-workflow'), { recursive: true })
|
|
930
|
+
await writeFile(join(tempDir, '.opencode', 'skills', 'testing-workflow', 'SKILL.md'), 'old')
|
|
931
|
+
const result = await adapter.update(PKG_ROOT, tempDir, STACK_EMPTY, EMPTY_REPO_INFO)
|
|
932
|
+
expect(existsSync(join(tempDir, '.opencode', 'skills'))).toBe(false)
|
|
933
|
+
expect(result.deleted).toContain('.opencode/skills/')
|
|
934
|
+
})
|
|
935
|
+
|
|
922
936
|
it('creates files in .opencode/ directory structure', async () => {
|
|
923
937
|
const adapter = await IDE_ADAPTERS['opencode']()
|
|
924
938
|
await adapter.install(PKG_ROOT, tempDir, STACK_SANITY_LINEAR, EMPTY_REPO_INFO)
|
|
925
939
|
|
|
926
940
|
expect(existsSync(join(tempDir, '.opencode', 'agents'))).toBe(true)
|
|
927
|
-
expect(existsSync(join(tempDir, '.
|
|
941
|
+
expect(existsSync(join(tempDir, '.agents', 'skills', 'sanity-cms', 'SKILL.md'))).toBe(true)
|
|
942
|
+
expect(existsSync(join(tempDir, '.opencode', 'skills'))).toBe(false)
|
|
928
943
|
expect(existsSync(join(tempDir, '.opencode', 'prompts'))).toBe(true)
|
|
929
944
|
expect(existsSync(join(tempDir, '.opencode', 'workflows'))).toBe(true)
|
|
930
945
|
})
|
|
@@ -977,7 +992,7 @@ describe('OpenCode adapter install', () => {
|
|
|
977
992
|
expect(paths.merged).toContain('AGENTS.md')
|
|
978
993
|
expect(paths.framework).not.toContain('AGENTS.md')
|
|
979
994
|
expect(paths.framework).toContain('.opencode/agents/')
|
|
980
|
-
expect(paths.framework).toContain('.
|
|
995
|
+
expect(paths.framework).toContain('.agents/skills/')
|
|
981
996
|
expect(paths.framework).toContain('.opencode/prompts/')
|
|
982
997
|
expect(paths.framework).toContain('.opencode/workflows/')
|
|
983
998
|
|
|
@@ -1047,21 +1062,18 @@ describe('Windsurf adapter install', () => {
|
|
|
1047
1062
|
expect(files.length).toBeGreaterThan(0)
|
|
1048
1063
|
})
|
|
1049
1064
|
|
|
1050
|
-
it('
|
|
1065
|
+
it('writes skills as Agent Skills in .agents/skills/, which Devin Desktop reads', async () => {
|
|
1051
1066
|
const adapter = await IDE_ADAPTERS['windsurf']()
|
|
1052
1067
|
await adapter.install(PKG_ROOT, tmpDir, STACK_SANITY_LINEAR)
|
|
1053
|
-
|
|
1054
|
-
expect(existsSync(
|
|
1055
|
-
const files = (await readdir(skillsDir)).filter(f => f.endsWith('.md'))
|
|
1056
|
-
expect(files.length).toBeGreaterThan(0)
|
|
1068
|
+
expect(existsSync(join(tmpDir, '.agents', 'skills', 'sanity-cms', 'SKILL.md'))).toBe(true)
|
|
1069
|
+
expect(existsSync(join(tmpDir, '.windsurf', 'rules', 'skills'))).toBe(false)
|
|
1057
1070
|
})
|
|
1058
1071
|
|
|
1059
|
-
it('
|
|
1072
|
+
it('writes MCP servers to .devin/mcp_config.json, the project file Devin Local reads', async () => {
|
|
1060
1073
|
const adapter = await IDE_ADAPTERS['windsurf']()
|
|
1061
1074
|
await adapter.install(PKG_ROOT, tmpDir, STACK_SANITY_LINEAR)
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
const mcp = await readJson(mcpPath)
|
|
1075
|
+
expect(existsSync(join(tmpDir, '.windsurf', 'mcp.json'))).toBe(false)
|
|
1076
|
+
const mcp = await readJson(join(tmpDir, '.devin', 'mcp_config.json'))
|
|
1065
1077
|
expect(mcp).toHaveProperty('mcpServers')
|
|
1066
1078
|
})
|
|
1067
1079
|
|
|
@@ -1071,7 +1083,8 @@ describe('Windsurf adapter install', () => {
|
|
|
1071
1083
|
expect(paths.merged).toContain('.windsurfrules')
|
|
1072
1084
|
expect(paths.framework).not.toContain('.windsurfrules')
|
|
1073
1085
|
expect(paths.framework.some(p => p.includes('.windsurf/rules/'))).toBe(true)
|
|
1074
|
-
expect(paths.customizable).toContain('.
|
|
1086
|
+
expect(paths.customizable).toContain('.devin/mcp_config.json')
|
|
1087
|
+
expect(paths.framework).toContain('.agents/skills/')
|
|
1075
1088
|
})
|
|
1076
1089
|
})
|
|
1077
1090
|
|
|
@@ -1148,6 +1161,20 @@ describe('Antigravity adapter install', () => {
|
|
|
1148
1161
|
expect(content).toContain('.agents/')
|
|
1149
1162
|
})
|
|
1150
1163
|
|
|
1164
|
+
it('points GEMINI.md at AGENTS.md when Codex or OpenCode writes it, so instructions load once', async () => {
|
|
1165
|
+
const both: StackConfig = { ...STACK_SANITY_LINEAR, ides: ['antigravity', 'codex'] }
|
|
1166
|
+
for (const ide of ['antigravity', 'codex'] as const) await (await IDE_ADAPTERS[ide]()).install(PKG_ROOT, tmpDir, both)
|
|
1167
|
+
const gemini = await readFile(join(tmpDir, 'GEMINI.md'), 'utf8')
|
|
1168
|
+
expect(gemini).toContain('are in `AGENTS.md`, which this assistant also reads')
|
|
1169
|
+
expect(gemini).not.toContain('## Available Skills')
|
|
1170
|
+
expect(await readFile(join(tmpDir, 'AGENTS.md'), 'utf8')).toContain('## Available Skills')
|
|
1171
|
+
|
|
1172
|
+
// Alone, it carries everything itself.
|
|
1173
|
+
await rm(join(tmpDir, 'GEMINI.md'))
|
|
1174
|
+
await (await IDE_ADAPTERS['antigravity']()).install(PKG_ROOT, tmpDir, { ...both, ides: ['antigravity'] })
|
|
1175
|
+
expect(await readFile(join(tmpDir, 'GEMINI.md'), 'utf8')).toContain('## Available Skills')
|
|
1176
|
+
})
|
|
1177
|
+
|
|
1151
1178
|
it('creates files in .agents/ directory structure', async () => {
|
|
1152
1179
|
const adapter = await IDE_ADAPTERS['antigravity']()
|
|
1153
1180
|
await adapter.install(PKG_ROOT, tmpDir, STACK_SANITY_LINEAR)
|
package/src/cli/managed-paths.ts
CHANGED
|
@@ -49,8 +49,10 @@ export const ROOT_INSTRUCTION_FILES = [
|
|
|
49
49
|
*/
|
|
50
50
|
const SUPERSEDED_FRAMEWORK: Record<string, string> = {
|
|
51
51
|
'.claude/commands/': `.claude/${CLAUDE_COMMANDS_DIR}/`,
|
|
52
|
-
// Codex never read `.codex/skills/`; its skills moved to the shared location
|
|
52
|
+
// Codex never read `.codex/skills/`; its skills moved to the shared location,
|
|
53
|
+
// and OpenCode's followed.
|
|
53
54
|
'.codex/skills/': '.agents/skills/',
|
|
55
|
+
'.opencode/skills/': '.agents/skills/',
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
function unique(values: string[]): string[] {
|
package/src/cli/mcp-audit.ts
CHANGED
|
@@ -441,6 +441,8 @@ const OWN_SPELLING: Partial<Record<IdeChoice, (name: string) => string>> = {
|
|
|
441
441
|
// Codex expands nothing: a variable reaches a server only by being named in
|
|
442
442
|
// a field that reads one.
|
|
443
443
|
codex: (n) => `env_vars, bearer_token_env_var or env_http_headers naming ${n}`,
|
|
444
|
+
// Antigravity expands none either, and has no field that reads a variable.
|
|
445
|
+
antigravity: (n) => `the value in your own ~/.gemini/config/mcp_config.json — Antigravity expands no variables, and a local server inherits ${n} from the environment`,
|
|
444
446
|
}
|
|
445
447
|
|
|
446
448
|
/** The first `${NAME}` this target would pass through literally, as `NAME → spelling`, or null. */
|
|
@@ -11,7 +11,8 @@ import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
|
11
11
|
import { mkdtempSync, writeFileSync, readFileSync, rmSync, realpathSync, mkdirSync } from 'node:fs'
|
|
12
12
|
import { join } from 'node:path'
|
|
13
13
|
import { tmpdir } from 'node:os'
|
|
14
|
-
import { upgradeGeneratedServers, rebuildMcpConfig, scaffoldMcpConfig } from './mcp.js'
|
|
14
|
+
import { upgradeGeneratedServers, rebuildMcpConfig, scaffoldMcpConfig, teamEntryFor } from './mcp.js'
|
|
15
|
+
import { auditMcpConfig } from './mcp-audit.js'
|
|
15
16
|
import type { StackConfig } from './types.js'
|
|
16
17
|
|
|
17
18
|
describe('upgradeGeneratedServers', () => {
|
|
@@ -22,6 +23,30 @@ describe('upgradeGeneratedServers', () => {
|
|
|
22
23
|
expect(servers.Supabase).toEqual({ type: 'http', url: 'https://mcp.supabase.com/mcp' })
|
|
23
24
|
})
|
|
24
25
|
|
|
26
|
+
it('moves Antigravity entries to serverUrl, and drops a ${NAME} it would send as text', () => {
|
|
27
|
+
// As every release before this one wrote them into .agents/mcp_config.json.
|
|
28
|
+
const servers: Record<string, unknown> = {
|
|
29
|
+
Supabase: { url: 'https://mcp.supabase.com/mcp' },
|
|
30
|
+
Coolify: {
|
|
31
|
+
command: 'npx',
|
|
32
|
+
args: ['-y', '@masonator/coolify-mcp@3.7.0'],
|
|
33
|
+
env: { COOLIFY_ACCESS_TOKEN: '${COOLIFY_ACCESS_TOKEN}', COOLIFY_BASE_URL: '${COOLIFY_BASE_URL}' },
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
expect(upgradeGeneratedServers(servers, 'antigravity', new Set(['Supabase', 'Coolify'])).sort()).toEqual(['Coolify', 'Supabase'])
|
|
37
|
+
expect(servers.Supabase).toEqual({ serverUrl: 'https://mcp.supabase.com/mcp' })
|
|
38
|
+
expect(servers.Coolify).toEqual({ command: 'npx', args: ['-y', '@masonator/coolify-mcp@3.7.0'] })
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it('writes a team server for Antigravity in its shape, and the audit names what it cannot expand', () => {
|
|
42
|
+
const remote = teamEntryFor('docs', { url: 'https://docs.acme.example/mcp', headers: { Authorization: 'Bearer ${DOCS_TOKEN}' } }, 'antigravity').entry
|
|
43
|
+
expect(remote).toEqual({ serverUrl: 'https://docs.acme.example/mcp', headers: { Authorization: 'Bearer ${DOCS_TOKEN}' } })
|
|
44
|
+
const local = teamEntryFor('db', { command: 'npx', args: ['-y', 'db-mcp@1.0.0'], env: { DB_URL: '${DB_URL}', MODE: 'ro' } }, 'antigravity').entry
|
|
45
|
+
expect(local).toEqual({ command: 'npx', args: ['-y', 'db-mcp@1.0.0'], env: { MODE: 'ro' } })
|
|
46
|
+
const audit = auditMcpConfig({ mcpServers: { docs: remote } }, 'antigravity')
|
|
47
|
+
expect(audit.findings.find((f) => f.problem === 'unexpanded-variable')?.subject).toContain('${DOCS_TOKEN} →')
|
|
48
|
+
})
|
|
49
|
+
|
|
25
50
|
it('moves a retired default to the current one, env vars and all', () => {
|
|
26
51
|
// What earlier releases wrote into .mcp.json for Figma: a package that was
|
|
27
52
|
// never published, with the token they asked for spelled into `env`.
|
package/src/cli/mcp.ts
CHANGED
|
@@ -96,13 +96,24 @@ function transformMcpForIde(
|
|
|
96
96
|
case 'windsurf':
|
|
97
97
|
case 'antigravity': {
|
|
98
98
|
// mcpServers format — no 'type' field
|
|
99
|
+
//
|
|
100
|
+
// Antigravity expands no variables in its MCP config: a `${NAME}` reaches
|
|
101
|
+
// the server as those characters. An entry that only forwards a variable
|
|
102
|
+
// under its own name therefore replaced the value the server would have
|
|
103
|
+
// inherited with literal text; it is left out, and the server reads the
|
|
104
|
+
// environment Antigravity was started in. Its MCP docs also require
|
|
105
|
+
// `serverUrl` for a remote server and call `url` a legacy field.
|
|
106
|
+
const antigravity = ide === 'antigravity' && !options.legacy;
|
|
99
107
|
const mcpServers: Record<string, unknown> = {};
|
|
100
108
|
for (const [name, server] of Object.entries(servers)) {
|
|
101
109
|
if (server.type === 'stdio') {
|
|
110
|
+
const env = antigravity && server.env
|
|
111
|
+
? Object.fromEntries(Object.entries(server.env).filter(([k, v]) => wholeReference(v) !== k))
|
|
112
|
+
: server.env;
|
|
102
113
|
mcpServers[name] = {
|
|
103
114
|
command: server.command,
|
|
104
115
|
args: server.args,
|
|
105
|
-
...(
|
|
116
|
+
...(env && Object.keys(env).length > 0 && { env }),
|
|
106
117
|
};
|
|
107
118
|
} else if (server.type === 'http') {
|
|
108
119
|
// Strip VS Code ${input:...} placeholders for non-VS Code IDEs
|
|
@@ -115,7 +126,11 @@ function transformMcpForIde(
|
|
|
115
126
|
// other targets in this group take the bare `url`.
|
|
116
127
|
const headers = server.headers && { headers: server.headers };
|
|
117
128
|
mcpServers[name] =
|
|
118
|
-
ide === 'claude-code' && !options.legacy
|
|
129
|
+
ide === 'claude-code' && !options.legacy
|
|
130
|
+
? { type: 'http', url, ...headers }
|
|
131
|
+
: antigravity
|
|
132
|
+
? { serverUrl: url, ...headers }
|
|
133
|
+
: { url, ...headers };
|
|
119
134
|
}
|
|
120
135
|
}
|
|
121
136
|
return { mcpServers };
|
|
@@ -594,7 +609,7 @@ export function getMcpConfigRelPath(ide: IdeChoice): string {
|
|
|
594
609
|
case 'opencode':
|
|
595
610
|
return 'opencode.json';
|
|
596
611
|
case 'windsurf':
|
|
597
|
-
return '.
|
|
612
|
+
return '.devin/mcp_config.json';
|
|
598
613
|
case 'codex':
|
|
599
614
|
return '.codex/config.toml';
|
|
600
615
|
case 'antigravity':
|
|
@@ -718,6 +733,10 @@ export async function stripManagedMcpServers(
|
|
|
718
733
|
*/
|
|
719
734
|
export const LEGACY_MCP_CONFIGS: Partial<Record<IdeChoice, string>> = {
|
|
720
735
|
codex: '.codex/mcp.json',
|
|
736
|
+
// Windsurf, now Devin Desktop, never read a project `.windsurf/mcp.json`:
|
|
737
|
+
// Cascade reads one global file, and the default Devin Local agent reads
|
|
738
|
+
// `.devin/mcp_config.json`.
|
|
739
|
+
windsurf: '.windsurf/mcp.json',
|
|
721
740
|
};
|
|
722
741
|
|
|
723
742
|
/**
|
|
@@ -212,10 +212,11 @@ describe('two targets that share a root file', () => {
|
|
|
212
212
|
}
|
|
213
213
|
const text = readFileSync(join(projectRoot, 'AGENTS.md'), 'utf8')
|
|
214
214
|
expect(text).toContain('shared by more than one assistant')
|
|
215
|
-
expect(text).toContain('
|
|
216
|
-
expect(text).toContain('`.codex
|
|
217
|
-
//
|
|
218
|
-
expect(existsSync(join(projectRoot, '.opencode', '
|
|
215
|
+
expect(text).toContain('Skills are in `.agents/skills/`')
|
|
216
|
+
expect(text).toContain('also installed under `.codex/`.')
|
|
217
|
+
// Each keeps its own agents; both read the one skills directory.
|
|
218
|
+
expect(existsSync(join(projectRoot, '.opencode', 'agents'))).toBe(true)
|
|
219
|
+
expect(existsSync(join(projectRoot, '.codex', 'agents'))).toBe(true)
|
|
219
220
|
expect(existsSync(join(projectRoot, '.agents', 'skills'))).toBe(true)
|
|
220
221
|
})
|
|
221
222
|
})
|
|
@@ -240,6 +240,22 @@ describe.skipIf(!built)('a baseline package', () => {
|
|
|
240
240
|
expect(check.out).toContain('points outside the package')
|
|
241
241
|
})
|
|
242
242
|
|
|
243
|
+
it('names each problem once, by the path it was given', () => {
|
|
244
|
+
run(dir, ['baseline', 'init', 'base', '--name', '@acme/base'])
|
|
245
|
+
writeFileSync(
|
|
246
|
+
join(dir, 'base', 'mcp.json'),
|
|
247
|
+
JSON.stringify({ $schema: 'https://agent-plugins.org/schemas/1.0.0/mcp.schema.json', mcpServers: { docs: { type: 'streamable-http', url: 'https://docs.acme.example/mcp' } } }),
|
|
248
|
+
)
|
|
249
|
+
run(dir, ['plugin', 'build', 'base'])
|
|
250
|
+
const check = run(dir, ['baseline', 'check', 'base'])
|
|
251
|
+
// eslint-disable-next-line no-control-regex
|
|
252
|
+
check.out = check.out.replace(/\x1b\[[0-9;]*m/g, '')
|
|
253
|
+
expect(check.code).toBe(1)
|
|
254
|
+
expect(check.out).toContain('✗ base/mcp.json: defines MCP server "docs", which @acme/base does not allow\n → add it to policy.mcp.allow in @acme/base')
|
|
255
|
+
expect(check.out).not.toContain('✗ ✗')
|
|
256
|
+
expect(check.out).not.toContain(dir.replace(/^\//, ''))
|
|
257
|
+
})
|
|
258
|
+
|
|
243
259
|
it('fails one that would publish empty', () => {
|
|
244
260
|
run(dir, ['baseline', 'init', 'base', '--name', '@acme/base'])
|
|
245
261
|
const path = join(dir, 'base', 'package.json')
|
|
@@ -484,6 +484,17 @@ describe('what review found, kept fixed (compiler and commands)', () => {
|
|
|
484
484
|
expect(plan.codeowners?.block).toContain('/apps/web/.opencastle/lock.json @acme/platform')
|
|
485
485
|
})
|
|
486
486
|
|
|
487
|
+
it('ci: names paths as the project spells them, through a linked checkout', () => {
|
|
488
|
+
const real = join(project, 'real')
|
|
489
|
+
write(real, { 'package.json': '{}', 'package-lock.json': '{}', CODEOWNERS: '* @acme/everyone\n' })
|
|
490
|
+
execFileSync('git', ['init', '-q'], { cwd: real })
|
|
491
|
+
const linked = join(project, 'linked')
|
|
492
|
+
symlinkSync(real, linked)
|
|
493
|
+
const plan = planCi(linked, '0.36.0', '@acme/platform')
|
|
494
|
+
expect(plan.codeowners?.path).toBe(join(linked, 'CODEOWNERS'))
|
|
495
|
+
expect(plan.workflowPath.startsWith(linked)).toBe(true)
|
|
496
|
+
})
|
|
497
|
+
|
|
487
498
|
it('ci: gives pnpm a version when package.json does not name one', () => {
|
|
488
499
|
write(project, { 'package.json': '{}', 'pnpm-lock.yaml': '' })
|
|
489
500
|
expect(planCi(project, '0.36.0').workflow).toContain('version: 10')
|
package/src/cli/types.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { CompileSource } from './layers.js';
|
|
|
4
4
|
// ── Stack selection types ──────────────────────────────────────
|
|
5
5
|
|
|
6
6
|
export type IdeChoice = 'vscode' | 'cursor' | 'claude-code' | 'opencode' | 'windsurf' | 'codex' | 'antigravity';
|
|
7
|
-
export type TechTool = 'sanity' | 'contentful' | 'strapi' | 'supabase' | 'convex' | 'vercel' | 'nx' | 'chrome-devtools' | 'nextjs' | 'astro' | 'netlify' | 'turborepo' | 'prisma' | 'cypress' | 'playwright' | 'vitest' | 'figma' | 'resend' | 'stripe' | 'sentry' | 'drizzle' | 'cloudflare' | 'coolify' | 'expo';
|
|
7
|
+
export type TechTool = 'sanity' | 'contentful' | 'strapi' | 'supabase' | 'convex' | 'vercel' | 'nx' | 'chrome-devtools' | 'nextjs' | 'astro' | 'netlify' | 'turborepo' | 'prisma' | 'cypress' | 'playwright' | 'vitest' | 'figma' | 'resend' | 'stripe' | 'sentry' | 'drizzle' | 'cloudflare' | 'coolify' | 'expo' | 'hetzner';
|
|
8
8
|
export type TeamTool = 'linear' | 'jira' | 'trello' | 'notion' | 'slack' | 'teams';
|
|
9
9
|
|
|
10
10
|
export interface StackConfig {
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Windsurf — now Devin Desktop — through the built CLI.
|
|
3
|
+
*
|
|
4
|
+
* Releases before this one wrote `.windsurf/mcp.json`, which no Devin Desktop
|
|
5
|
+
* agent reads (the legacy Cascade agent reads one global file, the default
|
|
6
|
+
* Devin Local agent `.devin/mcp_config.json`), and flattened every skill into
|
|
7
|
+
* a `.windsurf/rules/skills/` rule although both agents read Agent Skills.
|
|
8
|
+
*/
|
|
9
|
+
import { execFileSync } from 'node:child_process'
|
|
10
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
|
|
11
|
+
import { tmpdir } from 'node:os'
|
|
12
|
+
import { dirname, join, resolve } from 'node:path'
|
|
13
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
14
|
+
import type { Manifest } from './types.js'
|
|
15
|
+
|
|
16
|
+
const pkgRoot = resolve(import.meta.dirname, '..', '..')
|
|
17
|
+
const cli = join(pkgRoot, 'bin', 'cli.mjs')
|
|
18
|
+
const built = existsSync(join(pkgRoot, 'dist', 'cli', 'init.js'))
|
|
19
|
+
|
|
20
|
+
function write(root: string, files: Record<string, string>): void {
|
|
21
|
+
for (const [rel, text] of Object.entries(files)) {
|
|
22
|
+
mkdirSync(dirname(join(root, rel)), { recursive: true })
|
|
23
|
+
writeFileSync(join(root, rel), text)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const run = (cwd: string, ...args: string[]): string =>
|
|
28
|
+
execFileSync('node', [cli, ...args], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] })
|
|
29
|
+
|
|
30
|
+
describe.skipIf(!built)('Windsurf as a target', () => {
|
|
31
|
+
let project: string
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
project = mkdtempSync(join(tmpdir(), 'oc-windsurf-'))
|
|
34
|
+
execFileSync('git', ['init', '-q'], { cwd: project })
|
|
35
|
+
write(project, {
|
|
36
|
+
'package.json': JSON.stringify({ name: 'app', dependencies: { '@supabase/supabase-js': '^2.0.0' } }),
|
|
37
|
+
'.windsurfrules': '# House rules\n',
|
|
38
|
+
})
|
|
39
|
+
run(project, 'init', '--yes')
|
|
40
|
+
})
|
|
41
|
+
afterEach(() => rmSync(project, { recursive: true, force: true }))
|
|
42
|
+
|
|
43
|
+
it('installs skills and servers where Devin Desktop reads them', () => {
|
|
44
|
+
expect(existsSync(join(project, '.agents', 'skills', 'testing-workflow', 'SKILL.md'))).toBe(true)
|
|
45
|
+
const mcp = JSON.parse(readFileSync(join(project, '.devin', 'mcp_config.json'), 'utf8'))
|
|
46
|
+
expect(mcp.mcpServers.Supabase).toEqual({ url: 'https://mcp.supabase.com/mcp' })
|
|
47
|
+
expect(readFileSync(join(project, '.windsurfrules'), 'utf8')).toContain('Skills are in `.agents/skills/`')
|
|
48
|
+
run(project, 'sync', '--check')
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('the sync that upgrades a 1.0 install moves both, and leaves nothing behind', () => {
|
|
52
|
+
write(project, {
|
|
53
|
+
'.windsurf/mcp.json': JSON.stringify({ mcpServers: { Supabase: { url: 'https://mcp.supabase.com/mcp' } } }, null, 2) + '\n',
|
|
54
|
+
'.windsurf/rules/skills/testing-workflow.md': '---\ntrigger: model_decision\n---\n\nold\n',
|
|
55
|
+
'.windsurf/rules/skills/testing-workflow/REFERENCE.md': 'old\n',
|
|
56
|
+
})
|
|
57
|
+
const path = join(project, '.opencastle', 'manifest.json')
|
|
58
|
+
const manifest = JSON.parse(readFileSync(path, 'utf8')) as Manifest
|
|
59
|
+
manifest.version = '1.0.0'
|
|
60
|
+
manifest.createdConfigs = ['.windsurf/mcp.json']
|
|
61
|
+
writeFileSync(path, JSON.stringify(manifest, null, 2))
|
|
62
|
+
|
|
63
|
+
const out = run(project, 'sync', '--yes')
|
|
64
|
+
expect(out).toContain('Removed .windsurf/mcp.json')
|
|
65
|
+
expect(existsSync(join(project, '.windsurf', 'mcp.json'))).toBe(false)
|
|
66
|
+
expect(existsSync(join(project, '.windsurf', 'rules', 'skills'))).toBe(false)
|
|
67
|
+
expect(existsSync(join(project, '.devin', 'mcp_config.json'))).toBe(true)
|
|
68
|
+
run(project, 'sync', '--check')
|
|
69
|
+
})
|
|
70
|
+
})
|