@dual-os/cli 0.0.0-stage → 0.11.0
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/LICENSE +4 -0
- package/README.md +15 -2
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/auth/credentials.d.ts +17 -0
- package/dist/auth/credentials.d.ts.map +1 -0
- package/dist/auth/credentials.js +57 -0
- package/dist/auth/credentials.js.map +1 -0
- package/dist/auth/destination.d.ts +22 -0
- package/dist/auth/destination.d.ts.map +1 -0
- package/dist/auth/destination.js +49 -0
- package/dist/auth/destination.js.map +1 -0
- package/dist/auth/http.d.ts +12 -0
- package/dist/auth/http.d.ts.map +1 -0
- package/dist/auth/http.js +34 -0
- package/dist/auth/http.js.map +1 -0
- package/dist/auth/login.d.ts +22 -0
- package/dist/auth/login.d.ts.map +1 -0
- package/dist/auth/login.js +98 -0
- package/dist/auth/login.js.map +1 -0
- package/dist/auth/protocol.d.ts +26 -0
- package/dist/auth/protocol.d.ts.map +1 -0
- package/dist/auth/protocol.js +31 -0
- package/dist/auth/protocol.js.map +1 -0
- package/dist/baseline.d.ts +18 -0
- package/dist/baseline.d.ts.map +1 -0
- package/dist/baseline.js +22 -0
- package/dist/baseline.js.map +1 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +7 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.d.ts +19 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +492 -0
- package/dist/cli.js.map +1 -0
- package/dist/create/choices.d.ts +58 -0
- package/dist/create/choices.d.ts.map +1 -0
- package/dist/create/choices.js +121 -0
- package/dist/create/choices.js.map +1 -0
- package/dist/create/deployment.d.ts +48 -0
- package/dist/create/deployment.d.ts.map +1 -0
- package/dist/create/deployment.js +66 -0
- package/dist/create/deployment.js.map +1 -0
- package/dist/create/scaffold.d.ts +57 -0
- package/dist/create/scaffold.d.ts.map +1 -0
- package/dist/create/scaffold.js +198 -0
- package/dist/create/scaffold.js.map +1 -0
- package/dist/create/source-reference.d.ts +39 -0
- package/dist/create/source-reference.d.ts.map +1 -0
- package/dist/create/source-reference.js +185 -0
- package/dist/create/source-reference.js.map +1 -0
- package/dist/create/template.d.ts +116 -0
- package/dist/create/template.d.ts.map +1 -0
- package/dist/create/template.js +211 -0
- package/dist/create/template.js.map +1 -0
- package/dist/diagnostics.d.ts +6 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +18 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/help.d.ts +16 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +73 -0
- package/dist/help.js.map +1 -0
- package/dist/openapi/bundle.d.ts +18 -0
- package/dist/openapi/bundle.d.ts.map +1 -0
- package/dist/openapi/bundle.js +201 -0
- package/dist/openapi/bundle.js.map +1 -0
- package/dist/openapi/discovery.d.ts +30 -0
- package/dist/openapi/discovery.d.ts.map +1 -0
- package/dist/openapi/discovery.js +325 -0
- package/dist/openapi/discovery.js.map +1 -0
- package/dist/openapi/emit.d.ts +52 -0
- package/dist/openapi/emit.d.ts.map +1 -0
- package/dist/openapi/emit.js +596 -0
- package/dist/openapi/emit.js.map +1 -0
- package/dist/openapi/graphql.d.ts +102 -0
- package/dist/openapi/graphql.d.ts.map +1 -0
- package/dist/openapi/graphql.js +294 -0
- package/dist/openapi/graphql.js.map +1 -0
- package/dist/openapi/identity.d.ts +88 -0
- package/dist/openapi/identity.d.ts.map +1 -0
- package/dist/openapi/identity.js +98 -0
- package/dist/openapi/identity.js.map +1 -0
- package/dist/openapi/mcp.d.ts +21 -0
- package/dist/openapi/mcp.d.ts.map +1 -0
- package/dist/openapi/mcp.js +133 -0
- package/dist/openapi/mcp.js.map +1 -0
- package/dist/openapi/operations.d.ts +165 -0
- package/dist/openapi/operations.d.ts.map +1 -0
- package/dist/openapi/operations.js +361 -0
- package/dist/openapi/operations.js.map +1 -0
- package/dist/openapi/overlay.d.ts +23 -0
- package/dist/openapi/overlay.d.ts.map +1 -0
- package/dist/openapi/overlay.js +115 -0
- package/dist/openapi/overlay.js.map +1 -0
- package/dist/openapi/plugin.d.ts +83 -0
- package/dist/openapi/plugin.d.ts.map +1 -0
- package/dist/openapi/plugin.js +468 -0
- package/dist/openapi/plugin.js.map +1 -0
- package/dist/openapi/polymorphism.d.ts +21 -0
- package/dist/openapi/polymorphism.d.ts.map +1 -0
- package/dist/openapi/polymorphism.js +96 -0
- package/dist/openapi/polymorphism.js.map +1 -0
- package/dist/openapi/postman.d.ts +21 -0
- package/dist/openapi/postman.d.ts.map +1 -0
- package/dist/openapi/postman.js +286 -0
- package/dist/openapi/postman.js.map +1 -0
- package/dist/openapi/schema.d.ts +178 -0
- package/dist/openapi/schema.d.ts.map +1 -0
- package/dist/openapi/schema.js +1234 -0
- package/dist/openapi/schema.js.map +1 -0
- package/dist/openapi/select.d.ts +22 -0
- package/dist/openapi/select.d.ts.map +1 -0
- package/dist/openapi/select.js +79 -0
- package/dist/openapi/select.js.map +1 -0
- package/dist/openapi/spec.d.ts +147 -0
- package/dist/openapi/spec.d.ts.map +1 -0
- package/dist/openapi/spec.js +263 -0
- package/dist/openapi/spec.js.map +1 -0
- package/dist/openapi/swagger.d.ts +166 -0
- package/dist/openapi/swagger.d.ts.map +1 -0
- package/dist/openapi/swagger.js +298 -0
- package/dist/openapi/swagger.js.map +1 -0
- package/dist/openapi/versions.d.ts +52 -0
- package/dist/openapi/versions.d.ts.map +1 -0
- package/dist/openapi/versions.js +120 -0
- package/dist/openapi/versions.js.map +1 -0
- package/dist/plugin/archive.d.ts +27 -0
- package/dist/plugin/archive.d.ts.map +1 -0
- package/dist/plugin/archive.js +170 -0
- package/dist/plugin/archive.js.map +1 -0
- package/dist/plugin/bundle.d.ts +27 -0
- package/dist/plugin/bundle.d.ts.map +1 -0
- package/dist/plugin/bundle.js +328 -0
- package/dist/plugin/bundle.js.map +1 -0
- package/dist/plugin/init.d.ts +18 -0
- package/dist/plugin/init.d.ts.map +1 -0
- package/dist/plugin/init.js +121 -0
- package/dist/plugin/init.js.map +1 -0
- package/dist/plugin/inspection.d.ts +24 -0
- package/dist/plugin/inspection.d.ts.map +1 -0
- package/dist/plugin/inspection.js +24 -0
- package/dist/plugin/inspection.js.map +1 -0
- package/dist/plugin/package.d.ts +26 -0
- package/dist/plugin/package.d.ts.map +1 -0
- package/dist/plugin/package.js +73 -0
- package/dist/plugin/package.js.map +1 -0
- package/dist/plugin/publication.d.ts +29 -0
- package/dist/plugin/publication.d.ts.map +1 -0
- package/dist/plugin/publication.js +65 -0
- package/dist/plugin/publication.js.map +1 -0
- package/dist/plugin/validation.d.ts +15 -0
- package/dist/plugin/validation.d.ts.map +1 -0
- package/dist/plugin/validation.js +119 -0
- package/dist/plugin/validation.js.map +1 -0
- package/dist/release/archives.d.ts +33 -0
- package/dist/release/archives.d.ts.map +1 -0
- package/dist/release/archives.js +81 -0
- package/dist/release/archives.js.map +1 -0
- package/dist/release/release-manifest.d.ts +182 -0
- package/dist/release/release-manifest.d.ts.map +1 -0
- package/dist/release/release-manifest.js +79 -0
- package/dist/release/release-manifest.js.map +1 -0
- package/dist/release/releases.d.ts +36 -0
- package/dist/release/releases.d.ts.map +1 -0
- package/dist/release/releases.js +122 -0
- package/dist/release/releases.js.map +1 -0
- package/dist/skills.d.ts +35 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +257 -0
- package/dist/skills.js.map +1 -0
- package/package.json +73 -4
- package/skills/dual-fde/SKILL.md +38 -0
- package/skills/dual-fde/references/access.md +62 -0
- package/skills/dual-fde/references/author-plugins.md +54 -0
- package/skills/dual-fde/references/cli.md +97 -0
- package/skills/dual-fde/references/manage-plugins.md +78 -0
- package/skills/dual-fde/references/migrations-deployment.md +84 -0
- package/skills/dual-fde/references/openapi-plugins.md +47 -0
- package/skills/dual-fde/references/sdk-docs.md +56 -0
- package/skills/dual-fde/references/upgrades.md +115 -0
- package/skills/dual-fde/references/working-context.md +69 -0
- package/src/auth/credentials.ts +84 -0
- package/src/auth/destination.ts +83 -0
- package/src/auth/http.ts +39 -0
- package/src/auth/login.ts +177 -0
- package/src/auth/protocol.ts +37 -0
- package/src/baseline.ts +15 -0
- package/src/bin.ts +4 -0
- package/src/cli.ts +969 -0
- package/src/create/choices.ts +177 -0
- package/src/create/deployment.ts +96 -0
- package/src/create/scaffold.ts +334 -0
- package/src/create/source-reference.ts +212 -0
- package/src/create/template.ts +300 -0
- package/src/diagnostics.ts +8 -0
- package/src/help.ts +142 -0
- package/src/openapi/bundle.ts +290 -0
- package/src/openapi/discovery.ts +438 -0
- package/src/openapi/emit.ts +1031 -0
- package/src/openapi/graphql.ts +375 -0
- package/src/openapi/identity.ts +153 -0
- package/src/openapi/mcp.ts +165 -0
- package/src/openapi/operations.ts +781 -0
- package/src/openapi/overlay.ts +195 -0
- package/src/openapi/plugin.ts +856 -0
- package/src/openapi/polymorphism.ts +207 -0
- package/src/openapi/postman.ts +403 -0
- package/src/openapi/schema.ts +2138 -0
- package/src/openapi/select.ts +113 -0
- package/src/openapi/spec.ts +401 -0
- package/src/openapi/swagger.ts +422 -0
- package/src/openapi/versions.ts +174 -0
- package/src/plugin/archive.ts +244 -0
- package/src/plugin/bundle.ts +572 -0
- package/src/plugin/init.ts +178 -0
- package/src/plugin/inspection.ts +19 -0
- package/src/plugin/package.ts +140 -0
- package/src/plugin/publication.ts +128 -0
- package/src/plugin/validation.ts +213 -0
- package/src/release/archives.ts +133 -0
- package/src/release/release-manifest.ts +79 -0
- package/src/release/releases.ts +210 -0
- package/src/skills.ts +434 -0
- package/templates/compose/.env.compose.example.hbs +3 -0
- package/templates/compose/.env.host.example.hbs +4 -0
- package/templates/compose/Dockerfile.hbs +12 -0
- package/templates/compose/OPERATIONS.md.hbs +159 -0
- package/templates/compose/_dockerignore +14 -0
- package/templates/compose/compose.external.yaml +7 -0
- package/templates/compose/compose.host-linux.yaml +5 -0
- package/templates/compose/compose.host.yaml.hbs +15 -0
- package/templates/compose/compose.yaml.hbs +85 -0
- package/templates/compose/release.env.hbs +2 -0
- package/templates/default/.env.example.hbs +79 -0
- package/templates/default/README.md.hbs +150 -0
- package/templates/default/_gitignore +11 -0
- package/templates/default/packages/customer-plugin/src/Customer.ts.hbs +17 -0
- package/templates/default/packages/customer-plugin/tsconfig.json +15 -0
- package/templates/default/packages/execution-layer/src/App.ts.hbs +7 -0
- package/templates/default/packages/execution-layer/src/Host.ts.hbs +31 -0
- package/templates/default/packages/execution-layer/src/Telemetry.ts.hbs +23 -0
- package/templates/default/packages/execution-layer/src/api.ts.hbs +21 -0
- package/templates/default/packages/execution-layer/src/bootstrap.ts +22 -0
- package/templates/default/packages/execution-layer/src/migrate.ts +11 -0
- package/templates/default/packages/execution-layer/src/registry-check.ts +29 -0
- package/templates/default/packages/execution-layer/src/registry-sync.ts +14 -0
- package/templates/default/packages/execution-layer/src/worker.ts.hbs +16 -0
- package/templates/default/packages/execution-layer/test/app.host-test.ts.hbs +58 -0
- package/templates/default/packages/execution-layer/test/app.test.ts.hbs +16 -0
- package/templates/default/tsconfig.json +5 -0
- package/templates/default/vitest.config.ts +5 -0
- package/templates/default/vitest.host.config.ts +6 -0
- package/templates/opensandbox/OPEN-SANDBOX.md +25 -0
- package/templates/opensandbox/docker/agent-sandbox.Dockerfile +41 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { Service as Service$1, layer as layer$1, read } from "./archives.js";
|
|
3
|
+
import { ExactVersion, ReadableManifest, Selection, Version as Version$1, packageName as packageName$1 } from "./release-manifest.js";
|
|
4
|
+
import "./releases.js";
|
|
5
|
+
import { Array, Context, Effect, FileSystem, Layer, Order, Redacted, Schema, Stream, String } from "effect";
|
|
6
|
+
import { tmpdir } from "node:os";
|
|
7
|
+
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
8
|
+
import semver from "semver";
|
|
9
|
+
import { join } from "node:path";
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
11
|
+
import { isDeepStrictEqual } from "node:util";
|
|
12
|
+
// src/release/releases.ts
|
|
13
|
+
var releases_exports = /* @__PURE__ */ __exportAll({
|
|
14
|
+
CoreSelector: () => CoreSelector,
|
|
15
|
+
ReleaseError: () => ReleaseError,
|
|
16
|
+
Releases: () => releases_exports,
|
|
17
|
+
Request: () => Request,
|
|
18
|
+
Selector: () => Selector,
|
|
19
|
+
Service: () => Service,
|
|
20
|
+
Version: () => Version,
|
|
21
|
+
layer: () => layer,
|
|
22
|
+
packageName: () => packageName
|
|
23
|
+
});
|
|
24
|
+
const packageName = packageName$1;
|
|
25
|
+
const Version = Version$1;
|
|
26
|
+
const CoreSelector = Schema.Union([Schema.Literal("latest"), ExactVersion]);
|
|
27
|
+
const Selector = CoreSelector;
|
|
28
|
+
const Request = Schema.Union([Schema.Struct({
|
|
29
|
+
core: CoreSelector,
|
|
30
|
+
manifest: Schema.optionalKey(Schema.Never)
|
|
31
|
+
}), Schema.Struct({
|
|
32
|
+
core: Schema.optionalKey(Schema.Never),
|
|
33
|
+
manifest: Version
|
|
34
|
+
})]);
|
|
35
|
+
const Metadata = Schema.Struct({
|
|
36
|
+
bin: Schema.optionalKey(Schema.Never),
|
|
37
|
+
bundleDependencies: Schema.optionalKey(Schema.Array(Schema.Never)),
|
|
38
|
+
bundledDependencies: Schema.optionalKey(Schema.Array(Schema.Never)),
|
|
39
|
+
dependencies: Schema.optionalKey(Schema.Record(Schema.String, Schema.Never)),
|
|
40
|
+
devDependencies: Schema.optionalKey(Schema.Record(Schema.String, Schema.Never)),
|
|
41
|
+
dualRelease: Schema.optionalKey(Schema.Unknown),
|
|
42
|
+
files: Schema.Tuple([Schema.Literal("release.json")]),
|
|
43
|
+
name: Schema.Literal(packageName),
|
|
44
|
+
optionalDependencies: Schema.optionalKey(Schema.Record(Schema.String, Schema.Never)),
|
|
45
|
+
peerDependencies: Schema.optionalKey(Schema.Record(Schema.String, Schema.Never)),
|
|
46
|
+
scripts: Schema.optionalKey(Schema.Record(Schema.String, Schema.Never)),
|
|
47
|
+
version: Version
|
|
48
|
+
});
|
|
49
|
+
var ReleaseError = class extends Schema.TaggedError()("ReleaseError", { cause: Schema.Redacted(Schema.Defect()) }) {};
|
|
50
|
+
const failure = (cause) => new ReleaseError({ cause: Redacted.make(cause) });
|
|
51
|
+
var Service = class extends Context.Service()("@dual-os/cli/Releases") {};
|
|
52
|
+
const layer = Layer.effect(Service, Effect.gen(function* () {
|
|
53
|
+
const archives = yield* Service$1;
|
|
54
|
+
const fs = yield* FileSystem.FileSystem;
|
|
55
|
+
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
56
|
+
const resolve = Effect.fn("Releases.resolve")(function* (input, compatibility) {
|
|
57
|
+
const request = yield* Schema.decodeUnknownEffect(Request, { onExcessProperty: "error" })(input);
|
|
58
|
+
const cwd = yield* fs.makeTempDirectoryScoped({
|
|
59
|
+
directory: tmpdir(),
|
|
60
|
+
prefix: "dual-releases-"
|
|
61
|
+
});
|
|
62
|
+
yield* fs.writeFileString(join(cwd, "package.json"), "{\"private\":true}\n");
|
|
63
|
+
const view = Effect.fn("Releases.view")(function* () {
|
|
64
|
+
const handle = yield* spawner.spawn(ChildProcess.make("npm", [
|
|
65
|
+
"view",
|
|
66
|
+
`${packageName}@>=0.0.0`,
|
|
67
|
+
"version",
|
|
68
|
+
"--json",
|
|
69
|
+
"--cache",
|
|
70
|
+
join(cwd, "cache"),
|
|
71
|
+
"--prefer-online",
|
|
72
|
+
"--fetch-retries=0"
|
|
73
|
+
], {
|
|
74
|
+
cwd,
|
|
75
|
+
stderr: "ignore",
|
|
76
|
+
stdin: "ignore",
|
|
77
|
+
stdout: "pipe"
|
|
78
|
+
}));
|
|
79
|
+
const output = yield* Stream.mkString(Stream.decodeText(handle.stdout));
|
|
80
|
+
if ((yield* handle.exitCode) !== 0) return yield* failure("Manifest unavailable; check external npm registry credentials and release activation");
|
|
81
|
+
return output;
|
|
82
|
+
});
|
|
83
|
+
const enumerated = request.manifest === void 0 ? yield* Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Union([Version, Schema.Array(Version).check(Schema.isMinLength(1))])))(yield* view()) : [request.manifest];
|
|
84
|
+
const versions = typeof enumerated === "string" ? [enumerated] : enumerated;
|
|
85
|
+
for (const version of Array.sortWith([...new Set(versions)], (version) => BigInt(String.slice(4)(version)), Order.flip(Order.BigInt))) {
|
|
86
|
+
const directory = join(cwd, version);
|
|
87
|
+
yield* fs.makeDirectory(directory);
|
|
88
|
+
const archive = yield* archives.pack(`${packageName}@${version}`, directory);
|
|
89
|
+
const bytes = yield* fs.readFile(join(directory, archive.filename));
|
|
90
|
+
const integrity = `sha512-${createHash("sha512").update(bytes).digest("base64")}`;
|
|
91
|
+
const { documents } = yield* read(bytes, ["package/package.json", "package/release.json"]);
|
|
92
|
+
const metadata = yield* Schema.decodeUnknownEffect(Schema.fromJsonString(Metadata))(documents["package/package.json"]);
|
|
93
|
+
if (metadata.dualRelease !== void 0) yield* Schema.decodeUnknownEffect(ReadableManifest, { onExcessProperty: "error" })(metadata.dualRelease);
|
|
94
|
+
const manifest = yield* Schema.decodeUnknownEffect(Schema.fromJsonString(ReadableManifest), { onExcessProperty: "error" })(documents["package/release.json"]);
|
|
95
|
+
if (metadata.version !== version || manifest.version !== version || metadata.dualRelease !== void 0 && !isDeepStrictEqual(metadata.dualRelease, manifest)) return yield* failure("Manifest identity or metadata mismatch");
|
|
96
|
+
if (request.core !== void 0 && request.core !== "latest" && manifest.packages["@dual/core"] !== request.core) continue;
|
|
97
|
+
if (compatibility === void 0 || manifest.compatibility.template === compatibility.template && semver.satisfies(compatibility.cli, manifest.compatibility.cli)) return {
|
|
98
|
+
integrity,
|
|
99
|
+
manifest
|
|
100
|
+
};
|
|
101
|
+
if (request.manifest !== void 0) return yield* failure("Exact release is incompatible with this CLI/template");
|
|
102
|
+
}
|
|
103
|
+
return yield* failure("No completed release matches the requested core and compatibility");
|
|
104
|
+
}, Effect.scoped, Effect.timeout("60 seconds"), Effect.mapError(failure));
|
|
105
|
+
const resolveForCreate = Effect.fn("Releases.resolveForCreate")(function* (request, compatibility) {
|
|
106
|
+
return yield* Schema.decodeUnknownEffect(Selection)(yield* resolve(request, compatibility)).pipe(Effect.mapError(() => failure("This release predates @deslop/coding-standards; create it with the CLI it names")));
|
|
107
|
+
});
|
|
108
|
+
const verify = Effect.fn("Releases.verify")(function* (input) {
|
|
109
|
+
const selection = yield* Schema.decodeUnknownEffect(Selection, { onExcessProperty: "error" })(input).pipe(Effect.mapError(failure));
|
|
110
|
+
const actual = yield* resolve({ manifest: selection.manifest.version });
|
|
111
|
+
if (!isDeepStrictEqual(actual, selection)) return yield* failure("Exact release archive integrity or manifest changed");
|
|
112
|
+
return selection;
|
|
113
|
+
});
|
|
114
|
+
return Service.of({
|
|
115
|
+
resolve: (request) => resolve(request),
|
|
116
|
+
resolveForCreate,
|
|
117
|
+
verify
|
|
118
|
+
});
|
|
119
|
+
})).pipe(Layer.provide(layer$1));
|
|
120
|
+
export { CoreSelector, ReleaseError, releases_exports as Releases, Request, Selector, Service, Version, layer, packageName };
|
|
121
|
+
|
|
122
|
+
//# sourceMappingURL=releases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"releases.js","names":["ReleaseManifest.packageName","ReleaseManifest.Version","ReleaseManifest.ExactVersion","Archives.Service","Archives.read","ReleaseManifest.ReadableManifest","ReleaseManifest.Selection","Archives.layer"],"sources":["../../src/release/releases.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { isDeepStrictEqual } from \"node:util\";\n\nimport {\n Array,\n Context,\n Effect,\n FileSystem,\n Layer,\n Order,\n Redacted,\n Schema,\n Stream,\n String,\n} from \"effect\";\n\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\nimport semver from \"semver\";\n\nimport { Archives } from \"./archives.ts\";\nimport { ReleaseManifest } from \"./release-manifest.ts\";\n\nexport const packageName = ReleaseManifest.packageName;\nexport const Version = ReleaseManifest.Version;\nexport const CoreSelector = Schema.Union([Schema.Literal(\"latest\"), ReleaseManifest.ExactVersion]);\nexport const Selector = CoreSelector;\nexport const Request = Schema.Union([\n Schema.Struct({ core: CoreSelector, manifest: Schema.optionalKey(Schema.Never) }),\n Schema.Struct({ core: Schema.optionalKey(Schema.Never), manifest: Version }),\n]);\nexport type Request = typeof Request.Type;\nconst Metadata = Schema.Struct({\n bin: Schema.optionalKey(Schema.Never),\n bundleDependencies: Schema.optionalKey(Schema.Array(Schema.Never)),\n bundledDependencies: Schema.optionalKey(Schema.Array(Schema.Never)),\n dependencies: Schema.optionalKey(Schema.Record(Schema.String, Schema.Never)),\n devDependencies: Schema.optionalKey(Schema.Record(Schema.String, Schema.Never)),\n dualRelease: Schema.optionalKey(Schema.Unknown),\n files: Schema.Tuple([Schema.Literal(\"release.json\")]),\n name: Schema.Literal(packageName),\n optionalDependencies: Schema.optionalKey(Schema.Record(Schema.String, Schema.Never)),\n peerDependencies: Schema.optionalKey(Schema.Record(Schema.String, Schema.Never)),\n scripts: Schema.optionalKey(Schema.Record(Schema.String, Schema.Never)),\n version: Version,\n});\nexport class ReleaseError extends Schema.TaggedError<ReleaseError>()(\"ReleaseError\", {\n cause: Schema.Redacted(Schema.Defect()),\n}) {}\nconst failure = (cause: unknown) => new ReleaseError({ cause: Redacted.make(cause) });\nexport type Interface = {\n readonly resolve: (\n request: Request,\n ) => Effect.Effect<ReleaseManifest.ReadableSelection, ReleaseError>;\n readonly resolveForCreate: (\n request: Request,\n compatibility: { readonly cli: string; readonly template: string },\n ) => Effect.Effect<ReleaseManifest.Selection, ReleaseError>;\n readonly verify: (\n selection: ReleaseManifest.Selection,\n ) => Effect.Effect<ReleaseManifest.Selection, ReleaseError>;\n};\nexport class Service extends Context.Service<Service, Interface>()(\"@dual-os/cli/Releases\") {}\nexport const layer = Layer.effect(\n Service,\n Effect.gen(function* () {\n const archives = yield* Archives.Service;\n const fs = yield* FileSystem.FileSystem;\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const resolve = Effect.fn(\"Releases.resolve\")(\n function* (\n input: Request,\n compatibility?: { readonly cli: string; readonly template: string },\n ) {\n const request = yield* Schema.decodeUnknownEffect(Request, { onExcessProperty: \"error\" })(\n input,\n );\n const cwd = yield* fs.makeTempDirectoryScoped({\n directory: tmpdir(),\n prefix: \"dual-releases-\",\n });\n yield* fs.writeFileString(join(cwd, \"package.json\"), '{\"private\":true}\\n');\n const view = Effect.fn(\"Releases.view\")(function* () {\n const handle = yield* spawner.spawn(\n ChildProcess.make(\n \"npm\",\n [\n \"view\",\n `${packageName}@>=0.0.0`,\n \"version\",\n \"--json\",\n \"--cache\",\n join(cwd, \"cache\"),\n \"--prefer-online\",\n \"--fetch-retries=0\",\n ],\n { cwd, stderr: \"ignore\", stdin: \"ignore\", stdout: \"pipe\" },\n ),\n );\n const output = yield* Stream.mkString(Stream.decodeText(handle.stdout));\n if ((yield* handle.exitCode) !== 0) {\n return yield* failure(\n \"Manifest unavailable; check external npm registry credentials and release activation\",\n );\n }\n return output;\n });\n // Range enumeration ignores mutable/default dist-tags, including latest.\n const enumerated =\n request.manifest === undefined\n ? yield* Schema.decodeUnknownEffect(\n Schema.fromJsonString(\n Schema.Union([Version, Schema.Array(Version).check(Schema.isMinLength(1))]),\n ),\n )(yield* view())\n : [request.manifest];\n const versions = typeof enumerated === \"string\" ? [enumerated] : enumerated;\n for (const version of Array.sortWith(\n [...new Set(versions)],\n version => BigInt(String.slice(4)(version)),\n Order.flip(Order.BigInt),\n )) {\n const directory = join(cwd, version);\n yield* fs.makeDirectory(directory);\n const archive = yield* archives.pack(`${packageName}@${version}`, directory);\n const bytes = yield* fs.readFile(join(directory, archive.filename));\n // Hash actual downloaded archive bytes, never trust registry integrity metadata.\n const integrity = `sha512-${createHash(\"sha512\").update(bytes).digest(\"base64\")}`;\n const { documents } = yield* Archives.read(bytes, [\n \"package/package.json\",\n \"package/release.json\",\n ]);\n const metadata = yield* Schema.decodeUnknownEffect(Schema.fromJsonString(Metadata))(\n documents[\"package/package.json\"],\n );\n if (metadata.dualRelease !== undefined) {\n yield* Schema.decodeUnknownEffect(ReleaseManifest.ReadableManifest, {\n onExcessProperty: \"error\",\n })(metadata.dualRelease);\n }\n const manifest = yield* Schema.decodeUnknownEffect(\n Schema.fromJsonString(ReleaseManifest.ReadableManifest),\n { onExcessProperty: \"error\" },\n )(documents[\"package/release.json\"]);\n if (\n metadata.version !== version ||\n manifest.version !== version ||\n (metadata.dualRelease !== undefined &&\n !isDeepStrictEqual(metadata.dualRelease, manifest))\n ) {\n return yield* failure(\"Manifest identity or metadata mismatch\");\n }\n // Validate archive and identity before filtering; malformed candidates fail closed.\n if (\n request.core !== undefined &&\n request.core !== \"latest\" &&\n manifest.packages[\"@dual/core\"] !== request.core\n ) {\n continue;\n }\n if (\n compatibility === undefined ||\n (manifest.compatibility.template === compatibility.template &&\n semver.satisfies(compatibility.cli, manifest.compatibility.cli))\n ) {\n return { integrity, manifest };\n }\n // Core discovery may skip valid incompatible snapshots of the SAME core.\n // An explicit manifest is exact and never substitutes.\n if (request.manifest !== undefined) {\n return yield* failure(\"Exact release is incompatible with this CLI/template\");\n }\n }\n return yield* failure(\"No completed release matches the requested core and compatibility\");\n },\n Effect.scoped,\n Effect.timeout(\"60 seconds\"),\n Effect.mapError(failure),\n );\n // Repositories come only from current releases; an older one names the CLI that creates it.\n const resolveForCreate = Effect.fn(\"Releases.resolveForCreate\")(function* (\n request: Request,\n compatibility: { readonly cli: string; readonly template: string },\n ) {\n return yield* Schema.decodeUnknownEffect(ReleaseManifest.Selection)(\n yield* resolve(request, compatibility),\n ).pipe(\n Effect.mapError(() =>\n failure(\n \"This release predates @deslop/coding-standards; create it with the CLI it names\",\n ),\n ),\n );\n });\n const verify = Effect.fn(\"Releases.verify\")(function* (input: ReleaseManifest.Selection) {\n const selection = yield* Schema.decodeUnknownEffect(ReleaseManifest.Selection, {\n onExcessProperty: \"error\",\n })(input).pipe(Effect.mapError(failure));\n const actual = yield* resolve({ manifest: selection.manifest.version });\n if (!isDeepStrictEqual(actual, selection)) {\n return yield* failure(\"Exact release archive integrity or manifest changed\");\n }\n return selection;\n });\n return Service.of({ resolve: request => resolve(request), resolveForCreate, verify });\n }),\n).pipe(Layer.provide(Archives.layer));\n\nexport * as Releases from \"./releases.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,cAAcA;AAC3B,MAAa,UAAUC;AACvB,MAAa,eAAe,OAAO,MAAM,CAAC,OAAO,QAAQ,QAAQ,GAAGC,YAA4B,CAAC;AACjG,MAAa,WAAW;AACxB,MAAa,UAAU,OAAO,MAAM,CAClC,OAAO,OAAO;CAAE,MAAM;CAAc,UAAU,OAAO,YAAY,OAAO,KAAK;AAAE,CAAC,GAChF,OAAO,OAAO;CAAE,MAAM,OAAO,YAAY,OAAO,KAAK;CAAG,UAAU;AAAQ,CAAC,CAC7E,CAAC;AAED,MAAM,WAAW,OAAO,OAAO;CAC7B,KAAK,OAAO,YAAY,OAAO,KAAK;CACpC,oBAAoB,OAAO,YAAY,OAAO,MAAM,OAAO,KAAK,CAAC;CACjE,qBAAqB,OAAO,YAAY,OAAO,MAAM,OAAO,KAAK,CAAC;CAClE,cAAc,OAAO,YAAY,OAAO,OAAO,OAAO,QAAQ,OAAO,KAAK,CAAC;CAC3E,iBAAiB,OAAO,YAAY,OAAO,OAAO,OAAO,QAAQ,OAAO,KAAK,CAAC;CAC9E,aAAa,OAAO,YAAY,OAAO,OAAO;CAC9C,OAAO,OAAO,MAAM,CAAC,OAAO,QAAQ,cAAc,CAAC,CAAC;CACpD,MAAM,OAAO,QAAQ,WAAW;CAChC,sBAAsB,OAAO,YAAY,OAAO,OAAO,OAAO,QAAQ,OAAO,KAAK,CAAC;CACnF,kBAAkB,OAAO,YAAY,OAAO,OAAO,OAAO,QAAQ,OAAO,KAAK,CAAC;CAC/E,SAAS,OAAO,YAAY,OAAO,OAAO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layer, Schema, Stdio } from "effect";
|
|
3
|
+
import { Command } from "effect/cli";
|
|
4
|
+
import { ChildProcessSpawner } from "effect/process";
|
|
5
|
+
declare namespace skills_d_exports {
|
|
6
|
+
export { Interface, Service, skills_d_exports as Skills, SkillsError, command, layer };
|
|
7
|
+
}
|
|
8
|
+
declare const Read: Schema.Struct<{
|
|
9
|
+
readonly full: Schema.Boolean;
|
|
10
|
+
readonly reference: Schema.optional<Schema.Literals<readonly ["access", "author-plugins", "cli", "manage-plugins", "migrations-deployment", "openapi-plugins", "sdk-docs", "upgrades", "working-context"]>>;
|
|
11
|
+
}>;
|
|
12
|
+
declare const Install: Schema.Struct<{
|
|
13
|
+
readonly agents: Schema.$Array<Schema.String>;
|
|
14
|
+
readonly global: Schema.Boolean;
|
|
15
|
+
/** User scope root, also the installer's HOME. */
|
|
16
|
+
readonly home: Schema.NonEmptyString;
|
|
17
|
+
/** Project scope root and installer working directory. */
|
|
18
|
+
readonly project: Schema.NonEmptyString;
|
|
19
|
+
readonly yes: Schema.Boolean;
|
|
20
|
+
}>;
|
|
21
|
+
declare const SkillsError_base: Schema.Class<SkillsError, Schema.TaggedStruct<"SkillsError", {
|
|
22
|
+
readonly cause: Schema.optional<Schema.Defect>;
|
|
23
|
+
readonly message: Schema.String;
|
|
24
|
+
}>, import("effect/Cause").YieldableError>;
|
|
25
|
+
export declare class SkillsError extends SkillsError_base {}
|
|
26
|
+
export type Interface = {
|
|
27
|
+
readonly get: (options: typeof Read.Type) => Effect.Effect<string, SkillsError>;
|
|
28
|
+
readonly install: (options: typeof Install.Type) => Effect.Effect<void, SkillsError>;
|
|
29
|
+
};
|
|
30
|
+
declare const Service_base: Context.ServiceClass<Service, "@dual-os/cli/Skills", Interface>;
|
|
31
|
+
export declare class Service extends Service_base {}
|
|
32
|
+
export declare const layer: Layer.Layer<Service, never, ChildProcessSpawner.ChildProcessSpawner | Stdio.Stdio>;
|
|
33
|
+
export declare const command: Command.Command<"skills", {}, {}, SkillsError, Service>;
|
|
34
|
+
export { skills_d_exports as Skills };
|
|
35
|
+
//# sourceMappingURL=skills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills.d.ts","names":[],"sources":["../src/skills.ts"],"mappings":";;;;;;;cAuBM,MAAI,OAAA;;;;cAKJ,SAAO,OAAA;;;;;;;;;;;;;qBAaA,oBAAoB;YAkDrB;WACD,MAAM,gBAAgB,KAAK,SAAS,OAAO,eAAe;WAC1D,UAAU,gBAAgB,QAAQ,SAAS,OAAO,aAAa;;;qBAE7D,gBAAgB;qBAEhB,OAAK,MAAA,MAAA,gBAAA,oBAAA,sBAAA,MAAA;qBA8QL,SAAO,QAAA,0BAAA,aAAA"}
|
package/dist/skills.js
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
+
import "./skills.js";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { Array, Console, Context, Effect, Layer, Option, Schema, Stdio, Stream } from "effect";
|
|
5
|
+
import { Argument, Command, Flag } from "effect/cli";
|
|
6
|
+
import { homedir, tmpdir } from "node:os";
|
|
7
|
+
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
8
|
+
import { cp, lstat, mkdir, mkdtemp, readFile, readdir, realpath, rm } from "node:fs/promises";
|
|
9
|
+
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
11
|
+
// src/skills.ts
|
|
12
|
+
var skills_exports = /* @__PURE__ */ __exportAll({
|
|
13
|
+
Service: () => Service,
|
|
14
|
+
Skills: () => skills_exports,
|
|
15
|
+
SkillsError: () => SkillsError,
|
|
16
|
+
command: () => command,
|
|
17
|
+
layer: () => layer
|
|
18
|
+
});
|
|
19
|
+
const directory = new URL("../skills/dual-fde/", import.meta.url);
|
|
20
|
+
const references = [
|
|
21
|
+
"access",
|
|
22
|
+
"author-plugins",
|
|
23
|
+
"cli",
|
|
24
|
+
"manage-plugins",
|
|
25
|
+
"migrations-deployment",
|
|
26
|
+
"openapi-plugins",
|
|
27
|
+
"sdk-docs",
|
|
28
|
+
"upgrades",
|
|
29
|
+
"working-context"
|
|
30
|
+
];
|
|
31
|
+
const Read = Schema.Struct({
|
|
32
|
+
full: Schema.Boolean,
|
|
33
|
+
reference: Schema.optional(Schema.Literals(references))
|
|
34
|
+
});
|
|
35
|
+
const Agent = Schema.String.check(Schema.isPattern(/^[a-z][a-z0-9-]*$/));
|
|
36
|
+
const Install = Schema.Struct({
|
|
37
|
+
agents: Schema.Array(Agent).check(Schema.isMinLength(1)),
|
|
38
|
+
global: Schema.Boolean,
|
|
39
|
+
/** User scope root, also the installer's HOME. */
|
|
40
|
+
home: Schema.NonEmptyString,
|
|
41
|
+
/** Project scope root and installer working directory. */
|
|
42
|
+
project: Schema.NonEmptyString,
|
|
43
|
+
yes: Schema.Boolean
|
|
44
|
+
});
|
|
45
|
+
const Installed = Schema.fromJsonString(Schema.Array(Schema.Struct({
|
|
46
|
+
name: Schema.String,
|
|
47
|
+
path: Schema.String
|
|
48
|
+
})));
|
|
49
|
+
var SkillsError = class extends Schema.TaggedError()("SkillsError", {
|
|
50
|
+
cause: Schema.optional(Schema.Defect()),
|
|
51
|
+
message: Schema.String
|
|
52
|
+
}) {};
|
|
53
|
+
const Staged = Schema.fromJsonString(Schema.Array(Schema.Struct({
|
|
54
|
+
mode: Schema.Literal("copy"),
|
|
55
|
+
name: Schema.Literal("dual-fde"),
|
|
56
|
+
path: Schema.String,
|
|
57
|
+
scope: Schema.Literals(["project", "global"]),
|
|
58
|
+
status: Schema.Literal("installed")
|
|
59
|
+
})).check(Schema.isMinLength(1), Schema.isMaxLength(1)));
|
|
60
|
+
const Missing = Schema.Struct({ code: Schema.Literal("ENOENT") });
|
|
61
|
+
const inspectDestination = (destination) => Effect.runPromise(Effect.forEach(Array.unfold(Option.some(destination), (current) => Option.map(current, (path) => [path, dirname(path) === path ? Option.none() : Option.some(dirname(path))])), (current) => Effect.gen(function* () {
|
|
62
|
+
const entry = yield* Effect.tryPromise(() => lstat(current)).pipe(Effect.catchIf((cause) => Schema.is(Missing)(cause.cause), () => Effect.void));
|
|
63
|
+
if (entry && (current === destination || !entry.isDirectory())) return yield* new SkillsError({ message: `Refusing existing target or non-directory/symlink ancestor: ${current}. Preserve customer edits and move the conflict aside before reinstalling.` });
|
|
64
|
+
}), { discard: true }));
|
|
65
|
+
var Service = class extends Context.Service()("@dual-os/cli/Skills") {};
|
|
66
|
+
const layer = Layer.effect(Service, Effect.gen(function* () {
|
|
67
|
+
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
68
|
+
const stdio = yield* Stdio.Stdio;
|
|
69
|
+
const inspect = Effect.fn("Skills.inspect")(function* (command) {
|
|
70
|
+
const child = yield* spawner.spawn(command);
|
|
71
|
+
const [output, diagnostics, code] = yield* Effect.all([
|
|
72
|
+
Stream.mkString(Stream.decodeText(child.stdout)),
|
|
73
|
+
Stream.mkString(Stream.decodeText(child.stderr)),
|
|
74
|
+
child.exitCode
|
|
75
|
+
], { concurrency: "unbounded" });
|
|
76
|
+
if (code !== 0) return yield* new SkillsError({
|
|
77
|
+
cause: new Error(diagnostics),
|
|
78
|
+
message: "Pinned skills installer refused discovery/staging. Check --agent; custom path overrides are refused for --yes. No customer files were changed."
|
|
79
|
+
});
|
|
80
|
+
return output;
|
|
81
|
+
}, Effect.scoped);
|
|
82
|
+
const get = Effect.fn("Skills.get")(function* (input) {
|
|
83
|
+
const options = yield* Schema.decodeUnknownEffect(Read)(input);
|
|
84
|
+
if (options.full && options.reference !== void 0) return yield* new SkillsError({ message: "Use either --reference or --full, not both." });
|
|
85
|
+
return yield* Effect.tryPromise({
|
|
86
|
+
catch: (cause) => new SkillsError({
|
|
87
|
+
cause,
|
|
88
|
+
message: "Bundled skill unavailable. Reinstall this exact CLI package."
|
|
89
|
+
}),
|
|
90
|
+
try: async () => {
|
|
91
|
+
const paths = options.full ? ["SKILL.md", ...Array.map(references, (name) => `references/${name}.md`)] : [options.reference ? `references/${options.reference}.md` : "SKILL.md"];
|
|
92
|
+
return Array.join(await Promise.all(Array.map(paths, async (path) => {
|
|
93
|
+
const text = await readFile(new URL(path, directory), "utf8");
|
|
94
|
+
return options.full ? `# ${path}\n\n${text}` : text;
|
|
95
|
+
})), "\n\n");
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}, Effect.mapError((cause) => cause instanceof SkillsError ? cause : new SkillsError({
|
|
99
|
+
cause,
|
|
100
|
+
message: "Invalid skill read options."
|
|
101
|
+
})));
|
|
102
|
+
const install = Effect.fn("Skills.install")(function* (input) {
|
|
103
|
+
const options = yield* Schema.decodeUnknownEffect(Install)(input);
|
|
104
|
+
const terminal = (yield* stdio.stdinIsTerminal) && (yield* stdio.stdoutIsTerminal);
|
|
105
|
+
if (!options.yes && !terminal) return yield* new SkillsError({ message: "Skill installation requires an interactive terminal or explicit --yes with --agent. No files were changed." });
|
|
106
|
+
if (process.versions["bun"]) return yield* new SkillsError({ message: "Run skill installation with Node 22.20+ (not Bun)." });
|
|
107
|
+
const executable = yield* Effect.try({
|
|
108
|
+
catch: (cause) => new SkillsError({
|
|
109
|
+
cause,
|
|
110
|
+
message: "Pinned skills installer unavailable. Reinstall the CLI dependencies."
|
|
111
|
+
}),
|
|
112
|
+
try: () => join(dirname(createRequire(import.meta.url).resolve("skills/package.json")), "bin/cli.mjs")
|
|
113
|
+
});
|
|
114
|
+
const command = (args) => ChildProcess.make(process.execPath, [executable, ...args], {
|
|
115
|
+
cwd: options.project,
|
|
116
|
+
env: {
|
|
117
|
+
DISABLE_TELEMETRY: "1",
|
|
118
|
+
HOME: options.home,
|
|
119
|
+
USERPROFILE: options.home
|
|
120
|
+
},
|
|
121
|
+
extendEnv: true
|
|
122
|
+
});
|
|
123
|
+
const scope = options.global ? ["--global"] : [];
|
|
124
|
+
const output = yield* inspect(command([
|
|
125
|
+
"list",
|
|
126
|
+
"--json",
|
|
127
|
+
...scope
|
|
128
|
+
]));
|
|
129
|
+
const installed = yield* Schema.decodeUnknownEffect(Installed)(output);
|
|
130
|
+
if (Array.some(installed, (skill) => skill.name === "dual-fde" || basename(skill.path) === "dual-fde")) return yield* new SkillsError({ message: "dual-fde already exists in this scope. Preserve/review customer edits and move the existing installation aside before explicitly reinstalling. No files were changed." });
|
|
131
|
+
if (options.yes) {
|
|
132
|
+
yield* Effect.gen(function* () {
|
|
133
|
+
const stage = yield* Effect.acquireRelease(Effect.tryPromise(async () => realpath(await mkdtemp(join(tmpdir(), "dual-skills-")))), (path) => Effect.promise(() => rm(path, {
|
|
134
|
+
force: true,
|
|
135
|
+
recursive: true
|
|
136
|
+
})));
|
|
137
|
+
const home = join(stage, "home");
|
|
138
|
+
const project = join(stage, "project");
|
|
139
|
+
yield* Effect.tryPromise(async () => {
|
|
140
|
+
await mkdir(home);
|
|
141
|
+
await mkdir(project);
|
|
142
|
+
if (options.global) {
|
|
143
|
+
for (const entry of await readdir(options.home, { withFileTypes: true })) if (entry.isDirectory() || entry.isSymbolicLink()) await mkdir(join(home, entry.name));
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
const sourceBase = options.global ? home : project;
|
|
147
|
+
const targetBase = yield* Effect.tryPromise(() => realpath(options.global ? options.home : options.project));
|
|
148
|
+
const destinations = /* @__PURE__ */ new Map();
|
|
149
|
+
for (const agent of new Set(options.agents)) {
|
|
150
|
+
const result = yield* inspect(ChildProcess.make(process.execPath, [
|
|
151
|
+
"--permission",
|
|
152
|
+
"--allow-fs-read=*",
|
|
153
|
+
`--allow-fs-write=${stage}`,
|
|
154
|
+
executable,
|
|
155
|
+
"add",
|
|
156
|
+
fileURLToPath(directory),
|
|
157
|
+
"--skill",
|
|
158
|
+
"dual-fde",
|
|
159
|
+
"--agent",
|
|
160
|
+
agent,
|
|
161
|
+
"--copy",
|
|
162
|
+
"--yes",
|
|
163
|
+
"--json",
|
|
164
|
+
...scope
|
|
165
|
+
], {
|
|
166
|
+
cwd: project,
|
|
167
|
+
env: {
|
|
168
|
+
DISABLE_TELEMETRY: "1",
|
|
169
|
+
HOME: home,
|
|
170
|
+
NODE_OPTIONS: "",
|
|
171
|
+
USERPROFILE: home
|
|
172
|
+
},
|
|
173
|
+
extendEnv: true
|
|
174
|
+
}));
|
|
175
|
+
const staged = yield* Schema.decodeUnknownEffect(Staged)(result);
|
|
176
|
+
for (const skill of staged) {
|
|
177
|
+
const path = relative(sourceBase, skill.path);
|
|
178
|
+
if (!isAbsolute(skill.path) || isAbsolute(path) || path === ".." || path.startsWith(`..${sep}`) || basename(path) !== "dual-fde" || skill.scope !== (options.global ? "global" : "project")) return yield* new SkillsError({ message: "Installer returned an unexpected staging path/scope. No customer files were changed." });
|
|
179
|
+
destinations.set(resolve(targetBase, path), skill.path);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
yield* Effect.tryPromise({
|
|
183
|
+
catch: (cause) => cause instanceof SkillsError ? cause : new SkillsError({
|
|
184
|
+
cause,
|
|
185
|
+
message: "Could not publish the snapshot without overwriting. Inspect any partial installation before retrying."
|
|
186
|
+
}),
|
|
187
|
+
try: async () => {
|
|
188
|
+
for (const [destination] of destinations) await inspectDestination(destination);
|
|
189
|
+
for (const [destination, source] of destinations) {
|
|
190
|
+
await mkdir(dirname(destination), { recursive: true });
|
|
191
|
+
await inspectDestination(destination);
|
|
192
|
+
await mkdir(destination);
|
|
193
|
+
for (const entry of await readdir(source)) await cp(join(source, entry), join(destination, entry), {
|
|
194
|
+
errorOnExist: true,
|
|
195
|
+
force: false,
|
|
196
|
+
recursive: true
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
for (const [destination] of destinations) yield* Console.log(`Installed dual-fde snapshot: ${destination}`);
|
|
202
|
+
}).pipe(Effect.scoped);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
yield* Console.log(options.global ? "Installing the bundled snapshot globally. Cancel unexpected overwrites; local sources do not auto-update." : "Choose Project in the installer's scope prompt. Cancel unexpected overwrites or scope changes; local sources do not auto-update.");
|
|
206
|
+
if ((yield* spawner.exitCode(ChildProcess.make(process.execPath, [
|
|
207
|
+
executable,
|
|
208
|
+
"add",
|
|
209
|
+
fileURLToPath(directory),
|
|
210
|
+
"--skill",
|
|
211
|
+
"dual-fde",
|
|
212
|
+
...Array.flatMap(options.agents, (agent) => ["--agent", agent]),
|
|
213
|
+
...scope
|
|
214
|
+
], {
|
|
215
|
+
cwd: options.project,
|
|
216
|
+
env: {
|
|
217
|
+
DISABLE_TELEMETRY: "1",
|
|
218
|
+
HOME: options.home,
|
|
219
|
+
USERPROFILE: options.home
|
|
220
|
+
},
|
|
221
|
+
extendEnv: true,
|
|
222
|
+
stderr: "inherit",
|
|
223
|
+
stdin: "inherit",
|
|
224
|
+
stdout: "inherit"
|
|
225
|
+
}))) !== 0) return yield* new SkillsError({ message: "Skill installer failed or was cancelled. Inspect its output before retrying." });
|
|
226
|
+
}, Effect.mapError((cause) => cause instanceof SkillsError ? cause : new SkillsError({
|
|
227
|
+
cause,
|
|
228
|
+
message: "Could not safely inspect/install skills. No overwrite is attempted. Non-interactive installs require standard agent paths within the selected scope; custom path overrides are refused. Inspect any partial installation before retrying."
|
|
229
|
+
})));
|
|
230
|
+
return Service.of({
|
|
231
|
+
get,
|
|
232
|
+
install
|
|
233
|
+
});
|
|
234
|
+
}));
|
|
235
|
+
const command = Command.make("skills").pipe(Command.withAlias("skill"), Command.withDescription("Read bundled instructions offline or explicitly install a project-scoped snapshot."), Command.withShortDescription("Read/install bundled skills"), Command.withSubcommands([
|
|
236
|
+
Command.make("list", {}, () => Console.log("dual-fde")),
|
|
237
|
+
Command.make("get", {
|
|
238
|
+
full: Flag.Boolean("full").pipe(Flag.withDefault(false), Flag.withDescription("Read the index and all nine references; conflicts with --reference")),
|
|
239
|
+
name: Argument.Literals("name", ["dual-fde"]),
|
|
240
|
+
reference: Flag.Literals("reference", references).pipe(Flag.optional, Flag.withDescription("Read one task reference instead of the index"))
|
|
241
|
+
}, ({ reference, full }) => Effect.flatMap(Service, (skills) => Effect.flatMap(skills.get({
|
|
242
|
+
full,
|
|
243
|
+
reference: Option.getOrUndefined(reference)
|
|
244
|
+
}), Console.log))).pipe(Command.withDescription("Read only SKILL.md by default. Follow a references/<name>.md link with dual skill get dual-fde --reference <name>.")),
|
|
245
|
+
Command.make("install", {
|
|
246
|
+
agents: Flag.String("agent").pipe(Flag.withSchema(Agent), Flag.atLeast(1), Flag.withDescription("Explicit installer agent identifier; repeat for multiple agents")),
|
|
247
|
+
global: Flag.Boolean("global").pipe(Flag.withDefault(false), Flag.withDescription("Explicit opt-in to user-global scope instead of the current project")),
|
|
248
|
+
yes: Flag.Boolean("yes").pipe(Flag.withDefault(false), Flag.withAlias("y"), Flag.withDescription("Confirm a non-interactive, create-only snapshot install for the selected agents"))
|
|
249
|
+
}, (options) => Effect.flatMap(Service, (skills) => skills.install({
|
|
250
|
+
...options,
|
|
251
|
+
home: homedir(),
|
|
252
|
+
project: process.cwd()
|
|
253
|
+
})))
|
|
254
|
+
]));
|
|
255
|
+
export { Service, skills_exports as Skills, SkillsError, command, layer };
|
|
256
|
+
|
|
257
|
+
//# sourceMappingURL=skills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills.js","names":[],"sources":["../src/skills.ts"],"sourcesContent":["import { cp, lstat, mkdir, mkdtemp, readFile, readdir, realpath, rm } from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport { homedir, tmpdir } from \"node:os\";\nimport { basename, dirname, isAbsolute, join, relative, resolve, sep } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { Array, Console, Context, Effect, Layer, Option, Schema, Stdio, Stream } from \"effect\";\n\nimport { Argument, Command, Flag } from \"effect/cli\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nconst directory = new URL(\"../skills/dual-fde/\", import.meta.url);\nconst references = [\n \"access\",\n \"author-plugins\",\n \"cli\",\n \"manage-plugins\",\n \"migrations-deployment\",\n \"openapi-plugins\",\n \"sdk-docs\",\n \"upgrades\",\n \"working-context\",\n] as const;\nconst Read = Schema.Struct({\n full: Schema.Boolean,\n reference: Schema.optional(Schema.Literals(references)),\n});\nconst Agent = Schema.String.check(Schema.isPattern(/^[a-z][a-z0-9-]*$/));\nconst Install = Schema.Struct({\n agents: Schema.Array(Agent).check(Schema.isMinLength(1)),\n global: Schema.Boolean,\n /** User scope root, also the installer's HOME. */\n home: Schema.NonEmptyString,\n /** Project scope root and installer working directory. */\n project: Schema.NonEmptyString,\n yes: Schema.Boolean,\n});\nconst Installed = Schema.fromJsonString(\n Schema.Array(Schema.Struct({ name: Schema.String, path: Schema.String })),\n);\n\nexport class SkillsError extends Schema.TaggedError<SkillsError>()(\"SkillsError\", {\n cause: Schema.optional(Schema.Defect()),\n message: Schema.String,\n}) {}\n\nconst Staged = Schema.fromJsonString(\n Schema.Array(\n Schema.Struct({\n mode: Schema.Literal(\"copy\"),\n name: Schema.Literal(\"dual-fde\"),\n path: Schema.String,\n scope: Schema.Literals([\"project\", \"global\"]),\n status: Schema.Literal(\"installed\"),\n }),\n ).check(Schema.isMinLength(1), Schema.isMaxLength(1)),\n);\nconst Missing = Schema.Struct({ code: Schema.Literal(\"ENOENT\") });\n\n// Unlike installer discovery, lstat sees invalid skills, files and dangling links.\nconst inspectDestination = (destination: string) =>\n Effect.runPromise(\n Effect.forEach(\n Array.unfold(Option.some(destination), current =>\n Option.map(\n current,\n path =>\n [\n path,\n dirname(path) === path ? Option.none<string>() : Option.some(dirname(path)),\n ] as const,\n ),\n ),\n current =>\n Effect.gen(function* () {\n const entry = yield* Effect.tryPromise(() => lstat(current)).pipe(\n Effect.catchIf(\n cause => Schema.is(Missing)(cause.cause),\n () => Effect.void,\n ),\n );\n if (entry && (current === destination || !entry.isDirectory())) {\n return yield* new SkillsError({\n message: `Refusing existing target or non-directory/symlink ancestor: ${current}. Preserve customer edits and move the conflict aside before reinstalling.`,\n });\n }\n }),\n { discard: true },\n ),\n );\n\nexport type Interface = {\n readonly get: (options: typeof Read.Type) => Effect.Effect<string, SkillsError>;\n readonly install: (options: typeof Install.Type) => Effect.Effect<void, SkillsError>;\n};\nexport class Service extends Context.Service<Service, Interface>()(\"@dual-os/cli/Skills\") {}\n\nexport const layer = Layer.effect(\n Service,\n Effect.gen(function* () {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const stdio = yield* Stdio.Stdio;\n const inspect = Effect.fn(\"Skills.inspect\")(function* (command: ChildProcess.Command) {\n const child = yield* spawner.spawn(command);\n const [output, diagnostics, code] = yield* Effect.all(\n [\n Stream.mkString(Stream.decodeText(child.stdout)),\n Stream.mkString(Stream.decodeText(child.stderr)),\n child.exitCode,\n ],\n { concurrency: \"unbounded\" },\n );\n if (code !== 0) {\n return yield* new SkillsError({\n cause: new Error(diagnostics),\n message:\n \"Pinned skills installer refused discovery/staging. Check --agent; custom path overrides are refused for --yes. No customer files were changed.\",\n });\n }\n return output;\n }, Effect.scoped);\n const get = Effect.fn(\"Skills.get\")(\n function* (input: typeof Read.Type) {\n const options = yield* Schema.decodeUnknownEffect(Read)(input);\n if (options.full && options.reference !== undefined) {\n return yield* new SkillsError({ message: \"Use either --reference or --full, not both.\" });\n }\n return yield* Effect.tryPromise({\n catch: cause =>\n new SkillsError({\n cause,\n message: \"Bundled skill unavailable. Reinstall this exact CLI package.\",\n }),\n try: async () => {\n const paths = options.full\n ? [\"SKILL.md\", ...Array.map(references, name => `references/${name}.md`)]\n : [options.reference ? `references/${options.reference}.md` : \"SKILL.md\"];\n return Array.join(\n await Promise.all(\n Array.map(paths, async path => {\n const text = await readFile(new URL(path, directory), \"utf8\");\n return options.full ? `# ${path}\\n\\n${text}` : text;\n }),\n ),\n \"\\n\\n\",\n );\n },\n });\n },\n Effect.mapError(cause =>\n cause instanceof SkillsError\n ? cause\n : new SkillsError({ cause, message: \"Invalid skill read options.\" }),\n ),\n );\n const install = Effect.fn(\"Skills.install\")(\n function* (input: typeof Install.Type) {\n const options = yield* Schema.decodeUnknownEffect(Install)(input);\n const terminal = (yield* stdio.stdinIsTerminal) && (yield* stdio.stdoutIsTerminal);\n if (!options.yes && !terminal) {\n return yield* new SkillsError({\n message:\n \"Skill installation requires an interactive terminal or explicit --yes with --agent. No files were changed.\",\n });\n }\n if (process.versions[\"bun\"]) {\n return yield* new SkillsError({\n message: \"Run skill installation with Node 22.20+ (not Bun).\",\n });\n }\n const executable = yield* Effect.try({\n catch: cause =>\n new SkillsError({\n cause,\n message: \"Pinned skills installer unavailable. Reinstall the CLI dependencies.\",\n }),\n try: () =>\n join(\n dirname(createRequire(import.meta.url).resolve(\"skills/package.json\")),\n \"bin/cli.mjs\",\n ),\n });\n const command = (args: readonly string[]) =>\n ChildProcess.make(process.execPath, [executable, ...args], {\n cwd: options.project,\n env: { DISABLE_TELEMETRY: \"1\", HOME: options.home, USERPROFILE: options.home },\n extendEnv: true,\n });\n const scope = options.global ? [\"--global\"] : [];\n const output = yield* inspect(command([\"list\", \"--json\", ...scope]));\n const installed = yield* Schema.decodeUnknownEffect(Installed)(output);\n if (\n Array.some(\n installed,\n skill => skill.name === \"dual-fde\" || basename(skill.path) === \"dual-fde\",\n )\n ) {\n return yield* new SkillsError({\n message:\n \"dual-fde already exists in this scope. Preserve/review customer edits and move the existing installation aside before explicitly reinstalling. No files were changed.\",\n });\n }\n if (options.yes) {\n // 1.7.0 has no no-clobber/plan API; list omits malformed skills and add\n // destroys targets even in copy mode. Never run add --yes in user scope.\n // Upstream chooses paths in a write-restricted staging scope; Dual only\n // publishes its copies to absent paths, without an agent-path registry.\n yield* Effect.gen(function* () {\n const stage = yield* Effect.acquireRelease(\n Effect.tryPromise(async () =>\n realpath(await mkdtemp(join(tmpdir(), \"dual-skills-\"))),\n ),\n path => Effect.promise(() => rm(path, { force: true, recursive: true })),\n );\n const home = join(stage, \"home\");\n const project = join(stage, \"project\");\n yield* Effect.tryPromise(async () => {\n await mkdir(home);\n await mkdir(project);\n // Preserve upstream's home-root detection (e.g. legacy agent roots)\n // without exposing their contents to writes in the staging process.\n if (options.global) {\n for (const entry of await readdir(options.home, { withFileTypes: true })) {\n if (entry.isDirectory() || entry.isSymbolicLink()) {\n await mkdir(join(home, entry.name));\n }\n }\n }\n });\n const sourceBase = options.global ? home : project;\n const targetBase = yield* Effect.tryPromise(() =>\n realpath(options.global ? options.home : options.project),\n );\n const destinations = new Map<string, string>();\n for (const agent of new Set(options.agents)) {\n const result = yield* inspect(\n ChildProcess.make(\n process.execPath,\n [\n \"--permission\",\n \"--allow-fs-read=*\",\n `--allow-fs-write=${stage}`,\n executable,\n \"add\",\n fileURLToPath(directory),\n \"--skill\",\n \"dual-fde\",\n \"--agent\",\n agent,\n \"--copy\",\n \"--yes\",\n \"--json\",\n ...scope,\n ],\n {\n cwd: project,\n env: {\n DISABLE_TELEMETRY: \"1\",\n HOME: home,\n NODE_OPTIONS: \"\",\n USERPROFILE: home,\n },\n extendEnv: true,\n },\n ),\n );\n const staged = yield* Schema.decodeUnknownEffect(Staged)(result);\n for (const skill of staged) {\n const path = relative(sourceBase, skill.path);\n if (\n !isAbsolute(skill.path) ||\n isAbsolute(path) ||\n path === \"..\" ||\n path.startsWith(`..${sep}`) ||\n basename(path) !== \"dual-fde\" ||\n skill.scope !== (options.global ? \"global\" : \"project\")\n ) {\n return yield* new SkillsError({\n message:\n \"Installer returned an unexpected staging path/scope. No customer files were changed.\",\n });\n }\n destinations.set(resolve(targetBase, path), skill.path);\n }\n }\n // Check every destination before publishing any of them. In particular,\n // reject symlink ancestors and malformed/missing SKILL.md collisions.\n yield* Effect.tryPromise({\n catch: cause =>\n cause instanceof SkillsError\n ? cause\n : new SkillsError({\n cause,\n message:\n \"Could not publish the snapshot without overwriting. Inspect any partial installation before retrying.\",\n }),\n try: async () => {\n for (const [destination] of destinations) {\n await inspectDestination(destination);\n }\n for (const [destination, source] of destinations) {\n await mkdir(dirname(destination), { recursive: true });\n await inspectDestination(destination);\n await mkdir(destination); // Exclusive claim, never recursive at the target.\n for (const entry of await readdir(source)) {\n await cp(join(source, entry), join(destination, entry), {\n errorOnExist: true,\n force: false,\n recursive: true,\n });\n }\n }\n },\n });\n for (const [destination] of destinations) {\n yield* Console.log(`Installed dual-fde snapshot: ${destination}`);\n }\n }).pipe(Effect.scoped);\n return;\n }\n yield* Console.log(\n options.global\n ? \"Installing the bundled snapshot globally. Cancel unexpected overwrites; local sources do not auto-update.\"\n : \"Choose Project in the installer's scope prompt. Cancel unexpected overwrites or scope changes; local sources do not auto-update.\",\n );\n const code = yield* spawner.exitCode(\n ChildProcess.make(\n process.execPath,\n [\n executable,\n \"add\",\n fileURLToPath(directory),\n \"--skill\",\n \"dual-fde\",\n ...Array.flatMap(options.agents, agent => [\"--agent\", agent]),\n ...scope,\n ],\n {\n cwd: options.project,\n env: { DISABLE_TELEMETRY: \"1\", HOME: options.home, USERPROFILE: options.home },\n extendEnv: true,\n stderr: \"inherit\",\n stdin: \"inherit\",\n stdout: \"inherit\",\n },\n ),\n );\n if (code !== 0) {\n return yield* new SkillsError({\n message: \"Skill installer failed or was cancelled. Inspect its output before retrying.\",\n });\n }\n },\n Effect.mapError(cause =>\n cause instanceof SkillsError\n ? cause\n : new SkillsError({\n cause,\n message:\n \"Could not safely inspect/install skills. No overwrite is attempted. Non-interactive installs require standard agent paths within the selected scope; custom path overrides are refused. Inspect any partial installation before retrying.\",\n }),\n ),\n );\n return Service.of({ get, install });\n }),\n);\n\nexport const command = Command.make(\"skills\").pipe(\n Command.withAlias(\"skill\"),\n Command.withDescription(\n \"Read bundled instructions offline or explicitly install a project-scoped snapshot.\",\n ),\n Command.withShortDescription(\"Read/install bundled skills\"),\n Command.withSubcommands([\n Command.make(\"list\", {}, () => Console.log(\"dual-fde\")),\n Command.make(\n \"get\",\n {\n full: Flag.Boolean(\"full\").pipe(\n Flag.withDefault(false),\n Flag.withDescription(\n \"Read the index and all nine references; conflicts with --reference\",\n ),\n ),\n name: Argument.Literals(\"name\", [\"dual-fde\"]),\n reference: Flag.Literals(\"reference\", references).pipe(\n Flag.optional,\n Flag.withDescription(\"Read one task reference instead of the index\"),\n ),\n },\n ({ reference, full }) =>\n Effect.flatMap(Service, skills =>\n Effect.flatMap(\n skills.get({ full, reference: Option.getOrUndefined(reference) }),\n Console.log,\n ),\n ),\n ).pipe(\n Command.withDescription(\n \"Read only SKILL.md by default. Follow a references/<name>.md link with dual skill get dual-fde --reference <name>.\",\n ),\n ),\n Command.make(\n \"install\",\n {\n agents: Flag.String(\"agent\").pipe(\n Flag.withSchema(Agent),\n Flag.atLeast(1),\n Flag.withDescription(\"Explicit installer agent identifier; repeat for multiple agents\"),\n ),\n global: Flag.Boolean(\"global\").pipe(\n Flag.withDefault(false),\n Flag.withDescription(\n \"Explicit opt-in to user-global scope instead of the current project\",\n ),\n ),\n yes: Flag.Boolean(\"yes\").pipe(\n Flag.withDefault(false),\n Flag.withAlias(\"y\"),\n Flag.withDescription(\n \"Confirm a non-interactive, create-only snapshot install for the selected agents\",\n ),\n ),\n },\n // The CLI boundary owns the ambient scope roots; the service never reads them.\n options =>\n Effect.flatMap(Service, skills =>\n skills.install({ ...options, home: homedir(), project: process.cwd() }),\n ),\n ),\n ]),\n);\n\nexport * as Skills from \"./skills.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAWA,MAAM,YAAY,IAAI,IAAI,uBAAuB,YAAY,GAAG;AAChE,MAAM,aAAa;CACjB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,OAAO,OAAO,OAAO;CACzB,MAAM,OAAO;CACb,WAAW,OAAO,SAAS,OAAO,SAAS,UAAU,CAAC;AACxD,CAAC;AACD,MAAM,QAAQ,OAAO,OAAO,MAAM,OAAO,UAAU,mBAAmB,CAAC;AACvE,MAAM,UAAU,OAAO,OAAO;CAC5B,QAAQ,OAAO,MAAM,KAAK,CAAC,CAAC,MAAM,OAAO,YAAY,CA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iE,CACxF;EACA,QAAQ,KAAK,QAAQ,QAAQ,CAAC,CAAC,KAC7B,KAAK,YAAY,KAAK,GACtB,KAAK,gBACH,qEACF,CACF;EACA,KAAK,KAAK,QAAQ,KAAK,CAAC,CAAC,KACvB,KAAK,YAAY,KAAK,GACtB,KAAK,UAAU,GAAG,GAClB,KAAK,gBACH,iFACF,CACF;CACF,IAEA,YACE,OAAO,QAAQ,UAAS,WACtB,OAAO,QAAQ;EAAE,GAAG;EAAS,MAAM,QAAQ;EAAG,SAAS,QAAQ,IAAI;CAAE,CAAC,CACxE,CACJ;AACF,CAAC,CACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,75 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dual-os/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.11.0",
|
|
4
|
+
"license": "UNLICENSED",
|
|
5
|
+
"bin": {
|
|
6
|
+
"dual": "./dist/bin.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/**/*.js",
|
|
10
|
+
"dist/**/*.js.map",
|
|
11
|
+
"dist/**/*.d.ts",
|
|
12
|
+
"dist/**/*.d.ts.map",
|
|
13
|
+
"src/**/*.ts",
|
|
14
|
+
"!src/**/*.test.ts",
|
|
15
|
+
"!src/**/*.spec.ts",
|
|
16
|
+
"templates/**",
|
|
17
|
+
"skills/**",
|
|
18
|
+
"templates/default/.env.example.hbs",
|
|
19
|
+
"templates/compose/.env.*.hbs",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"imports": {
|
|
25
|
+
"#auth/*": {
|
|
26
|
+
"types": "./src/auth/*.ts",
|
|
27
|
+
"default": "./dist/auth/*.js"
|
|
28
|
+
},
|
|
29
|
+
"#diagnostics": {
|
|
30
|
+
"types": "./src/diagnostics.ts",
|
|
31
|
+
"default": "./dist/diagnostics.js"
|
|
32
|
+
},
|
|
33
|
+
"#release/*": {
|
|
34
|
+
"types": "./src/release/*.ts",
|
|
35
|
+
"default": "./dist/release/*.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"exports": {
|
|
39
|
+
".": "./dist/cli.js",
|
|
40
|
+
"./package.json": "./package.json"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"prepack": "vp run build",
|
|
44
|
+
"typecheck": "tsrs --build tsconfig.json --force --pretty false"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@dual-os/sdk": "0.8.1",
|
|
48
|
+
"@effect/platform-node": "4.1.2",
|
|
49
|
+
"@effect/platform-node-shared": "4.1.2",
|
|
50
|
+
"acorn": "8.17.0",
|
|
51
|
+
"effect": "4.1.2",
|
|
52
|
+
"fflate": "0.8.3",
|
|
53
|
+
"graphql": "16.11.0",
|
|
54
|
+
"handlebars": "4.7.9",
|
|
55
|
+
"js-yaml": "4.2.0",
|
|
56
|
+
"semver": "7.7.4",
|
|
57
|
+
"skills": "1.7.0",
|
|
58
|
+
"tar": "7.5.22",
|
|
59
|
+
"tr46": "6.0.0",
|
|
60
|
+
"vite-plus": "1.4.0"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@dual/core": "0.18.0",
|
|
64
|
+
"@dual/dualspec": "0.5.1",
|
|
65
|
+
"@dual/workspace-opensandbox": "0.4.0",
|
|
66
|
+
"@types/js-yaml": "4.0.9",
|
|
67
|
+
"@types/node": "25.9.5",
|
|
68
|
+
"@types/semver": "7.7.1",
|
|
69
|
+
"@types/tr46": "5.0.1",
|
|
70
|
+
"bun-types": "1.3.14"
|
|
71
|
+
},
|
|
72
|
+
"engines": {
|
|
73
|
+
"node": ">=22.20.0"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dual-fde
|
|
3
|
+
description: >-
|
|
4
|
+
Support Dual FDE work: create customer repositories with the CLI, manage existing
|
|
5
|
+
plugins, author customer plugins with the SDK, configure hosts, diagnose access
|
|
6
|
+
or registry blockers, analyze and apply requested upgrades, and guide migrations
|
|
7
|
+
and deployment readiness.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Dual FDE
|
|
11
|
+
|
|
12
|
+
Always load [working context](references/working-context.md), then load the task references needed below.
|
|
13
|
+
|
|
14
|
+
| Task | Reference |
|
|
15
|
+
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
|
|
16
|
+
| Create or replay a customer repository; discover CLI commands; install or refresh this skill | [CLI](references/cli.md) |
|
|
17
|
+
| Locate version-matched SDK documentation, public APIs or checked examples; configure a host | [SDK and host documentation](references/sdk-docs.md) |
|
|
18
|
+
| Choose, add, remove or configure existing plugins; diagnose missing capabilities | [Manage plugins](references/manage-plugins.md) |
|
|
19
|
+
| Build a new customer-specific plugin or extend its implementation | [Author plugins](references/author-plugins.md) |
|
|
20
|
+
| Integrate any API from a supported spec, schema or server: generate or regenerate the plugin package | [OpenAPI plugins](references/openapi-plugins.md) |
|
|
21
|
+
| Analyze or apply a requested package/core/frontend upgrade | [Upgrades](references/upgrades.md) |
|
|
22
|
+
| Diagnose SQL or registry state; prepare migrations, staging or deployment | [Migrations and deployment](references/migrations-deployment.md) |
|
|
23
|
+
| Diagnose private package/image access; consult product source or FDE references | [Access and references](references/access.md) |
|
|
24
|
+
|
|
25
|
+
For generated API integrations, the [OpenAPI workflow](references/openapi-plugins.md) owns coverage, source overlays and regeneration.
|
|
26
|
+
Give each product its own plugin and keep historical handlers in immutable package releases.
|
|
27
|
+
Never edit generated files or compensate for a compiler omission with handwritten endpoints.
|
|
28
|
+
|
|
29
|
+
## Default integration scope
|
|
30
|
+
|
|
31
|
+
A request to create or update an API plugin includes connection setup, useful event
|
|
32
|
+
sources, compatibility and public-runtime proof, not only generated actions. Do not
|
|
33
|
+
wait for a separate request for webhook or polling triggers. Follow the complete
|
|
34
|
+
[API integration workflow](references/openapi-plugins.md), including its trigger
|
|
35
|
+
coverage review. Resolve technical details from the source, official provider docs,
|
|
36
|
+
existing integrations and matching SDK examples. Ask only for unavailable private
|
|
37
|
+
access, a consequential customer choice or approval for an outward action; missing
|
|
38
|
+
documentation is not permission to invent a contract.
|