macaw-ai 0.9.11 → 0.9.12
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/bin/macaw.js +30 -16
- package/package.json +1 -1
package/bin/macaw.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// `
|
|
3
|
-
//
|
|
4
|
-
//
|
|
2
|
+
// `macaw-ai install` - the one name to remember. It installs nothing itself;
|
|
3
|
+
// it asks which surface you want governed and hands off to the package that
|
|
4
|
+
// does that one thing.
|
|
5
5
|
//
|
|
6
6
|
// Kept separate from those packages so this name never has to narrow. It
|
|
7
7
|
// means "MACAW" today and will still mean it when there are six surfaces.
|
|
@@ -15,14 +15,18 @@ const SURFACES = [
|
|
|
15
15
|
{
|
|
16
16
|
key: "1",
|
|
17
17
|
pkg: "@macaw-ai/coding-agents",
|
|
18
|
-
label: "Claude Code and Codex
|
|
18
|
+
label: "Claude Code and Codex",
|
|
19
19
|
detail: "every tool call stops at a hook and waits for a decision",
|
|
20
|
+
command: "macaw-sidecar",
|
|
21
|
+
subcommand: true,
|
|
20
22
|
},
|
|
21
23
|
{
|
|
22
24
|
key: "2",
|
|
23
25
|
pkg: "@macaw-ai/client",
|
|
24
|
-
label: "
|
|
25
|
-
detail: "
|
|
26
|
+
label: "the MACAW SDK Client Library and secureAI adapters",
|
|
27
|
+
detail: "drop-in adapters for popular agentic frameworks",
|
|
28
|
+
command: "macaw-client",
|
|
29
|
+
subcommand: true,
|
|
26
30
|
},
|
|
27
31
|
];
|
|
28
32
|
|
|
@@ -30,15 +34,23 @@ const C = process.stdout.isTTY
|
|
|
30
34
|
? { b: "\x1b[1m", dim: "\x1b[2m", c: "\x1b[36m", x: "\x1b[0m" }
|
|
31
35
|
: { b: "", dim: "", c: "", x: "" };
|
|
32
36
|
|
|
33
|
-
function
|
|
34
|
-
console.log(`\n${C.dim} →
|
|
35
|
-
const r = spawnSync(
|
|
36
|
-
stdio: "inherit",
|
|
37
|
-
env: { ...process.env, ...env },
|
|
38
|
-
});
|
|
37
|
+
function sh(cmd, args, env) {
|
|
38
|
+
console.log(`\n${C.dim} → ${cmd} ${args.join(" ")}${C.x}\n`);
|
|
39
|
+
const r = spawnSync(cmd, args, { stdio: "inherit", env: { ...process.env, ...env } });
|
|
39
40
|
return r.status ?? 1;
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
// Installed, then run by name. npx links no commands, so the launchers it
|
|
44
|
+
// leaves behind can only be reached by their full path inside an npm cache
|
|
45
|
+
// directory - which is how an install ended up telling people to type ninety
|
|
46
|
+
// characters.
|
|
47
|
+
function run(surface, args, env) {
|
|
48
|
+
const code = sh("npm", ["install", "-g", surface.pkg], env);
|
|
49
|
+
if (code !== 0) return code;
|
|
50
|
+
const rest = surface.subcommand ? args : args.filter((a) => a !== "install");
|
|
51
|
+
return sh(surface.command, rest, env);
|
|
52
|
+
}
|
|
53
|
+
|
|
42
54
|
// The coding-agents installer writes its key here. Reading it back lets the
|
|
43
55
|
// second surface join that workspace without asking for a key the user
|
|
44
56
|
// approved thirty seconds earlier.
|
|
@@ -68,7 +80,7 @@ function both(args) {
|
|
|
68
80
|
// restarted. Say which step this is.
|
|
69
81
|
console.log("");
|
|
70
82
|
console.log(`${C.b} ── ${i + 1} of ${SURFACES.length} · ${s.label} ──${C.x}`);
|
|
71
|
-
const code = run(s
|
|
83
|
+
const code = run(s, steps, i === 0 ? undefined : keyFromThisDirectory());
|
|
72
84
|
if (code !== 0) return code;
|
|
73
85
|
}
|
|
74
86
|
return 0;
|
|
@@ -81,7 +93,7 @@ async function main() {
|
|
|
81
93
|
// macaw-ai install --coding-agents
|
|
82
94
|
const named = SURFACES.find((s) => args.includes(`--${s.pkg.split("/")[1]}`));
|
|
83
95
|
if (named) {
|
|
84
|
-
process.exit(run(named
|
|
96
|
+
process.exit(run(named, args.filter((a) => !a.startsWith("--macaw") && a !== `--${named.pkg.split("/")[1]}`)));
|
|
85
97
|
}
|
|
86
98
|
|
|
87
99
|
// macaw-ai install --both
|
|
@@ -107,7 +119,9 @@ async function main() {
|
|
|
107
119
|
// something nobody asked for. Say what to type instead.
|
|
108
120
|
if (!process.stdin.isTTY) {
|
|
109
121
|
console.log(" Nothing is attached to answer, so pick one directly:");
|
|
110
|
-
for (const s of SURFACES)
|
|
122
|
+
for (const s of SURFACES) {
|
|
123
|
+
console.log(` npm install -g ${s.pkg} && ${s.command}${s.subcommand ? " install" : ""}`);
|
|
124
|
+
}
|
|
111
125
|
console.log("");
|
|
112
126
|
process.exit(1);
|
|
113
127
|
}
|
|
@@ -124,7 +138,7 @@ async function main() {
|
|
|
124
138
|
console.log(" Not a choice.");
|
|
125
139
|
process.exit(1);
|
|
126
140
|
}
|
|
127
|
-
process.exit(run(picked
|
|
141
|
+
process.exit(run(picked, rest));
|
|
128
142
|
}
|
|
129
143
|
|
|
130
144
|
main().catch((e) => { console.error(e.message); process.exit(1); });
|
package/package.json
CHANGED