@ipab/cli 0.1.0-rc.2 → 0.1.0-rc.4
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 +40 -13
- package/dist/app-authoring.d.ts.map +1 -1
- package/dist/app-authoring.js +11 -2
- package/dist/app-authoring.js.map +1 -1
- package/dist/app-definition.d.ts +52 -57
- package/dist/app-definition.d.ts.map +1 -1
- package/dist/app-definition.js +33 -38
- package/dist/app-definition.js.map +1 -1
- package/dist/app-templates.d.ts.map +1 -1
- package/dist/app-templates.js +2 -1
- package/dist/app-templates.js.map +1 -1
- package/dist/assembly.d.ts.map +1 -1
- package/dist/assembly.js +3 -4
- package/dist/assembly.js.map +1 -1
- package/dist/authoring.d.ts +3 -7
- package/dist/authoring.d.ts.map +1 -1
- package/dist/authoring.js +22 -12
- package/dist/authoring.js.map +1 -1
- package/dist/builtins/skill.ipab.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 +18 -2
- package/dist/builtins.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +367 -124
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +29 -16
- package/dist/config.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 +5 -2
- package/dist/content-provider.js.map +1 -1
- package/dist/get.d.ts.map +1 -1
- package/dist/get.js +34 -15
- package/dist/get.js.map +1 -1
- package/dist/identity.d.ts +5 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +5 -0
- package/dist/identity.js.map +1 -1
- package/dist/kubo.d.ts +40 -0
- package/dist/kubo.d.ts.map +1 -0
- package/dist/kubo.js +555 -0
- package/dist/kubo.js.map +1 -0
- package/dist/pins.d.ts +3 -3
- package/dist/pins.js +1 -1
- package/dist/pins.js.map +1 -1
- package/dist/setup.d.ts +7 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +22 -0
- package/dist/setup.js.map +1 -0
- package/dist/source-bundle.d.ts +3 -8
- package/dist/source-bundle.d.ts.map +1 -1
- package/dist/source-bundle.js +16 -11
- package/dist/source-bundle.js.map +1 -1
- package/dist/space.d.ts.map +1 -1
- package/dist/space.js +2 -2
- package/dist/space.js.map +1 -1
- package/dist/state.d.ts +7 -5
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +17 -14
- package/dist/state.js.map +1 -1
- package/dist/swarm-envelope.d.ts +36 -0
- package/dist/swarm-envelope.d.ts.map +1 -0
- package/dist/swarm-envelope.js +145 -0
- package/dist/swarm-envelope.js.map +1 -0
- package/dist/swarm-files.d.ts +6 -0
- package/dist/swarm-files.d.ts.map +1 -0
- package/dist/swarm-files.js +107 -0
- package/dist/swarm-files.js.map +1 -0
- package/dist/swarm.d.ts +120 -58
- package/dist/swarm.d.ts.map +1 -1
- package/dist/swarm.js +1065 -548
- package/dist/swarm.js.map +1 -1
- package/dist/template-definition.d.ts +47 -52
- package/dist/template-definition.d.ts.map +1 -1
- package/dist/template-definition.js +36 -41
- package/dist/template-definition.js.map +1 -1
- package/dist/template-source.d.ts +2 -0
- package/dist/template-source.d.ts.map +1 -1
- package/dist/template-source.js +4 -3
- package/dist/template-source.js.map +1 -1
- package/package.json +3 -3
- package/src/app-authoring.ts +22 -5
- package/src/app-definition.ts +33 -39
- package/src/app-templates.ts +9 -1
- package/src/assembly.ts +7 -4
- package/src/authoring.ts +31 -14
- package/src/builtins.ts +23 -2
- package/src/cli.ts +427 -147
- package/src/config.ts +32 -19
- package/src/content-provider.ts +5 -4
- package/src/get.ts +37 -15
- package/src/identity.ts +13 -0
- package/src/kubo.ts +732 -0
- package/src/pins.ts +1 -1
- package/src/setup.ts +21 -0
- package/src/source-bundle.ts +25 -12
- package/src/space.ts +2 -5
- package/src/state.ts +24 -15
- package/src/swarm-envelope.ts +255 -0
- package/src/swarm-files.ts +116 -0
- package/src/swarm.ts +1728 -836
- package/src/template-definition.ts +36 -41
- package/src/template-source.ts +10 -3
package/src/cli.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { createInterface } from "node:readline/promises";
|
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
import { IpfsStore } from "@ipab/ipfs-store";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
|
-
import
|
|
5
|
+
import { CID } from "multiformats/cid";
|
|
6
6
|
import stringWidth from "string-width";
|
|
7
7
|
import {
|
|
8
8
|
configKey,
|
|
@@ -30,13 +30,20 @@ import { buildBundle, inspectBundle, importBundle } from "./authoring.js";
|
|
|
30
30
|
import { initApp } from "./app-authoring.js";
|
|
31
31
|
import { assembleBundle } from "./assembly.js";
|
|
32
32
|
import { getBundle } from "./get.js";
|
|
33
|
+
import { setupDevice } from "./setup.js";
|
|
34
|
+
import { keyId } from "@ipab/bundle/pointer/crypto";
|
|
33
35
|
import {
|
|
34
36
|
createSwarm,
|
|
35
37
|
requestMembership,
|
|
36
38
|
approveMembership,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
exportRequest,
|
|
40
|
+
removeMember,
|
|
41
|
+
resumeRemoval,
|
|
42
|
+
updateProfile,
|
|
43
|
+
verifiedRequest,
|
|
44
|
+
membershipRequestSummary,
|
|
39
45
|
swarmHeader,
|
|
46
|
+
sharedSwarmStatus,
|
|
40
47
|
addSwarm,
|
|
41
48
|
updateSwarm,
|
|
42
49
|
searchNames,
|
|
@@ -92,17 +99,24 @@ export const processIO: IO = {
|
|
|
92
99
|
},
|
|
93
100
|
};
|
|
94
101
|
const commands: Record<string, string> = {
|
|
102
|
+
setup: "setup [--yes]",
|
|
95
103
|
"swarm create": "swarm create [--service URL] [--resume OPERATION]",
|
|
96
|
-
"swarm request":
|
|
97
|
-
|
|
98
|
-
"swarm
|
|
99
|
-
"swarm
|
|
104
|
+
"swarm request":
|
|
105
|
+
"swarm request CONFIG_URL --owner-fingerprint FINGERPRINT [--output FILE] [--alias ALIAS]",
|
|
106
|
+
"swarm export": "swarm export URL_OR_ALIAS --output FILE",
|
|
107
|
+
"swarm approve": "swarm approve REQUEST_FILE [--again] --yes",
|
|
108
|
+
"swarm exclude":
|
|
109
|
+
"swarm exclude MEMBER_PUBLIC_KEY [--swarm URL_OR_ALIAS] --yes",
|
|
110
|
+
"swarm resume": "swarm resume [URL_OR_ALIAS]",
|
|
111
|
+
"swarm profile":
|
|
112
|
+
"swarm profile [URL_OR_ALIAS] [--name NAME] [--address MULTIADDR]",
|
|
113
|
+
"swarm status": "swarm status [URL_OR_ALIAS]",
|
|
100
114
|
"swarm list": "swarm list",
|
|
101
|
-
"swarm add": "swarm add
|
|
102
|
-
"swarm use": "swarm use
|
|
103
|
-
"swarm remove": "swarm remove
|
|
115
|
+
"swarm add": "swarm add CONFIG_URL [--alias ALIAS]",
|
|
116
|
+
"swarm use": "swarm use URL_OR_ALIAS",
|
|
117
|
+
"swarm remove": "swarm remove URL_OR_ALIAS",
|
|
104
118
|
"swarm update":
|
|
105
|
-
"swarm update [
|
|
119
|
+
"swarm update [URL_OR_ALIAS] [--name TEXT] [--description TEXT]",
|
|
106
120
|
publish:
|
|
107
121
|
"publish CID_OR_CAR [--name NAME [--expect OLD_NODE_CID | --snapshot]]",
|
|
108
122
|
get: "get REF [--raw] [--force | --no-force] [-o DIRECTORY]",
|
|
@@ -152,6 +166,18 @@ const commandHelp: Record<
|
|
|
152
166
|
notes?: string[];
|
|
153
167
|
}
|
|
154
168
|
> = {
|
|
169
|
+
setup: {
|
|
170
|
+
summary:
|
|
171
|
+
"Verify/install Kubo and prepare the protected HOME account identity",
|
|
172
|
+
examples: ["ipab setup --yes", "ipab setup"],
|
|
173
|
+
options: [
|
|
174
|
+
"--yes Confirm installation and identity initialization outside a TTY.",
|
|
175
|
+
],
|
|
176
|
+
notes: [
|
|
177
|
+
"Idempotent: reuse the same verified program and existing identity.",
|
|
178
|
+
"Does not create Swarm repos, start or contact any daemon, deploy services or install login startup.",
|
|
179
|
+
],
|
|
180
|
+
},
|
|
155
181
|
"swarm create": {
|
|
156
182
|
summary: "Create a swarm using the account HOME identity",
|
|
157
183
|
options: [
|
|
@@ -168,39 +194,71 @@ const commandHelp: Record<
|
|
|
168
194
|
],
|
|
169
195
|
notes: [
|
|
170
196
|
"Creation uses the protected, origin-bound API key and owner possession proof.",
|
|
171
|
-
"
|
|
172
|
-
"Returns
|
|
197
|
+
"Installs checksum-verified Kubo on demand; each Swarm has its own protected repo and ports.",
|
|
198
|
+
"Returns the public organization configuration URL; owner needs no certificate.",
|
|
173
199
|
],
|
|
174
200
|
},
|
|
175
201
|
"swarm request": {
|
|
176
|
-
summary: "
|
|
177
|
-
examples: [
|
|
202
|
+
summary: "Save and export a signed self-contained membership Request",
|
|
203
|
+
examples: [
|
|
204
|
+
"ipab swarm request CONFIG_URL --owner-fingerprint TRUSTED_FINGERPRINT --output request.json --alias work",
|
|
205
|
+
],
|
|
206
|
+
options: [
|
|
207
|
+
"--owner-fingerprint VALUE Verify Owner through a trusted independent channel.",
|
|
208
|
+
"--name NAME Initial public display name.",
|
|
209
|
+
"--alias ALIAS Pre-register the target for lazy onboarding.",
|
|
210
|
+
"--output FILE Export the saved exact Request; no expiry or new PeerID on retry.",
|
|
211
|
+
],
|
|
178
212
|
notes: [
|
|
179
|
-
"
|
|
213
|
+
"No Invite, Response file, password or Join. Next normal use fetches and decrypts the approved package.",
|
|
180
214
|
],
|
|
181
215
|
},
|
|
182
216
|
"swarm approve": {
|
|
183
217
|
summary: "Owner signs a certificate for an exact request",
|
|
184
218
|
options: [
|
|
185
219
|
"--yes Explicit approval; required outside a TTY.",
|
|
186
|
-
"--
|
|
220
|
+
"--again Explicit fresh approval of an old Request; history is advisory.",
|
|
221
|
+
],
|
|
222
|
+
examples: ["ipab swarm approve request.json --yes"],
|
|
223
|
+
notes: [
|
|
224
|
+
"Creates a public profile and publishes an Owner-signed X25519/AES-GCM package. Exact-ID certificates have no expiry.",
|
|
187
225
|
],
|
|
188
|
-
examples: ["ipab swarm approve REQUEST_CID --yes"],
|
|
189
|
-
notes: ["Returns one response CID. Never exports the owner private key."],
|
|
190
226
|
},
|
|
191
|
-
"swarm
|
|
192
|
-
summary: "
|
|
193
|
-
examples: ["ipab swarm
|
|
194
|
-
|
|
227
|
+
"swarm export": {
|
|
228
|
+
summary: "Re-export the same persisted Request",
|
|
229
|
+
examples: ["ipab swarm export work --output request.json"],
|
|
230
|
+
},
|
|
231
|
+
"swarm exclude": {
|
|
232
|
+
summary: "Owner removes a member with irreversible HEAD/key rotation",
|
|
233
|
+
examples: ["ipab --swarm work swarm exclude MEMBER_PUBLIC_KEY --yes"],
|
|
195
234
|
notes: [
|
|
196
|
-
"
|
|
235
|
+
"Freezes the old HEAD atomically, preserves its final committed publication, rotates the key and remaining packages, deletes the leaving profile and retires the old HEAD.",
|
|
236
|
+
],
|
|
237
|
+
},
|
|
238
|
+
"swarm resume": {
|
|
239
|
+
summary: "Owner resumes an interrupted organization switch",
|
|
240
|
+
examples: ["ipab swarm resume work"],
|
|
241
|
+
},
|
|
242
|
+
"swarm profile": {
|
|
243
|
+
summary: "Update your public display name and LAN/VPN IPv4 TCP address",
|
|
244
|
+
examples: [
|
|
245
|
+
"ipab swarm profile work --name Wei",
|
|
246
|
+
"ipab swarm profile work --address /ip4/192.168.1.12/tcp/4001/p2p/PEER_ID",
|
|
197
247
|
],
|
|
198
248
|
},
|
|
199
249
|
"swarm status": {
|
|
200
|
-
summary: "
|
|
201
|
-
|
|
250
|
+
summary: "Read the current shared Swarm state",
|
|
251
|
+
options: [
|
|
252
|
+
"--local Also authenticate local membership, connect the node and diagnose interrupted Owner operations.",
|
|
253
|
+
],
|
|
254
|
+
examples: [
|
|
255
|
+
"ipab swarm status",
|
|
256
|
+
"ipab swarm status work",
|
|
257
|
+
"ipab swarm status work --local",
|
|
258
|
+
],
|
|
202
259
|
notes: [
|
|
203
|
-
"Always
|
|
260
|
+
"Always read public configuration, Scope and HEAD, and verify the State. Local content needs no HOME identity or node activation.",
|
|
261
|
+
"Missing local content may require the registered Swarm's private source. --local preserves the full local diagnostic and header-cache update.",
|
|
204
262
|
],
|
|
205
263
|
},
|
|
206
264
|
"swarm list": {
|
|
@@ -213,7 +271,7 @@ const commandHelp: Record<
|
|
|
213
271
|
options: [
|
|
214
272
|
"--alias ALIAS Unique local alias; does not rename the shared swarm.",
|
|
215
273
|
],
|
|
216
|
-
examples: ["ipab swarm add
|
|
274
|
+
examples: ["ipab swarm add CONFIG_URL --alias work"],
|
|
217
275
|
notes: [
|
|
218
276
|
"Not a membership grant. The first registration becomes the saved default only if none exists.",
|
|
219
277
|
],
|
|
@@ -231,8 +289,8 @@ const commandHelp: Record<
|
|
|
231
289
|
],
|
|
232
290
|
},
|
|
233
291
|
"swarm update": {
|
|
234
|
-
summary: "
|
|
235
|
-
arguments: ["
|
|
292
|
+
summary: "Owner updates public organization information",
|
|
293
|
+
arguments: ["URL_OR_ALIAS Defaults to the effective current swarm."],
|
|
236
294
|
options: [
|
|
237
295
|
"--name TEXT Replace the shared display name; empty text clears it.",
|
|
238
296
|
"--description TEXT Replace the shared description; empty text clears it.",
|
|
@@ -242,9 +300,8 @@ const commandHelp: Record<
|
|
|
242
300
|
'ipab swarm update --description ""',
|
|
243
301
|
],
|
|
244
302
|
notes: [
|
|
245
|
-
"Requires at least one field.
|
|
246
|
-
"
|
|
247
|
-
"Automatically retries HEAD contention while preserving current Names and unspecified properties.",
|
|
303
|
+
"Requires at least one field. Members can change only their own profile.",
|
|
304
|
+
"Content-CID CAS prevents overwriting concurrent organization changes.",
|
|
248
305
|
"Shared name changes do not rename local registry aliases.",
|
|
249
306
|
],
|
|
250
307
|
},
|
|
@@ -289,16 +346,18 @@ const commandHelp: Record<
|
|
|
289
346
|
"--raw Select the Artifact node instead of its value.",
|
|
290
347
|
"--force Refresh the shared Name's swarm HEAD.",
|
|
291
348
|
"--no-force Override swarm.forceRefresh and use valid cached headers.",
|
|
292
|
-
"-o, --output DIRECTORY New or empty directory; defaults to
|
|
349
|
+
"-o, --output DIRECTORY New or empty directory; defaults to a unique temporary directory.",
|
|
293
350
|
],
|
|
294
351
|
examples: [
|
|
295
352
|
"ipab --json get ipab:///apps/hello -o hello-app",
|
|
296
353
|
"ipab get ipab://work/apps/hello -o hello-app",
|
|
354
|
+
"ipab get CONTENT_CID",
|
|
297
355
|
"ipab get --raw RELEASE_CID",
|
|
298
356
|
],
|
|
299
357
|
notes: [
|
|
300
|
-
"
|
|
301
|
-
"
|
|
358
|
+
"Stdout contains only the absolute directory path; --json also returns content and original target CIDs.",
|
|
359
|
+
"Temporary exports remain after exit; copy before cleanup, not symlink. Use --output for a persistent destination.",
|
|
360
|
+
"ipab://ALIAS_OR_ENCODED_CONFIG_URL/PATH selects its own swarm; ipab:///PATH uses --swarm or swarm.default.",
|
|
302
361
|
"Does not install, build, edit, or automatically retrieve associated source.",
|
|
303
362
|
],
|
|
304
363
|
},
|
|
@@ -349,7 +408,7 @@ const commandHelp: Record<
|
|
|
349
408
|
],
|
|
350
409
|
notes: [
|
|
351
410
|
"Recipe explicitly maps source files and exact CID imports to target paths.",
|
|
352
|
-
"
|
|
411
|
+
"Instance paths come from .bundle.yaml; the referenced file defines the type. Imported DAG identities are preserved.",
|
|
353
412
|
"Legacy App ipab.yaml is rejected; use project preparation tools separately.",
|
|
354
413
|
"Select explicit files; review private files before providing Bundles.",
|
|
355
414
|
"Store failures preserve the CAR; retry with ipab bundle import FILE.car.",
|
|
@@ -366,7 +425,7 @@ const commandHelp: Record<
|
|
|
366
425
|
],
|
|
367
426
|
examples: [
|
|
368
427
|
"ipab bundle build note",
|
|
369
|
-
"ipab bundle build types\\.bundle.yaml --schema-only",
|
|
428
|
+
"ipab bundle build types\\.bundle-type.yaml --schema-only",
|
|
370
429
|
],
|
|
371
430
|
notes: [
|
|
372
431
|
"Imports into the configured Store without pinning or executing Apps.",
|
|
@@ -405,7 +464,7 @@ const commandHelp: Record<
|
|
|
405
464
|
],
|
|
406
465
|
notes: [
|
|
407
466
|
"Apps are NOT sandboxed; run only Apps you trust.",
|
|
408
|
-
"ipab://
|
|
467
|
+
"ipab://ALIAS_OR_ENCODED_CONFIG_URL/PATH selects its own swarm; ipab:///PATH uses --swarm or swarm.default.",
|
|
409
468
|
"History stores argv by default; do not put secrets in arguments.",
|
|
410
469
|
"Logs may contain secrets; stdin is never logged. Logging makes output non-TTY.",
|
|
411
470
|
"--json is not supported; App stdio is passed through.",
|
|
@@ -427,7 +486,7 @@ const commandHelp: Record<
|
|
|
427
486
|
],
|
|
428
487
|
notes: [
|
|
429
488
|
"Requires a saved registration and App support for the exact content type.",
|
|
430
|
-
"ipab://
|
|
489
|
+
"ipab://ALIAS_OR_ENCODED_CONFIG_URL/PATH selects its own swarm; ipab:///PATH uses --swarm or swarm.default.",
|
|
431
490
|
"Apps are NOT sandboxed; run only Apps you trust.",
|
|
432
491
|
"Logs may contain secrets; stdin is never logged. Logging makes output non-TTY.",
|
|
433
492
|
"--json is not supported; App stdio is passed through.",
|
|
@@ -577,7 +636,7 @@ const commandHelp: Record<
|
|
|
577
636
|
|
|
578
637
|
export function help(path = ""): string {
|
|
579
638
|
const globalOptions = `Global options (before COMMAND):
|
|
580
|
-
--swarm
|
|
639
|
+
--swarm URL|ALIAS Select shared swarm (otherwise swarm.default; URI swarm takes precedence)
|
|
581
640
|
--state-dir PATH Set the local state directory
|
|
582
641
|
--store-gateway URL Use a read-only upstream HTTP gateway
|
|
583
642
|
--json Output management/development metadata, not App stdio`;
|
|
@@ -598,6 +657,7 @@ Create:
|
|
|
598
657
|
bundle ${groups.bundle}
|
|
599
658
|
|
|
600
659
|
Manage:
|
|
660
|
+
setup ${commandHelp.setup!.summary}
|
|
601
661
|
swarm ${groups.swarm}
|
|
602
662
|
search Search formal Names across registered swarms
|
|
603
663
|
publish ${commandHelp.publish!.summary}
|
|
@@ -848,7 +908,11 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
848
908
|
result.positional = tokens;
|
|
849
909
|
return result;
|
|
850
910
|
}
|
|
851
|
-
if (
|
|
911
|
+
if (
|
|
912
|
+
!["open", "init", "build", "publish", "get", "search", "setup"].includes(
|
|
913
|
+
group,
|
|
914
|
+
)
|
|
915
|
+
) {
|
|
852
916
|
if (
|
|
853
917
|
![
|
|
854
918
|
"bundle",
|
|
@@ -885,52 +949,77 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
885
949
|
"API key must be provided through '-' and piped stdin; never pass it in command arguments.",
|
|
886
950
|
);
|
|
887
951
|
const booleans =
|
|
888
|
-
result.path === "
|
|
889
|
-
? ["
|
|
890
|
-
: result.path === "build"
|
|
891
|
-
? ["replace", "no-import"]
|
|
892
|
-
: result.path === "
|
|
893
|
-
? ["
|
|
894
|
-
: result.path === "
|
|
895
|
-
? ["
|
|
896
|
-
: result.path === "
|
|
897
|
-
? ["
|
|
898
|
-
: result.path === "
|
|
899
|
-
? ["
|
|
900
|
-
: result.path === "
|
|
901
|
-
? ["
|
|
902
|
-
: result.path === "
|
|
903
|
-
? ["
|
|
904
|
-
: result.path === "
|
|
905
|
-
? ["
|
|
906
|
-
:
|
|
952
|
+
result.path === "setup"
|
|
953
|
+
? ["yes"]
|
|
954
|
+
: result.path === "bundle build"
|
|
955
|
+
? ["replace", "schema-only", "no-import"]
|
|
956
|
+
: result.path === "build"
|
|
957
|
+
? ["replace", "no-import"]
|
|
958
|
+
: result.path === "publish"
|
|
959
|
+
? ["snapshot"]
|
|
960
|
+
: result.path === "get"
|
|
961
|
+
? ["raw", "force", "no-force"]
|
|
962
|
+
: result.path === "search"
|
|
963
|
+
? ["current", "force", "no-force"]
|
|
964
|
+
: result.path === "swarm approve"
|
|
965
|
+
? ["yes", "again"]
|
|
966
|
+
: result.path === "swarm status"
|
|
967
|
+
? ["local"]
|
|
968
|
+
: result.path === "swarm exclude"
|
|
969
|
+
? ["yes"]
|
|
970
|
+
: result.path === "register set"
|
|
971
|
+
? ["replace"]
|
|
972
|
+
: result.path === "history remove"
|
|
973
|
+
? ["yes"]
|
|
974
|
+
: result.path === "open"
|
|
975
|
+
? ["log", "raw", "force", "no-force"]
|
|
976
|
+
: [];
|
|
907
977
|
const values =
|
|
908
978
|
result.path === "swarm create"
|
|
909
979
|
? ["service", "resume", "name", "description", "alias"]
|
|
910
|
-
: result.path === "swarm add"
|
|
980
|
+
: result.path === "swarm add"
|
|
911
981
|
? ["alias"]
|
|
912
|
-
: result.path === "swarm
|
|
913
|
-
? ["name", "
|
|
914
|
-
: result.path === "swarm
|
|
915
|
-
? ["
|
|
916
|
-
: result.path === "
|
|
917
|
-
? ["name", "
|
|
918
|
-
: result.path === "
|
|
919
|
-
? ["
|
|
920
|
-
: result.path === "
|
|
921
|
-
? [
|
|
922
|
-
: result.path === "
|
|
923
|
-
? ["
|
|
924
|
-
: result.path === "
|
|
925
|
-
? ["
|
|
926
|
-
: result.path === "
|
|
927
|
-
? ["
|
|
928
|
-
: result.path === "
|
|
929
|
-
|
|
930
|
-
|
|
982
|
+
: result.path === "swarm request"
|
|
983
|
+
? ["owner-fingerprint", "name", "alias", "output"]
|
|
984
|
+
: result.path === "swarm export"
|
|
985
|
+
? ["output"]
|
|
986
|
+
: result.path === "swarm profile"
|
|
987
|
+
? ["name", "address"]
|
|
988
|
+
: result.path === "swarm update"
|
|
989
|
+
? ["name", "description"]
|
|
990
|
+
: result.path === "swarm approve"
|
|
991
|
+
? []
|
|
992
|
+
: result.path === "publish"
|
|
993
|
+
? ["name", "expect"]
|
|
994
|
+
: result.path === "get"
|
|
995
|
+
? ["output"]
|
|
996
|
+
: result.path === "init"
|
|
997
|
+
? ["template"]
|
|
998
|
+
: result.path === "bundle build" ||
|
|
999
|
+
result.path === "build"
|
|
1000
|
+
? ["output"]
|
|
1001
|
+
: result.path === "history list"
|
|
1002
|
+
? [
|
|
1003
|
+
"app",
|
|
1004
|
+
"status",
|
|
1005
|
+
"since",
|
|
1006
|
+
"until",
|
|
1007
|
+
"limit",
|
|
1008
|
+
"before",
|
|
1009
|
+
]
|
|
1010
|
+
: result.path === "history remove"
|
|
1011
|
+
? ["app", "status", "since", "until"]
|
|
1012
|
+
: result.path === "pin list"
|
|
1013
|
+
? ["type"]
|
|
1014
|
+
: [];
|
|
931
1015
|
while (tokens.length) {
|
|
932
1016
|
const value = tokens.shift()!;
|
|
933
|
-
if (
|
|
1017
|
+
if (
|
|
1018
|
+
result.path === "swarm exclude" &&
|
|
1019
|
+
/^--[A-Za-z0-9_-]{41}$/.test(value)
|
|
1020
|
+
) {
|
|
1021
|
+
result.positional.push(value);
|
|
1022
|
+
} else if (value.startsWith("--") || value === "-o") {
|
|
934
1023
|
const option = value === "-o" ? "output" : value.slice(2);
|
|
935
1024
|
if (result.path === "init" && option === "param") {
|
|
936
1025
|
const input = tokens.shift();
|
|
@@ -946,7 +1035,11 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
946
1035
|
const input = tokens.shift();
|
|
947
1036
|
if (
|
|
948
1037
|
input === undefined ||
|
|
949
|
-
input.startsWith("--")
|
|
1038
|
+
(input.startsWith("--") &&
|
|
1039
|
+
!(
|
|
1040
|
+
["resume", "owner-fingerprint"].includes(option) &&
|
|
1041
|
+
/^[A-Za-z0-9_-]{43}$/.test(input)
|
|
1042
|
+
)) ||
|
|
950
1043
|
(input === "" && result.path !== "swarm update")
|
|
951
1044
|
)
|
|
952
1045
|
syntax(`${value} needs a value.`);
|
|
@@ -963,10 +1056,14 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
963
1056
|
)
|
|
964
1057
|
syntax("--current and --swarm are mutually exclusive.");
|
|
965
1058
|
const counts: Record<string, [number, number]> = {
|
|
1059
|
+
setup: [0, 0],
|
|
966
1060
|
"swarm create": [0, 0],
|
|
967
1061
|
"swarm request": [1, 1],
|
|
968
1062
|
"swarm approve": [1, 1],
|
|
969
|
-
"swarm
|
|
1063
|
+
"swarm export": [1, 1],
|
|
1064
|
+
"swarm exclude": [1, 1],
|
|
1065
|
+
"swarm resume": [0, 1],
|
|
1066
|
+
"swarm profile": [0, 1],
|
|
970
1067
|
"swarm status": [0, 1],
|
|
971
1068
|
"swarm list": [0, 0],
|
|
972
1069
|
"swarm add": [1, 1],
|
|
@@ -1076,6 +1173,28 @@ async function performCli(
|
|
|
1076
1173
|
}
|
|
1077
1174
|
if (parsed.path === "history remove" && !parsed.options.yes && !io.tty)
|
|
1078
1175
|
syntax("Non-interactive history remove requires --yes.");
|
|
1176
|
+
if (parsed.path === "setup") {
|
|
1177
|
+
if (
|
|
1178
|
+
!parsed.options.yes &&
|
|
1179
|
+
(!io.tty ||
|
|
1180
|
+
!(await io.confirm(
|
|
1181
|
+
"Install checksum-verified Kubo and initialize/reuse the protected HOME identity? No daemon will be contacted or started.",
|
|
1182
|
+
)))
|
|
1183
|
+
)
|
|
1184
|
+
throw new HostError(
|
|
1185
|
+
"Setup requires explicit --yes or interactive confirmation.",
|
|
1186
|
+
);
|
|
1187
|
+
const result = await setupDevice(
|
|
1188
|
+
stateLocation(parsed.flags, env).path,
|
|
1189
|
+
env,
|
|
1190
|
+
);
|
|
1191
|
+
io.out(
|
|
1192
|
+
parsed.flags.json
|
|
1193
|
+
? JSON.stringify(result)
|
|
1194
|
+
: `Kubo ${result.kuboVersion}: ${result.binary}\nAccount fingerprint: ${result.fingerprint}\nReady. Nodes start only when a Swarm is used.`,
|
|
1195
|
+
);
|
|
1196
|
+
return 0;
|
|
1197
|
+
}
|
|
1079
1198
|
const builtins = await builtinContent();
|
|
1080
1199
|
state = new State(stateLocation(parsed.flags, env).path, builtins.pins);
|
|
1081
1200
|
if (
|
|
@@ -1091,7 +1210,10 @@ async function performCli(
|
|
|
1091
1210
|
return 0;
|
|
1092
1211
|
}
|
|
1093
1212
|
const items = effectiveConfig(
|
|
1094
|
-
state.config(
|
|
1213
|
+
state.config({
|
|
1214
|
+
includeSecrets:
|
|
1215
|
+
parsed.path !== "swarm status" || Boolean(parsed.options.local),
|
|
1216
|
+
}),
|
|
1095
1217
|
parsed.flags,
|
|
1096
1218
|
env,
|
|
1097
1219
|
(reference) => state!.resolveSwarm(reference),
|
|
@@ -1107,12 +1229,17 @@ async function performCli(
|
|
|
1107
1229
|
? undefined
|
|
1108
1230
|
: String(value("swarm.default"));
|
|
1109
1231
|
const swarmContext = (): SwarmContext => ({
|
|
1110
|
-
store
|
|
1232
|
+
get store() {
|
|
1233
|
+
return store!;
|
|
1234
|
+
},
|
|
1235
|
+
set store(next) {
|
|
1236
|
+
store = next;
|
|
1237
|
+
},
|
|
1111
1238
|
state: state!,
|
|
1112
1239
|
env,
|
|
1113
1240
|
stateDir: stateLocation(parsed.flags, env).path,
|
|
1114
|
-
provider: String(value("swarm.provider") ?? "http://127.0.0.1:5001"),
|
|
1115
1241
|
cacheTtl: Number(value("swarm.cacheTtl")),
|
|
1242
|
+
listen: value("swarm.listen") === "loopback" ? "loopback" : "lan",
|
|
1116
1243
|
forceRefresh: parsed.options.force
|
|
1117
1244
|
? true
|
|
1118
1245
|
: parsed.options["no-force"]
|
|
@@ -1148,14 +1275,27 @@ async function performCli(
|
|
|
1148
1275
|
case "swarm list": {
|
|
1149
1276
|
const result = { swarms: state.swarms(), ...selection() };
|
|
1150
1277
|
emit(
|
|
1151
|
-
|
|
1278
|
+
{
|
|
1279
|
+
...result,
|
|
1280
|
+
swarms: result.swarms.map((entry) => ({
|
|
1281
|
+
configUrl: entry.cid,
|
|
1282
|
+
alias: entry.alias,
|
|
1283
|
+
})),
|
|
1284
|
+
},
|
|
1152
1285
|
[
|
|
1153
1286
|
...result.swarms.map(
|
|
1154
1287
|
(entry) =>
|
|
1155
|
-
`${entry.cid === result.
|
|
1288
|
+
`${entry.cid === result.effectiveCurrent ? "*" : " "} ${printable(entry.alias ?? entry.cid)} ${entry.cid}`,
|
|
1156
1289
|
),
|
|
1157
|
-
|
|
1158
|
-
|
|
1290
|
+
...(result.swarms.length ? [] : ["No registered Swarms."]),
|
|
1291
|
+
...(result.effectiveCurrent === null
|
|
1292
|
+
? ["Use ipab swarm use <alias> to select a default Swarm."]
|
|
1293
|
+
: []),
|
|
1294
|
+
...(result.effectiveCurrent !== result.savedCurrent
|
|
1295
|
+
? [
|
|
1296
|
+
`Selected via --swarm: ${printable(String(result.swarms.find((entry) => entry.cid === result.effectiveCurrent)?.alias ?? result.effectiveCurrent ?? "(none)"))}; saved default: ${printable(String(result.swarms.find((entry) => entry.cid === result.savedCurrent)?.alias ?? result.savedCurrent ?? "(none)"))}.`,
|
|
1297
|
+
]
|
|
1298
|
+
: []),
|
|
1159
1299
|
].join("\n"),
|
|
1160
1300
|
);
|
|
1161
1301
|
break;
|
|
@@ -1184,17 +1324,67 @@ async function performCli(
|
|
|
1184
1324
|
case "swarm create":
|
|
1185
1325
|
case "swarm request":
|
|
1186
1326
|
case "swarm approve":
|
|
1187
|
-
case "swarm
|
|
1327
|
+
case "swarm export":
|
|
1328
|
+
case "swarm exclude":
|
|
1329
|
+
case "swarm resume":
|
|
1330
|
+
case "swarm profile":
|
|
1188
1331
|
case "swarm status":
|
|
1189
1332
|
case "publish":
|
|
1190
1333
|
case "get": {
|
|
1191
1334
|
store = new IpfsStore(await storeConfiguration(value("store.gateway")));
|
|
1192
1335
|
const context = swarmContext();
|
|
1336
|
+
if (parsed.path === "swarm export") {
|
|
1337
|
+
const id = await exportRequest(
|
|
1338
|
+
context,
|
|
1339
|
+
state.resolveSwarm(first!),
|
|
1340
|
+
String(parsed.options.output ?? ""),
|
|
1341
|
+
);
|
|
1342
|
+
emit({ id }, id);
|
|
1343
|
+
break;
|
|
1344
|
+
}
|
|
1345
|
+
if (
|
|
1346
|
+
["swarm exclude", "swarm resume", "swarm profile"].includes(
|
|
1347
|
+
parsed.path,
|
|
1348
|
+
)
|
|
1349
|
+
) {
|
|
1350
|
+
const url =
|
|
1351
|
+
parsed.path === "swarm exclude"
|
|
1352
|
+
? selectedSwarm
|
|
1353
|
+
: first
|
|
1354
|
+
? state.resolveSwarm(first)
|
|
1355
|
+
: selectedSwarm;
|
|
1356
|
+
if (!url) syntax("Select a Swarm configuration URL or alias.");
|
|
1357
|
+
if (parsed.path === "swarm exclude") {
|
|
1358
|
+
if (!parsed.options.yes)
|
|
1359
|
+
syntax("Member removal is irreversible; --yes required.");
|
|
1360
|
+
await removeMember(context, url, first!);
|
|
1361
|
+
} else if (parsed.path === "swarm resume")
|
|
1362
|
+
await resumeRemoval(context, url);
|
|
1363
|
+
else {
|
|
1364
|
+
const profile = await updateProfile(context, url, {
|
|
1365
|
+
...(typeof parsed.options.name === "string"
|
|
1366
|
+
? { name: parsed.options.name }
|
|
1367
|
+
: {}),
|
|
1368
|
+
...(typeof parsed.options.address === "string"
|
|
1369
|
+
? { addresses: [parsed.options.address] }
|
|
1370
|
+
: {}),
|
|
1371
|
+
});
|
|
1372
|
+
emit(profile, JSON.stringify(profile));
|
|
1373
|
+
store = context.store;
|
|
1374
|
+
break;
|
|
1375
|
+
}
|
|
1376
|
+
store = context.store;
|
|
1377
|
+
emit(
|
|
1378
|
+
{ url, completed: true },
|
|
1379
|
+
`Organization switch complete: ${url}`,
|
|
1380
|
+
);
|
|
1381
|
+
break;
|
|
1382
|
+
}
|
|
1193
1383
|
if (parsed.path === "swarm update") {
|
|
1194
1384
|
const cid = first ? state.resolveSwarm(first) : selectedSwarm;
|
|
1195
1385
|
if (!cid)
|
|
1196
1386
|
syntax(
|
|
1197
|
-
"swarm update requires a registered alias,
|
|
1387
|
+
"swarm update requires a registered alias, configuration URL or current swarm.",
|
|
1198
1388
|
);
|
|
1199
1389
|
const result = await updateSwarm(context, cid, {
|
|
1200
1390
|
...(typeof parsed.options.name === "string"
|
|
@@ -1206,12 +1396,12 @@ async function performCli(
|
|
|
1206
1396
|
});
|
|
1207
1397
|
emit(
|
|
1208
1398
|
result,
|
|
1209
|
-
`Swarm: ${result.
|
|
1399
|
+
`Swarm: ${result.configUrl}\nName: ${printable(result.properties.name)}\nDescription: ${printable(result.properties.description)}\nHEAD ID: ${result.headId}\nConfig content CID: ${result.valueCid}`,
|
|
1210
1400
|
);
|
|
1211
1401
|
break;
|
|
1212
1402
|
}
|
|
1213
1403
|
if (parsed.path === "swarm add") {
|
|
1214
|
-
const cid =
|
|
1404
|
+
const cid = state.resolveSwarm(first!);
|
|
1215
1405
|
await addSwarm(
|
|
1216
1406
|
context,
|
|
1217
1407
|
cid,
|
|
@@ -1221,7 +1411,11 @@ async function performCli(
|
|
|
1221
1411
|
);
|
|
1222
1412
|
const entry = state.registeredSwarm(cid);
|
|
1223
1413
|
emit(
|
|
1224
|
-
{
|
|
1414
|
+
{
|
|
1415
|
+
configUrl: entry.cid,
|
|
1416
|
+
alias: entry.alias,
|
|
1417
|
+
savedCurrent: state.config()["swarm.default"] ?? null,
|
|
1418
|
+
},
|
|
1225
1419
|
`Registered swarm ${entry.alias ?? cid} (${cid}).`,
|
|
1226
1420
|
);
|
|
1227
1421
|
break;
|
|
@@ -1263,40 +1457,114 @@ async function performCli(
|
|
|
1263
1457
|
if (parsed.path === "swarm status") {
|
|
1264
1458
|
const cid = first ? state.resolveSwarm(first) : selectedSwarm;
|
|
1265
1459
|
if (!cid)
|
|
1266
|
-
syntax(
|
|
1267
|
-
|
|
1268
|
-
|
|
1460
|
+
syntax(
|
|
1461
|
+
"swarm status requires a configuration URL or swarm.default.",
|
|
1462
|
+
);
|
|
1463
|
+
const local = Boolean(parsed.options.local);
|
|
1464
|
+
const { head, config } = local
|
|
1465
|
+
? await swarmHeader(context, cid, true)
|
|
1466
|
+
: await sharedSwarmStatus(context, cid);
|
|
1467
|
+
const fingerprint = await keyId(config.owner);
|
|
1468
|
+
store = context.store;
|
|
1269
1469
|
emit(
|
|
1270
1470
|
{
|
|
1271
|
-
cid,
|
|
1272
|
-
|
|
1471
|
+
configUrl: cid,
|
|
1472
|
+
owner: config.owner,
|
|
1473
|
+
ownerFingerprint: fingerprint,
|
|
1474
|
+
epoch: config.epoch,
|
|
1475
|
+
...(local
|
|
1476
|
+
? {
|
|
1477
|
+
peerId: context.node!.peerId,
|
|
1478
|
+
addresses: context.node!.addresses,
|
|
1479
|
+
}
|
|
1480
|
+
: {}),
|
|
1273
1481
|
root: head.root,
|
|
1274
|
-
|
|
1275
|
-
properties:
|
|
1482
|
+
valueCid: head.cid,
|
|
1483
|
+
properties: {
|
|
1484
|
+
name: config.name,
|
|
1485
|
+
description: config.description,
|
|
1486
|
+
},
|
|
1276
1487
|
},
|
|
1277
|
-
|
|
1488
|
+
[
|
|
1489
|
+
"Swarm",
|
|
1490
|
+
` Name: ${printable(config.name)}`,
|
|
1491
|
+
` Description: ${config.description ? printable(config.description) : "(none)"}`,
|
|
1492
|
+
" Config URL:",
|
|
1493
|
+
` ${cid}`,
|
|
1494
|
+
"",
|
|
1495
|
+
"Identity",
|
|
1496
|
+
" Owner fingerprint:",
|
|
1497
|
+
` ${fingerprint}`,
|
|
1498
|
+
...(local
|
|
1499
|
+
? [
|
|
1500
|
+
" PeerID:",
|
|
1501
|
+
` ${context.node!.peerId}`,
|
|
1502
|
+
"",
|
|
1503
|
+
"Local addresses",
|
|
1504
|
+
...context.node!.addresses.map(
|
|
1505
|
+
(address) => ` ${printable(address)}`,
|
|
1506
|
+
),
|
|
1507
|
+
]
|
|
1508
|
+
: []),
|
|
1509
|
+
"",
|
|
1510
|
+
"Content",
|
|
1511
|
+
" HEAD (publication root):",
|
|
1512
|
+
` ${head.root}`,
|
|
1513
|
+
" Content CID (HEAD value):",
|
|
1514
|
+
` ${head.cid}`,
|
|
1515
|
+
].join("\n"),
|
|
1278
1516
|
);
|
|
1279
1517
|
break;
|
|
1280
1518
|
}
|
|
1281
1519
|
if (parsed.path === "get") {
|
|
1282
|
-
const
|
|
1283
|
-
|
|
1284
|
-
first
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
{
|
|
1298
|
-
|
|
1520
|
+
const localCid = first!.startsWith("ipab://")
|
|
1521
|
+
? undefined
|
|
1522
|
+
: state.resolve(first!);
|
|
1523
|
+
const builtin = builtins.pins.find((pin) => pin.cid === localCid);
|
|
1524
|
+
const selected = builtin
|
|
1525
|
+
? { cid: builtin.cid, targetCid: builtin.cid }
|
|
1526
|
+
: await resolveReference(
|
|
1527
|
+
context,
|
|
1528
|
+
first!,
|
|
1529
|
+
selectedSwarm,
|
|
1530
|
+
(reference) => state!.resolve(reference),
|
|
1531
|
+
Boolean(parsed.options.raw),
|
|
1532
|
+
);
|
|
1533
|
+
const contentStore = context.store;
|
|
1534
|
+
const source = IpfsStore.fromClient(
|
|
1535
|
+
{
|
|
1536
|
+
block: {
|
|
1537
|
+
get: (key, options) => {
|
|
1538
|
+
options?.signal?.throwIfAborted();
|
|
1539
|
+
const builtin = builtins.blocks.get(
|
|
1540
|
+
CID.parse(key).toV1().toString(),
|
|
1541
|
+
);
|
|
1542
|
+
return builtin
|
|
1543
|
+
? Promise.resolve(builtin.slice())
|
|
1544
|
+
: contentStore.block.get(key, options);
|
|
1545
|
+
},
|
|
1546
|
+
},
|
|
1547
|
+
},
|
|
1548
|
+
contentStore.limits,
|
|
1299
1549
|
);
|
|
1550
|
+
let directory: string;
|
|
1551
|
+
try {
|
|
1552
|
+
directory = await getBundle(
|
|
1553
|
+
source,
|
|
1554
|
+
selected.cid,
|
|
1555
|
+
typeof parsed.options.output === "string"
|
|
1556
|
+
? parsed.options.output
|
|
1557
|
+
: undefined,
|
|
1558
|
+
);
|
|
1559
|
+
} finally {
|
|
1560
|
+
await source.close();
|
|
1561
|
+
}
|
|
1562
|
+
const closing = store;
|
|
1563
|
+
store = undefined;
|
|
1564
|
+
await closeStore(closing, undefined);
|
|
1565
|
+
state.close();
|
|
1566
|
+
state = undefined;
|
|
1567
|
+
emit({ ...selected, directory }, directory);
|
|
1300
1568
|
break;
|
|
1301
1569
|
}
|
|
1302
1570
|
let cid: string;
|
|
@@ -1317,34 +1585,35 @@ async function performCli(
|
|
|
1317
1585
|
: {}),
|
|
1318
1586
|
});
|
|
1319
1587
|
} else if (parsed.path === "swarm request")
|
|
1320
|
-
cid = await requestMembership(context,
|
|
1588
|
+
cid = await requestMembership(context, first!, {
|
|
1589
|
+
ownerFingerprint: String(parsed.options["owner-fingerprint"] ?? ""),
|
|
1590
|
+
...(typeof parsed.options.name === "string"
|
|
1591
|
+
? { name: parsed.options.name }
|
|
1592
|
+
: {}),
|
|
1593
|
+
...(typeof parsed.options.alias === "string"
|
|
1594
|
+
? { alias: parsed.options.alias }
|
|
1595
|
+
: {}),
|
|
1596
|
+
...(typeof parsed.options.output === "string"
|
|
1597
|
+
? { output: parsed.options.output }
|
|
1598
|
+
: {}),
|
|
1599
|
+
});
|
|
1321
1600
|
else if (parsed.path === "swarm approve") {
|
|
1601
|
+
const request = await verifiedRequest(first!);
|
|
1602
|
+
io.err(await membershipRequestSummary(request));
|
|
1322
1603
|
if (
|
|
1323
1604
|
!parsed.options.yes &&
|
|
1324
1605
|
(!io.tty ||
|
|
1325
1606
|
!(await io.confirm(
|
|
1326
|
-
`Approve
|
|
1607
|
+
`Approve the verified Request ${request.id} above? This grants current HEAD and the member's profile write access; all reads are public.`,
|
|
1327
1608
|
)))
|
|
1328
1609
|
)
|
|
1329
1610
|
throw new HostError(
|
|
1330
1611
|
"Approval requires explicit --yes or interactive confirmation.",
|
|
1331
1612
|
);
|
|
1332
|
-
cid = await approveMembership(
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
? undefined
|
|
1337
|
-
: Number(parsed.options["expires-in"]),
|
|
1338
|
-
);
|
|
1339
|
-
} else if (parsed.path === "swarm join")
|
|
1340
|
-
cid = await joinSwarm(
|
|
1341
|
-
context,
|
|
1342
|
-
exactCid(first!),
|
|
1343
|
-
typeof parsed.options.alias === "string"
|
|
1344
|
-
? parsed.options.alias
|
|
1345
|
-
: undefined,
|
|
1346
|
-
);
|
|
1347
|
-
else {
|
|
1613
|
+
cid = await approveMembership(context, request, {
|
|
1614
|
+
again: Boolean(parsed.options.again),
|
|
1615
|
+
});
|
|
1616
|
+
} else {
|
|
1348
1617
|
let content: string;
|
|
1349
1618
|
if (first!.toLowerCase().endsWith(".car"))
|
|
1350
1619
|
content = (
|
|
@@ -1362,11 +1631,19 @@ async function performCli(
|
|
|
1362
1631
|
snapshot: Boolean(parsed.options.snapshot),
|
|
1363
1632
|
});
|
|
1364
1633
|
}
|
|
1365
|
-
|
|
1634
|
+
store = context.store;
|
|
1635
|
+
if (parsed.path === "swarm create")
|
|
1366
1636
|
io.err(
|
|
1367
1637
|
`Registered swarm ${state.registeredSwarm(cid).alias ?? cid}. Saved current: ${state.config()["swarm.default"] ?? "(none)"}.`,
|
|
1368
1638
|
);
|
|
1369
|
-
emit(
|
|
1639
|
+
emit(
|
|
1640
|
+
parsed.path === "swarm request"
|
|
1641
|
+
? { requestId: cid }
|
|
1642
|
+
: parsed.path === "swarm create" || parsed.path === "swarm approve"
|
|
1643
|
+
? { configUrl: cid }
|
|
1644
|
+
: { cid },
|
|
1645
|
+
cid,
|
|
1646
|
+
);
|
|
1370
1647
|
break;
|
|
1371
1648
|
}
|
|
1372
1649
|
case "store usage":
|
|
@@ -1529,7 +1806,7 @@ async function performCli(
|
|
|
1529
1806
|
} else
|
|
1530
1807
|
emit(
|
|
1531
1808
|
result,
|
|
1532
|
-
`Kind: ${result.kind}\
|
|
1809
|
+
`Kind: ${result.kind}\n${result.manifest ? `Title: ${printable(result.manifest.title)}\nEntry: ${result.manifest.entry}\nType file: ${result.manifest.type}\n` : ""}Type CID: ${result.schemaCid}\nContent type: ${result.type.contentType}\nDefinition validation: passed\nStorage verification: ${result.validation.storage}\nEntry validation: ${result.validation.entry?.status ?? "not-applicable"}`,
|
|
1533
1810
|
);
|
|
1534
1811
|
} catch (cause) {
|
|
1535
1812
|
if (cancelled)
|
|
@@ -1583,12 +1860,13 @@ async function performCli(
|
|
|
1583
1860
|
emit(
|
|
1584
1861
|
{ items: listed, pending, invalid },
|
|
1585
1862
|
table(
|
|
1586
|
-
["NAME", "CID", "KIND", "
|
|
1863
|
+
["NAME", "CID", "KIND", "TITLE", "TYPE CID", "SOURCE"],
|
|
1587
1864
|
listed.map((pin) => [
|
|
1588
1865
|
pin.name,
|
|
1589
1866
|
pin.cid,
|
|
1590
1867
|
pin.kind,
|
|
1591
|
-
pin.
|
|
1868
|
+
pin.title,
|
|
1869
|
+
pin.schemaCid,
|
|
1592
1870
|
pin.builtin ? "built-in (read-only)" : "user",
|
|
1593
1871
|
]),
|
|
1594
1872
|
"No named pins.",
|
|
@@ -1606,7 +1884,7 @@ async function performCli(
|
|
|
1606
1884
|
);
|
|
1607
1885
|
emit(
|
|
1608
1886
|
result,
|
|
1609
|
-
`${result.name} → ${result.cid}\
|
|
1887
|
+
`${result.name} → ${result.cid}\nTitle: ${printable(result.title)}\nType CID: ${result.schemaCid}`,
|
|
1610
1888
|
);
|
|
1611
1889
|
break;
|
|
1612
1890
|
}
|
|
@@ -1627,7 +1905,7 @@ async function performCli(
|
|
|
1627
1905
|
const result = pinDetails(pin);
|
|
1628
1906
|
emit(
|
|
1629
1907
|
result,
|
|
1630
|
-
`Name: ${printable(result.name)}\nCID: ${result.cid}\
|
|
1908
|
+
`Name: ${printable(result.name)}\nCID: ${result.cid}\nTitle: ${printable(result.title)}\nType CID: ${result.schemaCid}\nSource: ${result.builtin ? "built-in (read-only; content bundled with IPAB)" : "local registration (not live node verification)"}`,
|
|
1631
1909
|
);
|
|
1632
1910
|
break;
|
|
1633
1911
|
}
|
|
@@ -1801,15 +2079,17 @@ async function performCli(
|
|
|
1801
2079
|
);
|
|
1802
2080
|
await recoverInactive(state);
|
|
1803
2081
|
store = new IpfsStore(await storeConfiguration(value("store.gateway")));
|
|
2082
|
+
const context = swarmContext();
|
|
1804
2083
|
const target = (
|
|
1805
2084
|
await resolveReference(
|
|
1806
|
-
|
|
2085
|
+
context,
|
|
1807
2086
|
first!,
|
|
1808
2087
|
selectedSwarm,
|
|
1809
2088
|
(reference) => state!.resolve(reference),
|
|
1810
2089
|
Boolean(parsed.options.raw),
|
|
1811
2090
|
)
|
|
1812
2091
|
).cid;
|
|
2092
|
+
store = context.store;
|
|
1813
2093
|
let appCid: string;
|
|
1814
2094
|
let appArgv: string[];
|
|
1815
2095
|
if (parsed.path === "open") {
|