ai-jue-adapter-codex 0.2.0 → 0.2.1
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/dist/capabilities/layout.d.ts +1 -1
- package/dist/capabilities/layout.js +6 -3
- package/dist/capabilities/layout.js.map +1 -1
- package/dist/capabilities/mcp.d.ts +10 -24
- package/dist/capabilities/mcp.js +43 -41
- package/dist/capabilities/mcp.js.map +1 -1
- package/dist/capabilities/skills.d.ts +6 -8
- package/dist/capabilities/skills.js +8 -9
- package/dist/capabilities/skills.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/read.js +4 -2
- package/dist/read.js.map +1 -1
- package/dist/write.d.ts +5 -17
- package/dist/write.js +25 -21
- package/dist/write.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export type CodexArtifactKind = "project" | "plugin";
|
|
11
11
|
export declare function isProjectLayout(root: string): boolean;
|
|
12
|
-
export declare function detectArtifactKind(root: string): CodexArtifactKind;
|
|
12
|
+
export declare function detectArtifactKind(root: string): CodexArtifactKind | undefined;
|
|
@@ -13,8 +13,11 @@ function isProjectLayout(root) {
|
|
|
13
13
|
fs_1.default.existsSync(path_1.default.join(root, "AGENTS.md")));
|
|
14
14
|
}
|
|
15
15
|
function detectArtifactKind(root) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
if (fs_1.default.existsSync(path_1.default.join(root, ".codex-plugin", "plugin.json"))) {
|
|
17
|
+
return "plugin";
|
|
18
|
+
}
|
|
19
|
+
if (isProjectLayout(root))
|
|
20
|
+
return "project";
|
|
21
|
+
return undefined;
|
|
19
22
|
}
|
|
20
23
|
//# sourceMappingURL=layout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/capabilities/layout.ts"],"names":[],"mappings":";;;;;AAcA,0CAMC;AAED,
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/capabilities/layout.ts"],"names":[],"mappings":";;;;;AAcA,0CAMC;AAED,gDAMC;AA5BD,4CAAoB;AACpB,gDAAwB;AAaxB,SAAgB,eAAe,CAAC,IAAY;IAC1C,OAAO,CACL,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACxC,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;QACvD,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAC5C,CAAC;AACJ,CAAC;AAED,SAAgB,kBAAkB,CAAC,IAAY;IAC7C,IAAI,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC;QACnE,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,IAAI,eAAe,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IAC5C,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1,27 +1,13 @@
|
|
|
1
1
|
import type { CapabilityMapping } from "ai-jue-core";
|
|
2
|
+
import type { CodexArtifactKind } from "./layout";
|
|
3
|
+
export interface CanonicalMcp {
|
|
4
|
+
servers: Record<string, any>;
|
|
5
|
+
}
|
|
2
6
|
/**
|
|
3
|
-
* Codex MCP
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* toNative boundary: we treat the file as a "JSON-ish document" with our
|
|
9
|
-
* own conversion. In practice this is best-effort — for the contract
|
|
10
|
-
* suite's narrow use, the input is JSON-shaped and we wrap it.
|
|
11
|
-
*
|
|
12
|
-
* Per JUE-104/105, verified live fields: `command`, `args`, `cwd`, `url`,
|
|
13
|
-
* `env` (map), `env_vars` (allow-list of names to pass through, NOT a
|
|
14
|
-
* list of key=value pairs), `bearer_token_env_var`, `enabled`,
|
|
15
|
-
* `enabled_tools`, `disabled_tools`, `startup_timeout_sec`, `tool_timeout_sec`.
|
|
16
|
-
*
|
|
17
|
-
* NOTE: This mapping treats the file as JSON for round-trip simplicity,
|
|
18
|
-
* not TOML. Project config (approval_policy, model, sandbox_mode) lives in
|
|
19
|
-
* the same file under flat keys — those are handled by the project-config
|
|
20
|
-
* mapping elsewhere, not here. The current round-trip of `[mcp_servers]`
|
|
21
|
-
* is therefore a no-op for now; the Adapter reports `unsupported`-equivalent
|
|
22
|
-
* for MCP servers at the on-disk file level (Codex's real MCP config shape
|
|
23
|
-
* is TOML, and the JUE-301 honest "lack of a tighter native validator"
|
|
24
|
-
* stance applies here too — we acknowledge the gap rather than fabricate a
|
|
25
|
-
* TOML parser inside a JSON-shaped abstraction).
|
|
7
|
+
* Codex MCP:
|
|
8
|
+
* - project → still degraded (TOML `[mcp_servers.*]` in `.codex/config.toml`;
|
|
9
|
+
* no TOML writer — honest no-op, JUE-301)
|
|
10
|
+
* - plugin → root `.mcp.json` (same portable shape as Claude plugins / OpenClaw
|
|
11
|
+
* compatible bundles; RFC-0002)
|
|
26
12
|
*/
|
|
27
|
-
export declare function mcp(): CapabilityMapping<Record<string, unknown>>;
|
|
13
|
+
export declare function mcp(artifactKind?: CodexArtifactKind): CapabilityMapping<CanonicalMcp | Record<string, unknown>>;
|
package/dist/capabilities/mcp.js
CHANGED
|
@@ -7,43 +7,43 @@ exports.mcp = mcp;
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const ai_jue_core_1 = require("ai-jue-core");
|
|
10
|
+
function toCanonicalMcp(native) {
|
|
11
|
+
const servers = native.mcpServers && typeof native.mcpServers === "object" ? native.mcpServers : native;
|
|
12
|
+
for (const [name, server] of Object.entries(servers)) {
|
|
13
|
+
(0, ai_jue_core_1.assertNoLiteralCredentials)(server, `Codex MCP server "${name}"`);
|
|
14
|
+
}
|
|
15
|
+
return { servers };
|
|
16
|
+
}
|
|
17
|
+
function toNativeMcp(canonical) {
|
|
18
|
+
const projectScoped = {};
|
|
19
|
+
for (const [name, server] of Object.entries(canonical.servers ?? {})) {
|
|
20
|
+
const scope = server.scope ?? "project";
|
|
21
|
+
if (scope !== "project") {
|
|
22
|
+
throw new Error(`Codex Plugin MCP server "${name}" uses scope "${scope}". ` +
|
|
23
|
+
'Plugin Artifacts only support "project" scope; refusing to drop the server silently.');
|
|
24
|
+
}
|
|
25
|
+
const { scope: _scope, ...rest } = server;
|
|
26
|
+
projectScoped[name] = rest;
|
|
27
|
+
}
|
|
28
|
+
return Object.keys(projectScoped).length > 0 ? { mcpServers: projectScoped } : undefined;
|
|
29
|
+
}
|
|
10
30
|
/**
|
|
11
|
-
* Codex MCP
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* toNative boundary: we treat the file as a "JSON-ish document" with our
|
|
17
|
-
* own conversion. In practice this is best-effort — for the contract
|
|
18
|
-
* suite's narrow use, the input is JSON-shaped and we wrap it.
|
|
19
|
-
*
|
|
20
|
-
* Per JUE-104/105, verified live fields: `command`, `args`, `cwd`, `url`,
|
|
21
|
-
* `env` (map), `env_vars` (allow-list of names to pass through, NOT a
|
|
22
|
-
* list of key=value pairs), `bearer_token_env_var`, `enabled`,
|
|
23
|
-
* `enabled_tools`, `disabled_tools`, `startup_timeout_sec`, `tool_timeout_sec`.
|
|
24
|
-
*
|
|
25
|
-
* NOTE: This mapping treats the file as JSON for round-trip simplicity,
|
|
26
|
-
* not TOML. Project config (approval_policy, model, sandbox_mode) lives in
|
|
27
|
-
* the same file under flat keys — those are handled by the project-config
|
|
28
|
-
* mapping elsewhere, not here. The current round-trip of `[mcp_servers]`
|
|
29
|
-
* is therefore a no-op for now; the Adapter reports `unsupported`-equivalent
|
|
30
|
-
* for MCP servers at the on-disk file level (Codex's real MCP config shape
|
|
31
|
-
* is TOML, and the JUE-301 honest "lack of a tighter native validator"
|
|
32
|
-
* stance applies here too — we acknowledge the gap rather than fabricate a
|
|
33
|
-
* TOML parser inside a JSON-shaped abstraction).
|
|
31
|
+
* Codex MCP:
|
|
32
|
+
* - project → still degraded (TOML `[mcp_servers.*]` in `.codex/config.toml`;
|
|
33
|
+
* no TOML writer — honest no-op, JUE-301)
|
|
34
|
+
* - plugin → root `.mcp.json` (same portable shape as Claude plugins / OpenClaw
|
|
35
|
+
* compatible bundles; RFC-0002)
|
|
34
36
|
*/
|
|
35
|
-
function mcp() {
|
|
37
|
+
function mcp(artifactKind = "project") {
|
|
38
|
+
if (artifactKind === "plugin") {
|
|
39
|
+
return (0, ai_jue_core_1.mergedJsonFile)({
|
|
40
|
+
filePath: (root) => path_1.default.join(root, ".mcp.json"),
|
|
41
|
+
toCanonical: toCanonicalMcp,
|
|
42
|
+
toNative: toNativeMcp,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
36
45
|
return {
|
|
37
46
|
read(root) {
|
|
38
|
-
// Codex's MCP config lives in the same TOML file as project settings;
|
|
39
|
-
// a real TOML-aware mapping is out of scope per the JUE-301 honest
|
|
40
|
-
// unsupported stance. The shared `mergedJsonFile` factory would try
|
|
41
|
-
// to JSON.parse a TOML file and throw — handle both missing-file
|
|
42
|
-
// and non-JSON-content cases by returning undefined. The sensitive-
|
|
43
|
-
// reference fixture is JSON-shaped on purpose so the security
|
|
44
|
-
// check (literal-credential detection) can fire here, matching the
|
|
45
|
-
// same `assertNoLiteralCredentials` contract every other Adapter
|
|
46
|
-
// uses.
|
|
47
47
|
const filePath = path_1.default.join(root, ".codex", "config.toml");
|
|
48
48
|
if (!fs_1.default.existsSync(filePath))
|
|
49
49
|
return undefined;
|
|
@@ -53,7 +53,7 @@ function mcp() {
|
|
|
53
53
|
parsed = JSON.parse(raw);
|
|
54
54
|
}
|
|
55
55
|
catch {
|
|
56
|
-
return undefined;
|
|
56
|
+
return undefined;
|
|
57
57
|
}
|
|
58
58
|
const servers = parsed.mcpServers;
|
|
59
59
|
if (servers) {
|
|
@@ -61,16 +61,18 @@ function mcp() {
|
|
|
61
61
|
(0, ai_jue_core_1.assertNoLiteralCredentials)(server, `codex-mcp-server-${name}`);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
return servers;
|
|
64
|
+
return servers ? { servers } : undefined;
|
|
65
65
|
},
|
|
66
66
|
write(_root, value, _target) {
|
|
67
|
-
if (!value ||
|
|
67
|
+
if (!value || typeof value !== "object")
|
|
68
|
+
return [];
|
|
69
|
+
const servers = "servers" in value && value.servers && typeof value.servers === "object"
|
|
70
|
+
? value.servers
|
|
71
|
+
: value;
|
|
72
|
+
if (!servers || Object.keys(servers).length === 0)
|
|
68
73
|
return [];
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
(0, ai_jue_core_1.assertNoLiteralCredentials)(json, "codex-mcp");
|
|
72
|
-
// Don't actually write — TOML format is out of scope. Returning []
|
|
73
|
-
// keeps the contract trivially satisfied.
|
|
74
|
+
(0, ai_jue_core_1.assertNoLiteralCredentials)(JSON.stringify(servers), "codex-mcp");
|
|
75
|
+
// Project TOML write remains out of scope.
|
|
74
76
|
return [];
|
|
75
77
|
},
|
|
76
78
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/capabilities/mcp.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/capabilities/mcp.ts"],"names":[],"mappings":";;;;;AA0CA,kBAwCC;AAlFD,4CAAoB;AACpB,gDAAwB;AACxB,6CAAyE;AAQzE,SAAS,cAAc,CAAC,MAAW;IACjC,MAAM,OAAO,GACX,MAAM,CAAC,UAAU,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,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AAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,EAAE,CAAC;YAC7D,IAAA,wCAA0B,EAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC;YACjE,2CAA2C;YAC3C,OAAO,EAAE,CAAC;QACZ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { CapabilityMapping } from "ai-jue-core";
|
|
2
|
+
import type { CodexArtifactKind } from "./layout";
|
|
2
3
|
/**
|
|
3
|
-
* Codex Skills
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* matching JUE-301's documented carry-over warning). `directoryPerItem`
|
|
8
|
-
* matches the exact shape; bundleKeys enables the same attachments Claude
|
|
9
|
-
* supports.
|
|
4
|
+
* Codex Skills:
|
|
5
|
+
* - project → `.agents/skills/<name>/SKILL.md` (JUE-301)
|
|
6
|
+
* - plugin → root `skills/<name>/SKILL.md` (marketplace / OpenClaw bundle shape;
|
|
7
|
+
* matches fixtures/plugin and RFC-0002)
|
|
10
8
|
*/
|
|
11
|
-
export declare function skills(): CapabilityMapping<Record<string, unknown>>;
|
|
9
|
+
export declare function skills(artifactKind?: CodexArtifactKind): CapabilityMapping<Record<string, unknown>>;
|
|
@@ -7,17 +7,16 @@ exports.skills = skills;
|
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const ai_jue_core_1 = require("ai-jue-core");
|
|
9
9
|
/**
|
|
10
|
-
* Codex Skills
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* matching JUE-301's documented carry-over warning). `directoryPerItem`
|
|
15
|
-
* matches the exact shape; bundleKeys enables the same attachments Claude
|
|
16
|
-
* supports.
|
|
10
|
+
* Codex Skills:
|
|
11
|
+
* - project → `.agents/skills/<name>/SKILL.md` (JUE-301)
|
|
12
|
+
* - plugin → root `skills/<name>/SKILL.md` (marketplace / OpenClaw bundle shape;
|
|
13
|
+
* matches fixtures/plugin and RFC-0002)
|
|
17
14
|
*/
|
|
18
|
-
function skills() {
|
|
15
|
+
function skills(artifactKind = "project") {
|
|
19
16
|
return (0, ai_jue_core_1.directoryPerItem)({
|
|
20
|
-
dirPath: (root) =>
|
|
17
|
+
dirPath: (root) => artifactKind === "plugin"
|
|
18
|
+
? path_1.default.join(root, "skills")
|
|
19
|
+
: path_1.default.join(root, ".agents", "skills"),
|
|
21
20
|
mainFileName: "SKILL.md",
|
|
22
21
|
bundleKeys: ["references", "scripts", "assets"],
|
|
23
22
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/capabilities/skills.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/capabilities/skills.ts"],"names":[],"mappings":";;;;;AAWA,wBAWC;AAtBD,gDAAwB;AACxB,6CAA+C;AAI/C;;;;;GAKG;AACH,SAAgB,MAAM,CACpB,eAAkC,SAAS;IAE3C,OAAO,IAAA,8BAAgB,EAAC;QACtB,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAChB,YAAY,KAAK,QAAQ;YACvB,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC;YAC3B,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC;QAC1C,YAAY,EAAE,UAAU;QACxB,UAAU,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAC;KAChD,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { write } from "./write";
|
|
|
4
4
|
export type { WriteContext } from "./write";
|
|
5
5
|
export { confirm } from "./confirm";
|
|
6
6
|
export type { ConfirmContext } from "./confirm";
|
|
7
|
+
export { detectArtifactKind } from "./capabilities/layout";
|
|
7
8
|
/**
|
|
8
9
|
* `jue apply`'s Codex entry point: converts a resolved config into
|
|
9
10
|
* `CanonicalDocument`, computes the Artifact via `write()`, and applies the
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.confirm = exports.write = exports.read = void 0;
|
|
3
|
+
exports.detectArtifactKind = exports.confirm = exports.write = exports.read = void 0;
|
|
4
4
|
exports.generate = generate;
|
|
5
5
|
const ai_jue_core_1 = require("ai-jue-core");
|
|
6
6
|
const confirm_1 = require("./confirm");
|
|
@@ -12,6 +12,8 @@ var write_2 = require("./write");
|
|
|
12
12
|
Object.defineProperty(exports, "write", { enumerable: true, get: function () { return write_2.write; } });
|
|
13
13
|
var confirm_2 = require("./confirm");
|
|
14
14
|
Object.defineProperty(exports, "confirm", { enumerable: true, get: function () { return confirm_2.confirm; } });
|
|
15
|
+
var layout_1 = require("./capabilities/layout");
|
|
16
|
+
Object.defineProperty(exports, "detectArtifactKind", { enumerable: true, get: function () { return layout_1.detectArtifactKind; } });
|
|
15
17
|
/**
|
|
16
18
|
* `jue apply`'s Codex entry point: converts a resolved config into
|
|
17
19
|
* `CanonicalDocument`, computes the Artifact via `write()`, and applies the
|
|
@@ -33,7 +35,8 @@ const codexAdapter = {
|
|
|
33
35
|
skills: "supported",
|
|
34
36
|
agents: "supported",
|
|
35
37
|
hooks: "supported",
|
|
36
|
-
|
|
38
|
+
// Project MCP stays TOML-degraded; Plugin Artifacts write portable `.mcp.json`.
|
|
39
|
+
mcp: "degraded",
|
|
37
40
|
},
|
|
38
41
|
read: read_1.read,
|
|
39
42
|
write: write_1.write,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAsBA,4BAIC;AA1BD,6CAAwF;AAExF,uCAAoC;AACpC,iCAA8B;AAC9B,mCAAgC;AAEhC,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AAEb,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AAEd,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAEhB,gDAA2D;AAAlD,4GAAA,kBAAkB,OAAA;AAE3B;;;;;;;GAOG;AACI,KAAK,UAAU,QAAQ,CAAC,MAAW,EAAE,SAAiB;IAC3D,MAAM,SAAS,GAAG,IAAA,iCAAmB,EAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,MAAM,IAAA,aAAK,EAAC,SAAS,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CAAC;IAC5F,IAAA,iCAAmB,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,YAAY,GAAY;IAC5B,EAAE,EAAE,OAAO;IACX,YAAY,EAAE;QACZ,KAAK,EAAE,UAAU,EAAE,+EAA+E;QAClG,QAAQ,EAAE,UAAU,EAAE,sEAAsE;QAC5F,MAAM,EAAE,WAAW;QACnB,MAAM,EAAE,WAAW;QACnB,KAAK,EAAE,WAAW;QAClB,gFAAgF;QAChF,GAAG,EAAE,UAAU;KAChB;IACD,IAAI,EAAJ,WAAI;IACJ,KAAK,EAAL,aAAK;IACL,OAAO,EAAP,iBAAO;CACR,CAAC;AAEF,kBAAe,IAAA,6BAAe,EAAC,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC"}
|
package/dist/read.js
CHANGED
|
@@ -5,17 +5,19 @@ const ai_jue_core_1 = require("ai-jue-core");
|
|
|
5
5
|
const agents_1 = require("./capabilities/agents");
|
|
6
6
|
const commands_1 = require("./capabilities/commands");
|
|
7
7
|
const context_1 = require("./capabilities/context");
|
|
8
|
+
const layout_1 = require("./capabilities/layout");
|
|
8
9
|
const hooks_1 = require("./capabilities/hooks");
|
|
9
10
|
const mcp_1 = require("./capabilities/mcp");
|
|
10
11
|
const skills_1 = require("./capabilities/skills");
|
|
11
12
|
async function read({ projectRoot }) {
|
|
13
|
+
const artifactKind = (0, layout_1.detectArtifactKind)(projectRoot) ?? "project";
|
|
12
14
|
const canonical = (0, ai_jue_core_1.readCapabilities)({
|
|
13
15
|
context: (0, context_1.context)(),
|
|
14
16
|
commands: (0, commands_1.commands)(),
|
|
15
17
|
agents: (0, agents_1.agents)(),
|
|
16
|
-
skills: (0, skills_1.skills)(),
|
|
18
|
+
skills: (0, skills_1.skills)(artifactKind),
|
|
17
19
|
hooks: (0, hooks_1.hooks)(),
|
|
18
|
-
mcp: (0, mcp_1.mcp)(),
|
|
20
|
+
mcp: (0, mcp_1.mcp)(artifactKind),
|
|
19
21
|
}, projectRoot);
|
|
20
22
|
return (0, ai_jue_core_1.toCanonicalDocument)(canonical);
|
|
21
23
|
}
|
package/dist/read.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.js","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":";;AAcA,oBAcC;AA5BD,6CAAoE;AAEpE,kDAA+C;AAC/C,sDAAmD;AACnD,oDAAiD;AACjD,kDAA2D;AAC3D,gDAA6C;AAC7C,4CAAyC;AACzC,kDAA+C;AAMxC,KAAK,UAAU,IAAI,CAAC,EAAE,WAAW,EAAe;IACrD,MAAM,YAAY,GAAG,IAAA,2BAAkB,EAAC,WAAW,CAAC,IAAI,SAAS,CAAC;IAClE,MAAM,SAAS,GAAG,IAAA,8BAAgB,EAChC;QACE,OAAO,EAAE,IAAA,iBAAO,GAAE;QAClB,QAAQ,EAAE,IAAA,mBAAQ,GAAE;QACpB,MAAM,EAAE,IAAA,eAAM,GAAE;QAChB,MAAM,EAAE,IAAA,eAAM,EAAC,YAAY,CAAC;QAC5B,KAAK,EAAE,IAAA,aAAK,GAAE;QACd,GAAG,EAAE,IAAA,SAAG,EAAC,YAAY,CAAC;KACvB,EACD,WAAW,CACZ,CAAC;IACF,OAAO,IAAA,iCAAmB,EAAC,SAA+C,CAAC,CAAC;AAC9E,CAAC"}
|
package/dist/write.d.ts
CHANGED
|
@@ -1,30 +1,18 @@
|
|
|
1
1
|
import type { ArtifactChange, CanonicalDocument } from "ai-jue-core";
|
|
2
|
+
import { type CodexArtifactKind } from "./capabilities/layout";
|
|
2
3
|
import { type CodexPluginManifest } from "./capabilities/manifest";
|
|
3
4
|
export interface WriteContext {
|
|
4
5
|
projectRoot: string;
|
|
5
|
-
artifactKind?:
|
|
6
|
+
artifactKind?: CodexArtifactKind;
|
|
6
7
|
pluginManifest?: CodexPluginManifest;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
10
|
* Computes the `ArtifactChange[]` needed to make a Codex project or Plugin
|
|
10
11
|
* directory match `canonical`, without performing I/O itself — Core
|
|
11
12
|
* executes approved changes (per the Adapter/Core split frozen in JUE-103's
|
|
12
|
-
* Extension Host).
|
|
13
|
-
* `./capabilities/*` and driven through the shared capability-mapping
|
|
14
|
-
* engine; the hand-written `agents` mapping exists because Codex agents
|
|
15
|
-
* are TOML, not the Markdown+frontmatter shape any factory produces.
|
|
13
|
+
* Extension Host).
|
|
16
14
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* `mcp` is similarly a no-op (Codex MCP lives in the same TOML file as
|
|
20
|
-
* project settings; a real TOML parser is out of scope per the JUE-301
|
|
21
|
-
* honest-unsupported stance).
|
|
22
|
-
*
|
|
23
|
-
* For Plugin Artifacts, if `pluginManifest` is not explicitly provided we
|
|
24
|
-
* try to copy the existing on-disk manifest (e.g. a fixture's
|
|
25
|
-
* `.codex-plugin/plugin.json`) — this lets the contract test round-trip
|
|
26
|
-
* a Plugin fixture's manifest without forcing every caller to re-supply it.
|
|
27
|
-
* If neither is present, the manifest is left untouched (a manifest-less
|
|
28
|
-
* Plugin is Codex's documented `--plugin-dir` auto-discovery mode).
|
|
15
|
+
* Plugin mode writes portable `skills/` + `.mcp.json` (RFC-0002 / OpenClaw
|
|
16
|
+
* compatible-bundle). Project mode keeps MCP as an honest TOML no-op.
|
|
29
17
|
*/
|
|
30
18
|
export declare function write(canonical: CanonicalDocument, writeContext: WriteContext): Promise<ArtifactChange[]>;
|
package/dist/write.js
CHANGED
|
@@ -20,32 +20,19 @@ const TARGET = "codex";
|
|
|
20
20
|
* Computes the `ArtifactChange[]` needed to make a Codex project or Plugin
|
|
21
21
|
* directory match `canonical`, without performing I/O itself — Core
|
|
22
22
|
* executes approved changes (per the Adapter/Core split frozen in JUE-103's
|
|
23
|
-
* Extension Host).
|
|
24
|
-
* `./capabilities/*` and driven through the shared capability-mapping
|
|
25
|
-
* engine; the hand-written `agents` mapping exists because Codex agents
|
|
26
|
-
* are TOML, not the Markdown+frontmatter shape any factory produces.
|
|
23
|
+
* Extension Host).
|
|
27
24
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* `mcp` is similarly a no-op (Codex MCP lives in the same TOML file as
|
|
31
|
-
* project settings; a real TOML parser is out of scope per the JUE-301
|
|
32
|
-
* honest-unsupported stance).
|
|
33
|
-
*
|
|
34
|
-
* For Plugin Artifacts, if `pluginManifest` is not explicitly provided we
|
|
35
|
-
* try to copy the existing on-disk manifest (e.g. a fixture's
|
|
36
|
-
* `.codex-plugin/plugin.json`) — this lets the contract test round-trip
|
|
37
|
-
* a Plugin fixture's manifest without forcing every caller to re-supply it.
|
|
38
|
-
* If neither is present, the manifest is left untouched (a manifest-less
|
|
39
|
-
* Plugin is Codex's documented `--plugin-dir` auto-discovery mode).
|
|
25
|
+
* Plugin mode writes portable `skills/` + `.mcp.json` (RFC-0002 / OpenClaw
|
|
26
|
+
* compatible-bundle). Project mode keeps MCP as an honest TOML no-op.
|
|
40
27
|
*/
|
|
41
28
|
async function write(canonical, writeContext) {
|
|
42
29
|
const artifactKind = writeContext.artifactKind ?? ((0, layout_1.isProjectLayout)(writeContext.projectRoot) ? "project" : "project");
|
|
43
30
|
let changes = (0, ai_jue_core_1.writeCapabilities)({
|
|
44
31
|
commands: (0, commands_1.commands)(),
|
|
45
32
|
agents: (0, agents_1.agents)(),
|
|
46
|
-
skills: (0, skills_1.skills)(),
|
|
33
|
+
skills: (0, skills_1.skills)(artifactKind),
|
|
47
34
|
hooks: (0, hooks_1.hooks)(),
|
|
48
|
-
mcp: (0, mcp_1.mcp)(),
|
|
35
|
+
mcp: (0, mcp_1.mcp)(artifactKind),
|
|
49
36
|
}, canonical, writeContext.projectRoot, TARGET);
|
|
50
37
|
if (artifactKind === "project" && canonical.context?.global) {
|
|
51
38
|
changes.push(...(0, context_1.context)().write(writeContext.projectRoot, { global: canonical.context.global }, TARGET));
|
|
@@ -60,13 +47,30 @@ async function write(canonical, writeContext) {
|
|
|
60
47
|
manifest = JSON.parse(fs_1.default.readFileSync(existingManifestPath, "utf8"));
|
|
61
48
|
}
|
|
62
49
|
catch {
|
|
63
|
-
|
|
50
|
+
throw new Error(`Codex Plugin manifest at ${existingManifestPath} is not valid JSON; refusing to replace it implicitly.`);
|
|
64
51
|
}
|
|
65
52
|
}
|
|
66
53
|
}
|
|
67
|
-
|
|
68
|
-
|
|
54
|
+
const candidate = manifest ?? {
|
|
55
|
+
name: "jue-plugin",
|
|
56
|
+
version: "0.1.0",
|
|
57
|
+
description: "Generated by ai-jue",
|
|
58
|
+
};
|
|
59
|
+
if (typeof candidate.name !== "string" ||
|
|
60
|
+
!candidate.name.trim() ||
|
|
61
|
+
typeof candidate.version !== "string" ||
|
|
62
|
+
!candidate.version.trim()) {
|
|
63
|
+
throw new Error(`Codex Plugin manifest at ${path_1.default.join(writeContext.projectRoot, ".codex-plugin", "plugin.json")} must contain non-empty name and version fields.`);
|
|
69
64
|
}
|
|
65
|
+
manifest = {
|
|
66
|
+
...candidate,
|
|
67
|
+
name: candidate.name.trim(),
|
|
68
|
+
version: candidate.version.trim(),
|
|
69
|
+
description: typeof candidate.description === "string" && candidate.description.trim()
|
|
70
|
+
? candidate.description.trim()
|
|
71
|
+
: "Generated by ai-jue",
|
|
72
|
+
};
|
|
73
|
+
changes.push(...(0, manifest_1.writeCodexPluginManifest)(writeContext.projectRoot, manifest, TARGET));
|
|
70
74
|
}
|
|
71
75
|
return changes;
|
|
72
76
|
}
|
package/dist/write.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.js","sourceRoot":"","sources":["../src/write.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"write.js","sourceRoot":"","sources":["../src/write.ts"],"names":[],"mappings":";;;;;AA8BA,sBAqEC;AAnGD,4CAAoB;AACpB,gDAAwB;AACxB,6CAAgD;AAEhD,kDAA+C;AAC/C,sDAAmD;AACnD,oDAAiD;AACjD,kDAAgF;AAChF,gDAA6C;AAC7C,4CAAyC;AACzC,sDAA6F;AAC7F,kDAA+C;AAQ/C,MAAM,MAAM,GAAG,OAAO,CAAC;AAEvB;;;;;;;;GAQG;AACI,KAAK,UAAU,KAAK,CACzB,SAA4B,EAC5B,YAA0B;IAE1B,MAAM,YAAY,GAChB,YAAY,CAAC,YAAY,IAAI,CAAC,IAAA,wBAAe,EAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAEnG,IAAI,OAAO,GAAG,IAAA,+BAAiB,EAC7B;QACE,QAAQ,EAAE,IAAA,mBAAQ,GAAE;QACpB,MAAM,EAAE,IAAA,eAAM,GAAE;QAChB,MAAM,EAAE,IAAA,eAAM,EAAC,YAAY,CAAC;QAC5B,KAAK,EAAE,IAAA,aAAK,GAAE;QACd,GAAG,EAAE,IAAA,SAAG,EAAC,YAAY,CAAC;KACvB,EACD,SAA+C,EAC/C,YAAY,CAAC,WAAW,EACxB,MAAM,CACP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