@zhixuan92/multi-model-agent 4.0.1 → 4.0.3
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 +31 -21
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +9 -24
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/serve.d.ts.map +1 -1
- package/dist/cli/serve.js +16 -58
- package/dist/cli/serve.js.map +1 -1
- package/dist/cli/status.js +1 -1
- package/dist/cli/status.js.map +1 -1
- package/dist/cli/sync-skills.d.ts +62 -0
- package/dist/cli/sync-skills.d.ts.map +1 -0
- package/dist/cli/sync-skills.js +251 -0
- package/dist/cli/sync-skills.js.map +1 -0
- package/dist/cli/telemetry.js +2 -2
- package/dist/cli/telemetry.js.map +1 -1
- package/dist/http/async-dispatch.d.ts +11 -0
- package/dist/http/async-dispatch.d.ts.map +1 -1
- package/dist/http/async-dispatch.js +112 -7
- package/dist/http/async-dispatch.js.map +1 -1
- package/dist/http/execution-context.d.ts +4 -1
- package/dist/http/execution-context.d.ts.map +1 -1
- package/dist/http/execution-context.js +14 -6
- package/dist/http/execution-context.js.map +1 -1
- package/dist/http/handlers/control/batch.d.ts.map +1 -1
- package/dist/http/handlers/control/batch.js +74 -6
- package/dist/http/handlers/control/batch.js.map +1 -1
- package/dist/http/handlers/control/retry.d.ts.map +1 -1
- package/dist/http/handlers/control/retry.js +1 -0
- package/dist/http/handlers/control/retry.js.map +1 -1
- package/dist/http/handlers/introspection/status.js +1 -1
- package/dist/http/handlers/tools/audit.d.ts.map +1 -1
- package/dist/http/handlers/tools/audit.js +1 -0
- package/dist/http/handlers/tools/audit.js.map +1 -1
- package/dist/http/handlers/tools/debug.d.ts.map +1 -1
- package/dist/http/handlers/tools/debug.js +1 -0
- package/dist/http/handlers/tools/debug.js.map +1 -1
- package/dist/http/handlers/tools/delegate.d.ts.map +1 -1
- package/dist/http/handlers/tools/delegate.js +1 -0
- package/dist/http/handlers/tools/delegate.js.map +1 -1
- package/dist/http/handlers/tools/execute-plan.d.ts.map +1 -1
- package/dist/http/handlers/tools/execute-plan.js +1 -0
- package/dist/http/handlers/tools/execute-plan.js.map +1 -1
- package/dist/http/handlers/tools/explore.d.ts.map +1 -1
- package/dist/http/handlers/tools/explore.js +1 -0
- package/dist/http/handlers/tools/explore.js.map +1 -1
- package/dist/http/handlers/tools/investigate.d.ts.map +1 -1
- package/dist/http/handlers/tools/investigate.js +1 -0
- package/dist/http/handlers/tools/investigate.js.map +1 -1
- package/dist/http/handlers/tools/retry.d.ts.map +1 -1
- package/dist/http/handlers/tools/retry.js +1 -0
- package/dist/http/handlers/tools/retry.js.map +1 -1
- package/dist/http/handlers/tools/review.d.ts.map +1 -1
- package/dist/http/handlers/tools/review.js +1 -0
- package/dist/http/handlers/tools/review.js.map +1 -1
- package/dist/http/handlers/tools/verify.d.ts.map +1 -1
- package/dist/http/handlers/tools/verify.js +1 -0
- package/dist/http/handlers/tools/verify.js.map +1 -1
- package/dist/http/middleware/caller-identity.d.ts +6 -3
- package/dist/http/middleware/caller-identity.d.ts.map +1 -1
- package/dist/http/middleware/caller-identity.js +5 -16
- package/dist/http/middleware/caller-identity.js.map +1 -1
- package/dist/http/project-registry.d.ts +9 -0
- package/dist/http/project-registry.d.ts.map +1 -1
- package/dist/http/project-registry.js +6 -2
- package/dist/http/project-registry.js.map +1 -1
- package/dist/http/request-pipeline.d.ts +3 -0
- package/dist/http/request-pipeline.d.ts.map +1 -1
- package/dist/http/request-pipeline.js +11 -1
- package/dist/http/request-pipeline.js.map +1 -1
- package/dist/http/server.d.ts.map +1 -1
- package/dist/http/server.js +30 -3
- package/dist/http/server.js.map +1 -1
- package/dist/http/types.d.ts +3 -2
- package/dist/http/types.d.ts.map +1 -1
- package/dist/skills/_shared/auth.md +25 -12
- package/dist/skills/mma-audit/SKILL.md +3 -1
- package/dist/skills/mma-context-blocks/SKILL.md +5 -1
- package/dist/skills/mma-debug/SKILL.md +3 -1
- package/dist/skills/mma-delegate/SKILL.md +3 -1
- package/dist/skills/mma-execute-plan/SKILL.md +3 -1
- package/dist/skills/mma-explore/SKILL.md +3 -1
- package/dist/skills/mma-investigate/SKILL.md +3 -1
- package/dist/skills/mma-retry/SKILL.md +3 -1
- package/dist/skills/mma-review/SKILL.md +3 -1
- package/dist/skills/mma-verify/SKILL.md +3 -1
- package/dist/skills/multi-model-agent/SKILL.md +1 -1
- package/dist/telemetry/recorder.js +3 -0
- package/dist/telemetry/recorder.js.map +1 -1
- package/package.json +3 -2
- package/scripts/postinstall.js +2 -2
- package/dist/cli/install-skill.d.ts +0 -78
- package/dist/cli/install-skill.d.ts.map +0 -1
- package/dist/cli/install-skill.js +0 -304
- package/dist/cli/install-skill.js.map +0 -1
- package/dist/cli/update-skills.d.ts +0 -16
- package/dist/cli/update-skills.d.ts.map +0 -1
- package/dist/cli/update-skills.js +0 -158
- package/dist/cli/update-skills.js.map +0 -1
- package/dist/http/loopback.d.ts +0 -17
- package/dist/http/loopback.d.ts.map +0 -1
- package/dist/http/loopback.js +0 -43
- package/dist/http/loopback.js.map +0 -1
- package/dist/http/router.d.ts +0 -19
- package/dist/http/router.d.ts.map +0 -1
- package/dist/http/router.js +0 -51
- package/dist/http/router.js.map +0 -1
- package/dist/http/wire/delegate-wire.d.ts +0 -4
- package/dist/http/wire/delegate-wire.d.ts.map +0 -1
- package/dist/http/wire/delegate-wire.js +0 -16
- package/dist/http/wire/delegate-wire.js.map +0 -1
- package/dist/http/wire/execute-plan-wire.d.ts +0 -18
- package/dist/http/wire/execute-plan-wire.d.ts.map +0 -1
- package/dist/http/wire/execute-plan-wire.js +0 -26
- package/dist/http/wire/execute-plan-wire.js.map +0 -1
- package/dist/http/wire/registry.d.ts +0 -3
- package/dist/http/wire/registry.d.ts.map +0 -1
- package/dist/http/wire/registry.js +0 -20
- package/dist/http/wire/registry.js.map +0 -1
- package/dist/install/claude-code.d.ts +0 -43
- package/dist/install/claude-code.d.ts.map +0 -1
- package/dist/install/claude-code.js +0 -65
- package/dist/install/claude-code.js.map +0 -1
- package/dist/install/codex-cli.d.ts +0 -27
- package/dist/install/codex-cli.d.ts.map +0 -1
- package/dist/install/codex-cli.js +0 -84
- package/dist/install/codex-cli.js.map +0 -1
- package/dist/install/cursor.d.ts +0 -72
- package/dist/install/cursor.d.ts.map +0 -1
- package/dist/install/cursor.js +0 -81
- package/dist/install/cursor.js.map +0 -1
- package/dist/install/discover.d.ts +0 -27
- package/dist/install/discover.d.ts.map +0 -1
- package/dist/install/discover.js +0 -67
- package/dist/install/discover.js.map +0 -1
- package/dist/install/gemini-cli.d.ts +0 -66
- package/dist/install/gemini-cli.d.ts.map +0 -1
- package/dist/install/gemini-cli.js +0 -111
- package/dist/install/gemini-cli.js.map +0 -1
- package/dist/install/headers.d.ts +0 -17
- package/dist/install/headers.d.ts.map +0 -1
- package/dist/install/headers.js +0 -22
- package/dist/install/headers.js.map +0 -1
- package/dist/install/include-utils.d.ts +0 -27
- package/dist/install/include-utils.d.ts.map +0 -1
- package/dist/install/include-utils.js +0 -90
- package/dist/install/include-utils.js.map +0 -1
- package/dist/install/manifest-resolve.d.ts +0 -17
- package/dist/install/manifest-resolve.d.ts.map +0 -1
- package/dist/install/manifest-resolve.js +0 -78
- package/dist/install/manifest-resolve.js.map +0 -1
- package/dist/install/manifest.d.ts +0 -94
- package/dist/install/manifest.d.ts.map +0 -1
- package/dist/install/manifest.js +0 -234
- package/dist/install/manifest.js.map +0 -1
- package/dist/install/missing-skills.d.ts +0 -20
- package/dist/install/missing-skills.d.ts.map +0 -1
- package/dist/install/missing-skills.js +0 -42
- package/dist/install/missing-skills.js.map +0 -1
- package/dist/install/notify.d.ts +0 -6
- package/dist/install/notify.d.ts.map +0 -1
- package/dist/install/notify.js +0 -13
- package/dist/install/notify.js.map +0 -1
- package/dist/install/orchestrate.d.ts +0 -47
- package/dist/install/orchestrate.d.ts.map +0 -1
- package/dist/install/orchestrate.js +0 -98
- package/dist/install/orchestrate.js.map +0 -1
- package/dist/install/skill-manifest-sync.d.ts +0 -11
- package/dist/install/skill-manifest-sync.d.ts.map +0 -1
- package/dist/install/skill-manifest-sync.js +0 -65
- package/dist/install/skill-manifest-sync.js.map +0 -1
- package/dist/openapi.d.ts +0 -15
- package/dist/openapi.d.ts.map +0 -1
- package/dist/openapi.js +0 -286
- package/dist/openapi.js.map +0 -1
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Client } from './manifest.js';
|
|
2
|
-
export declare const SUPPORTED_SKILLS: readonly ["multi-model-agent", "mma-delegate", "mma-audit", "mma-review", "mma-verify", "mma-debug", "mma-execute-plan", "mma-retry", "mma-context-blocks", "mma-investigate", "mma-explore"];
|
|
3
|
-
/** Thrown when a skill's SKILL.md cannot be read from the bundled skills directory. */
|
|
4
|
-
export declare class SkillNotFoundError extends Error {
|
|
5
|
-
readonly code: "skill_not_found";
|
|
6
|
-
constructor(skillName: string, checkedPath: string);
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Return the absolute path to the skills root directory. Production: the
|
|
10
|
-
* bundled `packages/server/src/skills/` (or its dist mirror). Tests pass
|
|
11
|
-
* a fixture path explicitly.
|
|
12
|
-
*/
|
|
13
|
-
export declare function getSkillsRoot(skillsRoot?: string): string;
|
|
14
|
-
/**
|
|
15
|
-
* Read the content of a skill's SKILL.md file. Returns null if the file
|
|
16
|
-
* does not exist; propagates other I/O errors so callers can distinguish
|
|
17
|
-
* "skill not found" from "can't access skill".
|
|
18
|
-
*/
|
|
19
|
-
export declare function readSkillContent(skillName: string, skillsRoot?: string): string | null;
|
|
20
|
-
/**
|
|
21
|
-
* Return the per-client install directories where skills are written as
|
|
22
|
-
* subdirectories. Only includes clients that use the per-skill directory
|
|
23
|
-
* model (claude-code and codex). Gemini and Cursor bundle skills into a
|
|
24
|
-
* single file/extension and are not included.
|
|
25
|
-
*/
|
|
26
|
-
export declare function discoverPerClientInstallDirs(homeDir?: string): Partial<Record<Client, string>>;
|
|
27
|
-
//# sourceMappingURL=discover.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../src/install/discover.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,eAAO,MAAM,gBAAgB,+LAYnB,CAAC;AAEX,uFAAuF;AACvF,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,EAAG,iBAAiB,CAAU;gBAC/B,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;CAOnD;AAQD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQtF;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAM9F"}
|
package/dist/install/discover.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// Skill discovery — locates packaged SKILL.md files on disk and reads them.
|
|
2
|
-
// Extracted from cli/install-skill.ts as part of Ch 7 Task 39.
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import os from 'node:os';
|
|
5
|
-
import path from 'node:path';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
export const SUPPORTED_SKILLS = [
|
|
8
|
-
'multi-model-agent',
|
|
9
|
-
'mma-delegate',
|
|
10
|
-
'mma-audit',
|
|
11
|
-
'mma-review',
|
|
12
|
-
'mma-verify',
|
|
13
|
-
'mma-debug',
|
|
14
|
-
'mma-execute-plan',
|
|
15
|
-
'mma-retry',
|
|
16
|
-
'mma-context-blocks',
|
|
17
|
-
'mma-investigate',
|
|
18
|
-
'mma-explore',
|
|
19
|
-
];
|
|
20
|
-
/** Thrown when a skill's SKILL.md cannot be read from the bundled skills directory. */
|
|
21
|
-
export class SkillNotFoundError extends Error {
|
|
22
|
-
code = 'skill_not_found';
|
|
23
|
-
constructor(skillName, checkedPath) {
|
|
24
|
-
super(`Skill '${skillName}' not found. ` +
|
|
25
|
-
`Checked: ${checkedPath}. ` +
|
|
26
|
-
`Available skills: ${SUPPORTED_SKILLS.join(', ')}`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
const DEFAULT_SKILLS_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'skills');
|
|
30
|
-
/**
|
|
31
|
-
* Return the absolute path to the skills root directory. Production: the
|
|
32
|
-
* bundled `packages/server/src/skills/` (or its dist mirror). Tests pass
|
|
33
|
-
* a fixture path explicitly.
|
|
34
|
-
*/
|
|
35
|
-
export function getSkillsRoot(skillsRoot) {
|
|
36
|
-
return skillsRoot ?? DEFAULT_SKILLS_ROOT;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Read the content of a skill's SKILL.md file. Returns null if the file
|
|
40
|
-
* does not exist; propagates other I/O errors so callers can distinguish
|
|
41
|
-
* "skill not found" from "can't access skill".
|
|
42
|
-
*/
|
|
43
|
-
export function readSkillContent(skillName, skillsRoot) {
|
|
44
|
-
const skillFile = path.join(getSkillsRoot(skillsRoot), skillName, 'SKILL.md');
|
|
45
|
-
try {
|
|
46
|
-
return fs.readFileSync(skillFile, 'utf-8');
|
|
47
|
-
}
|
|
48
|
-
catch (err) {
|
|
49
|
-
if (err.code === 'ENOENT')
|
|
50
|
-
return null;
|
|
51
|
-
throw err;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Return the per-client install directories where skills are written as
|
|
56
|
-
* subdirectories. Only includes clients that use the per-skill directory
|
|
57
|
-
* model (claude-code and codex). Gemini and Cursor bundle skills into a
|
|
58
|
-
* single file/extension and are not included.
|
|
59
|
-
*/
|
|
60
|
-
export function discoverPerClientInstallDirs(homeDir) {
|
|
61
|
-
const h = homeDir ?? os.homedir();
|
|
62
|
-
return {
|
|
63
|
-
'claude-code': path.join(h, '.claude', 'skills'),
|
|
64
|
-
'codex': path.join(h, '.codex', 'skills'),
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=discover.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../../src/install/discover.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,+DAA+D;AAC/D,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,mBAAmB;IACnB,cAAc;IACd,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,kBAAkB;IAClB,WAAW;IACX,oBAAoB;IACpB,iBAAiB;IACjB,aAAa;CACL,CAAC;AAEX,uFAAuF;AACvF,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,IAAI,GAAG,iBAA0B,CAAC;IAC3C,YAAY,SAAiB,EAAE,WAAmB;QAChD,KAAK,CACH,UAAU,SAAS,eAAe;YAClC,YAAY,WAAW,IAAI;YAC3B,qBAAqB,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACnD,CAAC;IACJ,CAAC;CACF;AAED,MAAM,mBAAmB,GAAG,IAAI,CAAC,OAAO,CACtC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAC5C,IAAI,EACJ,QAAQ,CACT,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,UAAmB;IAC/C,OAAO,UAAU,IAAI,mBAAmB,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAiB,EAAE,UAAmB;IACrE,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IAC9E,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAClE,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAAC,OAAgB;IAC3D,MAAM,CAAC,GAAG,OAAO,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;IAClC,OAAO;QACL,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC;QAChD,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC;KAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Options for installing a skill via the Gemini CLI writer.
|
|
3
|
-
*/
|
|
4
|
-
export interface GeminiCliInstallOpts {
|
|
5
|
-
/** Skill name (currently informational; writes always go to multi-model-agent extension). */
|
|
6
|
-
skillName: string;
|
|
7
|
-
/**
|
|
8
|
-
* Raw SKILL.md content. May contain `@include _shared/<file>.md` directives
|
|
9
|
-
* which are inlined before writing.
|
|
10
|
-
*/
|
|
11
|
-
content: string;
|
|
12
|
-
/**
|
|
13
|
-
* Version string for the extension manifest's `version` field.
|
|
14
|
-
*/
|
|
15
|
-
skillVersion: string;
|
|
16
|
-
/**
|
|
17
|
-
* The "home directory" that replaces `os.homedir()`.
|
|
18
|
-
* Must NOT default to `os.homedir()` — always required explicitly.
|
|
19
|
-
*/
|
|
20
|
-
homeDir: string;
|
|
21
|
-
/**
|
|
22
|
-
* Where shared files live. The writer reads `<skillsRoot>/_shared/<file>.md`
|
|
23
|
-
* when inlining `@include` directives.
|
|
24
|
-
*/
|
|
25
|
-
skillsRoot: string;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Inline `@include _shared/<file>.md` directives in `content`.
|
|
29
|
-
*
|
|
30
|
-
* Each line matching `@include <path>` (space after `@include`) is replaced with
|
|
31
|
-
* the full content of `<skillsRoot>/_shared/<path>`.
|
|
32
|
-
*
|
|
33
|
-
* If a shared file is missing:
|
|
34
|
-
* - A warning is written to stderr.
|
|
35
|
-
* - The include line is removed from the output (not preserved).
|
|
36
|
-
* - Processing continues for remaining directives.
|
|
37
|
-
*
|
|
38
|
-
* @param content Raw SKILL.md content (may contain @include directives).
|
|
39
|
-
* @param skillsRoot Root directory containing `_shared/` sub-directory.
|
|
40
|
-
* @returns The content with directives inlined.
|
|
41
|
-
*/
|
|
42
|
-
export declare function inlineIncludes(content: string, skillsRoot: string): string;
|
|
43
|
-
/**
|
|
44
|
-
* Install a skill to the Gemini CLI extensions directory.
|
|
45
|
-
*
|
|
46
|
-
* Writes two files into `<homeDir>/.gemini/extensions/multi-model-agent/`:
|
|
47
|
-
* 1. `gemini-extension.json` — the extension manifest
|
|
48
|
-
* 2. `SKILL.md` — the skill content with @include directives inlined
|
|
49
|
-
*
|
|
50
|
-
* The directory (and any parent directories) are created with mode `0o700`.
|
|
51
|
-
* Calling this function multiple times overwrites the previous installation
|
|
52
|
-
* (idempotent).
|
|
53
|
-
*
|
|
54
|
-
* @param opts Installation options (see `GeminiCliInstallOpts`).
|
|
55
|
-
*/
|
|
56
|
-
export declare function installGeminiCli(opts: GeminiCliInstallOpts): void;
|
|
57
|
-
/**
|
|
58
|
-
* Uninstall the multi-model-agent Gemini CLI extension.
|
|
59
|
-
*
|
|
60
|
-
* Recursively removes `<homeDir>/.gemini/extensions/multi-model-agent/`.
|
|
61
|
-
* This is a no-op when the directory does not exist (no error is thrown).
|
|
62
|
-
*
|
|
63
|
-
* @param homeDir The "home directory" that replaces `os.homedir()`.
|
|
64
|
-
*/
|
|
65
|
-
export declare function uninstallGeminiCli(homeDir: string): void;
|
|
66
|
-
//# sourceMappingURL=gemini-cli.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-cli.d.ts","sourceRoot":"","sources":["../../src/install/gemini-cli.ts"],"names":[],"mappings":"AAwBA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,6FAA6F;IAC7F,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CA6B1E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,CAuBjE;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAKxD"}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gemini CLI skill writer.
|
|
3
|
-
*
|
|
4
|
-
* Writes to `<homeDir>/.gemini/extensions/multi-model-agent/`:
|
|
5
|
-
* - `gemini-extension.json` — extension manifest
|
|
6
|
-
* - `SKILL.md` — skill content (with @include directives inlined)
|
|
7
|
-
*
|
|
8
|
-
* The extension is always named `multi-model-agent` regardless of `skillName`
|
|
9
|
-
* (the extension loads whichever skill files are provided). This is a
|
|
10
|
-
* judgment call because the Gemini CLI extension format is not fully
|
|
11
|
-
* standardized; a minimal JSON schema is used.
|
|
12
|
-
*
|
|
13
|
-
* Before writing SKILL.md, any `@include _shared/<file>.md` directive lines
|
|
14
|
-
* are replaced with the file content from `<skillsRoot>/_shared/<file>.md`.
|
|
15
|
-
* Missing shared files → warning to stderr, line is dropped.
|
|
16
|
-
*
|
|
17
|
-
* @module
|
|
18
|
-
*/
|
|
19
|
-
import fs from 'node:fs';
|
|
20
|
-
import path from 'node:path';
|
|
21
|
-
/** Regex matching a line that starts with `@include ` followed by a relative path. */
|
|
22
|
-
const INCLUDE_RE = /^@include\s+(.+)$/;
|
|
23
|
-
/**
|
|
24
|
-
* Inline `@include _shared/<file>.md` directives in `content`.
|
|
25
|
-
*
|
|
26
|
-
* Each line matching `@include <path>` (space after `@include`) is replaced with
|
|
27
|
-
* the full content of `<skillsRoot>/_shared/<path>`.
|
|
28
|
-
*
|
|
29
|
-
* If a shared file is missing:
|
|
30
|
-
* - A warning is written to stderr.
|
|
31
|
-
* - The include line is removed from the output (not preserved).
|
|
32
|
-
* - Processing continues for remaining directives.
|
|
33
|
-
*
|
|
34
|
-
* @param content Raw SKILL.md content (may contain @include directives).
|
|
35
|
-
* @param skillsRoot Root directory containing `_shared/` sub-directory.
|
|
36
|
-
* @returns The content with directives inlined.
|
|
37
|
-
*/
|
|
38
|
-
export function inlineIncludes(content, skillsRoot) {
|
|
39
|
-
const lines = content.split('\n');
|
|
40
|
-
const result = [];
|
|
41
|
-
for (const line of lines) {
|
|
42
|
-
const match = INCLUDE_RE.exec(line);
|
|
43
|
-
if (!match) {
|
|
44
|
-
result.push(line);
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
const relativePath = match[1];
|
|
48
|
-
const sharedFilePath = path.join(skillsRoot, relativePath);
|
|
49
|
-
try {
|
|
50
|
-
const sharedContent = fs.readFileSync(sharedFilePath, 'utf-8');
|
|
51
|
-
result.push(sharedContent);
|
|
52
|
-
}
|
|
53
|
-
catch (err) {
|
|
54
|
-
// Log warning to stderr and drop the include line.
|
|
55
|
-
const detail = err instanceof Error ? err.message : String(err);
|
|
56
|
-
process.stderr.write(`Warning: Gemini CLI skill writer: shared file not found: ` +
|
|
57
|
-
`${sharedFilePath} (referenced by @include ${relativePath}) — ${detail}\n`);
|
|
58
|
-
// Line is dropped — do not push anything.
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return result.join('\n');
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Install a skill to the Gemini CLI extensions directory.
|
|
65
|
-
*
|
|
66
|
-
* Writes two files into `<homeDir>/.gemini/extensions/multi-model-agent/`:
|
|
67
|
-
* 1. `gemini-extension.json` — the extension manifest
|
|
68
|
-
* 2. `SKILL.md` — the skill content with @include directives inlined
|
|
69
|
-
*
|
|
70
|
-
* The directory (and any parent directories) are created with mode `0o700`.
|
|
71
|
-
* Calling this function multiple times overwrites the previous installation
|
|
72
|
-
* (idempotent).
|
|
73
|
-
*
|
|
74
|
-
* @param opts Installation options (see `GeminiCliInstallOpts`).
|
|
75
|
-
*/
|
|
76
|
-
export function installGeminiCli(opts) {
|
|
77
|
-
const { skillName: _skillName, content, skillVersion, homeDir, skillsRoot } = opts;
|
|
78
|
-
const extDir = path.join(homeDir, '.gemini', 'extensions', 'multi-model-agent');
|
|
79
|
-
fs.mkdirSync(extDir, { recursive: true, mode: 0o700 });
|
|
80
|
-
// Write the extension manifest.
|
|
81
|
-
// Shape is a minimal reasonable schema; Gemini CLI extension format is not
|
|
82
|
-
// fully standardized, so we document this judgment call.
|
|
83
|
-
const manifest = {
|
|
84
|
-
name: 'multi-model-agent',
|
|
85
|
-
version: skillVersion,
|
|
86
|
-
description: 'multi-model-agent skills for Gemini CLI',
|
|
87
|
-
schemaVersion: '1.0',
|
|
88
|
-
contextFiles: ['SKILL.md'],
|
|
89
|
-
};
|
|
90
|
-
const manifestPath = path.join(extDir, 'gemini-extension.json');
|
|
91
|
-
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n', 'utf-8');
|
|
92
|
-
// Write the skill content with @include directives inlined.
|
|
93
|
-
const finalContent = inlineIncludes(content, skillsRoot);
|
|
94
|
-
const skillPath = path.join(extDir, 'SKILL.md');
|
|
95
|
-
fs.writeFileSync(skillPath, finalContent, 'utf-8');
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Uninstall the multi-model-agent Gemini CLI extension.
|
|
99
|
-
*
|
|
100
|
-
* Recursively removes `<homeDir>/.gemini/extensions/multi-model-agent/`.
|
|
101
|
-
* This is a no-op when the directory does not exist (no error is thrown).
|
|
102
|
-
*
|
|
103
|
-
* @param homeDir The "home directory" that replaces `os.homedir()`.
|
|
104
|
-
*/
|
|
105
|
-
export function uninstallGeminiCli(homeDir) {
|
|
106
|
-
const extDir = path.join(homeDir, '.gemini', 'extensions', 'multi-model-agent');
|
|
107
|
-
if (fs.existsSync(extDir)) {
|
|
108
|
-
fs.rmSync(extDir, { recursive: true, force: true });
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
//# sourceMappingURL=gemini-cli.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-cli.js","sourceRoot":"","sources":["../../src/install/gemini-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,sFAAsF;AACtF,MAAM,UAAU,GAAG,mBAAmB,CAAC;AA6BvC;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe,EAAE,UAAkB;IAChE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,I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D;IACzD,MAAM,QAAQ,GAAG;QACf,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,YAAY;QACrB,WAAW,EAAE,yCAAyC;QACtD,aAAa,EAAE,KAAK;QACpB,YAAY,EAAE,CAAC,UAAU,CAAC;KAC3B,CAAC;IACF,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IAChE,EAAE,CAAC,aAAa,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC;IAElF,4DAA4D;IAC5D,MAAM,YAAY,GAAG,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACzD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAChD,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,mBAAmB,CAAC,CAAC;IAChF,IAAI,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;AACH,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared outbound header helper for install writers.
|
|
3
|
-
*
|
|
4
|
-
* Returns the `X-MMA-Client` header value identifying which integration
|
|
5
|
-
* (client) is making the outbound request. Used wherever install-writer
|
|
6
|
-
* code POSTs to internal mma routes (e.g. /v1/events).
|
|
7
|
-
*
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
import type { Client } from '@zhixuan92/multi-model-agent-core/tool-surface/manifest';
|
|
11
|
-
export type HeaderClientName = 'claude-code' | 'cursor' | 'codex-cli' | 'gemini-cli';
|
|
12
|
-
export declare function clientHeaders(client: HeaderClientName): {
|
|
13
|
-
'X-MMA-Client': HeaderClientName;
|
|
14
|
-
};
|
|
15
|
-
/** Map internal `Client` enum values to the header-friendly client name. */
|
|
16
|
-
export declare function toHeaderClientName(client: Client): HeaderClientName;
|
|
17
|
-
//# sourceMappingURL=headers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../src/install/headers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yDAAyD,CAAC;AAEtF,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,QAAQ,GAAG,WAAW,GAAG,YAAY,CAAC;AAErF,wBAAgB,aAAa,CAAC,MAAM,EAAE,gBAAgB;;EAErD;AAED,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAOnE"}
|
package/dist/install/headers.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared outbound header helper for install writers.
|
|
3
|
-
*
|
|
4
|
-
* Returns the `X-MMA-Client` header value identifying which integration
|
|
5
|
-
* (client) is making the outbound request. Used wherever install-writer
|
|
6
|
-
* code POSTs to internal mma routes (e.g. /v1/events).
|
|
7
|
-
*
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
export function clientHeaders(client) {
|
|
11
|
-
return { 'X-MMA-Client': client };
|
|
12
|
-
}
|
|
13
|
-
/** Map internal `Client` enum values to the header-friendly client name. */
|
|
14
|
-
export function toHeaderClientName(client) {
|
|
15
|
-
switch (client) {
|
|
16
|
-
case 'claude-code': return 'claude-code';
|
|
17
|
-
case 'cursor': return 'cursor';
|
|
18
|
-
case 'codex': return 'codex-cli';
|
|
19
|
-
case 'gemini': return 'gemini-cli';
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=headers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"headers.js","sourceRoot":"","sources":["../../src/install/headers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,MAAM,UAAU,aAAa,CAAC,MAAwB;IACpD,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC;AACpC,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,aAAa,CAAC,CAAC,OAAO,aAAa,CAAC;QACzC,KAAK,QAAQ,CAAC,CAAM,OAAO,QAAQ,CAAC;QACpC,KAAK,OAAO,CAAC,CAAO,OAAO,WAAW,CAAC;QACvC,KAAK,QAAQ,CAAC,CAAM,OAAO,YAAY,CAAC;IAC1C,CAAC;AACH,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Inline `@include _shared/<path>` directives in `content`.
|
|
3
|
-
*
|
|
4
|
-
* Each line matching `@include _shared/<path>` (space after `@include`) is
|
|
5
|
-
* replaced with the full content of `<skillsRoot>/_shared/<path>`.
|
|
6
|
-
*
|
|
7
|
-
* Security constraints:
|
|
8
|
-
* - Only paths beginning with `_shared/` are accepted.
|
|
9
|
-
* - The resolved path must stay within `<skillsRoot>/_shared/`.
|
|
10
|
-
* Path traversal attempts are rejected with a warning and the directive
|
|
11
|
-
* line is dropped.
|
|
12
|
-
*
|
|
13
|
-
* If a shared file is missing (ENOENT):
|
|
14
|
-
* - A warning is written to stderr.
|
|
15
|
-
* - The include line is removed from the output (not preserved).
|
|
16
|
-
* - Processing continues for remaining directives.
|
|
17
|
-
*
|
|
18
|
-
* Other I/O errors (permission denied, EISDIR, etc.) are re-thrown so the
|
|
19
|
-
* caller can distinguish them from a simple missing-file case.
|
|
20
|
-
*
|
|
21
|
-
* @param skillContext Used in warning messages to identify the skill context.
|
|
22
|
-
* @param content Raw skill content (may contain @include directives).
|
|
23
|
-
* @param skillsRoot Root directory containing `_shared/` sub-directory.
|
|
24
|
-
* @returns The content with directives inlined.
|
|
25
|
-
*/
|
|
26
|
-
export declare function inlineIncludes(skillContext: string, content: string, skillsRoot: string): string;
|
|
27
|
-
//# sourceMappingURL=include-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"include-utils.d.ts","sourceRoot":"","sources":["../../src/install/include-utils.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,cAAc,CAC5B,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,MAAM,CA6DR"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared include-inlining utilities for skill writers.
|
|
3
|
-
*
|
|
4
|
-
* Provides a common implementation for `@include _shared/<path>` directive
|
|
5
|
-
* processing, used by all skill writers (Claude Code, Cursor, etc.).
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
import fs from 'node:fs';
|
|
10
|
-
import path from 'node:path';
|
|
11
|
-
/**
|
|
12
|
-
* Regex matching a line that starts with `@include ` (exact space after
|
|
13
|
-
* `@include`) followed by a relative path.
|
|
14
|
-
*/
|
|
15
|
-
const INCLUDE_RE = /^@include\s+(.+)$/;
|
|
16
|
-
/**
|
|
17
|
-
* Inline `@include _shared/<path>` directives in `content`.
|
|
18
|
-
*
|
|
19
|
-
* Each line matching `@include _shared/<path>` (space after `@include`) is
|
|
20
|
-
* replaced with the full content of `<skillsRoot>/_shared/<path>`.
|
|
21
|
-
*
|
|
22
|
-
* Security constraints:
|
|
23
|
-
* - Only paths beginning with `_shared/` are accepted.
|
|
24
|
-
* - The resolved path must stay within `<skillsRoot>/_shared/`.
|
|
25
|
-
* Path traversal attempts are rejected with a warning and the directive
|
|
26
|
-
* line is dropped.
|
|
27
|
-
*
|
|
28
|
-
* If a shared file is missing (ENOENT):
|
|
29
|
-
* - A warning is written to stderr.
|
|
30
|
-
* - The include line is removed from the output (not preserved).
|
|
31
|
-
* - Processing continues for remaining directives.
|
|
32
|
-
*
|
|
33
|
-
* Other I/O errors (permission denied, EISDIR, etc.) are re-thrown so the
|
|
34
|
-
* caller can distinguish them from a simple missing-file case.
|
|
35
|
-
*
|
|
36
|
-
* @param skillContext Used in warning messages to identify the skill context.
|
|
37
|
-
* @param content Raw skill content (may contain @include directives).
|
|
38
|
-
* @param skillsRoot Root directory containing `_shared/` sub-directory.
|
|
39
|
-
* @returns The content with directives inlined.
|
|
40
|
-
*/
|
|
41
|
-
export function inlineIncludes(skillContext, content, skillsRoot) {
|
|
42
|
-
const lines = content.split('\n');
|
|
43
|
-
const result = [];
|
|
44
|
-
for (const line of lines) {
|
|
45
|
-
const match = INCLUDE_RE.exec(line);
|
|
46
|
-
if (!match) {
|
|
47
|
-
result.push(line);
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
const relativePath = match[1] ?? '';
|
|
51
|
-
// Security: only accept paths beginning with `_shared/`
|
|
52
|
-
if (!relativePath.startsWith('_shared/')) {
|
|
53
|
-
process.stderr.write(`Warning: ${skillContext}: @include path must start with ` +
|
|
54
|
-
`"_shared/": ${relativePath}\n`);
|
|
55
|
-
// Directive line is dropped — do not push anything.
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
// Security: reject path traversal attempts
|
|
59
|
-
const resolvedPath = path.resolve(skillsRoot, relativePath);
|
|
60
|
-
const sharedDir = path.resolve(skillsRoot, '_shared');
|
|
61
|
-
if (!resolvedPath.startsWith(sharedDir + path.sep) &&
|
|
62
|
-
resolvedPath !== sharedDir) {
|
|
63
|
-
process.stderr.write(`Warning: ${skillContext}: @include path rejected ` +
|
|
64
|
-
`(path traversal): ${relativePath}\n`);
|
|
65
|
-
// Directive line is dropped.
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
const sharedFilePath = path.join(skillsRoot, relativePath);
|
|
69
|
-
try {
|
|
70
|
-
const sharedContent = fs.readFileSync(sharedFilePath, 'utf-8');
|
|
71
|
-
result.push(sharedContent);
|
|
72
|
-
}
|
|
73
|
-
catch (err) {
|
|
74
|
-
const nodeErr = err;
|
|
75
|
-
if (nodeErr.code === 'ENOENT') {
|
|
76
|
-
// Missing shared file — warn and drop the directive line.
|
|
77
|
-
const detail = err instanceof Error ? err.message : String(err);
|
|
78
|
-
process.stderr.write(`Warning: ${skillContext}: shared file not found: ` +
|
|
79
|
-
`${sharedFilePath} (referenced by @include ${relativePath}) — ${detail}\n`);
|
|
80
|
-
// Line is dropped — do not push anything.
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
// Permission errors, EISDIR, etc. — re-throw so the caller notices.
|
|
84
|
-
throw err;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return result.join('\n');
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=include-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"include-utils.js","sourceRoot":"","sources":["../../src/install/include-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;GAGG;AACH,MAAM,UAAU,GAAG,mBAAmB,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,cAAc,CAC5B,YAAoB,EACpB,OAAe,EACf,UAAkB;IAElB,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,KA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AAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC9B,0DAA0D;gBAC1D,MAAM,MAAM,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAChE,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,YAAY,YAAY,2BAA2B;oBACnD,GAAG,cAAc,4BAA4B,YAAY,OAAO,MAAM,IAAI,CAC3E,CAAC;gBACF,0CAA0C;YAC5C,CAAC;iBAAM,CAAC;gBACN,oEAAoE;gBACpE,MAAM,GAAG,CAAC;YACZ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Client } from '@zhixuan92/multi-model-agent-core/tool-surface/manifest';
|
|
2
|
-
/**
|
|
3
|
-
* Return the per-client install directory where skills are written as
|
|
4
|
-
* subdirectories. Only claude-code and codex use the per-skill directory
|
|
5
|
-
* model; gemini and cursor use a single file/extension and return null.
|
|
6
|
-
*/
|
|
7
|
-
export declare function resolveClientInstallDir(target: Client, homeDir: string): string | null;
|
|
8
|
-
/** Thrown when a passed `--target` value is not a known client. */
|
|
9
|
-
export declare class UnknownTargetError extends Error {
|
|
10
|
-
readonly code: "unknown_target";
|
|
11
|
-
constructor(target: string, valid: readonly Client[]);
|
|
12
|
-
}
|
|
13
|
-
/** Dispatch a write to the appropriate per-client installer. */
|
|
14
|
-
export declare function writeSkillToClient(skillName: string, content: string, target: Client, homeDir: string, skillsRoot: string, version?: string, cwd?: string, force?: boolean): void;
|
|
15
|
-
/** Dispatch an uninstall to the appropriate per-client remover. */
|
|
16
|
-
export declare function removeSkillFromClient(skillName: string, target: Client, homeDir: string, cwd?: string): void;
|
|
17
|
-
//# sourceMappingURL=manifest-resolve.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manifest-resolve.d.ts","sourceRoot":"","sources":["../../src/install/manifest-resolve.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yDAAyD,CAAC;AAOtF;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAStF;AAED,mEAAmE;AACnE,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,EAAG,gBAAgB,CAAU;gBAC9B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE;CAGrD;AAED,gEAAgE;AAChE,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,MAAgB,EACzB,GAAG,GAAE,MAAsB,EAC3B,KAAK,GAAE,OAAe,GACrB,IAAI,CAuBN;AAED,mEAAmE;AACnE,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,MAAsB,GAC1B,IAAI,CAmBN"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// Per-client install/uninstall dispatch — resolves a target client to the
|
|
2
|
-
// concrete writer/remover pair. Extracted from cli/install-skill.ts as
|
|
3
|
-
// part of Ch 7 Task 39.
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import { notifySkillInstalled } from './notify.js';
|
|
6
|
-
import { installClaudeCode, uninstallClaudeCode } from '@zhixuan92/multi-model-agent-core/tool-surface/skill-installers/claude-code';
|
|
7
|
-
import { installGeminiCli, uninstallGeminiCli } from '@zhixuan92/multi-model-agent-core/tool-surface/skill-installers/gemini-cli';
|
|
8
|
-
import { installCodexCli, uninstallCodexCli } from '@zhixuan92/multi-model-agent-core/tool-surface/skill-installers/codex-cli';
|
|
9
|
-
import { installCursor, uninstallCursor } from '@zhixuan92/multi-model-agent-core/tool-surface/skill-installers/cursor';
|
|
10
|
-
/**
|
|
11
|
-
* Return the per-client install directory where skills are written as
|
|
12
|
-
* subdirectories. Only claude-code and codex use the per-skill directory
|
|
13
|
-
* model; gemini and cursor use a single file/extension and return null.
|
|
14
|
-
*/
|
|
15
|
-
export function resolveClientInstallDir(target, homeDir) {
|
|
16
|
-
switch (target) {
|
|
17
|
-
case 'claude-code':
|
|
18
|
-
return path.join(homeDir, '.claude', 'skills');
|
|
19
|
-
case 'codex':
|
|
20
|
-
return path.join(homeDir, '.codex', 'skills');
|
|
21
|
-
default:
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
/** Thrown when a passed `--target` value is not a known client. */
|
|
26
|
-
export class UnknownTargetError extends Error {
|
|
27
|
-
code = 'unknown_target';
|
|
28
|
-
constructor(target, valid) {
|
|
29
|
-
super(`Unknown target: ${target}. Valid: ${valid.join(', ')}`);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/** Dispatch a write to the appropriate per-client installer. */
|
|
33
|
-
export function writeSkillToClient(skillName, content, target, homeDir, skillsRoot, version = '0.0.0', cwd = process.cwd(), force = false) {
|
|
34
|
-
switch (target) {
|
|
35
|
-
case 'claude-code':
|
|
36
|
-
installClaudeCode({ skillName, content, homeDir, skillsRoot });
|
|
37
|
-
notifySkillInstalled({ skillId: skillName, client: target });
|
|
38
|
-
break;
|
|
39
|
-
case 'gemini':
|
|
40
|
-
installGeminiCli({ skillName, content, skillVersion: version, homeDir, skillsRoot });
|
|
41
|
-
notifySkillInstalled({ skillId: skillName, client: target });
|
|
42
|
-
break;
|
|
43
|
-
case 'codex':
|
|
44
|
-
installCodexCli({ skillName, content, homeDir, skillsRoot });
|
|
45
|
-
notifySkillInstalled({ skillId: skillName, client: target });
|
|
46
|
-
break;
|
|
47
|
-
case 'cursor':
|
|
48
|
-
installCursor({ content, cwd, homeDir, skillsRoot, force });
|
|
49
|
-
notifySkillInstalled({ skillId: skillName, client: target });
|
|
50
|
-
break;
|
|
51
|
-
default: {
|
|
52
|
-
const _exhaustive = target;
|
|
53
|
-
throw new Error(`install-skill: unknown target: ${_exhaustive}`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/** Dispatch an uninstall to the appropriate per-client remover. */
|
|
58
|
-
export function removeSkillFromClient(skillName, target, homeDir, cwd = process.cwd()) {
|
|
59
|
-
switch (target) {
|
|
60
|
-
case 'claude-code':
|
|
61
|
-
uninstallClaudeCode(skillName, homeDir);
|
|
62
|
-
break;
|
|
63
|
-
case 'gemini':
|
|
64
|
-
uninstallGeminiCli(homeDir);
|
|
65
|
-
break;
|
|
66
|
-
case 'codex':
|
|
67
|
-
uninstallCodexCli(skillName, homeDir);
|
|
68
|
-
break;
|
|
69
|
-
case 'cursor':
|
|
70
|
-
uninstallCursor(cwd);
|
|
71
|
-
break;
|
|
72
|
-
default: {
|
|
73
|
-
const _exhaustive = target;
|
|
74
|
-
throw new Error(`install-skill: unknown target: ${_exhaustive}`);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=manifest-resolve.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manifest-resolve.js","sourceRoot":"","sources":["../../src/install/manifest-resolve.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,uEAAuE;AACvE,wBAAwB;AACxB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,6EAA6E,CAAC;AACrI,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,4EAA4E,CAAC;AAClI,OAAO,EAAE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