@ipab/cli 0.1.0-rc.6 → 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 +72 -33
- 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 +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +395 -86
- package/dist/cli.js.map +1 -1
- package/dist/context.d.ts +16 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +20 -0
- package/dist/context.js.map +1 -1
- package/dist/ipc.d.ts +2 -1
- package/dist/ipc.d.ts.map +1 -1
- package/dist/ipc.js +44 -3
- package/dist/ipc.js.map +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +6 -3
- 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.js +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 +53 -0
- package/dist/swarm.d.ts.map +1 -1
- package/dist/swarm.js +465 -73
- 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 +474 -71
- package/src/context.ts +45 -0
- package/src/ipc.ts +63 -2
- package/src/runtime.ts +6 -2
- 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.ts +1 -1
- package/src/swarm-files.ts +2 -1
- package/src/swarm-meta.ts +109 -0
- package/src/swarm.ts +721 -128
- 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/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";
|
|
@@ -11,19 +11,21 @@ import { filters, listHistory, selectedIds, Ownership, recoverInactive, removeHi
|
|
|
11
11
|
import { execute } from "./runtime.js";
|
|
12
12
|
import { validatedBundle } from "./space.js";
|
|
13
13
|
import { createAssociation, exactCid, State, } from "./state.js";
|
|
14
|
-
import { buildBundle, inspectBundle, importBundle } from "./authoring.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
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, accountProfile, updateAccountProfile, swarmMembers, verifiedRequest, verifiedRequestStream, membershipRequestSummary, swarmHeader, sharedSwarmStatus, addSwarm, updateSwarm, searchNames, formatNameReference, resolveReference, parseNameReference, formalName, publish, pinNameSubscription, pinReference, swarmRegistrations, swarmAssociation, setSwarmAssociation, removeSwarmAssociation, } 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
22
|
import { unpin, pinDetails } from "./pins.js";
|
|
23
23
|
import { publicationSource } from "./publish-source.js";
|
|
24
|
+
import { templateRenderExample, templateOutputTree, templateParameterRows, } from "./template-presentation.js";
|
|
24
25
|
import { logFiles } from "./logs.js";
|
|
25
26
|
import { builtinContent } from "./builtins.js";
|
|
26
27
|
import { readSecretStream } from "./config-secret.js";
|
|
28
|
+
import { manageSkills } from "./skills.js";
|
|
27
29
|
let progressLine = false;
|
|
28
30
|
export const processIO = {
|
|
29
31
|
out(text) {
|
|
@@ -69,6 +71,8 @@ export const processIO = {
|
|
|
69
71
|
},
|
|
70
72
|
};
|
|
71
73
|
const commands = {
|
|
74
|
+
"skills list": "skills list [--force | --no-force]",
|
|
75
|
+
"skills sync": "skills sync [NAMES...] [--agent AGENT]... [--dry-run] [--yes] [--force | --no-force]",
|
|
72
76
|
doctor: "doctor [--fix [--yes]]",
|
|
73
77
|
profile: "profile [--name NAME] [--description TEXT]",
|
|
74
78
|
"swarm create": "swarm create [--service URL] [--resume OPERATION]",
|
|
@@ -85,10 +89,10 @@ const commands = {
|
|
|
85
89
|
"swarm use": "swarm use URL_OR_ALIAS",
|
|
86
90
|
"swarm remove": "swarm remove URL_OR_ALIAS",
|
|
87
91
|
"swarm update": "swarm update [--name TEXT] [--description TEXT]",
|
|
88
|
-
publish: "publish NAME SOURCE [--expect
|
|
92
|
+
publish: "publish NAME SOURCE [--expect OLD_CID | --snapshot]",
|
|
89
93
|
get: "get REF [--raw] [--force | --no-force] [-o DIRECTORY]",
|
|
90
94
|
search: "search QUERY [--all | --current] [--force | --no-force]",
|
|
91
|
-
|
|
95
|
+
"templates render": "templates render TEMPLATE NAME [DIR] [OPTIONS]",
|
|
92
96
|
build: "build [SOURCE] [OPTIONS]",
|
|
93
97
|
"bundle build": "bundle build SOURCE [OPTIONS]",
|
|
94
98
|
"bundle inspect": "bundle inspect SOURCE",
|
|
@@ -99,9 +103,13 @@ const commands = {
|
|
|
99
103
|
unpin: "unpin REF",
|
|
100
104
|
"pin list": "pin list",
|
|
101
105
|
"pin show": "pin show REF",
|
|
102
|
-
"register list": "register list [--swarm URL_OR_ALIAS]
|
|
103
|
-
"register set": "register set SCHEMA APP [--swarm URL_OR_ALIAS]... [--replace]
|
|
106
|
+
"register list": "register list [--swarm URL_OR_ALIAS]",
|
|
107
|
+
"register set": "register set SCHEMA APP [--swarm URL_OR_ALIAS]... [--replace]",
|
|
104
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",
|
|
105
113
|
"config get": "config get [KEY]",
|
|
106
114
|
"config set": "config set KEY VALUE\n ipab config set pointers.apiKey - < protected-key-file",
|
|
107
115
|
"config reset": "config reset KEY",
|
|
@@ -112,15 +120,105 @@ const commands = {
|
|
|
112
120
|
"history remove": "history remove RUN_ID... [--yes]\n ipab history remove FILTERS [--yes]",
|
|
113
121
|
};
|
|
114
122
|
const groups = {
|
|
123
|
+
skills: "Discover and explicitly synchronize selected Swarm Skills globally",
|
|
115
124
|
swarm: "Create, authorize, select and manage personal swarms",
|
|
116
125
|
bundle: "Create, inspect and import content bundles",
|
|
117
126
|
pin: "Retain an exact CID or follow a shared Swarm Name",
|
|
118
127
|
register: "Associate content types with Apps",
|
|
128
|
+
templates: "Inspect, render and manage Template Bundles",
|
|
119
129
|
config: "Manage local configuration",
|
|
120
130
|
store: "Query local storage and collect unreferenced blocks",
|
|
121
131
|
history: "View and remove execution history",
|
|
122
132
|
};
|
|
123
133
|
const commandHelp = {
|
|
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
|
+
],
|
|
204
|
+
options: [
|
|
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",
|
|
213
|
+
],
|
|
214
|
+
notes: [
|
|
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
|
+
},
|
|
124
222
|
profile: {
|
|
125
223
|
summary: "Read or update your account-wide public name and description",
|
|
126
224
|
examples: [
|
|
@@ -330,18 +428,18 @@ const commandHelp = {
|
|
|
330
428
|
publish: {
|
|
331
429
|
summary: "Protect content locally and publish a shared Swarm Name",
|
|
332
430
|
options: [
|
|
333
|
-
"--expect CID Exact old
|
|
431
|
+
"--expect CID Exact old Name target CID, required for iteration.",
|
|
334
432
|
"--snapshot Name ordinary content without an Artifact; initial only.",
|
|
335
433
|
],
|
|
336
434
|
examples: [
|
|
337
435
|
"ipab --swarm work publish apps/hello app.car",
|
|
338
|
-
"ipab publish apps/hello APP_CID --expect
|
|
436
|
+
"ipab publish apps/hello APP_CID --expect OLD_APP_CID",
|
|
339
437
|
"ipab publish notes/readme ./README.md",
|
|
340
438
|
],
|
|
341
439
|
notes: [
|
|
342
440
|
"SOURCE is an exact Bundle CID, CAR, regular file or directory. No compiler, hooks, install or App execution.",
|
|
343
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.",
|
|
344
|
-
"Occupied Names require --expect
|
|
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.",
|
|
345
443
|
"Different-name CAS contention is rebased; same-name edits conflict (exit 3).",
|
|
346
444
|
"Kubo pin confirmation precedes HEAD; it does not prove a remote device is online.",
|
|
347
445
|
],
|
|
@@ -384,20 +482,28 @@ const commandHelp = {
|
|
|
384
482
|
"Does not unpin, clear history, delete unknown files or request Kubo daemon GC.",
|
|
385
483
|
],
|
|
386
484
|
},
|
|
387
|
-
|
|
388
|
-
summary: "
|
|
389
|
-
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
|
+
],
|
|
390
491
|
options: [
|
|
391
|
-
"--
|
|
492
|
+
"--description TEXT Set the declared description parameter.",
|
|
493
|
+
"--force / --no-force Refresh Swarm HEAD now / allow its valid cached snapshot.",
|
|
392
494
|
"--param KEY=VALUE Template parameter; repeatable. Strings are literal;",
|
|
393
495
|
" other parameter types use JSON.",
|
|
394
496
|
],
|
|
395
497
|
examples: [
|
|
396
|
-
"ipab
|
|
397
|
-
"ipab
|
|
398
|
-
"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.",
|
|
399
506
|
],
|
|
400
|
-
notes: ["Does not install dependencies or execute template code."],
|
|
401
507
|
},
|
|
402
508
|
build: {
|
|
403
509
|
summary: "Assemble any Bundle using ipab.build.yaml (no compilation)",
|
|
@@ -545,15 +651,15 @@ const commandHelp = {
|
|
|
545
651
|
},
|
|
546
652
|
"pin show": {
|
|
547
653
|
summary: "Show saved retention and following status",
|
|
548
|
-
examples: ["ipab pin show APP_CID"
|
|
654
|
+
examples: ["ipab pin show APP_CID"],
|
|
549
655
|
notes: [
|
|
550
656
|
"Reads local metadata; built-in pins do not claim user Store retention.",
|
|
551
657
|
],
|
|
552
658
|
},
|
|
553
659
|
"register list": {
|
|
554
|
-
summary: "List
|
|
660
|
+
summary: "List content-type associations in the current or selected Swarm",
|
|
555
661
|
options: [
|
|
556
|
-
"--swarm URL_OR_ALIAS Read this Swarm registry;
|
|
662
|
+
"--swarm URL_OR_ALIAS Read only this Swarm registry; specify at most once.",
|
|
557
663
|
],
|
|
558
664
|
examples: ["ipab register list", "ipab register list --swarm work"],
|
|
559
665
|
notes: [
|
|
@@ -566,19 +672,18 @@ const commandHelp = {
|
|
|
566
672
|
arguments: [
|
|
567
673
|
"SCHEMA Exact type CID or builtin:node-app.v1.",
|
|
568
674
|
"APP App CID or Swarm IPAB URI; the exact CID is saved.",
|
|
569
|
-
"TEMPLATE App argv after --; must contain a whole argument % (default: %).",
|
|
570
675
|
],
|
|
571
676
|
options: [
|
|
572
677
|
"--replace Allow changing an existing association.",
|
|
573
678
|
"--swarm URL_OR_ALIAS Write this Swarm registry; repeat for multiple Swarms.",
|
|
574
679
|
],
|
|
575
680
|
examples: [
|
|
576
|
-
"ipab register set SCHEMA_CID
|
|
577
|
-
"ipab register set SCHEMA_CID reader '--' '--cid' '%'",
|
|
681
|
+
"ipab register set SCHEMA_CID APP_CID",
|
|
578
682
|
"ipab register set SCHEMA_CID ipab:///apps/reader --swarm work --swarm team",
|
|
579
683
|
],
|
|
580
684
|
notes: [
|
|
581
|
-
"
|
|
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.",
|
|
582
687
|
"Does not verify App type support; open checks it before execution.",
|
|
583
688
|
"Without explicit --swarm, writes the saved default Swarm. Swarm writes require HEAD write access.",
|
|
584
689
|
"Multiple Swarms commit sequentially, not atomically; failures report completed targets.",
|
|
@@ -682,7 +787,7 @@ Run Apps:
|
|
|
682
787
|
open ${commandHelp.open.summary}
|
|
683
788
|
|
|
684
789
|
Create:
|
|
685
|
-
|
|
790
|
+
templates ${groups.templates}
|
|
686
791
|
build ${commandHelp.build.summary}
|
|
687
792
|
bundle ${groups.bundle}
|
|
688
793
|
|
|
@@ -690,6 +795,7 @@ Manage:
|
|
|
690
795
|
doctor ${commandHelp.doctor.summary}
|
|
691
796
|
profile ${commandHelp.profile.summary}
|
|
692
797
|
swarm ${groups.swarm}
|
|
798
|
+
skills ${groups.skills}
|
|
693
799
|
search Search formal Names in the current swarm
|
|
694
800
|
publish ${commandHelp.publish.summary}
|
|
695
801
|
get ${commandHelp.get.summary}
|
|
@@ -906,6 +1012,10 @@ export function parse(argv) {
|
|
|
906
1012
|
syntax(`Unknown global option "${flag}".`);
|
|
907
1013
|
}
|
|
908
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.");
|
|
909
1019
|
const result = {
|
|
910
1020
|
flags,
|
|
911
1021
|
path: group,
|
|
@@ -939,7 +1049,6 @@ export function parse(argv) {
|
|
|
939
1049
|
}
|
|
940
1050
|
if (![
|
|
941
1051
|
"open",
|
|
942
|
-
"init",
|
|
943
1052
|
"build",
|
|
944
1053
|
"publish",
|
|
945
1054
|
"get",
|
|
@@ -952,10 +1061,12 @@ export function parse(argv) {
|
|
|
952
1061
|
"bundle",
|
|
953
1062
|
"pin",
|
|
954
1063
|
"register",
|
|
1064
|
+
"templates",
|
|
955
1065
|
"config",
|
|
956
1066
|
"history",
|
|
957
1067
|
"store",
|
|
958
1068
|
"swarm",
|
|
1069
|
+
"skills",
|
|
959
1070
|
].includes(group))
|
|
960
1071
|
syntax(`Unknown command "${group}".${group === "setup" ? " Run ipab doctor to inspect, or ipab doctor --fix to prepare this device." : " Run ipab --help."}`);
|
|
961
1072
|
if (group === "pin" && !["list", "show"].includes(tokens[0] ?? "")) {
|
|
@@ -975,6 +1086,8 @@ export function parse(argv) {
|
|
|
975
1086
|
syntax("--json is not supported for exec/open.");
|
|
976
1087
|
if (!commands[result.path])
|
|
977
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.");
|
|
978
1091
|
const separator = result.path === "register set" ? tokens.indexOf("--") : -1;
|
|
979
1092
|
if (separator >= 0)
|
|
980
1093
|
result.template = tokens.splice(separator + 1);
|
|
@@ -988,31 +1101,44 @@ export function parse(argv) {
|
|
|
988
1101
|
tokens.includes("pointers.apiKey") &&
|
|
989
1102
|
!(tokens.length === 2 && tokens[1] === "-"))
|
|
990
1103
|
syntax("API key must be provided through '-' and piped stdin; never pass it in command arguments.");
|
|
991
|
-
const booleans = result.path
|
|
992
|
-
?
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
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
|
+
: [];
|
|
1016
1142
|
const values = result.path === "swarm create"
|
|
1017
1143
|
? ["service", "resume", "name", "description", "alias"]
|
|
1018
1144
|
: result.path === "swarm add"
|
|
@@ -1027,12 +1153,12 @@ export function parse(argv) {
|
|
|
1027
1153
|
? ["name", "description"]
|
|
1028
1154
|
: result.path === "swarm approve"
|
|
1029
1155
|
? []
|
|
1030
|
-
:
|
|
1156
|
+
: ["publish", "templates set", "templates remove"].includes(result.path)
|
|
1031
1157
|
? ["expect"]
|
|
1032
1158
|
: result.path === "get"
|
|
1033
1159
|
? ["output"]
|
|
1034
|
-
: result.path === "
|
|
1035
|
-
? ["
|
|
1160
|
+
: result.path === "templates render"
|
|
1161
|
+
? ["description"]
|
|
1036
1162
|
: result.path === "bundle build" ||
|
|
1037
1163
|
result.path === "build"
|
|
1038
1164
|
? ["output"]
|
|
@@ -1056,6 +1182,13 @@ export function parse(argv) {
|
|
|
1056
1182
|
}
|
|
1057
1183
|
else if (value.startsWith("--") || value === "-o") {
|
|
1058
1184
|
const option = value === "-o" ? "output" : value.slice(2);
|
|
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
|
+
}
|
|
1059
1192
|
if (result.path.startsWith("register ") && option === "swarm") {
|
|
1060
1193
|
const input = tokens.shift();
|
|
1061
1194
|
if (!input || input.startsWith("-"))
|
|
@@ -1064,7 +1197,9 @@ export function parse(argv) {
|
|
|
1064
1197
|
flags.swarm = input;
|
|
1065
1198
|
continue;
|
|
1066
1199
|
}
|
|
1067
|
-
if (result.path === "
|
|
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") {
|
|
1068
1203
|
const input = tokens.shift();
|
|
1069
1204
|
if (!input || input.startsWith("--") || input.indexOf("=") < 1)
|
|
1070
1205
|
syntax("--param requires KEY=VALUE.");
|
|
@@ -1080,7 +1215,8 @@ export function parse(argv) {
|
|
|
1080
1215
|
if (input === undefined ||
|
|
1081
1216
|
(input.startsWith("--") &&
|
|
1082
1217
|
!(option === "resume" && /^[A-Za-z0-9_-]{43}$/.test(input))) ||
|
|
1083
|
-
(input === "" &&
|
|
1218
|
+
(input === "" &&
|
|
1219
|
+
!["swarm update", "profile", "templates render"].includes(result.path)))
|
|
1084
1220
|
syntax(`${value} needs a value.`);
|
|
1085
1221
|
result.options[option] = input;
|
|
1086
1222
|
}
|
|
@@ -1103,8 +1239,13 @@ export function parse(argv) {
|
|
|
1103
1239
|
result.options.all &&
|
|
1104
1240
|
(result.options.current || flags.swarm !== undefined))
|
|
1105
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.");
|
|
1106
1245
|
const counts = {
|
|
1107
1246
|
doctor: [0, 0],
|
|
1247
|
+
"skills list": [0, 0],
|
|
1248
|
+
"skills sync": [0, Number.MAX_SAFE_INTEGER],
|
|
1108
1249
|
profile: [0, 0],
|
|
1109
1250
|
"swarm create": [0, 0],
|
|
1110
1251
|
"swarm request": [1, 1],
|
|
@@ -1123,7 +1264,7 @@ export function parse(argv) {
|
|
|
1123
1264
|
publish: [2, 2],
|
|
1124
1265
|
get: [1, 1],
|
|
1125
1266
|
search: [1, 1],
|
|
1126
|
-
|
|
1267
|
+
"templates render": [2, 3],
|
|
1127
1268
|
build: [0, 1],
|
|
1128
1269
|
"bundle build": [1, 1],
|
|
1129
1270
|
"bundle inspect": [1, 1],
|
|
@@ -1136,6 +1277,10 @@ export function parse(argv) {
|
|
|
1136
1277
|
"register list": [0, 0],
|
|
1137
1278
|
"register set": [2, 2],
|
|
1138
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],
|
|
1139
1284
|
"config get": [0, 1],
|
|
1140
1285
|
"config set": [2, 2],
|
|
1141
1286
|
"config reset": [1, 1],
|
|
@@ -1162,9 +1307,8 @@ export function parse(argv) {
|
|
|
1162
1307
|
syntax(`Swarm target positionals are no longer supported. Use ipab --swarm URL_OR_ALIAS ${result.path} instead.`);
|
|
1163
1308
|
if (result.positional.length < minimum || result.positional.length > maximum)
|
|
1164
1309
|
syntax(`Invalid arguments.\n${help(result.path)}`);
|
|
1165
|
-
if (result.template
|
|
1166
|
-
(
|
|
1167
|
-
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.');
|
|
1168
1312
|
if (result.path === "history remove") {
|
|
1169
1313
|
const selected = values.some((value) => Object.hasOwn(result.options, value));
|
|
1170
1314
|
if ((!selected && !result.positional.length) ||
|
|
@@ -1187,6 +1331,15 @@ export function parse(argv) {
|
|
|
1187
1331
|
if (result.options.expect && result.options.snapshot)
|
|
1188
1332
|
syntax("--snapshot is initial-only and cannot be combined with --expect.");
|
|
1189
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.");
|
|
1342
|
+
}
|
|
1190
1343
|
if (result.path.startsWith("config ") && result.positional[0]) {
|
|
1191
1344
|
if (!(result.path === "config get" && result.positional[0] === "state-dir") &&
|
|
1192
1345
|
!(result.path === "config reset" && result.positional[0] === "store.rpc"))
|
|
@@ -1325,10 +1478,93 @@ async function performCli(argv, io, env) {
|
|
|
1325
1478
|
};
|
|
1326
1479
|
if (parsed.path === "open" || parsed.path.startsWith("register ")) {
|
|
1327
1480
|
if (state.legacyRegistrationCount)
|
|
1328
|
-
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. Review the archived values and explicitly run ipab register set TYPE_CID APP_CID --swarm URL_OR_ALIAS
|
|
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.`);
|
|
1329
1482
|
}
|
|
1330
1483
|
if (state.legacyPinCount)
|
|
1331
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
|
+
}
|
|
1332
1568
|
if (parsed.path.startsWith("register ")) {
|
|
1333
1569
|
const references = parsed.registrySwarms?.length
|
|
1334
1570
|
? parsed.registrySwarms
|
|
@@ -1336,7 +1572,7 @@ async function performCli(argv, io, env) {
|
|
|
1336
1572
|
? [selectedSwarm]
|
|
1337
1573
|
: [];
|
|
1338
1574
|
if (!references.length)
|
|
1339
|
-
throw new HostError("Register requires a selected Swarm. Pass --swarm URL_OR_ALIAS
|
|
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.");
|
|
1340
1576
|
const targets = [
|
|
1341
1577
|
...new Set(references.map((reference) => state.resolveSwarm(reference))),
|
|
1342
1578
|
];
|
|
@@ -1352,12 +1588,11 @@ async function performCli(argv, io, env) {
|
|
|
1352
1588
|
try {
|
|
1353
1589
|
if (parsed.path === "register list") {
|
|
1354
1590
|
const items = await swarmRegistrations(context, configUrl);
|
|
1591
|
+
const alias = state
|
|
1592
|
+
.swarms()
|
|
1593
|
+
.find((swarm) => swarm.cid === configUrl)?.alias;
|
|
1355
1594
|
results.push({ items });
|
|
1356
|
-
human.push(
|
|
1357
|
-
item.schemaCid,
|
|
1358
|
-
item.appCid,
|
|
1359
|
-
JSON.stringify(item.argv),
|
|
1360
|
-
]), "No associations.")}`);
|
|
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")}`);
|
|
1361
1596
|
}
|
|
1362
1597
|
else if (parsed.path === "register set") {
|
|
1363
1598
|
const appCid = parseNameReference(second)
|
|
@@ -1375,7 +1610,9 @@ async function performCli(argv, io, env) {
|
|
|
1375
1610
|
completed.push(configUrl);
|
|
1376
1611
|
}
|
|
1377
1612
|
catch (cause) {
|
|
1378
|
-
throw new HostError(
|
|
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");
|
|
1379
1616
|
}
|
|
1380
1617
|
finally {
|
|
1381
1618
|
await context.finishRead?.();
|
|
@@ -1461,6 +1698,8 @@ async function performCli(argv, io, env) {
|
|
|
1461
1698
|
case "swarm add":
|
|
1462
1699
|
case "swarm update":
|
|
1463
1700
|
case "search":
|
|
1701
|
+
case "skills list":
|
|
1702
|
+
case "skills sync":
|
|
1464
1703
|
case "swarm create":
|
|
1465
1704
|
case "swarm request":
|
|
1466
1705
|
case "swarm approve":
|
|
@@ -1476,6 +1715,35 @@ async function performCli(argv, io, env) {
|
|
|
1476
1715
|
store = new IpfsStore(await storeConfiguration(value("store.gateway")));
|
|
1477
1716
|
const context = swarmContext();
|
|
1478
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
|
+
}
|
|
1479
1747
|
if (parsed.path === "pin") {
|
|
1480
1748
|
io.err("Fetching, verifying and retaining content...");
|
|
1481
1749
|
const result = await pinNameSubscription(context, first, selectedSwarm);
|
|
@@ -1755,7 +2023,7 @@ async function performCli(argv, io, env) {
|
|
|
1755
2023
|
}
|
|
1756
2024
|
break;
|
|
1757
2025
|
}
|
|
1758
|
-
case "
|
|
2026
|
+
case "templates render":
|
|
1759
2027
|
case "build":
|
|
1760
2028
|
case "bundle build":
|
|
1761
2029
|
case "bundle inspect":
|
|
@@ -1791,34 +2059,73 @@ async function performCli(argv, io, env) {
|
|
|
1791
2059
|
const builtin = builtins.blocks.get(cid.toV1().toString());
|
|
1792
2060
|
if (builtin)
|
|
1793
2061
|
return builtin.slice();
|
|
1794
|
-
return (await getStore()).block.get(cid.toString(), options);
|
|
2062
|
+
return (store ?? (await getStore())).block.get(cid.toString(), options);
|
|
1795
2063
|
},
|
|
1796
2064
|
};
|
|
1797
2065
|
const builtinSource = first ? state.pin(first) : undefined;
|
|
1798
2066
|
const source = builtinSource?.builtin && builtinSource.metadata?.kind === "bundle"
|
|
1799
2067
|
? builtinSource.cid
|
|
1800
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
|
+
}
|
|
1801
2113
|
if (parsed.path === "bundle build" || parsed.path === "build")
|
|
1802
2114
|
io.err(parsed.path === "build"
|
|
1803
2115
|
? "Assembling and validating Bundle (no compilation)..."
|
|
1804
2116
|
: "Validating and building bundle...");
|
|
1805
2117
|
if (parsed.path === "bundle import")
|
|
1806
2118
|
io.err("Validating and importing CAR into Store...");
|
|
1807
|
-
const result = parsed.path === "
|
|
1808
|
-
? await initApp(
|
|
2119
|
+
const result = parsed.path === "templates render"
|
|
2120
|
+
? await initApp(second, parsed.positional[2], {
|
|
1809
2121
|
...request,
|
|
1810
|
-
...(
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
}
|
|
1818
|
-
: {}),
|
|
1819
|
-
...(parsed.parameters
|
|
1820
|
-
? { parameters: parsed.parameters }
|
|
1821
|
-
: {}),
|
|
2122
|
+
...(selectedTemplate ? { template: selectedTemplate } : {}),
|
|
2123
|
+
parameters: [
|
|
2124
|
+
...(parsed.parameters ?? []),
|
|
2125
|
+
...(typeof parsed.options.description === "string"
|
|
2126
|
+
? [`description=${parsed.options.description}`]
|
|
2127
|
+
: []),
|
|
2128
|
+
],
|
|
1822
2129
|
})
|
|
1823
2130
|
: parsed.path === "build"
|
|
1824
2131
|
? await assembleBundle(first, {
|
|
@@ -2116,7 +2423,9 @@ async function performCli(argv, io, env) {
|
|
|
2116
2423
|
if (!association)
|
|
2117
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.`);
|
|
2118
2425
|
appCid = association.appCid;
|
|
2119
|
-
|
|
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];
|
|
2120
2429
|
// execute owns the App/input context before this validation owner's eventual release.
|
|
2121
2430
|
const result = await execute(state, store, { origin: "open", appCid, argv: appArgv }, {
|
|
2122
2431
|
inputSchema: schema,
|