opencastle 0.38.1 → 1.0.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 +81 -1
- package/bin/cli.mjs +20 -3
- package/dist/cli/adapters/antigravity.d.ts +1 -1
- package/dist/cli/adapters/antigravity.d.ts.map +1 -1
- package/dist/cli/adapters/claude-code.d.ts +1 -1
- package/dist/cli/adapters/claude-code.d.ts.map +1 -1
- package/dist/cli/adapters/codex.d.ts +1 -1
- package/dist/cli/adapters/codex.d.ts.map +1 -1
- package/dist/cli/adapters/cursor.d.ts +1 -1
- package/dist/cli/adapters/cursor.d.ts.map +1 -1
- package/dist/cli/adapters/opencode.d.ts +1 -1
- package/dist/cli/adapters/opencode.d.ts.map +1 -1
- package/dist/cli/adapters/rules-dir-base.d.ts +3 -2
- package/dist/cli/adapters/rules-dir-base.d.ts.map +1 -1
- package/dist/cli/adapters/rules-dir-base.js +13 -25
- package/dist/cli/adapters/rules-dir-base.js.map +1 -1
- package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
- package/dist/cli/adapters/single-file-base.js +30 -43
- package/dist/cli/adapters/single-file-base.js.map +1 -1
- package/dist/cli/adapters/vscode.d.ts +3 -2
- package/dist/cli/adapters/vscode.d.ts.map +1 -1
- package/dist/cli/adapters/vscode.js +19 -71
- package/dist/cli/adapters/vscode.js.map +1 -1
- package/dist/cli/adapters/windsurf.d.ts +1 -1
- package/dist/cli/adapters/windsurf.d.ts.map +1 -1
- package/dist/cli/baseline.d.ts +3 -0
- package/dist/cli/baseline.d.ts.map +1 -0
- package/dist/cli/baseline.js +280 -0
- package/dist/cli/baseline.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/ci.d.ts +18 -0
- package/dist/cli/ci.d.ts.map +1 -0
- package/dist/cli/ci.js +279 -0
- package/dist/cli/ci.js.map +1 -0
- package/dist/cli/dispatcher.test.js +2 -2
- package/dist/cli/dispatcher.test.js.map +1 -1
- package/dist/cli/docs-accuracy.test.js +5 -0
- package/dist/cli/docs-accuracy.test.js.map +1 -1
- package/dist/cli/doctor.d.ts +3 -3
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +66 -9
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/explain.d.ts +3 -0
- package/dist/cli/explain.d.ts.map +1 -0
- package/dist/cli/explain.js +210 -0
- package/dist/cli/explain.js.map +1 -0
- package/dist/cli/fleet.d.ts +30 -0
- package/dist/cli/fleet.d.ts.map +1 -0
- package/dist/cli/fleet.js +149 -0
- package/dist/cli/fleet.js.map +1 -0
- package/dist/cli/github-report.d.ts +49 -0
- package/dist/cli/github-report.d.ts.map +1 -0
- package/dist/cli/github-report.js +161 -0
- package/dist/cli/github-report.js.map +1 -0
- package/dist/cli/github-report.test.d.ts +2 -0
- package/dist/cli/github-report.test.d.ts.map +1 -0
- package/dist/cli/github-report.test.js +146 -0
- package/dist/cli/github-report.test.js.map +1 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +135 -94
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/init.test.js +26 -25
- package/dist/cli/init.test.js.map +1 -1
- package/dist/cli/layers.d.ts +152 -0
- package/dist/cli/layers.d.ts.map +1 -0
- package/dist/cli/layers.js +932 -0
- package/dist/cli/layers.js.map +1 -0
- package/dist/cli/layers.test.d.ts +2 -0
- package/dist/cli/layers.test.d.ts.map +1 -0
- package/dist/cli/layers.test.js +483 -0
- package/dist/cli/layers.test.js.map +1 -0
- package/dist/cli/lock.d.ts +130 -0
- package/dist/cli/lock.d.ts.map +1 -0
- package/dist/cli/lock.js +320 -0
- package/dist/cli/lock.js.map +1 -0
- package/dist/cli/mcp-audit.d.ts +164 -0
- package/dist/cli/mcp-audit.d.ts.map +1 -0
- package/dist/cli/mcp-audit.js +504 -0
- package/dist/cli/mcp-audit.js.map +1 -0
- package/dist/cli/mcp-audit.test.d.ts +2 -0
- package/dist/cli/mcp-audit.test.d.ts.map +1 -0
- package/dist/cli/mcp-audit.test.js +215 -0
- package/dist/cli/mcp-audit.test.js.map +1 -0
- package/dist/cli/mcp-upgrade.test.d.ts +2 -0
- package/dist/cli/mcp-upgrade.test.d.ts.map +1 -0
- package/dist/cli/mcp-upgrade.test.js +118 -0
- package/dist/cli/mcp-upgrade.test.js.map +1 -0
- package/dist/cli/mcp.d.ts +74 -5
- package/dist/cli/mcp.d.ts.map +1 -1
- package/dist/cli/mcp.js +340 -32
- package/dist/cli/mcp.js.map +1 -1
- package/dist/cli/policy.d.ts +58 -0
- package/dist/cli/policy.d.ts.map +1 -0
- package/dist/cli/policy.js +194 -0
- package/dist/cli/policy.js.map +1 -0
- package/dist/cli/publish-workflow.test.js +55 -1
- package/dist/cli/publish-workflow.test.js.map +1 -1
- package/dist/cli/remove.d.ts.map +1 -1
- package/dist/cli/remove.js +3 -2
- package/dist/cli/remove.js.map +1 -1
- package/dist/cli/review.d.ts +25 -0
- package/dist/cli/review.d.ts.map +1 -0
- package/dist/cli/review.js +437 -0
- package/dist/cli/review.js.map +1 -0
- package/dist/cli/status.d.ts +2 -0
- package/dist/cli/status.d.ts.map +1 -1
- package/dist/cli/status.js +25 -4
- package/dist/cli/status.js.map +1 -1
- package/dist/cli/status.test.js +5 -3
- package/dist/cli/status.test.js.map +1 -1
- package/dist/cli/sync-check.d.ts +16 -1
- package/dist/cli/sync-check.d.ts.map +1 -1
- package/dist/cli/sync-check.js +219 -13
- package/dist/cli/sync-check.js.map +1 -1
- package/dist/cli/sync-check.test.js +14 -8
- package/dist/cli/sync-check.test.js.map +1 -1
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +2 -0
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/team-ci.test.d.ts +2 -0
- package/dist/cli/team-ci.test.d.ts.map +1 -0
- package/dist/cli/team-ci.test.js +169 -0
- package/dist/cli/team-ci.test.js.map +1 -0
- package/dist/cli/team-commands.test.d.ts +2 -0
- package/dist/cli/team-commands.test.d.ts.map +1 -0
- package/dist/cli/team-commands.test.js +233 -0
- package/dist/cli/team-commands.test.js.map +1 -0
- package/dist/cli/team-config.d.ts +88 -0
- package/dist/cli/team-config.d.ts.map +1 -0
- package/dist/cli/team-config.js +261 -0
- package/dist/cli/team-config.js.map +1 -0
- package/dist/cli/team-health.d.ts +49 -0
- package/dist/cli/team-health.d.ts.map +1 -0
- package/dist/cli/team-health.js +205 -0
- package/dist/cli/team-health.js.map +1 -0
- package/dist/cli/team-sources.test.d.ts +2 -0
- package/dist/cli/team-sources.test.d.ts.map +1 -0
- package/dist/cli/team-sources.test.js +542 -0
- package/dist/cli/team-sources.test.js.map +1 -0
- package/dist/cli/types.d.ts +16 -2
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli/types.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +204 -44
- package/dist/cli/update.js.map +1 -1
- package/dist/cli/version-range.d.ts +24 -0
- package/dist/cli/version-range.d.ts.map +1 -0
- package/dist/cli/version-range.js +157 -0
- package/dist/cli/version-range.js.map +1 -0
- package/dist/cli/website-plugins.test.d.ts +2 -0
- package/dist/cli/website-plugins.test.d.ts.map +1 -0
- package/dist/cli/website-plugins.test.js +34 -0
- package/dist/cli/website-plugins.test.js.map +1 -0
- package/dist/orchestrator/plugins/chrome-devtools/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/chrome-devtools/config.js +11 -1
- package/dist/orchestrator/plugins/chrome-devtools/config.js.map +1 -1
- package/dist/orchestrator/plugins/contentful/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/contentful/config.js +11 -1
- package/dist/orchestrator/plugins/contentful/config.js.map +1 -1
- package/dist/orchestrator/plugins/convex/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/convex/config.js +11 -1
- package/dist/orchestrator/plugins/convex/config.js.map +1 -1
- package/dist/orchestrator/plugins/coolify/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/coolify/config.js +14 -1
- package/dist/orchestrator/plugins/coolify/config.js.map +1 -1
- package/dist/orchestrator/plugins/figma/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/figma/config.js +24 -13
- package/dist/orchestrator/plugins/figma/config.js.map +1 -1
- package/dist/orchestrator/plugins/linear/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/linear/config.js +27 -17
- package/dist/orchestrator/plugins/linear/config.js.map +1 -1
- package/dist/orchestrator/plugins/netlify/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/netlify/config.js +23 -9
- package/dist/orchestrator/plugins/netlify/config.js.map +1 -1
- package/dist/orchestrator/plugins/nextjs/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/nextjs/config.js +11 -1
- package/dist/orchestrator/plugins/nextjs/config.js.map +1 -1
- package/dist/orchestrator/plugins/nx/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/nx/config.js +11 -1
- package/dist/orchestrator/plugins/nx/config.js.map +1 -1
- package/dist/orchestrator/plugins/pins.test.d.ts +2 -0
- package/dist/orchestrator/plugins/pins.test.d.ts.map +1 -0
- package/dist/orchestrator/plugins/pins.test.js +78 -0
- package/dist/orchestrator/plugins/pins.test.js.map +1 -0
- package/dist/orchestrator/plugins/playwright/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/playwright/config.js +11 -1
- package/dist/orchestrator/plugins/playwright/config.js.map +1 -1
- package/dist/orchestrator/plugins/prisma/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/prisma/config.js +17 -2
- package/dist/orchestrator/plugins/prisma/config.js.map +1 -1
- package/dist/orchestrator/plugins/resend/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/resend/config.js +17 -1
- package/dist/orchestrator/plugins/resend/config.js.map +1 -1
- package/dist/orchestrator/plugins/sentry/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/sentry/config.js +13 -1
- package/dist/orchestrator/plugins/sentry/config.js.map +1 -1
- package/dist/orchestrator/plugins/slack/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/slack/config.js +20 -1
- package/dist/orchestrator/plugins/slack/config.js.map +1 -1
- package/dist/orchestrator/plugins/strapi/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/strapi/config.js +11 -1
- package/dist/orchestrator/plugins/strapi/config.js.map +1 -1
- package/dist/orchestrator/plugins/trello/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/trello/config.js +21 -1
- package/dist/orchestrator/plugins/trello/config.js.map +1 -1
- package/dist/orchestrator/plugins/types.d.ts +22 -0
- package/dist/orchestrator/plugins/types.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/cli/adapters/rules-dir-base.ts +23 -44
- package/src/cli/adapters/single-file-base.ts +43 -46
- package/src/cli/adapters/vscode.ts +28 -71
- package/src/cli/baseline.ts +289 -0
- package/src/cli/bootstrap.ts +1 -1
- package/src/cli/ci.ts +289 -0
- package/src/cli/dispatcher.test.ts +2 -2
- package/src/cli/docs-accuracy.test.ts +5 -0
- package/src/cli/doctor.ts +92 -6
- package/src/cli/explain.ts +210 -0
- package/src/cli/fleet.ts +176 -0
- package/src/cli/github-report.test.ts +158 -0
- package/src/cli/github-report.ts +179 -0
- package/src/cli/init.test.ts +27 -27
- package/src/cli/init.ts +135 -93
- package/src/cli/layers.test.ts +525 -0
- package/src/cli/layers.ts +1089 -0
- package/src/cli/lock.ts +395 -0
- package/src/cli/mcp-audit.test.ts +259 -0
- package/src/cli/mcp-audit.ts +619 -0
- package/src/cli/mcp-upgrade.test.ts +135 -0
- package/src/cli/mcp.ts +373 -34
- package/src/cli/policy.ts +207 -0
- package/src/cli/publish-workflow.test.ts +60 -1
- package/src/cli/remove.ts +8 -2
- package/src/cli/review.ts +457 -0
- package/src/cli/status.test.ts +5 -3
- package/src/cli/status.ts +29 -4
- package/src/cli/sync-check.test.ts +16 -8
- package/src/cli/sync-check.ts +245 -14
- package/src/cli/sync.ts +2 -0
- package/src/cli/team-ci.test.ts +195 -0
- package/src/cli/team-commands.test.ts +253 -0
- package/src/cli/team-config.ts +289 -0
- package/src/cli/team-health.ts +234 -0
- package/src/cli/team-sources.test.ts +578 -0
- package/src/cli/types.ts +19 -1
- package/src/cli/update.ts +217 -44
- package/src/cli/version-range.ts +150 -0
- package/src/cli/website-plugins.test.ts +41 -0
- package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
- package/src/orchestrator/customizations/README.md +1 -1
- package/src/orchestrator/plugins/chrome-devtools/SKILL.md +1 -1
- package/src/orchestrator/plugins/chrome-devtools/config.ts +11 -1
- package/src/orchestrator/plugins/contentful/SKILL.md +1 -1
- package/src/orchestrator/plugins/contentful/config.ts +11 -1
- package/src/orchestrator/plugins/convex/SKILL.md +1 -1
- package/src/orchestrator/plugins/convex/config.ts +11 -1
- package/src/orchestrator/plugins/coolify/config.ts +14 -1
- package/src/orchestrator/plugins/cypress/SKILL.md +1 -1
- package/src/orchestrator/plugins/figma/SKILL.md +18 -14
- package/src/orchestrator/plugins/figma/config.ts +24 -13
- package/src/orchestrator/plugins/jira/SKILL.md +2 -2
- package/src/orchestrator/plugins/linear/SKILL.md +6 -14
- package/src/orchestrator/plugins/linear/config.ts +27 -17
- package/src/orchestrator/plugins/netlify/SKILL.md +1 -1
- package/src/orchestrator/plugins/netlify/config.ts +23 -9
- package/src/orchestrator/plugins/nextjs/config.ts +11 -1
- package/src/orchestrator/plugins/nx/config.ts +11 -1
- package/src/orchestrator/plugins/pins.test.ts +80 -0
- package/src/orchestrator/plugins/playwright/SKILL.md +1 -1
- package/src/orchestrator/plugins/playwright/config.ts +11 -1
- package/src/orchestrator/plugins/prisma/SKILL.md +1 -1
- package/src/orchestrator/plugins/prisma/config.ts +17 -2
- package/src/orchestrator/plugins/resend/config.ts +17 -1
- package/src/orchestrator/plugins/sanity/SKILL.md +1 -1
- package/src/orchestrator/plugins/sentry/config.ts +13 -1
- package/src/orchestrator/plugins/slack/config.ts +20 -1
- package/src/orchestrator/plugins/strapi/SKILL.md +1 -1
- package/src/orchestrator/plugins/strapi/config.ts +11 -1
- package/src/orchestrator/plugins/supabase/SKILL.md +1 -1
- package/src/orchestrator/plugins/trello/SKILL.md +1 -1
- package/src/orchestrator/plugins/trello/config.ts +21 -1
- package/src/orchestrator/plugins/types.ts +24 -0
- 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/git-workflow/SKILL.md +1 -1
package/src/cli/update.ts
CHANGED
|
@@ -8,7 +8,6 @@ import { TECH_PLUGINS, TEAM_PLUGINS } from '../orchestrator/plugins/index.js'
|
|
|
8
8
|
import { IDE_ADAPTERS, VALID_IDES } from './adapters/index.js'
|
|
9
9
|
import { getOrchestratorRoot } from './copy.js'
|
|
10
10
|
import {
|
|
11
|
-
getRequiredMcpEnvVars,
|
|
12
11
|
updateSkillMatrixFile,
|
|
13
12
|
resolveStack,
|
|
14
13
|
getCustomizationsTransform,
|
|
@@ -21,6 +20,40 @@ import { detectRepoInfo, mergeStackIntoRepoInfo, buildDetectedToolsSet } from '.
|
|
|
21
20
|
import type { CliContext, IdeChoice, TechTool, TeamTool, StackConfig } from './types.js'
|
|
22
21
|
import { UnreadableConfigError } from './types.js'
|
|
23
22
|
import { noteUnreadable } from './unreadable-report.js'
|
|
23
|
+
import {
|
|
24
|
+
resolveSources,
|
|
25
|
+
materialize,
|
|
26
|
+
hasErrors,
|
|
27
|
+
usesTeamSources,
|
|
28
|
+
formatIssues,
|
|
29
|
+
requiredEnvVars,
|
|
30
|
+
type ResolvedSources,
|
|
31
|
+
} from './layers.js'
|
|
32
|
+
import { buildLock, writeLock, LOCK_REL, priorTeam } from './lock.js'
|
|
33
|
+
import { parseVersion, compareVersions } from './version-range.js'
|
|
34
|
+
|
|
35
|
+
/** Print what is wrong with the team's sources, and that nothing was written. */
|
|
36
|
+
function reportTeamIssues(resolved: ResolvedSources): void {
|
|
37
|
+
const errors = resolved.issues.filter((i) => i.level === 'error')
|
|
38
|
+
console.error(
|
|
39
|
+
`\n ${c.red('✗')} The team's sources have ${errors.length} problem(s); nothing was compiled.\n`,
|
|
40
|
+
)
|
|
41
|
+
for (const line of formatIssues(errors)) console.error(` ${line.startsWith(' ') ? c.dim(line) : line}`)
|
|
42
|
+
console.error('')
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The manifest without the field that changes on every write.
|
|
47
|
+
*
|
|
48
|
+
* `updatedAt` changed on every sync, so two branches that both synced always
|
|
49
|
+
* conflicted on the manifest — in the one file every command reads first,
|
|
50
|
+
* where a conflict makes every command stop. Written only when something it
|
|
51
|
+
* records has actually changed.
|
|
52
|
+
*/
|
|
53
|
+
function manifestMeaning(m: Record<string, unknown>): string {
|
|
54
|
+
const { updatedAt: _u, installedAt: _i, ...rest } = m
|
|
55
|
+
return JSON.stringify(rest)
|
|
56
|
+
}
|
|
24
57
|
|
|
25
58
|
const UPDATE_HELP = `
|
|
26
59
|
opencastle update [options]
|
|
@@ -31,6 +64,8 @@ const UPDATE_HELP = `
|
|
|
31
64
|
Options:
|
|
32
65
|
--dry-run Preview what would be changed without writing files
|
|
33
66
|
--force Force update even if versions match
|
|
67
|
+
--allow-downgrade Recompile with this OpenCastle even though a newer one
|
|
68
|
+
compiled the project
|
|
34
69
|
--reconfigure Re-run IDE and stack selection
|
|
35
70
|
--help, -h Show this help
|
|
36
71
|
`
|
|
@@ -136,6 +171,44 @@ export default async function update({
|
|
|
136
171
|
await readFile(resolve(pkgRoot, 'package.json'), 'utf8')
|
|
137
172
|
) as { version: string }
|
|
138
173
|
|
|
174
|
+
// An older OpenCastle than the one that compiled the project would replace
|
|
175
|
+
// newer output with older, and the next teammate's sync would put it back —
|
|
176
|
+
// a pull request war nobody chose. Refused unless asked for by name: not by
|
|
177
|
+
// `--force`, which the tool's own remedies prescribe for other reasons, and
|
|
178
|
+
// which a teammate on an old CLI would otherwise run into a downgrade.
|
|
179
|
+
{
|
|
180
|
+
const mine = parseVersion(pkg.version)
|
|
181
|
+
const theirs = parseVersion(manifest.version)
|
|
182
|
+
if (mine && theirs && compareVersions(mine, theirs) < 0) {
|
|
183
|
+
if (!args.includes('--allow-downgrade')) {
|
|
184
|
+
console.error(
|
|
185
|
+
`\n ${c.red('✗')} This project was compiled by OpenCastle ${manifest.version}; this is ${pkg.version}.`,
|
|
186
|
+
)
|
|
187
|
+
console.error(` ${c.dim('Syncing would replace newer generated files with older ones. Run the project\'s version —')}`)
|
|
188
|
+
console.error(` ${c.dim(`npx opencastle@${manifest.version} sync, or add it to devDependencies so everyone runs one —`)}`)
|
|
189
|
+
console.error(` ${c.dim('or pass --allow-downgrade to go back to this version on purpose.')}\n`)
|
|
190
|
+
process.exit(1)
|
|
191
|
+
}
|
|
192
|
+
console.log(` ${c.yellow('!')} Downgrading this project from OpenCastle ${manifest.version} to ${pkg.version}, as asked.`)
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// The team's sources, checked before anything is written. A baseline that is
|
|
197
|
+
// not installed or a server the policy forbids is a compile error: better no
|
|
198
|
+
// output than output that quietly leaves the team's standard out.
|
|
199
|
+
{
|
|
200
|
+
const early = resolveSources({
|
|
201
|
+
pkgRoot,
|
|
202
|
+
projectRoot,
|
|
203
|
+
stack: resolveStack({ ...manifest, ides }),
|
|
204
|
+
repoInfo: manifest.repoInfo,
|
|
205
|
+
})
|
|
206
|
+
if (hasErrors(early)) {
|
|
207
|
+
reportTeamIssues(early)
|
|
208
|
+
process.exit(1)
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
139
212
|
// ── Recreate the local-only directories ─────────────────────────
|
|
140
213
|
// Deliberately gitignored, so a fresh clone has none of them, and only `init`
|
|
141
214
|
// used to create them: `doctor` failed on every clone and told the user to run
|
|
@@ -197,10 +270,16 @@ export default async function update({
|
|
|
197
270
|
} catch {
|
|
198
271
|
return true
|
|
199
272
|
}
|
|
273
|
+
// The drift report also counts an MCP server entry still exactly as an
|
|
274
|
+
// earlier release wrote it, whose default has since changed. `doctor`
|
|
275
|
+
// prescribes this command for those — a package missing from npm, a remote
|
|
276
|
+
// server Claude Code cannot load — so the short-circuit must see them.
|
|
200
277
|
try {
|
|
201
278
|
const { buildCheckReport } = await import('./sync-check.js')
|
|
202
279
|
const report = await buildCheckReport(pkgRoot, projectRoot)
|
|
203
|
-
|
|
280
|
+
// Not a broken MCP server only a person can fix: recompiling cannot clear
|
|
281
|
+
// it, and doing so on every run rewrote the committed manifest for nothing.
|
|
282
|
+
return report.drift.some((d) => !(d.origin === 'mcp' && d.kind === 'unreducible'))
|
|
204
283
|
} catch {
|
|
205
284
|
// If the comparison itself fails, err towards doing the work.
|
|
206
285
|
return true
|
|
@@ -454,54 +533,93 @@ export default async function update({
|
|
|
454
533
|
const staleRoots: string[] = []
|
|
455
534
|
const tornRoots: string[] = []
|
|
456
535
|
const sweptFiles: string[] = []
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
const results = await adapter.update(pkgRoot, projectRoot, newStack, repoInfo)
|
|
465
|
-
totalCopied += results.copied.length
|
|
466
|
-
totalCreated += results.created.length
|
|
467
|
-
adoptedRoots.push(...(results.adopted ?? []))
|
|
468
|
-
repairedRoots.push(...(results.repaired ?? []))
|
|
469
|
-
damagedRoots.push(...(results.damagedRoots ?? []))
|
|
470
|
-
severedRoots.push(...(results.severedRoots ?? []))
|
|
471
|
-
staleRoots.push(...(results.staleRoots ?? []))
|
|
472
|
-
tornRoots.push(...(results.tornRoots ?? []))
|
|
473
|
-
sweptFiles.push(...(results.deleted ?? []))
|
|
474
|
-
// The adapters skip a config they cannot parse instead of throwing; the
|
|
475
|
-
// report below is the only place the user learns which file to fix.
|
|
476
|
-
for (const file of results.unreadable ?? []) {
|
|
477
|
-
noteUnreadable(unreadable, file)
|
|
478
|
-
}
|
|
536
|
+
// The merged sources — OpenCastle's content, the baselines, the project's
|
|
537
|
+
// own — resolved once more with the final stack, so a reconfigure is honoured.
|
|
538
|
+
const resolved = resolveSources({ pkgRoot, projectRoot, stack: newStack, repoInfo })
|
|
539
|
+
if (hasErrors(resolved)) {
|
|
540
|
+
reportTeamIssues(resolved)
|
|
541
|
+
closePrompts()
|
|
542
|
+
process.exit(1)
|
|
479
543
|
}
|
|
480
|
-
|
|
481
544
|
// Deduplicated, and re-sorted by what the adapters declare today — two targets
|
|
482
545
|
// that share AGENTS.md used to record it twice, and a manifest from before
|
|
483
546
|
// root files were co-owned still files them under `framework`.
|
|
484
547
|
const allManagedPaths = await resolveManagedPaths({ ...manifest, ides })
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
548
|
+
const teamWritten = new Set<string>()
|
|
549
|
+
const teamRemoved = new Set<string>()
|
|
550
|
+
const upgradedServers = new Set<string>()
|
|
551
|
+
const removedServers = new Set<string>()
|
|
552
|
+
let lockWritten = false
|
|
553
|
+
let lockHeld = false
|
|
554
|
+
const source = materialize(resolved, pkgRoot, ...priorTeam(projectRoot))
|
|
555
|
+
try {
|
|
492
556
|
for (const ide of ides) {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
557
|
+
const adapter = await IDE_ADAPTERS[ide]()
|
|
558
|
+
// `repoInfo` matters here: `scaffoldMcpConfigInto` uses it to decide which
|
|
559
|
+
// servers belong in the config. The parameter was threaded through all
|
|
560
|
+
// three adapters and then not passed from the one place `sync` calls them,
|
|
561
|
+
// so every sync scaffolded MCP as though the repository had been detected
|
|
562
|
+
// as nothing at all — a property enforced everywhere except at the call.
|
|
563
|
+
const results = await adapter.update(pkgRoot, projectRoot, newStack, repoInfo, source)
|
|
564
|
+
totalCopied += results.copied.length
|
|
565
|
+
totalCreated += results.created.length
|
|
566
|
+
adoptedRoots.push(...(results.adopted ?? []))
|
|
567
|
+
repairedRoots.push(...(results.repaired ?? []))
|
|
568
|
+
damagedRoots.push(...(results.damagedRoots ?? []))
|
|
569
|
+
severedRoots.push(...(results.severedRoots ?? []))
|
|
570
|
+
staleRoots.push(...(results.staleRoots ?? []))
|
|
571
|
+
tornRoots.push(...(results.tornRoots ?? []))
|
|
572
|
+
sweptFiles.push(...(results.deleted ?? []))
|
|
573
|
+
for (const key of results.mcpTeamWritten ?? []) teamWritten.add(key)
|
|
574
|
+
for (const key of results.mcpTeamRemoved ?? []) teamRemoved.add(key)
|
|
575
|
+
// The adapters skip a config they cannot parse instead of throwing; the
|
|
576
|
+
// report below is the only place the user learns which file to fix.
|
|
577
|
+
for (const file of results.unreadable ?? []) {
|
|
578
|
+
noteUnreadable(unreadable, file)
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// The skill matrix and the MCP config are compiled output like everything else,
|
|
583
|
+
// so they are regenerated whenever we recompile. Gating them on `stackChanged`
|
|
584
|
+
// — a flag only ever set inside the interactive reconfigure branch — meant
|
|
585
|
+
// `opencastle add supabase` edited the manifest, recompiled, and left the skill
|
|
586
|
+
// matrix and MCP config describing the stack from before the pack was added.
|
|
587
|
+
if (newStack) {
|
|
588
|
+
for (const ide of ides) {
|
|
589
|
+
for (const step of [
|
|
590
|
+
() => updateSkillMatrixFile(projectRoot, ide, newStack),
|
|
591
|
+
async () => {
|
|
592
|
+
const outcome = await rebuildMcpConfig(projectRoot, ide as IdeChoice, newStack, repoInfo, source.mcp)
|
|
593
|
+
for (const key of outcome.upgraded) upgradedServers.add(key)
|
|
594
|
+
for (const key of outcome.removed) removedServers.add(key)
|
|
595
|
+
for (const key of outcome.teamWritten) teamWritten.add(key)
|
|
596
|
+
for (const key of outcome.teamRemoved) teamRemoved.add(key)
|
|
597
|
+
},
|
|
598
|
+
]) {
|
|
599
|
+
try {
|
|
600
|
+
await step()
|
|
601
|
+
} catch (err) {
|
|
602
|
+
if (!(err instanceof UnreadableConfigError)) throw err
|
|
603
|
+
noteUnreadable(unreadable, err.file)
|
|
604
|
+
}
|
|
502
605
|
}
|
|
503
606
|
}
|
|
504
607
|
}
|
|
608
|
+
|
|
609
|
+
// What every assistant is now given, for review. Written last, from the
|
|
610
|
+
// same source the targets were compiled from — and not at all while an MCP
|
|
611
|
+
// config could not be read. The lock is how the next sync knows which team
|
|
612
|
+
// servers to take back out; recording a retirement before every config has
|
|
613
|
+
// had the server removed would leave it in the unreadable one for good,
|
|
614
|
+
// with every check green.
|
|
615
|
+
const mcpPaths = new Set(ides.map((i) => getMcpConfigRelPath(i as IdeChoice)))
|
|
616
|
+
lockHeld = unreadable.some((u) => {
|
|
617
|
+
const name = u.split('\u0000')[0]
|
|
618
|
+
return mcpPaths.has((isAbsolute(name) ? relative(projectRoot, name) : name).replace(/\\/g, '/'))
|
|
619
|
+
})
|
|
620
|
+
if (!lockHeld) lockWritten = await writeLock(projectRoot, buildLock(source, { ides, stack: newStack, repoInfo }))
|
|
621
|
+
} finally {
|
|
622
|
+
source.dispose()
|
|
505
623
|
}
|
|
506
624
|
|
|
507
625
|
// ── Restore any missing .opencastle/ scaffolding ────────────────
|
|
@@ -529,13 +647,16 @@ export default async function update({
|
|
|
529
647
|
await migrateLegacyLogs(projectRoot)
|
|
530
648
|
|
|
531
649
|
// ── Update manifest ─────────────────────────────────────────────
|
|
650
|
+
const before = manifestMeaning(manifest as unknown as Record<string, unknown>)
|
|
532
651
|
manifest.version = pkg.version
|
|
533
652
|
manifest.ides = ides
|
|
534
|
-
manifest.updatedAt = new Date().toISOString()
|
|
535
653
|
manifest.managedPaths = allManagedPaths
|
|
536
654
|
manifest.stack = newStack
|
|
537
655
|
manifest.repoInfo = mergeStackIntoRepoInfo(repoInfo, newStack)
|
|
538
|
-
|
|
656
|
+
if (manifestMeaning(manifest as unknown as Record<string, unknown>) !== before) {
|
|
657
|
+
manifest.updatedAt = new Date().toISOString()
|
|
658
|
+
await writeManifest(projectRoot, manifest)
|
|
659
|
+
}
|
|
539
660
|
|
|
540
661
|
// ── Results ─────────────────────────────────────────────────────
|
|
541
662
|
console.log(
|
|
@@ -550,6 +671,58 @@ export default async function update({
|
|
|
550
671
|
console.log(` ${c.green('✓')} Updated skill matrix`)
|
|
551
672
|
console.log(` ${c.green('✓')} Rebuilt MCP config`)
|
|
552
673
|
}
|
|
674
|
+
// Said, because it changes a file the user commits: an entry we generated has
|
|
675
|
+
// moved to a new default (a pinned version, a server that exists, a shape the
|
|
676
|
+
// assistant can load), and the diff should not come as a surprise in review.
|
|
677
|
+
if (upgradedServers.size > 0) {
|
|
678
|
+
console.log(
|
|
679
|
+
` ${c.green('✓')} Moved ${upgradedServers.size} MCP server(s) to the current default: ` +
|
|
680
|
+
[...upgradedServers].sort().join(', '),
|
|
681
|
+
)
|
|
682
|
+
}
|
|
683
|
+
if (removedServers.size > 0) {
|
|
684
|
+
console.log(
|
|
685
|
+
` ${c.yellow('-')} Removed ${removedServers.size} MCP server(s) this project's stack no longer includes: ` +
|
|
686
|
+
[...removedServers].sort().join(', ') +
|
|
687
|
+
c.dim(' (opencastle add <pack> brings one back)'),
|
|
688
|
+
)
|
|
689
|
+
}
|
|
690
|
+
if (teamWritten.size > 0) {
|
|
691
|
+
console.log(` ${c.green('✓')} Wrote the team's MCP server(s) as defined: ${[...teamWritten].sort().join(', ')}`)
|
|
692
|
+
}
|
|
693
|
+
if (teamRemoved.size > 0) {
|
|
694
|
+
console.log(
|
|
695
|
+
` ${c.yellow('-')} Removed ${teamRemoved.size} MCP server(s) the team's layers retired or its policy does not allow: ` +
|
|
696
|
+
[...teamRemoved].sort().join(', '),
|
|
697
|
+
)
|
|
698
|
+
}
|
|
699
|
+
if (usesTeamSources(resolved)) {
|
|
700
|
+
const baselines = resolved.layers.filter((l) => l.kind === 'baseline')
|
|
701
|
+
const own = [...resolved.items.values()].filter((i) => i.layer !== 'opencastle').length
|
|
702
|
+
console.log(
|
|
703
|
+
` ${c.green('✓')} Compiled ${baselines.length > 0 ? `${baselines.map((b) => `${b.id}${b.version ? ` ${b.version}` : ''}`).join(', ')} and ` : ''}` +
|
|
704
|
+
`this project's own sources${own > 0 ? ` (${own} item${own === 1 ? '' : 's'})` : ''}`,
|
|
705
|
+
)
|
|
706
|
+
}
|
|
707
|
+
if (lockWritten) {
|
|
708
|
+
console.log(` ${c.green('✓')} Updated ${LOCK_REL} ${c.dim('(opencastle review explains the change)')}`)
|
|
709
|
+
}
|
|
710
|
+
if (lockHeld) {
|
|
711
|
+
console.log(` ${c.yellow('!')} Left ${LOCK_REL} as it was until every MCP config can be read — fix the file named below and sync again.`)
|
|
712
|
+
}
|
|
713
|
+
// An integration the stack includes but the policy refuses is left out on
|
|
714
|
+
// purpose; saying nothing made `add stripe` look like it had worked.
|
|
715
|
+
if (resolved.blocked.size > 0) {
|
|
716
|
+
console.log(` ${c.yellow('-')} Left out ${resolved.blocked.size} MCP server(s):`)
|
|
717
|
+
for (const [key, why] of [...resolved.blocked].sort(([a], [b]) => (a < b ? -1 : 1))) {
|
|
718
|
+
console.log(` ${key} ${c.dim(`— ${why}`)}`)
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
const teamWarnings = resolved.issues.filter((i) => i.level === 'warning')
|
|
722
|
+
if (teamWarnings.length > 0) {
|
|
723
|
+
console.log(`\n ${c.yellow('!')} ${teamWarnings.length} note(s) about the team's sources:`)
|
|
724
|
+
for (const line of formatIssues(teamWarnings)) console.log(` ${c.dim(line)}`)
|
|
725
|
+
}
|
|
553
726
|
for (const file of unreadable) {
|
|
554
727
|
const [abs, why] = file.split('\u0000')
|
|
555
728
|
// Reported project-relative, whichever layer recorded it. `copyDir` works in
|
|
@@ -662,7 +835,7 @@ export default async function update({
|
|
|
662
835
|
// The old diff-against-previous-stack version was inside the `stackChanged`
|
|
663
836
|
// gate, so `opencastle add sentry` never mentioned the token it now needs.
|
|
664
837
|
if (newStack) {
|
|
665
|
-
const envVars =
|
|
838
|
+
const envVars = requiredEnvVars(resolved, newStack, repoInfo)
|
|
666
839
|
const envFile = await readFile(resolve(projectRoot, '.env'), 'utf8').catch(() => '')
|
|
667
840
|
const missing = envVars.filter(({ envVar }) => !isEnvVarSatisfied(envVar, envFile))
|
|
668
841
|
if (missing.length > 0) {
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Just enough semver to answer one question: does the running OpenCastle
|
|
3
|
+
* satisfy the range a team pinned in `.opencastle/config.json`?
|
|
4
|
+
*
|
|
5
|
+
* A team whose members run different OpenCastle versions gets a pull request
|
|
6
|
+
* war: each `sync` rewrites the generated files to its own release's output and
|
|
7
|
+
* the next person's `sync` rewrites them back. The version belongs to the
|
|
8
|
+
* project, like any other tool's, so the project can say which one it wants.
|
|
9
|
+
*
|
|
10
|
+
* Supported: exact (`0.36.0`), `^`, `~`, x-ranges (`0.36.x`, `0.x`, `*`),
|
|
11
|
+
* comparators (`>=0.36.0 <0.38.0`) and `||` alternatives. Prereleases compare
|
|
12
|
+
* by their dotted identifiers. That covers every range npm users write for a
|
|
13
|
+
* CLI; anything else is reported as unparseable rather than guessed at.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
type Version = [number, number, number, string[]]
|
|
17
|
+
|
|
18
|
+
const VERSION = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/
|
|
19
|
+
|
|
20
|
+
export function parseVersion(text: string): Version | null {
|
|
21
|
+
const m = VERSION.exec(text.trim())
|
|
22
|
+
if (!m) return null
|
|
23
|
+
return [Number(m[1]), Number(m[2]), Number(m[3]), m[4] ? m[4].split('.') : []]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function comparePre(a: string[], b: string[]): number {
|
|
27
|
+
// A release outranks any of its prereleases.
|
|
28
|
+
if (a.length === 0 || b.length === 0) return a.length === b.length ? 0 : a.length === 0 ? 1 : -1
|
|
29
|
+
for (let i = 0; i < Math.max(a.length, b.length); i++) {
|
|
30
|
+
if (a[i] === undefined) return -1
|
|
31
|
+
if (b[i] === undefined) return 1
|
|
32
|
+
const an = /^\d+$/.test(a[i])
|
|
33
|
+
const bn = /^\d+$/.test(b[i])
|
|
34
|
+
if (an && bn) {
|
|
35
|
+
const d = Number(a[i]) - Number(b[i])
|
|
36
|
+
if (d !== 0) return d < 0 ? -1 : 1
|
|
37
|
+
} else if (an !== bn) {
|
|
38
|
+
return an ? -1 : 1
|
|
39
|
+
} else if (a[i] !== b[i]) {
|
|
40
|
+
return a[i] < b[i] ? -1 : 1
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return 0
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function compareVersions(a: Version, b: Version): number {
|
|
47
|
+
for (let i = 0; i < 3; i++) {
|
|
48
|
+
const d = (a[i] as number) - (b[i] as number)
|
|
49
|
+
if (d !== 0) return d < 0 ? -1 : 1
|
|
50
|
+
}
|
|
51
|
+
return comparePre(a[3], b[3])
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
type Comparator = { op: '>=' | '>' | '<=' | '<' | '='; version: Version }
|
|
55
|
+
|
|
56
|
+
/** `1`, `1.2`, `1.x`, `1.2.*` → the parts given, with wildcards as null. */
|
|
57
|
+
function partial(text: string): [number | null, number | null, number | null, string[]] | null {
|
|
58
|
+
const m = /^v?(\d+|x|X|\*)(?:\.(\d+|x|X|\*))?(?:\.(\d+|x|X|\*))?(?:-([0-9A-Za-z.-]+))?$/.exec(text)
|
|
59
|
+
if (!m) return null
|
|
60
|
+
const num = (s: string | undefined): number | null =>
|
|
61
|
+
s === undefined || /^[xX*]$/.test(s) ? null : Number(s)
|
|
62
|
+
return [num(m[1]), num(m[2]), num(m[3]), m[4] ? m[4].split('.') : []]
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function v(major: number, minor: number, patch: number, pre: string[] = []): Version {
|
|
66
|
+
return [major, minor, patch, pre]
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** One space-separated term of a range, as comparators. Null when unreadable. */
|
|
70
|
+
function term(raw: string): Comparator[] | null {
|
|
71
|
+
if (raw === '*' || raw === 'x' || raw === 'X' || raw === '') return []
|
|
72
|
+
const op = /^(\^|~|>=|<=|>|<|=)?(.*)$/.exec(raw)
|
|
73
|
+
if (!op) return null
|
|
74
|
+
const sign = op[1] ?? ''
|
|
75
|
+
const p = partial(op[2])
|
|
76
|
+
if (!p) return null
|
|
77
|
+
const [ma, mi, pa, pre] = p
|
|
78
|
+
if (ma === null) return sign === '' || sign === '=' || sign === '>=' ? [] : null
|
|
79
|
+
|
|
80
|
+
if (sign === '^') {
|
|
81
|
+
const lo = v(ma, mi ?? 0, pa ?? 0, pre)
|
|
82
|
+
let hi: Version
|
|
83
|
+
if (ma > 0 || mi === null) hi = v(ma + 1, 0, 0, ['0'])
|
|
84
|
+
else if (mi > 0 || pa === null) hi = v(0, mi + 1, 0, ['0'])
|
|
85
|
+
else hi = v(0, 0, pa + 1, ['0'])
|
|
86
|
+
return [{ op: '>=', version: lo }, { op: '<', version: hi }]
|
|
87
|
+
}
|
|
88
|
+
if (sign === '~') {
|
|
89
|
+
const lo = v(ma, mi ?? 0, pa ?? 0, pre)
|
|
90
|
+
const hi = mi === null ? v(ma + 1, 0, 0, ['0']) : v(ma, mi + 1, 0, ['0'])
|
|
91
|
+
return [{ op: '>=', version: lo }, { op: '<', version: hi }]
|
|
92
|
+
}
|
|
93
|
+
if (sign === '' || sign === '=') {
|
|
94
|
+
if (mi === null) return [{ op: '>=', version: v(ma, 0, 0) }, { op: '<', version: v(ma + 1, 0, 0, ['0']) }]
|
|
95
|
+
if (pa === null) return [{ op: '>=', version: v(ma, mi, 0) }, { op: '<', version: v(ma, mi + 1, 0, ['0']) }]
|
|
96
|
+
return [{ op: '=', version: v(ma, mi, pa, pre) }]
|
|
97
|
+
}
|
|
98
|
+
// Comparators with a partial version: `>=1.2` means `>=1.2.0`, `<1.2` means `<1.2.0`,
|
|
99
|
+
// `>1.2` means `>=1.3.0`, `<=1.2` means `<1.3.0`.
|
|
100
|
+
if (sign === '>=' || sign === '<') {
|
|
101
|
+
return [{ op: sign, version: v(ma, mi ?? 0, pa ?? 0, pre) }]
|
|
102
|
+
}
|
|
103
|
+
if (pa !== null && mi !== null) return [{ op: sign as Comparator['op'], version: v(ma, mi, pa, pre) }]
|
|
104
|
+
const next = mi === null ? v(ma + 1, 0, 0) : v(ma, mi + 1, 0)
|
|
105
|
+
return [{ op: sign === '>' ? '>=' : '<', version: next }]
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function test(version: Version, c: Comparator): boolean {
|
|
109
|
+
const d = compareVersions(version, c.version)
|
|
110
|
+
switch (c.op) {
|
|
111
|
+
case '>=': return d >= 0
|
|
112
|
+
case '>': return d > 0
|
|
113
|
+
case '<=': return d <= 0
|
|
114
|
+
case '<': return d < 0
|
|
115
|
+
case '=': return d === 0
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Does `version` satisfy `range`? `null` when either cannot be read — the
|
|
121
|
+
* caller says so instead of treating an unreadable range as a pass or a fail.
|
|
122
|
+
*/
|
|
123
|
+
export function satisfies(version: string, range: string): boolean | null {
|
|
124
|
+
const ver = parseVersion(version)
|
|
125
|
+
if (!ver) return null
|
|
126
|
+
let any = false
|
|
127
|
+
for (const alt of range.split('||')) {
|
|
128
|
+
// `1.2.3 - 2.0.0` hyphen ranges.
|
|
129
|
+
const hyphen = /^\s*(\S+)\s+-\s+(\S+)\s*$/.exec(alt)
|
|
130
|
+
// `>= 1.2.0`, written with a space, is one comparator.
|
|
131
|
+
const joined = alt.trim().replace(/(>=|<=|>|<|=|\^|~)\s+/g, '$1')
|
|
132
|
+
const parts = hyphen ? [`>=${hyphen[1]}`, `<=${hyphen[2]}`] : joined.split(/\s+/)
|
|
133
|
+
const comparators: Comparator[] = []
|
|
134
|
+
for (const part of parts) {
|
|
135
|
+
const t = term(part)
|
|
136
|
+
if (t === null) return null
|
|
137
|
+
comparators.push(...t)
|
|
138
|
+
}
|
|
139
|
+
// A prerelease only satisfies a range that names a prerelease of the same
|
|
140
|
+
// version, as npm has it — `^0.36.0` must not accept `0.37.0-rc.1`.
|
|
141
|
+
if (ver[3].length > 0) {
|
|
142
|
+
const allowed = comparators.some(
|
|
143
|
+
(c) => c.version[3].length > 0 && c.version[0] === ver[0] && c.version[1] === ver[1] && c.version[2] === ver[2],
|
|
144
|
+
)
|
|
145
|
+
if (!allowed) continue
|
|
146
|
+
}
|
|
147
|
+
if (comparators.every((c) => test(ver, c))) any = true
|
|
148
|
+
}
|
|
149
|
+
return any
|
|
150
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The plugin guide takes its MCP configs from the plugin sources.
|
|
3
|
+
*
|
|
4
|
+
* It used to carry hand-copied JSON, and when the sources were pinned and three
|
|
5
|
+
* packages that do not exist were replaced, sixteen cards kept the old configs —
|
|
6
|
+
* `@latest`, and the dead packages — because nothing tied them to the code. The
|
|
7
|
+
* page now renders each snippet from `PLUGINS`; these tests keep it that way.
|
|
8
|
+
*/
|
|
9
|
+
import { readFileSync } from 'node:fs'
|
|
10
|
+
import { join, resolve } from 'node:path'
|
|
11
|
+
import { describe, it, expect } from 'vitest'
|
|
12
|
+
import { PLUGINS } from '../orchestrator/plugins/index.js'
|
|
13
|
+
|
|
14
|
+
const page = readFileSync(
|
|
15
|
+
join(resolve(import.meta.dirname, '..', '..'), 'website', 'src', 'pages', 'docs', 'plugins.astro'),
|
|
16
|
+
'utf8',
|
|
17
|
+
)
|
|
18
|
+
const rendered = [...page.matchAll(/mcpSnippet\('([\w-]+)'\)/g)].map((m) => m[1])
|
|
19
|
+
const withServer = Object.values(PLUGINS).filter((p) => p.mcpServerKey && p.mcpConfig)
|
|
20
|
+
|
|
21
|
+
describe('the plugin guide', () => {
|
|
22
|
+
it('writes no MCP config by hand', () => {
|
|
23
|
+
expect(page.match(/"(?:command|args|url|type)"\s*:/g) ?? []).toEqual([])
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('renders only servers that exist', () => {
|
|
27
|
+
const ids = new Set(withServer.map((p) => p.id))
|
|
28
|
+
expect(rendered.filter((id) => !ids.has(id))).toEqual([])
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it('shows every server a plugin ships', () => {
|
|
32
|
+
const shown = new Set(rendered)
|
|
33
|
+
expect(withServer.map((p) => p.id).filter((id) => !shown.has(id))).toEqual([])
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it('names no package that is not on npm', () => {
|
|
37
|
+
for (const dead of ['@anthropic/figma-mcp', '@anthropic/prisma-mcp', '@mseep/linear-mcp', '>netlify-mcp<']) {
|
|
38
|
+
expect(page).not.toContain(dead)
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
})
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
"hash": "
|
|
2
|
+
"hash": "d8816c8a",
|
|
3
3
|
"configHash": "30f8ea04",
|
|
4
|
-
"lockfileHash": "
|
|
5
|
-
"browserHash": "
|
|
4
|
+
"lockfileHash": "aa5f6b33",
|
|
5
|
+
"browserHash": "acbce511",
|
|
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": "4f9d68ca",
|
|
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": "7e629593",
|
|
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": "26826007",
|
|
23
23
|
"needsInterop": true
|
|
24
24
|
}
|
|
25
25
|
},
|
|
@@ -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
|
|
|
@@ -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
|
|
|
@@ -12,7 +12,7 @@ export const config: PluginConfig = {
|
|
|
12
12
|
mcpConfig: {
|
|
13
13
|
type: 'stdio',
|
|
14
14
|
command: 'npx',
|
|
15
|
-
args: ['-y', 'chrome-devtools-mcp@
|
|
15
|
+
args: ['-y', 'chrome-devtools-mcp@1.10.1'],
|
|
16
16
|
},
|
|
17
17
|
authType: 'none',
|
|
18
18
|
envVars: [],
|
|
@@ -26,4 +26,14 @@ export const config: PluginConfig = {
|
|
|
26
26
|
officialDocs: 'https://developer.chrome.com/docs/devtools',
|
|
27
27
|
mcpPackage: 'chrome-devtools-mcp',
|
|
28
28
|
preselected: true,
|
|
29
|
+
previousMcpConfigs: [
|
|
30
|
+
{
|
|
31
|
+
mcpConfig: {
|
|
32
|
+
type: 'stdio',
|
|
33
|
+
command: 'npx',
|
|
34
|
+
args: ['-y', 'chrome-devtools-mcp@latest'],
|
|
35
|
+
},
|
|
36
|
+
envVars: [],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
29
39
|
};
|
|
@@ -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
|
|
|
@@ -12,7 +12,7 @@ export const config: PluginConfig = {
|
|
|
12
12
|
mcpConfig: {
|
|
13
13
|
type: 'stdio',
|
|
14
14
|
command: 'npx',
|
|
15
|
-
args: ['-y', '@contentful/mcp-server'],
|
|
15
|
+
args: ['-y', '@contentful/mcp-server@1.23.2'],
|
|
16
16
|
},
|
|
17
17
|
authType: 'none',
|
|
18
18
|
envVars: [],
|
|
@@ -46,4 +46,14 @@ export const config: PluginConfig = {
|
|
|
46
46
|
docsUrl: 'https://www.opencastle.dev/docs/plugins#contentful',
|
|
47
47
|
officialDocs: 'https://www.contentful.com/developers/docs/',
|
|
48
48
|
mcpPackage: '@contentful/mcp-server',
|
|
49
|
+
previousMcpConfigs: [
|
|
50
|
+
{
|
|
51
|
+
mcpConfig: {
|
|
52
|
+
type: 'stdio',
|
|
53
|
+
command: 'npx',
|
|
54
|
+
args: ['-y', '@contentful/mcp-server'],
|
|
55
|
+
},
|
|
56
|
+
envVars: [],
|
|
57
|
+
},
|
|
58
|
+
],
|
|
49
59
|
};
|
|
@@ -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
|