@dual-os/cli 0.0.0-stage → 0.11.0-next.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.
Files changed (254) hide show
  1. package/LICENSE +4 -0
  2. package/README.md +15 -2
  3. package/dist/_virtual/_rolldown/runtime.js +13 -0
  4. package/dist/auth/credentials.d.ts +17 -0
  5. package/dist/auth/credentials.d.ts.map +1 -0
  6. package/dist/auth/credentials.js +57 -0
  7. package/dist/auth/credentials.js.map +1 -0
  8. package/dist/auth/destination.d.ts +22 -0
  9. package/dist/auth/destination.d.ts.map +1 -0
  10. package/dist/auth/destination.js +49 -0
  11. package/dist/auth/destination.js.map +1 -0
  12. package/dist/auth/http.d.ts +12 -0
  13. package/dist/auth/http.d.ts.map +1 -0
  14. package/dist/auth/http.js +34 -0
  15. package/dist/auth/http.js.map +1 -0
  16. package/dist/auth/login.d.ts +22 -0
  17. package/dist/auth/login.d.ts.map +1 -0
  18. package/dist/auth/login.js +98 -0
  19. package/dist/auth/login.js.map +1 -0
  20. package/dist/auth/protocol.d.ts +26 -0
  21. package/dist/auth/protocol.d.ts.map +1 -0
  22. package/dist/auth/protocol.js +31 -0
  23. package/dist/auth/protocol.js.map +1 -0
  24. package/dist/baseline.d.ts +18 -0
  25. package/dist/baseline.d.ts.map +1 -0
  26. package/dist/baseline.js +22 -0
  27. package/dist/baseline.js.map +1 -0
  28. package/dist/bin.d.ts +1 -0
  29. package/dist/bin.js +7 -0
  30. package/dist/bin.js.map +1 -0
  31. package/dist/cli.d.ts +19 -0
  32. package/dist/cli.d.ts.map +1 -0
  33. package/dist/cli.js +492 -0
  34. package/dist/cli.js.map +1 -0
  35. package/dist/create/choices.d.ts +58 -0
  36. package/dist/create/choices.d.ts.map +1 -0
  37. package/dist/create/choices.js +121 -0
  38. package/dist/create/choices.js.map +1 -0
  39. package/dist/create/deployment.d.ts +48 -0
  40. package/dist/create/deployment.d.ts.map +1 -0
  41. package/dist/create/deployment.js +66 -0
  42. package/dist/create/deployment.js.map +1 -0
  43. package/dist/create/scaffold.d.ts +57 -0
  44. package/dist/create/scaffold.d.ts.map +1 -0
  45. package/dist/create/scaffold.js +198 -0
  46. package/dist/create/scaffold.js.map +1 -0
  47. package/dist/create/source-reference.d.ts +39 -0
  48. package/dist/create/source-reference.d.ts.map +1 -0
  49. package/dist/create/source-reference.js +185 -0
  50. package/dist/create/source-reference.js.map +1 -0
  51. package/dist/create/template.d.ts +116 -0
  52. package/dist/create/template.d.ts.map +1 -0
  53. package/dist/create/template.js +211 -0
  54. package/dist/create/template.js.map +1 -0
  55. package/dist/diagnostics.d.ts +6 -0
  56. package/dist/diagnostics.d.ts.map +1 -0
  57. package/dist/diagnostics.js +18 -0
  58. package/dist/diagnostics.js.map +1 -0
  59. package/dist/help.d.ts +16 -0
  60. package/dist/help.d.ts.map +1 -0
  61. package/dist/help.js +73 -0
  62. package/dist/help.js.map +1 -0
  63. package/dist/openapi/bundle.d.ts +18 -0
  64. package/dist/openapi/bundle.d.ts.map +1 -0
  65. package/dist/openapi/bundle.js +201 -0
  66. package/dist/openapi/bundle.js.map +1 -0
  67. package/dist/openapi/discovery.d.ts +30 -0
  68. package/dist/openapi/discovery.d.ts.map +1 -0
  69. package/dist/openapi/discovery.js +325 -0
  70. package/dist/openapi/discovery.js.map +1 -0
  71. package/dist/openapi/emit.d.ts +52 -0
  72. package/dist/openapi/emit.d.ts.map +1 -0
  73. package/dist/openapi/emit.js +596 -0
  74. package/dist/openapi/emit.js.map +1 -0
  75. package/dist/openapi/graphql.d.ts +102 -0
  76. package/dist/openapi/graphql.d.ts.map +1 -0
  77. package/dist/openapi/graphql.js +294 -0
  78. package/dist/openapi/graphql.js.map +1 -0
  79. package/dist/openapi/identity.d.ts +88 -0
  80. package/dist/openapi/identity.d.ts.map +1 -0
  81. package/dist/openapi/identity.js +98 -0
  82. package/dist/openapi/identity.js.map +1 -0
  83. package/dist/openapi/mcp.d.ts +21 -0
  84. package/dist/openapi/mcp.d.ts.map +1 -0
  85. package/dist/openapi/mcp.js +133 -0
  86. package/dist/openapi/mcp.js.map +1 -0
  87. package/dist/openapi/operations.d.ts +165 -0
  88. package/dist/openapi/operations.d.ts.map +1 -0
  89. package/dist/openapi/operations.js +361 -0
  90. package/dist/openapi/operations.js.map +1 -0
  91. package/dist/openapi/overlay.d.ts +23 -0
  92. package/dist/openapi/overlay.d.ts.map +1 -0
  93. package/dist/openapi/overlay.js +115 -0
  94. package/dist/openapi/overlay.js.map +1 -0
  95. package/dist/openapi/plugin.d.ts +83 -0
  96. package/dist/openapi/plugin.d.ts.map +1 -0
  97. package/dist/openapi/plugin.js +468 -0
  98. package/dist/openapi/plugin.js.map +1 -0
  99. package/dist/openapi/polymorphism.d.ts +21 -0
  100. package/dist/openapi/polymorphism.d.ts.map +1 -0
  101. package/dist/openapi/polymorphism.js +96 -0
  102. package/dist/openapi/polymorphism.js.map +1 -0
  103. package/dist/openapi/postman.d.ts +21 -0
  104. package/dist/openapi/postman.d.ts.map +1 -0
  105. package/dist/openapi/postman.js +286 -0
  106. package/dist/openapi/postman.js.map +1 -0
  107. package/dist/openapi/schema.d.ts +178 -0
  108. package/dist/openapi/schema.d.ts.map +1 -0
  109. package/dist/openapi/schema.js +1234 -0
  110. package/dist/openapi/schema.js.map +1 -0
  111. package/dist/openapi/select.d.ts +22 -0
  112. package/dist/openapi/select.d.ts.map +1 -0
  113. package/dist/openapi/select.js +79 -0
  114. package/dist/openapi/select.js.map +1 -0
  115. package/dist/openapi/spec.d.ts +147 -0
  116. package/dist/openapi/spec.d.ts.map +1 -0
  117. package/dist/openapi/spec.js +263 -0
  118. package/dist/openapi/spec.js.map +1 -0
  119. package/dist/openapi/swagger.d.ts +166 -0
  120. package/dist/openapi/swagger.d.ts.map +1 -0
  121. package/dist/openapi/swagger.js +298 -0
  122. package/dist/openapi/swagger.js.map +1 -0
  123. package/dist/openapi/versions.d.ts +52 -0
  124. package/dist/openapi/versions.d.ts.map +1 -0
  125. package/dist/openapi/versions.js +120 -0
  126. package/dist/openapi/versions.js.map +1 -0
  127. package/dist/plugin/archive.d.ts +27 -0
  128. package/dist/plugin/archive.d.ts.map +1 -0
  129. package/dist/plugin/archive.js +170 -0
  130. package/dist/plugin/archive.js.map +1 -0
  131. package/dist/plugin/bundle.d.ts +27 -0
  132. package/dist/plugin/bundle.d.ts.map +1 -0
  133. package/dist/plugin/bundle.js +328 -0
  134. package/dist/plugin/bundle.js.map +1 -0
  135. package/dist/plugin/init.d.ts +18 -0
  136. package/dist/plugin/init.d.ts.map +1 -0
  137. package/dist/plugin/init.js +121 -0
  138. package/dist/plugin/init.js.map +1 -0
  139. package/dist/plugin/inspection.d.ts +24 -0
  140. package/dist/plugin/inspection.d.ts.map +1 -0
  141. package/dist/plugin/inspection.js +24 -0
  142. package/dist/plugin/inspection.js.map +1 -0
  143. package/dist/plugin/package.d.ts +26 -0
  144. package/dist/plugin/package.d.ts.map +1 -0
  145. package/dist/plugin/package.js +73 -0
  146. package/dist/plugin/package.js.map +1 -0
  147. package/dist/plugin/publication.d.ts +29 -0
  148. package/dist/plugin/publication.d.ts.map +1 -0
  149. package/dist/plugin/publication.js +65 -0
  150. package/dist/plugin/publication.js.map +1 -0
  151. package/dist/plugin/validation.d.ts +15 -0
  152. package/dist/plugin/validation.d.ts.map +1 -0
  153. package/dist/plugin/validation.js +119 -0
  154. package/dist/plugin/validation.js.map +1 -0
  155. package/dist/release/archives.d.ts +33 -0
  156. package/dist/release/archives.d.ts.map +1 -0
  157. package/dist/release/archives.js +81 -0
  158. package/dist/release/archives.js.map +1 -0
  159. package/dist/release/release-manifest.d.ts +182 -0
  160. package/dist/release/release-manifest.d.ts.map +1 -0
  161. package/dist/release/release-manifest.js +79 -0
  162. package/dist/release/release-manifest.js.map +1 -0
  163. package/dist/release/releases.d.ts +36 -0
  164. package/dist/release/releases.d.ts.map +1 -0
  165. package/dist/release/releases.js +122 -0
  166. package/dist/release/releases.js.map +1 -0
  167. package/dist/skills.d.ts +35 -0
  168. package/dist/skills.d.ts.map +1 -0
  169. package/dist/skills.js +257 -0
  170. package/dist/skills.js.map +1 -0
  171. package/package.json +73 -4
  172. package/skills/dual-fde/SKILL.md +38 -0
  173. package/skills/dual-fde/references/access.md +62 -0
  174. package/skills/dual-fde/references/author-plugins.md +54 -0
  175. package/skills/dual-fde/references/cli.md +97 -0
  176. package/skills/dual-fde/references/manage-plugins.md +78 -0
  177. package/skills/dual-fde/references/migrations-deployment.md +84 -0
  178. package/skills/dual-fde/references/openapi-plugins.md +47 -0
  179. package/skills/dual-fde/references/sdk-docs.md +56 -0
  180. package/skills/dual-fde/references/upgrades.md +115 -0
  181. package/skills/dual-fde/references/working-context.md +69 -0
  182. package/src/auth/credentials.ts +84 -0
  183. package/src/auth/destination.ts +83 -0
  184. package/src/auth/http.ts +39 -0
  185. package/src/auth/login.ts +177 -0
  186. package/src/auth/protocol.ts +37 -0
  187. package/src/baseline.ts +15 -0
  188. package/src/bin.ts +4 -0
  189. package/src/cli.ts +969 -0
  190. package/src/create/choices.ts +177 -0
  191. package/src/create/deployment.ts +96 -0
  192. package/src/create/scaffold.ts +334 -0
  193. package/src/create/source-reference.ts +212 -0
  194. package/src/create/template.ts +300 -0
  195. package/src/diagnostics.ts +8 -0
  196. package/src/help.ts +142 -0
  197. package/src/openapi/bundle.ts +290 -0
  198. package/src/openapi/discovery.ts +438 -0
  199. package/src/openapi/emit.ts +1031 -0
  200. package/src/openapi/graphql.ts +375 -0
  201. package/src/openapi/identity.ts +153 -0
  202. package/src/openapi/mcp.ts +165 -0
  203. package/src/openapi/operations.ts +781 -0
  204. package/src/openapi/overlay.ts +195 -0
  205. package/src/openapi/plugin.ts +856 -0
  206. package/src/openapi/polymorphism.ts +207 -0
  207. package/src/openapi/postman.ts +403 -0
  208. package/src/openapi/schema.ts +2138 -0
  209. package/src/openapi/select.ts +113 -0
  210. package/src/openapi/spec.ts +401 -0
  211. package/src/openapi/swagger.ts +422 -0
  212. package/src/openapi/versions.ts +174 -0
  213. package/src/plugin/archive.ts +244 -0
  214. package/src/plugin/bundle.ts +572 -0
  215. package/src/plugin/init.ts +178 -0
  216. package/src/plugin/inspection.ts +19 -0
  217. package/src/plugin/package.ts +140 -0
  218. package/src/plugin/publication.ts +128 -0
  219. package/src/plugin/validation.ts +213 -0
  220. package/src/release/archives.ts +133 -0
  221. package/src/release/release-manifest.ts +79 -0
  222. package/src/release/releases.ts +210 -0
  223. package/src/skills.ts +434 -0
  224. package/templates/compose/.env.compose.example.hbs +3 -0
  225. package/templates/compose/.env.host.example.hbs +4 -0
  226. package/templates/compose/Dockerfile.hbs +12 -0
  227. package/templates/compose/OPERATIONS.md.hbs +159 -0
  228. package/templates/compose/_dockerignore +14 -0
  229. package/templates/compose/compose.external.yaml +7 -0
  230. package/templates/compose/compose.host-linux.yaml +5 -0
  231. package/templates/compose/compose.host.yaml.hbs +15 -0
  232. package/templates/compose/compose.yaml.hbs +85 -0
  233. package/templates/compose/release.env.hbs +2 -0
  234. package/templates/default/.env.example.hbs +79 -0
  235. package/templates/default/README.md.hbs +150 -0
  236. package/templates/default/_gitignore +11 -0
  237. package/templates/default/packages/customer-plugin/src/Customer.ts.hbs +17 -0
  238. package/templates/default/packages/customer-plugin/tsconfig.json +15 -0
  239. package/templates/default/packages/execution-layer/src/App.ts.hbs +7 -0
  240. package/templates/default/packages/execution-layer/src/Host.ts.hbs +31 -0
  241. package/templates/default/packages/execution-layer/src/Telemetry.ts.hbs +23 -0
  242. package/templates/default/packages/execution-layer/src/api.ts.hbs +21 -0
  243. package/templates/default/packages/execution-layer/src/bootstrap.ts +22 -0
  244. package/templates/default/packages/execution-layer/src/migrate.ts +11 -0
  245. package/templates/default/packages/execution-layer/src/registry-check.ts +29 -0
  246. package/templates/default/packages/execution-layer/src/registry-sync.ts +14 -0
  247. package/templates/default/packages/execution-layer/src/worker.ts.hbs +16 -0
  248. package/templates/default/packages/execution-layer/test/app.host-test.ts.hbs +58 -0
  249. package/templates/default/packages/execution-layer/test/app.test.ts.hbs +16 -0
  250. package/templates/default/tsconfig.json +5 -0
  251. package/templates/default/vitest.config.ts +5 -0
  252. package/templates/default/vitest.host.config.ts +6 -0
  253. package/templates/opensandbox/OPEN-SANDBOX.md +25 -0
  254. package/templates/opensandbox/docker/agent-sandbox.Dockerfile +41 -0
