claude-flow 3.63.9 → 3.65.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.
Files changed (73) hide show
  1. package/package.json +1 -1
  2. package/v3/@claude-flow/cli/catalog-manifest.json +3 -3
  3. package/v3/@claude-flow/cli/dist/src/commands/cost.d.ts +18 -0
  4. package/v3/@claude-flow/cli/dist/src/commands/cost.js +195 -0
  5. package/v3/@claude-flow/cli/dist/src/commands/doctor-auto-approve.d.ts +9 -0
  6. package/v3/@claude-flow/cli/dist/src/commands/doctor-auto-approve.js +32 -0
  7. package/v3/@claude-flow/cli/dist/src/commands/doctor.js +28 -2
  8. package/v3/@claude-flow/cli/dist/src/commands/hive-mind-worker.d.ts +2 -0
  9. package/v3/@claude-flow/cli/dist/src/commands/hive-mind-worker.js +9 -3
  10. package/v3/@claude-flow/cli/dist/src/commands/hive-mind.js +15 -1
  11. package/v3/@claude-flow/cli/dist/src/commands/hooks.js +45 -0
  12. package/v3/@claude-flow/cli/dist/src/commands/index.js +2 -0
  13. package/v3/@claude-flow/cli/dist/src/commands/init.js +76 -2
  14. package/v3/@claude-flow/cli/dist/src/commands/mods.js +13 -0
  15. package/v3/@claude-flow/cli/dist/src/commands/plugins-paths.d.ts +13 -0
  16. package/v3/@claude-flow/cli/dist/src/commands/plugins-paths.js +55 -0
  17. package/v3/@claude-flow/cli/dist/src/commands/plugins-verify.d.ts +9 -0
  18. package/v3/@claude-flow/cli/dist/src/commands/plugins-verify.js +92 -0
  19. package/v3/@claude-flow/cli/dist/src/commands/plugins.js +13 -1
  20. package/v3/@claude-flow/cli/dist/src/cost/attribution.d.ts +35 -0
  21. package/v3/@claude-flow/cli/dist/src/cost/attribution.js +101 -0
  22. package/v3/@claude-flow/cli/dist/src/cost/budget-file.d.ts +57 -0
  23. package/v3/@claude-flow/cli/dist/src/cost/budget-file.js +113 -0
  24. package/v3/@claude-flow/cli/dist/src/cost/litellm.d.ts +69 -0
  25. package/v3/@claude-flow/cli/dist/src/cost/litellm.js +135 -0
  26. package/v3/@claude-flow/cli/dist/src/init/executor.d.ts +7 -2
  27. package/v3/@claude-flow/cli/dist/src/init/executor.js +64 -10
  28. package/v3/@claude-flow/cli/dist/src/init/helper-commands.d.ts +16 -0
  29. package/v3/@claude-flow/cli/dist/src/init/helper-commands.js +73 -0
  30. package/v3/@claude-flow/cli/dist/src/init/risky-settings-gate.d.ts +39 -0
  31. package/v3/@claude-flow/cli/dist/src/init/risky-settings-gate.js +130 -0
  32. package/v3/@claude-flow/cli/dist/src/init/settings-risk-scanner.d.ts +35 -0
  33. package/v3/@claude-flow/cli/dist/src/init/settings-risk-scanner.js +85 -0
  34. package/v3/@claude-flow/cli/dist/src/init/types.d.ts +12 -0
  35. package/v3/@claude-flow/cli/dist/src/mcp-tools/capability-brain.d.ts +1 -1
  36. package/v3/@claude-flow/cli/dist/src/mcp-tools/capability-brain.js +1 -1
  37. package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.d.ts +1 -0
  38. package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +38 -0
  39. package/v3/@claude-flow/cli/dist/src/memory/verified-guards.d.ts +70 -0
  40. package/v3/@claude-flow/cli/dist/src/memory/verified-guards.js +101 -0
  41. package/v3/@claude-flow/cli/dist/src/memory/verified-outcomes.d.ts +228 -0
  42. package/v3/@claude-flow/cli/dist/src/memory/verified-outcomes.js +372 -0
  43. package/v3/@claude-flow/cli/dist/src/memory/verified-reverify.d.ts +63 -0
  44. package/v3/@claude-flow/cli/dist/src/memory/verified-reverify.js +174 -0
  45. package/v3/@claude-flow/cli/dist/src/missions/schemas.d.ts +36 -36
  46. package/v3/@claude-flow/cli/dist/src/mods/apply.d.ts +2 -0
  47. package/v3/@claude-flow/cli/dist/src/mods/apply.js +68 -8
  48. package/v3/@claude-flow/cli/dist/src/mods/command-registry/schema.d.ts +222 -222
  49. package/v3/@claude-flow/cli/dist/src/mods/compact-snapshots.d.ts +21 -0
  50. package/v3/@claude-flow/cli/dist/src/mods/compact-snapshots.js +45 -0
  51. package/v3/@claude-flow/cli/dist/src/mods/headless-check.d.ts +58 -0
  52. package/v3/@claude-flow/cli/dist/src/mods/headless-check.js +137 -0
  53. package/v3/@claude-flow/cli/dist/src/mods/headless-plugins.d.ts +44 -0
  54. package/v3/@claude-flow/cli/dist/src/mods/headless-plugins.js +92 -0
  55. package/v3/@claude-flow/cli/dist/src/mods/install-trust.d.ts +28 -0
  56. package/v3/@claude-flow/cli/dist/src/mods/install-trust.js +127 -0
  57. package/v3/@claude-flow/cli/dist/src/mods/install.d.ts +19 -0
  58. package/v3/@claude-flow/cli/dist/src/mods/install.js +38 -1
  59. package/v3/@claude-flow/cli/dist/src/mods/plugin-paths.d.ts +60 -0
  60. package/v3/@claude-flow/cli/dist/src/mods/plugin-paths.js +131 -0
  61. package/v3/@claude-flow/cli/dist/src/mods/plugin-repair.d.ts +8 -0
  62. package/v3/@claude-flow/cli/dist/src/mods/plugin-repair.js +7 -0
  63. package/v3/@claude-flow/cli/dist/src/plugins/marketplace-trust/scan.d.ts +23 -0
  64. package/v3/@claude-flow/cli/dist/src/plugins/marketplace-trust/scan.js +255 -0
  65. package/v3/@claude-flow/cli/dist/src/plugins/marketplace-trust/signature.d.ts +53 -0
  66. package/v3/@claude-flow/cli/dist/src/plugins/marketplace-trust/signature.js +140 -0
  67. package/v3/@claude-flow/cli/dist/src/plugins/marketplace-trust/verify-status.d.ts +42 -0
  68. package/v3/@claude-flow/cli/dist/src/plugins/marketplace-trust/verify-status.js +110 -0
  69. package/v3/@claude-flow/cli/dist/src/services/headless-worker-executor.d.ts +2 -0
  70. package/v3/@claude-flow/cli/dist/src/services/headless-worker-executor.js +13 -3
  71. package/v3/@claude-flow/cli/package.json +2 -1
  72. package/.claude/.proven-config-version +0 -1
  73. package/.claude/proven-config.json +0 -42
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Signed plugin manifests for the ruflo marketplace (ADR-509 §2.1).
3
+ *
4
+ * At release, scripts/sign-plugins.mjs writes `<plugin>/.claude-plugin/signature.json`
5
+ * for every plugin listed in `.claude-plugin/marketplace.json`: a sorted list of
6
+ * every file's path and SHA-256, the plugin's version, and an Ed25519 signature
7
+ * over the canonical JSON of both. The key pair is the existing helpers signing
8
+ * key (ADR-174): the public half is RUFLO_HELPERS_PUBKEY, already pinned here.
9
+ *
10
+ * This module is the verifier. The canonical bytes MUST match the signer
11
+ * byte-for-byte; a round-trip test (signer script → this verifier) pins that.
12
+ */
13
+ import { createHash, verify as edVerify } from 'node:crypto';
14
+ import { existsSync, lstatSync, readFileSync, readdirSync, readlinkSync } from 'node:fs';
15
+ import { join } from 'node:path';
16
+ import { RUFLO_HELPERS_PUBKEY } from '../../init/helper-signing.js';
17
+ export const SIGNATURE_RELATIVE = '.claude-plugin/signature.json';
18
+ /** Never part of a plugin's signed content: VCS metadata and installed dependencies. */
19
+ const SKIP_DIRS = new Set(['.git', 'node_modules']);
20
+ const sha256 = (bytes) => createHash('sha256').update(bytes).digest('hex');
21
+ /** Canonical bytes: fixed key order, files sorted by path. MUST match scripts/sign-plugins.mjs. */
22
+ export function canonicalPluginManifestBytes(m) {
23
+ const files = [...m.files]
24
+ .map((f) => ({ path: f.path, sha256: f.sha256 }))
25
+ .sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));
26
+ return Buffer.from(JSON.stringify({ plugin: m.plugin, version: m.version, files }), 'utf-8');
27
+ }
28
+ /**
29
+ * Every file under a plugin root, as posix paths, excluding the signature
30
+ * itself. A symlink is an entry of its own (digest of `link:<target>`), never
31
+ * followed: following it would let a link swap in content the digest never saw.
32
+ */
33
+ export function digestPluginDir(root) {
34
+ const out = [];
35
+ const walk = (rel) => {
36
+ const abs = rel ? join(root, rel) : root;
37
+ for (const name of readdirSync(abs).sort()) {
38
+ const childRel = rel ? `${rel}/${name}` : name;
39
+ if (childRel === SIGNATURE_RELATIVE)
40
+ continue;
41
+ const st = lstatSync(join(abs, name));
42
+ if (st.isSymbolicLink())
43
+ out.push({ path: childRel, sha256: sha256(`link:${readlinkSync(join(abs, name))}`) });
44
+ else if (st.isDirectory()) {
45
+ if (!SKIP_DIRS.has(name))
46
+ walk(childRel);
47
+ }
48
+ else if (st.isFile())
49
+ out.push({ path: childRel, sha256: sha256(readFileSync(join(abs, name))) });
50
+ }
51
+ };
52
+ walk('');
53
+ return out;
54
+ }
55
+ function parseSigned(text) {
56
+ try {
57
+ const s = JSON.parse(text);
58
+ if (!s || s.algorithm !== 'ed25519' || typeof s.signature !== 'string' || !s.manifest)
59
+ return null;
60
+ const m = s.manifest;
61
+ if (typeof m.plugin !== 'string' || typeof m.version !== 'string' || !Array.isArray(m.files))
62
+ return null;
63
+ if (!m.files.every((f) => f && typeof f.path === 'string' && typeof f.sha256 === 'string'))
64
+ return null;
65
+ return s;
66
+ }
67
+ catch {
68
+ return null;
69
+ }
70
+ }
71
+ /** Signature check only: true when `signed.signature` verifies over its manifest. */
72
+ export function signatureValid(signed, pubkeyPem = RUFLO_HELPERS_PUBKEY) {
73
+ try {
74
+ return edVerify(null, canonicalPluginManifestBytes(signed.manifest), pubkeyPem, Buffer.from(signed.signature, 'base64'));
75
+ }
76
+ catch {
77
+ return false;
78
+ }
79
+ }
80
+ /**
81
+ * Check a plugin directory against its signature.json. `expectName` (the
82
+ * marketplace name) must match the signed plugin name: a valid signature
83
+ * copied from another plugin is a bad signature here, not a pass.
84
+ */
85
+ export function verifyPluginDir(dir, expectName, pubkeyPem = RUFLO_HELPERS_PUBKEY) {
86
+ const base = { plugin: expectName, dir, result: 'unsigned', changed: [], missing: [], extra: [] };
87
+ const sigPath = join(dir, SIGNATURE_RELATIVE);
88
+ if (!existsSync(sigPath))
89
+ return base;
90
+ const signed = parseSigned(readFileSync(sigPath, 'utf-8'));
91
+ if (!signed || signed.manifest.plugin !== expectName || !signatureValid(signed, pubkeyPem)) {
92
+ return { ...base, result: 'bad-signature', version: signed?.manifest.version };
93
+ }
94
+ const signedFiles = new Map(signed.manifest.files.map((f) => [f.path, f.sha256]));
95
+ const onDisk = new Map(digestPluginDir(dir).map((f) => [f.path, f.sha256]));
96
+ const changed = [];
97
+ const missing = [];
98
+ const extra = [];
99
+ for (const [path, digest] of signedFiles) {
100
+ const now = onDisk.get(path);
101
+ if (now === undefined)
102
+ missing.push(path);
103
+ else if (now !== digest)
104
+ changed.push(path);
105
+ }
106
+ for (const path of onDisk.keys())
107
+ if (!signedFiles.has(path))
108
+ extra.push(path);
109
+ const clean = changed.length === 0 && missing.length === 0 && extra.length === 0;
110
+ return { ...base, result: clean ? 'verified' : 'modified', changed, missing, extra, version: signed.manifest.version };
111
+ }
112
+ /** The plugins a marketplace clone lists, each with its directory (its `source`, else plugins/<name>). */
113
+ export function listMarketplacePlugins(clone) {
114
+ const catalog = JSON.parse(readFileSync(join(clone, '.claude-plugin', 'marketplace.json'), 'utf-8'));
115
+ const listed = Array.isArray(catalog.plugins) ? catalog.plugins : [];
116
+ const out = [];
117
+ for (const p of listed) {
118
+ if (!p || typeof p.name !== 'string' || !/^[A-Za-z0-9._-]{1,100}$/.test(p.name))
119
+ continue;
120
+ const source = typeof p.source === 'string' ? p.source : `./plugins/${p.name}`;
121
+ // A source outside the clone (absolute, `..`, or a remote object) is not this clone's to verify.
122
+ if (source.startsWith('/') || source.split(/[\\/]/).includes('..'))
123
+ continue;
124
+ out.push({ name: p.name, dir: join(clone, source) });
125
+ }
126
+ return out;
127
+ }
128
+ /** One line per verification, with the differing files named (capped). */
129
+ export function describeVerification(v, cap = 5) {
130
+ if (v.result !== 'modified')
131
+ return `${v.plugin}: ${v.result}`;
132
+ const parts = [
133
+ ...v.changed.map((p) => `changed ${p}`),
134
+ ...v.missing.map((p) => `missing ${p}`),
135
+ ...v.extra.map((p) => `extra ${p}`),
136
+ ];
137
+ const shown = parts.slice(0, cap).join(', ');
138
+ return `${v.plugin}: modified (${shown}${parts.length > cap ? `, … ${parts.length - cap} more` : ''})`;
139
+ }
140
+ //# sourceMappingURL=signature.js.map
@@ -0,0 +1,42 @@
1
+ import { type PluginVerification, type VerifyResult } from './signature.js';
2
+ export declare const VERIFY_STATUS_RELATIVE: string;
3
+ export interface VerifyStatusEntry {
4
+ writtenAt: string;
5
+ clone: string;
6
+ /**
7
+ * Plugin name → the WORST result across its clone copy and every install-cache
8
+ * copy: Claude Code loads an installed plugin from the cache, so a clean clone
9
+ * next to a tampered cache must not read as verified.
10
+ */
11
+ plugins: Record<string, VerifyResult>;
12
+ /** Plugin directory (normalized, see normalizeTrustPath) → that copy's own result: the mod looks up the dir it is loading. */
13
+ paths?: Record<string, VerifyResult>;
14
+ }
15
+ export interface VerifyStatusFile {
16
+ version: 1;
17
+ byConfigDir: Record<string, VerifyStatusEntry>;
18
+ }
19
+ /**
20
+ * The one spelling of a path both sides key on (the CLI writing, the mod
21
+ * reading): forward slashes, no repeated or trailing slash, and a Windows
22
+ * drive path lower-cased (Windows paths are case-insensitive, and HOME /
23
+ * USERPROFILE / os.homedir() disagree on separators). Kept byte-identical to
24
+ * plugins/ruflo-mods/hooks/trust.ts normalizeTrustPath.
25
+ */
26
+ export declare function normalizeTrustPath(p: string): string;
27
+ /** The worse of two results (bad-signature > modified > unsigned > verified). */
28
+ export declare const worseResult: (a: VerifyResult | undefined, b: VerifyResult) => VerifyResult;
29
+ export declare const verifyStatusPath: (home?: string) => string;
30
+ export declare function readVerifyStatus(home?: string): VerifyStatusFile;
31
+ /**
32
+ * Record the clone's results and the install-cache copies' (`cache`): per plugin
33
+ * the worst of all its copies, and per copy its own result keyed by directory.
34
+ */
35
+ export declare function writeVerifyStatus(configDir: string, clone: string, results: readonly PluginVerification[], home?: string, cache?: readonly PluginVerification[]): string;
36
+ /** Verify every plugin a clone lists (or only `names`). A plugin not in the clone is skipped. */
37
+ export declare function verifyClone(clone: string, names?: readonly string[]): PluginVerification[];
38
+ /** Install-cache copies of ruflo plugins (installed_plugins.json), each verified as its own row. */
39
+ export declare function verifyInstallCache(configDir: string, marketplace: string, names?: readonly string[]): PluginVerification[];
40
+ /** The results that §2.1 makes enforceable under refuse-risky. */
41
+ export declare const isUntrusted: (r: VerifyResult) => r is "modified" | "bad-signature";
42
+ //# sourceMappingURL=verify-status.d.ts.map
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Where the ruflo marketplace verification lands (ADR-509 §2.1): `ruflo mods
3
+ * install`, `ruflo mods doctor` and `ruflo plugins verify` check the clone
4
+ * Claude Code loads from (and the install cache) and write the result to a
5
+ * status file that the ruflo-mods `plugin.register` gate reads under
6
+ * `modTrust: refuse-risky`.
7
+ *
8
+ * The file lives under the user's home (~/.claude-flow/mods/plugin-verify.json),
9
+ * not in a project: the clone is per Claude Code config dir, and a repository
10
+ * must not be able to ship a file that says its own tampered clone verified.
11
+ * It is keyed by config dir, so two config dirs never overwrite each other.
12
+ */
13
+ import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
14
+ import { homedir } from 'node:os';
15
+ import { dirname, join } from 'node:path';
16
+ import { listMarketplacePlugins, verifyPluginDir } from './signature.js';
17
+ export const VERIFY_STATUS_RELATIVE = join('.claude-flow', 'mods', 'plugin-verify.json');
18
+ /**
19
+ * The one spelling of a path both sides key on (the CLI writing, the mod
20
+ * reading): forward slashes, no repeated or trailing slash, and a Windows
21
+ * drive path lower-cased (Windows paths are case-insensitive, and HOME /
22
+ * USERPROFILE / os.homedir() disagree on separators). Kept byte-identical to
23
+ * plugins/ruflo-mods/hooks/trust.ts normalizeTrustPath.
24
+ */
25
+ export function normalizeTrustPath(p) {
26
+ let out = p.replace(/\\/g, '/').replace(/\/{2,}/g, '/');
27
+ if (out.length > 1)
28
+ out = out.replace(/\/+$/, '');
29
+ return /^[A-Za-z]:(\/|$)/.test(out) ? out.toLowerCase() : out;
30
+ }
31
+ const RANK = { verified: 0, unsigned: 1, modified: 2, 'bad-signature': 3 };
32
+ /** The worse of two results (bad-signature > modified > unsigned > verified). */
33
+ export const worseResult = (a, b) => (a === undefined || RANK[b] > RANK[a] ? b : a);
34
+ export const verifyStatusPath = (home = homedir()) => join(home, VERIFY_STATUS_RELATIVE);
35
+ export function readVerifyStatus(home = homedir()) {
36
+ try {
37
+ const parsed = JSON.parse(readFileSync(verifyStatusPath(home), 'utf-8'));
38
+ if (parsed && parsed.version === 1 && parsed.byConfigDir && typeof parsed.byConfigDir === 'object')
39
+ return parsed;
40
+ }
41
+ catch {
42
+ // absent or unreadable: nothing verified yet
43
+ }
44
+ return { version: 1, byConfigDir: {} };
45
+ }
46
+ /**
47
+ * Record the clone's results and the install-cache copies' (`cache`): per plugin
48
+ * the worst of all its copies, and per copy its own result keyed by directory.
49
+ */
50
+ export function writeVerifyStatus(configDir, clone, results, home = homedir(), cache = []) {
51
+ const file = readVerifyStatus(home);
52
+ const plugins = {};
53
+ const paths = {};
54
+ for (const r of [...results, ...cache]) {
55
+ plugins[r.plugin] = worseResult(plugins[r.plugin], r.result);
56
+ const key = normalizeTrustPath(r.dir);
57
+ paths[key] = worseResult(paths[key], r.result);
58
+ }
59
+ const key = normalizeTrustPath(configDir);
60
+ // An entry an older writer keyed with another spelling of the same dir is replaced, not left beside it.
61
+ for (const k of Object.keys(file.byConfigDir))
62
+ if (k !== key && normalizeTrustPath(k) === key)
63
+ delete file.byConfigDir[k];
64
+ file.byConfigDir[key] = { writtenAt: new Date().toISOString(), clone, plugins, paths };
65
+ const path = verifyStatusPath(home);
66
+ mkdirSync(dirname(path), { recursive: true });
67
+ const tmp = `${path}.${process.pid}.tmp`;
68
+ writeFileSync(tmp, JSON.stringify(file, null, 2) + '\n', 'utf-8');
69
+ renameSync(tmp, path);
70
+ return path;
71
+ }
72
+ /** Verify every plugin a clone lists (or only `names`). A plugin not in the clone is skipped. */
73
+ export function verifyClone(clone, names) {
74
+ const want = names && names.length ? new Set(names) : null;
75
+ return listMarketplacePlugins(clone)
76
+ .filter((p) => !want || want.has(p.name))
77
+ .filter((p) => existsSync(join(p.dir, '.claude-plugin', 'plugin.json')))
78
+ .map((p) => verifyPluginDir(p.dir, p.name));
79
+ }
80
+ /** Install-cache copies of ruflo plugins (installed_plugins.json), each verified as its own row. */
81
+ export function verifyInstallCache(configDir, marketplace, names) {
82
+ let installed;
83
+ try {
84
+ installed = JSON.parse(readFileSync(join(configDir, 'plugins', 'installed_plugins.json'), 'utf-8'));
85
+ }
86
+ catch {
87
+ return [];
88
+ }
89
+ const plugins = installed?.plugins;
90
+ if (!plugins || typeof plugins !== 'object')
91
+ return [];
92
+ const out = [];
93
+ for (const [id, entries] of Object.entries(plugins)) {
94
+ const at = id.lastIndexOf('@');
95
+ if (at <= 0 || id.slice(at + 1) !== marketplace)
96
+ continue;
97
+ const name = id.slice(0, at);
98
+ if (names && names.length && !names.includes(name))
99
+ continue;
100
+ for (const e of Array.isArray(entries) ? entries : []) {
101
+ const path = e?.installPath;
102
+ if (typeof path === 'string' && existsSync(join(path, '.claude-plugin', 'plugin.json')))
103
+ out.push(verifyPluginDir(path, name));
104
+ }
105
+ }
106
+ return out;
107
+ }
108
+ /** The results that §2.1 makes enforceable under refuse-risky. */
109
+ export const isUntrusted = (r) => r === 'modified' || r === 'bad-signature';
110
+ //# sourceMappingURL=verify-status.js.map
@@ -135,6 +135,8 @@ export interface HeadlessExecutionResult {
135
135
  error?: string;
136
136
  /** Execution ID for tracking */
137
137
  executionId: string;
138
+ /** ADR-510 — plugins in the worker profile that could not be found; the worker ran without them. */
139
+ missingPlugins?: string[];
138
140
  /**
139
141
  * #2661 — true when the launch was skipped because the same job
140
142
  * (repositoryId + HEAD + worker + config) succeeded within the freshness
@@ -25,6 +25,7 @@ import { join } from 'path';
25
25
  import { getGlobalAiBudget, isQuotaErrorText } from './global-ai-budget.js';
26
26
  import { resolveGitWorkspaceIdentity } from './git-workspace-identity.js';
27
27
  import { getAiJobDedupRegistry, computeAiJobKey, hashWorkerConfig } from './ai-job-dedup.js';
28
+ import { withHeadlessPlugins } from '../mods/headless-plugins.js';
28
29
  // ============================================
29
30
  // Constants
30
31
  // ============================================
@@ -777,6 +778,7 @@ export class HeadlessWorkerExecutor extends EventEmitter {
777
778
  timestamp: new Date(),
778
779
  executionId,
779
780
  error: result.error,
781
+ ...(result.missingPlugins ? { missingPlugins: result.missingPlugins } : {}),
780
782
  };
781
783
  // Log result
782
784
  this.logExecution(executionId, 'result', JSON.stringify(executionResult, null, 2));
@@ -1011,7 +1013,10 @@ Analyze the above codebase context and provide your response following the forma
1011
1013
  * Execute Claude Code in headless mode
1012
1014
  */
1013
1015
  executeClaudeCode(prompt, options) {
1014
- return new Promise((resolve) => {
1016
+ return new Promise((resolveRaw) => {
1017
+ // ADR-510: a plugin the worker profile wants but cannot find is recorded on the result.
1018
+ let missingPlugins = [];
1019
+ const resolve = (r) => resolveRaw(missingPlugins.length > 0 ? { ...r, missingPlugins } : r);
1015
1020
  const env = {
1016
1021
  ...process.env,
1017
1022
  CLAUDE_CODE_HEADLESS: 'true',
@@ -1057,9 +1062,14 @@ Analyze the above codebase context and provide your response following the forma
1057
1062
  // and ALWAYS falls back to the raw text on any mismatch — a schema
1058
1063
  // surprise from an older/newer `claude` CLI must degrade to exactly
1059
1064
  // today's behavior (no usage captured), never break analysis output.
1060
- const child = spawn('claude', ['--print', '--output-format', 'json'], {
1065
+ // ADR-510: `claude -p` on a fresh config loads no marketplace plugins, so
1066
+ // pass the worker profile (default ruflo-mods) as --plugin-dir and turn
1067
+ // function hooks on unless the caller set CLAUDE_CODE_ENABLE_FUNCTION_HOOKS.
1068
+ const staged = withHeadlessPlugins(['--print', '--output-format', 'json'], env, { projectRoot: this.projectRoot });
1069
+ missingPlugins = staged.missing;
1070
+ const child = spawn('claude', staged.argv, {
1061
1071
  cwd: this.projectRoot,
1062
- env,
1072
+ env: staged.env,
1063
1073
  stdio: ['pipe', 'pipe', 'pipe'],
1064
1074
  windowsHide: true, // Prevent phantom console windows on Windows
1065
1075
  detached: process.platform !== 'win32',
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.63.9",
3
+ "version": "3.65.0",
4
4
  "type": "module",
5
5
  "description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",
@@ -86,6 +86,7 @@
86
86
  "build": "tsc",
87
87
  "check:metaharness-pins": "node ../../../scripts/check-metaharness-pins.mjs",
88
88
  "test": "vitest run",
89
+ "test:real-binary": "vitest run --config vitest.real-binary.config.ts",
89
90
  "test:plugin-store": "npx tsx src/plugins/tests/standalone-test.ts",
90
91
  "test:pattern-store": "npx tsx src/transfer/store/tests/standalone-test.ts",
91
92
  "postinstall": "node ./scripts/postinstall.cjs",
@@ -1 +0,0 @@
1
- sha256:6141a8ea990c5063b77e090ae8f37f9c539d8aa8f58dcceb30f3a82f97e57319
@@ -1,42 +0,0 @@
1
- {
2
- "adoptedAt": 1793279562028,
3
- "championId": "sha256:6141a8ea990c5063b77e090ae8f37f9c539d8aa8f58dcceb30f3a82f97e57319",
4
- "manifest": {
5
- "schema": "ruflo.proven-config/v1",
6
- "policy": {
7
- "ref": "sha256:6141a8ea990c5063b77e090ae8f37f9c539d8aa8f58dcceb30f3a82f97e57319",
8
- "value": {
9
- "alpha": 0.3,
10
- "subjectWeight": 1,
11
- "mmrLambda": 0.5,
12
- "bodyWeight": 1.5,
13
- "typePenaltyFactor": 0.5
14
- }
15
- },
16
- "layer": "framework/node-cli",
17
- "compatibility": {
18
- "ruflo": ">=3.24.0"
19
- },
20
- "benchmark": {
21
- "corpus": "ADR-081-labelled-v1",
22
- "corpusHash": "sha256:2f700b5c363e20a3bd88ce2bc9b87bbbbaa61732c6177894c6ec37890f888982"
23
- },
24
- "receipt": {
25
- "heldOutDelta": 0.07381404928570845,
26
- "redblue": "PASS",
27
- "drift": 0,
28
- "canary": {
29
- "rollbackRate": 0,
30
- "latencyP95": 244.612458000076,
31
- "costPerTask": 0
32
- },
33
- "receiptCoverage": 1
34
- },
35
- "platform": [
36
- "linux",
37
- "macOS",
38
- "windows"
39
- ]
40
- },
41
- "previous": ""
42
- }