@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
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { encodeSchema, type BundleType } from "@ipab/bundle";
|
|
2
|
+
import { HostError, object } from "./errors.js";
|
|
3
|
+
import { relativePath } from "./space.js";
|
|
4
|
+
|
|
5
|
+
export const legacySwarmMetaType: BundleType = {
|
|
6
|
+
contentType: "application/json",
|
|
7
|
+
schema: {
|
|
8
|
+
type: "object",
|
|
9
|
+
required: ["templatePath", "registryPath"],
|
|
10
|
+
properties: {
|
|
11
|
+
templatePath: { type: "string", minLength: 1, maxLength: 196 },
|
|
12
|
+
registryPath: { type: "string", minLength: 1, maxLength: 196 },
|
|
13
|
+
},
|
|
14
|
+
additionalProperties: false,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export const swarmMetaType: BundleType = {
|
|
18
|
+
contentType: "application/json",
|
|
19
|
+
schema: {
|
|
20
|
+
type: "object",
|
|
21
|
+
additionalProperties: false,
|
|
22
|
+
required: ["templatePath", "registryPath", "skillPath"],
|
|
23
|
+
properties: {
|
|
24
|
+
templatePath: { type: "string", minLength: 1, maxLength: 196 },
|
|
25
|
+
registryPath: { type: "string", minLength: 1, maxLength: 196 },
|
|
26
|
+
skillPath: { type: "string", minLength: 1, maxLength: 196 },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export const swarmMetaSchema = await encodeSchema(swarmMetaType);
|
|
31
|
+
export const legacySwarmMetaSchema = await encodeSchema(legacySwarmMetaType);
|
|
32
|
+
export interface SwarmMeta {
|
|
33
|
+
templatePath: string;
|
|
34
|
+
registryPath: string;
|
|
35
|
+
skillPath?: string;
|
|
36
|
+
}
|
|
37
|
+
export const legacySwarmStateType: BundleType = {
|
|
38
|
+
contentType: "application/json",
|
|
39
|
+
schema: {
|
|
40
|
+
type: "object",
|
|
41
|
+
required: ["v", "templatePath", "registryPath", "names"],
|
|
42
|
+
properties: {
|
|
43
|
+
v: { const: 5 },
|
|
44
|
+
templatePath: { type: "string", minLength: 1, maxLength: 196 },
|
|
45
|
+
registryPath: { type: "string", minLength: 1, maxLength: 196 },
|
|
46
|
+
names: {
|
|
47
|
+
type: "object",
|
|
48
|
+
additionalProperties: { type: "string" },
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
additionalProperties: false,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
export const swarmStateType: BundleType = {
|
|
55
|
+
contentType: "application/json",
|
|
56
|
+
schema: {
|
|
57
|
+
type: "object",
|
|
58
|
+
required: ["v", "templatePath", "registryPath", "skillPath", "names"],
|
|
59
|
+
properties: {
|
|
60
|
+
v: { const: 5 },
|
|
61
|
+
templatePath: { type: "string", minLength: 1, maxLength: 196 },
|
|
62
|
+
registryPath: { type: "string", minLength: 1, maxLength: 196 },
|
|
63
|
+
skillPath: { type: "string", minLength: 1, maxLength: 196 },
|
|
64
|
+
names: { type: "object", additionalProperties: { type: "string" } },
|
|
65
|
+
},
|
|
66
|
+
additionalProperties: false,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
export const swarmStateSchema = await encodeSchema(swarmStateType);
|
|
70
|
+
export const legacySwarmStateSchema = await encodeSchema(legacySwarmStateType);
|
|
71
|
+
export function isSwarmStateSchema(cid: string): boolean {
|
|
72
|
+
return (
|
|
73
|
+
cid === swarmStateSchema.cid.toString() ||
|
|
74
|
+
cid === legacySwarmStateSchema.cid.toString()
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
export function parseSwarmMeta(value: unknown): SwarmMeta {
|
|
78
|
+
const data = object(value, "Swarm Meta");
|
|
79
|
+
if (
|
|
80
|
+
![
|
|
81
|
+
"registryPath,templatePath",
|
|
82
|
+
"registryPath,skillPath,templatePath",
|
|
83
|
+
].includes(Object.keys(data).sort().join()) ||
|
|
84
|
+
typeof data.templatePath !== "string" ||
|
|
85
|
+
typeof data.registryPath !== "string" ||
|
|
86
|
+
("skillPath" in data && typeof data.skillPath !== "string")
|
|
87
|
+
)
|
|
88
|
+
throw new HostError(
|
|
89
|
+
"Swarm Meta requires templatePath, registryPath and (for the new exact type) skillPath.",
|
|
90
|
+
);
|
|
91
|
+
for (const path of [
|
|
92
|
+
data.templatePath,
|
|
93
|
+
data.registryPath,
|
|
94
|
+
...(typeof data.skillPath === "string" ? [data.skillPath] : []),
|
|
95
|
+
]) {
|
|
96
|
+
relativePath(path);
|
|
97
|
+
if (path.length > 196 || path.includes(":"))
|
|
98
|
+
throw new HostError(
|
|
99
|
+
"Swarm Meta paths must be current-Swarm ordinary Name prefixes of at most 196 characters, not URIs.",
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
templatePath: data.templatePath,
|
|
104
|
+
registryPath: data.registryPath,
|
|
105
|
+
...(typeof data.skillPath === "string"
|
|
106
|
+
? { skillPath: data.skillPath }
|
|
107
|
+
: {}),
|
|
108
|
+
};
|
|
109
|
+
}
|