@dual-os/cli 0.13.0 → 0.13.2

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.
@@ -14,6 +14,7 @@ export declare const Artifact: Schema.Struct<{
14
14
  readonly file: Schema.String;
15
15
  readonly plugin: Schema.String;
16
16
  readonly published: Schema.Literal<false>;
17
+ readonly sdkVersion: Schema.String;
17
18
  readonly size: Schema.Finite;
18
19
  readonly version: Schema.String;
19
20
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"archive.d.ts","names":["PluginPackage.PackageError","PluginPackage.Service","PluginValidation.Service"],"sources":["../../src/plugin/archive.ts"],"mappings":";;;;;;;;;YA2BY,kBAAkB,SAAS;qBAC1B,UAAQ,OAAA;;;;;;;;;YAST;WACD,QACP,mBACA,mBACG,OAAO,OAAO,UAAUA;;;qBAElB,gBAAgB;qBAIhB,OAAK,MAAA,MAAA,SAAA,cAAA,eAAA,oBAAA,sBAAA,OAAA,SAAA,WAAA,aAAA,KAAA,OAAAC,YAAAC"}
1
+ {"version":3,"file":"archive.d.ts","names":["PluginPackage.PackageError","PluginPackage.Service","PluginValidation.Service"],"sources":["../../src/plugin/archive.ts"],"mappings":";;;;;;;;;YA2BY,kBAAkB,SAAS;qBAC1B,UAAQ,OAAA;;;;;;;;;;YAUT;WACD,QACP,mBACA,mBACG,OAAO,OAAO,UAAUA;;;qBAElB,gBAAgB;qBAIhB,OAAK,MAAA,MAAA,SAAA,cAAA,eAAA,oBAAA,sBAAA,OAAA,SAAA,WAAA,aAAA,KAAA,OAAAC,YAAAC"}
@@ -24,6 +24,7 @@ const Artifact = Schema.Struct({
24
24
  file: Schema.String,
25
25
  plugin: Schema.String,
26
26
  published: Schema.Literal(false),
27
+ sdkVersion: Schema.String,
27
28
  size: Schema.Finite,
28
29
  version: Schema.String
29
30
  });
