@cliangdev/conductor 0.24.1 → 0.26.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/assets/claude/commands/conductor/creative.md +90 -0
- package/assets/claude/skills/conductor-creative/SKILL.md +129 -51
- package/assets/claude/skills/conductor-creative/references/brand-kit-setup.md +41 -0
- package/assets/cli-manifest.json +38 -3
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +2 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +2 -0
- package/dist/commands/start.js.map +1 -1
- package/dist/creative/assertions.js +22 -11
- package/dist/creative/frame.js +3 -3
- package/dist/creative/job/file-transport.mjs +211 -0
- package/dist/creative/job/render.mjs +84 -2
- package/dist/creative/job/server.mjs +70 -13
- package/dist/lib/creative-render.d.ts +62 -0
- package/dist/lib/creative-render.d.ts.map +1 -1
- package/dist/lib/creative-render.js +51 -0
- package/dist/lib/creative-render.js.map +1 -1
- package/dist/lib/plugin-assets.d.ts +48 -1
- package/dist/lib/plugin-assets.d.ts.map +1 -1
- package/dist/lib/plugin-assets.js +272 -22
- package/dist/lib/plugin-assets.js.map +1 -1
- package/dist/mcp/api.d.ts +18 -1
- package/dist/mcp/api.d.ts.map +1 -1
- package/dist/mcp/api.js +20 -2
- package/dist/mcp/api.js.map +1 -1
- package/dist/mcp/index.d.ts +2414 -471
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +246 -77
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/tools/creative-drafts.d.ts +134 -0
- package/dist/mcp/tools/creative-drafts.d.ts.map +1 -0
- package/dist/mcp/tools/creative-drafts.js +405 -0
- package/dist/mcp/tools/creative-drafts.js.map +1 -0
- package/dist/mcp/tools/creatives.d.ts +60 -0
- package/dist/mcp/tools/creatives.d.ts.map +1 -1
- package/dist/mcp/tools/creatives.js +219 -23
- package/dist/mcp/tools/creatives.js.map +1 -1
- package/package.json +1 -1
- package/scripts/build-creative.mjs +1 -0
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* launched or what browser it gets — that's `job/transport.mjs`'s and this file's job respectively.
|
|
9
9
|
*/
|
|
10
10
|
import { existsSync } from 'node:fs';
|
|
11
|
+
import { readFile } from 'node:fs/promises';
|
|
11
12
|
import { dirname, join } from 'node:path';
|
|
12
13
|
import { fileURLToPath } from 'node:url';
|
|
13
14
|
import { apiGet, apiPost, ApiError } from '../mcp/api.js';
|
|
@@ -110,4 +111,54 @@ export async function renderCreative(params, config, log = () => { }) {
|
|
|
110
111
|
};
|
|
111
112
|
}
|
|
112
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Renders a DRAFT spec (the backend's `draft-spec` response — nothing about it is saved) with the same
|
|
116
|
+
* render core a saved Creative uses, but through the file transport: the local files behind
|
|
117
|
+
* `local:<key>` are served to the headless browser from this machine, and the frames plus a
|
|
118
|
+
* `manifest.json` land in `outDir`. A `previewOnly` spec also gets `manifest.checks` / `manifest.passed`:
|
|
119
|
+
* the full render's per-placement assertions, run without keeping their frames. Never talks to the Conductor API. A MOTION spec that is not
|
|
120
|
+
* `previewOnly` needs ffmpeg, resolved the same way {@link renderCreative} resolves it.
|
|
121
|
+
*/
|
|
122
|
+
export async function renderDraft(params, log = () => { }) {
|
|
123
|
+
const { spec, localFiles, outDir } = params;
|
|
124
|
+
let ffmpegPath;
|
|
125
|
+
if (spec.creative?.kind === 'MOTION' && !spec.previewOnly) {
|
|
126
|
+
try {
|
|
127
|
+
ffmpegPath = await resolveFfmpegPath();
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
return { ok: false, error: err instanceof Error ? err.message : String(err) };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const { run } = await loadRenderCore();
|
|
134
|
+
const transportPath = join(jobDir(), 'file-transport.mjs');
|
|
135
|
+
if (!existsSync(transportPath)) {
|
|
136
|
+
throw new Error(`Creative draft transport not found at ${transportPath}. This is a packaging bug in @cliangdev/conductor — reinstall the CLI, or in this repo run \`npm run build\`.`);
|
|
137
|
+
}
|
|
138
|
+
const { createFileTransport } = (await import(transportPath));
|
|
139
|
+
const transport = createFileTransport({ spec, localFiles, outDir });
|
|
140
|
+
const browserFactory = await findBrowserFactory(log);
|
|
141
|
+
let ok;
|
|
142
|
+
try {
|
|
143
|
+
// A preview renders only the contact sheet, which never runs the assertions a full render fails on, so
|
|
144
|
+
// ask the core to run them per placement too (and drop the frames) — otherwise an approved preview can
|
|
145
|
+
// still fail its real render.
|
|
146
|
+
ok = await run({ transport, browserFactory, log, ffmpegPath, fps: MOTION_FPS, checkPlacements: !!spec.previewOnly });
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
await transport.close();
|
|
150
|
+
}
|
|
151
|
+
let manifest;
|
|
152
|
+
try {
|
|
153
|
+
manifest = JSON.parse(await readFile(join(outDir, 'manifest.json'), 'utf8'));
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
manifest = undefined;
|
|
157
|
+
}
|
|
158
|
+
if (!ok)
|
|
159
|
+
return { ok: false, error: transport.getError() ?? manifest?.error ?? 'The draft render failed.', manifest };
|
|
160
|
+
if (!manifest)
|
|
161
|
+
return { ok: false, error: 'The draft render finished but wrote no manifest.json.' };
|
|
162
|
+
return { ok: true, manifest };
|
|
163
|
+
}
|
|
113
164
|
//# sourceMappingURL=creative-render.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creative-render.js","sourceRoot":"","sources":["../../src/lib/creative-render.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,e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AAmC,CAAA;IACvC,IAAI,CAAC;QACH,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,CAAC,CAAkB,CAAA;IAC/F,CAAC;IAAC,MAAM,CAAC;QACP,QAAQ,GAAG,SAAS,CAAA;IACtB,CAAC;IACD,IAAI,CAAC,EAAE;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,QAAQ,EAAE,IAAI,QAAQ,EAAE,KAAK,IAAI,0BAA0B,EAAE,QAAQ,EAAE,CAAA;IACrH,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,uDAAuD,EAAE,CAAA;IACnG,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;AAC/B,CAAC"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export declare function getAssetSrcDir(): string;
|
|
2
|
+
/** The running @cliangdev/conductor package's own version — same resolution path as
|
|
3
|
+
* getAssetSrcDir (dist/lib/plugin-assets.js -> ../../package.json). */
|
|
4
|
+
export declare function getPackageVersion(): string;
|
|
2
5
|
export type InstallStatus = 'installed' | 'updated' | 'current';
|
|
3
6
|
/**
|
|
4
|
-
* Install or update conductor Claude plugin assets into targetDir.
|
|
7
|
+
* Install or update conductor Claude plugin assets into targetDir. Used only by `conductor init` —
|
|
8
|
+
* this is the one place allowed to touch settings.json/.mcp.json; a background refresh
|
|
9
|
+
* ({@link refreshInstalledPluginAssets}) never calls this.
|
|
5
10
|
*
|
|
6
11
|
* @param targetDir Destination .claude/ directory (e.g. ~/.claude/ or projectRoot/.claude/)
|
|
7
12
|
* @param assetSrcDir Source assets/claude/ directory from the CLI package
|
|
@@ -16,4 +21,46 @@ export declare function getPluginInstallStatus(assetSrcDir: string, globalClaude
|
|
|
16
21
|
location: 'global' | 'local' | 'none';
|
|
17
22
|
outdated: boolean;
|
|
18
23
|
};
|
|
24
|
+
/** Records which package version last (re)installed the plugin assets into targetDir, and — from this
|
|
25
|
+
* version on — a sha256 per installed file, so a later refresh can tell whether the user edited a file
|
|
26
|
+
* (hash mismatch, leave it alone) or it's still exactly what was shipped (safe to overwrite). */
|
|
27
|
+
export declare const PLUGIN_VERSION_MARKER = ".conductor-plugin-version";
|
|
28
|
+
export interface PluginVersionMarker {
|
|
29
|
+
version: string;
|
|
30
|
+
/** relPath (one of PLUGIN_FILES) -> sha256 hex of the content this package wrote there. Present
|
|
31
|
+
* only for the current JSON marker format; absent for a legacy plain-version-string marker (or when
|
|
32
|
+
* no marker exists at all), which carries no hash baseline to check edits against. */
|
|
33
|
+
files?: Record<string, string>;
|
|
34
|
+
}
|
|
35
|
+
/** The sha256 of every currently-installed PLUGIN_FILES entry under targetDir, for stamping into the
|
|
36
|
+
* marker right after a write (install, refresh, or migration) so the next refresh has a baseline. */
|
|
37
|
+
export declare function computeInstalledFileHashes(targetDir: string): Record<string, string>;
|
|
38
|
+
export declare function writePluginVersionMarker(targetDir: string, version: string, files?: Record<string, string>): void;
|
|
39
|
+
/** Reads the marker, transparently handling the legacy format (a bare version string, no JSON) that
|
|
40
|
+
* predates per-file hashes — returned with `files` left undefined so callers can tell the two apart. */
|
|
41
|
+
export declare function readPluginVersionMarker(targetDir: string): PluginVersionMarker | undefined;
|
|
42
|
+
export interface RefreshOptions {
|
|
43
|
+
/** Called once per location actually refreshed, and once if the whole thing fails; defaults to a
|
|
44
|
+
* no-op so callers that don't care about logging don't have to pass anything. */
|
|
45
|
+
log?: (message: string) => void;
|
|
46
|
+
assetSrcDir?: string;
|
|
47
|
+
currentVersion?: string;
|
|
48
|
+
/** Override for tests; production callers omit this and get `~/.claude`. */
|
|
49
|
+
globalClaudeDir?: string;
|
|
50
|
+
/** Override for tests; production callers omit this and let it resolve from `cwd`. */
|
|
51
|
+
localClaudeDir?: string;
|
|
52
|
+
cwd?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Refreshes every existing Claude plugin install — the global one (`~/.claude`) and the project-local
|
|
56
|
+
* one for whichever project `cwd` belongs to — in place, but only the ones that actually exist and
|
|
57
|
+
* only when the running package version is newer than what each install's marker records (equal or
|
|
58
|
+
* older is a no-op, per install). Never touches settings.json or .mcp.json — `conductor init` alone
|
|
59
|
+
* manages those. Writes are atomic (temp file + rename). Swallows every error so a broken refresh can
|
|
60
|
+
* never block the MCP server or the daemon from starting; logs through `log`.
|
|
61
|
+
*
|
|
62
|
+
* Single implementation shared by the MCP server (`mcp/index.ts`) and `conductor start`
|
|
63
|
+
* (`commands/start.ts`) startup — call this instead of duplicating the check.
|
|
64
|
+
*/
|
|
65
|
+
export declare function refreshInstalledPluginAssets(opts?: RefreshOptions): void;
|
|
19
66
|
//# sourceMappingURL=plugin-assets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-assets.d.ts","sourceRoot":"","sources":["../../src/lib/plugin-assets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-assets.d.ts","sourceRoot":"","sources":["../../src/lib/plugin-assets.ts"],"names":[],"mappings":"AAuDA,wBAAgB,cAAc,IAAI,MAAM,CAKvC;AAED;uEACuE;AACvE,wBAAgB,iBAAiB,IAAI,MAAM,CAI1C;AA2CD,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,CAAA;AA6C/D;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,MAAM,GACnB,aAAa,CASf;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,GACrB;IAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CA0B9D;AAED;;iGAEiG;AACjG,eAAO,MAAM,qBAAqB,8BAA8B,CAAA;AAEhE,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAA;IACf;;0FAEsF;IACtF,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B;AAMD;qGACqG;AACrG,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQpF;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAGjH;AAED;wGACwG;AACxG,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAmB1F;AAyID,MAAM,WAAW,cAAc;IAC7B;qFACiF;IACjF,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,sFAAsF;IACtF,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,GAAE,cAAmB,GAAG,IAAI,CAyB5E"}
|
|
@@ -1,31 +1,57 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
+
import * as os from 'os';
|
|
4
|
+
import { execSync } from 'child_process';
|
|
5
|
+
import { createHash } from 'crypto';
|
|
3
6
|
import { fileURLToPath } from 'url';
|
|
7
|
+
import { createRequire } from 'module';
|
|
8
|
+
import { readConfig as readCliConfig } from './config.js';
|
|
9
|
+
import { resolveProject } from '../mcp/config.js';
|
|
4
10
|
const PLUGIN_FILES = [
|
|
5
11
|
'commands/conductor/prd.md',
|
|
6
12
|
'commands/conductor/implement.md',
|
|
7
13
|
'commands/conductor/fix.md',
|
|
8
14
|
'commands/conductor/workflow.md',
|
|
15
|
+
'commands/conductor/creative.md',
|
|
9
16
|
'agents/conductor-researcher.md',
|
|
10
17
|
'skills/conductor-ux-ui-design/SKILL.md',
|
|
11
18
|
'skills/conductor-ux-ui-design/references/design-tokens.md',
|
|
12
19
|
'skills/conductor-coder/SKILL.md',
|
|
13
20
|
'skills/conductor-publisher/SKILL.md',
|
|
14
21
|
'skills/conductor-creative/SKILL.md',
|
|
22
|
+
'skills/conductor-creative/references/brand-kit-setup.md',
|
|
15
23
|
];
|
|
16
|
-
// Paths removed in previous versions — deleted on `conductor init` to clean up stale installs.
|
|
24
|
+
// Paths removed in previous versions — deleted on `conductor init` (and a refresh) to clean up stale installs.
|
|
17
25
|
const LEGACY_PATHS = [
|
|
18
26
|
'agents/researcher.md',
|
|
19
27
|
'skills/ux-ui-design/SKILL.md',
|
|
20
28
|
'skills/ux-ui-design/references/design-tokens.md',
|
|
21
29
|
];
|
|
22
30
|
const CONDUCTOR_PERMISSIONS = ['mcp__conductor__*'];
|
|
31
|
+
/** Anchor file used to decide whether a `.claude/` dir has the plugin installed at all. */
|
|
32
|
+
const PLUGIN_ANCHOR = path.join('commands', 'conductor', 'prd.md');
|
|
23
33
|
export function getAssetSrcDir() {
|
|
24
34
|
const __filename = fileURLToPath(import.meta.url);
|
|
25
35
|
const __dirname = path.dirname(__filename);
|
|
26
36
|
// Compiled to dist/lib/plugin-assets.js; assets/claude/ is at ../../assets/claude
|
|
27
37
|
return path.join(__dirname, '..', '..', 'assets', 'claude');
|
|
28
38
|
}
|
|
39
|
+
/** The running @cliangdev/conductor package's own version — same resolution path as
|
|
40
|
+
* getAssetSrcDir (dist/lib/plugin-assets.js -> ../../package.json). */
|
|
41
|
+
export function getPackageVersion() {
|
|
42
|
+
const require = createRequire(import.meta.url);
|
|
43
|
+
const pkg = require('../../package.json');
|
|
44
|
+
return pkg.version;
|
|
45
|
+
}
|
|
46
|
+
/** Writes `content` to `destPath` via a temp-file-then-rename, so a reader (or a concurrently
|
|
47
|
+
* starting daemon/MCP server) never observes a partially-written file. */
|
|
48
|
+
function atomicWriteFileSync(destPath, content) {
|
|
49
|
+
const dir = path.dirname(destPath);
|
|
50
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
51
|
+
const tmpPath = path.join(dir, `.${path.basename(destPath)}.tmp-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
52
|
+
fs.writeFileSync(tmpPath, content, 'utf8');
|
|
53
|
+
fs.renameSync(tmpPath, destPath);
|
|
54
|
+
}
|
|
29
55
|
function mergeSettingsJson(settingsPath) {
|
|
30
56
|
let settings = {};
|
|
31
57
|
try {
|
|
@@ -38,8 +64,7 @@ function mergeSettingsJson(settingsPath) {
|
|
|
38
64
|
...(settings.permissions ?? {}),
|
|
39
65
|
allow: newAllow,
|
|
40
66
|
};
|
|
41
|
-
|
|
42
|
-
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n', 'utf8');
|
|
67
|
+
atomicWriteFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
|
|
43
68
|
}
|
|
44
69
|
function mergeMcpJson(mcpPath) {
|
|
45
70
|
let mcp = {};
|
|
@@ -51,17 +76,14 @@ function mergeMcpJson(mcpPath) {
|
|
|
51
76
|
...(mcp.mcpServers ?? {}),
|
|
52
77
|
conductor: { command: 'conductor', args: ['mcp'] },
|
|
53
78
|
};
|
|
54
|
-
|
|
55
|
-
fs.writeFileSync(mcpPath, JSON.stringify(mcp, null, 2) + '\n', 'utf8');
|
|
79
|
+
atomicWriteFileSync(mcpPath, JSON.stringify(mcp, null, 2) + '\n');
|
|
56
80
|
}
|
|
57
|
-
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
|
|
63
|
-
*/
|
|
64
|
-
export function installPluginAssets(targetDir, assetSrcDir, mcpJsonPath) {
|
|
81
|
+
/** Writes every PLUGIN_FILES entry into targetDir (unconditionally overwriting anything already
|
|
82
|
+
* there) and removes LEGACY_PATHS — the file-level half of installing/refreshing the plugin, with no
|
|
83
|
+
* opinion on settings.json or .mcp.json. Shared by {@link installPluginAssets} (which also merges
|
|
84
|
+
* those) and the legacy-marker migration path in {@link refreshInstalledPluginAssets} (which
|
|
85
|
+
* deliberately does not). */
|
|
86
|
+
function writePluginFiles(targetDir, assetSrcDir) {
|
|
65
87
|
let anyNew = false;
|
|
66
88
|
let anyUpdated = false;
|
|
67
89
|
for (const file of PLUGIN_FILES) {
|
|
@@ -81,31 +103,42 @@ export function installPluginAssets(targetDir, assetSrcDir, mcpJsonPath) {
|
|
|
81
103
|
catch { /* doesn't exist yet */ }
|
|
82
104
|
if (destContent === null) {
|
|
83
105
|
anyNew = true;
|
|
84
|
-
|
|
85
|
-
fs.writeFileSync(destPath, srcContent, 'utf8');
|
|
106
|
+
atomicWriteFileSync(destPath, srcContent);
|
|
86
107
|
}
|
|
87
108
|
else if (destContent !== srcContent) {
|
|
88
109
|
anyUpdated = true;
|
|
89
|
-
|
|
110
|
+
atomicWriteFileSync(destPath, srcContent);
|
|
90
111
|
}
|
|
91
112
|
}
|
|
92
113
|
for (const legacy of LEGACY_PATHS) {
|
|
93
|
-
const legacyPath = path.join(targetDir, legacy);
|
|
94
114
|
try {
|
|
95
|
-
fs.rmSync(
|
|
115
|
+
fs.rmSync(path.join(targetDir, legacy));
|
|
96
116
|
}
|
|
97
117
|
catch { /* already gone */ }
|
|
98
118
|
}
|
|
99
|
-
mergeSettingsJson(path.join(targetDir, 'settings.json'));
|
|
100
|
-
if (mcpJsonPath) {
|
|
101
|
-
mergeMcpJson(mcpJsonPath);
|
|
102
|
-
}
|
|
103
119
|
if (anyNew)
|
|
104
120
|
return 'installed';
|
|
105
121
|
if (anyUpdated)
|
|
106
122
|
return 'updated';
|
|
107
123
|
return 'current';
|
|
108
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Install or update conductor Claude plugin assets into targetDir. Used only by `conductor init` —
|
|
127
|
+
* this is the one place allowed to touch settings.json/.mcp.json; a background refresh
|
|
128
|
+
* ({@link refreshInstalledPluginAssets}) never calls this.
|
|
129
|
+
*
|
|
130
|
+
* @param targetDir Destination .claude/ directory (e.g. ~/.claude/ or projectRoot/.claude/)
|
|
131
|
+
* @param assetSrcDir Source assets/claude/ directory from the CLI package
|
|
132
|
+
* @param mcpJsonPath Optional path to .mcp.json to merge; omit if caller handles it separately
|
|
133
|
+
*/
|
|
134
|
+
export function installPluginAssets(targetDir, assetSrcDir, mcpJsonPath) {
|
|
135
|
+
const status = writePluginFiles(targetDir, assetSrcDir);
|
|
136
|
+
mergeSettingsJson(path.join(targetDir, 'settings.json'));
|
|
137
|
+
if (mcpJsonPath) {
|
|
138
|
+
mergeMcpJson(mcpJsonPath);
|
|
139
|
+
}
|
|
140
|
+
return status;
|
|
141
|
+
}
|
|
109
142
|
/**
|
|
110
143
|
* Return the plugin install status without writing any files.
|
|
111
144
|
* Used by `conductor doctor`.
|
|
@@ -135,4 +168,221 @@ export function getPluginInstallStatus(assetSrcDir, globalClaudeDir, localClaude
|
|
|
135
168
|
}
|
|
136
169
|
return { location, outdated };
|
|
137
170
|
}
|
|
171
|
+
/** Records which package version last (re)installed the plugin assets into targetDir, and — from this
|
|
172
|
+
* version on — a sha256 per installed file, so a later refresh can tell whether the user edited a file
|
|
173
|
+
* (hash mismatch, leave it alone) or it's still exactly what was shipped (safe to overwrite). */
|
|
174
|
+
export const PLUGIN_VERSION_MARKER = '.conductor-plugin-version';
|
|
175
|
+
function sha256Hex(content) {
|
|
176
|
+
return createHash('sha256').update(content, 'utf8').digest('hex');
|
|
177
|
+
}
|
|
178
|
+
/** The sha256 of every currently-installed PLUGIN_FILES entry under targetDir, for stamping into the
|
|
179
|
+
* marker right after a write (install, refresh, or migration) so the next refresh has a baseline. */
|
|
180
|
+
export function computeInstalledFileHashes(targetDir) {
|
|
181
|
+
const hashes = {};
|
|
182
|
+
for (const file of PLUGIN_FILES) {
|
|
183
|
+
try {
|
|
184
|
+
hashes[file] = sha256Hex(fs.readFileSync(path.join(targetDir, file), 'utf8'));
|
|
185
|
+
}
|
|
186
|
+
catch { /* not installed */ }
|
|
187
|
+
}
|
|
188
|
+
return hashes;
|
|
189
|
+
}
|
|
190
|
+
export function writePluginVersionMarker(targetDir, version, files) {
|
|
191
|
+
const marker = files ? { version, files } : { version };
|
|
192
|
+
atomicWriteFileSync(path.join(targetDir, PLUGIN_VERSION_MARKER), JSON.stringify(marker));
|
|
193
|
+
}
|
|
194
|
+
/** Reads the marker, transparently handling the legacy format (a bare version string, no JSON) that
|
|
195
|
+
* predates per-file hashes — returned with `files` left undefined so callers can tell the two apart. */
|
|
196
|
+
export function readPluginVersionMarker(targetDir) {
|
|
197
|
+
let raw;
|
|
198
|
+
try {
|
|
199
|
+
raw = fs.readFileSync(path.join(targetDir, PLUGIN_VERSION_MARKER), 'utf8').trim();
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
return undefined;
|
|
203
|
+
}
|
|
204
|
+
if (!raw)
|
|
205
|
+
return undefined;
|
|
206
|
+
try {
|
|
207
|
+
const parsed = JSON.parse(raw);
|
|
208
|
+
if (parsed && typeof parsed.version === 'string') {
|
|
209
|
+
const files = parsed.files && typeof parsed.files === 'object' ? parsed.files : undefined;
|
|
210
|
+
return { version: parsed.version, files };
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
catch {
|
|
214
|
+
// Not JSON — a legacy marker written as a bare version string.
|
|
215
|
+
}
|
|
216
|
+
return { version: raw };
|
|
217
|
+
}
|
|
218
|
+
function parseSemverTriple(v) {
|
|
219
|
+
const m = /^(\d+)\.(\d+)\.(\d+)/.exec(v.trim());
|
|
220
|
+
if (!m)
|
|
221
|
+
return [0, 0, 0];
|
|
222
|
+
return [Number(m[1]), Number(m[2]), Number(m[3])];
|
|
223
|
+
}
|
|
224
|
+
/** True only when `a` is strictly newer than `b` (major.minor.patch; pre-release/build tags are
|
|
225
|
+
* ignored — this package only ever compares its own release versions). Equal or older returns false,
|
|
226
|
+
* which is what makes a refresh a no-op instead of silently re-running on every startup. */
|
|
227
|
+
function isNewerVersion(a, b) {
|
|
228
|
+
const [aMaj, aMin, aPatch] = parseSemverTriple(a);
|
|
229
|
+
const [bMaj, bMin, bPatch] = parseSemverTriple(b);
|
|
230
|
+
if (aMaj !== bMaj)
|
|
231
|
+
return aMaj > bMaj;
|
|
232
|
+
if (aMin !== bMin)
|
|
233
|
+
return aMin > bMin;
|
|
234
|
+
return aPatch > bPatch;
|
|
235
|
+
}
|
|
236
|
+
/** Overwrites a plugin file only when it's missing or its current content still hashes to what was
|
|
237
|
+
* recorded at the last install/refresh — i.e. the user hasn't touched it. A file with no recorded hash
|
|
238
|
+
* that still exists is left alone too (unknown provenance); a brand-new PLUGIN_FILES entry with no
|
|
239
|
+
* recorded hash is written because it's simply missing. Never touches settings.json or .mcp.json.
|
|
240
|
+
*
|
|
241
|
+
* Returns the new hash for every file this call actually wrote (or found already matching the bundled
|
|
242
|
+
* content). Files it left alone because the user edited them are NOT included — the caller must keep
|
|
243
|
+
* their previously recorded hash rather than recompute one from the edited content on disk, or the next
|
|
244
|
+
* refresh would see disk-matches-recorded-hash and silently adopt the edit as "clean", overwriting it. */
|
|
245
|
+
function overwriteUneditedFiles(targetDir, assetSrcDir, recordedHashes) {
|
|
246
|
+
const writtenHashes = {};
|
|
247
|
+
for (const file of PLUGIN_FILES) {
|
|
248
|
+
const srcPath = path.join(assetSrcDir, file);
|
|
249
|
+
let srcContent;
|
|
250
|
+
try {
|
|
251
|
+
srcContent = fs.readFileSync(srcPath, 'utf8');
|
|
252
|
+
}
|
|
253
|
+
catch {
|
|
254
|
+
continue; // no longer shipped
|
|
255
|
+
}
|
|
256
|
+
const destPath = path.join(targetDir, file);
|
|
257
|
+
let destContent = null;
|
|
258
|
+
try {
|
|
259
|
+
destContent = fs.readFileSync(destPath, 'utf8');
|
|
260
|
+
}
|
|
261
|
+
catch { /* missing */ }
|
|
262
|
+
if (destContent === null) {
|
|
263
|
+
atomicWriteFileSync(destPath, srcContent);
|
|
264
|
+
writtenHashes[file] = sha256Hex(srcContent);
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
const recordedHash = recordedHashes[file];
|
|
268
|
+
if (recordedHash !== undefined && sha256Hex(destContent) === recordedHash) {
|
|
269
|
+
if (destContent !== srcContent) {
|
|
270
|
+
atomicWriteFileSync(destPath, srcContent);
|
|
271
|
+
}
|
|
272
|
+
writtenHashes[file] = sha256Hex(srcContent);
|
|
273
|
+
}
|
|
274
|
+
// else: edited by the user (or no baseline to trust) — leave it exactly as it is, and leave its
|
|
275
|
+
// hash out of writtenHashes so the caller keeps the previously recorded one.
|
|
276
|
+
}
|
|
277
|
+
for (const legacy of LEGACY_PATHS) {
|
|
278
|
+
try {
|
|
279
|
+
fs.rmSync(path.join(targetDir, legacy));
|
|
280
|
+
}
|
|
281
|
+
catch { /* already gone */ }
|
|
282
|
+
}
|
|
283
|
+
return writtenHashes;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Refreshes one install location in place, if the running version is newer than what's recorded there.
|
|
287
|
+
* A JSON marker (with `files`) does the selective, edit-preserving overwrite; a legacy marker (a bare
|
|
288
|
+
* version string) or no marker at all has no hash baseline, so this migrates it the same way
|
|
289
|
+
* `installPluginAssets` would — overwrite our own files unconditionally — and starts recording hashes
|
|
290
|
+
* from here on. Never touches settings.json or .mcp.json. Returns whether anything actually changed.
|
|
291
|
+
*/
|
|
292
|
+
function refreshOneLocation(targetDir, assetSrcDir, currentVersion) {
|
|
293
|
+
const marker = readPluginVersionMarker(targetDir);
|
|
294
|
+
if (marker && !isNewerVersion(currentVersion, marker.version))
|
|
295
|
+
return false;
|
|
296
|
+
let newHashes;
|
|
297
|
+
if (marker?.files) {
|
|
298
|
+
const written = overwriteUneditedFiles(targetDir, assetSrcDir, marker.files);
|
|
299
|
+
// Files that were skipped (user-edited) keep their previously recorded hash so they're
|
|
300
|
+
// still recognized as edited — and thus left alone — by every future refresh.
|
|
301
|
+
newHashes = { ...marker.files, ...written };
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
writePluginFiles(targetDir, assetSrcDir);
|
|
305
|
+
newHashes = computeInstalledFileHashes(targetDir);
|
|
306
|
+
}
|
|
307
|
+
writePluginVersionMarker(targetDir, currentVersion, newHashes);
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
/** True if `dir` is inside a git work-tree; returns its root, or undefined outside one (or if `git`
|
|
311
|
+
* itself is unavailable — never throws). */
|
|
312
|
+
function findGitRoot(startDir) {
|
|
313
|
+
try {
|
|
314
|
+
const root = execSync('git rev-parse --show-toplevel', {
|
|
315
|
+
cwd: startDir,
|
|
316
|
+
encoding: 'utf8',
|
|
317
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
318
|
+
}).trim();
|
|
319
|
+
return root || undefined;
|
|
320
|
+
}
|
|
321
|
+
catch {
|
|
322
|
+
return undefined;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Finds the project `.claude/` that `cwd` belongs to — never bare `cwd` itself, which for the MCP
|
|
327
|
+
* server or the daemon is rarely the project root. Prefers the localPath `conductor init` recorded for
|
|
328
|
+
* whichever project this cwd resolves to (the same `projects` map + cwd-matching `resolveProject` uses
|
|
329
|
+
* for MCP tool calls), but only when `resolveProject` actually derived that project *from* this cwd
|
|
330
|
+
* (source `cwd` or `env`) — since that survives cwd being a subdirectory or symlink. A `fallback`
|
|
331
|
+
* source (cwd matched no configured project, or there's no map at all) means the resolved project's
|
|
332
|
+
* localPath has nothing to do with this cwd — using it would silently point the refresh at some other,
|
|
333
|
+
* unrelated project's `.claude/`. In that case (and whenever there's no on-disk config to consult, e.g.
|
|
334
|
+
* an ephemeral container) fall back to walking up to the enclosing git repo's root instead.
|
|
335
|
+
*/
|
|
336
|
+
function resolveLocalClaudeDir(cwd) {
|
|
337
|
+
try {
|
|
338
|
+
const config = readCliConfig();
|
|
339
|
+
if (config) {
|
|
340
|
+
const resolution = resolveProject(config, cwd);
|
|
341
|
+
if (resolution.source === 'cwd' || resolution.source === 'env') {
|
|
342
|
+
const localPath = config.projects?.[resolution.projectId]?.localPath;
|
|
343
|
+
if (localPath)
|
|
344
|
+
return path.join(localPath, '.claude');
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
catch { /* fall through to git */ }
|
|
349
|
+
const gitRoot = findGitRoot(cwd);
|
|
350
|
+
return gitRoot ? path.join(gitRoot, '.claude') : undefined;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Refreshes every existing Claude plugin install — the global one (`~/.claude`) and the project-local
|
|
354
|
+
* one for whichever project `cwd` belongs to — in place, but only the ones that actually exist and
|
|
355
|
+
* only when the running package version is newer than what each install's marker records (equal or
|
|
356
|
+
* older is a no-op, per install). Never touches settings.json or .mcp.json — `conductor init` alone
|
|
357
|
+
* manages those. Writes are atomic (temp file + rename). Swallows every error so a broken refresh can
|
|
358
|
+
* never block the MCP server or the daemon from starting; logs through `log`.
|
|
359
|
+
*
|
|
360
|
+
* Single implementation shared by the MCP server (`mcp/index.ts`) and `conductor start`
|
|
361
|
+
* (`commands/start.ts`) startup — call this instead of duplicating the check.
|
|
362
|
+
*/
|
|
363
|
+
export function refreshInstalledPluginAssets(opts = {}) {
|
|
364
|
+
const log = opts.log ?? (() => { });
|
|
365
|
+
try {
|
|
366
|
+
const assetSrcDir = opts.assetSrcDir ?? getAssetSrcDir();
|
|
367
|
+
const currentVersion = opts.currentVersion ?? getPackageVersion();
|
|
368
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
369
|
+
const globalDir = opts.globalClaudeDir ?? path.join(os.homedir(), '.claude');
|
|
370
|
+
const localDir = opts.localClaudeDir ?? resolveLocalClaudeDir(cwd);
|
|
371
|
+
const targets = [];
|
|
372
|
+
if (fs.existsSync(path.join(globalDir, PLUGIN_ANCHOR))) {
|
|
373
|
+
targets.push({ dir: globalDir, location: 'global' });
|
|
374
|
+
}
|
|
375
|
+
if (localDir && path.resolve(localDir) !== path.resolve(globalDir) && fs.existsSync(path.join(localDir, PLUGIN_ANCHOR))) {
|
|
376
|
+
targets.push({ dir: localDir, location: 'local' });
|
|
377
|
+
}
|
|
378
|
+
for (const { dir, location } of targets) {
|
|
379
|
+
if (refreshOneLocation(dir, assetSrcDir, currentVersion)) {
|
|
380
|
+
log(`conductor: refreshed Claude plugin assets (${location})`);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
catch (err) {
|
|
385
|
+
log(`conductor: could not refresh Claude plugin assets: ${err instanceof Error ? err.message : String(err)}`);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
138
388
|
//# sourceMappingURL=plugin-assets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-assets.js","sourceRoot":"","sources":["../../src/lib/plugin-assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,MAAM,YAAY,GAAG;IACnB,2BAA2B;IAC3B,iCAAiC;IACjC,2BAA2B;IAC3B,gCAAgC;IAChC,gCAAgC;IAChC,wCAAwC;IACxC,2DAA2D;IAC3D,iCAAiC;IACjC,qCAAqC;IACrC,oCAAoC;CACrC,CAAA;AAED,+FAA+F;AAC/F,MAAM,YAAY,GAAG;IACnB,sBAAsB;IACtB,8BAA8B;IAC9B,iDAAiD;CAClD,CAAA;AAED,MAAM,qBAAqB,GAAG,CAAC,mBAAmB,CAAC,CAAA;AAoB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cp/api.d.ts
CHANGED
|
@@ -1,19 +1,36 @@
|
|
|
1
1
|
import type { Config } from './config.js';
|
|
2
|
+
/** One field-scoped validation failure, as a Brand Kit 422 (`FieldValidationProblem`) reports it. */
|
|
3
|
+
export interface ApiFieldError {
|
|
4
|
+
field?: string;
|
|
5
|
+
message: string;
|
|
6
|
+
}
|
|
7
|
+
/** One rule-scoped validation failure, as a Creative 422 reports it. */
|
|
8
|
+
export interface ApiViolation {
|
|
9
|
+
field?: string;
|
|
10
|
+
ruleId?: string;
|
|
11
|
+
message: string;
|
|
12
|
+
}
|
|
2
13
|
/**
|
|
3
14
|
* An HTTP error from the Conductor API. `message` is the server's own sentence — an RFC 7807
|
|
4
15
|
* problem's `detail`, falling back to `title`, falling back to the raw response body — so a caller
|
|
5
16
|
* can relay it to a person without re-parsing JSON. `status`, `code`, `detail` and `title` are kept
|
|
6
|
-
* as fields for callers that need to branch on more than the message.
|
|
17
|
+
* as fields for callers that need to branch on more than the message. `fieldErrors`/`violations` are
|
|
18
|
+
* kept too, verbatim from the problem body, when the endpoint's 422 shape carries them — so a caller
|
|
19
|
+
* can format its own per-field message instead of re-parsing `message` as JSON (it usually isn't).
|
|
7
20
|
*/
|
|
8
21
|
export declare class ApiError extends Error {
|
|
9
22
|
readonly status: number;
|
|
10
23
|
readonly code?: string;
|
|
11
24
|
readonly detail?: string;
|
|
12
25
|
readonly title?: string;
|
|
26
|
+
readonly fieldErrors?: ApiFieldError[];
|
|
27
|
+
readonly violations?: ApiViolation[];
|
|
13
28
|
constructor(status: number, message: string, opts?: {
|
|
14
29
|
code?: string;
|
|
15
30
|
detail?: string;
|
|
16
31
|
title?: string;
|
|
32
|
+
fieldErrors?: ApiFieldError[];
|
|
33
|
+
violations?: ApiViolation[];
|
|
17
34
|
});
|
|
18
35
|
}
|
|
19
36
|
/**
|
package/dist/mcp/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["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