@anhlp/alp-cli 0.0.1-beta.7 → 0.0.1-beta.8
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/THIRD-PARTY-NOTICES.txt +1 -1
- package/dist/acp/main.js +1 -1
- package/dist/acp.js +7425 -2195
- package/dist/alp-web/assets/{TerminalPanel-BeMws9CP.js → TerminalPanel-BbYa_Xkd.js} +1 -1
- package/dist/alp-web/assets/{index-Dl7motn1.js → index-DOJh89Ik.js} +35 -35
- package/dist/alp-web/index.html +1 -1
- package/dist/alp-web.js +154 -29
- package/dist/alpd.js +10588 -4190
- package/dist/backup.js +1 -1
- package/dist/build-manifest.json +11 -2
- package/dist/cli.js +5 -3
- package/dist/daemon.d.ts +1 -1
- package/dist/daemon.js +2 -2
- package/dist/interfaces.js +2 -0
- package/dist/library.d.ts +16 -2
- package/dist/library.js +114 -7
- package/dist/projects.js +2 -1
- package/dist/self-update.d.ts +2 -1
- package/dist/self-update.js +22 -5
- package/dist/usage.d.ts +1 -1
- package/dist/usage.js +7 -2
- package/package.json +5 -5
- package/src/cli.js +6 -2
- package/src/daemon.js +3 -3
- package/src/interfaces.js +4 -0
- package/src/library.js +108 -9
- package/src/projects.js +3 -1
- package/src/self-update.js +35 -6
- package/src/usage.js +7 -2
package/dist/backup.js
CHANGED
|
@@ -7,7 +7,7 @@ import { acquireDaemonLock, alpHome, assertPrivateDirectory, daemonPaths, lockAl
|
|
|
7
7
|
import { daemonHeld, holdDaemon, releaseHold } from "@anhlp/alp-client/supervise";
|
|
8
8
|
import { start, stop } from "./daemon.js";
|
|
9
9
|
import { UsageError } from "./usage.js";
|
|
10
|
-
var VERSION = true ? "0.0.1-beta.
|
|
10
|
+
var VERSION = true ? "0.0.1-beta.8" : "dev";
|
|
11
11
|
var BY = `alp ${VERSION}`;
|
|
12
12
|
var size = (bytes) => bytes >= 1024 * 1024 ? `${(bytes / 1024 / 1024).toFixed(1)} MB` : bytes >= 1024 ? `${(bytes / 1024).toFixed(1)} KB` : `${bytes} B`;
|
|
13
13
|
var stamp = () => (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "Z");
|
package/dist/build-manifest.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.1-beta.
|
|
2
|
+
"version": "0.0.1-beta.8",
|
|
3
3
|
"entries": {
|
|
4
4
|
"packages/cli/dist/alpd.js": {
|
|
5
5
|
"inputs": [
|
|
6
|
+
"packages/client/src/acp-probe.js",
|
|
6
7
|
"packages/client/src/index.js",
|
|
7
8
|
"packages/client/src/ipc.js",
|
|
9
|
+
"packages/client/src/mcp-probe.js",
|
|
8
10
|
"packages/client/src/portable.js",
|
|
9
11
|
"packages/client/src/rpc/client.js",
|
|
10
12
|
"packages/client/src/rpc/errors.js",
|
|
@@ -41,6 +43,7 @@
|
|
|
41
43
|
"packages/core/src/resolver.js",
|
|
42
44
|
"packages/core/src/safe-path.js",
|
|
43
45
|
"packages/core/src/shell.js",
|
|
46
|
+
"packages/core/src/skill-validate.js",
|
|
44
47
|
"packages/core/src/state-schema.js",
|
|
45
48
|
"packages/core/src/task-rows.js",
|
|
46
49
|
"packages/core/src/tasks.js",
|
|
@@ -63,6 +66,7 @@
|
|
|
63
66
|
"packages/daemon/src/lifecycle.ts",
|
|
64
67
|
"packages/daemon/src/lock.ts",
|
|
65
68
|
"packages/daemon/src/main.ts",
|
|
69
|
+
"packages/daemon/src/model-catalog.ts",
|
|
66
70
|
"packages/daemon/src/native-terminal.ts",
|
|
67
71
|
"packages/daemon/src/operations.ts",
|
|
68
72
|
"packages/daemon/src/registry.ts",
|
|
@@ -110,13 +114,15 @@
|
|
|
110
114
|
"packages/runtime/src/runtime-context.ts",
|
|
111
115
|
"packages/runtime/src/runtime.ts",
|
|
112
116
|
"packages/runtime/src/session-config.ts",
|
|
117
|
+
"packages/runtime/src/skill-resources.ts",
|
|
113
118
|
"packages/runtime/src/tool-detail.ts",
|
|
114
119
|
"packages/runtime/src/tool-results.ts",
|
|
115
120
|
"packages/runtime/src/tools.ts",
|
|
116
121
|
"packages/runtime/src/transport.ts",
|
|
117
122
|
"packages/runtime/src/usage.ts",
|
|
118
123
|
"packages/runtime/src/workspace.ts",
|
|
119
|
-
"packages/runtime/src/worktree-domain.ts"
|
|
124
|
+
"packages/runtime/src/worktree-domain.ts",
|
|
125
|
+
"packages/runtime/src/write-error.ts"
|
|
120
126
|
],
|
|
121
127
|
"external": [
|
|
122
128
|
"child_process",
|
|
@@ -208,6 +214,7 @@
|
|
|
208
214
|
"packages/client/src/websocket.js",
|
|
209
215
|
"packages/core/src/atomic.js",
|
|
210
216
|
"packages/core/src/errors.js",
|
|
217
|
+
"packages/core/src/gate-ledger.js",
|
|
211
218
|
"packages/core/src/library-edit.js",
|
|
212
219
|
"packages/core/src/library.js",
|
|
213
220
|
"packages/core/src/log.js",
|
|
@@ -218,6 +225,8 @@
|
|
|
218
225
|
"packages/core/src/resolver.js",
|
|
219
226
|
"packages/core/src/safe-path.js",
|
|
220
227
|
"packages/core/src/shell.js",
|
|
228
|
+
"packages/core/src/skill-validate.js",
|
|
229
|
+
"packages/core/src/tasks.js",
|
|
221
230
|
"packages/core/src/teams.js",
|
|
222
231
|
"packages/core/src/template-path.js",
|
|
223
232
|
"packages/core/src/validation.js",
|
package/dist/cli.js
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
import { setup } from "@anhlp/alp-client/setup";
|
|
5
5
|
import { alpHome } from "@anhlp/alp-client/index";
|
|
6
6
|
import { scrubText } from "@anhlp/alp-core/log";
|
|
7
|
+
import { catalogModels, useLiveModels } from "@anhlp/alp-core/models";
|
|
7
8
|
import { USAGE, UsageError } from "./usage.js";
|
|
8
9
|
import { project, permissionsCommand, trustCommand, language, verify, doctor } from "./projects.js";
|
|
9
10
|
import { daemon } from "./daemon.js";
|
|
10
11
|
import { run, ps, attach, send, questions, answer, top, log, board, models, pause, resume, recall, interrupt, compact } from "./sessions.js";
|
|
11
|
-
import { libraryCommand, editCommand, teamsCommand } from "./library.js";
|
|
12
|
+
import { libraryCommand, editCommand, teamsCommand, packsCommand, packCommand } from "./library.js";
|
|
12
13
|
import { scheduleCommand } from "./schedules.js";
|
|
13
14
|
import { tasksCommand, formulaCommand, taskCommand } from "./tasks.js";
|
|
14
15
|
import { webCommand, acpCommand } from "./interfaces.js";
|
|
@@ -19,7 +20,7 @@ import { selfUpdate } from "./self-update.js";
|
|
|
19
20
|
import { bundleInfo } from "@anhlp/alp-core/packaged";
|
|
20
21
|
import { connect, lockAlive, readLock } from "@anhlp/alp-client/index";
|
|
21
22
|
function alpVersion() {
|
|
22
|
-
return true ? "0.0.1-beta.
|
|
23
|
+
return true ? "0.0.1-beta.8" : JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
23
24
|
}
|
|
24
25
|
async function runningDaemon() {
|
|
25
26
|
const lock = await readLock(alpHome());
|
|
@@ -39,13 +40,14 @@ async function updateCommand(args2) {
|
|
|
39
40
|
const code = await selfUpdate(args2, { bundle: bundleInfo(), version: alpVersion(), daemon: runningDaemon });
|
|
40
41
|
if (code) process.exitCode = code;
|
|
41
42
|
}
|
|
42
|
-
var commands = { schedule: scheduleCommand, setup: (args2) => setup(args2, alpHome()), init: (args2) => project("init", args2), "update-template": (args2) => project("upgrade", args2), upgrade: (args2) => project("upgrade", args2), update: updateCommand, daemon, doctor, run, ps, top, attach, send, questions, answer, log, board, tasks: tasksCommand, task: taskCommand, formula: formulaCommand, permissions: permissionsCommand, agents: (args2) => libraryCommand("agents", args2), skills: (args2) => libraryCommand("skills", args2), mcp: (args2) => ["add", "rm", "mv", "cp", "test", "show", "edit"].includes(args2[0]) ? editCommand("mcp", args2) : libraryCommand("mcp", args2), hooks: (args2) => libraryCommand("hooks", args2), providers: (args2) => libraryCommand("providers", args2), provider: (args2) => editCommand("providers", args2), teams: teamsCommand, trust: trustCommand, agent: (args2) => editCommand("agents", args2), team: (args2) => editCommand("teams", args2), skill: (args2) => editCommand("skills", args2), hook: (args2) => editCommand("hooks", args2), verify, recall, pause, resume, language, models, interrupt, compact, acp: acpCommand, web: webCommand, backup: backupCommand, restore: restoreCommand, terminal: terminalCommand, bridge: bridgeCommand };
|
|
43
|
+
var commands = { schedule: scheduleCommand, setup: (args2) => setup(args2, alpHome()), init: (args2) => project("init", args2), "update-template": (args2) => project("upgrade", args2), upgrade: (args2) => project("upgrade", args2), update: updateCommand, daemon, doctor, run, ps, top, attach, send, questions, answer, log, board, tasks: tasksCommand, task: taskCommand, formula: formulaCommand, permissions: permissionsCommand, agents: (args2) => libraryCommand("agents", args2), skills: (args2) => libraryCommand("skills", args2), mcp: (args2) => ["add", "rm", "mv", "cp", "test", "show", "edit"].includes(args2[0]) ? editCommand("mcp", args2) : libraryCommand("mcp", args2), hooks: (args2) => libraryCommand("hooks", args2), providers: (args2) => libraryCommand("providers", args2), provider: (args2) => editCommand("providers", args2), teams: teamsCommand, packs: packsCommand, pack: packCommand, trust: trustCommand, agent: (args2) => editCommand("agents", args2), team: (args2) => editCommand("teams", args2), skill: (args2) => editCommand("skills", args2), hook: (args2) => editCommand("hooks", args2), verify, recall, pause, resume, language, models, interrupt, compact, acp: acpCommand, web: webCommand, backup: backupCommand, restore: restoreCommand, terminal: terminalCommand, bridge: bridgeCommand };
|
|
43
44
|
var [command, ...args] = process.argv.slice(2);
|
|
44
45
|
try {
|
|
45
46
|
if (command === "--version") {
|
|
46
47
|
console.log(alpVersion());
|
|
47
48
|
} else {
|
|
48
49
|
if (!Object.hasOwn(commands, command)) throw new UsageError();
|
|
50
|
+
if (command !== "setup") useLiveModels(catalogModels(alpHome()));
|
|
49
51
|
await commands[command](args);
|
|
50
52
|
}
|
|
51
53
|
} catch (error) {
|
package/dist/daemon.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function built(): Promise<void>;
|
|
2
|
-
/** Waits until an alpd for this home is ready; returns its socket. */
|
|
2
|
+
/** Waits until an alpd for this home is ready; returns its socket. Default wait: ALP_DAEMON_START_TIMEOUT_MS, else 60 s. */
|
|
3
3
|
export function ready(timeoutMs?: number): Promise<any>;
|
|
4
4
|
/** The installed service for this ALP_HOME, if any. */
|
|
5
5
|
export function installed(): Promise<{
|
package/dist/daemon.js
CHANGED
|
@@ -3,7 +3,7 @@ import { access } from "node:fs/promises";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { installedProgram, installService, serviceFor, uninstallService } from "@anhlp/alp-client/service";
|
|
5
5
|
import { holdDaemon, startDaemon } from "@anhlp/alp-client/supervise";
|
|
6
|
-
import { alpHome, connect, lockAlive, readLock, withDaemonLifecycle } from "@anhlp/alp-client/index";
|
|
6
|
+
import { alpHome, connect, daemonStartTimeoutMs, lockAlive, readLock, withDaemonLifecycle } from "@anhlp/alp-client/index";
|
|
7
7
|
import { scrubText } from "@anhlp/alp-core/log";
|
|
8
8
|
import { UsageError } from "./usage.js";
|
|
9
9
|
import { DAEMON_ENTRY } from "./paths.js";
|
|
@@ -15,7 +15,7 @@ async function built() {
|
|
|
15
15
|
throw new Error(`alpd is not built (${DAEMON_ENTRY}); run npm run build`);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
async function ready(timeoutMs =
|
|
18
|
+
async function ready(timeoutMs = daemonStartTimeoutMs()) {
|
|
19
19
|
const deadline = Date.now() + timeoutMs;
|
|
20
20
|
while (Date.now() < deadline) {
|
|
21
21
|
const lock = await readLock(alpHome());
|
package/dist/interfaces.js
CHANGED
|
@@ -9,6 +9,7 @@ import { UsageError } from "./usage.js";
|
|
|
9
9
|
import { built, start, running } from "./daemon.js";
|
|
10
10
|
import { DAEMON_ENTRY, distributionEntry } from "./paths.js";
|
|
11
11
|
import { entryCommand } from "@anhlp/alp-core/packaged";
|
|
12
|
+
import { isAgentProcess } from "@anhlp/alp-core/tasks";
|
|
12
13
|
import { runRole } from "./roles.js";
|
|
13
14
|
import { alpWebEntry, alpWebScript, isWebClaimed, isWebReady, refusal, stopPreRenamePaseo, stopWebService, webOwner } from "./web-service.js";
|
|
14
15
|
var PASEO = "paseo";
|
|
@@ -144,6 +145,7 @@ ${refusal(home)} (${owner.reason}). If it is not alp web, stop it, then run alp
|
|
|
144
145
|
return `${info.url}#token=${info.token}`;
|
|
145
146
|
}
|
|
146
147
|
async function webCommand(args) {
|
|
148
|
+
if (isAgentProcess()) throw new Error("alp web is the user's: it prints and rotates the user's credential; this process was started by an ALP agent (ALP_AGENT_SESSION is set)");
|
|
147
149
|
if (args[0] === "pair") return pairCommand(args.slice(1));
|
|
148
150
|
if (args[0] === "rotate") return rotateCommand(args.slice(1));
|
|
149
151
|
if (args[0] === "serve") return runRole("web", alpWebScript(), args.slice(1));
|
package/dist/library.d.ts
CHANGED
|
@@ -86,6 +86,12 @@ export const EDIT_OPTIONS: {
|
|
|
86
86
|
file: {
|
|
87
87
|
type: string;
|
|
88
88
|
};
|
|
89
|
+
roles: {
|
|
90
|
+
type: string;
|
|
91
|
+
};
|
|
92
|
+
'no-roles': {
|
|
93
|
+
type: string;
|
|
94
|
+
};
|
|
89
95
|
command: {
|
|
90
96
|
type: string;
|
|
91
97
|
};
|
|
@@ -122,10 +128,10 @@ export const EDIT_OPTIONS: {
|
|
|
122
128
|
'match-label': {
|
|
123
129
|
type: string;
|
|
124
130
|
};
|
|
125
|
-
|
|
131
|
+
strict: {
|
|
126
132
|
type: string;
|
|
127
133
|
};
|
|
128
|
-
|
|
134
|
+
kind: {
|
|
129
135
|
type: string;
|
|
130
136
|
};
|
|
131
137
|
models: {
|
|
@@ -138,3 +144,11 @@ export function edited(kind: any, name: any, current: any, values: any): Promise
|
|
|
138
144
|
export function editCommand(kind: any, args: any): Promise<void>;
|
|
139
145
|
/** alp trust: the workspaces whose hooks run without asking (ALPD §45). */
|
|
140
146
|
export function teamsCommand(args: any): Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* alp packs [--project DIR] [--json]: the optional packs ALP ships, and whether the library or the
|
|
149
|
+
* project has them. alp pack install <id> [--project [DIR]] [--assign] [--json]: copies a pack's
|
|
150
|
+
* skills, agents and teams into the library (or the project's .alp/), keeping any entry already
|
|
151
|
+
* there; --assign (library) gives its suggested skills to roles in role-skills.json.
|
|
152
|
+
*/
|
|
153
|
+
export function packsCommand(args: any): Promise<void>;
|
|
154
|
+
export function packCommand(args: any): Promise<void>;
|
package/dist/library.js
CHANGED
|
@@ -5,14 +5,31 @@ import { parseArgs } from "node:util";
|
|
|
5
5
|
import { seedLibrary } from "@anhlp/alp-core/library";
|
|
6
6
|
import { libraryEntries } from "@anhlp/alp-core/resolver";
|
|
7
7
|
import { listTeams, resolveTeam } from "@anhlp/alp-core/teams";
|
|
8
|
-
import { deleteEntry, duplicateEntry, getEntry, renameEntry, saveEntry } from "@anhlp/alp-core/library-edit";
|
|
8
|
+
import { deleteEntry, duplicateEntry, getEntry, listRetiredSkills, renameEntry, restoreSkill, saveEntry, withSkillName } from "@anhlp/alp-core/library-edit";
|
|
9
9
|
import { testEntry } from "@anhlp/alp-client/library-test";
|
|
10
|
+
import { formatValidation, validateSkill } from "@anhlp/alp-core/skill-validate";
|
|
11
|
+
import { installPack, listPacks, packStatus } from "@anhlp/alp-core/packs";
|
|
10
12
|
import { alpHome } from "@anhlp/alp-client/index";
|
|
11
13
|
import { UsageError } from "./usage.js";
|
|
12
14
|
import { taskProject } from "./tasks.js";
|
|
13
15
|
async function libraryCommand(kind, args) {
|
|
14
|
-
const { values, positionals } = parseArgs({ args, allowPositionals: true, options: { project: { type: "string" }, json: { type: "boolean" } } });
|
|
16
|
+
const { values, positionals } = parseArgs({ args, allowPositionals: true, options: { project: { type: "string" }, json: { type: "boolean" }, ...kind === "skills" ? { retired: { type: "boolean" } } : {} } });
|
|
15
17
|
if (positionals.length) throw new UsageError();
|
|
18
|
+
if (values.retired) {
|
|
19
|
+
if (values.project !== void 0) throw new UsageError();
|
|
20
|
+
const rows2 = await listRetiredSkills({ library: alpHome() });
|
|
21
|
+
if (values.json) {
|
|
22
|
+
console.log(JSON.stringify(rows2));
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (!rows2.length) {
|
|
26
|
+
console.log(`No retired skills in ${path.join(alpHome(), "retired-skills")}`);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const width2 = Math.max(...rows2.map((row) => row.name.length));
|
|
30
|
+
for (const row of rows2) console.log(`${row.name.padEnd(width2)} ${row.retiredAt} ${row.roles === null ? "roles not recorded" : `roles: ${row.roles.join(", ") || "none"}`}${row.agent ? `; by ${row.agent}` : ""}${row.invalid ? `; warning: invalid retired metadata: ${row.invalid}` : ""} ${row.directory}`);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
16
33
|
if (kind === "providers") await seedLibrary(alpHome());
|
|
17
34
|
const root = path.resolve(values.project ?? process.cwd());
|
|
18
35
|
const rows = await libraryEntries(kind, root, { library: alpHome() });
|
|
@@ -75,6 +92,8 @@ var EDIT_OPTIONS = {
|
|
|
75
92
|
rules: { type: "string" },
|
|
76
93
|
// skill, mcp, hook
|
|
77
94
|
file: { type: "string" },
|
|
95
|
+
roles: { type: "string" },
|
|
96
|
+
"no-roles": { type: "boolean" },
|
|
78
97
|
command: { type: "string" },
|
|
79
98
|
arg: { type: "string", multiple: true },
|
|
80
99
|
env: { type: "string", multiple: true },
|
|
@@ -86,9 +105,9 @@ var EDIT_OPTIONS = {
|
|
|
86
105
|
timeout: { type: "string" },
|
|
87
106
|
"match-agent": { type: "string" },
|
|
88
107
|
"match-label": { type: "string" },
|
|
108
|
+
strict: { type: "boolean" },
|
|
89
109
|
// provider
|
|
90
110
|
kind: { type: "string" },
|
|
91
|
-
"read-only-mode": { type: "string" },
|
|
92
111
|
models: { type: "string" }
|
|
93
112
|
};
|
|
94
113
|
async function edited(kind, name, current, values) {
|
|
@@ -156,12 +175,16 @@ Describe what this agent does, and how.
|
|
|
156
175
|
if (values.file !== void 0) content.body = await readFile(values.file, "utf8");
|
|
157
176
|
content.body ??= `---
|
|
158
177
|
name: ${name}
|
|
159
|
-
description:
|
|
178
|
+
description: ${JSON.stringify(values.description ?? `What ${name} does. Use when the work it is for comes up.`)}
|
|
160
179
|
---
|
|
161
180
|
|
|
162
181
|
# ${name}
|
|
163
182
|
|
|
164
|
-
|
|
183
|
+
## When to use
|
|
184
|
+
|
|
185
|
+
## Workflow
|
|
186
|
+
|
|
187
|
+
## Verification
|
|
165
188
|
`;
|
|
166
189
|
} else if (kind === "mcp") {
|
|
167
190
|
if (values.command !== void 0 || values.url !== void 0) content.server = {};
|
|
@@ -199,7 +222,7 @@ Steps and checks.
|
|
|
199
222
|
set(provider, "label", values.label);
|
|
200
223
|
set(provider, "description", values.description);
|
|
201
224
|
set(provider, "command", values.command);
|
|
202
|
-
|
|
225
|
+
delete provider.readOnlyMode;
|
|
203
226
|
if (values.arg?.length) provider.args = values.arg;
|
|
204
227
|
if (values.env?.length) provider.env = pairs(values.env, "--env");
|
|
205
228
|
const models = names(values.models);
|
|
@@ -211,9 +234,44 @@ Steps and checks.
|
|
|
211
234
|
}
|
|
212
235
|
return content;
|
|
213
236
|
}
|
|
237
|
+
async function checkSkills(name, positionals, values) {
|
|
238
|
+
if (positionals.length > 2) throw new UsageError();
|
|
239
|
+
const root = path.resolve(values.project ?? process.cwd());
|
|
240
|
+
const mode = values.strict ? "strict" : "legacy";
|
|
241
|
+
let targets;
|
|
242
|
+
if (name !== void 0 && (name.includes("/") || name.includes(path.sep) || name.startsWith("."))) targets = [path.resolve(name)];
|
|
243
|
+
else {
|
|
244
|
+
const rows = await libraryEntries("skills", root, { library: alpHome() });
|
|
245
|
+
const chosen = name === void 0 ? rows : rows.filter((row) => row.name === name);
|
|
246
|
+
if (name !== void 0 && !chosen.length) throw new Error(`No skill '${name}' in ${path.join(root, ".alp", "skills")} or ${path.join(alpHome(), "skills")}`);
|
|
247
|
+
targets = chosen.map((row) => path.dirname(row.path));
|
|
248
|
+
}
|
|
249
|
+
const reports = [];
|
|
250
|
+
for (const target of targets) reports.push(await validateSkill(target, { mode }));
|
|
251
|
+
if (values.json) console.log(JSON.stringify(reports));
|
|
252
|
+
else {
|
|
253
|
+
for (const report of reports) console.log(formatValidation(report));
|
|
254
|
+
const failed = reports.filter((report) => !report.ok).length;
|
|
255
|
+
const warned = reports.filter((report) => report.warnings.length).length;
|
|
256
|
+
console.log(`${reports.length} skill${reports.length === 1 ? "" : "s"} checked (${mode}): ${failed} with errors, ${warned} with warnings.${mode === "legacy" && warned ? " Warnings do not stop a skill from loading; fix them when you next edit it." : ""}`);
|
|
257
|
+
}
|
|
258
|
+
if (reports.some((report) => !report.ok)) process.exitCode = 1;
|
|
259
|
+
}
|
|
214
260
|
async function editCommand(kind, args) {
|
|
261
|
+
if (kind === "providers" && args.some((arg) => arg === "--read-only-mode" || arg.startsWith("--read-only-mode="))) throw new Error("--read-only-mode was removed; delete readOnlyMode from provider JSON and choose the session --mode read-only, workspace-write or full-access. Existing native sessions keep their mode.");
|
|
215
262
|
const { values, positionals } = parseArgs({ args: projectFlag(args), allowPositionals: true, options: EDIT_OPTIONS });
|
|
216
263
|
const [action, name, target] = positionals;
|
|
264
|
+
if (kind === "skills" && action === "restore") {
|
|
265
|
+
if (!name || positionals.length > 2 || values.project !== void 0 || values.roles !== void 0 && values["no-roles"]) throw new UsageError();
|
|
266
|
+
const roles = values["no-roles"] ? [] : names(values.roles);
|
|
267
|
+
const result2 = await restoreSkill(name, { library: alpHome(), from: values.from, roles });
|
|
268
|
+
console.log(values.json ? JSON.stringify(result2) : `Restored ${name} to ${result2.restored} from ${result2.from}; ${result2.roles.length ? `given to ${result2.roles.join(", ")}` : "given to no role"}.`);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (kind === "skills" && action === "check") {
|
|
272
|
+
await checkSkills(name, positionals, values);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
217
275
|
if (kind === "providers" && action !== "add") await seedLibrary(alpHome());
|
|
218
276
|
const creates = { agents: "new", teams: "new", skills: "new", mcp: "add", hooks: "add", providers: "add" }[kind];
|
|
219
277
|
if (!name || positionals.length > (["cp", "mv"].includes(action) ? 3 : 2) || ["cp", "mv"].includes(action) && !target) throw new UsageError();
|
|
@@ -271,6 +329,7 @@ stderr: ${result2.stderr.trim()}` : ""}`);
|
|
|
271
329
|
let revision = null;
|
|
272
330
|
if (action === creates) {
|
|
273
331
|
if (values.from !== void 0) current = (await getEntry(kind, values.from, { root, library: alpHome() })).content;
|
|
332
|
+
if (kind === "skills" && current?.body !== void 0) current = { ...current, body: withSkillName(current.body, name) };
|
|
274
333
|
} else {
|
|
275
334
|
const entry = await getEntry(kind, name, { root, library: alpHome() }).catch((error) => {
|
|
276
335
|
if (error.code === "NOT_FOUND") throw new Error(`No ${kind} entry '${name}'; create it with alp ${kind.replace(/s$/, "")} ${creates}`);
|
|
@@ -280,8 +339,14 @@ stderr: ${result2.stderr.trim()}` : ""}`);
|
|
|
280
339
|
current = (own ?? entry).content;
|
|
281
340
|
revision = own ? own.revision : null;
|
|
282
341
|
}
|
|
283
|
-
const result = await saveEntry(kind, name, await edited(kind, name, current, values), { ...options, revision });
|
|
342
|
+
const result = await saveEntry(kind, name, await edited(kind, name, current, values), { ...options, revision, strict: kind === "skills" && action === creates });
|
|
284
343
|
done(result, `${action === "edit" ? "Saved" : "Created"} ${name} in ${where}.`);
|
|
344
|
+
if (kind === "skills" && !values.json) {
|
|
345
|
+
const directory = path.join(scope === "project" ? path.join(root, ".alp") : alpHome(), "skills", name);
|
|
346
|
+
const report = await validateSkill(directory);
|
|
347
|
+
const notes = [...result.warnings ?? [], ...report.errors.map((finding) => finding.message), ...report.warnings.map((finding) => finding.message)];
|
|
348
|
+
for (const note of [...new Set(notes)]) console.log(`note: ${note}`);
|
|
349
|
+
}
|
|
285
350
|
}
|
|
286
351
|
async function teamsCommand(args) {
|
|
287
352
|
const { values, positionals } = parseArgs({ args, allowPositionals: true, options: { project: { type: "string" }, json: { type: "boolean" } } });
|
|
@@ -307,12 +372,54 @@ async function teamsCommand(args) {
|
|
|
307
372
|
console.log(` supervisor: ${team.supervisor ? member(team.supervisor.agent, { role: "watches main", model: team.supervisor.model, thinking: team.supervisor.thinking }) : "none"}${team.maxPeers ? `; at most ${team.maxPeers} peers` : ""}`);
|
|
308
373
|
}
|
|
309
374
|
}
|
|
375
|
+
async function packsCommand(args) {
|
|
376
|
+
const { values, positionals } = parseArgs({ args, allowPositionals: true, options: { project: { type: "string" }, json: { type: "boolean" } } });
|
|
377
|
+
if (positionals.length) throw new UsageError();
|
|
378
|
+
const root = path.resolve(values.project ?? process.cwd());
|
|
379
|
+
const rows = [];
|
|
380
|
+
for (const pack of await listPacks()) rows.push({ ...pack, installed: await packStatus(pack, { root, library: alpHome() }) });
|
|
381
|
+
if (values.json) {
|
|
382
|
+
console.log(JSON.stringify(rows));
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
const width = Math.max(...rows.map((row) => row.id.length));
|
|
386
|
+
for (const row of rows) {
|
|
387
|
+
const contents = [row.skills.length ? `skills: ${row.skills.join(", ")}` : "", row.agents.length ? `agents: ${row.agents.join(", ")}` : "", row.teams.length ? `teams: ${row.teams.join(", ")}` : ""].filter(Boolean).join("; ");
|
|
388
|
+
const where = [row.installed.library ? "library" : "", row.installed.project ? "project" : ""].filter(Boolean).join(", ");
|
|
389
|
+
console.log(`${row.id.padEnd(width)} ${row.description}
|
|
390
|
+
${" ".repeat(width)} ${contents}${where ? ` [installed: ${where}]` : ""}`);
|
|
391
|
+
}
|
|
392
|
+
console.log("Install one with: alp pack install <id> [--project] [--assign]");
|
|
393
|
+
}
|
|
394
|
+
async function packCommand(args) {
|
|
395
|
+
const { values, positionals } = parseArgs({ args: projectFlag(args), allowPositionals: true, options: { project: { type: "string" }, json: { type: "boolean" }, assign: { type: "boolean" } } });
|
|
396
|
+
const [action, id] = positionals;
|
|
397
|
+
if (action !== "install" || !id || positionals.length > 2) throw new UsageError();
|
|
398
|
+
const scope = values.project !== void 0 ? "project" : "library";
|
|
399
|
+
const root = values.project !== void 0 ? path.resolve(values.project) : void 0;
|
|
400
|
+
if (scope === "project") await taskProject(root);
|
|
401
|
+
const result = await installPack(id, { scope, root, library: alpHome(), assign: values.assign });
|
|
402
|
+
if (values.json) {
|
|
403
|
+
console.log(JSON.stringify(result));
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
const where = scope === "project" ? `the project ${root}` : `your library ${alpHome()}`;
|
|
407
|
+
for (const entry of result.installed) console.log(`installed ${entry.kind.replace(/s$/, "")} ${entry.name} ${entry.path}`);
|
|
408
|
+
for (const entry of result.kept) console.log(`kept ${entry.kind.replace(/s$/, "")} ${entry.name}: one already exists, and stays as it is (${entry.path})`);
|
|
409
|
+
for (const line of result.permissions.set) console.log(`permission ${line} (agent capped by its permission profile)`);
|
|
410
|
+
for (const line of result.permissions.conflicts) console.log(`warning: ${line}`);
|
|
411
|
+
if (result.assigned.length) console.log(`assigned ${result.assigned.join(", ")} in role-skills.json`);
|
|
412
|
+
else if (!values.assign && scope === "library" && result.installed.some((entry) => entry.kind === "skills")) console.log("No role has these skills yet: rerun with --assign for the pack's suggestion, or alp agent edit <agent> --skills a,b.");
|
|
413
|
+
console.log(`Pack ${id} in ${where}. Start a new session (or close and resume) for agents to see it.`);
|
|
414
|
+
}
|
|
310
415
|
export {
|
|
311
416
|
EDIT_OPTIONS,
|
|
312
417
|
editCommand,
|
|
313
418
|
edited,
|
|
314
419
|
libraryCommand,
|
|
315
420
|
names,
|
|
421
|
+
packCommand,
|
|
422
|
+
packsCommand,
|
|
316
423
|
pairs,
|
|
317
424
|
projectFlag,
|
|
318
425
|
teamsCommand
|
package/dist/projects.js
CHANGED
|
@@ -21,8 +21,9 @@ async function project(command, args) {
|
|
|
21
21
|
try {
|
|
22
22
|
const result = await (command === "upgrade" ? upgradeProject : initProject)(args[0] ?? process.cwd(), { library: alpHome() });
|
|
23
23
|
console.log(`ALP initialized: ${result.created.length} files created, ${result.preserved.length} existing files preserved.`);
|
|
24
|
-
const library = await seedLibrary(alpHome());
|
|
24
|
+
const library = await seedLibrary(alpHome(), { offerRoleSkills: command === "upgrade" });
|
|
25
25
|
if (library.created.length || library.updated.length) console.log(`Skill library ${alpHome()}: ${library.created.length} files added, ${library.updated.length} unchanged files updated.`);
|
|
26
|
+
if (library.offered?.length) console.log(`New built-in skills given to roles in your edited role-skills.json: ${library.offered.join(", ")} (remove any you do not want; ALP will not add it again).`);
|
|
26
27
|
if (command === "init" && result.updated?.length) console.log(`Template model profiles refreshed: ${result.updated.join(", ")}`);
|
|
27
28
|
if (command === "upgrade") {
|
|
28
29
|
console.log(`ALP upgraded: ${result.updated.length} files updated.${result.backup ? ` Backup: ${result.backup}` : ""}`);
|
package/dist/self-update.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export function verifyProvenance(file: string, { repo, env, run, find }: {
|
|
|
58
58
|
}): "unavailable" | "verified";
|
|
59
59
|
/**
|
|
60
60
|
* Runs `action`, again after a pause while Windows reports the file busy: a virus scanner holds an
|
|
61
|
-
* executable it just saw run (the staged bundle's --version) for a moment. About
|
|
61
|
+
* executable it just saw run (the staged bundle's --version) for a moment. About 8 s in all.
|
|
62
62
|
* @template T @param {() => T} action @param {(ms: number) => void} [sleep]
|
|
63
63
|
*/
|
|
64
64
|
export function retryBusy<T>(action: () => T, sleep?: (ms: number) => void, attempts?: number): T;
|
|
@@ -118,6 +118,7 @@ export function sha256(bytes: Uint8Array): string;
|
|
|
118
118
|
/** The largest file alp update downloads: an archive of the bundle is about 70 MB. */
|
|
119
119
|
export const MAX_DOWNLOAD: number;
|
|
120
120
|
export function notInstalledMessage(root: string): string;
|
|
121
|
+
export function systemTar(platform?: string, env?: Record<string, string | undefined>): string;
|
|
121
122
|
export type UpdateDeps = {
|
|
122
123
|
bundle: import("@anhlp/alp-core/packaged").BundleInfo | undefined;
|
|
123
124
|
version: string;
|
package/dist/self-update.js
CHANGED
|
@@ -160,7 +160,7 @@ Then restart alpd when no sessions are running: alp daemon restart
|
|
|
160
160
|
}
|
|
161
161
|
var notInstalledMessage = (root) => `alp: ${root} is not an installed ALP (no app/current points at it); install the release with install.sh (Windows: install.ps1), which alp update can then keep up to date:
|
|
162
162
|
curl -fsSL https://github.com/${DEFAULT_REPO}/releases/latest/download/install.sh | sh`;
|
|
163
|
-
var systemTar = (
|
|
163
|
+
var systemTar = (platform = process.platform, env = process.env) => platform === "win32" ? path.win32.join(env.SystemRoot ?? "C:\\Windows", "System32", "tar.exe") : "tar";
|
|
164
164
|
function extract(archive, directory, asset, platform, run = spawnSync) {
|
|
165
165
|
const windows = platform.startsWith("windows-");
|
|
166
166
|
const result = run(systemTar(), [windows ? "-xf" : "-xzf", archive, "-C", directory], { encoding: "utf8", windowsHide: true });
|
|
@@ -308,7 +308,6 @@ async function selfUpdate(args, overrides = {}) {
|
|
|
308
308
|
return 0;
|
|
309
309
|
}
|
|
310
310
|
const { app, current } = bundle;
|
|
311
|
-
if (deps.platform === "win32" && asset.version === path.basename(bundle.root)) throw new Error(`ALP ${asset.version} is the version running now; Windows cannot replace it in place. Close ALP (alp daemon stop) and rerun install.ps1 to repair it`);
|
|
312
311
|
const running = await deps.daemon().catch(() => void 0);
|
|
313
312
|
try {
|
|
314
313
|
nodeFs.accessSync(app, nodeFs.constants.W_OK);
|
|
@@ -344,11 +343,28 @@ async function selfUpdate(args, overrides = {}) {
|
|
|
344
343
|
if (reported !== asset.version) throw new Error(`The downloaded ALP reports version ${JSON.stringify(reported)}, not ${asset.version}; nothing was changed`);
|
|
345
344
|
if (nodeFs.existsSync(target)) {
|
|
346
345
|
if (samePath(target, bundle.root) || running?.version === asset.version) {
|
|
347
|
-
|
|
348
|
-
|
|
346
|
+
const moved = `.alp-old-${randomBytes(6).toString("hex")}`;
|
|
347
|
+
try {
|
|
348
|
+
retryBusy(() => nodeFs.renameSync(target, path.join(app, moved)));
|
|
349
|
+
} catch (error) {
|
|
350
|
+
throw new Error(`Could not move ${target} aside to reinstall ALP ${asset.version}: ${error.message}. Something holds that directory: a process whose working directory is inside it, or a file handle opened without delete sharing. Stop alpd (alp daemon stop), leave that directory in any shell, and run alp update again`, { cause: error });
|
|
351
|
+
}
|
|
352
|
+
aside = moved;
|
|
349
353
|
} else nodeFs.rmSync(target, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
|
|
350
354
|
}
|
|
351
|
-
|
|
355
|
+
try {
|
|
356
|
+
retryBusy(() => nodeFs.renameSync(unpacked, target));
|
|
357
|
+
} catch (error) {
|
|
358
|
+
if (aside && !nodeFs.existsSync(target)) {
|
|
359
|
+
try {
|
|
360
|
+
nodeFs.renameSync(path.join(app, aside), target);
|
|
361
|
+
aside = void 0;
|
|
362
|
+
} catch {
|
|
363
|
+
throw new Error(`${error.message}; the running ALP ${asset.version} is in ${path.join(app, aside)}: move it back to ${target}`, { cause: error });
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
throw error;
|
|
367
|
+
}
|
|
352
368
|
switchCurrent(app, asset.version, { platform: deps.platform });
|
|
353
369
|
} finally {
|
|
354
370
|
try {
|
|
@@ -394,6 +410,7 @@ export {
|
|
|
394
410
|
selfUpdate,
|
|
395
411
|
sha256,
|
|
396
412
|
switchCurrent,
|
|
413
|
+
systemTar,
|
|
397
414
|
verifyChecksum,
|
|
398
415
|
verifyProvenance
|
|
399
416
|
};
|
package/dist/usage.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const USAGE: "Usage:\n alp <init|update-template> [directory] create a project, or upgrade an older project's ALP template (upgrade is an alias)\n alp update [--check] [--yes] [--version X] update ALP from GitHub Releases (checksum and provenance checked)\n alp --version\n alp setup [directory] [--runtime codex|claude|mix] [--prefer claude|codex]\n [--claude-model M] [--codex-model M] [--claude-supervisor M] [--codex-supervisor M]\n [--claude-oracle M] [--codex-oracle M] write Ph\u1EDF/Cafe's agent profiles to .alp/settings.json\n alp daemon <start|stop|restart>\n alp daemon status [--json] liveness and readiness; exit 0 ready, 3 not running, 4 not ready\n alp daemon <install|uninstall> run alpd as a login service that restarts after a crash\n alp daemon run [--detach] [--service] run alpd in this process (what services written by 0.0.1-beta.5/6 start)\n alp acp serve ALP to an editor (Zed, JetBrains) over the Agent Client Protocol on stdio\n alp web [--print] open the ALP web app on this machine (alp-web, loopback); --print only prints its address\n alp web serve [--service|--rotate] [--project DIR] run alp-web in this process (what alp web starts)\n alp bridge <acp|antigravity> the stdio MCP bridge an agent CLI starts to reach alpd (internal)\n alp web rotate give alp web a new token: open pages lose access; prints the new address\n alp web pair [--on|--off] the link that pairs Paseo's app on another device through the relay; --on or --off turns the relay on or off\n alp terminal <allow [--paseo] --yes|deny [--paseo]|status> [--json] remote terminals (a shell as you on this host; a workspace is not a sandbox), off by default\n alp doctor [--project DIR] [--fix] [--json] check this machine and project; --fix repairs what is safe to\n alp backup [-o FILE] [--project DIR]... [--no-projects] [--stop] [--json] sessions, settings, library and tasks in one file\n alp backup verify <file> [--json] | alp backup list [--json]\n alp restore <file> [--home-only] [--dry-run] [--stop] [--replace-newer] [--json] checks the whole backup first; keeps what it replaces\n alpd must be stopped for both; --stop stops it and starts it again after\n alp run [--agent A] [--team pho|cafe|ID] [--model M] [--mode read-only|workspace-write|full-access] [--thinking T] [--project DIR] [--json] <prompt>\n alp schedule create --session ID --at ISO_WITH_OFFSET --prompt TEXT [--project DIR] [--json]\n alp schedule list [--status pending|delivered|failed|cancelled] [--project DIR] [--json]\n alp schedule <show|cancel> ID [--project DIR] [--json] one-shot wake; timer gates only unblock tasks\n alp ps [--all]\n alp top [session] [--once]\n alp attach <session> [--json]\n alp send <session> [--prompt] [--json] <text>\n child default: user mail; --prompt: explicit new prompt to a live root or child\n alp questions [--json]\n alp answer <question> <text> | alp answer <question> --dismiss [--reason R]\n alp log <session> [--json]\n alp board [--project DIR] [--json]\n alp <agents|skills|mcp|hooks> [--project DIR] [--json] the library: built-in, ~/.alp and project entries\n alp providers [--json] ACP and Antigravity providers in your library\n alp teams [--project DIR] [--json] teams sessions run in: members, delegation, house rules\n alp agent <new|edit> <name> [--project [DIR]] [--from A] [-d text] [--provider P] [--model M] [--thinking T] [--mode M]\n [--skills a,b] [--mcp a,b] [--hooks a,b] [--instructions FILE]\n alp team <new|edit> <id> [--project [DIR]] [--from ID] [--label L] [-d text] [--main A] [--member name=role]...\n [--member-model name=M]... [--member-thinking name=T]... [--delegate owner=a,b]... [--max-peers N]\n [--supervisor A] [--supervisor-model M] [--supervisor-thinking T] [--no-supervisor] [--rules FILE]\n alp skill new <name> [--project [DIR]] [--from S] [--file FILE]\n alp mcp add <name> [--project [DIR]] (--command C [--arg A]... [--env K=V]... [--cwd D] | --url U [--header K=V]...)\n alp hook add <name> [--project [DIR]] --event E --command C [--blocking] [--timeout SEC] [--match-agent A] [--match-label L]\n alp provider add <id> --command C [--arg A]... [--env K=V]... [--label L] [-d text] [--models a,b] an ACP agent; use id antigravity for native agy\n alp
|
|
1
|
+
export const USAGE: "Usage:\n alp <init|update-template> [directory] create a project, or upgrade an older project's ALP template (upgrade is an alias)\n alp update [--check] [--yes] [--version X] update ALP from GitHub Releases (checksum and provenance checked)\n alp --version\n alp setup [directory] [--runtime codex|claude|mix] [--prefer claude|codex]\n [--claude-model M] [--codex-model M] [--claude-supervisor M] [--codex-supervisor M]\n [--claude-oracle M] [--codex-oracle M] write Ph\u1EDF/Cafe's agent profiles to .alp/settings.json\n (keeps profiles written by hand; names other teams and the keys to edit)\n alp daemon <start|stop|restart>\n alp daemon status [--json] liveness and readiness; exit 0 ready, 3 not running, 4 not ready\n alp daemon <install|uninstall> run alpd as a login service that restarts after a crash\n alp daemon run [--detach] [--service] run alpd in this process (what services written by 0.0.1-beta.5/6 start)\n alp acp serve ALP to an editor (Zed, JetBrains) over the Agent Client Protocol on stdio\n alp web [--print] open the ALP web app on this machine (alp-web, loopback); --print only prints its address\n alp web serve [--service|--rotate] [--project DIR] run alp-web in this process (what alp web starts)\n alp bridge <acp|antigravity> the stdio MCP bridge an agent CLI starts to reach alpd (internal)\n alp web rotate give alp web a new token: open pages lose access; prints the new address\n alp web pair [--on|--off] the link that pairs Paseo's app on another device through the relay; --on or --off turns the relay on or off\n alp terminal <allow [--paseo] --yes|deny [--paseo]|status> [--json] remote terminals (a shell as you on this host; a workspace is not a sandbox), off by default\n alp doctor [--project DIR] [--fix] [--json] check this machine and project; --fix repairs what is safe to\n alp backup [-o FILE] [--project DIR]... [--no-projects] [--stop] [--json] sessions, settings, library and tasks in one file\n alp backup verify <file> [--json] | alp backup list [--json]\n alp restore <file> [--home-only] [--dry-run] [--stop] [--replace-newer] [--json] checks the whole backup first; keeps what it replaces\n alpd must be stopped for both; --stop stops it and starts it again after\n alp run [--agent A] [--team pho|cafe|ID] [--model M] [--mode read-only|workspace-write|full-access] [--thinking T] [--project DIR] [--json] <prompt>\n alp schedule create --session ID --at ISO_WITH_OFFSET --prompt TEXT [--project DIR] [--json]\n alp schedule list [--status pending|delivered|failed|cancelled] [--project DIR] [--json]\n alp schedule <show|cancel> ID [--project DIR] [--json] one-shot wake; timer gates only unblock tasks\n alp ps [--all]\n alp top [session] [--once]\n alp attach <session> [--json]\n alp send <session> [--prompt] [--json] <text>\n child default: user mail; --prompt: explicit new prompt to a live root or child\n alp questions [--json]\n alp answer <question> <text> | alp answer <question> --dismiss [--reason R]\n alp log <session> [--json]\n alp board [--project DIR] [--json]\n alp <agents|skills|mcp|hooks> [--project DIR] [--json] the library: built-in, ~/.alp and project entries\n alp skills --retired [--json] skills alp_skill_retire moved to ~/.alp/retired-skills\n alp providers [--json] ACP and Antigravity providers in your library\n alp teams [--project DIR] [--json] teams sessions run in: members, delegation, house rules\n alp packs [--project DIR] [--json] optional skill packs ALP ships (backend, frontend, architecture, ...)\n alp pack install <id> [--project [DIR]] [--assign] [--json] copy a pack's skills, agents and teams; existing entries are kept\n alp agent <new|edit> <name> [--project [DIR]] [--from A] [-d text] [--provider P] [--model M] [--thinking T] [--mode M]\n [--skills a,b] [--mcp a,b] [--hooks a,b] [--instructions FILE]\n alp team <new|edit> <id> [--project [DIR]] [--from ID] [--label L] [-d text] [--main A] [--member name=role]...\n [--member-model name=M]... [--member-thinking name=T]... [--delegate owner=a,b]... [--max-peers N]\n [--supervisor A] [--supervisor-model M] [--supervisor-thinking T] [--no-supervisor] [--rules FILE]\n alp skill <new|edit> <name> [--project [DIR]] [--from S] [--file FILE]\n alp skill check [name|DIR] [--project [DIR]] [--strict] [--json] validate skills (format, references, links); exit 1 on errors\n alp skill restore <name> [--from DIR] [--roles a,b | --no-roles] bring back a retired skill; --roles needed if it was retired without retired.json\n alp mcp add <name> [--project [DIR]] (--command C [--arg A]... [--env K=V]... [--cwd D] | --url U [--header K=V]...)\n alp hook add <name> [--project [DIR]] --event E --command C [--blocking] [--timeout SEC] [--match-agent A] [--match-label L]\n alp provider add <id> --command C [--arg A]... [--env K=V]... [--label L] [-d text] [--models a,b] an ACP agent; use id antigravity for native agy\n alp <agent|team|skill|mcp|hook|provider> <rm|show> <name> [--project [DIR]] | <cp|mv> <from> <to> [--project [DIR]]\n alp <mcp|hook|provider> test <name> [--project [DIR]] list an MCP server's tools; run a hook once; initialize a provider\n without --project, changes go to your library in ~/.alp; built-in agents and teams are never changed\n alp trust [--project DIR] | --revoke [--project DIR] | --list [--json] whether the project's hooks may run\n alp permissions [--project DIR] [--json] each agent's permission profile\n alp permissions check <agent> \"<command>\" what that agent's profile says about a command\n alp tasks [ready] [--all] [--status S] [--label L] [--project DIR] [--json]\n alp tasks gates [--json] open gates; checks GitHub ones\n alp tasks compact [--days 30] [--dry-run]\n alp tasks export [-o file.jsonl] as beads JSONL\n alp tasks import [file.jsonl] [--dry-run] beads JSONL; default .beads/issues.jsonl\n alp formula list | show <name> | pour <name> [--var k=v]... [--parent ID] [--dry-run]\n alp task add <title> [-d text] [-p 0-4] [-t task|bug|feature|chore|epic] [--parent ID] [--after ID]... [-l label]... [--path P]... [--from ID]\n alp task show <id> [--json]\n alp task report <epic> [--json] what an epic came to: tasks, time, rework, verification\n alp task edit <id> [--title T] [-d text] [-p N] [-t type] [-l label]... [--path P]... [-m note]\n alp task close <id> [--reason done|wontfix|duplicate|superseded] [-m summary] [--unverified \"why\"]\n alp verify [--project DIR] [--task ID] [--json] run the project's verify commands; --task records the result\n alp task reopen <id> [-m note]\n alp task dep <add|rm> <id> [--after ID]... [--parent ID] [--related ID]...\n alp task gate add <id> --human \"question\" [--option answer]... | --timer +2h|ISO | --pr N|owner/repo#N | --run N|owner/repo#N\n alp task gate clear <id> <gate> [--choice answer] [-m note] approve; main is told by mail\n alp task gate reject <id> <gate> [-m reason] the gate stays open; main is told by mail\n alp task gate rm <id> <gate> [-m note]\n alp pause [codex|claude] [--now] [-m reason] | alp pause status hold delegation; --now parks running assignments\n alp resume [codex|claude] lift a pause; parked assignments continue\n alp models [--refresh] [--json] the models alpd offers now, from each provider (cached; refreshed every 6 h)\n alp language [name | --reset] the language agents and ALP write to you in; default Vietnamese\n alp recall <assignment|task> [--project DIR] [--json] <question> ask a finished assignment about its work\n alp interrupt <session>\n alp compact <session>";
|
|
2
2
|
export class UsageError extends Error {
|
|
3
3
|
}
|
package/dist/usage.js
CHANGED
|
@@ -6,6 +6,7 @@ var USAGE = `Usage:
|
|
|
6
6
|
alp setup [directory] [--runtime codex|claude|mix] [--prefer claude|codex]
|
|
7
7
|
[--claude-model M] [--codex-model M] [--claude-supervisor M] [--codex-supervisor M]
|
|
8
8
|
[--claude-oracle M] [--codex-oracle M] write Ph\u1EDF/Cafe's agent profiles to .alp/settings.json
|
|
9
|
+
(keeps profiles written by hand; names other teams and the keys to edit)
|
|
9
10
|
alp daemon <start|stop|restart>
|
|
10
11
|
alp daemon status [--json] liveness and readiness; exit 0 ready, 3 not running, 4 not ready
|
|
11
12
|
alp daemon <install|uninstall> run alpd as a login service that restarts after a crash
|
|
@@ -36,18 +37,22 @@ var USAGE = `Usage:
|
|
|
36
37
|
alp log <session> [--json]
|
|
37
38
|
alp board [--project DIR] [--json]
|
|
38
39
|
alp <agents|skills|mcp|hooks> [--project DIR] [--json] the library: built-in, ~/.alp and project entries
|
|
40
|
+
alp skills --retired [--json] skills alp_skill_retire moved to ~/.alp/retired-skills
|
|
39
41
|
alp providers [--json] ACP and Antigravity providers in your library
|
|
40
42
|
alp teams [--project DIR] [--json] teams sessions run in: members, delegation, house rules
|
|
43
|
+
alp packs [--project DIR] [--json] optional skill packs ALP ships (backend, frontend, architecture, ...)
|
|
44
|
+
alp pack install <id> [--project [DIR]] [--assign] [--json] copy a pack's skills, agents and teams; existing entries are kept
|
|
41
45
|
alp agent <new|edit> <name> [--project [DIR]] [--from A] [-d text] [--provider P] [--model M] [--thinking T] [--mode M]
|
|
42
46
|
[--skills a,b] [--mcp a,b] [--hooks a,b] [--instructions FILE]
|
|
43
47
|
alp team <new|edit> <id> [--project [DIR]] [--from ID] [--label L] [-d text] [--main A] [--member name=role]...
|
|
44
48
|
[--member-model name=M]... [--member-thinking name=T]... [--delegate owner=a,b]... [--max-peers N]
|
|
45
49
|
[--supervisor A] [--supervisor-model M] [--supervisor-thinking T] [--no-supervisor] [--rules FILE]
|
|
46
|
-
alp skill new <name> [--project [DIR]] [--from S] [--file FILE]
|
|
50
|
+
alp skill <new|edit> <name> [--project [DIR]] [--from S] [--file FILE]
|
|
51
|
+
alp skill check [name|DIR] [--project [DIR]] [--strict] [--json] validate skills (format, references, links); exit 1 on errors
|
|
52
|
+
alp skill restore <name> [--from DIR] [--roles a,b | --no-roles] bring back a retired skill; --roles needed if it was retired without retired.json
|
|
47
53
|
alp mcp add <name> [--project [DIR]] (--command C [--arg A]... [--env K=V]... [--cwd D] | --url U [--header K=V]...)
|
|
48
54
|
alp hook add <name> [--project [DIR]] --event E --command C [--blocking] [--timeout SEC] [--match-agent A] [--match-label L]
|
|
49
55
|
alp provider add <id> --command C [--arg A]... [--env K=V]... [--label L] [-d text] [--models a,b] an ACP agent; use id antigravity for native agy
|
|
50
|
-
alp provider edit antigravity --read-only-mode instructions|reject legacy, no effect: agy enforces every mode itself
|
|
51
56
|
alp <agent|team|skill|mcp|hook|provider> <rm|show> <name> [--project [DIR]] | <cp|mv> <from> <to> [--project [DIR]]
|
|
52
57
|
alp <mcp|hook|provider> test <name> [--project [DIR]] list an MCP server's tools; run a hook once; initialize a provider
|
|
53
58
|
without --project, changes go to your library in ~/.alp; built-in agents and teams are never changed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anhlp/alp-cli",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "ALP cli module",
|
|
6
6
|
"files": [
|
|
@@ -127,9 +127,9 @@
|
|
|
127
127
|
"node": ">=22.12"
|
|
128
128
|
},
|
|
129
129
|
"dependencies": {
|
|
130
|
-
"@anhlp/alp-core": "0.0.1-beta.
|
|
131
|
-
"@anhlp/alp-client": "0.0.1-beta.
|
|
132
|
-
"@anhlp/alp-protocol": "0.0.1-beta.
|
|
130
|
+
"@anhlp/alp-core": "0.0.1-beta.8",
|
|
131
|
+
"@anhlp/alp-client": "0.0.1-beta.8",
|
|
132
|
+
"@anhlp/alp-protocol": "0.0.1-beta.8",
|
|
133
133
|
"smol-toml": "1.9.0",
|
|
134
134
|
"@agentclientprotocol/sdk": "1.7.0",
|
|
135
135
|
"@anthropic-ai/claude-agent-sdk": "^0.3.292"
|
|
@@ -161,6 +161,6 @@
|
|
|
161
161
|
"node-pty": "1.2.0-beta.15"
|
|
162
162
|
},
|
|
163
163
|
"devDependencies": {
|
|
164
|
-
"@anhlp/alp-gateway": "0.0.1-beta.
|
|
164
|
+
"@anhlp/alp-gateway": "0.0.1-beta.8"
|
|
165
165
|
}
|
|
166
166
|
}
|
package/src/cli.js
CHANGED
|
@@ -3,11 +3,12 @@ import { readFileSync } from 'node:fs';
|
|
|
3
3
|
import { setup } from '@anhlp/alp-client/setup';
|
|
4
4
|
import { alpHome } from '@anhlp/alp-client/index';
|
|
5
5
|
import { scrubText } from '@anhlp/alp-core/log';
|
|
6
|
+
import { catalogModels, useLiveModels } from '@anhlp/alp-core/models';
|
|
6
7
|
import { USAGE, UsageError } from './usage.js';
|
|
7
8
|
import { project, permissionsCommand, trustCommand, language, verify, doctor } from './projects.js';
|
|
8
9
|
import { daemon } from './daemon.js';
|
|
9
10
|
import { run, ps, attach, send, questions, answer, top, log, board, models, pause, resume, recall, interrupt, compact } from './sessions.js';
|
|
10
|
-
import { libraryCommand, editCommand, teamsCommand } from './library.js';
|
|
11
|
+
import { libraryCommand, editCommand, teamsCommand, packsCommand, packCommand } from './library.js';
|
|
11
12
|
import { scheduleCommand } from './schedules.js';
|
|
12
13
|
import { tasksCommand, formulaCommand, taskCommand } from './tasks.js';
|
|
13
14
|
import { webCommand, acpCommand } from './interfaces.js';
|
|
@@ -46,7 +47,7 @@ async function updateCommand(args) {
|
|
|
46
47
|
if (code) process.exitCode = code;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
const commands = { schedule: scheduleCommand, setup: args => setup(args, alpHome()), init: args => project('init', args), 'update-template': args => project('upgrade', args), upgrade: args => project('upgrade', args), update: updateCommand, daemon, doctor, run, ps, top, attach, send, questions, answer, log, board, tasks: tasksCommand, task: taskCommand, formula: formulaCommand, permissions: permissionsCommand, agents: args => libraryCommand('agents', args), skills: args => libraryCommand('skills', args), mcp: args => ['add', 'rm', 'mv', 'cp', 'test', 'show', 'edit'].includes(args[0]) ? editCommand('mcp', args) : libraryCommand('mcp', args), hooks: args => libraryCommand('hooks', args), providers: args => libraryCommand('providers', args), provider: args => editCommand('providers', args), teams: teamsCommand, trust: trustCommand, agent: args => editCommand('agents', args), team: args => editCommand('teams', args), skill: args => editCommand('skills', args), hook: args => editCommand('hooks', args), verify, recall, pause, resume, language, models, interrupt, compact, acp: acpCommand, web: webCommand, backup: backupCommand, restore: restoreCommand, terminal: terminalCommand, bridge: bridgeCommand };
|
|
50
|
+
const commands = { schedule: scheduleCommand, setup: args => setup(args, alpHome()), init: args => project('init', args), 'update-template': args => project('upgrade', args), upgrade: args => project('upgrade', args), update: updateCommand, daemon, doctor, run, ps, top, attach, send, questions, answer, log, board, tasks: tasksCommand, task: taskCommand, formula: formulaCommand, permissions: permissionsCommand, agents: args => libraryCommand('agents', args), skills: args => libraryCommand('skills', args), mcp: args => ['add', 'rm', 'mv', 'cp', 'test', 'show', 'edit'].includes(args[0]) ? editCommand('mcp', args) : libraryCommand('mcp', args), hooks: args => libraryCommand('hooks', args), providers: args => libraryCommand('providers', args), provider: args => editCommand('providers', args), teams: teamsCommand, packs: packsCommand, pack: packCommand, trust: trustCommand, agent: args => editCommand('agents', args), team: args => editCommand('teams', args), skill: args => editCommand('skills', args), hook: args => editCommand('hooks', args), verify, recall, pause, resume, language, models, interrupt, compact, acp: acpCommand, web: webCommand, backup: backupCommand, restore: restoreCommand, terminal: terminalCommand, bridge: bridgeCommand };
|
|
50
51
|
const [command, ...args] = process.argv.slice(2);
|
|
51
52
|
try {
|
|
52
53
|
if (command === '--version') {
|
|
@@ -54,6 +55,9 @@ try {
|
|
|
54
55
|
console.log(alpVersion());
|
|
55
56
|
} else {
|
|
56
57
|
if (!Object.hasOwn(commands, command)) throw new UsageError();
|
|
58
|
+
// Effort checks read the catalog alpd last cached, the rows alpd itself checks with (t-086c), so
|
|
59
|
+
// the CLI and alpd agree on a model only live rows list (t-b3cd #8). No provider is asked.
|
|
60
|
+
if (command !== 'setup') useLiveModels(catalogModels(alpHome()));
|
|
57
61
|
await commands[command](args);
|
|
58
62
|
}
|
|
59
63
|
} catch (error) {
|