@@ -168,6 +169,7 @@ const layer = Layer.effect(Service, Effect.gen(function* () {
168
169
  file,
169
170
  plugin: original.plugin,
170
171
  published: false,
172
+ sdkVersion: compiled.sdkVersion,
171
173
  size: bytes.length,
172
174
  version: original.version
173
175
  };
@@ -1 +1 @@
1
- {"version":3,"file":"archive.js","names":["PluginPackage.Service","PluginValidation.Service","makeBundle","PluginInspection.Result","PluginPackage.PackageError","PluginPackage.fromCause"],"sources":["../../src/plugin/archive.ts"],"sourcesContent":["import type { PlatformError } from \"effect\";\nimport {\n Array,\n Context,\n DateTime,\n Effect,\n FileSystem,\n Layer,\n MutableList,\n Order,\n Path,\n Schema,\n} from \"effect\";\n\nimport { Digest } from \"effect/crypto\";\nimport { Hex } from \"effect/encoding\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\nimport * as tar from \"tar\";\n\nimport { PluginRuntime } from \"@dual-os/sdk/PluginRuntime\";\n\nimport { make as makeBundle } from \"./bundle.ts\";\nimport { PluginInspection } from \"./inspection.ts\";\nimport { PluginPackage } from \"./package.ts\";\nimport { PluginValidation } from \"./validation.ts\";\n\nconst Manifest = Schema.Struct({ scripts: Schema.Record(Schema.String, Schema.String) });\nexport type Artifact = typeof Artifact.Type;\nexport const Artifact = Schema.Struct({\n activated: Schema.Literal(false),\n digest: Schema.String,\n file: Schema.String,\n plugin: Schema.String,\n published: Schema.Literal(false),\n size: Schema.Finite,\n version: Schema.String,\n});\nexport type Interface = {\n readonly build: (\n directory: string,\n output: string,\n ) => Effect.Effect<Artifact, PluginPackage.PackageError>;\n};\nexport class Service extends Context.Service<Service, Interface>()(\n \"@dual-os/cli/plugin/archive/Service\",\n) {}\n\nexport const layer = Layer.effect(\n Service,\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const crypto = yield* Digest.Digest;\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const packages = yield* PluginPackage.Service;\n const validation = yield* PluginValidation.Service;\n const buildBundle = yield* makeBundle;\n const executable = (yield* spawner.string(ChildProcess.make(\"which\", [\"bun\"]))).trim();\n return Service.of({\n build: Effect.fn(\"PluginArchive.build\")(\n function* (directory, output) {\n const root = yield* fs.realPath(path.resolve(directory));\n const lockRoot = Effect.fnUntraced(function* (\n current: string,\n ): Effect.fn.Return<string, PlatformError.PlatformError | PluginPackage.PackageError> {\n if (yield* fs.exists(path.join(current, \"bun.lock\"))) return current;\n const parent = path.dirname(current);\n if (parent === current)\n return yield* PluginPackage.PackageError.make({\n message: \"A frozen bun.lock is required to build a plugin\",\n });\n return yield* lockRoot(parent);\n });\n const locked = yield* lockRoot(root);\n const command = Effect.fnUntraced(function* (\n executable: string,\n args: string[],\n cwd: string,\n ) {\n const code = yield* spawner.exitCode(\n ChildProcess.make(executable, args, {\n cwd,\n stdin: \"ignore\",\n stdout: \"ignore\",\n stderr: \"inherit\",\n }),\n );\n if (code !== 0)\n return yield* PluginPackage.PackageError.make({\n message: `Plugin build failed: ${executable} ${Array.join(args, \" \")}`,\n });\n });\n const bun = (yield* spawner.string(ChildProcess.make(\"bun\", [\"--version\"]))).trim();\n if (bun !== \"1.4.2\")\n return yield* PluginPackage.PackageError.make({\n message: \"Plugin builds require Bun 1.4.2\",\n });\n yield* command(\n \"bun\",\n [\"install\", \"--frozen-lockfile\", \"--ignore-scripts\", \"--no-env-file\"],\n locked,\n );\n const manifest = yield* Schema.decodeEffect(Schema.fromJsonString(Manifest))(\n yield* fs.readFileString(path.join(root, \"package.json\")),\n );\n const build = manifest.scripts[\"build\"] ? \"build\" : \"prepack\";\n if (!manifest.scripts[build])\n return yield* PluginPackage.PackageError.make({\n message: \"Declare scripts.build or scripts.prepack before building a plugin\",\n });\n yield* command(\"bun\", [\"run\", \"--no-env-file\", build], root);\n const prepared = yield* packages.inspect(root);\n const original = yield* validation.validate(root);\n const compiled = yield* buildBundle(root, prepared);\n const contracts = \"dual-contracts.json\";\n if (yield* fs.exists(path.join(compiled.output, contracts)))\n return yield* PluginPackage.PackageError.make({\n message: `${contracts} is reserved for the bundled plugin contracts`,\n });\n const declaration = {\n contracts,\n entrypoint: compiled.entrypoint.replaceAll(\"\\\\\", \"/\"),\n export: prepared.export,\n format: 2,\n plugin: original.plugin,\n runner: compiled.runner,\n sdk_version: compiled.sdkVersion,\n version: original.version,\n };\n const write = (name: string, value: Schema.Json) =>\n Effect.flatMap(Schema.encodeEffect(Schema.fromJsonString(Schema.Json))(value), text =>\n fs.writeFileString(path.join(compiled.output, name), text),\n );\n yield* write(\"package.json\", {\n ...compiled.manifest,\n dependencies: {},\n devDependencies: {},\n peerDependencies: {},\n optionalDependencies: {},\n scripts: {},\n files: [\"**/*\"],\n dual: { plugin: { ...declaration, assets: compiled.assets } },\n });\n yield* write(\"dual-plugin.json\", declaration);\n yield* write(\"bundle-inventory.json\", {\n format: 1,\n toolchain: {\n bun,\n lockfile_sha512: Hex.encode(\n yield* crypto.digest(\n Digest.sha512,\n yield* fs.readFile(path.join(locked, \"bun.lock\")),\n ),\n ),\n },\n packages: compiled.packages,\n });\n const bundled = yield* validation.validate(compiled.output);\n const metadata = yield* Schema.encodeUnknownEffect(Schema.fromJsonString(Schema.Json))(\n bundled.registry,\n );\n if (Buffer.byteLength(metadata) > PluginRuntime.maxMetadataBytes)\n return yield* PluginPackage.PackageError.make({\n message: \"Bundled plugin contracts exceed the 64 MiB metadata limit\",\n });\n yield* fs.writeFileString(path.join(compiled.output, contracts), metadata);\n const names = Array.sort(yield* fs.glob(\"**/*\", { root: compiled.output }), Order.String);\n const files = MutableList.make<string>();\n for (const name of names)\n if ((yield* fs.stat(path.join(compiled.output, name))).type === \"File\")\n MutableList.append(files, name);\n const staged = yield* fs.makeTempDirectoryScoped({ prefix: \"dual-plugin-tarball-\" });\n const archive = path.join(staged, \"plugin.tgz\");\n yield* Effect.tryPromise(() =>\n tar.create(\n {\n cwd: compiled.output,\n file: archive,\n gzip: true,\n portable: true,\n mtime: DateTime.toDateUtc(DateTime.makeUnsafe(\"1980-01-01T00:00:00Z\")),\n prefix: \"package\",\n },\n MutableList.toArray(files),\n ),\n );\n const isolated = path.join(staged, \"isolated\");\n yield* fs.makeDirectory(isolated);\n yield* Effect.tryPromise(() =>\n tar.extract({ cwd: isolated, file: archive, strip: 1, strict: true }),\n );\n const inspected = yield* validation.validate(isolated);\n const publicExports = Effect.fnUntraced(function* (\n directory: string,\n entries: (readonly [string, string])[],\n ) {\n const output = yield* spawner.string(\n ChildProcess.make(\n executable,\n [\n \"--no-env-file\",\n \"--no-install\",\n \"--eval\",\n '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));',\n JSON.stringify(entries),\n ],\n { cwd: directory, env: {}, stdin: \"ignore\" },\n ),\n );\n return yield* Schema.decodeEffect(\n Schema.fromJsonString(Schema.Record(Schema.String, Schema.Array(Schema.String))),\n )(output.trim());\n });\n const originalExports = yield* publicExports(\n root,\n Array.map(compiled.publicJavaScript, entry => [entry.source, entry.source] as const),\n );\n const finalExports = yield* publicExports(\n isolated,\n Array.map(compiled.publicJavaScript, entry => [entry.source, entry.output] as const),\n );\n if (JSON.stringify(originalExports) !== JSON.stringify(finalExports))\n return yield* PluginPackage.PackageError.make({\n message:\n \"The final tarball changed public JavaScript exports; no archive was written\",\n });\n const encode = Schema.encodeEffect(Schema.fromJsonString(PluginInspection.Result));\n if (\n (yield* encode(original)) !== (yield* encode(inspected)) ||\n (yield* encode(bundled)) !== (yield* encode(inspected)) ||\n (yield* fs.readFileString(path.join(isolated, contracts))) !== metadata\n )\n return yield* PluginPackage.PackageError.make({\n message:\n \"The packaged plugin identity or contracts differ from the project inspection; no archive was written\",\n });\n const bytes = yield* fs.readFile(archive);\n const file = path.resolve(output);\n yield* fs.makeDirectory(path.dirname(file), { recursive: true });\n const temporary = yield* fs.makeTempFileScoped({\n directory: path.dirname(file),\n prefix: \".dual-plugin-\",\n });\n yield* fs.writeFile(temporary, bytes);\n yield* fs.rename(temporary, file);\n return {\n activated: false,\n digest: Hex.encode(yield* crypto.digest(Digest.sha512, bytes)),\n file,\n plugin: original.plugin,\n published: false,\n size: bytes.length,\n version: original.version,\n } satisfies Artifact;\n },\n Effect.scoped,\n Effect.mapError(cause =>\n Schema.is(PluginPackage.PackageError)(cause) ? cause : PluginPackage.fromCause(cause),\n ),\n ),\n });\n }),\n);\n\nexport * as PluginArchive from \"./archive.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA0BA,MAAM,WAAW,OAAO,OAAO,EAAE,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO,MAAM,EAAE,CAAC;AAEvF,MAAa,WAAW,OAAO,OAAO;CACpC,WAAW,OAAO,QAAQ,KAAK;CAC/B,QAAQ,OAAO;CACf,MAAM,OAAO;CACb,QAAQ,OAAO;CACf,WAAW,OAAO,QAAQ,KAAK;CAC/B,MAAM,OAAO;CACb,SAAS,OAAO;AAClB,CAAC;AAOD,IAAa,UAAb,cAA6B,QAAQ,QAA4B,CAAC,CAChE,qCACF,CAAC,CAAC,CAAC;AAEH,MAAa,QAAQ,MAAM,OACzB,SACA,OAAO,IAAI,aAAa;CACtB,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,SAAS,OAAO,OAAO;CAC7B,MAAM,UAAU,OAAO,oBAAoB;CAC3C,MAAM,WAAW,OAAOA;CACxB,MAAM,aAAa,OAAOC;CAC1B,MAAM,cAAc,OAAOC;CAC3B,MAAM,cAAc,OAAO,QAAQ,OAAO,aAAa,KAAK,SAAS,CAAC,KAAK,CAAC,CAAC,EAAA,CAAG,KAAK;CACrF,OAAO,QAAQ,GAAG,EAChB,OAAO,OAAO,GAAG,qBAAqB,CAAC,CACrC,WAAW,WAAW,QAAQ;EAC5B,MAAM,OAAO,OAAO,GAAG,SAAS,KAAK,QAAQ,SAAS,CAAC;EACvD,MAAM,WAAW,OAAO,WAAW,WACjC,SACoF;GACpF,IAAI,OAAO,GAAG,OAAO,KAAK,KAAK,SAAS,UAAU,CAAC,GAAG,OAAO;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spection.Result","PluginPackage.PackageError","PluginPackage.fromCause"],"sources":["../../src/plugin/archive.ts"],"sourcesContent":["import type { PlatformError } from \"effect\";\nimport {\n Array,\n Context,\n DateTime,\n Effect,\n FileSystem,\n Layer,\n MutableList,\n Order,\n Path,\n Schema,\n} from \"effect\";\n\nimport { Digest } from \"effect/crypto\";\nimport { Hex } from \"effect/encoding\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\nimport * as tar from \"tar\";\n\nimport { PluginRuntime } from \"@dual-os/sdk/PluginRuntime\";\n\nimport { make as makeBundle } from \"./bundle.ts\";\nimport { PluginInspection } from \"./inspection.ts\";\nimport { PluginPackage } from \"./package.ts\";\nimport { PluginValidation } from \"./validation.ts\";\n\nconst Manifest = Schema.Struct({ scripts: Schema.Record(Schema.String, Schema.String) });\nexport type Artifact = typeof Artifact.Type;\nexport const Artifact = Schema.Struct({\n activated: Schema.Literal(false),\n digest: Schema.String,\n file: Schema.String,\n plugin: Schema.String,\n published: Schema.Literal(false),\n sdkVersion: Schema.String,\n size: Schema.Finite,\n version: Schema.String,\n});\nexport type Interface = {\n readonly build: (\n directory: string,\n output: string,\n ) => Effect.Effect<Artifact, PluginPackage.PackageError>;\n};\nexport class Service extends Context.Service<Service, Interface>()(\n \"@dual-os/cli/plugin/archive/Service\",\n) {}\n\nexport const layer = Layer.effect(\n Service,\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const crypto = yield* Digest.Digest;\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const packages = yield* PluginPackage.Service;\n const validation = yield* PluginValidation.Service;\n const buildBundle = yield* makeBundle;\n const executable = (yield* spawner.string(ChildProcess.make(\"which\", [\"bun\"]))).trim();\n return Service.of({\n build: Effect.fn(\"PluginArchive.build\")(\n function* (directory, output) {\n const root = yield* fs.realPath(path.resolve(directory));\n const lockRoot = Effect.fnUntraced(function* (\n current: string,\n ): Effect.fn.Return<string, PlatformError.PlatformError | PluginPackage.PackageError> {\n if (yield* fs.exists(path.join(current, \"bun.lock\"))) return current;\n const parent = path.dirname(current);\n if (parent === current)\n return yield* PluginPackage.PackageError.make({\n message: \"A frozen bun.lock is required to build a plugin\",\n });\n return yield* lockRoot(parent);\n });\n const locked = yield* lockRoot(root);\n const command = Effect.fnUntraced(function* (\n executable: string,\n args: string[],\n cwd: string,\n ) {\n const code = yield* spawner.exitCode(\n ChildProcess.make(executable, args, {\n cwd,\n stdin: \"ignore\",\n stdout: \"ignore\",\n stderr: \"inherit\",\n }),\n );\n if (code !== 0)\n return yield* PluginPackage.PackageError.make({\n message: `Plugin build failed: ${executable} ${Array.join(args, \" \")}`,\n });\n });\n const bun = (yield* spawner.string(ChildProcess.make(\"bun\", [\"--version\"]))).trim();\n if (bun !== \"1.4.2\")\n return yield* PluginPackage.PackageError.make({\n message: \"Plugin builds require Bun 1.4.2\",\n });\n yield* command(\n \"bun\",\n [\"install\", \"--frozen-lockfile\", \"--ignore-scripts\", \"--no-env-file\"],\n locked,\n );\n const manifest = yield* Schema.decodeEffect(Schema.fromJsonString(Manifest))(\n yield* fs.readFileString(path.join(root, \"package.json\")),\n );\n const build = manifest.scripts[\"build\"] ? \"build\" : \"prepack\";\n if (!manifest.scripts[build])\n return yield* PluginPackage.PackageError.make({\n message: \"Declare scripts.build or scripts.prepack before building a plugin\",\n });\n yield* command(\"bun\", [\"run\", \"--no-env-file\", build], root);\n const prepared = yield* packages.inspect(root);\n const original = yield* validation.validate(root);\n const compiled = yield* buildBundle(root, prepared);\n const contracts = \"dual-contracts.json\";\n if (yield* fs.exists(path.join(compiled.output, contracts)))\n return yield* PluginPackage.PackageError.make({\n message: `${contracts} is reserved for the bundled plugin contracts`,\n });\n const declaration = {\n contracts,\n entrypoint: compiled.entrypoint.replaceAll(\"\\\\\", \"/\"),\n export: prepared.export,\n format: 2,\n plugin: original.plugin,\n runner: compiled.runner,\n sdk_version: compiled.sdkVersion,\n version: original.version,\n };\n const write = (name: string, value: Schema.Json) =>\n Effect.flatMap(Schema.encodeEffect(Schema.fromJsonString(Schema.Json))(value), text =>\n fs.writeFileString(path.join(compiled.output, name), text),\n );\n yield* write(\"package.json\", {\n ...compiled.manifest,\n dependencies: {},\n devDependencies: {},\n peerDependencies: {},\n optionalDependencies: {},\n scripts: {},\n files: [\"**/*\"],\n dual: { plugin: { ...declaration, assets: compiled.assets } },\n });\n yield* write(\"dual-plugin.json\", declaration);\n yield* write(\"bundle-inventory.json\", {\n format: 1,\n toolchain: {\n bun,\n lockfile_sha512: Hex.encode(\n yield* crypto.digest(\n Digest.sha512,\n yield* fs.readFile(path.join(locked, \"bun.lock\")),\n ),\n ),\n },\n packages: compiled.packages,\n });\n const bundled = yield* validation.validate(compiled.output);\n const metadata = yield* Schema.encodeUnknownEffect(Schema.fromJsonString(Schema.Json))(\n bundled.registry,\n );\n if (Buffer.byteLength(metadata) > PluginRuntime.maxMetadataBytes)\n return yield* PluginPackage.PackageError.make({\n message: \"Bundled plugin contracts exceed the 64 MiB metadata limit\",\n });\n yield* fs.writeFileString(path.join(compiled.output, contracts), metadata);\n const names = Array.sort(yield* fs.glob(\"**/*\", { root: compiled.output }), Order.String);\n const files = MutableList.make<string>();\n for (const name of names)\n if ((yield* fs.stat(path.join(compiled.output, name))).type === \"File\")\n MutableList.append(files, name);\n const staged = yield* fs.makeTempDirectoryScoped({ prefix: \"dual-plugin-tarball-\" });\n const archive = path.join(staged, \"plugin.tgz\");\n yield* Effect.tryPromise(() =>\n tar.create(\n {\n cwd: compiled.output,\n file: archive,\n gzip: true,\n portable: true,\n mtime: DateTime.toDateUtc(DateTime.makeUnsafe(\"1980-01-01T00:00:00Z\")),\n prefix: \"package\",\n },\n MutableList.toArray(files),\n ),\n );\n const isolated = path.join(staged, \"isolated\");\n yield* fs.makeDirectory(isolated);\n yield* Effect.tryPromise(() =>\n tar.extract({ cwd: isolated, file: archive, strip: 1, strict: true }),\n );\n const inspected = yield* validation.validate(isolated);\n const publicExports = Effect.fnUntraced(function* (\n directory: string,\n entries: (readonly [string, string])[],\n ) {\n const output = yield* spawner.string(\n ChildProcess.make(\n executable,\n [\n \"--no-env-file\",\n \"--no-install\",\n \"--eval\",\n '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));',\n JSON.stringify(entries),\n ],\n { cwd: directory, env: {}, stdin: \"ignore\" },\n ),\n );\n return yield* Schema.decodeEffect(\n Schema.fromJsonString(Schema.Record(Schema.String, Schema.Array(Schema.String))),\n )(output.trim());\n });\n const originalExports = yield* publicExports(\n root,\n Array.map(compiled.publicJavaScript, entry => [entry.source, entry.source] as const),\n );\n const finalExports = yield* publicExports(\n isolated,\n Array.map(compiled.publicJavaScript, entry => [entry.source, entry.output] as const),\n );\n if (JSON.stringify(originalExports) !== JSON.stringify(finalExports))\n return yield* PluginPackage.PackageError.make({\n message:\n \"The final tarball changed public JavaScript exports; no archive was written\",\n });\n const encode = Schema.encodeEffect(Schema.fromJsonString(PluginInspection.Result));\n if (\n (yield* encode(original)) !== (yield* encode(inspected)) ||\n (yield* encode(bundled)) !== (yield* encode(inspected)) ||\n (yield* fs.readFileString(path.join(isolated, contracts))) !== metadata\n )\n return yield* PluginPackage.PackageError.make({\n message:\n \"The packaged plugin identity or contracts differ from the project inspection; no archive was written\",\n });\n const bytes = yield* fs.readFile(archive);\n const file = path.resolve(output);\n yield* fs.makeDirectory(path.dirname(file), { recursive: true });\n const temporary = yield* fs.makeTempFileScoped({\n directory: path.dirname(file),\n prefix: \".dual-plugin-\",\n });\n yield* fs.writeFile(temporary, bytes);\n yield* fs.rename(temporary, file);\n return {\n activated: false,\n digest: Hex.encode(yield* crypto.digest(Digest.sha512, bytes)),\n file,\n plugin: original.plugin,\n published: false,\n sdkVersion: compiled.sdkVersion,\n size: bytes.length,\n version: original.version,\n } satisfies Artifact;\n },\n Effect.scoped,\n Effect.mapError(cause =>\n Schema.is(PluginPackage.PackageError)(cause) ? cause : PluginPackage.fromCause(cause),\n ),\n ),\n });\n }),\n);\n\nexport * as PluginArchive from \"./archive.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA0BA,MAAM,WAAW,OAAO,OAAO,EAAE,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO,MAAM,EAAE,CAAC;AAEvF,MAAa,WAAW,OAAO,OAAO;CACpC,WAAW,OAAO,QAAQ,KAAK;CAC/B,QAAQ,OAAO;CACf,MAAM,OAAO;CACb,QAAQ,OAAO;CACf,WAAW,OAAO,QAAQ,KAAK;CAC/B,YAAY,OAAO;CACnB,MAAM,OAAO;CACb,SAAS,OAAO;AAClB,CAAC;AAOD,IAAa,UAAb,cAA6B,QAAQ,QAA4B,CAAC,CAChE,qCACF,CAAC,CAAC,CAAC;AAEH,MAAa,QAAQ,MAAM,OACzB,SACA,OAAO,IAAI,aAAa;CACtB,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,SAAS,OAAO,OAAO;CAC7B,MAAM,UAAU,OAAO,oBAAoB;CAC3C,MAAM,WAAW,OAAOA;CACxB,MAAM,aAAa,OAAOC;CAC1B,MAAM,cAAc,OAAOC;CAC3B,MAAM,cAAc,OAAO,QAAQ,OAAO,aAAa,KAAK,SAAS,CAAC,KAAK,CAAC,CAAC,EAAA,CAAG,KAAK;CACrF,OAAO,QAAQ,GAAG,EAChB,OAAO,OAAO,GAAG,qBAAqB,CAAC,CACrC,WAAW,WAAW,QAAQ;EAC5B,MAAM,OAAO,OAAO,GAAG,SAAS,KAAK,QAAQ,SAAS,CAAC;EACvD,MAAM,WAAW,OAAO,WAAW,WACjC,SACoF;GACpF,IAAI,OAAO,GAAG,OAAO,KAAK,KAAK,SAAS,UAAU,CAAC,GAAG,OAAO;GAC7D,MAAM,SAAS,KAAK,QAAQ,OAAO;GACnC,IAAI,WAAW,SACb,OAAO,OAAA,aAAkC,KAAK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,SAAS,mBAAkB,UAAS,CAAC,MAAM,QAAQ,MAAM,MAAM,CAAU,CACrF;EACA,IAAI,KAAK,UAAU,eAAe,MAAM,KAAK,UAAU,YAAY,GACjE,OAAO,OAAA,aAAkC,KAAK,EAC5C,SACE,8EACJ,CAAC;EACH,MAAM,SAAS,OAAO,aAAa,OAAO,eAAeC,QAAuB,CAAC;EACjF,KACG,OAAO,OAAO,QAAQ,QAAQ,OAAO,OAAO,SAAS,OACrD,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO,SAAS,OACpD,OAAO,GAAG,eAAe,KAAK,KAAK,UAAU,SAAS,CAAC,OAAO,UAE/D,OAAO,OAAA,aAAkC,KAAK,EAC5C,SACE,uGACJ,CAAC;EACH,MAAM,QAAQ,OAAO,GAAG,SAAS,OAAO;EACxC,MAAM,OAAO,KAAK,QAAQ,MAAM;EAChC,OAAO,GAAG,cAAc,KAAK,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;EAC/D,MAAM,YAAY,OAAO,GAAG,mBAAmB;GAC7C,WAAW,KAAK,QAAQ,IAAI;GAC5B,QAAQ;EACV,CAAC;EACD,OAAO,GAAG,UAAU,WAAW,KAAK;EACpC,OAAO,GAAG,OAAO,WAAW,IAAI;EAChC,OAAO;GACL,WAAW;GACX,QAAQ,IAAI,OAAO,OAAO,OAAO,OAAO,OAAO,QAAQ,KAAK,CAAC;GAC7D;GACA,QAAQ,SAAS;GACjB,WAAW;GACX,YAAY,SAAS;GACrB,MAAM,MAAM;GACZ,SAAS,SAAS;EACpB;CACF,GACA,OAAO,QACP,OAAO,UAAS,UACd,OAAO,GAAGC,YAA0B,CAAC,CAAC,KAAK,IAAI,QAAQC,UAAwB,KAAK,CACtF,CACF,EACF,CAAC;AACH,CAAC,CACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"publication.d.ts","names":["AuthProtocol.Organizations","AuthProtocol.AuthError","CliDestination.Target","PluginPackage.PackageError","CliCredentials.Service","CliDestination.Service","PluginArchive.Service"],"sources":["../../src/plugin/publication.ts"],"mappings":";;;;;;;;;;;YAsBY,iBAAiB,QAAQ;qBACxB,SAAO,OAAA;;;;;;;;YAQR;WACD,gBACP,uBACG,OAAO,OAAOA,eAA4BC;WACtC,OACP,mBACA,QAAQC,WACL,OAAO,OAAO,SAASC,eAA6BF;;;qBAE9C,gBAAgB;qBAGhB,OAAK,MAAA,MAAA,gBAAA,WAAA,aAAA,WAAA,aAAA,KAAA,OAAAG,YAAAC,YAAAC"}
1
+ {"version":3,"file":"publication.d.ts","names":["AuthProtocol.Organizations","AuthProtocol.AuthError","CliDestination.Target","PluginPackage.PackageError","CliCredentials.Service","CliDestination.Service","PluginArchive.Service"],"sources":["../../src/plugin/publication.ts"],"mappings":";;;;;;;;;;;YA0BY,iBAAiB,QAAQ;qBACxB,SAAO,OAAA;;;;;;;;YAQR;WACD,gBACP,uBACG,OAAO,OAAOA,eAA4BC;WACtC,OACP,mBACA,QAAQC,WACL,OAAO,OAAO,SAASC,eAA6BF;;;qBAE9C,gBAAgB;qBAGhB,OAAK,MAAA,MAAA,gBAAA,WAAA,aAAA,WAAA,aAAA,KAAA,OAAAG,YAAAC,YAAAC"}
@@ -2,8 +2,10 @@ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
2
  import { PackageError, fromCause } from "./package.js";
3
3
  import { Service as Service$1 } from "./archive.js";
4
4
  import "./publication.js";
5
- import { Context, Effect, FileSystem, Inspectable, Layer, Path, Redacted, Schema, pipe } from "effect";
5
+ import { Console, Context, Effect, FileSystem, Inspectable, Layer, Path, Redacted, Schema, pipe } from "effect";
6
6
  import { HttpClient, HttpClientRequest } from "effect/http";
7
+ import semver from "semver";
8
+ import sdkPackage from "@dual-os/sdk/package.json" with { type: "json" };
7
9
  import { CliCredentials } from "#auth/credentials";
8
10
  import { CliDestination } from "#auth/destination";
9
11
  import { CliHttp } from "#auth/http";
@@ -46,6 +48,7 @@ const layer = Layer.effect(Service, Effect.gen(function* () {
46
48
  const credential = Redacted.value(yield* credentials.get(target.deployment));
47
49
  const file = path.join(yield* fs.makeTempDirectoryScoped({ prefix: "dual-plugin-push-" }), "plugin.tgz");
48
50
  const artifact = yield* archives.build(directory, file);
51
+ if (semver.lt(artifact.sdkVersion, `${semver.major(sdkPackage.version)}.${semver.minor(sdkPackage.version)}.0`)) yield* Console.error(`Warning: this plugin uses @dual-os/sdk ${artifact.sdkVersion}, an older minor than this CLI's ${sdkPackage.version}. Dual stops accepting it for publication when the next SDK minor ships; run \`bun add @dual-os/sdk@${sdkPackage.version}\`.`);
49
52
  const response = yield* client.execute(pipe(HttpClientRequest.post(new URL("/api/cli/plugins/push", target.deployment).href), HttpClientRequest.bearerToken(credential.token), HttpClientRequest.setHeaders({
50
53
  "x-dual-artifact-sha512": artifact.digest,
51
54
  "x-dual-organization-id": target.organizationId,
@@ -1 +1 @@
1
- {"version":3,"file":"publication.js","names":["PluginArchive.Service","PluginPackage.PackageError","PluginPackage.fromCause"],"sources":["../../src/plugin/publication.ts"],"sourcesContent":["import {\n Context,\n Effect,\n FileSystem,\n Inspectable,\n Layer,\n Path,\n Redacted,\n Schema,\n pipe,\n} from \"effect\";\n\nimport { HttpClient, HttpClientRequest } from \"effect/http\";\n\nimport { CliCredentials } from \"#auth/credentials\";\nimport { CliDestination } from \"#auth/destination\";\nimport { CliHttp } from \"#auth/http\";\nimport { AuthProtocol } from \"#auth/protocol\";\n\nimport { PluginArchive } from \"./archive.ts\";\nimport { PluginPackage } from \"./package.ts\";\n\nexport type Receipt = typeof Receipt.Type;\nexport const Receipt = Schema.Struct({\n digest: Schema.String.check(Schema.isPattern(/^[a-f0-9]{128}$/u)),\n organizationId: Schema.NonEmptyString,\n plugin: Schema.NonEmptyString,\n published: Schema.Literal(true),\n status: Schema.Literal(\"validated\"),\n version: Schema.NonEmptyString,\n});\nexport type Interface = {\n readonly organizations: (\n deployment: string,\n ) => Effect.Effect<AuthProtocol.Organizations, AuthProtocol.AuthError>;\n readonly push: (\n directory: string,\n target: CliDestination.Target,\n ) => Effect.Effect<Receipt, PluginPackage.PackageError | AuthProtocol.AuthError>;\n};\nexport class Service extends Context.Service<Service, Interface>()(\n \"@dual-os/cli/plugin/publication/Service\",\n) {}\nexport const layer = Layer.effect(\n Service,\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const client = CliHttp.withErrors(yield* HttpClient.HttpClient);\n const credentials = yield* CliCredentials.Service;\n const archives = yield* PluginArchive.Service;\n const destination = yield* CliDestination.Service;\n const mapError = Effect.mapError(cause =>\n Schema.is(AuthProtocol.AuthError)(cause) || Schema.is(PluginPackage.PackageError)(cause)\n ? cause\n : PluginPackage.fromCause(cause),\n );\n return Service.of({\n organizations: Effect.fn(\"PluginPublication.organizations\")(\n function* (deployment) {\n const credential = Redacted.value(yield* credentials.get(deployment));\n const response = yield* client.execute(\n pipe(\n HttpClientRequest.get(new URL(\"/api/cli-auth/organizations\", deployment).href),\n HttpClientRequest.bearerToken(credential.token),\n ),\n );\n yield* CliHttp.requireStatus(response, [200]);\n return yield* Schema.decodeUnknownEffect(AuthProtocol.Organizations)(\n yield* pipe(response.json, Effect.mapError(CliHttp.fromCause)),\n );\n },\n Effect.scoped,\n Effect.mapError(cause =>\n Schema.is(AuthProtocol.AuthError)(cause)\n ? cause\n : AuthProtocol.AuthError.make({\n cause: Redacted.make(cause),\n message: Inspectable.toStringUnknown(cause),\n }),\n ),\n ),\n push: Effect.fn(\"PluginPublication.push\")(\n function* (directory, target) {\n const credential = Redacted.value(yield* credentials.get(target.deployment));\n const file = path.join(\n yield* fs.makeTempDirectoryScoped({ prefix: \"dual-plugin-push-\" }),\n \"plugin.tgz\",\n );\n const artifact = yield* archives.build(directory, file);\n const response = yield* client.execute(\n pipe(\n HttpClientRequest.post(new URL(\"/api/cli/plugins/push\", target.deployment).href),\n HttpClientRequest.bearerToken(credential.token),\n HttpClientRequest.setHeaders({\n \"x-dual-artifact-sha512\": artifact.digest,\n \"x-dual-organization-id\": target.organizationId,\n \"x-dual-plugin-key\": artifact.plugin,\n \"x-dual-plugin-version\": artifact.version,\n }),\n HttpClientRequest.bodyUint8Array(yield* fs.readFile(file), \"application/gzip\"),\n ),\n );\n yield* CliHttp.requireStatus(response, [200, 201]);\n const receipt = yield* Schema.decodeUnknownEffect(Receipt)(\n yield* pipe(response.json, Effect.mapError(CliHttp.fromCause)),\n );\n if (\n receipt.digest !== artifact.digest ||\n receipt.plugin !== artifact.plugin ||\n receipt.version !== artifact.version ||\n receipt.organizationId !== target.organizationId\n ) {\n return yield* AuthProtocol.AuthError.make({\n message:\n \"Dual returned a different artifact identity. No publication success was confirmed.\",\n });\n }\n yield* destination.save(directory, target);\n return receipt;\n },\n Effect.scoped,\n mapError,\n ),\n });\n }),\n);\nexport * as PluginPublication from \"./publication.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAuBA,MAAa,UAAU,OAAO,OAAO;CACnC,QAAQ,OAAO,OAAO,MAAM,OAAO,UAAU,kBAAkB,CAAC;CAChE,gBAAgB,OAAO;CACvB,QAAQ,OAAO;CACf,WAAW,OAAO,QAAQ,IAAI;CAC9B,QAAQ,OAAO,QAAQ,WAAW;CAClC,SAAS,OAAO;AAClB,CAAC;AAUD,IAAa,UAAb,cAA6B,QAAQ,QAA4B,CAAC,CAChE,yCACF,CAAC,CAAC,CAAC;AACH,MAAa,QAAQ,MAAM,OACzB,SACA,OAAO,IAAI,aAAa;CACtB,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,SAAS,QAAQ,WAAW,OAAO,WAAW,UAAU;CAC9D,MAAM,cAAc,OAAO,eAAe;CAC1C,MAAM,WAAW,OAAOA;CACxB,MAAM,cAAc,OAAO,eAAe;CAC1C,MAAM,WAAW,OAAO,UAAS,UAC/B,OAAO,GAAG,aAAa,SAAS,CAAC,CAAC,KAAK,KAAK,OAAO,GAAGC,YAA0B,CAAC,CAAC,KAAK,IACnF,QACAC,UAAwB,KAAK,CAC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AAkB,CAC/E,CACF;GACA,OAAO,QAAQ,cAAc,UAAU,CAAC,KAAK,GAAG,CAAC;GACjD,MAAM,UAAU,OAAO,OAAO,oBAAoB,OAAO,CAAC,CACxD,OAAO,KAAK,SAAS,MAAM,OAAO,SAAS,QAAQ,SAAS,CAAC,CAC/D;GACA,IACE,QAAQ,WAAW,SAAS,UAC5B,QAAQ,WAAW,SAAS,UAC5B,QAAQ,YAAY,SAAS,WAC7B,QAAQ,mBAAmB,OAAO,gBAElC,OAAO,OAAO,aAAa,UAAU,KAAK,EACxC,SACE,qFACJ,CAAC;GAEH,OAAO,YAAY,KAAK,WAAW,MAAM;GACzC,OAAO;EACT,GACA,OAAO,QACP,QACF;CACF,CAAC;AACH,CAAC,CACH"}
1
+ {"version":3,"file":"publication.js","names":["PluginArchive.Service","PluginPackage.PackageError","PluginPackage.fromCause"],"sources":["../../src/plugin/publication.ts"],"sourcesContent":["import {\n Console,\n Context,\n Effect,\n FileSystem,\n Inspectable,\n Layer,\n Path,\n Redacted,\n Schema,\n pipe,\n} from \"effect\";\n\nimport { HttpClient, HttpClientRequest } from \"effect/http\";\nimport semver from \"semver\";\n\nimport sdkPackage from \"@dual-os/sdk/package.json\" with { type: \"json\" };\n\nimport { CliCredentials } from \"#auth/credentials\";\nimport { CliDestination } from \"#auth/destination\";\nimport { CliHttp } from \"#auth/http\";\nimport { AuthProtocol } from \"#auth/protocol\";\n\nimport { PluginArchive } from \"./archive.ts\";\nimport { PluginPackage } from \"./package.ts\";\n\nexport type Receipt = typeof Receipt.Type;\nexport const Receipt = Schema.Struct({\n digest: Schema.String.check(Schema.isPattern(/^[a-f0-9]{128}$/u)),\n organizationId: Schema.NonEmptyString,\n plugin: Schema.NonEmptyString,\n published: Schema.Literal(true),\n status: Schema.Literal(\"validated\"),\n version: Schema.NonEmptyString,\n});\nexport type Interface = {\n readonly organizations: (\n deployment: string,\n ) => Effect.Effect<AuthProtocol.Organizations, AuthProtocol.AuthError>;\n readonly push: (\n directory: string,\n target: CliDestination.Target,\n ) => Effect.Effect<Receipt, PluginPackage.PackageError | AuthProtocol.AuthError>;\n};\nexport class Service extends Context.Service<Service, Interface>()(\n \"@dual-os/cli/plugin/publication/Service\",\n) {}\nexport const layer = Layer.effect(\n Service,\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const client = CliHttp.withErrors(yield* HttpClient.HttpClient);\n const credentials = yield* CliCredentials.Service;\n const archives = yield* PluginArchive.Service;\n const destination = yield* CliDestination.Service;\n const mapError = Effect.mapError(cause =>\n Schema.is(AuthProtocol.AuthError)(cause) || Schema.is(PluginPackage.PackageError)(cause)\n ? cause\n : PluginPackage.fromCause(cause),\n );\n return Service.of({\n organizations: Effect.fn(\"PluginPublication.organizations\")(\n function* (deployment) {\n const credential = Redacted.value(yield* credentials.get(deployment));\n const response = yield* client.execute(\n pipe(\n HttpClientRequest.get(new URL(\"/api/cli-auth/organizations\", deployment).href),\n HttpClientRequest.bearerToken(credential.token),\n ),\n );\n yield* CliHttp.requireStatus(response, [200]);\n return yield* Schema.decodeUnknownEffect(AuthProtocol.Organizations)(\n yield* pipe(response.json, Effect.mapError(CliHttp.fromCause)),\n );\n },\n Effect.scoped,\n Effect.mapError(cause =>\n Schema.is(AuthProtocol.AuthError)(cause)\n ? cause\n : AuthProtocol.AuthError.make({\n cause: Redacted.make(cause),\n message: Inspectable.toStringUnknown(cause),\n }),\n ),\n ),\n push: Effect.fn(\"PluginPublication.push\")(\n function* (directory, target) {\n const credential = Redacted.value(yield* credentials.get(target.deployment));\n const file = path.join(\n yield* fs.makeTempDirectoryScoped({ prefix: \"dual-plugin-push-\" }),\n \"plugin.tgz\",\n );\n const artifact = yield* archives.build(directory, file);\n if (\n semver.lt(\n artifact.sdkVersion,\n `${semver.major(sdkPackage.version)}.${semver.minor(sdkPackage.version)}.0`,\n )\n )\n yield* Console.error(\n `Warning: this plugin uses @dual-os/sdk ${artifact.sdkVersion}, an older minor than this CLI's ${sdkPackage.version}. Dual stops accepting it for publication when the next SDK minor ships; run \\`bun add @dual-os/sdk@${sdkPackage.version}\\`.`,\n );\n const response = yield* client.execute(\n pipe(\n HttpClientRequest.post(new URL(\"/api/cli/plugins/push\", target.deployment).href),\n HttpClientRequest.bearerToken(credential.token),\n HttpClientRequest.setHeaders({\n \"x-dual-artifact-sha512\": artifact.digest,\n \"x-dual-organization-id\": target.organizationId,\n \"x-dual-plugin-key\": artifact.plugin,\n \"x-dual-plugin-version\": artifact.version,\n }),\n HttpClientRequest.bodyUint8Array(yield* fs.readFile(file), \"application/gzip\"),\n ),\n );\n yield* CliHttp.requireStatus(response, [200, 201]);\n const receipt = yield* Schema.decodeUnknownEffect(Receipt)(\n yield* pipe(response.json, Effect.mapError(CliHttp.fromCause)),\n );\n if (\n receipt.digest !== artifact.digest ||\n receipt.plugin !== artifact.plugin ||\n receipt.version !== artifact.version ||\n receipt.organizationId !== target.organizationId\n ) {\n return yield* AuthProtocol.AuthError.make({\n message:\n \"Dual returned a different artifact identity. No publication success was confirmed.\",\n });\n }\n yield* destination.save(directory, target);\n return receipt;\n },\n Effect.scoped,\n mapError,\n ),\n });\n }),\n);\nexport * as PluginPublication from \"./publication.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA2BA,MAAa,UAAU,OAAO,OAAO;CACnC,QAAQ,OAAO,OAAO,MAAM,OAAO,UAAU,kBAAkB,CAAC;CAChE,gBAAgB,OAAO;CACvB,QAAQ,OAAO;CACf,WAAW,OAAO,QAAQ,IAAI;CAC9B,QAAQ,OAAO,QAAQ,WAAW;CAClC,SAAS,OAAO;AAClB,CAAC;AAUD,IAAa,UAAb,cAA6B,QAAQ,QAA4B,CAAC,CAChE,yCACF,CAAC,CAAC,CAAC;AACH,MAAa,QAAQ,MAAM,OACzB,SACA,OAAO,IAAI,aAAa;CACtB,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,SAAS,QAAQ,WAAW,OAAO,W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AO,EAAE,GAAG,OAAO,MAAM,WAAW,OAAO,EAAE,GAC1E,GAEA,OAAO,QAAQ,MACb,0CAA0C,SAAS,WAAW,mCAAmC,WAAW,QAAQ,sGAAsG,WAAW,QAAQ,IAC/O;GACF,MAAM,WAAW,OAAO,OAAO,QAC7B,KACE,kBAAkB,KAAK,IAAI,IAAI,yBAAyB,OAAO,UAAU,CAAC,CAAC,IAAI,GAC/E,kBAAkB,YAAY,WAAW,KAAK,GAC9C,kBAAkB,WAAW;IAC3B,0BAA0B,SAAS;IACnC,0BAA0B,OAAO;IACjC,qBAAqB,SAAS;IAC9B,yBAAyB,SAAS;GACpC,CAAC,GACD,kBAAkB,eAAe,OAAO,GAAG,SAAS,IAAI,GAAG,kBAAkB,CAC/E,CACF;GACA,OAAO,QAAQ,cAAc,UAAU,CAAC,KAAK,GAAG,CAAC;GACjD,MAAM,UAAU,OAAO,OAAO,oBAAoB,OAAO,CAAC,CACxD,OAAO,KAAK,SAAS,MAAM,OAAO,SAAS,QAAQ,SAAS,CAAC,CAC/D;GACA,IACE,QAAQ,WAAW,SAAS,UAC5B,QAAQ,WAAW,SAAS,UAC5B,QAAQ,YAAY,SAAS,WAC7B,QAAQ,mBAAmB,OAAO,gBAElC,OAAO,OAAO,aAAa,UAAU,KAAK,EACxC,SACE,qFACJ,CAAC;GAEH,OAAO,YAAY,KAAK,WAAW,MAAM;GACzC,OAAO;EACT,GACA,OAAO,QACP,QACF;CACF,CAAC;AACH,CAAC,CACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dual-os/cli",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
4
4
  "license": "UNLICENSED",
5
5
  "bin": {
6
6
  "dual": "./dist/bin.js"
@@ -44,7 +44,7 @@
44
44
  "typecheck": "tsrs --build tsconfig.json --force --pretty false"
45
45
  },
46
46
  "dependencies": {
47
- "@dual-os/sdk": "0.10.0",
47
+ "@dual-os/sdk": "0.11.0",
48
48
  "@effect/platform-node": "4.1.2",
49
49
  "@effect/platform-node-shared": "4.1.2",
50
50
  "acorn": "8.17.0",
@@ -60,8 +60,8 @@
60
60
  "vite-plus": "1.4.0"
61
61
  },
62
62
  "devDependencies": {
63
- "@dual/core": "0.20.4",
64
- "@dual/dualspec": "0.5.4",
63
+ "@dual/core": "0.21.0",
64
+ "@dual/dualspec": "0.5.5",
65
65
  "@dual/workspace-opensandbox": "0.4.1",
66
66
  "@types/js-yaml": "4.0.9",
67
67
  "@types/node": "25.9.5",
@@ -32,6 +32,7 @@ export const Artifact = Schema.Struct({
32
32
  file: Schema.String,
33
33
  plugin: Schema.String,
34
34
  published: Schema.Literal(false),
35
+ sdkVersion: Schema.String,
35
36
  size: Schema.Finite,
36
37
  version: Schema.String,
37
38
  });
@@ -249,6 +250,7 @@ export const layer = Layer.effect(
249
250
  file,
250
251
  plugin: original.plugin,
251
252
  published: false,
253
+ sdkVersion: compiled.sdkVersion,
252
254
  size: bytes.length,
253
255
  version: original.version,
254
256
  } satisfies Artifact;
@@ -1,4 +1,5 @@
1
1
  import {
2
+ Console,
2
3
  Context,
3
4
  Effect,
4
5
  FileSystem,
@@ -11,6 +12,9 @@ import {
11
12
  } from "effect";
12
13
 
13
14
  import { HttpClient, HttpClientRequest } from "effect/http";
15
+ import semver from "semver";
16
+
17
+ import sdkPackage from "@dual-os/sdk/package.json" with { type: "json" };
14
18
 
15
19
  import { CliCredentials } from "#auth/credentials";
16
20
  import { CliDestination } from "#auth/destination";
@@ -88,6 +92,15 @@ export const layer = Layer.effect(
88
92
  "plugin.tgz",
89
93
  );
90
94
  const artifact = yield* archives.build(directory, file);
95
+ if (
96
+ semver.lt(
97
+ artifact.sdkVersion,
98
+ `${semver.major(sdkPackage.version)}.${semver.minor(sdkPackage.version)}.0`,
99
+ )
100
+ )
101
+ yield* Console.error(
102
+ `Warning: this plugin uses @dual-os/sdk ${artifact.sdkVersion}, an older minor than this CLI's ${sdkPackage.version}. Dual stops accepting it for publication when the next SDK minor ships; run \`bun add @dual-os/sdk@${sdkPackage.version}\`.`,
103
+ );
91
104
  const response = yield* client.execute(
92
105
  pipe(
93
106
  HttpClientRequest.post(new URL("/api/cli/plugins/push", target.deployment).href),