@keel-agent/adapters 0.1.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/LICENSE +21 -0
- package/README.md +17 -0
- package/package.json +32 -0
- package/src/index.js +73 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 keel-agent contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @keel-agent/adapters
|
|
2
|
+
|
|
3
|
+
Host adapters for exporting keel-agent canonical assets to Codex and other agent hosts.
|
|
4
|
+
|
|
5
|
+
Use this package when you already have `.keel-agent/` canonical assets and need to export them to a supported host.
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import { exportHost } from "@keel-agent/adapters";
|
|
9
|
+
|
|
10
|
+
await exportHost(process.cwd(), "codex");
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Normal project setup should go through `@keel-agent/cli`:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
ka export --host codex
|
|
17
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@keel-agent/adapters",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Host adapters for exporting keel-agent canonical assets to Codex and other agent hosts.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"package.json",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/netpilot-z/keel-agent.git",
|
|
19
|
+
"directory": "packages/adapters"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/netpilot-z/keel-agent/tree/main/packages/adapters#readme",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/netpilot-z/keel-agent/issues"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@keel-agent/core": "0.1.0",
|
|
27
|
+
"@keel-agent/templates": "0.1.0"
|
|
28
|
+
},
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=20.10.0"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import { codexSkillPath, copyDirectory, ensureDir, keelPath, pathExists, writeManagedFile } from "@keel-agent/core";
|
|
4
|
+
import { rootAgentsTemplate } from "@keel-agent/templates";
|
|
5
|
+
|
|
6
|
+
export const supportedHosts = ["codex", "claude", "cursor", "opencode"];
|
|
7
|
+
|
|
8
|
+
export async function exportHost(root, host, options = {}) {
|
|
9
|
+
if (!supportedHosts.includes(host)) {
|
|
10
|
+
throw new Error(`Unsupported host adapter: ${host}`);
|
|
11
|
+
}
|
|
12
|
+
if (host === "codex") return exportCodex(root, options);
|
|
13
|
+
return exportPlaceholder(root, host, options);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function exportCodex(root, options = {}) {
|
|
17
|
+
const actions = [];
|
|
18
|
+
const force = options.force === true;
|
|
19
|
+
const dryRun = options.dryRun === true;
|
|
20
|
+
const sourceSkills = keelPath(root, "skills");
|
|
21
|
+
const targetSkills = codexSkillPath(root);
|
|
22
|
+
|
|
23
|
+
if (!(await pathExists(sourceSkills))) {
|
|
24
|
+
throw new Error("Missing .keel-agent/skills. Run `ka init` first.");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
actions.push(await writeManagedFile(path.join(root, "AGENTS.md"), rootAgentsTemplate(), { force, dryRun }));
|
|
28
|
+
if (!dryRun) await ensureDir(targetSkills);
|
|
29
|
+
|
|
30
|
+
const skills = await fs.readdir(sourceSkills, { withFileTypes: true });
|
|
31
|
+
for (const entry of skills) {
|
|
32
|
+
if (!entry.isDirectory()) continue;
|
|
33
|
+
const source = path.join(sourceSkills, entry.name);
|
|
34
|
+
const target = path.join(targetSkills, entry.name);
|
|
35
|
+
if (!dryRun) await copyDirectory(source, target);
|
|
36
|
+
actions.push({ action: dryRun ? "would-export-skill" : "exported-skill", path: target });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
actions.push(await writeManagedFile(
|
|
40
|
+
keelPath(root, "export", "codex", "README.md"),
|
|
41
|
+
`# Codex Export
|
|
42
|
+
|
|
43
|
+
<!-- keel-agent:managed -->
|
|
44
|
+
|
|
45
|
+
Generated assets:
|
|
46
|
+
|
|
47
|
+
- \`AGENTS.md\`
|
|
48
|
+
- \`.agents/skills/*/SKILL.md\`
|
|
49
|
+
|
|
50
|
+
These files are generated from keel-agent canonical assets under \`.keel-agent/\`.
|
|
51
|
+
`,
|
|
52
|
+
{ force, dryRun }
|
|
53
|
+
));
|
|
54
|
+
|
|
55
|
+
return { host: "codex", actions };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function exportPlaceholder(root, host, options = {}) {
|
|
59
|
+
const force = options.force === true;
|
|
60
|
+
const dryRun = options.dryRun === true;
|
|
61
|
+
const target = keelPath(root, "export", host, "README.md");
|
|
62
|
+
const result = await writeManagedFile(
|
|
63
|
+
target,
|
|
64
|
+
`# ${host} Export
|
|
65
|
+
|
|
66
|
+
<!-- keel-agent:managed -->
|
|
67
|
+
|
|
68
|
+
This adapter is reserved for the keel-agent v0.x roadmap. Canonical assets already exist under \`.keel-agent/\`.
|
|
69
|
+
`,
|
|
70
|
+
{ force, dryRun }
|
|
71
|
+
);
|
|
72
|
+
return { host, actions: [result] };
|
|
73
|
+
}
|