opencastle 1.10.0 → 1.11.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 +29 -15
- package/bin/cli.mjs +1 -1
- package/dist/cli/detect.d.ts.map +1 -1
- package/dist/cli/detect.js +106 -2
- package/dist/cli/detect.js.map +1 -1
- package/dist/cli/detect.test.js +76 -0
- package/dist/cli/detect.test.js.map +1 -1
- package/dist/cli/docs-accuracy.test.js +4 -4
- package/dist/cli/docs-accuracy.test.js.map +1 -1
- package/dist/cli/explain.d.ts.map +1 -1
- package/dist/cli/explain.js +7 -0
- package/dist/cli/explain.js.map +1 -1
- package/dist/cli/init-detect.test.js +18 -0
- package/dist/cli/init-detect.test.js.map +1 -1
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +1 -0
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/init.test.js +10 -0
- package/dist/cli/init.test.js.map +1 -1
- package/dist/cli/mcp-upgrade.test.js +40 -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 +6 -2
- package/dist/cli/mcp.js.map +1 -1
- package/dist/cli/stack-config.d.ts.map +1 -1
- package/dist/cli/stack-config.js +14 -1
- package/dist/cli/stack-config.js.map +1 -1
- package/dist/cli/types.d.ts +3 -1
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli/types.js.map +1 -1
- package/dist/cli/update.js +1 -1
- package/dist/cli/update.js.map +1 -1
- package/dist/orchestrator/plugins/github/config.d.ts +3 -0
- package/dist/orchestrator/plugins/github/config.d.ts.map +1 -0
- package/dist/orchestrator/plugins/github/config.js +36 -0
- package/dist/orchestrator/plugins/github/config.js.map +1 -0
- package/dist/orchestrator/plugins/gitlab/config.d.ts +3 -0
- package/dist/orchestrator/plugins/gitlab/config.d.ts.map +1 -0
- package/dist/orchestrator/plugins/gitlab/config.js +26 -0
- package/dist/orchestrator/plugins/gitlab/config.js.map +1 -0
- package/dist/orchestrator/plugins/index.d.ts.map +1 -1
- package/dist/orchestrator/plugins/index.js +4 -0
- package/dist/orchestrator/plugins/index.js.map +1 -1
- package/dist/orchestrator/plugins/types.d.ts +15 -1
- package/dist/orchestrator/plugins/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/cli/detect.test.ts +88 -0
- package/src/cli/detect.ts +100 -3
- package/src/cli/docs-accuracy.test.ts +4 -4
- package/src/cli/explain.ts +6 -0
- package/src/cli/init-detect.test.ts +22 -0
- package/src/cli/init.test.ts +13 -0
- package/src/cli/init.ts +1 -0
- package/src/cli/mcp-upgrade.test.ts +45 -2
- package/src/cli/mcp.ts +10 -4
- package/src/cli/stack-config.ts +18 -1
- package/src/cli/types.ts +3 -1
- package/src/cli/update.ts +1 -1
- package/src/orchestrator/customizations/agents/skill-matrix.json +7 -1
- package/src/orchestrator/plugins/github/config.ts +37 -0
- package/src/orchestrator/plugins/github/mcp.json +9 -0
- package/src/orchestrator/plugins/github/plugin.json +24 -0
- package/src/orchestrator/plugins/github/skills/github-platform/SKILL.md +77 -0
- package/src/orchestrator/plugins/gitlab/config.ts +27 -0
- package/src/orchestrator/plugins/gitlab/mcp.json +9 -0
- package/src/orchestrator/plugins/gitlab/plugin.json +21 -0
- package/src/orchestrator/plugins/gitlab/skills/gitlab-platform/SKILL.md +72 -0
- package/src/orchestrator/plugins/index.ts +4 -0
- package/src/orchestrator/plugins/types.ts +17 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAmC/C,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE7F,2CAA2C;AAC3C,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAkChD,CAAC;AAEF,8BAA8B;AAC9B,eAAO,MAAM,YAAY,gBAExB,CAAC;AAEF,8BAA8B;AAC9B,eAAO,MAAM,YAAY,gBAExB,CAAC;AAEF,oCAAoC;AACpC,eAAO,MAAM,WAAW,gBAEvB,CAAC;AAEF,yCAAyC;AACzC,eAAO,MAAM,UAAU,gBAEtB,CAAC;AAEF,0BAA0B;AAC1B,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAE9D;AAED,qCAAqC;AACrC,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,YAAY,EAAE,CAE9E;AAED,yCAAyC;AACzC,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,YAAY,CAAC,aAAa,CAAC,GACvC,YAAY,EAAE,CAEhB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAIjE;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,EAEF,CAAC"}
|
|
@@ -11,6 +11,8 @@ import { config as linear } from './linear/config.js';
|
|
|
11
11
|
import { config as jira } from './jira/config.js';
|
|
12
12
|
import { config as slack } from './slack/config.js';
|
|
13
13
|
import { config as teams } from './teams/config.js';
|
|
14
|
+
import { config as github } from './github/config.js';
|
|
15
|
+
import { config as gitlab } from './gitlab/config.js';
|
|
14
16
|
import { config as chromeDevtools } from './chrome-devtools/config.js';
|
|
15
17
|
import { config as netlify } from './netlify/config.js';
|
|
16
18
|
import { config as turborepo } from './turborepo/config.js';
|
|
@@ -62,6 +64,8 @@ export const PLUGINS = {
|
|
|
62
64
|
notion,
|
|
63
65
|
slack,
|
|
64
66
|
teams,
|
|
67
|
+
github,
|
|
68
|
+
gitlab,
|
|
65
69
|
};
|
|
66
70
|
/** Tech tool plugins only. */
|
|
67
71
|
export const TECH_PLUGINS = Object.values(PLUGINS).filter((p) => p.category === 'tech');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/orchestrator/plugins/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,MAAM,IAAI,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,MAAM,IAAI,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,M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;AACvE,CAAC;AAED,yCAAyC;AACzC,MAAM,UAAU,uBAAuB,CACrC,WAAwC;IAExC,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,WAAW,CAAC,CAAC;AAC7E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAiB;IACrD,OAAO,OAAO;SACX,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC;SACnC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAa,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;KACnE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;KACvB,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IdeChoice } from '../../cli/types.js';
|
|
1
2
|
/**
|
|
2
3
|
* Configuration for a tool plugin.
|
|
3
4
|
* Single source of truth for tool metadata used by init, adapters, and agents.
|
|
@@ -10,7 +11,7 @@ export interface PluginConfig {
|
|
|
10
11
|
/** Plugin category */
|
|
11
12
|
category: 'tech' | 'team';
|
|
12
13
|
/** Sub-category for grouping */
|
|
13
|
-
subCategory: 'cms' | 'database' | 'deployment' | 'framework' | 'codebase-tool' | 'task-management' | 'knowledge-management' | 'notifications' | 'testing' | 'e2e-testing' | 'design' | 'email' | 'payments' | 'observability';
|
|
14
|
+
subCategory: 'cms' | 'database' | 'deployment' | 'framework' | 'codebase-tool' | 'task-management' | 'knowledge-management' | 'notifications' | 'source-control' | 'testing' | 'e2e-testing' | 'design' | 'email' | 'payments' | 'observability';
|
|
14
15
|
/** Label shown in the `npx opencastle init` multiselect */
|
|
15
16
|
label: string;
|
|
16
17
|
/** Hint shown next to the label in multiselect */
|
|
@@ -38,6 +39,19 @@ export interface PluginConfig {
|
|
|
38
39
|
preselected?: boolean;
|
|
39
40
|
/** VS Code input prompts required by this plugin's MCP config (e.g. tenant ID) */
|
|
40
41
|
mcpInputs?: McpInput[];
|
|
42
|
+
/**
|
|
43
|
+
* For a remote server that only some clients can sign in to with OAuth.
|
|
44
|
+
*
|
|
45
|
+
* GitHub's completes OAuth in VS Code and in no other target: Claude Code,
|
|
46
|
+
* Cursor, Windsurf, OpenCode and Codex must send a personal access token. The
|
|
47
|
+
* targets in `oauthTargets` get `mcpConfig` alone and need no token; every
|
|
48
|
+
* other target also sends `headers`, each value a `${NAME}` reference to one
|
|
49
|
+
* of `envVars`, written in that target's own spelling.
|
|
50
|
+
*/
|
|
51
|
+
tokenAuth?: {
|
|
52
|
+
oauthTargets: IdeChoice[];
|
|
53
|
+
headers: Record<string, string>;
|
|
54
|
+
};
|
|
41
55
|
/**
|
|
42
56
|
* What earlier releases generated for this server, newest first.
|
|
43
57
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/plugins/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,wDAAwD;IACxD,EAAE,EAAE,MAAM,CAAC;IAEX,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IAEb,sBAAsB;IACtB,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAE1B,gCAAgC;IAChC,WAAW,EAAE,KAAK,GAAG,UAAU,GAAG,YAAY,GAAG,WAAW,GAAG,eAAe,GAAG,iBAAiB,GAAG,sBAAsB,GAAG,eAAe,GAAG,SAAS,GAAG,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,eAAe,CAAC;
|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,kFAAkF;IAClF,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IAEvB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE;QACV,YAAY,EAAE,SAAS,EAAE,CAAC;QAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACjC,CAAC;IAEF;;;;;;;;;OASG;IACH,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAC1C;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,eAAe,CAAC;IAC3B;;;;OAIG;IACH,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,cAAc,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;CACd"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencastle",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "Your team's AI setup and memory, in every teammate's assistant: shared instructions, skills, agents, MCP servers and lessons, reviewed in pull requests and extended across repositories, for Claude Code, Copilot, Cursor, Windsurf, OpenCode, Codex and Antigravity.",
|
|
6
6
|
"bin": {
|
|
7
7
|
"opencastle": "bin/cli.mjs"
|
|
8
8
|
},
|
package/src/cli/detect.test.ts
CHANGED
|
@@ -326,6 +326,94 @@ describe('detectRepoInfo — Python and Go', () => {
|
|
|
326
326
|
})
|
|
327
327
|
})
|
|
328
328
|
|
|
329
|
+
describe('detectRepoInfo — code hosts', () => {
|
|
330
|
+
let dir: string
|
|
331
|
+
beforeEach(async () => { dir = await mkdtemp(join(tmpdir(), 'opencastle-host-')) })
|
|
332
|
+
afterEach(async () => { await rm(dir, { recursive: true, force: true }) })
|
|
333
|
+
|
|
334
|
+
const gitConfig = async (gitDir: string, body: string): Promise<void> => {
|
|
335
|
+
await mkdir(gitDir, { recursive: true })
|
|
336
|
+
await writeFile(join(gitDir, 'config'), `[core]\n\tbare = false\n${body}`)
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
it('reads GitHub from an https remote, and a self-managed GitLab from an scp-style one', async () => {
|
|
340
|
+
await gitConfig(join(dir, '.git'), '[remote "origin"]\n\turl = https://github.com/acme/web.git\n')
|
|
341
|
+
expect((await detectRepoInfo(dir)).codeHosts).toEqual(['github'])
|
|
342
|
+
await gitConfig(join(dir, '.git'), '[remote "origin"]\n\turl = git@gitlab.acme.example:web/app.git\n')
|
|
343
|
+
expect((await detectRepoInfo(dir)).codeHosts).toEqual(['gitlab'])
|
|
344
|
+
})
|
|
345
|
+
|
|
346
|
+
it('ignores a submodule hosted elsewhere', async () => {
|
|
347
|
+
await gitConfig(join(dir, '.git'), [
|
|
348
|
+
'[remote "origin"]', '\turl = https://gitlab.com/acme/web.git',
|
|
349
|
+
'[submodule "vendor/lib"]', '\turl = https://github.com/someone/lib.git', '',
|
|
350
|
+
].join('\n'))
|
|
351
|
+
expect((await detectRepoInfo(dir)).codeHosts).toEqual(['gitlab'])
|
|
352
|
+
})
|
|
353
|
+
|
|
354
|
+
it('follows a worktree to the main repository’s remotes', async () => {
|
|
355
|
+
const main = join(dir, 'main', '.git')
|
|
356
|
+
await gitConfig(main, '[remote "origin"]\n\turl = ssh://git@github.com/acme/web.git\n')
|
|
357
|
+
await mkdir(join(main, 'worktrees', 'feature'), { recursive: true })
|
|
358
|
+
await writeFile(join(main, 'worktrees', 'feature', 'commondir'), '../..\n')
|
|
359
|
+
await mkdir(join(dir, 'feature'))
|
|
360
|
+
await writeFile(join(dir, 'feature', '.git'), `gitdir: ${join(main, 'worktrees', 'feature')}\n`)
|
|
361
|
+
expect((await detectRepoInfo(join(dir, 'feature'))).codeHosts).toEqual(['github'])
|
|
362
|
+
})
|
|
363
|
+
|
|
364
|
+
it('reads the remote of the repository a monorepo package sits in', async () => {
|
|
365
|
+
await gitConfig(join(dir, '.git'), '[remote "origin"]\n\turl = https://gitlab.com/acme/platform.git\n')
|
|
366
|
+
await mkdir(join(dir, 'apps', 'web'), { recursive: true })
|
|
367
|
+
expect((await detectRepoInfo(join(dir, 'apps', 'web'))).codeHosts).toEqual(['gitlab'])
|
|
368
|
+
})
|
|
369
|
+
|
|
370
|
+
it('falls back to files only a code host reads, without a remote', async () => {
|
|
371
|
+
await writeFile(join(dir, '.gitlab-ci.yml'), 'test:\n script: npm test\n')
|
|
372
|
+
const info = await detectRepoInfo(dir)
|
|
373
|
+
expect(info.codeHosts).toEqual(['gitlab'])
|
|
374
|
+
expect(buildDetectedToolsSet(info).has('gitlab')).toBe(true)
|
|
375
|
+
|
|
376
|
+
await rm(join(dir, '.gitlab-ci.yml'))
|
|
377
|
+
await mkdir(join(dir, '.github'))
|
|
378
|
+
await writeFile(join(dir, '.github', 'dependabot.yml'), 'version: 2\n')
|
|
379
|
+
expect((await detectRepoInfo(dir)).codeHosts).toEqual(['github'])
|
|
380
|
+
})
|
|
381
|
+
|
|
382
|
+
it('does not read VS Code’s Copilot files as GitHub', async () => {
|
|
383
|
+
// This tool writes them for every VS Code target, wherever the code is hosted.
|
|
384
|
+
await mkdir(join(dir, '.github', 'agents'), { recursive: true })
|
|
385
|
+
await mkdir(join(dir, '.github', 'prompts'))
|
|
386
|
+
await writeFile(join(dir, '.github', 'copilot-instructions.md'), '# Copilot\n')
|
|
387
|
+
await writeFile(join(dir, '.github', 'agents', 'developer.agent.md'), '---\n---\n')
|
|
388
|
+
expect((await detectRepoInfo(dir)).codeHosts).toBeUndefined()
|
|
389
|
+
})
|
|
390
|
+
|
|
391
|
+
it.each([
|
|
392
|
+
['github:acme/web', 'github'],
|
|
393
|
+
['acme/web', 'github'],
|
|
394
|
+
['gitlab:acme/web', 'gitlab'],
|
|
395
|
+
[{ type: 'git', url: 'git+https://gitlab.com/acme/web.git' }, 'gitlab'],
|
|
396
|
+
[{ type: 'git', url: 'git+ssh://git@github.com/acme/web.git' }, 'github'],
|
|
397
|
+
])('reads %j in package.json as %s', async (repository, host) => {
|
|
398
|
+
await writeFile(join(dir, 'package.json'), JSON.stringify({ name: 'web', repository }))
|
|
399
|
+
expect((await detectRepoInfo(dir)).codeHosts).toEqual([host])
|
|
400
|
+
})
|
|
401
|
+
|
|
402
|
+
it('reads a Go module path, and an SDK for one host', async () => {
|
|
403
|
+
await writeFile(join(dir, 'go.mod'), 'module gitlab.com/acme/svc\n\ngo 1.22\n')
|
|
404
|
+
expect((await detectRepoInfo(dir)).codeHosts).toEqual(['gitlab'])
|
|
405
|
+
await rm(join(dir, 'go.mod'))
|
|
406
|
+
await writeFile(join(dir, 'package.json'), JSON.stringify({ name: 'bot', dependencies: { '@octokit/rest': '^21.0.0' } }))
|
|
407
|
+
expect((await detectRepoInfo(dir)).codeHosts).toEqual(['github'])
|
|
408
|
+
})
|
|
409
|
+
|
|
410
|
+
it('finds no host for a repository without a remote', async () => {
|
|
411
|
+
await gitConfig(join(dir, '.git'), '')
|
|
412
|
+
await writeFile(join(dir, 'package.json'), JSON.stringify({ name: 'web', repository: 'bitbucket:acme/web' }))
|
|
413
|
+
expect((await detectRepoInfo(dir)).codeHosts).toBeUndefined()
|
|
414
|
+
})
|
|
415
|
+
})
|
|
416
|
+
|
|
329
417
|
describe('buildDetectedToolsSet', () => {
|
|
330
418
|
it('maps detection labels to plugin IDs', () => {
|
|
331
419
|
const set = buildDetectedToolsSet({
|
package/src/cli/detect.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolve } from 'node:path';
|
|
1
|
+
import { dirname, resolve } from 'node:path';
|
|
2
2
|
import { readFile, readdir, access } from 'node:fs/promises';
|
|
3
3
|
import { existsSync } from 'node:fs';
|
|
4
4
|
import type { IdeChoice, RepoInfo, StackConfig } from './types.js';
|
|
@@ -178,6 +178,18 @@ const CICD: DetectionRule[] = [
|
|
|
178
178
|
{ label: 'travis', files: ['.travis.yml'] },
|
|
179
179
|
];
|
|
180
180
|
|
|
181
|
+
// Files only a code host reads. Not `.github/` as a whole: VS Code's Copilot
|
|
182
|
+
// files live there too — `copilot-instructions.md`, `agents/`, `prompts/` —
|
|
183
|
+
// and this tool writes them for every VS Code target, hosted anywhere.
|
|
184
|
+
const CODE_HOSTS: DetectionRule[] = [
|
|
185
|
+
{
|
|
186
|
+
label: 'github',
|
|
187
|
+
files: ['.github/dependabot.yml', '.github/dependabot.yaml', '.github/CODEOWNERS', '.github/pull_request_template.md', '.github/PULL_REQUEST_TEMPLATE.md', '.github/FUNDING.yml'],
|
|
188
|
+
dirs: ['.github/workflows/', '.github/ISSUE_TEMPLATE/', '.github/PULL_REQUEST_TEMPLATE/'],
|
|
189
|
+
},
|
|
190
|
+
{ label: 'gitlab', files: ['.gitlab-ci.yml'], dirs: ['.gitlab/'] },
|
|
191
|
+
];
|
|
192
|
+
|
|
181
193
|
const STYLING: DetectionRule[] = [
|
|
182
194
|
{ label: 'tailwind', files: ['tailwind.config.js', 'tailwind.config.ts', 'tailwind.config.mjs'] },
|
|
183
195
|
{ label: 'sass', files: [] }, // detected via package.json
|
|
@@ -249,6 +261,14 @@ export const PACKAGE_DETECTIONS: Record<string, { category: string; label: strin
|
|
|
249
261
|
'@linear/sdk': { category: 'pm', label: 'linear' },
|
|
250
262
|
'@slack/web-api': { category: 'notifications', label: 'slack' },
|
|
251
263
|
'@slack/bolt': { category: 'notifications', label: 'slack' },
|
|
264
|
+
// Code hosts (their APIs, and GitHub Actions written in this repository)
|
|
265
|
+
'octokit': { category: 'codeHosts', label: 'github' },
|
|
266
|
+
'@octokit/rest': { category: 'codeHosts', label: 'github' },
|
|
267
|
+
'@octokit/core': { category: 'codeHosts', label: 'github' },
|
|
268
|
+
'@actions/core': { category: 'codeHosts', label: 'github' },
|
|
269
|
+
'@actions/github': { category: 'codeHosts', label: 'github' },
|
|
270
|
+
'@gitbeaker/rest': { category: 'codeHosts', label: 'gitlab' },
|
|
271
|
+
'@gitbeaker/core': { category: 'codeHosts', label: 'gitlab' },
|
|
252
272
|
};
|
|
253
273
|
|
|
254
274
|
// ── Helpers ───────────────────────────────────────────────────
|
|
@@ -294,6 +314,7 @@ interface RepoInfoInternal {
|
|
|
294
314
|
services: string[];
|
|
295
315
|
pm: string[];
|
|
296
316
|
notifications: string[];
|
|
317
|
+
codeHosts: string[];
|
|
297
318
|
mcpConfig?: boolean;
|
|
298
319
|
configFiles: string[];
|
|
299
320
|
}
|
|
@@ -316,6 +337,7 @@ export async function detectRepoInfo(projectRoot: string): Promise<RepoInfo> {
|
|
|
316
337
|
services: [],
|
|
317
338
|
pm: [],
|
|
318
339
|
notifications: [],
|
|
340
|
+
codeHosts: [],
|
|
319
341
|
configFiles: [],
|
|
320
342
|
};
|
|
321
343
|
|
|
@@ -350,8 +372,12 @@ export async function detectRepoInfo(projectRoot: string): Promise<RepoInfo> {
|
|
|
350
372
|
detectCategory(projectRoot, STYLING, info, 'styling'),
|
|
351
373
|
detectCategory(projectRoot, AUTH, info, 'auth'),
|
|
352
374
|
detectCategory(projectRoot, SERVICES, info, 'services'),
|
|
375
|
+
detectCategory(projectRoot, CODE_HOSTS, info, 'codeHosts'),
|
|
353
376
|
]);
|
|
354
377
|
|
|
378
|
+
// ── 3b. Detect the code host from git remotes ───────────────
|
|
379
|
+
await detectCodeHosts(projectRoot, info);
|
|
380
|
+
|
|
355
381
|
// ── 4. Detect from package.json deps ────────────────────────
|
|
356
382
|
await detectFromPackageJson(projectRoot, info);
|
|
357
383
|
|
|
@@ -411,7 +437,7 @@ export async function detectRepoInfo(projectRoot: string): Promise<RepoInfo> {
|
|
|
411
437
|
info.configFiles = [...new Set(info.configFiles)];
|
|
412
438
|
|
|
413
439
|
// Sort arrays for stable output
|
|
414
|
-
for (const key of ['frameworks', 'databases', 'cms', 'deployment', 'testing', 'cicd', 'styling', 'auth', 'services', 'pm', 'notifications', 'configFiles'] as const) {
|
|
440
|
+
for (const key of ['frameworks', 'databases', 'cms', 'deployment', 'testing', 'cicd', 'styling', 'auth', 'services', 'pm', 'notifications', 'codeHosts', 'configFiles'] as const) {
|
|
415
441
|
info[key].sort();
|
|
416
442
|
}
|
|
417
443
|
|
|
@@ -445,6 +471,72 @@ async function detectPythonOrGo(root: string, info: RepoInfoInternal): Promise<v
|
|
|
445
471
|
for (const [re, label] of PYTHON_FRAMEWORKS) if (re.test(text)) addUnique(info.frameworks, label)
|
|
446
472
|
}
|
|
447
473
|
|
|
474
|
+
/**
|
|
475
|
+
* Where the repository is hosted, from what names the host outright: its git
|
|
476
|
+
* remotes, the `repository` in package.json, and a Go module path. The file
|
|
477
|
+
* rules in CODE_HOSTS cover a checkout with no remote.
|
|
478
|
+
*
|
|
479
|
+
* A self-managed GitLab is recognised by `gitlab` in its host name, the usual
|
|
480
|
+
* convention; one under another name is added with `opencastle add gitlab`.
|
|
481
|
+
*/
|
|
482
|
+
async function detectCodeHosts(root: string, info: RepoInfoInternal): Promise<void> {
|
|
483
|
+
const urls: string[] = []
|
|
484
|
+
// Remotes only: a submodule's `url` names where a dependency lives.
|
|
485
|
+
let remote = false
|
|
486
|
+
for (const line of (await readGitConfig(root)).split('\n')) {
|
|
487
|
+
if (/^\s*\[/.test(line)) remote = /^\s*\[remote\s/.test(line)
|
|
488
|
+
const url = remote ? /^\s*url\s*=\s*(\S+)/.exec(line)?.[1] : undefined
|
|
489
|
+
if (url) urls.push(url)
|
|
490
|
+
}
|
|
491
|
+
try {
|
|
492
|
+
const repository = (JSON.parse(await readFile(resolve(root, 'package.json'), 'utf8')) as { repository?: string | { url?: string } }).repository
|
|
493
|
+
const url = typeof repository === 'string' ? repository : repository?.url
|
|
494
|
+
// npm's shorthands: `github:user/repo`, `gitlab:user/repo`, and a bare `user/repo` for GitHub.
|
|
495
|
+
if (url) urls.push(/^[\w.-]+\/[\w.-]+$/.test(url) ? 'github.com/' + url : url.replace(/^(github|gitlab):/, '$1.com/'))
|
|
496
|
+
} catch {
|
|
497
|
+
// No package.json, or not JSON — the other signals still count.
|
|
498
|
+
}
|
|
499
|
+
const goModule = /^module\s+(\S+)/m.exec(await readFile(resolve(root, 'go.mod'), 'utf8').catch(() => ''))?.[1]
|
|
500
|
+
if (goModule) urls.push(goModule)
|
|
501
|
+
for (const url of urls) {
|
|
502
|
+
const host = codeHostOf(url)
|
|
503
|
+
if (host) addUnique(info.codeHosts, host)
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/** `github` or `gitlab` for a URL, scp-style address or module path on one of them. */
|
|
508
|
+
function codeHostOf(url: string): string | null {
|
|
509
|
+
// https://host/…, ssh://git@host/…, git@host:path and host/path.
|
|
510
|
+
const host = /^(?:[a-z][a-z0-9+.-]*:\/\/)?(?:[^@/]+@)?([^:/]+)/i.exec(url)?.[1].toLowerCase() ?? ''
|
|
511
|
+
if (host === 'github.com' || host === 'ssh.github.com') return 'github'
|
|
512
|
+
if (/(^|[.-])gitlab([.-]|$)/.test(host)) return 'gitlab'
|
|
513
|
+
return null
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* The git config of the repository the project is in, following `.git` up
|
|
518
|
+
* through parent directories, as git does — a package in a monorepo has no
|
|
519
|
+
* `.git` of its own — and through a `.git` file, which is a worktree or a
|
|
520
|
+
* submodule.
|
|
521
|
+
*/
|
|
522
|
+
async function readGitConfig(root: string): Promise<string> {
|
|
523
|
+
let dir = resolve(root)
|
|
524
|
+
while (!(await fileExists(resolve(dir, '.git')))) {
|
|
525
|
+
const parent = dirname(dir)
|
|
526
|
+
if (parent === dir) return ''
|
|
527
|
+
dir = parent
|
|
528
|
+
}
|
|
529
|
+
let gitDir = resolve(dir, '.git')
|
|
530
|
+
const pointer = /^gitdir:\s*(.+)$/m.exec(await readFile(gitDir, 'utf8').catch(() => ''))
|
|
531
|
+
if (pointer) {
|
|
532
|
+
gitDir = resolve(dir, pointer[1].trim())
|
|
533
|
+
// A worktree keeps its remotes in the main repository's config.
|
|
534
|
+
const common = (await readFile(resolve(gitDir, 'commondir'), 'utf8').catch(() => '')).trim()
|
|
535
|
+
if (common) gitDir = resolve(gitDir, common)
|
|
536
|
+
}
|
|
537
|
+
return readFile(resolve(gitDir, 'config'), 'utf8').catch(() => '')
|
|
538
|
+
}
|
|
539
|
+
|
|
448
540
|
async function checkFiles(root: string, files: string[]): Promise<string[]> {
|
|
449
541
|
const found: string[] = [];
|
|
450
542
|
for (const f of files) {
|
|
@@ -455,7 +547,7 @@ async function checkFiles(root: string, files: string[]): Promise<string[]> {
|
|
|
455
547
|
return found;
|
|
456
548
|
}
|
|
457
549
|
|
|
458
|
-
type CategoryKey = 'frameworks' | 'databases' | 'cms' | 'deployment' | 'testing' | 'cicd' | 'styling' | 'auth' | 'services' | 'pm' | 'notifications';
|
|
550
|
+
type CategoryKey = 'frameworks' | 'databases' | 'cms' | 'deployment' | 'testing' | 'cicd' | 'styling' | 'auth' | 'services' | 'pm' | 'notifications' | 'codeHosts';
|
|
459
551
|
|
|
460
552
|
async function detectCategory(
|
|
461
553
|
root: string,
|
|
@@ -695,6 +787,7 @@ export function buildDetectedToolsSet(repoInfo: RepoInfo): Set<string> {
|
|
|
695
787
|
...(repoInfo.services ?? []),
|
|
696
788
|
...(repoInfo.pm ?? []),
|
|
697
789
|
...(repoInfo.notifications ?? []),
|
|
790
|
+
...(repoInfo.codeHosts ?? []),
|
|
698
791
|
]);
|
|
699
792
|
}
|
|
700
793
|
|
|
@@ -719,6 +812,7 @@ function cleanEmpty(info: RepoInfoInternal): RepoInfo {
|
|
|
719
812
|
if (info.services.length > 0) result.services = info.services;
|
|
720
813
|
if (info.pm.length > 0) result.pm = info.pm;
|
|
721
814
|
if (info.notifications.length > 0) result.notifications = info.notifications;
|
|
815
|
+
if (info.codeHosts.length > 0) result.codeHosts = info.codeHosts;
|
|
722
816
|
if (info.configFiles.length > 0) result.configFiles = info.configFiles;
|
|
723
817
|
|
|
724
818
|
return result;
|
|
@@ -751,6 +845,8 @@ export function mergeStackIntoRepoInfo(info: RepoInfo, stack: StackConfig): Repo
|
|
|
751
845
|
merged.pm = addUniqueToArray(merged.pm, tool);
|
|
752
846
|
} else if (['slack', 'teams'].includes(tool)) {
|
|
753
847
|
merged.notifications = addUniqueToArray(merged.notifications, tool);
|
|
848
|
+
} else if (['github', 'gitlab'].includes(tool)) {
|
|
849
|
+
merged.codeHosts = addUniqueToArray(merged.codeHosts, tool);
|
|
754
850
|
}
|
|
755
851
|
}
|
|
756
852
|
|
|
@@ -790,6 +886,7 @@ export function formatRepoInfo(info: RepoInfo): string {
|
|
|
790
886
|
if (info.services?.length) lines.push(`Services: ${info.services.join(', ')}`);
|
|
791
887
|
if (info.pm?.length) lines.push(`Project management: ${info.pm.join(', ')}`);
|
|
792
888
|
if (info.notifications?.length) lines.push(`Notifications: ${info.notifications.join(', ')}`);
|
|
889
|
+
if (info.codeHosts?.length) lines.push(`Code hosting: ${info.codeHosts.join(', ')}`);
|
|
793
890
|
if (info.deployment?.length) lines.push(`Deployment: ${info.deployment.join(', ')}`);
|
|
794
891
|
if (info.testing?.length) lines.push(`Testing: ${info.testing.join(', ')}`);
|
|
795
892
|
if (info.cicd?.length) lines.push(`CI/CD: ${info.cicd.join(', ')}`);
|
|
@@ -473,12 +473,12 @@ describe('website matches the shipped CLI', () => {
|
|
|
473
473
|
})
|
|
474
474
|
})
|
|
475
475
|
|
|
476
|
-
describe('the pitch leads with
|
|
476
|
+
describe('the pitch leads with shared memory', () => {
|
|
477
477
|
it('says what the tool does before listing what is inside', () => {
|
|
478
|
-
const
|
|
478
|
+
const does = readme.search(/OpenCastle makes it the team's/i)
|
|
479
479
|
const inside = readme.indexOf('## What gets compiled')
|
|
480
|
-
expect(
|
|
481
|
-
expect(
|
|
480
|
+
expect(does).toBeGreaterThan(-1)
|
|
481
|
+
expect(does).toBeLessThan(inside)
|
|
482
482
|
})
|
|
483
483
|
|
|
484
484
|
it('marks the convoy engine experimental wherever it is introduced', () => {
|
package/src/cli/explain.ts
CHANGED
|
@@ -91,8 +91,14 @@ async function build(pkgRoot: string, projectRoot: string): Promise<ExplainRepor
|
|
|
91
91
|
})
|
|
92
92
|
}
|
|
93
93
|
for (const [key, s] of Object.entries(lock.mcp)) {
|
|
94
|
+
// A server that takes a token elsewhere signs in with OAuth in some targets.
|
|
95
|
+
const plugin = s.from.startsWith('plugin:') ? PLUGINS[s.from.slice(7)] : undefined
|
|
96
|
+
const oauthIn = (plugin?.tokenAuth?.oauthTargets ?? []).filter((t) => ides.includes(t))
|
|
94
97
|
if (s.auth === 'oauth') {
|
|
95
98
|
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' })
|
|
99
|
+
} else if (oauthIn.length > 0) {
|
|
100
|
+
const where = oauthIn.map((t) => IDE_LABELS[t]).join(', ')
|
|
101
|
+
setup.push({ server: key, need: 'sign-in', ok: true, how: `${where} opens a browser to sign in the first time it starts the server` })
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
104
|
// Codex loads a project's `.codex/config.toml` only once the user has
|
|
@@ -144,6 +144,28 @@ describe('detected selection', () => {
|
|
|
144
144
|
expect(selection.teamTools).toEqual([])
|
|
145
145
|
expect(selection.techTools.length).toBeGreaterThan(0)
|
|
146
146
|
})
|
|
147
|
+
|
|
148
|
+
it.each([
|
|
149
|
+
['github', 'https://github.com/acme/web.git'],
|
|
150
|
+
['gitlab', 'git@gitlab.com:acme/web.git'],
|
|
151
|
+
])('selects %s when the repository is hosted there', async (host, url) => {
|
|
152
|
+
mkdirSync(join(dir, '.git'))
|
|
153
|
+
writeFileSync(join(dir, '.git', 'config'), `[remote "origin"]\n\turl = ${url}\n`)
|
|
154
|
+
writeFileSync(join(dir, 'package.json'), JSON.stringify({ name: 'x' }))
|
|
155
|
+
|
|
156
|
+
const selection = detectSelection(dir, await detectRepoInfo(dir))
|
|
157
|
+
|
|
158
|
+
expect(selection.teamTools).toEqual([host])
|
|
159
|
+
expect(selection.techTools).not.toContain(host)
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
it('selects neither code host for a repository with no sign of one', async () => {
|
|
163
|
+
mkdirSync(join(dir, '.git'))
|
|
164
|
+
writeFileSync(join(dir, '.git', 'config'), '[core]\n\tbare = false\n')
|
|
165
|
+
const selection = detectSelection(dir, await detectRepoInfo(dir))
|
|
166
|
+
expect(selection.teamTools).not.toContain('github')
|
|
167
|
+
expect(selection.teamTools).not.toContain('gitlab')
|
|
168
|
+
})
|
|
147
169
|
})
|
|
148
170
|
|
|
149
171
|
/**
|
package/src/cli/init.test.ts
CHANGED
|
@@ -219,6 +219,19 @@ describe('stack-config: getRequiredMcpEnvVars', () => {
|
|
|
219
219
|
])
|
|
220
220
|
)
|
|
221
221
|
})
|
|
222
|
+
|
|
223
|
+
it('asks for the GitHub token only when a target cannot sign in with OAuth', () => {
|
|
224
|
+
// GitHub's server completes OAuth in VS Code alone; the rest send the token.
|
|
225
|
+
const github = (ides: StackConfig['ides']) =>
|
|
226
|
+
getRequiredMcpEnvVars({ ides, techTools: [], teamTools: ['github'] }).map((v) => v.envVar)
|
|
227
|
+
expect(github(['vscode'])).toEqual([])
|
|
228
|
+
expect(github(['vscode', 'claude-code'])).toEqual(['GITHUB_PERSONAL_ACCESS_TOKEN'])
|
|
229
|
+
expect(github(['cursor'])).toEqual(['GITHUB_PERSONAL_ACCESS_TOKEN'])
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
it('asks for no GitLab token — GitLab’s server signs in with OAuth', () => {
|
|
233
|
+
expect(getRequiredMcpEnvVars({ ides: ['claude-code'], techTools: [], teamTools: ['gitlab'] })).toEqual([])
|
|
234
|
+
})
|
|
222
235
|
})
|
|
223
236
|
|
|
224
237
|
describe('stack-config: getAgentToolInjections', () => {
|
package/src/cli/init.ts
CHANGED
|
@@ -51,6 +51,7 @@ const CATEGORY_STEPS: Array<{ title: string; subCategories: string[]; target: 't
|
|
|
51
51
|
{ title: 'Build Tools', subCategories: ['codebase-tool'], target: 'tech' },
|
|
52
52
|
{ title: 'More Tools', subCategories: ['design', 'email', 'payments', 'observability', 'knowledge-management'], target: 'tech' },
|
|
53
53
|
{ title: 'Project Management', subCategories: ['task-management'], target: 'team' },
|
|
54
|
+
{ title: 'Code Hosting', subCategories: ['source-control'], target: 'team' },
|
|
54
55
|
{ title: 'Notifications', subCategories: ['notifications'], target: 'team' },
|
|
55
56
|
]
|
|
56
57
|
|
|
@@ -11,9 +11,10 @@ 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, teamEntryFor } from './mcp.js'
|
|
14
|
+
import { upgradeGeneratedServers, rebuildMcpConfig, scaffoldMcpConfig, teamEntryFor, getMcpConfigRelPath, containerKeyFor } from './mcp.js'
|
|
15
15
|
import { auditMcpConfig } from './mcp-audit.js'
|
|
16
|
-
import
|
|
16
|
+
import { parseMcpConfigText } from './mcp-file.js'
|
|
17
|
+
import type { IdeChoice, StackConfig } from './types.js'
|
|
17
18
|
|
|
18
19
|
describe('upgradeGeneratedServers', () => {
|
|
19
20
|
it('adds the type Claude Code needs to a remote server we wrote without it', () => {
|
|
@@ -158,3 +159,45 @@ describe('rebuildMcpConfig on an install from before the fix', () => {
|
|
|
158
159
|
}
|
|
159
160
|
})
|
|
160
161
|
})
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* GitHub's server completes OAuth in VS Code and nowhere else. VS Code gets the
|
|
165
|
+
* bare URL; every other target sends the token, in its own spelling of "this
|
|
166
|
+
* environment variable" — a `${NAME}` Cursor or OpenCode does not expand would
|
|
167
|
+
* reach GitHub as those characters.
|
|
168
|
+
*/
|
|
169
|
+
describe('a remote server only some targets sign in to with OAuth', () => {
|
|
170
|
+
let root: string
|
|
171
|
+
beforeEach(() => {
|
|
172
|
+
root = realpathSync(mkdtempSync(join(tmpdir(), 'mcp-token-auth-')))
|
|
173
|
+
})
|
|
174
|
+
afterEach(() => {
|
|
175
|
+
rmSync(root, { recursive: true, force: true })
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
const url = 'https://api.githubcopilot.com/mcp/'
|
|
179
|
+
const written = async (ide: IdeChoice): Promise<unknown> => {
|
|
180
|
+
const rel = getMcpConfigRelPath(ide)
|
|
181
|
+
await scaffoldMcpConfig(root, rel, { ides: [ide], techTools: [], teamTools: ['github'] }, undefined, ide)
|
|
182
|
+
const config = parseMcpConfigText(readFileSync(join(root, rel), 'utf8'), rel)
|
|
183
|
+
return (config[containerKeyFor(ide)] as Record<string, unknown>).GitHub
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
it.each([
|
|
187
|
+
['vscode', { type: 'http', url }],
|
|
188
|
+
['claude-code', { type: 'http', url, headers: { Authorization: 'Bearer ${GITHUB_PERSONAL_ACCESS_TOKEN}' } }],
|
|
189
|
+
['cursor', { url, headers: { Authorization: 'Bearer ${env:GITHUB_PERSONAL_ACCESS_TOKEN}' } }],
|
|
190
|
+
['windsurf', { url, headers: { Authorization: 'Bearer ${env:GITHUB_PERSONAL_ACCESS_TOKEN}' } }],
|
|
191
|
+
['opencode', { type: 'remote', url, headers: { Authorization: 'Bearer {env:GITHUB_PERSONAL_ACCESS_TOKEN}' } }],
|
|
192
|
+
['codex', { url, bearer_token_env_var: 'GITHUB_PERSONAL_ACCESS_TOKEN' }],
|
|
193
|
+
] as const)('%s', async (ide, entry) => {
|
|
194
|
+
expect(await written(ide)).toEqual(entry)
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
it('writes nothing the audit objects to, and nothing a rebuild changes', async () => {
|
|
198
|
+
const entry = await written('claude-code')
|
|
199
|
+
expect(auditMcpConfig({ mcpServers: { GitHub: entry } }, 'claude-code').findings).toEqual([])
|
|
200
|
+
const stack: StackConfig = { ides: ['claude-code'], techTools: [], teamTools: ['github'] }
|
|
201
|
+
expect(await rebuildMcpConfig(root, 'claude-code', stack)).toEqual({ upgraded: [], removed: [], teamWritten: [], teamRemoved: [] })
|
|
202
|
+
})
|
|
203
|
+
})
|
package/src/cli/mcp.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { existsSync } from 'node:fs';
|
|
|
4
4
|
import { getIncludedMcpServers } from './stack-config.js';
|
|
5
5
|
import { PLUGINS } from '../orchestrator/plugins/index.js';
|
|
6
6
|
import { UnreadableConfigError } from './types.js';
|
|
7
|
-
import type { McpInput, McpServerConfig, EnvVarRequirement } from '../orchestrator/plugins/types.js';
|
|
7
|
+
import type { McpInput, McpServerConfig, EnvVarRequirement, PluginConfig } from '../orchestrator/plugins/types.js';
|
|
8
8
|
import type { ScaffoldResult, StackConfig, RepoInfo, IdeChoice, CopyResults } from './types.js';
|
|
9
9
|
import type { TeamMcpPlan } from './layers.js';
|
|
10
10
|
import { EDITOR_VARIABLES, type TeamMcpServer } from './team-config.js';
|
|
@@ -219,14 +219,20 @@ function transformMcpForIde(
|
|
|
219
219
|
|
|
220
220
|
/**
|
|
221
221
|
* One plugin's server as the VS Code–format config, with the env vars other
|
|
222
|
-
* targets need spelled out — they have no `envFile
|
|
222
|
+
* targets need spelled out — they have no `envFile` — and, for a server only
|
|
223
|
+
* some targets can sign in to with OAuth, the token header the others send.
|
|
223
224
|
*/
|
|
224
225
|
function serverFor(
|
|
225
|
-
plugin: { mcpConfig?: McpServerConfig; envVars: EnvVarRequirement[] },
|
|
226
|
+
plugin: { mcpConfig?: McpServerConfig; envVars: EnvVarRequirement[]; tokenAuth?: PluginConfig['tokenAuth'] },
|
|
226
227
|
ide: IdeChoice,
|
|
227
228
|
legacyEnv = false,
|
|
228
229
|
): VsCodeServer {
|
|
229
230
|
const serverConfig = { ...plugin.mcpConfig! } as VsCodeServer;
|
|
231
|
+
if (plugin.tokenAuth && !plugin.tokenAuth.oauthTargets.includes(ide)) {
|
|
232
|
+
serverConfig.headers = Object.fromEntries(
|
|
233
|
+
Object.entries(plugin.tokenAuth.headers).map(([k, v]) => [k, legacyEnv ? v : rewriteRefs(v, ide)]),
|
|
234
|
+
);
|
|
235
|
+
}
|
|
230
236
|
if (ide !== 'vscode' && plugin.envVars.length > 0) {
|
|
231
237
|
const envBlock: Record<string, string> = { ...(serverConfig.env ?? {}) };
|
|
232
238
|
for (const ev of plugin.envVars) {
|
|
@@ -435,7 +441,7 @@ export function upgradeGeneratedServers(
|
|
|
435
441
|
// shape and the env-variable spelling of the time.
|
|
436
442
|
const earlier: unknown[] = [];
|
|
437
443
|
const configs = [
|
|
438
|
-
{ mcpConfig: plugin.mcpConfig, envVars: plugin.envVars },
|
|
444
|
+
{ mcpConfig: plugin.mcpConfig, envVars: plugin.envVars, tokenAuth: plugin.tokenAuth },
|
|
439
445
|
...(plugin.previousMcpConfigs ?? []).map((p) => ({ mcpConfig: p.mcpConfig, envVars: p.envVars })),
|
|
440
446
|
];
|
|
441
447
|
for (const cfg of configs) {
|
package/src/cli/stack-config.ts
CHANGED
|
@@ -233,7 +233,23 @@ export function getIncludedMcpServers(stack: StackConfig, repoInfo?: RepoInfo):
|
|
|
233
233
|
*/
|
|
234
234
|
export function getRequiredMcpEnvVars(stack: StackConfig, repoInfo?: RepoInfo): McpEnvRequirement[] {
|
|
235
235
|
const included = getIncludedMcpServers(stack, repoInfo);
|
|
236
|
-
return MCP_ENV_REQUIREMENTS.filter((req) => included.has(req.server));
|
|
236
|
+
return MCP_ENV_REQUIREMENTS.filter((req) => included.has(req.server) && needsToken(req.server, stack));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Targets that sign in to a server with OAuth, by server key. A project that
|
|
241
|
+
* compiles only for those never sends the token, and asking for it in `.env`
|
|
242
|
+
* and in `doctor` would be asking for a secret nothing reads.
|
|
243
|
+
*/
|
|
244
|
+
const OAUTH_TARGETS = new Map(
|
|
245
|
+
Object.values(PLUGINS)
|
|
246
|
+
.filter((p) => p.mcpServerKey && p.tokenAuth)
|
|
247
|
+
.map((p) => [p.mcpServerKey!, p.tokenAuth!.oauthTargets as string[]]),
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
function needsToken(server: string, stack: StackConfig): boolean {
|
|
251
|
+
const oauth = OAUTH_TARGETS.get(server);
|
|
252
|
+
return !oauth || stack.ides.length === 0 || stack.ides.some((ide) => !oauth.includes(ide));
|
|
237
253
|
}
|
|
238
254
|
|
|
239
255
|
// ── Customization file transforms ─────────────────────────────
|
|
@@ -351,6 +367,7 @@ const SUBCATEGORY_TO_SLOT: Record<string, string> = {
|
|
|
351
367
|
'codebase-tool': 'codebase-tool',
|
|
352
368
|
'task-management': 'task-management',
|
|
353
369
|
'knowledge-management': 'knowledge-management',
|
|
370
|
+
'source-control': 'source-control',
|
|
354
371
|
testing: 'testing',
|
|
355
372
|
'e2e-testing': 'e2e-testing',
|
|
356
373
|
design: 'design',
|
package/src/cli/types.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { CompileSource } from './layers.js';
|
|
|
5
5
|
|
|
6
6
|
export type IdeChoice = 'vscode' | 'cursor' | 'claude-code' | 'opencode' | 'windsurf' | 'codex' | 'antigravity';
|
|
7
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
|
-
export type TeamTool = 'linear' | 'jira' | 'trello' | 'notion' | 'slack' | 'teams';
|
|
8
|
+
export type TeamTool = 'linear' | 'jira' | 'trello' | 'notion' | 'slack' | 'teams' | 'github' | 'gitlab';
|
|
9
9
|
|
|
10
10
|
export interface StackConfig {
|
|
11
11
|
ides: IdeChoice[];
|
|
@@ -134,6 +134,8 @@ export interface RepoInfo {
|
|
|
134
134
|
pm?: string[];
|
|
135
135
|
notifications?: string[];
|
|
136
136
|
services?: string[];
|
|
137
|
+
/** Where the repository is hosted, `github` or `gitlab`: from its remotes, package metadata and files only a host reads. */
|
|
138
|
+
codeHosts?: string[];
|
|
137
139
|
mcpConfig?: boolean;
|
|
138
140
|
configFiles?: string[];
|
|
139
141
|
}
|