@@ -0,0 +1,244 @@
1
+ import type { PlatformError } from "effect";
2
+ import {
3
+ Array,
4
+ Context,
5
+ DateTime,
6
+ Effect,
7
+ FileSystem,
8
+ Layer,
9
+ MutableList,
10
+ Order,
11
+ Path,
12
+ Schema,
13
+ } from "effect";
14
+
15
+ import { Digest } from "effect/crypto";
16
+ import { Hex } from "effect/encoding";
17
+ import { ChildProcess, ChildProcessSpawner } from "effect/process";
18
+ import * as tar from "tar";
19
+
20
+ import { make as makeBundle } from "./bundle.ts";
21
+ import { PluginInspection } from "./inspection.ts";
22
+ import { PluginPackage } from "./package.ts";
23
+ import { PluginValidation } from "./validation.ts";
24
+
25
+ const Manifest = Schema.Struct({ scripts: Schema.Record(Schema.String, Schema.String) });
26
+ export type Artifact = typeof Artifact.Type;
27
+ export const Artifact = Schema.Struct({
28
+ activated: Schema.Literal(false),
29
+ digest: Schema.String,
30
+ file: Schema.String,
31
+ plugin: Schema.String,
32
+ published: Schema.Literal(false),
33
+ size: Schema.Finite,
34
+ version: Schema.String,
35
+ });
36
+ export type Interface = {
37
+ readonly build: (
38
+ directory: string,
39
+ output: string,
40
+ ) => Effect.Effect<Artifact, PluginPackage.PackageError>;
41
+ };
42
+ export class Service extends Context.Service<Service, Interface>()(
43
+ "@dual-os/cli/plugin/archive/Service",
44
+ ) {}
45
+
46
+ export const layer = Layer.effect(
47
+ Service,
48
+ Effect.gen(function* () {
49
+ const fs = yield* FileSystem.FileSystem;
50
+ const path = yield* Path.Path;
51
+ const crypto = yield* Digest.Digest;
52
+ const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
53
+ const packages = yield* PluginPackage.Service;
54
+ const validation = yield* PluginValidation.Service;
55
+ const buildBundle = yield* makeBundle;
56
+ const executable = (yield* spawner.string(ChildProcess.make("which", ["bun"]))).trim();
57
+ return Service.of({
58
+ build: Effect.fn("PluginArchive.build")(
59
+ function* (directory, output) {
60
+ const root = yield* fs.realPath(path.resolve(directory));
61
+ const lockRoot = Effect.fnUntraced(function* (
62
+ current: string,
63
+ ): Effect.fn.Return<string, PlatformError.PlatformError | PluginPackage.PackageError> {
64
+ if (yield* fs.exists(path.join(current, "bun.lock"))) return current;
65
+ const parent = path.dirname(current);
66
+ if (parent === current)
67
+ return yield* PluginPackage.PackageError.make({
68
+ message: "A frozen bun.lock is required to build a plugin",
69
+ });
70
+ return yield* lockRoot(parent);
71
+ });
72
+ const locked = yield* lockRoot(root);
73
+ const command = Effect.fnUntraced(function* (
74
+ executable: string,
75
+ args: string[],
76
+ cwd: string,
77
+ ) {
78
+ const code = yield* spawner.exitCode(
79
+ ChildProcess.make(executable, args, {
80
+ cwd,
81
+ stdin: "ignore",
82
+ stdout: "ignore",
83
+ stderr: "inherit",
84
+ }),
85
+ );
86
+ if (code !== 0)
87
+ return yield* PluginPackage.PackageError.make({
88
+ message: `Plugin build failed: ${executable} ${Array.join(args, " ")}`,
89
+ });
90
+ });
91
+ const bun = (yield* spawner.string(ChildProcess.make("bun", ["--version"]))).trim();
92
+ if (bun !== "1.4.2")
93
+ return yield* PluginPackage.PackageError.make({
94
+ message: "Plugin builds require Bun 1.4.2",
95
+ });
96
+ yield* command(
97
+ "bun",
98
+ ["install", "--frozen-lockfile", "--ignore-scripts", "--no-env-file"],
99
+ locked,
100
+ );
101
+ const manifest = yield* Schema.decodeEffect(Schema.fromJsonString(Manifest))(
102
+ yield* fs.readFileString(path.join(root, "package.json")),
103
+ );
104
+ const build = manifest.scripts["build"] ? "build" : "prepack";
105
+ if (!manifest.scripts[build])
106
+ return yield* PluginPackage.PackageError.make({
107
+ message: "Declare scripts.build or scripts.prepack before building a plugin",
108
+ });
109
+ yield* command("bun", ["run", "--no-env-file", build], root);
110
+ const prepared = yield* packages.inspect(root);
111
+ const original = yield* validation.validate(root);
112
+ const compiled = yield* buildBundle(root, prepared);
113
+ const declaration = {
114
+ entrypoint: compiled.entrypoint.replaceAll("\\", "/"),
115
+ export: prepared.export,
116
+ format: 2,
117
+ plugin: original.plugin,
118
+ runner: compiled.runner,
119
+ sdk_version: compiled.sdkVersion,
120
+ version: original.version,
121
+ };
122
+ const write = (name: string, value: Schema.Json) =>
123
+ Effect.flatMap(Schema.encodeEffect(Schema.fromJsonString(Schema.Json))(value), text =>
124
+ fs.writeFileString(path.join(compiled.output, name), text),
125
+ );
126
+ yield* write("package.json", {
127
+ ...compiled.manifest,
128
+ dependencies: {},
129
+ devDependencies: {},
130
+ peerDependencies: {},
131
+ optionalDependencies: {},
132
+ scripts: {},
133
+ files: ["**/*"],
134
+ dual: { plugin: { ...declaration, assets: compiled.assets } },
135
+ });
136
+ yield* write("dual-plugin.json", declaration);
137
+ yield* write("bundle-inventory.json", {
138
+ format: 1,
139
+ toolchain: {
140
+ bun,
141
+ lockfile_sha512: Hex.encode(
142
+ yield* crypto.digest(
143
+ Digest.sha512,
144
+ yield* fs.readFile(path.join(locked, "bun.lock")),
145
+ ),
146
+ ),
147
+ },
148
+ packages: compiled.packages,
149
+ });
150
+ const names = Array.sort(yield* fs.glob("**/*", { root: compiled.output }), Order.String);
151
+ const files = MutableList.make<string>();
152
+ for (const name of names)
153
+ if ((yield* fs.stat(path.join(compiled.output, name))).type === "File")
154
+ MutableList.append(files, name);
155
+ const staged = yield* fs.makeTempDirectoryScoped({ prefix: "dual-plugin-tarball-" });
156
+ const archive = path.join(staged, "plugin.tgz");
157
+ yield* Effect.tryPromise(() =>
158
+ tar.create(
159
+ {
160
+ cwd: compiled.output,
161
+ file: archive,
162
+ gzip: true,
163
+ portable: true,
164
+ mtime: DateTime.toDateUtc(DateTime.makeUnsafe("1980-01-01T00:00:00Z")),
165
+ prefix: "package",
166
+ },
167
+ MutableList.toArray(files),
168
+ ),
169
+ );
170
+ const isolated = path.join(staged, "isolated");
171
+ yield* fs.makeDirectory(isolated);
172
+ yield* Effect.tryPromise(() =>
173
+ tar.extract({ cwd: isolated, file: archive, strip: 1, strict: true }),
174
+ );
175
+ const inspected = yield* validation.validate(isolated);
176
+ const publicExports = Effect.fnUntraced(function* (
177
+ directory: string,
178
+ entries: (readonly [string, string])[],
179
+ ) {
180
+ const output = yield* spawner.string(
181
+ ChildProcess.make(
182
+ executable,
183
+ [
184
+ "--no-env-file",
185
+ "--no-install",
186
+ "--eval",
187
+ 'import { pathToFileURL } from "node:url"; const result = {}; for (const [source,file] of JSON.parse(process.argv[1])) result[source] = Object.keys(await import(pathToFileURL(process.cwd()+"/"+file).href)).sort(); console.log(JSON.stringify(result));',
188
+ JSON.stringify(entries),
189
+ ],
190
+ { cwd: directory, env: {}, stdin: "ignore" },
191
+ ),
192
+ );
193
+ return yield* Schema.decodeEffect(
194
+ Schema.fromJsonString(Schema.Record(Schema.String, Schema.Array(Schema.String))),
195
+ )(output.trim());
196
+ });
197
+ const originalExports = yield* publicExports(
198
+ root,
199
+ Array.map(compiled.publicJavaScript, entry => [entry.source, entry.source] as const),
200
+ );
201
+ const finalExports = yield* publicExports(
202
+ isolated,
203
+ Array.map(compiled.publicJavaScript, entry => [entry.source, entry.output] as const),
204
+ );
205
+ if (JSON.stringify(originalExports) !== JSON.stringify(finalExports))
206
+ return yield* PluginPackage.PackageError.make({
207
+ message:
208
+ "The final tarball changed public JavaScript exports; no archive was written",
209
+ });
210
+ const encode = Schema.encodeEffect(Schema.fromJsonString(PluginInspection.Result));
211
+ if ((yield* encode(original)) !== (yield* encode(inspected)))
212
+ return yield* PluginPackage.PackageError.make({
213
+ message:
214
+ "The packaged plugin identity or contracts differ from the project inspection; no archive was written",
215
+ });
216
+ const bytes = yield* fs.readFile(archive);
217
+ const file = path.resolve(output);
218
+ yield* fs.makeDirectory(path.dirname(file), { recursive: true });
219
+ const temporary = yield* fs.makeTempFileScoped({
220
+ directory: path.dirname(file),
221
+ prefix: ".dual-plugin-",
222
+ });
223
+ yield* fs.writeFile(temporary, bytes);
224
+ yield* fs.rename(temporary, file);
225
+ return {
226
+ activated: false,
227
+ digest: Hex.encode(yield* crypto.digest(Digest.sha512, bytes)),
228
+ file,
229
+ plugin: original.plugin,
230
+ published: false,
231
+ size: bytes.length,
232
+ version: original.version,
233
+ } satisfies Artifact;
234
+ },
235
+ Effect.scoped,
236
+ Effect.mapError(cause =>
237
+ Schema.is(PluginPackage.PackageError)(cause) ? cause : PluginPackage.fromCause(cause),
238
+ ),
239
+ ),
240
+ });
241
+ }),
242
+ );
243
+
244
+ export * as PluginArchive from "./archive.ts";