@zhixuan92/multi-model-agent 3.9.0 → 3.10.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 +2 -2
- package/dist/cli/serve.d.ts.map +1 -1
- package/dist/cli/serve.js +24 -19
- package/dist/cli/serve.js.map +1 -1
- package/dist/cli/telemetry.d.ts.map +1 -1
- package/dist/cli/telemetry.js +2 -1
- package/dist/cli/telemetry.js.map +1 -1
- package/dist/install/codex-cli.d.ts +8 -20
- package/dist/install/codex-cli.d.ts.map +1 -1
- package/dist/install/codex-cli.js +56 -290
- package/dist/install/codex-cli.js.map +1 -1
- package/dist/install/manifest-resolve.js +1 -1
- package/dist/install/manifest-resolve.js.map +1 -1
- package/dist/install/manifest.d.ts +1 -1
- package/dist/install/manifest.js +2 -2
- package/dist/install/manifest.js.map +1 -1
- package/dist/install/notify.d.ts.map +1 -1
- package/dist/install/notify.js +2 -5
- package/dist/install/notify.js.map +1 -1
- package/dist/skills/mma-audit/SKILL.md +1 -1
- package/dist/skills/mma-clarifications/SKILL.md +1 -1
- package/dist/skills/mma-context-blocks/SKILL.md +1 -1
- package/dist/skills/mma-debug/SKILL.md +1 -1
- package/dist/skills/mma-delegate/SKILL.md +1 -1
- package/dist/skills/mma-execute-plan/SKILL.md +1 -1
- package/dist/skills/mma-investigate/SKILL.md +1 -1
- package/dist/skills/mma-retry/SKILL.md +1 -1
- package/dist/skills/mma-review/SKILL.md +1 -1
- package/dist/skills/mma-verify/SKILL.md +1 -1
- package/dist/skills/multi-model-agent/SKILL.md +1 -1
- package/dist/telemetry/flusher.d.ts.map +1 -1
- package/dist/telemetry/flusher.js +6 -3
- package/dist/telemetry/flusher.js.map +1 -1
- package/dist/telemetry/install-meta.d.ts +6 -2
- package/dist/telemetry/install-meta.d.ts.map +1 -1
- package/dist/telemetry/install-meta.js +1 -24
- package/dist/telemetry/install-meta.js.map +1 -1
- package/dist/telemetry/queue.d.ts +5 -10
- package/dist/telemetry/queue.d.ts.map +1 -1
- package/dist/telemetry/queue.js.map +1 -1
- package/dist/telemetry/recorder.d.ts +1 -4
- package/dist/telemetry/recorder.d.ts.map +1 -1
- package/dist/telemetry/recorder.js +6 -43
- package/dist/telemetry/recorder.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -82,7 +82,7 @@ Two ways — pick one:
|
|
|
82
82
|
|
|
83
83
|
```bash
|
|
84
84
|
mmagent serve # 127.0.0.1:7337 by default
|
|
85
|
-
curl -s http://localhost:7337/health # → {"ok":true,"version":"3.9.
|
|
85
|
+
curl -s http://localhost:7337/health # → {"ok":true,"version":"3.9.1",...}
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
For an always-on background install (survives reboots): [launchd / systemd templates](./scripts/README.md).
|
|
@@ -285,7 +285,7 @@ Full design rationale: [DIRECTION.md](https://github.com/zhixuan312/multi-model-
|
|
|
285
285
|
|
|
286
286
|
## What's new
|
|
287
287
|
|
|
288
|
-
Latest: **3.9.
|
|
288
|
+
Latest: **3.9.1** — Codex skill installs now use Codex's native `~/.codex/skills/<skillName>/SKILL.md` layout, so all MMA skills load independently in new Codex sessions. The installer also removes the legacy MMA-managed `AGENTS.md` block while preserving user-authored `AGENTS.md` content. Full history: [CHANGELOG](https://github.com/zhixuan312/multi-model-agent/blob/master/CHANGELOG.md).
|
|
289
289
|
|
|
290
290
|
## Full documentation
|
|
291
291
|
|
package/dist/cli/serve.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/cli/serve.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/cli/serve.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAwF1E,wDAAwD;AACxD,MAAM,WAAW,WAAW;IAC1B,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAYD;;;;;;;;;;;;GAYG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,gBAAgB,EACxB,IAAI,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAkC,GACzD,OAAO,CAAC,WAAW,CAAC,CAkKtB"}
|
package/dist/cli/serve.js
CHANGED
|
@@ -131,9 +131,32 @@ export async function startServe(config, exit = process.exit.bind(process)) {
|
|
|
131
131
|
// Stripping to { server } here caused a 3.1.0 regression where tool
|
|
132
132
|
// endpoints returned 503 'no_agent_config' even when agents were set.
|
|
133
133
|
const running = await startServer(config);
|
|
134
|
-
// ── Telemetry:
|
|
134
|
+
// ── Telemetry: consent re-confirmation + recorder ─────────────────────
|
|
135
135
|
const homeDir = path.join(os.homedir(), '.multi-model');
|
|
136
136
|
const mmagentVersion = readServerVersion();
|
|
137
|
+
// V2→V3 consent re-confirmation (§7.6): V2 opt-ins do NOT auto-migrate.
|
|
138
|
+
// When telemetry is enabled but consent schemaVersion is < 3,
|
|
139
|
+
// clear the flag and prompt the user to re-confirm.
|
|
140
|
+
const configPath = path.join(homeDir, 'config.json');
|
|
141
|
+
try {
|
|
142
|
+
const raw = fs.readFileSync(configPath, 'utf8');
|
|
143
|
+
const cfg = JSON.parse(raw);
|
|
144
|
+
const telemetry = (cfg.telemetry ?? {});
|
|
145
|
+
if (telemetry.enabled === true) {
|
|
146
|
+
const consentVersion = telemetry.consentSchemaVersion;
|
|
147
|
+
if ((consentVersion ?? 0) < 3) {
|
|
148
|
+
telemetry.enabled = false;
|
|
149
|
+
telemetry.consentSchemaVersion = 3;
|
|
150
|
+
cfg.telemetry = telemetry;
|
|
151
|
+
fs.writeFileSync(configPath, JSON.stringify(cfg, null, 2) + '\n', { mode: 0o600 });
|
|
152
|
+
stderr('mmagent: telemetry schema upgraded to v3; previous opt-in cleared.\n');
|
|
153
|
+
stderr('Run "mmagent telemetry enable" to opt in to schema v3.\n');
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
// no config file, first run — nothing to migrate
|
|
159
|
+
}
|
|
137
160
|
const recorder = createRecorder({ homeDir, mmagentVersion });
|
|
138
161
|
const lastVersionPath = path.join(homeDir, 'last-version');
|
|
139
162
|
let lastVersion = null;
|
|
@@ -149,7 +172,6 @@ export async function startServe(config, exit = process.exit.bind(process)) {
|
|
|
149
172
|
: compareSemver(lastVersion, mmagentVersion) < 0
|
|
150
173
|
? 'upgrade'
|
|
151
174
|
: 'downgrade';
|
|
152
|
-
recorder.recordInstallChanged(lastVersion, mmagentVersion, trigger);
|
|
153
175
|
try {
|
|
154
176
|
fs.mkdirSync(homeDir, { recursive: true });
|
|
155
177
|
fs.writeFileSync(lastVersionPath, mmagentVersion + '\n', { mode: 0o600 });
|
|
@@ -158,23 +180,6 @@ export async function startServe(config, exit = process.exit.bind(process)) {
|
|
|
158
180
|
stderr(`[mmagent] warning: failed to write last-version at ${lastVersionPath}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
159
181
|
}
|
|
160
182
|
}
|
|
161
|
-
const providersConfigured = new Set();
|
|
162
|
-
for (const agent of Object.values(config.agents)) {
|
|
163
|
-
const t = agent.type;
|
|
164
|
-
if (t === 'claude' || t === 'claude-compatible')
|
|
165
|
-
providersConfigured.add('claude');
|
|
166
|
-
else if (t === 'openai-compatible')
|
|
167
|
-
providersConfigured.add('openai-compatible');
|
|
168
|
-
else if (t === 'codex')
|
|
169
|
-
providersConfigured.add('codex');
|
|
170
|
-
}
|
|
171
|
-
const snapshot = {
|
|
172
|
-
defaultTier: 'standard',
|
|
173
|
-
diagnosticsEnabled: config.diagnostics?.log ?? false,
|
|
174
|
-
autoUpdateSkills: config.server.autoUpdateSkills,
|
|
175
|
-
providersConfigured: [...providersConfigured],
|
|
176
|
-
};
|
|
177
|
-
recorder.recordSessionStarted(snapshot);
|
|
178
183
|
// Telemetry uploader. Default endpoint ships to the project's hosted
|
|
179
184
|
// dashboard. MMAGENT_TELEMETRY_ENDPOINT overrides for self-hosted backends;
|
|
180
185
|
// setting it to an empty string disables shipping entirely (events stay in
|
package/dist/cli/serve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../src/cli/serve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,4BAA4B,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../src/cli/serve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,4BAA4B,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,KAAK,EA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AAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;IAChC,uBAAuB;IACvB,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;CACjC;
|
|
1
|
+
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/cli/telemetry.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAC;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,uBAAuB;IACvB,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;IAChC,uBAAuB;IACvB,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;CACjC;AAyJD,wBAAsB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAavE"}
|
package/dist/cli/telemetry.js
CHANGED
|
@@ -79,10 +79,11 @@ async function runEnable(deps) {
|
|
|
79
79
|
}
|
|
80
80
|
const telemetry = (cfg.telemetry ?? {});
|
|
81
81
|
telemetry.enabled = true;
|
|
82
|
+
telemetry.consentSchemaVersion = 3;
|
|
82
83
|
cfg.telemetry = telemetry;
|
|
83
84
|
try {
|
|
84
85
|
writeConfigObj(deps.homeDir, cfg);
|
|
85
|
-
stdout('Telemetry enabled (config.telemetry.enabled = true)\n');
|
|
86
|
+
stdout('Telemetry enabled (config.telemetry.enabled = true, schema v3)\n');
|
|
86
87
|
return 0;
|
|
87
88
|
}
|
|
88
89
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../src/cli/telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,S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AAC,CAAC;YACxE,MAAM,CAAC,0CAA2C,IAAY,CAAC,UAAU,KAAK,CAAC,CAAC;YAChF,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface CodexCliInstallOpts {
|
|
2
|
-
/** Human-readable name of the skill (used in
|
|
2
|
+
/** Human-readable name of the skill (used in file path). */
|
|
3
3
|
skillName: string;
|
|
4
|
-
/** Raw skill content
|
|
4
|
+
/** Raw skill content, possibly containing @include directives. */
|
|
5
5
|
content: string;
|
|
6
6
|
/**
|
|
7
7
|
* Home directory — replaces `os.homedir()` in all file operations.
|
|
@@ -12,28 +12,16 @@ export interface CodexCliInstallOpts {
|
|
|
12
12
|
skillsRoot: string;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Write (or overwrite) the
|
|
15
|
+
* Write (or overwrite) the SKILL.md file for a Codex CLI skill.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
* 1. Inline @include directives.
|
|
19
|
-
* 2. Read existing file if present.
|
|
20
|
-
* 3. Determine new content: create / append / replace.
|
|
21
|
-
* 4. Write to disk.
|
|
22
|
-
*
|
|
23
|
-
* @throws If the AGENTS.md file exists but cannot be read.
|
|
24
|
-
* @throws If the AGENTS.md path is a directory.
|
|
17
|
+
* Target path: `<homeDir>/.codex/skills/<skillName>/SKILL.md`
|
|
25
18
|
*/
|
|
26
19
|
export declare function installCodexCli(opts: CodexCliInstallOpts): void;
|
|
27
20
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* Behaviour:
|
|
31
|
-
* - File does not exist → no-op.
|
|
32
|
-
* - File has no managed block markers → no-op (file unchanged).
|
|
33
|
-
* - File has managed block → remove it; write remaining content back.
|
|
34
|
-
* - Remaining content is empty or whitespace-only → delete the file.
|
|
21
|
+
* Uninstall a Codex CLI skill by removing its directory.
|
|
35
22
|
*
|
|
36
|
-
*
|
|
23
|
+
* This is a no-op when the directory does not exist or when `skillName` would
|
|
24
|
+
* escape the Codex skills directory.
|
|
37
25
|
*/
|
|
38
|
-
export declare function uninstallCodexCli(homeDir: string): void;
|
|
26
|
+
export declare function uninstallCodexCli(skillName: string, homeDir: string): void;
|
|
39
27
|
//# sourceMappingURL=codex-cli.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-cli.d.ts","sourceRoot":"","sources":["../../src/install/codex-cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"codex-cli.d.ts","sourceRoot":"","sources":["../../src/install/codex-cli.ts"],"names":[],"mappings":"AAqBA,MAAM,WAAW,mBAAmB;IAClC,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC;CACpB;AAuCD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAW/D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAK1E"}
|
|
@@ -1,318 +1,84 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Codex CLI skill writer for install-skill.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Writes each skill's SKILL.md to `<homeDir>/.codex/skills/<skillName>/SKILL.md`.
|
|
5
|
+
* Codex discovers skills from that directory on the next session start. Existing
|
|
6
|
+
* `AGENTS.md` instructions are user-owned and are not modified by this writer.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* <!-- multi-model-agent:END -->
|
|
11
|
-
*
|
|
12
|
-
* Install behaviour:
|
|
13
|
-
* - If AGENTS.md does NOT exist: create it with just the managed block.
|
|
14
|
-
* - If AGENTS.md exists but has NO managed block markers: append the block
|
|
15
|
-
* at the end with a blank-line separator.
|
|
16
|
-
* - If AGENTS.md exists WITH managed block markers: replace the content
|
|
17
|
-
* between (and including) the markers with the new managed block.
|
|
18
|
-
* - User content OUTSIDE the markers is preserved verbatim.
|
|
19
|
-
*
|
|
20
|
-
* Uninstall behaviour:
|
|
21
|
-
* - Remove the managed block (including markers) from AGENTS.md.
|
|
22
|
-
* - If the file becomes empty or only whitespace after removal, delete the
|
|
23
|
-
* file.
|
|
24
|
-
* - If the file does not contain the markers, do nothing (no error).
|
|
25
|
-
* - If the file does not exist, do nothing (no error).
|
|
26
|
-
*
|
|
27
|
-
* @include resolution:
|
|
28
|
-
* Lines beginning with `@include _shared/<file>.md` are replaced with the
|
|
29
|
-
* file content read from `<skillsRoot>/_shared/<file>.md`. If the file
|
|
30
|
-
* cannot be read, a warning is written to stderr and the line is omitted
|
|
31
|
-
* from the output (the directive is NOT preserved — matching the Claude Code
|
|
32
|
-
* writer behaviour).
|
|
33
|
-
*
|
|
34
|
-
* Security: @include paths must begin with `_shared/` and are resolved
|
|
35
|
-
* strictly within `<skillsRoot>/_shared/` to prevent path traversal.
|
|
8
|
+
* Before writing, any `@include _shared/<file>.md` directives are inlined using
|
|
9
|
+
* the shared include utility. Missing shared files are warned about and omitted,
|
|
10
|
+
* matching the other client writers.
|
|
36
11
|
*
|
|
37
12
|
* @module
|
|
38
13
|
*/
|
|
39
14
|
import fs from 'node:fs';
|
|
40
15
|
import path from 'node:path';
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
* Build the complete managed block string including delimiters.
|
|
47
|
-
*
|
|
48
|
-
* Block format:
|
|
49
|
-
* <!-- multi-model-agent:BEGIN -->
|
|
50
|
-
* <content>
|
|
51
|
-
* <!-- multi-model-agent:END -->
|
|
52
|
-
*
|
|
53
|
-
* Key newline rules:
|
|
54
|
-
* - BEGIN is always followed by `\n` so content starts on its own line.
|
|
55
|
-
* - The content line(s) end with a newline. If content doesn't already end
|
|
56
|
-
* with `\n`, we add one before END.
|
|
57
|
-
* - END is the final line of the block; no trailing newline is added after
|
|
58
|
-
* END (the block ends with the `>` character of the END tag).
|
|
59
|
-
*
|
|
60
|
-
* This means the block always ends with `MANAGED_END` as the last characters
|
|
61
|
-
* of the file (no trailing newline after it).
|
|
62
|
-
*/
|
|
63
|
-
function buildManagedBlock(inlinedContent) {
|
|
64
|
-
const contentEndsWithNewline = inlinedContent.endsWith('\n');
|
|
65
|
-
// Block format: BEGIN + "\n" + content (ending with \n) + END
|
|
66
|
-
// No trailing newline after END — callers join suffix directly.
|
|
67
|
-
return `${MANAGED_BEGIN}\n${inlinedContent}${contentEndsWithNewline ? '' : '\n'}${MANAGED_END}`;
|
|
68
|
-
}
|
|
69
|
-
// ─── @include inlining (private) ─────────────────────────────────────────────
|
|
70
|
-
/**
|
|
71
|
-
* Inline `@include _shared/<path>` directives in `content`.
|
|
72
|
-
*
|
|
73
|
-
* Each line matching `@include _shared/<path>` is replaced with the full
|
|
74
|
-
* content of the corresponding file under `<skillsRoot>/_shared/<path>`.
|
|
75
|
-
*
|
|
76
|
-
* Security constraints:
|
|
77
|
-
* - Only paths beginning with `_shared/` are accepted.
|
|
78
|
-
* - The resolved path must stay within `<skillsRoot>/_shared/`. Path
|
|
79
|
-
* traversal attempts (e.g. `_shared/../secrets.txt`) are rejected with a
|
|
80
|
-
* warning and the directive line is dropped.
|
|
81
|
-
*
|
|
82
|
-
* Missing shared files:
|
|
83
|
-
* - A warning containing "missing shared file" is written to stderr.
|
|
84
|
-
* - The directive line is dropped (not preserved) — matching the Claude
|
|
85
|
-
* Code writer behaviour as required by the brief.
|
|
86
|
-
*
|
|
87
|
-
* @param skillName Used in warning messages to identify the skill.
|
|
88
|
-
* @param content Raw skill content (may contain @include directives).
|
|
89
|
-
* @param skillsRoot Root directory containing `_shared/`.
|
|
90
|
-
* @returns The content with directives inlined.
|
|
91
|
-
*/
|
|
92
|
-
function inlineIncludes(skillName, content, skillsRoot) {
|
|
93
|
-
const lines = content.split('\n');
|
|
94
|
-
const result = [];
|
|
95
|
-
for (const line of lines) {
|
|
96
|
-
const match = line.match(/^@include\s+(.+)$/);
|
|
97
|
-
if (!match) {
|
|
98
|
-
result.push(line);
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
// Trim trailing whitespace from the path token.
|
|
102
|
-
const relativePath = match[1].trimEnd();
|
|
103
|
-
// Security: only accept paths beginning with `_shared/`
|
|
104
|
-
if (!relativePath.startsWith('_shared/')) {
|
|
105
|
-
process.stderr.write(`Warning: Codex CLI skill writer [${skillName}]: @include path must ` +
|
|
106
|
-
`start with "_shared/": ${relativePath}\n`);
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
// Security: reject path traversal attempts
|
|
110
|
-
const resolvedPath = path.resolve(skillsRoot, relativePath);
|
|
111
|
-
const sharedDir = path.resolve(skillsRoot, '_shared');
|
|
112
|
-
if (!resolvedPath.startsWith(sharedDir + path.sep) &&
|
|
113
|
-
resolvedPath !== sharedDir) {
|
|
114
|
-
process.stderr.write(`Warning: Codex CLI skill writer [${skillName}]: @include path ` +
|
|
115
|
-
`rejected (path traversal): ${relativePath}\n`);
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
const sharedFilePath = path.join(skillsRoot, relativePath);
|
|
119
|
-
try {
|
|
120
|
-
const sharedContent = fs.readFileSync(sharedFilePath, 'utf-8');
|
|
121
|
-
result.push(sharedContent);
|
|
122
|
-
}
|
|
123
|
-
catch (err) {
|
|
124
|
-
const nodeErr = err;
|
|
125
|
-
if (nodeErr.code === 'ENOENT') {
|
|
126
|
-
process.stderr.write(`Warning: Codex CLI skill writer [${skillName}]: missing shared ` +
|
|
127
|
-
`file: ${sharedFilePath} (referenced by @include ${relativePath})\n`);
|
|
128
|
-
// Directive is dropped — do not push anything.
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
// Permission errors, EISDIR, etc. — re-throw so the caller notices.
|
|
132
|
-
throw err;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return result.join('\n');
|
|
137
|
-
}
|
|
138
|
-
// ─── Marker helpers ────────────────────────────────────────────────────────────
|
|
139
|
-
/**
|
|
140
|
-
* Returns true only when both managed block markers are present in
|
|
141
|
-
* `content` and BEGIN appears before END. An orphan marker or corrupt
|
|
142
|
-
* ordering does NOT constitute a valid block.
|
|
143
|
-
*/
|
|
144
|
-
function hasManagedBlock(content) {
|
|
145
|
-
const beginIdx = content.indexOf(MANAGED_BEGIN);
|
|
146
|
-
const endIdx = content.indexOf(MANAGED_END);
|
|
147
|
-
return beginIdx !== -1 && endIdx !== -1 && beginIdx < endIdx;
|
|
16
|
+
import { inlineIncludes } from './include-utils.js';
|
|
17
|
+
const LEGACY_MANAGED_BEGIN = '<!-- multi-model-agent:BEGIN -->';
|
|
18
|
+
const LEGACY_MANAGED_END = '<!-- multi-model-agent:END -->';
|
|
19
|
+
function codexSkillsBase(homeDir) {
|
|
20
|
+
return path.resolve(homeDir, '.codex', 'skills');
|
|
148
21
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
* before BEGIN and `suffix` is everything after the block's final character.
|
|
154
|
-
*
|
|
155
|
-
* The block always ends with `MANAGED_END` (no trailing newline after END).
|
|
156
|
-
* After END, there may be a structural newline (the newline that terminates
|
|
157
|
-
* the END line). This structural newline is NOT part of the user suffix — it
|
|
158
|
-
* belongs to the block boundary and must not appear as an extra blank line
|
|
159
|
-
* when prefix and suffix are joined.
|
|
160
|
-
*
|
|
161
|
-
* Edge cases:
|
|
162
|
-
* - If END is the last character of the file (no trailing newline), suffix
|
|
163
|
-
* is empty.
|
|
164
|
-
* - If BEGIN and END are in corrupt order (END before BEGIN), returns null
|
|
165
|
-
* so no user content is inadvertently destroyed.
|
|
166
|
-
*/
|
|
167
|
-
function splitAroundBlock(content) {
|
|
168
|
-
const beginIdx = content.indexOf(MANAGED_BEGIN);
|
|
169
|
-
const endIdx = content.indexOf(MANAGED_END);
|
|
170
|
-
// No valid block without both markers
|
|
171
|
-
if (beginIdx === -1 || endIdx === -1) {
|
|
172
|
-
return null;
|
|
173
|
-
}
|
|
174
|
-
// Corrupt order: END before BEGIN — treat as no valid block to protect
|
|
175
|
-
// user content from inadvertent removal.
|
|
176
|
-
if (beginIdx > endIdx) {
|
|
22
|
+
function resolveSkillDir(homeDir, skillName) {
|
|
23
|
+
const base = codexSkillsBase(homeDir);
|
|
24
|
+
const resolved = path.resolve(base, path.normalize(skillName));
|
|
25
|
+
if (!resolved.startsWith(base + path.sep))
|
|
177
26
|
return null;
|
|
178
|
-
|
|
179
|
-
// suffix starts immediately after MANAGED_END (includes any trailing newlines).
|
|
180
|
-
// Callers decide how to handle the leading newlines in suffix:
|
|
181
|
-
// - Install (replace): suffix begins with the separator between END and
|
|
182
|
-
// following user content; joining block + suffix reconstructs the file.
|
|
183
|
-
// - Uninstall: strip all leading newlines from suffix before joining.
|
|
184
|
-
const suffixStart = endIdx + MANAGED_END.length;
|
|
185
|
-
return {
|
|
186
|
-
prefix: content.slice(0, beginIdx),
|
|
187
|
-
suffix: content.slice(suffixStart),
|
|
188
|
-
};
|
|
27
|
+
return resolved;
|
|
189
28
|
}
|
|
190
|
-
|
|
191
|
-
* Write (or overwrite) the managed block in the Codex CLI's AGENTS.md.
|
|
192
|
-
*
|
|
193
|
-
* The algorithm:
|
|
194
|
-
* 1. Inline @include directives.
|
|
195
|
-
* 2. Read existing file if present.
|
|
196
|
-
* 3. Determine new content: create / append / replace.
|
|
197
|
-
* 4. Write to disk.
|
|
198
|
-
*
|
|
199
|
-
* @throws If the AGENTS.md file exists but cannot be read.
|
|
200
|
-
* @throws If the AGENTS.md path is a directory.
|
|
201
|
-
*/
|
|
202
|
-
export function installCodexCli(opts) {
|
|
203
|
-
const agentsPath = path.join(opts.homeDir, '.codex', 'AGENTS.md');
|
|
204
|
-
// 1. Inline @include directives
|
|
205
|
-
const inlinedContent = inlineIncludes(opts.skillName, opts.content, opts.skillsRoot);
|
|
206
|
-
const block = buildManagedBlock(inlinedContent);
|
|
207
|
-
// 2. Read existing file
|
|
208
|
-
let existingContent;
|
|
209
|
-
let fileExists = false;
|
|
210
|
-
try {
|
|
211
|
-
const stat = fs.statSync(agentsPath);
|
|
212
|
-
if (stat.isDirectory()) {
|
|
213
|
-
throw new Error(`AGENTS.md path is a directory: ${agentsPath}`);
|
|
214
|
-
}
|
|
215
|
-
existingContent = fs.readFileSync(agentsPath, 'utf-8');
|
|
216
|
-
fileExists = true;
|
|
217
|
-
}
|
|
218
|
-
catch (err) {
|
|
219
|
-
if (err.code === 'ENOENT') {
|
|
220
|
-
existingContent = '';
|
|
221
|
-
fileExists = false;
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
throw err;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
// 3. Determine new content
|
|
228
|
-
let newContent;
|
|
229
|
-
if (!fileExists) {
|
|
230
|
-
// Case A: file does not exist → create with just the managed block
|
|
231
|
-
newContent = block;
|
|
232
|
-
}
|
|
233
|
-
else if (!hasManagedBlock(existingContent)) {
|
|
234
|
-
// Case B: file exists but no managed block → append with blank-line separator
|
|
235
|
-
//
|
|
236
|
-
// The block begins with BEGIN + "\n". To create exactly one blank line
|
|
237
|
-
// between existing content and the BEGIN marker:
|
|
238
|
-
// - If existingContent ends with "\n": add one "\n" → existing ends with
|
|
239
|
-
// "\n", block starts with "\n" → two newlines = one blank line. ✓
|
|
240
|
-
// - If existingContent does NOT end with "\n": add "\n\n" → existing ends
|
|
241
|
-
// with "\n", block starts with "\n" → two newlines = one blank line. ✓
|
|
242
|
-
newContent = existingContent.endsWith('\n')
|
|
243
|
-
? `${existingContent}\n${block}`
|
|
244
|
-
: `${existingContent}\n\n${block}`;
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
// Case C: file exists with managed block → replace it
|
|
248
|
-
const split = splitAroundBlock(existingContent);
|
|
249
|
-
if (split === null) {
|
|
250
|
-
// Both markers present but split returned null — corrupt marker order.
|
|
251
|
-
// Do not overwrite; append with separator instead.
|
|
252
|
-
newContent = existingContent.endsWith('\n')
|
|
253
|
-
? `${existingContent}\n${block}`
|
|
254
|
-
: `${existingContent}\n\n${block}`;
|
|
255
|
-
}
|
|
256
|
-
else {
|
|
257
|
-
const { prefix, suffix } = split;
|
|
258
|
-
newContent = `${prefix}${block}${suffix}`;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
// 4. Write to disk
|
|
262
|
-
fs.mkdirSync(path.join(opts.homeDir, '.codex'), { recursive: true });
|
|
263
|
-
fs.writeFileSync(agentsPath, newContent, 'utf-8');
|
|
264
|
-
}
|
|
265
|
-
// ─── Uninstall ────────────────────────────────────────────────────────────────
|
|
266
|
-
/**
|
|
267
|
-
* Remove the managed block (including markers) from AGENTS.md.
|
|
268
|
-
*
|
|
269
|
-
* Behaviour:
|
|
270
|
-
* - File does not exist → no-op.
|
|
271
|
-
* - File has no managed block markers → no-op (file unchanged).
|
|
272
|
-
* - File has managed block → remove it; write remaining content back.
|
|
273
|
-
* - Remaining content is empty or whitespace-only → delete the file.
|
|
274
|
-
*
|
|
275
|
-
* @throws On filesystem errors other than ENOENT when reading/writing.
|
|
276
|
-
*/
|
|
277
|
-
export function uninstallCodexCli(homeDir) {
|
|
29
|
+
function removeLegacyManagedAgentsBlock(homeDir) {
|
|
278
30
|
const agentsPath = path.join(homeDir, '.codex', 'AGENTS.md');
|
|
279
31
|
let content;
|
|
280
32
|
try {
|
|
281
33
|
content = fs.readFileSync(agentsPath, 'utf-8');
|
|
282
34
|
}
|
|
283
35
|
catch (err) {
|
|
284
|
-
if (err.code === 'ENOENT')
|
|
285
|
-
// File does not exist — no-op.
|
|
36
|
+
if (err.code === 'ENOENT')
|
|
286
37
|
return;
|
|
287
|
-
}
|
|
288
|
-
// Re-throw on read errors, preserving the original error context.
|
|
289
38
|
throw err;
|
|
290
39
|
}
|
|
291
|
-
|
|
292
|
-
|
|
40
|
+
const beginIdx = content.indexOf(LEGACY_MANAGED_BEGIN);
|
|
41
|
+
const endIdx = content.indexOf(LEGACY_MANAGED_END);
|
|
42
|
+
if (beginIdx === -1 || endIdx === -1 || beginIdx > endIdx)
|
|
293
43
|
return;
|
|
294
|
-
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
const { prefix, suffix } = split;
|
|
302
|
-
// Strip all leading newlines from suffix. The suffix begins with any
|
|
303
|
-
// newlines that followed MANAGED_END (including blank-line separators).
|
|
304
|
-
// Removing them avoids leaving orphan blank lines after the managed block
|
|
305
|
-
// is gone. The prefix already ends before BEGIN (including any trailing
|
|
306
|
-
// newlines the user placed before the block), so this does not disturb
|
|
307
|
-
// user-authored spacing in the prefix.
|
|
308
|
-
const trimmedSuffix = suffix.replace(/^\n+/, '');
|
|
309
|
-
const newContent = `${prefix}${trimmedSuffix}`;
|
|
310
|
-
if (newContent.trim() === '') {
|
|
311
|
-
// File is empty after removal — delete it.
|
|
44
|
+
const suffixStart = endIdx + LEGACY_MANAGED_END.length;
|
|
45
|
+
const prefix = content.slice(0, beginIdx);
|
|
46
|
+
const suffix = content.slice(suffixStart).replace(/^\n+/, '');
|
|
47
|
+
const nextContent = `${prefix}${suffix}`;
|
|
48
|
+
if (nextContent.trim() === '') {
|
|
312
49
|
fs.unlinkSync(agentsPath);
|
|
313
50
|
}
|
|
314
51
|
else {
|
|
315
|
-
fs.writeFileSync(agentsPath,
|
|
52
|
+
fs.writeFileSync(agentsPath, nextContent, 'utf-8');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Write (or overwrite) the SKILL.md file for a Codex CLI skill.
|
|
57
|
+
*
|
|
58
|
+
* Target path: `<homeDir>/.codex/skills/<skillName>/SKILL.md`
|
|
59
|
+
*/
|
|
60
|
+
export function installCodexCli(opts) {
|
|
61
|
+
const { skillName, content, homeDir, skillsRoot } = opts;
|
|
62
|
+
const skillDir = resolveSkillDir(homeDir, skillName);
|
|
63
|
+
if (skillDir === null) {
|
|
64
|
+
throw new Error(`Invalid Codex CLI skill name: ${skillName}`);
|
|
316
65
|
}
|
|
66
|
+
removeLegacyManagedAgentsBlock(homeDir);
|
|
67
|
+
const inlinedContent = inlineIncludes('Codex CLI skill writer', content, skillsRoot);
|
|
68
|
+
fs.mkdirSync(skillDir, { recursive: true });
|
|
69
|
+
fs.writeFileSync(path.join(skillDir, 'SKILL.md'), inlinedContent, 'utf-8');
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Uninstall a Codex CLI skill by removing its directory.
|
|
73
|
+
*
|
|
74
|
+
* This is a no-op when the directory does not exist or when `skillName` would
|
|
75
|
+
* escape the Codex skills directory.
|
|
76
|
+
*/
|
|
77
|
+
export function uninstallCodexCli(skillName, homeDir) {
|
|
78
|
+
removeLegacyManagedAgentsBlock(homeDir);
|
|
79
|
+
const skillDir = resolveSkillDir(homeDir, skillName);
|
|
80
|
+
if (skillDir === null)
|
|
81
|
+
return;
|
|
82
|
+
fs.rmSync(skillDir, { recursive: true, force: true });
|
|
317
83
|
}
|
|
318
84
|
//# sourceMappingURL=codex-cli.js.map
|