@cogfoundry/loomloom 0.4.1-beta.4 → 0.4.2-beta.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/README.md +6 -0
- package/bin/installer.cjs +137 -0
- package/bin/loomloom.cjs +8 -6
- package/package.json +7 -7
- package/platforms.json +14 -14
package/README.md
CHANGED
|
@@ -8,3 +8,9 @@ loomloom --version
|
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
GitHub Release assets remain the binary source of truth. The launcher selects and verifies one platform package without downloading a binary during npm lifecycle scripts.
|
|
11
|
+
|
|
12
|
+
To install the matching general LoomLoom Skill for one explicit Agent, run:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npx @cogfoundry/loomloom@0.4.2-beta.1 install --agent codex --yes
|
|
16
|
+
```
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require("node:child_process");
|
|
4
|
+
const readline = require("node:readline/promises");
|
|
5
|
+
|
|
6
|
+
const PACKAGE_NAME = "@cogfoundry/loomloom";
|
|
7
|
+
const SKILL_NAME = "loomloom";
|
|
8
|
+
const SKILL_PATH = "agent-guidance/loomloom";
|
|
9
|
+
|
|
10
|
+
function parseInstallArgs(argv) {
|
|
11
|
+
const result = { agent: "", yes: false };
|
|
12
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
13
|
+
const argument = argv[index];
|
|
14
|
+
if (argument === "--yes") {
|
|
15
|
+
result.yes = true;
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
if (argument === "--agent") {
|
|
19
|
+
const agent = argv[index + 1];
|
|
20
|
+
if (!agent || agent.startsWith("-")) {
|
|
21
|
+
throw new Error("--agent requires a skills CLI agent id, such as codex");
|
|
22
|
+
}
|
|
23
|
+
result.agent = agent;
|
|
24
|
+
index += 1;
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
throw new Error(`unsupported install option: ${argument}`);
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function skillSourceURL(version) {
|
|
33
|
+
if (!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(version)) {
|
|
34
|
+
throw new Error(`unsupported npm package version for Skill installation: ${version}`);
|
|
35
|
+
}
|
|
36
|
+
return `https://github.com/cogfoundry-labs/loomloom/tree/v${version}/${SKILL_PATH}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function globalPackageSpec(version) {
|
|
40
|
+
return `${PACKAGE_NAME}@${version}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function skillsAddArgs(source, agent) {
|
|
44
|
+
return ["--yes", "skills", "add", source, "--skill", SKILL_NAME, "--global", "--agent", agent, "--yes"];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function skillsListArgs(agent) {
|
|
48
|
+
return ["--yes", "skills", "ls", "--global", "--agent", agent, "--json"];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function runCommand(command, args, options = {}) {
|
|
52
|
+
const result = spawnSync(command, args, {
|
|
53
|
+
encoding: "utf8",
|
|
54
|
+
env: options.env ?? process.env,
|
|
55
|
+
stdio: options.capture ? ["ignore", "pipe", "pipe"] : "inherit",
|
|
56
|
+
shell: process.platform === "win32" && /\.(cmd|bat)$/i.test(command),
|
|
57
|
+
});
|
|
58
|
+
if (result.error) {
|
|
59
|
+
throw result.error;
|
|
60
|
+
}
|
|
61
|
+
if (result.status !== 0) {
|
|
62
|
+
const details = `${result.stdout ?? ""}\n${result.stderr ?? ""}`.trim();
|
|
63
|
+
throw new Error(`${command} ${args.join(" ")} failed with exit ${result.status}${details ? `: ${details}` : ""}`);
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function skillInstalled(listJSON) {
|
|
69
|
+
let entries;
|
|
70
|
+
try {
|
|
71
|
+
entries = JSON.parse(listJSON);
|
|
72
|
+
} catch (error) {
|
|
73
|
+
throw new Error(`skills list returned invalid JSON: ${error.message}`);
|
|
74
|
+
}
|
|
75
|
+
return Array.isArray(entries) && entries.some((entry) => entry?.name === SKILL_NAME && typeof entry.path === "string");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function promptForAgent(prompt = {}) {
|
|
79
|
+
const input = prompt.input ?? process.stdin;
|
|
80
|
+
const output = prompt.output ?? process.stdout;
|
|
81
|
+
if (!input.isTTY) {
|
|
82
|
+
throw new Error("--agent is required when stdin is not interactive; for example: --agent codex");
|
|
83
|
+
}
|
|
84
|
+
const terminal = readline.createInterface({ input, output });
|
|
85
|
+
try {
|
|
86
|
+
const agent = (await terminal.question("Target Agent id (for example codex): ")).trim();
|
|
87
|
+
if (!agent) {
|
|
88
|
+
throw new Error("an Agent id is required");
|
|
89
|
+
}
|
|
90
|
+
return agent;
|
|
91
|
+
} finally {
|
|
92
|
+
terminal.close();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function retryCommand(source, agent) {
|
|
97
|
+
return `npx ${skillsAddArgs(source, agent).map((argument) => JSON.stringify(argument)).join(" ")}`;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async function install(argv, options = {}) {
|
|
101
|
+
const parsed = parseInstallArgs(argv);
|
|
102
|
+
const version = options.packageVersion ?? require("../package.json").version;
|
|
103
|
+
const source = skillSourceURL(version);
|
|
104
|
+
const agent = parsed.agent || await (options.promptForAgent ?? promptForAgent)();
|
|
105
|
+
const execute = options.runCommand ?? runCommand;
|
|
106
|
+
|
|
107
|
+
execute("npm", ["install", "--global", globalPackageSpec(version)]);
|
|
108
|
+
try {
|
|
109
|
+
execute("npx", skillsAddArgs(source, agent));
|
|
110
|
+
const listed = execute("npx", skillsListArgs(agent), { capture: true });
|
|
111
|
+
if (!skillInstalled(listed.stdout)) {
|
|
112
|
+
throw new Error(`skills manager did not report ${SKILL_NAME} for agent ${agent}`);
|
|
113
|
+
}
|
|
114
|
+
} catch (error) {
|
|
115
|
+
throw new Error(
|
|
116
|
+
`CLI ${version} is installed, but the ${SKILL_NAME} Skill was not installed for ${agent}. ` +
|
|
117
|
+
`Retry: ${retryCommand(source, agent)}. Cause: ${error.message}`,
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const output = options.output ?? process.stdout;
|
|
122
|
+
output.write(`Installed LoomLoom CLI ${version} and Skill ${SKILL_NAME} for ${agent}.\n`);
|
|
123
|
+
return { agent, source, version };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
module.exports = {
|
|
127
|
+
PACKAGE_NAME,
|
|
128
|
+
SKILL_NAME,
|
|
129
|
+
globalPackageSpec,
|
|
130
|
+
install,
|
|
131
|
+
parseInstallArgs,
|
|
132
|
+
retryCommand,
|
|
133
|
+
skillInstalled,
|
|
134
|
+
skillSourceURL,
|
|
135
|
+
skillsAddArgs,
|
|
136
|
+
skillsListArgs,
|
|
137
|
+
};
|
package/bin/loomloom.cjs
CHANGED
|
@@ -5,6 +5,7 @@ const crypto = require("node:crypto");
|
|
|
5
5
|
const fs = require("node:fs");
|
|
6
6
|
const path = require("node:path");
|
|
7
7
|
const { spawn } = require("node:child_process");
|
|
8
|
+
const installer = require("./installer.cjs");
|
|
8
9
|
|
|
9
10
|
const DEFAULT_MANIFEST = path.join(__dirname, "..", "platforms.json");
|
|
10
11
|
const FORWARDED_SIGNALS = process.platform === "win32"
|
|
@@ -114,21 +115,22 @@ function execute(binary, args = process.argv.slice(2)) {
|
|
|
114
115
|
});
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
function run() {
|
|
118
|
+
async function run(args = process.argv.slice(2), options = {}) {
|
|
119
|
+
if (args[0] === "install") {
|
|
120
|
+
return installer.install(args.slice(1), options);
|
|
121
|
+
}
|
|
118
122
|
const manifest = loadManifest();
|
|
119
123
|
const selected = selectPlatform(manifest);
|
|
120
124
|
const binary = locateBinary(selected);
|
|
121
125
|
verifyBinary(binary, selected.binarySHA256);
|
|
122
|
-
execute(binary);
|
|
126
|
+
return execute(binary, args);
|
|
123
127
|
}
|
|
124
128
|
|
|
125
129
|
if (require.main === module) {
|
|
126
|
-
|
|
127
|
-
run();
|
|
128
|
-
} catch (error) {
|
|
130
|
+
run().catch((error) => {
|
|
129
131
|
console.error(`loomloom: ${error.message}`);
|
|
130
132
|
process.exitCode = 1;
|
|
131
|
-
}
|
|
133
|
+
});
|
|
132
134
|
}
|
|
133
135
|
|
|
134
136
|
module.exports = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cogfoundry/loomloom",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2-beta.1",
|
|
4
4
|
"description": "LoomLoom CLI for defining, compiling, executing, and managing AI work as software",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"LICENSE"
|
|
21
21
|
],
|
|
22
22
|
"optionalDependencies": {
|
|
23
|
-
"@cogfoundry/loomloom-linux-x64": "0.4.
|
|
24
|
-
"@cogfoundry/loomloom-linux-arm64": "0.4.
|
|
25
|
-
"@cogfoundry/loomloom-darwin-x64": "0.4.
|
|
26
|
-
"@cogfoundry/loomloom-darwin-arm64": "0.4.
|
|
27
|
-
"@cogfoundry/loomloom-win32-x64": "0.4.
|
|
28
|
-
"@cogfoundry/loomloom-win32-arm64": "0.4.
|
|
23
|
+
"@cogfoundry/loomloom-linux-x64": "0.4.2-beta.1",
|
|
24
|
+
"@cogfoundry/loomloom-linux-arm64": "0.4.2-beta.1",
|
|
25
|
+
"@cogfoundry/loomloom-darwin-x64": "0.4.2-beta.1",
|
|
26
|
+
"@cogfoundry/loomloom-darwin-arm64": "0.4.2-beta.1",
|
|
27
|
+
"@cogfoundry/loomloom-win32-x64": "0.4.2-beta.1",
|
|
28
|
+
"@cogfoundry/loomloom-win32-arm64": "0.4.2-beta.1"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
package/platforms.json
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
{
|
|
2
|
-
"releaseTag": "v0.4.
|
|
3
|
-
"version": "0.4.
|
|
2
|
+
"releaseTag": "v0.4.2-beta.1",
|
|
3
|
+
"version": "0.4.2-beta.1",
|
|
4
4
|
"platforms": {
|
|
5
5
|
"linux-x64": {
|
|
6
6
|
"package": "@cogfoundry/loomloom-linux-x64",
|
|
7
7
|
"binary": "bin/loomloom",
|
|
8
|
-
"binarySHA256": "
|
|
8
|
+
"binarySHA256": "14c48278e33ee4aa7cf0c820d70ae51d9b588d721d803e5a9938267629325264",
|
|
9
9
|
"archive": "loomloom-linux-amd64.tar.gz",
|
|
10
|
-
"archiveSHA256": "
|
|
10
|
+
"archiveSHA256": "a2440c01d62e4eeb05dd449787cc4794dc8d82d0a53c51594099e1a7f1b98a0d"
|
|
11
11
|
},
|
|
12
12
|
"linux-arm64": {
|
|
13
13
|
"package": "@cogfoundry/loomloom-linux-arm64",
|
|
14
14
|
"binary": "bin/loomloom",
|
|
15
|
-
"binarySHA256": "
|
|
15
|
+
"binarySHA256": "77307de0cd23364bee06abaf1ad591ceaa83c360f63b1623902d960ba54b0707",
|
|
16
16
|
"archive": "loomloom-linux-arm64.tar.gz",
|
|
17
|
-
"archiveSHA256": "
|
|
17
|
+
"archiveSHA256": "d4f815586a87ec65ae054911a4b57e221d74cd92b129a30c5c7bbadb1f1c73ce"
|
|
18
18
|
},
|
|
19
19
|
"darwin-x64": {
|
|
20
20
|
"package": "@cogfoundry/loomloom-darwin-x64",
|
|
21
21
|
"binary": "bin/loomloom",
|
|
22
|
-
"binarySHA256": "
|
|
22
|
+
"binarySHA256": "ccaa3cb68b507cdbb86a11cfc8fa9ca68b4c40e95ec381d40bbd9c357e14e500",
|
|
23
23
|
"archive": "loomloom-darwin-amd64.tar.gz",
|
|
24
|
-
"archiveSHA256": "
|
|
24
|
+
"archiveSHA256": "c06d04b472c02c9f6e4a1b7125d06245b60a236a32d765b82bf469174cde4ca5"
|
|
25
25
|
},
|
|
26
26
|
"darwin-arm64": {
|
|
27
27
|
"package": "@cogfoundry/loomloom-darwin-arm64",
|
|
28
28
|
"binary": "bin/loomloom",
|
|
29
|
-
"binarySHA256": "
|
|
29
|
+
"binarySHA256": "a0aaa0d7c7abd52eb496c3e11fd6a642bff7f7d025e198e49063560272b1c20b",
|
|
30
30
|
"archive": "loomloom-darwin-arm64.tar.gz",
|
|
31
|
-
"archiveSHA256": "
|
|
31
|
+
"archiveSHA256": "762b580768b2338b4533699e45876a94fa765f9f411ba57bf205af991fae2cbf"
|
|
32
32
|
},
|
|
33
33
|
"win32-x64": {
|
|
34
34
|
"package": "@cogfoundry/loomloom-win32-x64",
|
|
35
35
|
"binary": "bin/loomloom.exe",
|
|
36
|
-
"binarySHA256": "
|
|
36
|
+
"binarySHA256": "69389f87b32c874a94add0ef51b17178533cf07bddf9f6b3fc06de5c2449b662",
|
|
37
37
|
"archive": "loomloom-windows-amd64.zip",
|
|
38
|
-
"archiveSHA256": "
|
|
38
|
+
"archiveSHA256": "583ad168709c6b7a28bf637f562ee7534c9990c315a054a736f8525d27fa454d"
|
|
39
39
|
},
|
|
40
40
|
"win32-arm64": {
|
|
41
41
|
"package": "@cogfoundry/loomloom-win32-arm64",
|
|
42
42
|
"binary": "bin/loomloom.exe",
|
|
43
|
-
"binarySHA256": "
|
|
43
|
+
"binarySHA256": "4f4aeacafd7ffeb85845940f27575c4611cb56c84f12934bca802fe68b0a324b",
|
|
44
44
|
"archive": "loomloom-windows-arm64.zip",
|
|
45
|
-
"archiveSHA256": "
|
|
45
|
+
"archiveSHA256": "e614d85b06363ce2356a06f371576e67e3d2370eb72dda9f968e8c7f67ad2b98"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|