@ipab/cli 0.1.0-rc.5 → 0.1.0-rc.7
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 +128 -22
- package/dist/app-authoring.d.ts +5 -0
- package/dist/app-authoring.d.ts.map +1 -1
- package/dist/app-authoring.js +4 -1
- package/dist/app-authoring.js.map +1 -1
- package/dist/app-templates.d.ts +0 -1
- package/dist/app-templates.d.ts.map +1 -1
- package/dist/app-templates.js +6 -45
- package/dist/app-templates.js.map +1 -1
- package/dist/builtins/skill.ipab.car +0 -0
- package/dist/builtins/template.bundle-viewer.car +0 -0
- package/dist/builtins/template.check.car +0 -0
- package/dist/builtins/template.node.car +0 -0
- package/dist/builtins/template.web-app.car +0 -0
- package/dist/builtins.d.ts.map +1 -1
- package/dist/builtins.js +1 -39
- package/dist/builtins.js.map +1 -1
- package/dist/cli.d.ts +4 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +934 -336
- package/dist/cli.js.map +1 -1
- package/dist/content-provider.d.ts +1 -1
- package/dist/content-provider.d.ts.map +1 -1
- package/dist/content-provider.js +4 -3
- package/dist/content-provider.js.map +1 -1
- package/dist/context.d.ts +16 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +20 -10
- package/dist/context.js.map +1 -1
- package/dist/doctor.d.ts +29 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +576 -0
- package/dist/doctor.js.map +1 -0
- package/dist/identity.d.ts +1 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +9 -9
- package/dist/identity.js.map +1 -1
- package/dist/ipc.d.ts +2 -2
- package/dist/ipc.d.ts.map +1 -1
- package/dist/ipc.js +44 -12
- package/dist/ipc.js.map +1 -1
- package/dist/kubo-install.d.ts +18 -1
- package/dist/kubo-install.d.ts.map +1 -1
- package/dist/kubo-install.js +424 -61
- package/dist/kubo-install.js.map +1 -1
- package/dist/kubo-release.d.ts +19 -0
- package/dist/kubo-release.d.ts.map +1 -1
- package/dist/kubo-release.js +164 -0
- package/dist/kubo-release.js.map +1 -1
- package/dist/kubo.d.ts +1 -0
- package/dist/kubo.d.ts.map +1 -1
- package/dist/kubo.js +102 -96
- package/dist/kubo.js.map +1 -1
- package/dist/pins.d.ts +15 -17
- package/dist/pins.d.ts.map +1 -1
- package/dist/pins.js +144 -106
- package/dist/pins.js.map +1 -1
- package/dist/publish-source.d.ts +3 -0
- package/dist/publish-source.d.ts.map +1 -0
- package/dist/publish-source.js +85 -0
- package/dist/publish-source.js.map +1 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +6 -5
- package/dist/runtime.js.map +1 -1
- package/dist/skill-definition.d.ts +6 -0
- package/dist/skill-definition.d.ts.map +1 -0
- package/dist/skill-definition.js +38 -0
- package/dist/skill-definition.js.map +1 -0
- package/dist/skill-source.d.ts +5 -0
- package/dist/skill-source.d.ts.map +1 -0
- package/dist/skill-source.js +12 -0
- package/dist/skill-source.js.map +1 -0
- package/dist/skills.d.ts +84 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +736 -0
- package/dist/skills.js.map +1 -0
- package/dist/space.d.ts +15 -2
- package/dist/space.d.ts.map +1 -1
- package/dist/space.js +153 -3
- package/dist/space.js.map +1 -1
- package/dist/state-storage-windows.js +1 -1
- package/dist/state-storage.d.ts +3 -1
- package/dist/state-storage.d.ts.map +1 -1
- package/dist/state-storage.js +38 -7
- package/dist/state-storage.js.map +1 -1
- package/dist/state.d.ts +40 -6
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +208 -82
- package/dist/state.js.map +1 -1
- package/dist/swarm-envelope.d.ts +1 -0
- package/dist/swarm-envelope.d.ts.map +1 -1
- package/dist/swarm-envelope.js +12 -0
- package/dist/swarm-envelope.js.map +1 -1
- package/dist/swarm-files.d.ts +1 -1
- package/dist/swarm-files.d.ts.map +1 -1
- package/dist/swarm-files.js +2 -2
- package/dist/swarm-files.js.map +1 -1
- package/dist/swarm-meta.d.ts +17 -0
- package/dist/swarm-meta.d.ts.map +1 -0
- package/dist/swarm-meta.js +96 -0
- package/dist/swarm-meta.js.map +1 -0
- package/dist/swarm.d.ts +117 -8
- package/dist/swarm.d.ts.map +1 -1
- package/dist/swarm.js +1275 -131
- package/dist/swarm.js.map +1 -1
- package/dist/template-paths.d.ts +7 -0
- package/dist/template-paths.d.ts.map +1 -0
- package/dist/template-paths.js +23 -0
- package/dist/template-paths.js.map +1 -0
- package/dist/template-presentation.d.ts +20 -0
- package/dist/template-presentation.d.ts.map +1 -0
- package/dist/template-presentation.js +133 -0
- package/dist/template-presentation.js.map +1 -0
- package/dist/template-source.d.ts +2 -1
- package/dist/template-source.d.ts.map +1 -1
- package/dist/template-source.js +7 -1
- package/dist/template-source.js.map +1 -1
- package/dist/templates.d.ts +11 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +53 -0
- package/dist/templates.js.map +1 -0
- package/package.json +7 -6
- package/src/app-authoring.ts +18 -2
- package/src/app-templates.ts +8 -72
- package/src/builtins.ts +2 -48
- package/src/cli.ts +1154 -387
- package/src/content-provider.ts +4 -2
- package/src/context.ts +45 -10
- package/src/doctor.ts +902 -0
- package/src/identity.ts +10 -10
- package/src/ipc.ts +63 -10
- package/src/kubo-install.ts +562 -78
- package/src/kubo-release.ts +213 -0
- package/src/kubo.ts +134 -106
- package/src/pins.ts +188 -126
- package/src/publish-source.ts +103 -0
- package/src/runtime.ts +6 -5
- package/src/skill-definition.ts +53 -0
- package/src/skill-source.ts +15 -0
- package/src/skills.ts +1005 -0
- package/src/space.ts +214 -5
- package/src/state-storage-windows.ts +1 -1
- package/src/state-storage.ts +53 -7
- package/src/state.ts +357 -98
- package/src/swarm-envelope.ts +14 -0
- package/src/swarm-files.ts +2 -1
- package/src/swarm-meta.ts +109 -0
- package/src/swarm.ts +1877 -175
- package/src/template-paths.ts +43 -0
- package/src/template-presentation.ts +151 -0
- package/src/template-source.ts +9 -2
- package/src/templates.ts +77 -0
- package/dist/setup.d.ts +0 -8
- package/dist/setup.d.ts.map +0 -1
- package/dist/setup.js +0 -27
- package/dist/setup.js.map +0 -1
- package/src/setup.ts +0 -34
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createInterface } from "node:readline/promises";
|
|
2
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { lstat, readFile } from "node:fs/promises";
|
|
3
3
|
import { ContentError, IpfsStore } from "@ipab/ipfs-store";
|
|
4
4
|
import { ContentBundleError } from "@ipab/bundle";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
@@ -10,19 +10,22 @@ import { HostError, message, object, syntax } from "./errors.js";
|
|
|
10
10
|
import { filters, listHistory, selectedIds, Ownership, recoverInactive, removeHistory, } from "./history.js";
|
|
11
11
|
import { execute } from "./runtime.js";
|
|
12
12
|
import { validatedBundle } from "./space.js";
|
|
13
|
-
import {
|
|
14
|
-
import { buildBundle, inspectBundle, importBundle } from "./authoring.js";
|
|
13
|
+
import { createAssociation, exactCid, State, } from "./state.js";
|
|
14
|
+
import { buildBundle, inspectBundle, importBundle, nodeError, } from "./authoring.js";
|
|
15
15
|
import { initApp } from "./app-authoring.js";
|
|
16
16
|
import { assembleBundle } from "./assembly.js";
|
|
17
17
|
import { getBundle } from "./get.js";
|
|
18
|
-
import {
|
|
18
|
+
import { doctorDevice, doctorText } from "./doctor.js";
|
|
19
19
|
import { keyId } from "@ipab/bundle/pointer/crypto";
|
|
20
|
-
import { createSwarm, requestMembership, approveMembership, exportRequest, removeMember, resumeRemoval, updateProfile, verifiedRequest, membershipRequestSummary, swarmHeader, sharedSwarmStatus, addSwarm, updateSwarm, searchNames, formatNameReference, resolveReference, parseNameReference, publish, } from "./swarm.js";
|
|
20
|
+
import { createSwarm, requestMembership, approveMembership, exportRequest, removeMember, resumeRemoval, updateProfile, accountProfile, updateAccountProfile, swarmMembers, verifiedRequest, verifiedRequestStream, membershipRequestSummary, swarmHeader, sharedSwarmStatus, addSwarm, updateSwarm, searchNames, formatNameReference, resolveReference, parseNameReference, formalName, publish, pinNameSubscription, pinReference, swarmRegistrations, swarmAssociation, setSwarmAssociation, removeSwarmAssociation, resolveTemplateSelector, templateName, swarmTemplates, setSwarmTemplate, removeSwarmTemplate, } from "./swarm.js";
|
|
21
21
|
import { schemaAlias } from "./app-definition.js";
|
|
22
|
-
import {
|
|
22
|
+
import { unpin, pinDetails } from "./pins.js";
|
|
23
|
+
import { publicationSource } from "./publish-source.js";
|
|
24
|
+
import { templateRenderExample, templateOutputTree, templateParameterRows, } from "./template-presentation.js";
|
|
23
25
|
import { logFiles } from "./logs.js";
|
|
24
26
|
import { builtinContent } from "./builtins.js";
|
|
25
27
|
import { readSecretStream } from "./config-secret.js";
|
|
28
|
+
import { manageSkills } from "./skills.js";
|
|
26
29
|
let progressLine = false;
|
|
27
30
|
export const processIO = {
|
|
28
31
|
out(text) {
|
|
@@ -43,19 +46,24 @@ export const processIO = {
|
|
|
43
46
|
columns() {
|
|
44
47
|
return process.stdout.columns;
|
|
45
48
|
},
|
|
49
|
+
requestInput() {
|
|
50
|
+
if (process.stdin.isTTY)
|
|
51
|
+
syntax("Pipe Request JSON into swarm approve - --yes, or pass a Request file.");
|
|
52
|
+
return process.stdin;
|
|
53
|
+
},
|
|
46
54
|
async readSecret() {
|
|
47
55
|
if (process.stdin.isTTY)
|
|
48
56
|
syntax("Pipe the API key through stdin; interactive echo is not permitted.");
|
|
49
57
|
process.stdin.setEncoding("utf8");
|
|
50
58
|
return readSecretStream(process.stdin);
|
|
51
59
|
},
|
|
52
|
-
async confirm(text) {
|
|
60
|
+
async confirm(text, signal) {
|
|
53
61
|
const reader = createInterface({
|
|
54
62
|
input: process.stdin,
|
|
55
63
|
output: process.stderr,
|
|
56
64
|
});
|
|
57
65
|
try {
|
|
58
|
-
return /^(y|yes)$/i.test((await reader.question(`${text} [y/N]
|
|
66
|
+
return /^(y|yes)$/i.test((await reader.question(`${text} [y/N] `, signal ? { signal } : {})).trim());
|
|
59
67
|
}
|
|
60
68
|
finally {
|
|
61
69
|
reader.close();
|
|
@@ -63,38 +71,45 @@ export const processIO = {
|
|
|
63
71
|
},
|
|
64
72
|
};
|
|
65
73
|
const commands = {
|
|
66
|
-
|
|
74
|
+
"skills list": "skills list [--force | --no-force]",
|
|
75
|
+
"skills sync": "skills sync [NAMES...] [--agent AGENT]... [--dry-run] [--yes] [--force | --no-force]",
|
|
76
|
+
doctor: "doctor [--fix [--yes]]",
|
|
77
|
+
profile: "profile [--name NAME] [--description TEXT]",
|
|
67
78
|
"swarm create": "swarm create [--service URL] [--resume OPERATION]",
|
|
68
|
-
"swarm request": "swarm request CONFIG_URL
|
|
69
|
-
"swarm export": "swarm export
|
|
79
|
+
"swarm request": "swarm request CONFIG_URL [--output FILE] [--alias ALIAS]",
|
|
80
|
+
"swarm export": "swarm export --output FILE",
|
|
70
81
|
"swarm approve": "swarm approve REQUEST_FILE [--again] --yes",
|
|
71
|
-
"swarm exclude": "swarm exclude MEMBER_PUBLIC_KEY
|
|
72
|
-
"swarm resume": "swarm resume
|
|
73
|
-
"swarm profile": "swarm profile
|
|
74
|
-
"swarm status": "swarm status [
|
|
82
|
+
"swarm exclude": "swarm exclude MEMBER_PUBLIC_KEY --yes",
|
|
83
|
+
"swarm resume": "swarm resume",
|
|
84
|
+
"swarm profile": "swarm profile --address MULTIADDR",
|
|
85
|
+
"swarm status": "swarm status [--local]",
|
|
86
|
+
"swarm members": "swarm members",
|
|
75
87
|
"swarm list": "swarm list",
|
|
76
88
|
"swarm add": "swarm add CONFIG_URL [--alias ALIAS]",
|
|
77
89
|
"swarm use": "swarm use URL_OR_ALIAS",
|
|
78
90
|
"swarm remove": "swarm remove URL_OR_ALIAS",
|
|
79
|
-
"swarm update": "swarm update [
|
|
80
|
-
publish: "publish
|
|
91
|
+
"swarm update": "swarm update [--name TEXT] [--description TEXT]",
|
|
92
|
+
publish: "publish NAME SOURCE [--expect OLD_CID | --snapshot]",
|
|
81
93
|
get: "get REF [--raw] [--force | --no-force] [-o DIRECTORY]",
|
|
82
|
-
search: "search QUERY [--current] [--force | --no-force]",
|
|
83
|
-
|
|
94
|
+
search: "search QUERY [--all | --current] [--force | --no-force]",
|
|
95
|
+
"templates render": "templates render TEMPLATE NAME [DIR] [OPTIONS]",
|
|
84
96
|
build: "build [SOURCE] [OPTIONS]",
|
|
85
97
|
"bundle build": "bundle build SOURCE [OPTIONS]",
|
|
86
98
|
"bundle inspect": "bundle inspect SOURCE",
|
|
87
99
|
"bundle import": "bundle import FILE.car",
|
|
88
100
|
exec: "exec [--log] [--force | --no-force] APP [APP_ARGS...]",
|
|
89
101
|
open: "open [--log] [--raw] [--force | --no-force] CONTENT",
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
"pin list": "pin list
|
|
93
|
-
"pin show": "pin show
|
|
94
|
-
"
|
|
95
|
-
"register
|
|
96
|
-
"register
|
|
97
|
-
"
|
|
102
|
+
pin: "pin REF",
|
|
103
|
+
unpin: "unpin REF",
|
|
104
|
+
"pin list": "pin list",
|
|
105
|
+
"pin show": "pin show REF",
|
|
106
|
+
"register list": "register list [--swarm URL_OR_ALIAS]",
|
|
107
|
+
"register set": "register set SCHEMA APP [--swarm URL_OR_ALIAS]... [--replace]",
|
|
108
|
+
"register remove": "register remove SCHEMA [--swarm URL_OR_ALIAS]...",
|
|
109
|
+
"templates list": "templates list [--force | --no-force]",
|
|
110
|
+
"templates show": "templates show NAME [--force | --no-force]",
|
|
111
|
+
"templates set": "templates set NAME SOURCE [--expect OLD_TARGET_CID]",
|
|
112
|
+
"templates remove": "templates remove NAME --expect OLD_TARGET_CID",
|
|
98
113
|
"config get": "config get [KEY]",
|
|
99
114
|
"config set": "config set KEY VALUE\n ipab config set pointers.apiKey - < protected-key-file",
|
|
100
115
|
"config reset": "config reset KEY",
|
|
@@ -105,24 +120,140 @@ const commands = {
|
|
|
105
120
|
"history remove": "history remove RUN_ID... [--yes]\n ipab history remove FILTERS [--yes]",
|
|
106
121
|
};
|
|
107
122
|
const groups = {
|
|
123
|
+
skills: "Discover and explicitly synchronize selected Swarm Skills globally",
|
|
108
124
|
swarm: "Create, authorize, select and manage personal swarms",
|
|
109
125
|
bundle: "Create, inspect and import content bundles",
|
|
110
|
-
pin: "Retain
|
|
126
|
+
pin: "Retain an exact CID or follow a shared Swarm Name",
|
|
111
127
|
register: "Associate content types with Apps",
|
|
128
|
+
templates: "Inspect, render and manage Template Bundles",
|
|
112
129
|
config: "Manage local configuration",
|
|
113
130
|
store: "Query local storage and collect unreferenced blocks",
|
|
114
131
|
history: "View and remove execution history",
|
|
115
132
|
};
|
|
116
133
|
const commandHelp = {
|
|
117
|
-
|
|
118
|
-
summary: "
|
|
119
|
-
|
|
134
|
+
"templates list": {
|
|
135
|
+
summary: "List templates under the selected Swarm Meta templatePath",
|
|
136
|
+
options: [
|
|
137
|
+
"--force / --no-force Refresh HEAD now / allow a valid cached snapshot.",
|
|
138
|
+
],
|
|
139
|
+
examples: [
|
|
140
|
+
"ipab --swarm work templates list",
|
|
141
|
+
"ipab --json templates list",
|
|
142
|
+
],
|
|
143
|
+
notes: [
|
|
144
|
+
"Uses only global --swarm (once, before the command), otherwise the saved default. No builtin or other Swarm fallback.",
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
"templates show": {
|
|
148
|
+
summary: "Show one template, its exact targets and declared parameters",
|
|
149
|
+
arguments: [
|
|
150
|
+
"NAME Safe relative template Name; nested names are supported.",
|
|
151
|
+
],
|
|
152
|
+
options: [
|
|
153
|
+
"--force / --no-force Refresh HEAD now / allow a valid cached snapshot.",
|
|
154
|
+
],
|
|
155
|
+
examples: ["ipab --swarm work templates show node"],
|
|
156
|
+
},
|
|
157
|
+
"templates set": {
|
|
158
|
+
summary: "Publish one validated Template Bundle with exact Name conflict checks",
|
|
159
|
+
arguments: [
|
|
160
|
+
"NAME Safe relative template Name.",
|
|
161
|
+
"SOURCE Exact Template CID, self-contained CAR or explicit manifest directory; no URI, build or hooks.",
|
|
162
|
+
],
|
|
163
|
+
options: [
|
|
164
|
+
"--expect OLD_TARGET_CID Required to replace an occupied Name; use its exact target CID, including an Artifact wrapper.",
|
|
165
|
+
],
|
|
166
|
+
examples: [
|
|
167
|
+
"ipab --swarm work templates set team/node ./template.car",
|
|
168
|
+
"ipab templates set node TEMPLATE_CID --expect OLD_TARGET_CID",
|
|
169
|
+
],
|
|
170
|
+
notes: [
|
|
171
|
+
"Publishes an ordinary Artifact and preserves publication history and content retention.",
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
"templates remove": {
|
|
175
|
+
summary: "Remove only one template Name, without deleting content",
|
|
176
|
+
arguments: ["NAME Safe relative template Name."],
|
|
177
|
+
options: [
|
|
178
|
+
"--expect OLD_TARGET_CID Required exact current Name target CID.",
|
|
179
|
+
],
|
|
180
|
+
examples: [
|
|
181
|
+
"ipab --swarm work templates remove team/node --expect OLD_TARGET_CID",
|
|
182
|
+
],
|
|
183
|
+
notes: [
|
|
184
|
+
"Missing Names are errors. Does not unpin, GC or delete content or history.",
|
|
185
|
+
],
|
|
186
|
+
},
|
|
187
|
+
"skills list": {
|
|
188
|
+
summary: "List typed Skills and local installation status from one Swarm",
|
|
189
|
+
options: [
|
|
190
|
+
"--force / --no-force Refresh HEAD now / reuse a valid verified snapshot.",
|
|
191
|
+
"Global --json Emit machine-readable names, exact payload CIDs and status.",
|
|
192
|
+
],
|
|
193
|
+
examples: ["ipab --swarm work skills list", "ipab --json skills list"],
|
|
194
|
+
notes: [
|
|
195
|
+
"Select one Swarm with global --swarm or swarm use; there is no --all.",
|
|
196
|
+
"Requires skillPath in the exact root State Bundle or legacy Meta type. Older v5 roots require a new seeded Swarm; only legacy v2/v3/v4 Meta can be explicitly replaced with --expect. No silent upgrades.",
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
"skills sync": {
|
|
200
|
+
summary: "Install reviewed Swarm Skills using the pinned official npx installer",
|
|
201
|
+
arguments: [
|
|
202
|
+
"NAMES Install identities, e.g. ipab code-review, or full shared Names such as ipab/skills/ipab. Resolved from one verified snapshot; omit for all Skills.",
|
|
203
|
+
],
|
|
120
204
|
options: [
|
|
121
|
-
"--
|
|
122
|
-
"--
|
|
205
|
+
"--agent AGENT Repeatable globally supported agent ID; default is detected agents.",
|
|
206
|
+
"--dry-run Preview without invoking npx or changing installed Skills.",
|
|
207
|
+
"--yes Skip IPAB consent only; conflicts and local edits remain protected.",
|
|
208
|
+
"--force / --no-force Refresh HEAD now / reuse a valid verified snapshot.",
|
|
209
|
+
],
|
|
210
|
+
examples: [
|
|
211
|
+
"ipab --swarm work skills sync --dry-run",
|
|
212
|
+
"ipab skills sync ipab code-review --agent github-copilot --yes",
|
|
123
213
|
],
|
|
124
214
|
notes: [
|
|
125
|
-
"
|
|
215
|
+
"Global installs only, through official skills@1.9.1 with --copy. Requires Node >=22.20.0.",
|
|
216
|
+
"Non-interactive execution requires --yes. Installer version, source, paths and agents are shown first.",
|
|
217
|
+
"No Skill hooks/scripts run. The trusted installer is not sandboxed. Telemetry and remote audits are disabled.",
|
|
218
|
+
"Non-IPAB installs, local edits, cross-Swarm collisions and symlink/junction aliases are never overwritten. Removed sources are reported, not deleted.",
|
|
219
|
+
"Partial failures report individual results, preserve pending attribution and exit nonzero; retry the same sync.",
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
profile: {
|
|
223
|
+
summary: "Read or update your account-wide public name and description",
|
|
224
|
+
examples: [
|
|
225
|
+
"ipab profile",
|
|
226
|
+
'ipab profile --name Wei --description "Developer"',
|
|
227
|
+
'ipab profile --description ""',
|
|
228
|
+
],
|
|
229
|
+
options: [
|
|
230
|
+
"--name NAME Replace only your personal name.",
|
|
231
|
+
"--description TEXT Replace only your description; empty text clears it.",
|
|
232
|
+
],
|
|
233
|
+
notes: [
|
|
234
|
+
"Independent of Swarm selection. Reading never creates an identity, persists a profile or activates a node.",
|
|
235
|
+
"An explicit update prepares a missing account identity without starting Kubo.",
|
|
236
|
+
"Updates persist locally first, then synchronize all registered memberships without changing network addresses. Partial failure exits nonzero and reports every result.",
|
|
237
|
+
"Retry the same profile update, or normally activate a failed membership to synchronize the saved profile.",
|
|
238
|
+
"First use preserves unanimous legacy values; conflicting fields require an explicit choice. New memberships adopt this same profile.",
|
|
239
|
+
],
|
|
240
|
+
},
|
|
241
|
+
doctor: {
|
|
242
|
+
summary: "Inspect device readiness without writes; explicitly authorize safe repairs",
|
|
243
|
+
examples: [
|
|
244
|
+
"ipab doctor",
|
|
245
|
+
"ipab doctor --fix",
|
|
246
|
+
"ipab --json doctor --fix --yes",
|
|
247
|
+
],
|
|
248
|
+
options: [
|
|
249
|
+
"--fix Repair missing components, cache official archives to verify existing Kubo without reinstall, and authorize healthy compatible upgrades within ^0.43.2.",
|
|
250
|
+
"--yes Authorize planned repairs without prompting; requires --fix.",
|
|
251
|
+
],
|
|
252
|
+
notes: [
|
|
253
|
+
"Always checks local state/configuration, managed Kubo, HOME identity, local Swarm registry and compatible updates.",
|
|
254
|
+
"Inspection never creates state, locks, credentials or caches. Official release metadata may be queried; unavailable updates are not claimed current.",
|
|
255
|
+
"Healthy current components are reused without download or confirmation. Fixed protected archive cache is automatic.",
|
|
256
|
+
"Unverified existing Kubo: --fix may download/cache its exact-version official archive for byte comparison only; never execute it to authenticate itself or overwrite a mismatch.",
|
|
126
257
|
"Does not create Swarm repos, start or contact any daemon, deploy services or install login startup.",
|
|
127
258
|
],
|
|
128
259
|
},
|
|
@@ -149,16 +280,20 @@ const commandHelp = {
|
|
|
149
280
|
"swarm request": {
|
|
150
281
|
summary: "Save and export a signed self-contained membership Request",
|
|
151
282
|
examples: [
|
|
152
|
-
"ipab swarm request CONFIG_URL --
|
|
283
|
+
"ipab swarm request CONFIG_URL --alias work",
|
|
284
|
+
"ipab swarm request CONFIG_URL --output request.json --alias work",
|
|
153
285
|
],
|
|
154
286
|
options: [
|
|
155
|
-
"--owner-fingerprint VALUE Verify Owner through a trusted independent channel.",
|
|
156
|
-
"--name NAME Initial public display name.",
|
|
157
287
|
"--alias ALIAS Pre-register the target for lazy onboarding.",
|
|
158
|
-
"--output FILE Export
|
|
288
|
+
"--output FILE Export to a new file instead of stdout; never overwrites.",
|
|
159
289
|
],
|
|
160
290
|
notes: [
|
|
291
|
+
"Verify the printed Owner fingerprint through an independent trusted channel before manually sending the Request file to the Owner.",
|
|
292
|
+
"Without --output, stdout is the signed Request JSON, including in --json mode.",
|
|
293
|
+
"With --output, reports the file on stderr; --json returns file, requestId and ownerFingerprint.",
|
|
294
|
+
"Retries export the exact saved Request without expiry or a new PeerID.",
|
|
161
295
|
"No Invite, Response file, password or Join. Next normal use fetches and decrypts the approved package.",
|
|
296
|
+
"Set your account-wide personal name with ipab profile --name NAME before requesting membership.",
|
|
162
297
|
"If the alias is taken, choose another to keep both Swarms. If you mean to replace only the local registration, run ipab swarm remove ALIAS and retry.",
|
|
163
298
|
],
|
|
164
299
|
},
|
|
@@ -168,14 +303,18 @@ const commandHelp = {
|
|
|
168
303
|
"--yes Explicit approval; required outside a TTY.",
|
|
169
304
|
"--again Explicit fresh approval of an old Request; history is advisory.",
|
|
170
305
|
],
|
|
171
|
-
examples: [
|
|
306
|
+
examples: [
|
|
307
|
+
"ipab swarm approve request.json --yes",
|
|
308
|
+
"ipab swarm approve - --yes < request.json",
|
|
309
|
+
],
|
|
172
310
|
notes: [
|
|
311
|
+
"Use '-' to read Request JSON from stdin (maximum 16 KiB); --yes is required and no confirmation prompt reads stdin.",
|
|
173
312
|
"Creates a public profile and publishes an Owner-signed X25519/AES-GCM package. Exact-ID certificates have no expiry.",
|
|
174
313
|
],
|
|
175
314
|
},
|
|
176
315
|
"swarm export": {
|
|
177
316
|
summary: "Re-export the same persisted Request",
|
|
178
|
-
examples: ["ipab swarm export
|
|
317
|
+
examples: ["ipab --swarm work swarm export --output request.json"],
|
|
179
318
|
},
|
|
180
319
|
"swarm exclude": {
|
|
181
320
|
summary: "Owner removes a member with irreversible HEAD/key rotation",
|
|
@@ -186,13 +325,22 @@ const commandHelp = {
|
|
|
186
325
|
},
|
|
187
326
|
"swarm resume": {
|
|
188
327
|
summary: "Owner resumes an interrupted organization switch",
|
|
189
|
-
examples: ["ipab swarm resume
|
|
328
|
+
examples: ["ipab --swarm work swarm resume"],
|
|
190
329
|
},
|
|
191
330
|
"swarm profile": {
|
|
192
|
-
summary: "
|
|
331
|
+
summary: "Configure only your selected Swarm's LAN/VPN IPv4 TCP address",
|
|
193
332
|
examples: [
|
|
194
|
-
"ipab swarm profile
|
|
195
|
-
|
|
333
|
+
"ipab --swarm work swarm profile --address /ip4/192.168.1.12/tcp/4001/p2p/PEER_ID",
|
|
334
|
+
],
|
|
335
|
+
notes: [
|
|
336
|
+
"Personal name/description are managed only by ipab profile, not this network configuration command.",
|
|
337
|
+
],
|
|
338
|
+
},
|
|
339
|
+
"swarm members": {
|
|
340
|
+
summary: "List every public member, including the Owner",
|
|
341
|
+
examples: ["ipab --swarm work swarm members", "ipab --json swarm members"],
|
|
342
|
+
notes: [
|
|
343
|
+
"Public HTTP reads only; no local membership, identity creation or node activation. Failed reads fail the command, never omit members.",
|
|
196
344
|
],
|
|
197
345
|
},
|
|
198
346
|
"swarm status": {
|
|
@@ -202,8 +350,8 @@ const commandHelp = {
|
|
|
202
350
|
],
|
|
203
351
|
examples: [
|
|
204
352
|
"ipab swarm status",
|
|
205
|
-
"ipab swarm status
|
|
206
|
-
"ipab swarm status
|
|
353
|
+
"ipab --swarm work swarm status",
|
|
354
|
+
"ipab --swarm work swarm status --local",
|
|
207
355
|
],
|
|
208
356
|
notes: [
|
|
209
357
|
"Always read public configuration, Scope and HEAD, and verify the State. Local content needs no HOME identity or node activation.",
|
|
@@ -239,13 +387,12 @@ const commandHelp = {
|
|
|
239
387
|
},
|
|
240
388
|
"swarm update": {
|
|
241
389
|
summary: "Owner updates public organization information",
|
|
242
|
-
arguments: ["URL_OR_ALIAS Defaults to the effective current swarm."],
|
|
243
390
|
options: [
|
|
244
391
|
"--name TEXT Replace the shared display name; empty text clears it.",
|
|
245
392
|
"--description TEXT Replace the shared description; empty text clears it.",
|
|
246
393
|
],
|
|
247
394
|
examples: [
|
|
248
|
-
'ipab swarm update
|
|
395
|
+
'ipab --swarm work swarm update --name "Team" --description "Shared workspace"',
|
|
249
396
|
'ipab swarm update --description ""',
|
|
250
397
|
],
|
|
251
398
|
notes: [
|
|
@@ -255,37 +402,44 @@ const commandHelp = {
|
|
|
255
402
|
],
|
|
256
403
|
},
|
|
257
404
|
search: {
|
|
258
|
-
summary: "Search formal Names
|
|
405
|
+
summary: "Search formal Names in the current swarm",
|
|
259
406
|
arguments: [
|
|
260
407
|
"QUERY Case-insensitive literal name substring, 1..256 characters.",
|
|
261
408
|
],
|
|
262
409
|
options: [
|
|
263
|
-
"--
|
|
410
|
+
"--all Search all registered swarms; conflicts with --current and --swarm.",
|
|
411
|
+
"--current Explicitly select the default search scope; conflicts with --swarm.",
|
|
264
412
|
"--force Refresh HEAD for every swarm in the search scope.",
|
|
265
413
|
"--no-force Override swarm.forceRefresh and use valid cached headers.",
|
|
266
414
|
],
|
|
267
|
-
examples: [
|
|
415
|
+
examples: [
|
|
416
|
+
"ipab search hello",
|
|
417
|
+
"ipab search hello --all",
|
|
418
|
+
"ipab --swarm work search hello --force",
|
|
419
|
+
],
|
|
268
420
|
notes: [
|
|
269
|
-
"Searches
|
|
270
|
-
"Valid caches use local Names
|
|
421
|
+
"Searches only --swarm or the saved current swarm by default. Use --all to search every registration.",
|
|
422
|
+
"Valid caches use local Names; absent/expired caches refresh. Active Name pins may synchronize content.",
|
|
423
|
+
"Refresh reads public configuration and HEAD; private networking is activated only for missing content.",
|
|
271
424
|
"No matches is success, not a reason to refresh valid caches. Any failed swarm fails the whole search.",
|
|
272
425
|
"Text uses local alias URIs when available; JSON references use full configuration URLs for cross-device sharing.",
|
|
273
426
|
],
|
|
274
427
|
},
|
|
275
428
|
publish: {
|
|
276
|
-
summary: "
|
|
429
|
+
summary: "Protect content locally and publish a shared Swarm Name",
|
|
277
430
|
options: [
|
|
278
|
-
"--
|
|
279
|
-
"--expect CID Exact old Artifact node, required for iteration.",
|
|
431
|
+
"--expect CID Exact old Name target CID, required for iteration.",
|
|
280
432
|
"--snapshot Name ordinary content without an Artifact; initial only.",
|
|
281
433
|
],
|
|
282
434
|
examples: [
|
|
283
|
-
"ipab
|
|
284
|
-
"ipab publish
|
|
285
|
-
"ipab publish
|
|
435
|
+
"ipab --swarm work publish apps/hello app.car",
|
|
436
|
+
"ipab publish apps/hello APP_CID --expect OLD_APP_CID",
|
|
437
|
+
"ipab publish notes/readme ./README.md",
|
|
286
438
|
],
|
|
287
439
|
notes: [
|
|
288
|
-
"No
|
|
440
|
+
"SOURCE is an exact Bundle CID, CAR, regular file or directory. No compiler, hooks, install or App execution.",
|
|
441
|
+
"Directories require .bundle.yaml/type, or a package.json source snapshot. Standalone .json/.yaml/.yml/.md/.txt entries get a standard Bundle; other file types require explicit metadata.",
|
|
442
|
+
"App and Meta Bundles publish direct CID links; other content uses Artifact records. Occupied Names require --expect EXACT_OLD_CID (the old Artifact CID when applicable). Published payloads are local CID pins; unpin CID releases that protection, not history holders.",
|
|
289
443
|
"Different-name CAS contention is rebased; same-name edits conflict (exit 3).",
|
|
290
444
|
"Kubo pin confirmation precedes HEAD; it does not prove a remote device is online.",
|
|
291
445
|
],
|
|
@@ -328,20 +482,28 @@ const commandHelp = {
|
|
|
328
482
|
"Does not unpin, clear history, delete unknown files or request Kubo daemon GC.",
|
|
329
483
|
],
|
|
330
484
|
},
|
|
331
|
-
|
|
332
|
-
summary: "
|
|
333
|
-
arguments: [
|
|
485
|
+
"templates render": {
|
|
486
|
+
summary: "Render a template's project files into a new or empty folder",
|
|
487
|
+
arguments: [
|
|
488
|
+
"TEMPLATE Explicit Swarm selector, directory, CAR, exact CID or IPAB URI.",
|
|
489
|
+
"NAME Project name parameter; DIR defaults to NAME (new/empty only).",
|
|
490
|
+
],
|
|
334
491
|
options: [
|
|
335
|
-
"--
|
|
492
|
+
"--description TEXT Set the declared description parameter.",
|
|
493
|
+
"--force / --no-force Refresh Swarm HEAD now / allow its valid cached snapshot.",
|
|
336
494
|
"--param KEY=VALUE Template parameter; repeatable. Strings are literal;",
|
|
337
495
|
" other parameter types use JSON.",
|
|
338
496
|
],
|
|
339
497
|
examples: [
|
|
340
|
-
"ipab
|
|
341
|
-
"ipab
|
|
342
|
-
"ipab
|
|
498
|
+
"ipab templates render node hello",
|
|
499
|
+
"ipab templates render web-app dashboard --param webAppDependency=0.1.0-rc.2",
|
|
500
|
+
"ipab templates render ./template.car hello --description Demo",
|
|
501
|
+
],
|
|
502
|
+
notes: [
|
|
503
|
+
"Short selectors resolve through the selected Swarm's typed root configuration (legacy v2/v3/v4 use Meta Name ipab); no builtin fallback.",
|
|
504
|
+
"Explicit directory, CAR and available exact CID work offline without a Swarm.",
|
|
505
|
+
"Does not install dependencies or execute template code.",
|
|
343
506
|
],
|
|
344
|
-
notes: ["Does not install dependencies or execute template code."],
|
|
345
507
|
},
|
|
346
508
|
build: {
|
|
347
509
|
summary: "Assemble any Bundle using ipab.build.yaml (no compilation)",
|
|
@@ -385,7 +547,9 @@ const commandHelp = {
|
|
|
385
547
|
},
|
|
386
548
|
"bundle inspect": {
|
|
387
549
|
summary: "Inspect a Bundle or type definition",
|
|
388
|
-
arguments: [
|
|
550
|
+
arguments: [
|
|
551
|
+
"SOURCE Directory, definition file, CAR, CID or packaged builtin reference.",
|
|
552
|
+
],
|
|
389
553
|
examples: ["ipab bundle inspect note\\dist\\bundle.car"],
|
|
390
554
|
notes: ["Does not execute Apps, import content or create pins."],
|
|
391
555
|
},
|
|
@@ -395,11 +559,11 @@ const commandHelp = {
|
|
|
395
559
|
examples: ["ipab bundle import hello\\dist\\app.car"],
|
|
396
560
|
notes: [
|
|
397
561
|
"Repeated imports are safe; no App execution or daemon startup.",
|
|
398
|
-
"Does not pin or retain content. Use pin
|
|
562
|
+
"Does not pin or retain content. Use pin CID for persistent retention.",
|
|
399
563
|
],
|
|
400
564
|
},
|
|
401
565
|
exec: {
|
|
402
|
-
summary: "Run an App by CID
|
|
566
|
+
summary: "Run an App by exact CID or Swarm IPAB URI",
|
|
403
567
|
arguments: [
|
|
404
568
|
"APP_ARGS Everything after APP is passed verbatim, including --help.",
|
|
405
569
|
],
|
|
@@ -423,7 +587,9 @@ const commandHelp = {
|
|
|
423
587
|
},
|
|
424
588
|
open: {
|
|
425
589
|
summary: "Open content with its registered App",
|
|
426
|
-
arguments: [
|
|
590
|
+
arguments: [
|
|
591
|
+
"CONTENT Bundle CID, packaged builtin reference or Swarm IPAB URI.",
|
|
592
|
+
],
|
|
427
593
|
options: [
|
|
428
594
|
"--log Record stdout/stderr; requires history enabled.",
|
|
429
595
|
"--raw Open the Artifact node rather than its value.",
|
|
@@ -437,86 +603,106 @@ const commandHelp = {
|
|
|
437
603
|
],
|
|
438
604
|
notes: [
|
|
439
605
|
"Requires a saved registration and App support for the exact content type.",
|
|
606
|
+
"Uses only the content URI's Swarm, otherwise --swarm, otherwise swarm.default. A selected Swarm is required.",
|
|
607
|
+
"A registered App's retrieval, compatibility or execution failure never triggers fallback.",
|
|
608
|
+
"Legacy User registrations are inactive and preserved in the state database's legacy_user_registrations table; review them before explicit Swarm registration.",
|
|
440
609
|
"ipab://ALIAS_OR_ENCODED_CONFIG_URL/PATH selects its own swarm; ipab:///PATH uses --swarm or swarm.default.",
|
|
441
610
|
"Apps are NOT sandboxed; run only Apps you trust.",
|
|
442
611
|
"Logs may contain secrets; stdin is never logged. Logging makes output non-TTY.",
|
|
443
612
|
"--json is not supported; App stdio is passed through.",
|
|
444
613
|
],
|
|
445
614
|
},
|
|
446
|
-
|
|
447
|
-
summary: "
|
|
615
|
+
pin: {
|
|
616
|
+
summary: "Retain an immutable CID or follow a shared Swarm Name",
|
|
448
617
|
arguments: [
|
|
449
|
-
"
|
|
450
|
-
|
|
618
|
+
"REF Exact Bundle CID or ipab://SWARM/NAME; no local content aliases.",
|
|
619
|
+
],
|
|
620
|
+
examples: [
|
|
621
|
+
"ipab pin APP_CID",
|
|
622
|
+
"ipab pin ipab://work/apps/reader",
|
|
623
|
+
"ipab pin list",
|
|
451
624
|
],
|
|
452
|
-
examples: ["ipab pin add reader APP_CID"],
|
|
453
625
|
notes: [
|
|
454
626
|
"Validates a complete Bundle and retains its full DAG in the configured Store.",
|
|
455
|
-
"
|
|
627
|
+
"A CID stays fixed. A shared Name saves its canonical configuration URL and exact Name, refreshing on related Swarm HEAD reads/sync, not continuously.",
|
|
628
|
+
"New content is verified and retained before the previous subscription version is released. Failures keep the last good version marked stale; deleted Names keep it marked missing.",
|
|
629
|
+
"Does not execute Apps or install dependencies. Shared Names connect to their Swarm content source only as needed.",
|
|
456
630
|
"The builtin namespace is read-only.",
|
|
457
631
|
],
|
|
458
632
|
},
|
|
459
|
-
|
|
460
|
-
summary: "
|
|
461
|
-
examples: ["ipab
|
|
633
|
+
unpin: {
|
|
634
|
+
summary: "Release a CID pin or stop following a shared Name",
|
|
635
|
+
examples: ["ipab unpin APP_CID", "ipab unpin ipab://work/apps/reader"],
|
|
462
636
|
notes: [
|
|
463
637
|
"Releases only this pin's ownership on its original backend; no block deletion or GC.",
|
|
464
|
-
"
|
|
638
|
+
"Never re-resolves a shared Name to release content. Uses only saved actual roots. Missing pins are success.",
|
|
639
|
+
"Exact CID also releases archived legacy named-pin holders for that CID. Does not change shared Names, registrations or history. Built-ins are read-only.",
|
|
640
|
+
"Publication/history owners are independent; --snapshot payloads remain recursively retained by publication history after ordinary unpin.",
|
|
465
641
|
],
|
|
466
642
|
},
|
|
467
643
|
"pin list": {
|
|
468
|
-
summary: "List
|
|
469
|
-
|
|
470
|
-
"--type TYPE Exact type CID or the name of a Bundle pin of that type.",
|
|
471
|
-
],
|
|
472
|
-
examples: ["ipab pin list", "ipab pin list --type reader"],
|
|
644
|
+
summary: "List local retention, following Names and packaged built-ins",
|
|
645
|
+
examples: ["ipab pin list"],
|
|
473
646
|
notes: [
|
|
474
|
-
"
|
|
475
|
-
"Legacy retention is preserved; use
|
|
647
|
+
"Includes pending/stale/missing records and inactive archived local pin names.",
|
|
648
|
+
"Legacy retention is preserved; use unpin EXACT_CID to explicitly release its archived holders.",
|
|
476
649
|
"Reads local registrations and packaged built-ins, not live node status.",
|
|
477
650
|
],
|
|
478
651
|
},
|
|
479
652
|
"pin show": {
|
|
480
|
-
summary: "Show
|
|
481
|
-
examples: ["ipab pin show
|
|
653
|
+
summary: "Show saved retention and following status",
|
|
654
|
+
examples: ["ipab pin show APP_CID"],
|
|
482
655
|
notes: [
|
|
483
656
|
"Reads local metadata; built-in pins do not claim user Store retention.",
|
|
484
657
|
],
|
|
485
658
|
},
|
|
486
|
-
"
|
|
487
|
-
summary: "
|
|
488
|
-
|
|
659
|
+
"register list": {
|
|
660
|
+
summary: "List content-type associations in the current or selected Swarm",
|
|
661
|
+
options: [
|
|
662
|
+
"--swarm URL_OR_ALIAS Read only this Swarm registry; specify at most once.",
|
|
663
|
+
],
|
|
664
|
+
examples: ["ipab register list", "ipab register list --swarm work"],
|
|
489
665
|
notes: [
|
|
490
|
-
"
|
|
491
|
-
"
|
|
666
|
+
"Without explicit --swarm, reads the saved default Swarm. Select one with --swarm or ipab swarm use.",
|
|
667
|
+
"Legacy User registrations are inactive and preserved in legacy_user_registrations; no automatic upload or deletion.",
|
|
492
668
|
],
|
|
493
669
|
},
|
|
494
|
-
"register list": {
|
|
495
|
-
summary: "List saved content-type associations",
|
|
496
|
-
examples: ["ipab register list"],
|
|
497
|
-
},
|
|
498
670
|
"register set": {
|
|
499
671
|
summary: "Associate a content type with an App",
|
|
500
672
|
arguments: [
|
|
501
673
|
"SCHEMA Exact type CID or builtin:node-app.v1.",
|
|
502
|
-
"APP App CID or
|
|
503
|
-
|
|
674
|
+
"APP App CID or Swarm IPAB URI; the exact CID is saved.",
|
|
675
|
+
],
|
|
676
|
+
options: [
|
|
677
|
+
"--replace Allow changing an existing association.",
|
|
678
|
+
"--swarm URL_OR_ALIAS Write this Swarm registry; repeat for multiple Swarms.",
|
|
504
679
|
],
|
|
505
|
-
options: ["--replace Allow changing an existing association."],
|
|
506
680
|
examples: [
|
|
507
|
-
"ipab register set SCHEMA_CID
|
|
508
|
-
"ipab register set SCHEMA_CID reader
|
|
681
|
+
"ipab register set SCHEMA_CID APP_CID",
|
|
682
|
+
"ipab register set SCHEMA_CID ipab:///apps/reader --swarm work --swarm team",
|
|
509
683
|
],
|
|
510
684
|
notes: [
|
|
511
|
-
"
|
|
685
|
+
"Writes the Name META.registryPath/TYPE_CID directly to the App CID. Open passes only the content CID.",
|
|
686
|
+
"Custom per-association argv is unsupported; adapt the App or use ipab exec APP_CID ARGS.",
|
|
512
687
|
"Does not verify App type support; open checks it before execution.",
|
|
688
|
+
"Without explicit --swarm, writes the saved default Swarm. Swarm writes require HEAD write access.",
|
|
689
|
+
"Multiple Swarms commit sequentially, not atomically; failures report completed targets.",
|
|
513
690
|
],
|
|
514
691
|
},
|
|
515
692
|
"register remove": {
|
|
516
693
|
summary: "Remove a saved content-type association",
|
|
517
694
|
arguments: ["SCHEMA Exact type CID or builtin:node-app.v1."],
|
|
518
|
-
|
|
519
|
-
|
|
695
|
+
options: [
|
|
696
|
+
"--swarm URL_OR_ALIAS Remove from this Swarm registry; repeat for multiple Swarms.",
|
|
697
|
+
],
|
|
698
|
+
examples: [
|
|
699
|
+
"ipab register remove SCHEMA_CID",
|
|
700
|
+
"ipab register remove SCHEMA_CID --swarm work",
|
|
701
|
+
],
|
|
702
|
+
notes: [
|
|
703
|
+
"Without explicit --swarm, removes from the saved default Swarm. Multiple Swarm edits are not atomic.",
|
|
704
|
+
"Does not remove Apps, pins or content.",
|
|
705
|
+
],
|
|
520
706
|
},
|
|
521
707
|
"config get": {
|
|
522
708
|
summary: "Show effective configuration",
|
|
@@ -544,7 +730,7 @@ const commandHelp = {
|
|
|
544
730
|
"history list": {
|
|
545
731
|
summary: "List execution history",
|
|
546
732
|
options: [
|
|
547
|
-
"--app APP Filter by App CID
|
|
733
|
+
"--app APP Filter by exact App CID.",
|
|
548
734
|
"--status STATUS succeeded, failed or cancelled.",
|
|
549
735
|
"--since TIME Include runs ended at or after TIME.",
|
|
550
736
|
"--until TIME Include runs ended before TIME.",
|
|
@@ -567,7 +753,7 @@ const commandHelp = {
|
|
|
567
753
|
"history remove": {
|
|
568
754
|
summary: "Remove execution records and their logs",
|
|
569
755
|
options: [
|
|
570
|
-
"--app APP Filter by App CID
|
|
756
|
+
"--app APP Filter by exact App CID.",
|
|
571
757
|
"--status STATUS succeeded, failed or cancelled.",
|
|
572
758
|
"--since TIME Include runs ended at or after TIME.",
|
|
573
759
|
"--until TIME Include runs ended before TIME.",
|
|
@@ -601,17 +787,20 @@ Run Apps:
|
|
|
601
787
|
open ${commandHelp.open.summary}
|
|
602
788
|
|
|
603
789
|
Create:
|
|
604
|
-
|
|
790
|
+
templates ${groups.templates}
|
|
605
791
|
build ${commandHelp.build.summary}
|
|
606
792
|
bundle ${groups.bundle}
|
|
607
793
|
|
|
608
794
|
Manage:
|
|
609
|
-
|
|
795
|
+
doctor ${commandHelp.doctor.summary}
|
|
796
|
+
profile ${commandHelp.profile.summary}
|
|
610
797
|
swarm ${groups.swarm}
|
|
611
|
-
|
|
798
|
+
skills ${groups.skills}
|
|
799
|
+
search Search formal Names in the current swarm
|
|
612
800
|
publish ${commandHelp.publish.summary}
|
|
613
801
|
get ${commandHelp.get.summary}
|
|
614
802
|
pin ${groups.pin}
|
|
803
|
+
unpin ${commandHelp.unpin.summary}
|
|
615
804
|
register ${groups.register}
|
|
616
805
|
config ${groups.config}
|
|
617
806
|
store ${groups.store}
|
|
@@ -633,7 +822,25 @@ ${footer}`;
|
|
|
633
822
|
...(topic.arguments ? [section("Arguments", topic.arguments)] : []),
|
|
634
823
|
...(topic.options ? [section("Options", topic.options)] : []),
|
|
635
824
|
section("Examples", topic.examples),
|
|
636
|
-
...(
|
|
825
|
+
...([
|
|
826
|
+
"swarm status",
|
|
827
|
+
"swarm members",
|
|
828
|
+
"swarm update",
|
|
829
|
+
"swarm resume",
|
|
830
|
+
"swarm profile",
|
|
831
|
+
"swarm export",
|
|
832
|
+
"swarm approve",
|
|
833
|
+
"swarm exclude",
|
|
834
|
+
].includes(path)
|
|
835
|
+
? [
|
|
836
|
+
section("Notes", [
|
|
837
|
+
...(topic.notes ?? []),
|
|
838
|
+
"Select only with global --swarm URL_OR_ALIAS (before the command), or the saved swarm.default. Neither means an error.",
|
|
839
|
+
]),
|
|
840
|
+
]
|
|
841
|
+
: topic.notes
|
|
842
|
+
? [section("Notes", topic.notes)]
|
|
843
|
+
: []),
|
|
637
844
|
`\n\n-h, --help shows this help. Global options: see 'ipab --help'.\n${footer}`,
|
|
638
845
|
].join("");
|
|
639
846
|
}
|
|
@@ -757,6 +964,7 @@ async function closeStore(store, appExitCode) {
|
|
|
757
964
|
export function parse(argv) {
|
|
758
965
|
const tokens = [...argv];
|
|
759
966
|
const flags = { json: false };
|
|
967
|
+
const swarms = [];
|
|
760
968
|
while (tokens[0]?.startsWith("-")) {
|
|
761
969
|
const flag = tokens.shift();
|
|
762
970
|
if (flag === "-h" || flag === "--help")
|
|
@@ -792,8 +1000,10 @@ export function parse(argv) {
|
|
|
792
1000
|
syntax(`${flag} needs a value.`);
|
|
793
1001
|
if (flag === "--state-dir")
|
|
794
1002
|
flags.stateDir = value;
|
|
795
|
-
else if (flag === "--swarm")
|
|
1003
|
+
else if (flag === "--swarm") {
|
|
796
1004
|
flags.swarm = value;
|
|
1005
|
+
swarms.push(value);
|
|
1006
|
+
}
|
|
797
1007
|
else {
|
|
798
1008
|
flags.storeGateway = publicUrl(value);
|
|
799
1009
|
}
|
|
@@ -802,6 +1012,10 @@ export function parse(argv) {
|
|
|
802
1012
|
syntax(`Unknown global option "${flag}".`);
|
|
803
1013
|
}
|
|
804
1014
|
const group = tokens.shift() ?? "";
|
|
1015
|
+
if (group === "init")
|
|
1016
|
+
syntax("Root init was removed. Use ipab templates render TEMPLATE NAME [DIR]; TEMPLATE is the first positional argument, not --template.");
|
|
1017
|
+
if (group === "templates" && swarms.length > 1)
|
|
1018
|
+
syntax("Templates accepts only one global --swarm, before the command.");
|
|
805
1019
|
const result = {
|
|
806
1020
|
flags,
|
|
807
1021
|
path: group,
|
|
@@ -809,6 +1023,7 @@ export function parse(argv) {
|
|
|
809
1023
|
options: {},
|
|
810
1024
|
help: !group,
|
|
811
1025
|
version: false,
|
|
1026
|
+
...(group === "register" ? { registrySwarms: swarms } : {}),
|
|
812
1027
|
};
|
|
813
1028
|
if (!group)
|
|
814
1029
|
return result;
|
|
@@ -832,27 +1047,47 @@ export function parse(argv) {
|
|
|
832
1047
|
result.positional = tokens;
|
|
833
1048
|
return result;
|
|
834
1049
|
}
|
|
835
|
-
if (![
|
|
1050
|
+
if (![
|
|
1051
|
+
"open",
|
|
1052
|
+
"build",
|
|
1053
|
+
"publish",
|
|
1054
|
+
"get",
|
|
1055
|
+
"search",
|
|
1056
|
+
"doctor",
|
|
1057
|
+
"profile",
|
|
1058
|
+
"unpin",
|
|
1059
|
+
].includes(group)) {
|
|
836
1060
|
if (![
|
|
837
1061
|
"bundle",
|
|
838
1062
|
"pin",
|
|
839
1063
|
"register",
|
|
1064
|
+
"templates",
|
|
840
1065
|
"config",
|
|
841
1066
|
"history",
|
|
842
1067
|
"store",
|
|
843
1068
|
"swarm",
|
|
1069
|
+
"skills",
|
|
844
1070
|
].includes(group))
|
|
845
|
-
syntax(`Unknown command "${group}"
|
|
846
|
-
if (
|
|
1071
|
+
syntax(`Unknown command "${group}".${group === "setup" ? " Run ipab doctor to inspect, or ipab doctor --fix to prepare this device." : " Run ipab --help."}`);
|
|
1072
|
+
if (group === "pin" && !["list", "show"].includes(tokens[0] ?? "")) {
|
|
1073
|
+
if (!tokens.length || tokens[0] === "-h" || tokens[0] === "--help") {
|
|
1074
|
+
result.help = true;
|
|
1075
|
+
return result;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
else if (!tokens.length || tokens[0] === "-h" || tokens[0] === "--help") {
|
|
847
1079
|
result.help = true;
|
|
848
1080
|
return result;
|
|
849
1081
|
}
|
|
850
|
-
|
|
1082
|
+
else
|
|
1083
|
+
result.path = `${group} ${tokens.shift()}`;
|
|
851
1084
|
}
|
|
852
1085
|
else if (group === "open" && flags.json)
|
|
853
1086
|
syntax("--json is not supported for exec/open.");
|
|
854
1087
|
if (!commands[result.path])
|
|
855
1088
|
syntax(`Unknown command "${result.path}".`);
|
|
1089
|
+
if (group === "skills" && swarms.length > 1)
|
|
1090
|
+
syntax("Skills operations select exactly one Swarm; repeated --swarm is not supported.");
|
|
856
1091
|
const separator = result.path === "register set" ? tokens.indexOf("--") : -1;
|
|
857
1092
|
if (separator >= 0)
|
|
858
1093
|
result.template = tokens.splice(separator + 1);
|
|
@@ -866,51 +1101,64 @@ export function parse(argv) {
|
|
|
866
1101
|
tokens.includes("pointers.apiKey") &&
|
|
867
1102
|
!(tokens.length === 2 && tokens[1] === "-"))
|
|
868
1103
|
syntax("API key must be provided through '-' and piped stdin; never pass it in command arguments.");
|
|
869
|
-
const booleans = result.path
|
|
870
|
-
?
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
1104
|
+
const booleans = result.path.startsWith("skills ")
|
|
1105
|
+
? result.path === "skills sync"
|
|
1106
|
+
? ["dry-run", "yes", "force", "no-force"]
|
|
1107
|
+
: ["force", "no-force"]
|
|
1108
|
+
: result.path === "doctor"
|
|
1109
|
+
? ["fix", "yes"]
|
|
1110
|
+
: result.path === "bundle build"
|
|
1111
|
+
? ["replace", "schema-only", "no-import"]
|
|
1112
|
+
: result.path === "build"
|
|
1113
|
+
? ["replace", "no-import"]
|
|
1114
|
+
: result.path === "publish"
|
|
1115
|
+
? ["snapshot"]
|
|
1116
|
+
: [
|
|
1117
|
+
"get",
|
|
1118
|
+
"templates render",
|
|
1119
|
+
"templates list",
|
|
1120
|
+
"templates show",
|
|
1121
|
+
].includes(result.path)
|
|
1122
|
+
? result.path === "templates render"
|
|
1123
|
+
? ["force", "no-force"]
|
|
1124
|
+
: result.path === "get"
|
|
1125
|
+
? ["raw", "force", "no-force"]
|
|
1126
|
+
: ["force", "no-force"]
|
|
1127
|
+
: result.path === "search"
|
|
1128
|
+
? ["all", "current", "force", "no-force"]
|
|
1129
|
+
: result.path === "swarm approve"
|
|
1130
|
+
? ["yes", "again"]
|
|
1131
|
+
: result.path === "swarm status"
|
|
1132
|
+
? ["local"]
|
|
1133
|
+
: result.path === "swarm exclude"
|
|
1134
|
+
? ["yes"]
|
|
1135
|
+
: result.path === "register set"
|
|
1136
|
+
? ["replace"]
|
|
1137
|
+
: result.path === "history remove"
|
|
1138
|
+
? ["yes"]
|
|
1139
|
+
: result.path === "open"
|
|
1140
|
+
? ["log", "raw", "force", "no-force"]
|
|
1141
|
+
: [];
|
|
894
1142
|
const values = result.path === "swarm create"
|
|
895
1143
|
? ["service", "resume", "name", "description", "alias"]
|
|
896
1144
|
: result.path === "swarm add"
|
|
897
1145
|
? ["alias"]
|
|
898
1146
|
: result.path === "swarm request"
|
|
899
|
-
? ["
|
|
1147
|
+
? ["alias", "output"]
|
|
900
1148
|
: result.path === "swarm export"
|
|
901
1149
|
? ["output"]
|
|
902
1150
|
: result.path === "swarm profile"
|
|
903
|
-
? ["
|
|
904
|
-
: result.path === "swarm update"
|
|
1151
|
+
? ["address"]
|
|
1152
|
+
: result.path === "swarm update" || result.path === "profile"
|
|
905
1153
|
? ["name", "description"]
|
|
906
1154
|
: result.path === "swarm approve"
|
|
907
1155
|
? []
|
|
908
|
-
:
|
|
909
|
-
? ["
|
|
1156
|
+
: ["publish", "templates set", "templates remove"].includes(result.path)
|
|
1157
|
+
? ["expect"]
|
|
910
1158
|
: result.path === "get"
|
|
911
1159
|
? ["output"]
|
|
912
|
-
: result.path === "
|
|
913
|
-
? ["
|
|
1160
|
+
: result.path === "templates render"
|
|
1161
|
+
? ["description"]
|
|
914
1162
|
: result.path === "bundle build" ||
|
|
915
1163
|
result.path === "build"
|
|
916
1164
|
? ["output"]
|
|
@@ -925,11 +1173,7 @@ export function parse(argv) {
|
|
|
925
1173
|
]
|
|
926
1174
|
: result.path === "history remove"
|
|
927
1175
|
? ["app", "status", "since", "until"]
|
|
928
|
-
:
|
|
929
|
-
? ["type"]
|
|
930
|
-
: [];
|
|
931
|
-
if (result.path === "setup")
|
|
932
|
-
values.push("kubo-archive");
|
|
1176
|
+
: [];
|
|
933
1177
|
while (tokens.length) {
|
|
934
1178
|
const value = tokens.shift();
|
|
935
1179
|
if (result.path === "swarm exclude" &&
|
|
@@ -938,7 +1182,24 @@ export function parse(argv) {
|
|
|
938
1182
|
}
|
|
939
1183
|
else if (value.startsWith("--") || value === "-o") {
|
|
940
1184
|
const option = value === "-o" ? "output" : value.slice(2);
|
|
941
|
-
if (result.path === "
|
|
1185
|
+
if (result.path === "skills sync" && option === "agent") {
|
|
1186
|
+
const input = tokens.shift();
|
|
1187
|
+
if (!input || input.startsWith("-"))
|
|
1188
|
+
syntax("--agent needs a value.");
|
|
1189
|
+
(result.agents ??= []).push(input);
|
|
1190
|
+
continue;
|
|
1191
|
+
}
|
|
1192
|
+
if (result.path.startsWith("register ") && option === "swarm") {
|
|
1193
|
+
const input = tokens.shift();
|
|
1194
|
+
if (!input || input.startsWith("-"))
|
|
1195
|
+
syntax("--swarm needs a value.");
|
|
1196
|
+
result.registrySwarms.push(input);
|
|
1197
|
+
flags.swarm = input;
|
|
1198
|
+
continue;
|
|
1199
|
+
}
|
|
1200
|
+
if (result.path === "templates render" && option === "template")
|
|
1201
|
+
syntax("--template was removed. Use ipab templates render TEMPLATE NAME [DIR], with TEMPLATE first.");
|
|
1202
|
+
if (result.path === "templates render" && option === "param") {
|
|
942
1203
|
const input = tokens.shift();
|
|
943
1204
|
if (!input || input.startsWith("--") || input.indexOf("=") < 1)
|
|
944
1205
|
syntax("--param requires KEY=VALUE.");
|
|
@@ -953,12 +1214,15 @@ export function parse(argv) {
|
|
|
953
1214
|
const input = tokens.shift();
|
|
954
1215
|
if (input === undefined ||
|
|
955
1216
|
(input.startsWith("--") &&
|
|
956
|
-
!(
|
|
957
|
-
|
|
958
|
-
|
|
1217
|
+
!(option === "resume" && /^[A-Za-z0-9_-]{43}$/.test(input))) ||
|
|
1218
|
+
(input === "" &&
|
|
1219
|
+
!["swarm update", "profile", "templates render"].includes(result.path)))
|
|
959
1220
|
syntax(`${value} needs a value.`);
|
|
960
1221
|
result.options[option] = input;
|
|
961
1222
|
}
|
|
1223
|
+
else if (option === "name" &&
|
|
1224
|
+
["swarm profile", "swarm request"].includes(result.path))
|
|
1225
|
+
syntax(`Personal names are account-wide. Use ipab profile --name NAME instead.${result.path === "swarm profile" ? " For network configuration, use ipab --swarm URL_OR_ALIAS swarm profile --address MULTIADDR." : ""}`);
|
|
962
1226
|
else
|
|
963
1227
|
syntax(`Unknown option "${value}".`);
|
|
964
1228
|
}
|
|
@@ -971,38 +1235,52 @@ export function parse(argv) {
|
|
|
971
1235
|
result.options.current &&
|
|
972
1236
|
flags.swarm !== undefined)
|
|
973
1237
|
syntax("--current and --swarm are mutually exclusive.");
|
|
1238
|
+
if (result.path === "search" &&
|
|
1239
|
+
result.options.all &&
|
|
1240
|
+
(result.options.current || flags.swarm !== undefined))
|
|
1241
|
+
syntax("--all is mutually exclusive with --current and --swarm.");
|
|
1242
|
+
if (result.path === "register list" &&
|
|
1243
|
+
(result.registrySwarms?.length ?? 0) > 1)
|
|
1244
|
+
syntax("register list accepts --swarm at most once. Select one Swarm or omit it to use the current Swarm.");
|
|
974
1245
|
const counts = {
|
|
975
|
-
|
|
1246
|
+
doctor: [0, 0],
|
|
1247
|
+
"skills list": [0, 0],
|
|
1248
|
+
"skills sync": [0, Number.MAX_SAFE_INTEGER],
|
|
1249
|
+
profile: [0, 0],
|
|
976
1250
|
"swarm create": [0, 0],
|
|
977
1251
|
"swarm request": [1, 1],
|
|
978
1252
|
"swarm approve": [1, 1],
|
|
979
|
-
"swarm export": [
|
|
1253
|
+
"swarm export": [0, 0],
|
|
980
1254
|
"swarm exclude": [1, 1],
|
|
981
|
-
"swarm resume": [0,
|
|
982
|
-
"swarm profile": [0,
|
|
983
|
-
"swarm status": [0,
|
|
1255
|
+
"swarm resume": [0, 0],
|
|
1256
|
+
"swarm profile": [0, 0],
|
|
1257
|
+
"swarm status": [0, 0],
|
|
1258
|
+
"swarm members": [0, 0],
|
|
984
1259
|
"swarm list": [0, 0],
|
|
985
1260
|
"swarm add": [1, 1],
|
|
986
1261
|
"swarm use": [1, 1],
|
|
987
1262
|
"swarm remove": [1, 1],
|
|
988
|
-
"swarm update": [0,
|
|
989
|
-
publish: [
|
|
1263
|
+
"swarm update": [0, 0],
|
|
1264
|
+
publish: [2, 2],
|
|
990
1265
|
get: [1, 1],
|
|
991
1266
|
search: [1, 1],
|
|
992
|
-
|
|
1267
|
+
"templates render": [2, 3],
|
|
993
1268
|
build: [0, 1],
|
|
994
1269
|
"bundle build": [1, 1],
|
|
995
1270
|
"bundle inspect": [1, 1],
|
|
996
1271
|
"bundle import": [1, 1],
|
|
997
1272
|
open: [1, 1],
|
|
998
|
-
|
|
999
|
-
|
|
1273
|
+
pin: [1, 1],
|
|
1274
|
+
unpin: [1, 1],
|
|
1000
1275
|
"pin list": [0, 0],
|
|
1001
1276
|
"pin show": [1, 1],
|
|
1002
|
-
"pin rename": [2, 2],
|
|
1003
1277
|
"register list": [0, 0],
|
|
1004
1278
|
"register set": [2, 2],
|
|
1005
1279
|
"register remove": [1, 1],
|
|
1280
|
+
"templates list": [0, 0],
|
|
1281
|
+
"templates show": [1, 1],
|
|
1282
|
+
"templates set": [2, 2],
|
|
1283
|
+
"templates remove": [1, 1],
|
|
1006
1284
|
"config get": [0, 1],
|
|
1007
1285
|
"config set": [2, 2],
|
|
1008
1286
|
"config reset": [1, 1],
|
|
@@ -1015,11 +1293,22 @@ export function parse(argv) {
|
|
|
1015
1293
|
if (result.options["with-source"] && result.options["without-source"])
|
|
1016
1294
|
syntax("--with-source and --without-source are mutually exclusive.");
|
|
1017
1295
|
const [minimum, maximum] = counts[result.path];
|
|
1296
|
+
if (result.path === "profile" && flags.swarm !== undefined)
|
|
1297
|
+
syntax("Personal profile is account-wide; do not pass --swarm.");
|
|
1298
|
+
if (result.positional.length &&
|
|
1299
|
+
[
|
|
1300
|
+
"swarm status",
|
|
1301
|
+
"swarm update",
|
|
1302
|
+
"swarm resume",
|
|
1303
|
+
"swarm profile",
|
|
1304
|
+
"swarm export",
|
|
1305
|
+
"swarm members",
|
|
1306
|
+
].includes(result.path))
|
|
1307
|
+
syntax(`Swarm target positionals are no longer supported. Use ipab --swarm URL_OR_ALIAS ${result.path} instead.`);
|
|
1018
1308
|
if (result.positional.length < minimum || result.positional.length > maximum)
|
|
1019
1309
|
syntax(`Invalid arguments.\n${help(result.path)}`);
|
|
1020
|
-
if (result.template
|
|
1021
|
-
(
|
|
1022
|
-
syntax('Argument template must contain a whole "%" token.');
|
|
1310
|
+
if (result.template)
|
|
1311
|
+
syntax('Custom per-association argv is unsupported. Remove "-- TEMPLATE..."; open passes only the content CID. Adapt the App or use ipab exec APP_CID ARGS.');
|
|
1023
1312
|
if (result.path === "history remove") {
|
|
1024
1313
|
const selected = values.some((value) => Object.hasOwn(result.options, value));
|
|
1025
1314
|
if ((!selected && !result.positional.length) ||
|
|
@@ -1027,12 +1316,29 @@ export function parse(argv) {
|
|
|
1027
1316
|
syntax("history remove requires explicit IDs OR filters, not both.");
|
|
1028
1317
|
}
|
|
1029
1318
|
// Validate syntactic values before state access, let alone a backend connection.
|
|
1030
|
-
if (
|
|
1031
|
-
|
|
1032
|
-
if (result.path
|
|
1033
|
-
|
|
1034
|
-
if (result.path === "pin
|
|
1035
|
-
|
|
1319
|
+
if (["pin", "unpin", "pin show"].includes(result.path)) {
|
|
1320
|
+
const reference = result.positional[0];
|
|
1321
|
+
if (reference.startsWith("builtin:") && result.path !== "pin show")
|
|
1322
|
+
syntax("Packaged builtin references are read-only; they cannot be pinned or unpinned.");
|
|
1323
|
+
if (!(result.path === "pin show" && reference.startsWith("builtin:")) &&
|
|
1324
|
+
!parseNameReference(reference))
|
|
1325
|
+
exactCid(reference);
|
|
1326
|
+
}
|
|
1327
|
+
if (result.path === "publish") {
|
|
1328
|
+
formalName(result.positional[0]);
|
|
1329
|
+
if (typeof result.options.expect === "string")
|
|
1330
|
+
exactCid(result.options.expect);
|
|
1331
|
+
if (result.options.expect && result.options.snapshot)
|
|
1332
|
+
syntax("--snapshot is initial-only and cannot be combined with --expect.");
|
|
1333
|
+
}
|
|
1334
|
+
if (result.path.startsWith("templates ") &&
|
|
1335
|
+
result.path !== "templates render") {
|
|
1336
|
+
if (result.positional[0] !== undefined)
|
|
1337
|
+
templateName(result.positional[0]);
|
|
1338
|
+
if (typeof result.options.expect === "string")
|
|
1339
|
+
exactCid(result.options.expect);
|
|
1340
|
+
if (result.path === "templates remove" && !result.options.expect)
|
|
1341
|
+
syntax("templates remove requires --expect OLD_TARGET_CID.");
|
|
1036
1342
|
}
|
|
1037
1343
|
if (result.path.startsWith("config ") && result.positional[0]) {
|
|
1038
1344
|
if (!(result.path === "config get" && result.positional[0] === "state-dir") &&
|
|
@@ -1051,6 +1357,8 @@ export function parse(argv) {
|
|
|
1051
1357
|
parseValue("history.limit", result.options.limit, true);
|
|
1052
1358
|
if (result.options.output === "-")
|
|
1053
1359
|
syntax("CAR output requires a file path; binary stdout is not supported.");
|
|
1360
|
+
if (result.path === "doctor" && result.options.yes && !result.options.fix)
|
|
1361
|
+
syntax("doctor --yes requires --fix.");
|
|
1054
1362
|
return result;
|
|
1055
1363
|
}
|
|
1056
1364
|
async function performCli(argv, io, env) {
|
|
@@ -1073,34 +1381,29 @@ async function performCli(argv, io, env) {
|
|
|
1073
1381
|
}
|
|
1074
1382
|
if (parsed.path === "history remove" && !parsed.options.yes && !io.tty)
|
|
1075
1383
|
syntax("Non-interactive history remove requires --yes.");
|
|
1076
|
-
if (parsed.path === "
|
|
1077
|
-
if (!parsed.options.yes &&
|
|
1078
|
-
(!io.tty ||
|
|
1079
|
-
!(await io.confirm("Install checksum-verified Kubo and initialize/reuse the protected HOME identity? No daemon will be contacted or started."))))
|
|
1080
|
-
throw new HostError("Setup requires explicit --yes or interactive confirmation.");
|
|
1384
|
+
if (parsed.path === "doctor") {
|
|
1081
1385
|
const controller = new AbortController();
|
|
1082
1386
|
const interrupt = () => {
|
|
1083
|
-
controller.abort(new HostError("
|
|
1387
|
+
controller.abort(new HostError("Doctor interrupted.", 130, "ABORTED"));
|
|
1084
1388
|
};
|
|
1085
1389
|
const terminate = () => {
|
|
1086
|
-
controller.abort(new HostError("
|
|
1390
|
+
controller.abort(new HostError("Doctor terminated.", 143, "ABORTED"));
|
|
1087
1391
|
};
|
|
1088
1392
|
process.once("SIGINT", interrupt);
|
|
1089
1393
|
process.once("SIGTERM", terminate);
|
|
1090
1394
|
try {
|
|
1091
|
-
const result = await
|
|
1395
|
+
const result = await doctorDevice(stateLocation(parsed.flags, env).path, env, {
|
|
1092
1396
|
diagnostic: (text, progress) => {
|
|
1093
1397
|
io.err(text, progress);
|
|
1094
1398
|
},
|
|
1095
1399
|
signal: controller.signal,
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1400
|
+
fix: Boolean(parsed.options.fix),
|
|
1401
|
+
yes: Boolean(parsed.options.yes),
|
|
1402
|
+
tty: io.tty,
|
|
1403
|
+
confirm: (text, signal) => io.confirm(text, signal),
|
|
1099
1404
|
});
|
|
1100
|
-
io.out(parsed.flags.json
|
|
1101
|
-
|
|
1102
|
-
: `Kubo ${result.kuboVersion}: ${result.binary}\nAccount fingerprint: ${result.fingerprint}\nReady. Nodes start only when a Swarm is used.`);
|
|
1103
|
-
return 0;
|
|
1405
|
+
io.out(parsed.flags.json ? JSON.stringify(result) : doctorText(result));
|
|
1406
|
+
return result.ready ? 0 : 1;
|
|
1104
1407
|
}
|
|
1105
1408
|
finally {
|
|
1106
1409
|
process.removeListener("SIGINT", interrupt);
|
|
@@ -1118,7 +1421,8 @@ async function performCli(argv, io, env) {
|
|
|
1118
1421
|
return 0;
|
|
1119
1422
|
}
|
|
1120
1423
|
const items = effectiveConfig(state.config({
|
|
1121
|
-
includeSecrets:
|
|
1424
|
+
includeSecrets: !["swarm members", "profile", "swarm status"].includes(parsed.path) ||
|
|
1425
|
+
Boolean(parsed.options.local),
|
|
1122
1426
|
}), parsed.flags, env, (reference) => state.resolveSwarm(reference));
|
|
1123
1427
|
const value = (key) => items.find((item) => item.key === key).value;
|
|
1124
1428
|
const emit = (result, human) => {
|
|
@@ -1128,6 +1432,11 @@ async function performCli(argv, io, env) {
|
|
|
1128
1432
|
const selectedSwarm = value("swarm.default") === null
|
|
1129
1433
|
? undefined
|
|
1130
1434
|
: String(value("swarm.default"));
|
|
1435
|
+
const requireSwarm = () => {
|
|
1436
|
+
if (!selectedSwarm)
|
|
1437
|
+
syntax("Select a Swarm with ipab --swarm URL_OR_ALIAS, or save a default with ipab swarm use URL_OR_ALIAS.");
|
|
1438
|
+
return selectedSwarm;
|
|
1439
|
+
};
|
|
1131
1440
|
const swarmContext = () => ({
|
|
1132
1441
|
get store() {
|
|
1133
1442
|
return store;
|
|
@@ -1167,7 +1476,187 @@ async function performCli(argv, io, env) {
|
|
|
1167
1476
|
source: current.source,
|
|
1168
1477
|
};
|
|
1169
1478
|
};
|
|
1479
|
+
if (parsed.path === "open" || parsed.path.startsWith("register ")) {
|
|
1480
|
+
if (state.legacyRegistrationCount)
|
|
1481
|
+
io.err(`Legacy User registrations are inactive. ${state.legacyRegistrationCount} entries are preserved in legacy_user_registrations in the state database under ${state.directory}; nothing was uploaded or deleted. Custom per-association argv is unsupported. Review the archived values and explicitly run ipab register set TYPE_CID APP_CID --swarm URL_OR_ALIAS to publish only intended associations.`);
|
|
1482
|
+
}
|
|
1483
|
+
if (state.legacyPinCount)
|
|
1484
|
+
io.err(`Legacy local pin names are inactive: ${state.legacyPinCount} records are preserved in legacy_named_pins under ${state.directory}. Retention and original Store owners are unchanged; inspect ipab pin list and release intended archived holders with ipab unpin EXACT_CID.`);
|
|
1485
|
+
if (parsed.path.startsWith("templates ") &&
|
|
1486
|
+
parsed.path !== "templates render") {
|
|
1487
|
+
const configUrl = requireSwarm();
|
|
1488
|
+
store = new IpfsStore(await storeConfiguration(value("store.gateway")));
|
|
1489
|
+
const context = swarmContext();
|
|
1490
|
+
const expected = typeof parsed.options.expect === "string"
|
|
1491
|
+
? parsed.options.expect
|
|
1492
|
+
: undefined;
|
|
1493
|
+
try {
|
|
1494
|
+
if (parsed.path === "templates list") {
|
|
1495
|
+
const items = await swarmTemplates(context, configUrl);
|
|
1496
|
+
const alias = state
|
|
1497
|
+
.swarms()
|
|
1498
|
+
.find((swarm) => swarm.cid === configUrl)?.alias;
|
|
1499
|
+
emit({ items }, `Swarm: ${alias ? printable(alias) : "(no local alias)"}\nConfig URL: ${configUrl}\nTemplates: ${items.length}\n\n${table(["NAME", "TITLE", "TARGET CID", "TEMPLATE CID"], items.map((item) => [
|
|
1500
|
+
item.selector,
|
|
1501
|
+
item.title,
|
|
1502
|
+
item.targetCid,
|
|
1503
|
+
item.templateCid,
|
|
1504
|
+
]), "No templates registered in this Swarm.\nAdd a template: ipab templates set NAME SOURCE")}`);
|
|
1505
|
+
}
|
|
1506
|
+
else if (parsed.path === "templates show") {
|
|
1507
|
+
const item = (await swarmTemplates(context, configUrl, first))[0];
|
|
1508
|
+
if (parsed.flags.json)
|
|
1509
|
+
io.out(JSON.stringify(item));
|
|
1510
|
+
else {
|
|
1511
|
+
const alias = state
|
|
1512
|
+
.swarms()
|
|
1513
|
+
.find((swarm) => swarm.cid === configUrl)?.alias;
|
|
1514
|
+
const swarm = alias ?? configUrl;
|
|
1515
|
+
const reference = formatNameReference(swarm, item.name);
|
|
1516
|
+
const tree = await templateOutputTree(context.store, item.templateCid);
|
|
1517
|
+
const shell = process.platform === "win32" ? "powershell" : "posix";
|
|
1518
|
+
io.out([
|
|
1519
|
+
`${printable(item.selector)} — ${printable(item.title)}`,
|
|
1520
|
+
printable(item.description) || "(No description.)",
|
|
1521
|
+
"",
|
|
1522
|
+
"Location",
|
|
1523
|
+
` Swarm: ${printable(swarm)}`,
|
|
1524
|
+
` Name: ${printable(item.name)}`,
|
|
1525
|
+
"",
|
|
1526
|
+
`Create a project (${shell === "powershell" ? "PowerShell" : "POSIX shell"})`,
|
|
1527
|
+
` ${templateRenderExample(reference, swarm, item.definition, shell)}`,
|
|
1528
|
+
" Replace example parameter values as needed. No code is run by show.",
|
|
1529
|
+
"",
|
|
1530
|
+
"Parameters",
|
|
1531
|
+
table(["NAME", "TYPE", "REQUIRED", "DEFAULT", "INPUT"], templateParameterRows(item.definition), "No parameters declared."),
|
|
1532
|
+
"Required means an input is needed when no default is declared.",
|
|
1533
|
+
"",
|
|
1534
|
+
"Output files (from project/)",
|
|
1535
|
+
" my-project/",
|
|
1536
|
+
...tree.entries.map((entry) => `${" ".repeat(entry.path.split("/").length + 1)}${printable(entry.path.split("/").at(-1))}${entry.kind === "directory" ? "/" : ""}`),
|
|
1537
|
+
...(tree.truncated
|
|
1538
|
+
? [
|
|
1539
|
+
` ... truncated: ${tree.truncated}; more files may exist.`,
|
|
1540
|
+
]
|
|
1541
|
+
: tree.entries.length
|
|
1542
|
+
? []
|
|
1543
|
+
: [" (no output files)"]),
|
|
1544
|
+
"",
|
|
1545
|
+
"Versions",
|
|
1546
|
+
` Template CID: ${item.templateCid}`,
|
|
1547
|
+
` Reference: ${reference}`,
|
|
1548
|
+
...(item.targetCid !== item.templateCid
|
|
1549
|
+
? [` Target CID (--expect): ${item.targetCid}`]
|
|
1550
|
+
: []),
|
|
1551
|
+
].join("\n"));
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
else if (parsed.path === "templates set") {
|
|
1555
|
+
const item = await setSwarmTemplate(context, configUrl, first, second, expected);
|
|
1556
|
+
emit(item, `${item.reference} → ${item.targetCid} (Template ${item.templateCid})`);
|
|
1557
|
+
}
|
|
1558
|
+
else {
|
|
1559
|
+
const item = await removeSwarmTemplate(context, configUrl, first, expected);
|
|
1560
|
+
emit({ removed: item }, `Removed ${item.reference}; content and history are retained.`);
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
finally {
|
|
1564
|
+
await context.finishRead?.();
|
|
1565
|
+
}
|
|
1566
|
+
return 0;
|
|
1567
|
+
}
|
|
1568
|
+
if (parsed.path.startsWith("register ")) {
|
|
1569
|
+
const references = parsed.registrySwarms?.length
|
|
1570
|
+
? parsed.registrySwarms
|
|
1571
|
+
: selectedSwarm
|
|
1572
|
+
? [selectedSwarm]
|
|
1573
|
+
: [];
|
|
1574
|
+
if (!references.length)
|
|
1575
|
+
throw new HostError("Register requires a selected Swarm. Pass --swarm URL_OR_ALIAS, or save a default with ipab swarm use URL_OR_ALIAS.");
|
|
1576
|
+
const targets = [
|
|
1577
|
+
...new Set(references.map((reference) => state.resolveSwarm(reference))),
|
|
1578
|
+
];
|
|
1579
|
+
const schema = first
|
|
1580
|
+
? state.resolve(schemaAlias(first), true)
|
|
1581
|
+
: undefined;
|
|
1582
|
+
const results = [];
|
|
1583
|
+
const completed = [];
|
|
1584
|
+
const human = [];
|
|
1585
|
+
store = new IpfsStore(await storeConfiguration(value("store.gateway")));
|
|
1586
|
+
for (const configUrl of targets) {
|
|
1587
|
+
const context = swarmContext();
|
|
1588
|
+
try {
|
|
1589
|
+
if (parsed.path === "register list") {
|
|
1590
|
+
const items = await swarmRegistrations(context, configUrl);
|
|
1591
|
+
const alias = state
|
|
1592
|
+
.swarms()
|
|
1593
|
+
.find((swarm) => swarm.cid === configUrl)?.alias;
|
|
1594
|
+
results.push({ items });
|
|
1595
|
+
human.push(`Swarm: ${alias ? printable(alias) : "(no local alias)"}\nConfig URL: ${configUrl}\nAssociations: ${items.length}\n\n${table(["TYPE CID", "APP CID"], items.map((item) => [item.schemaCid, item.appCid]), "No associations registered in this Swarm.\nRegister an App: ipab register set TYPE_CID APP_CID --swarm URL_OR_ALIAS")}`);
|
|
1596
|
+
}
|
|
1597
|
+
else if (parsed.path === "register set") {
|
|
1598
|
+
const appCid = parseNameReference(second)
|
|
1599
|
+
? (await resolveReference(context, second, configUrl, (reference) => state.resolve(reference))).cid
|
|
1600
|
+
: state.resolve(second);
|
|
1601
|
+
const association = await setSwarmAssociation(context, configUrl, createAssociation(schema, appCid, parsed.template ?? ["%"]), Boolean(parsed.options.replace));
|
|
1602
|
+
results.push({ association });
|
|
1603
|
+
human.push(`${configUrl}: ${association.schemaCid} → ${association.appCid} ${JSON.stringify(association.argv)}`);
|
|
1604
|
+
}
|
|
1605
|
+
else {
|
|
1606
|
+
const removed = await removeSwarmAssociation(context, configUrl, schema);
|
|
1607
|
+
results.push({ removed: [removed] });
|
|
1608
|
+
human.push(`${configUrl}: removed association for ${removed}.`);
|
|
1609
|
+
}
|
|
1610
|
+
completed.push(configUrl);
|
|
1611
|
+
}
|
|
1612
|
+
catch (cause) {
|
|
1613
|
+
throw new HostError(parsed.path === "register list"
|
|
1614
|
+
? `Cannot list associations for Swarm ${configUrl}: ${message(cause)}`
|
|
1615
|
+
: `Registry operation failed for ${configUrl}: ${message(cause)}. Completed Swarms: ${completed.length ? completed.join(", ") : "(none)"}. Multiple Swarm edits are not atomic.`, cause instanceof HostError ? cause.exitCode : 1, cause instanceof HostError ? cause.code : "REGISTRY_FAILED", "publication");
|
|
1616
|
+
}
|
|
1617
|
+
finally {
|
|
1618
|
+
await context.finishRead?.();
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
emit({
|
|
1622
|
+
swarms: results.map((result, index) => ({
|
|
1623
|
+
configUrl: targets[index],
|
|
1624
|
+
...result,
|
|
1625
|
+
})),
|
|
1626
|
+
}, human.join("\n\n"));
|
|
1627
|
+
return 0;
|
|
1628
|
+
}
|
|
1170
1629
|
switch (parsed.path) {
|
|
1630
|
+
case "profile": {
|
|
1631
|
+
const context = swarmContext();
|
|
1632
|
+
readContext = context;
|
|
1633
|
+
const changes = {
|
|
1634
|
+
...(typeof parsed.options.name === "string"
|
|
1635
|
+
? { name: parsed.options.name }
|
|
1636
|
+
: {}),
|
|
1637
|
+
...(typeof parsed.options.description === "string"
|
|
1638
|
+
? { description: parsed.options.description }
|
|
1639
|
+
: {}),
|
|
1640
|
+
};
|
|
1641
|
+
if (!Object.keys(changes).length) {
|
|
1642
|
+
const profile = await accountProfile(context);
|
|
1643
|
+
emit({ profile, localPersisted: profile.updatedAt !== null }, `Name: ${printable(profile.name)}\nDescription: ${printable(profile.description)}\nPublic key: ${profile.publicKey}`);
|
|
1644
|
+
}
|
|
1645
|
+
else {
|
|
1646
|
+
const result = await updateAccountProfile(context, changes);
|
|
1647
|
+
emit(result, [
|
|
1648
|
+
`Name: ${printable(result.profile.name)}`,
|
|
1649
|
+
`Description: ${printable(result.profile.description)}`,
|
|
1650
|
+
"Personal profile saved locally.",
|
|
1651
|
+
...result.swarms.map((entry) => `${entry.configUrl}: ${entry.synchronized ? "synchronized" : `FAILED: ${entry.error}`}`),
|
|
1652
|
+
].join("\n"));
|
|
1653
|
+
if (result.swarms.some((entry) => !entry.synchronized)) {
|
|
1654
|
+
io.err("Profile saved locally, but some Swarms failed. Retry the profile update or normally activate each failed membership to synchronize it.");
|
|
1655
|
+
return 1;
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
break;
|
|
1659
|
+
}
|
|
1171
1660
|
case "swarm list": {
|
|
1172
1661
|
const result = { swarms: state.swarms(), ...selection() };
|
|
1173
1662
|
emit({
|
|
@@ -1209,6 +1698,8 @@ async function performCli(argv, io, env) {
|
|
|
1209
1698
|
case "swarm add":
|
|
1210
1699
|
case "swarm update":
|
|
1211
1700
|
case "search":
|
|
1701
|
+
case "skills list":
|
|
1702
|
+
case "skills sync":
|
|
1212
1703
|
case "swarm create":
|
|
1213
1704
|
case "swarm request":
|
|
1214
1705
|
case "swarm approve":
|
|
@@ -1216,24 +1707,67 @@ async function performCli(argv, io, env) {
|
|
|
1216
1707
|
case "swarm exclude":
|
|
1217
1708
|
case "swarm resume":
|
|
1218
1709
|
case "swarm profile":
|
|
1710
|
+
case "swarm members":
|
|
1219
1711
|
case "swarm status":
|
|
1220
1712
|
case "publish":
|
|
1713
|
+
case "pin":
|
|
1221
1714
|
case "get": {
|
|
1222
1715
|
store = new IpfsStore(await storeConfiguration(value("store.gateway")));
|
|
1223
1716
|
const context = swarmContext();
|
|
1717
|
+
readContext = context;
|
|
1718
|
+
if (parsed.path.startsWith("skills ")) {
|
|
1719
|
+
const result = await manageSkills(context, requireSwarm(), {
|
|
1720
|
+
sync: parsed.path === "skills sync",
|
|
1721
|
+
names: parsed.positional,
|
|
1722
|
+
agents: parsed.agents ?? [],
|
|
1723
|
+
dryRun: Boolean(parsed.options["dry-run"]),
|
|
1724
|
+
yes: Boolean(parsed.options.yes),
|
|
1725
|
+
tty: io.tty,
|
|
1726
|
+
confirm: (text) => io.confirm(text),
|
|
1727
|
+
preview: (text) => {
|
|
1728
|
+
io.err(text);
|
|
1729
|
+
},
|
|
1730
|
+
});
|
|
1731
|
+
store = context.store;
|
|
1732
|
+
emit(result, [
|
|
1733
|
+
table(["NAME", "PAYLOAD CID", "INSTALL NAME", "STATUS"], result.items.map((skill) => [
|
|
1734
|
+
skill.name,
|
|
1735
|
+
skill.cid,
|
|
1736
|
+
skill.identity,
|
|
1737
|
+
skill.status,
|
|
1738
|
+
]), "No Skills."),
|
|
1739
|
+
...result.items.flatMap((skill) => skill.problems),
|
|
1740
|
+
...result.orphaned.map((skill) => `Source removed: ${skill.name} ${skill.cid} (${skill.path}); installation retained.`),
|
|
1741
|
+
...result.results.map((entry) => `${entry.name} / ${entry.agent}: ${entry.status}${entry.error ? `: ${entry.error}` : ""}`),
|
|
1742
|
+
].join("\n"));
|
|
1743
|
+
if (!result.ok)
|
|
1744
|
+
return 1;
|
|
1745
|
+
break;
|
|
1746
|
+
}
|
|
1747
|
+
if (parsed.path === "pin") {
|
|
1748
|
+
io.err("Fetching, verifying and retaining content...");
|
|
1749
|
+
const result = await pinNameSubscription(context, first, selectedSwarm);
|
|
1750
|
+
store = context.store;
|
|
1751
|
+
emit(result, `${result.reference} → ${result.cid}\nStatus: ${result.freshness}`);
|
|
1752
|
+
break;
|
|
1753
|
+
}
|
|
1754
|
+
if (parsed.path === "swarm members") {
|
|
1755
|
+
const result = await swarmMembers(context, requireSwarm());
|
|
1756
|
+
emit(result, table(["NAME", "DESCRIPTION", "ROLE", "PUBLIC KEY"], result.members.map((member) => [
|
|
1757
|
+
member.name,
|
|
1758
|
+
member.description,
|
|
1759
|
+
member.role,
|
|
1760
|
+
member.publicKey,
|
|
1761
|
+
]), "No members."));
|
|
1762
|
+
break;
|
|
1763
|
+
}
|
|
1224
1764
|
if (parsed.path === "swarm export") {
|
|
1225
|
-
const id = await exportRequest(context,
|
|
1765
|
+
const id = await exportRequest(context, requireSwarm(), String(parsed.options.output ?? ""));
|
|
1226
1766
|
emit({ id }, id);
|
|
1227
1767
|
break;
|
|
1228
1768
|
}
|
|
1229
1769
|
if (["swarm exclude", "swarm resume", "swarm profile"].includes(parsed.path)) {
|
|
1230
|
-
const url =
|
|
1231
|
-
? selectedSwarm
|
|
1232
|
-
: first
|
|
1233
|
-
? state.resolveSwarm(first)
|
|
1234
|
-
: selectedSwarm;
|
|
1235
|
-
if (!url)
|
|
1236
|
-
syntax("Select a Swarm configuration URL or alias.");
|
|
1770
|
+
const url = requireSwarm();
|
|
1237
1771
|
if (parsed.path === "swarm exclude") {
|
|
1238
1772
|
if (!parsed.options.yes)
|
|
1239
1773
|
syntax("Member removal is irreversible; --yes required.");
|
|
@@ -1243,9 +1777,6 @@ async function performCli(argv, io, env) {
|
|
|
1243
1777
|
await resumeRemoval(context, url);
|
|
1244
1778
|
else {
|
|
1245
1779
|
const profile = await updateProfile(context, url, {
|
|
1246
|
-
...(typeof parsed.options.name === "string"
|
|
1247
|
-
? { name: parsed.options.name }
|
|
1248
|
-
: {}),
|
|
1249
1780
|
...(typeof parsed.options.address === "string"
|
|
1250
1781
|
? { addresses: [parsed.options.address] }
|
|
1251
1782
|
: {}),
|
|
@@ -1259,9 +1790,7 @@ async function performCli(argv, io, env) {
|
|
|
1259
1790
|
break;
|
|
1260
1791
|
}
|
|
1261
1792
|
if (parsed.path === "swarm update") {
|
|
1262
|
-
const cid =
|
|
1263
|
-
if (!cid)
|
|
1264
|
-
syntax("swarm update requires a registered alias, configuration URL or current swarm.");
|
|
1793
|
+
const cid = requireSwarm();
|
|
1265
1794
|
const result = await updateSwarm(context, cid, {
|
|
1266
1795
|
...(typeof parsed.options.name === "string"
|
|
1267
1796
|
? { name: parsed.options.name }
|
|
@@ -1288,28 +1817,22 @@ async function performCli(argv, io, env) {
|
|
|
1288
1817
|
break;
|
|
1289
1818
|
}
|
|
1290
1819
|
if (parsed.path === "search") {
|
|
1291
|
-
const source = items.find((item) => item.key === "swarm.default").source;
|
|
1292
|
-
const limited = parsed.options.current || source === "flag";
|
|
1293
|
-
if (limited && !selectedSwarm)
|
|
1294
|
-
syntax("Search of the current swarm requires --swarm or swarm.default.");
|
|
1295
1820
|
const registrations = state.swarms();
|
|
1296
|
-
const scope =
|
|
1297
|
-
?
|
|
1821
|
+
const scope = parsed.options.all
|
|
1822
|
+
? registrations
|
|
1823
|
+
: [
|
|
1298
1824
|
{
|
|
1299
|
-
cid:
|
|
1825
|
+
cid: requireSwarm(),
|
|
1300
1826
|
alias: registrations.find((entry) => entry.cid === selectedSwarm)
|
|
1301
1827
|
?.alias ?? null,
|
|
1302
1828
|
},
|
|
1303
|
-
]
|
|
1304
|
-
: registrations;
|
|
1829
|
+
];
|
|
1305
1830
|
const result = await searchNames(context, first, scope);
|
|
1306
1831
|
emit(result, formatSearchResults(result.matches));
|
|
1307
1832
|
break;
|
|
1308
1833
|
}
|
|
1309
1834
|
if (parsed.path === "swarm status") {
|
|
1310
|
-
const cid =
|
|
1311
|
-
if (!cid)
|
|
1312
|
-
syntax("swarm status requires a configuration URL or swarm.default.");
|
|
1835
|
+
const cid = requireSwarm();
|
|
1313
1836
|
const local = Boolean(parsed.options.local);
|
|
1314
1837
|
const { head, config } = local
|
|
1315
1838
|
? await swarmHeader(context, cid, true)
|
|
@@ -1362,7 +1885,6 @@ async function performCli(argv, io, env) {
|
|
|
1362
1885
|
break;
|
|
1363
1886
|
}
|
|
1364
1887
|
if (parsed.path === "get") {
|
|
1365
|
-
readContext = context;
|
|
1366
1888
|
const localCid = /^(ipab|name):/i.test(first)
|
|
1367
1889
|
? undefined
|
|
1368
1890
|
: state.resolve(first);
|
|
@@ -1391,6 +1913,12 @@ async function performCli(argv, io, env) {
|
|
|
1391
1913
|
finally {
|
|
1392
1914
|
await source.close();
|
|
1393
1915
|
}
|
|
1916
|
+
try {
|
|
1917
|
+
await context.finishRead?.();
|
|
1918
|
+
}
|
|
1919
|
+
finally {
|
|
1920
|
+
readContext = undefined;
|
|
1921
|
+
}
|
|
1394
1922
|
const closing = store;
|
|
1395
1923
|
store = undefined;
|
|
1396
1924
|
await closeStore(closing, undefined);
|
|
@@ -1400,6 +1928,7 @@ async function performCli(argv, io, env) {
|
|
|
1400
1928
|
break;
|
|
1401
1929
|
}
|
|
1402
1930
|
let cid;
|
|
1931
|
+
let contentCid;
|
|
1403
1932
|
if (parsed.path === "swarm create") {
|
|
1404
1933
|
cid = await createSwarm(context, {
|
|
1405
1934
|
...(typeof parsed.options.service === "string"
|
|
@@ -1417,12 +1946,8 @@ async function performCli(argv, io, env) {
|
|
|
1417
1946
|
: {}),
|
|
1418
1947
|
});
|
|
1419
1948
|
}
|
|
1420
|
-
else if (parsed.path === "swarm request")
|
|
1421
|
-
|
|
1422
|
-
ownerFingerprint: String(parsed.options["owner-fingerprint"] ?? ""),
|
|
1423
|
-
...(typeof parsed.options.name === "string"
|
|
1424
|
-
? { name: parsed.options.name }
|
|
1425
|
-
: {}),
|
|
1949
|
+
else if (parsed.path === "swarm request") {
|
|
1950
|
+
const result = await requestMembership(context, first, {
|
|
1426
1951
|
...(typeof parsed.options.alias === "string"
|
|
1427
1952
|
? { alias: parsed.options.alias }
|
|
1428
1953
|
: {}),
|
|
@@ -1430,8 +1955,30 @@ async function performCli(argv, io, env) {
|
|
|
1430
1955
|
? { output: parsed.options.output }
|
|
1431
1956
|
: {}),
|
|
1432
1957
|
});
|
|
1958
|
+
store = context.store;
|
|
1959
|
+
io.err(`Owner fingerprint: ${result.ownerFingerprint}\nVerify this fingerprint through an independent trusted channel before manually sending the Request file to the Owner.`);
|
|
1960
|
+
if (result.file === undefined)
|
|
1961
|
+
io.out(JSON.stringify(result.request, null, 2));
|
|
1962
|
+
else {
|
|
1963
|
+
io.err(`Request saved to: ${result.file}`);
|
|
1964
|
+
if (parsed.flags.json)
|
|
1965
|
+
emit({
|
|
1966
|
+
file: result.file,
|
|
1967
|
+
requestId: result.requestId,
|
|
1968
|
+
ownerFingerprint: result.ownerFingerprint,
|
|
1969
|
+
}, "");
|
|
1970
|
+
}
|
|
1971
|
+
break;
|
|
1972
|
+
}
|
|
1433
1973
|
else if (parsed.path === "swarm approve") {
|
|
1434
|
-
const
|
|
1974
|
+
const selected = requireSwarm();
|
|
1975
|
+
if (first === "-" && !parsed.options.yes)
|
|
1976
|
+
syntax("Reading a Request from stdin requires explicit --yes; no interactive confirmation is available.");
|
|
1977
|
+
const request = first === "-"
|
|
1978
|
+
? await verifiedRequestStream((io.requestInput ?? processIO.requestInput)())
|
|
1979
|
+
: await verifiedRequest(first);
|
|
1980
|
+
if (request.configUrl !== selected)
|
|
1981
|
+
syntax(`Request belongs to ${request.configUrl}, not the selected Swarm. Use ipab --swarm ${request.configUrl} swarm approve REQUEST_FILE --yes.`);
|
|
1435
1982
|
io.err(await membershipRequestSummary(request));
|
|
1436
1983
|
if (!parsed.options.yes &&
|
|
1437
1984
|
(!io.tty ||
|
|
@@ -1442,16 +1989,11 @@ async function performCli(argv, io, env) {
|
|
|
1442
1989
|
});
|
|
1443
1990
|
}
|
|
1444
1991
|
else {
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
content = (await importBundle(first, () => Promise.resolve(store))).cid;
|
|
1448
|
-
else
|
|
1449
|
-
content = exactCid(first);
|
|
1992
|
+
const content = await publicationSource(second, store);
|
|
1993
|
+
contentCid = content;
|
|
1450
1994
|
cid = await publish(context, content, {
|
|
1451
1995
|
...(selectedSwarm ? { swarm: selectedSwarm } : {}),
|
|
1452
|
-
|
|
1453
|
-
? { name: parsed.options.name }
|
|
1454
|
-
: {}),
|
|
1996
|
+
name: first,
|
|
1455
1997
|
...(typeof parsed.options.expect === "string"
|
|
1456
1998
|
? { expect: parsed.options.expect }
|
|
1457
1999
|
: {}),
|
|
@@ -1461,11 +2003,11 @@ async function performCli(argv, io, env) {
|
|
|
1461
2003
|
store = context.store;
|
|
1462
2004
|
if (parsed.path === "swarm create")
|
|
1463
2005
|
io.err(`Registered swarm ${state.registeredSwarm(cid).alias ?? cid}. Saved current: ${state.config({ includeSecrets: false })["swarm.default"] ?? "(none)"}.`);
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
2006
|
+
if (contentCid)
|
|
2007
|
+
io.err(`Locally protected payload: ${contentCid}. Use ipab unpin ${contentCid} to release this CID pin only; Name subscriptions and publication/history owners remain. --snapshot links payloads directly into retained publication history, so unpin cannot release that protection.`);
|
|
2008
|
+
emit(parsed.path === "swarm create" || parsed.path === "swarm approve"
|
|
2009
|
+
? { configUrl: cid }
|
|
2010
|
+
: { cid, ...(contentCid ? { contentCid } : {}) }, cid);
|
|
1469
2011
|
break;
|
|
1470
2012
|
}
|
|
1471
2013
|
case "store usage":
|
|
@@ -1481,7 +2023,7 @@ async function performCli(argv, io, env) {
|
|
|
1481
2023
|
}
|
|
1482
2024
|
break;
|
|
1483
2025
|
}
|
|
1484
|
-
case "
|
|
2026
|
+
case "templates render":
|
|
1485
2027
|
case "build":
|
|
1486
2028
|
case "bundle build":
|
|
1487
2029
|
case "bundle inspect":
|
|
@@ -1517,34 +2059,73 @@ async function performCli(argv, io, env) {
|
|
|
1517
2059
|
const builtin = builtins.blocks.get(cid.toV1().toString());
|
|
1518
2060
|
if (builtin)
|
|
1519
2061
|
return builtin.slice();
|
|
1520
|
-
return (await getStore()).block.get(cid.toString(), options);
|
|
2062
|
+
return (store ?? (await getStore())).block.get(cid.toString(), options);
|
|
1521
2063
|
},
|
|
1522
2064
|
};
|
|
1523
2065
|
const builtinSource = first ? state.pin(first) : undefined;
|
|
1524
2066
|
const source = builtinSource?.builtin && builtinSource.metadata?.kind === "bundle"
|
|
1525
2067
|
? builtinSource.cid
|
|
1526
2068
|
: first;
|
|
2069
|
+
let selectedTemplate;
|
|
2070
|
+
if (parsed.path === "templates render") {
|
|
2071
|
+
const selector = first;
|
|
2072
|
+
selectedTemplate = selector;
|
|
2073
|
+
if (parseNameReference(selector)) {
|
|
2074
|
+
await getStore();
|
|
2075
|
+
const context = swarmContext();
|
|
2076
|
+
readContext = context;
|
|
2077
|
+
selectedTemplate = (await resolveReference(context, selector, selectedSwarm, (reference) => state.resolve(reference), false, "local-first")).cid;
|
|
2078
|
+
store = context.store;
|
|
2079
|
+
}
|
|
2080
|
+
else {
|
|
2081
|
+
let explicit = false;
|
|
2082
|
+
try {
|
|
2083
|
+
CID.parse(selector);
|
|
2084
|
+
explicit = true;
|
|
2085
|
+
}
|
|
2086
|
+
catch {
|
|
2087
|
+
/* Not a CID. */
|
|
2088
|
+
}
|
|
2089
|
+
explicit ||= selector.toLowerCase().endsWith(".car");
|
|
2090
|
+
if (!explicit) {
|
|
2091
|
+
try {
|
|
2092
|
+
await lstat(selector);
|
|
2093
|
+
explicit = true;
|
|
2094
|
+
}
|
|
2095
|
+
catch (cause) {
|
|
2096
|
+
if (!nodeError(cause, "ENOENT") &&
|
|
2097
|
+
!nodeError(cause, "ENOTDIR"))
|
|
2098
|
+
throw cause;
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
if (!explicit) {
|
|
2102
|
+
templateName(selector);
|
|
2103
|
+
if (!selectedSwarm)
|
|
2104
|
+
throw new HostError("Template selectors require a selected Swarm. Use --swarm or swarm use, or supply an explicit Bundle directory, CAR, exact CID or IPAB URI.");
|
|
2105
|
+
await getStore();
|
|
2106
|
+
const context = swarmContext();
|
|
2107
|
+
readContext = context;
|
|
2108
|
+
selectedTemplate = await resolveTemplateSelector(context, selector, selectedSwarm);
|
|
2109
|
+
store = context.store;
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
1527
2113
|
if (parsed.path === "bundle build" || parsed.path === "build")
|
|
1528
2114
|
io.err(parsed.path === "build"
|
|
1529
2115
|
? "Assembling and validating Bundle (no compilation)..."
|
|
1530
2116
|
: "Validating and building bundle...");
|
|
1531
2117
|
if (parsed.path === "bundle import")
|
|
1532
2118
|
io.err("Validating and importing CAR into Store...");
|
|
1533
|
-
const result = parsed.path === "
|
|
1534
|
-
? await initApp(
|
|
2119
|
+
const result = parsed.path === "templates render"
|
|
2120
|
+
? await initApp(second, parsed.positional[2], {
|
|
1535
2121
|
...request,
|
|
1536
|
-
...(
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
}
|
|
1544
|
-
: {}),
|
|
1545
|
-
...(parsed.parameters
|
|
1546
|
-
? { parameters: parsed.parameters }
|
|
1547
|
-
: {}),
|
|
2122
|
+
...(selectedTemplate ? { template: selectedTemplate } : {}),
|
|
2123
|
+
parameters: [
|
|
2124
|
+
...(parsed.parameters ?? []),
|
|
2125
|
+
...(typeof parsed.options.description === "string"
|
|
2126
|
+
? [`description=${parsed.options.description}`]
|
|
2127
|
+
: []),
|
|
2128
|
+
],
|
|
1548
2129
|
})
|
|
1549
2130
|
: parsed.path === "build"
|
|
1550
2131
|
? await assembleBundle(first, {
|
|
@@ -1593,7 +2174,7 @@ async function performCli(argv, io, env) {
|
|
|
1593
2174
|
if (result.files.includes("package.json") &&
|
|
1594
2175
|
(result.files.includes("ipab.yaml") ||
|
|
1595
2176
|
result.files.includes("ipab.json")))
|
|
1596
|
-
io.err(`Next: install declared dependencies
|
|
2177
|
+
io.err(`Next: install declared dependencies in ${JSON.stringify(result.directory)}; if your template does not declare @ipab/cli, add or link it as a development dependency. Run pnpm build to prepare and package the App. Root ipab build does not compile.`);
|
|
1597
2178
|
else if (result.files.includes(".bundle.yaml"))
|
|
1598
2179
|
io.err(`Next: ipab bundle build ${JSON.stringify(result.directory)}`);
|
|
1599
2180
|
}
|
|
@@ -1612,80 +2193,62 @@ async function performCli(argv, io, env) {
|
|
|
1612
2193
|
break;
|
|
1613
2194
|
}
|
|
1614
2195
|
case "pin list": {
|
|
1615
|
-
const
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
.map((
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
emit({ items: listed, pending, invalid }, table(["NAME", "CID", "KIND", "TITLE", "TYPE CID", "SOURCE"], listed.map((pin) => [
|
|
1639
|
-
pin.name,
|
|
1640
|
-
pin.cid,
|
|
1641
|
-
pin.kind,
|
|
1642
|
-
pin.title,
|
|
1643
|
-
pin.schemaCid,
|
|
1644
|
-
pin.builtin ? "built-in (read-only)" : "user",
|
|
1645
|
-
]), "No named pins."));
|
|
1646
|
-
break;
|
|
1647
|
-
}
|
|
1648
|
-
case "pin add": {
|
|
1649
|
-
io.err("Fetching, verifying and retaining content in Store...");
|
|
1650
|
-
const result = await addPin(state, first, second, await storeConfiguration(value("store.gateway")));
|
|
1651
|
-
emit(result, `${result.name} → ${result.cid}\nTitle: ${printable(result.title)}\nType CID: ${result.schemaCid}`);
|
|
2196
|
+
const listed = state.contentPins();
|
|
2197
|
+
const archived = state.archivedPins();
|
|
2198
|
+
const builtins = state.pins().map(pinDetails);
|
|
2199
|
+
emit({ items: listed, builtins, archived }, table(["REFERENCE", "CID", "STATUS", "SOURCE"], [
|
|
2200
|
+
...listed.map((pin) => [
|
|
2201
|
+
pin.reference,
|
|
2202
|
+
pin.cid ?? "(none)",
|
|
2203
|
+
`${pin.status}/${pin.freshness}${pin.error ? `: ${pin.error}` : ""}`,
|
|
2204
|
+
pin.swarm ? "following shared Name" : "fixed CID",
|
|
2205
|
+
]),
|
|
2206
|
+
...builtins.map((pin) => [
|
|
2207
|
+
pin.name,
|
|
2208
|
+
pin.cid,
|
|
2209
|
+
"read-only",
|
|
2210
|
+
"built-in",
|
|
2211
|
+
]),
|
|
2212
|
+
...archived.map((pin) => [
|
|
2213
|
+
pin.cid,
|
|
2214
|
+
pin.cid,
|
|
2215
|
+
pin.status,
|
|
2216
|
+
`inactive archive (${pin.name}); unpin exact CID`,
|
|
2217
|
+
]),
|
|
2218
|
+
], "No pins."));
|
|
1652
2219
|
break;
|
|
1653
2220
|
}
|
|
1654
|
-
case "
|
|
1655
|
-
const
|
|
1656
|
-
|
|
2221
|
+
case "unpin": {
|
|
2222
|
+
const canonical = pinReference(state, first, selectedSwarm);
|
|
2223
|
+
const result = await unpin(state, canonical.reference);
|
|
2224
|
+
emit(result, `Unpinned ${canonical.reference}; released only its saved retention responsibility. No blocks deleted or GC requested.`);
|
|
1657
2225
|
break;
|
|
1658
2226
|
}
|
|
1659
2227
|
case "pin show": {
|
|
1660
|
-
const
|
|
1661
|
-
|
|
2228
|
+
const builtin = first.startsWith("builtin:")
|
|
2229
|
+
? state.pin(first)
|
|
2230
|
+
: undefined;
|
|
2231
|
+
const canonical = builtin
|
|
2232
|
+
? undefined
|
|
2233
|
+
: pinReference(state, first, selectedSwarm);
|
|
2234
|
+
const pin = canonical
|
|
2235
|
+
? state.contentPin(canonical.reference)
|
|
2236
|
+
: undefined;
|
|
2237
|
+
const archived = canonical
|
|
2238
|
+
? state
|
|
2239
|
+
.archivedPins()
|
|
2240
|
+
.filter((pin) => pin.cid === canonical.reference)
|
|
2241
|
+
: [];
|
|
2242
|
+
if (!pin && !builtin && !archived.length)
|
|
1662
2243
|
throw new HostError(`Pin "${first}" does not exist. Run ipab pin list.`);
|
|
1663
|
-
const result =
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
}
|
|
1672
|
-
case "register list": {
|
|
1673
|
-
const associations = state.registrations();
|
|
1674
|
-
emit({ items: associations }, table(["SCHEMA CID", "APP CID", "ARGV"], associations.map((association) => [
|
|
1675
|
-
association.schemaCid,
|
|
1676
|
-
association.appCid,
|
|
1677
|
-
JSON.stringify(association.argv),
|
|
1678
|
-
]), "No associations."));
|
|
1679
|
-
break;
|
|
1680
|
-
}
|
|
1681
|
-
case "register set": {
|
|
1682
|
-
const association = state.setAssociation(schemaAlias(first), second, parsed.template ?? ["%"], Boolean(parsed.options.replace));
|
|
1683
|
-
emit(association, `${association.schemaCid} → ${association.appCid} ${JSON.stringify(association.argv)}`);
|
|
1684
|
-
break;
|
|
1685
|
-
}
|
|
1686
|
-
case "register remove": {
|
|
1687
|
-
const removed = state.removeAssociation(schemaAlias(first));
|
|
1688
|
-
emit({ removed: [removed] }, `Removed association for ${removed}.`);
|
|
2244
|
+
const result = builtin
|
|
2245
|
+
? pinDetails(builtin)
|
|
2246
|
+
: {
|
|
2247
|
+
pin: pin ?? null,
|
|
2248
|
+
roots: pin ? state.hold(pin.owner)?.roots : [],
|
|
2249
|
+
archived,
|
|
2250
|
+
};
|
|
2251
|
+
emit(result, JSON.stringify(result, null, 2));
|
|
1689
2252
|
break;
|
|
1690
2253
|
}
|
|
1691
2254
|
case "config get": {
|
|
@@ -1775,12 +2338,19 @@ async function performCli(argv, io, env) {
|
|
|
1775
2338
|
}
|
|
1776
2339
|
case "exec":
|
|
1777
2340
|
case "open": {
|
|
2341
|
+
const named = parsed.path === "open" ? parseNameReference(first) : undefined;
|
|
2342
|
+
const registrySwarm = named?.swarm
|
|
2343
|
+
? state.resolveSwarm(named.swarm)
|
|
2344
|
+
: selectedSwarm;
|
|
2345
|
+
if (parsed.path === "open" && !registrySwarm)
|
|
2346
|
+
throw new HostError("Open requires a selected Swarm. Use ipab://URL_OR_ALIAS/PATH, pass --swarm URL_OR_ALIAS, or save a default with ipab swarm use URL_OR_ALIAS. To select an App directly, use ipab exec.");
|
|
1778
2347
|
if (parsed.options.log && !value("history.enabled"))
|
|
1779
2348
|
throw new HostError("Execution logging requires history.enabled=true.");
|
|
1780
2349
|
await recoverInactive(state);
|
|
1781
2350
|
store = new IpfsStore(await storeConfiguration(value("store.gateway")));
|
|
1782
2351
|
const context = swarmContext();
|
|
1783
|
-
|
|
2352
|
+
readContext = context;
|
|
2353
|
+
const target = (await resolveReference(context, first, selectedSwarm, (reference) => state.resolve(reference), Boolean(parsed.options.raw), "local-first")).cid;
|
|
1784
2354
|
store = context.store;
|
|
1785
2355
|
const resolveBundleReference = async (reference, signal, preferredSwarm) => {
|
|
1786
2356
|
signal.throwIfAborted();
|
|
@@ -1795,7 +2365,7 @@ async function performCli(argv, io, env) {
|
|
|
1795
2365
|
: preferredSwarm
|
|
1796
2366
|
? state.resolveSwarm(preferredSwarm)
|
|
1797
2367
|
: selectedSwarm;
|
|
1798
|
-
const resolve = (source) => resolveReference(lookup, reference, source, (input) => state.resolve(input));
|
|
2368
|
+
const resolve = (source) => resolveReference(lookup, reference, source, (input) => state.resolve(input), false, "local-first");
|
|
1799
2369
|
let resolved;
|
|
1800
2370
|
try {
|
|
1801
2371
|
resolved = await resolve(named ? swarm : undefined);
|
|
@@ -1816,7 +2386,12 @@ async function performCli(argv, io, env) {
|
|
|
1816
2386
|
return { ...resolved, ...(swarm ? { swarm } : {}) };
|
|
1817
2387
|
}
|
|
1818
2388
|
finally {
|
|
1819
|
-
|
|
2389
|
+
try {
|
|
2390
|
+
await lookup.finishRead?.();
|
|
2391
|
+
}
|
|
2392
|
+
finally {
|
|
2393
|
+
await lookup.store.close();
|
|
2394
|
+
}
|
|
1820
2395
|
}
|
|
1821
2396
|
};
|
|
1822
2397
|
let appCid;
|
|
@@ -1827,11 +2402,30 @@ async function performCli(argv, io, env) {
|
|
|
1827
2402
|
try {
|
|
1828
2403
|
const content = await validatedBundle(root, store, owner);
|
|
1829
2404
|
const schema = content.schemaKey;
|
|
1830
|
-
|
|
2405
|
+
let association;
|
|
2406
|
+
if (registrySwarm) {
|
|
2407
|
+
const lookup = {
|
|
2408
|
+
...swarmContext(),
|
|
2409
|
+
store: new IpfsStore(await storeConfiguration(value("store.gateway"))),
|
|
2410
|
+
};
|
|
2411
|
+
try {
|
|
2412
|
+
association = await swarmAssociation(lookup, registrySwarm, schema, "local-first");
|
|
2413
|
+
}
|
|
2414
|
+
finally {
|
|
2415
|
+
try {
|
|
2416
|
+
await lookup.finishRead?.();
|
|
2417
|
+
}
|
|
2418
|
+
finally {
|
|
2419
|
+
await lookup.store.close();
|
|
2420
|
+
}
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
1831
2423
|
if (!association)
|
|
1832
|
-
throw new HostError(`No App registered for Schema ${schema}. Use ipab register set or ipab exec.`);
|
|
2424
|
+
throw new HostError(`No App registered for Schema ${schema} in Swarm ${registrySwarm}. Use ipab register set ${schema} APP_CID --swarm ${registrySwarm} or ipab exec.`);
|
|
1833
2425
|
appCid = association.appCid;
|
|
1834
|
-
|
|
2426
|
+
if (association.argv.length !== 1 || association.argv[0] !== "%")
|
|
2427
|
+
throw new HostError("Custom per-association argv is unsupported; adapt the App to accept only the content CID or use ipab exec APP_CID ARGS.");
|
|
2428
|
+
appArgv = [root];
|
|
1835
2429
|
// execute owns the App/input context before this validation owner's eventual release.
|
|
1836
2430
|
const result = await execute(state, store, { origin: "open", appCid, argv: appArgv }, {
|
|
1837
2431
|
inputSchema: schema,
|
|
@@ -1876,8 +2470,12 @@ async function performCli(argv, io, env) {
|
|
|
1876
2470
|
}
|
|
1877
2471
|
finally {
|
|
1878
2472
|
try {
|
|
1879
|
-
|
|
1880
|
-
|
|
2473
|
+
try {
|
|
2474
|
+
await readContext?.finishRead?.();
|
|
2475
|
+
}
|
|
2476
|
+
finally {
|
|
2477
|
+
await closeStore(store, appExitCode);
|
|
2478
|
+
}
|
|
1881
2479
|
}
|
|
1882
2480
|
finally {
|
|
1883
2481
|
state?.close();
|