openspecui 0.9.5 → 1.0.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 (36) hide show
  1. package/dist/cli.mjs +109 -8
  2. package/dist/index.mjs +1 -1
  3. package/dist/{open-CgagzOBo.mjs → open-BVmQScxd.mjs} +1 -1
  4. package/dist/{src-5u2R3Fnr.mjs → src-9rYAmuTz.mjs} +10442 -865
  5. package/package.json +5 -4
  6. package/web/assets/BufferResource-CVUoegR6.js +185 -0
  7. package/web/assets/CanvasRenderer-BEIcB8i1.js +1 -0
  8. package/web/assets/Filter-Bu_qhr6H.js +1 -0
  9. package/web/assets/RenderTargetSystem-DWouFDxU.js +172 -0
  10. package/web/assets/WebGLRenderer-6FH_N1FV.js +156 -0
  11. package/web/assets/WebGPURenderer-B8sJk3Sv.js +41 -0
  12. package/web/assets/browserAll-CLKeV1yb.js +14 -0
  13. package/web/assets/gemini-Bk-V9kKu.png +0 -0
  14. package/web/assets/{index-Bp00uZNc.js → index-BE5-y0_g.js} +1 -1
  15. package/web/assets/{index-CCfVkFzN.js → index-BPCTI2mG.js} +1 -1
  16. package/web/assets/{index-BsTieXqQ.js → index-BRp8MJ9v.js} +1 -1
  17. package/web/assets/{index-8c6bEJ99.js → index-BlZ-sasH.js} +1 -1
  18. package/web/assets/{index-Bafja8o4.js → index-Bp_dnlLF.js} +1 -1
  19. package/web/assets/{index-ftYom_wU.js → index-BtNuxyw4.js} +1 -1
  20. package/web/assets/index-Bv7pWR8R.js +7 -0
  21. package/web/assets/{index-D3mXuuih.js → index-Byr3HkRi.js} +1 -1
  22. package/web/assets/index-CEHMo0EU.js +1385 -0
  23. package/web/assets/{index-eA_XNQ_L.js → index-CEKSUzvw.js} +1 -1
  24. package/web/assets/index-CEf9wXLh.css +1 -0
  25. package/web/assets/{index-ArhptQw0.js → index-CX13iBBs.js} +1 -1
  26. package/web/assets/index-CoOT7eZ9.js +1 -0
  27. package/web/assets/{index-B1hpa--1.js → index-D4AU46yO.js} +1 -1
  28. package/web/assets/{index-BvGAWAqS.js → index-DXRZmZm8.js} +1 -1
  29. package/web/assets/{index-AbWe21oh.js → index-eQZwF8qE.js} +1 -1
  30. package/web/assets/{index-gvPT4BlL.js → index-mWXhCp9j.js} +1 -1
  31. package/web/assets/webworkerAll-DjWoTx9g.js +83 -0
  32. package/web/index.html +2 -2
  33. package/web/assets/index-D-Urq2hl.css +0 -1
  34. package/web/assets/index-DFOLYN6W.js +0 -1
  35. package/web/assets/index-DpxkOmNJ.js +0 -7
  36. package/web/assets/index-YZ-iXB95.js +0 -309
package/dist/cli.mjs CHANGED
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { a as __toESM, i as __commonJS, r as OpenSpecAdapter, t as startServer } from "./src-5u2R3Fnr.mjs";
2
+ import { a as SchemaInfoSchema, c as CliExecutor, d as __commonJS, f as __toESM, i as SchemaDetailSchema, l as ConfigManager, o as SchemaResolutionSchema, r as require_dist, s as TemplatesSchema, t as startServer, u as OpenSpecAdapter } from "./src-9rYAmuTz.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { fileURLToPath } from "url";
5
5
  import { basename, dirname, extname, join, normalize, relative, resolve } from "path";
6
+ import { readFile } from "node:fs/promises";
6
7
  import { dirname as dirname$1, join as join$1, resolve as resolve$1 } from "node:path";
7
8
  import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
8
- import { readFileSync as readFileSync$1, readdirSync as readdirSync$1, statSync as statSync$1, writeFile } from "fs";
9
+ import { readFileSync as readFileSync$1, readdirSync as readdirSync$1, statSync as statSync$1, writeFile as writeFile$1 } from "fs";
9
10
  import { format, inspect } from "util";
10
11
  import { fileURLToPath as fileURLToPath$1 } from "node:url";
11
12
  import { notStrictEqual, strictEqual } from "assert";
@@ -1436,7 +1437,7 @@ function getProcessArgvBin() {
1436
1437
  var node_default = {
1437
1438
  fs: {
1438
1439
  readFileSync: readFileSync$1,
1439
- writeFile
1440
+ writeFile: writeFile$1
1440
1441
  },
1441
1442
  format,
1442
1443
  resolve,
@@ -2618,11 +2619,11 @@ function usage(yargs, shim$2) {
2618
2619
  };
2619
2620
  self.stringifiedValues = function stringifiedValues(values, separator) {
2620
2621
  let string = "";
2621
- const sep = separator || ", ";
2622
+ const sep$1 = separator || ", ";
2622
2623
  const array = [].concat(values);
2623
2624
  if (!values || !array.length) return string;
2624
2625
  array.forEach((value) => {
2625
- if (string.length) string += sep;
2626
+ if (string.length) string += sep$1;
2626
2627
  string += JSON.stringify(value);
2627
2628
  });
2628
2629
  return string;
@@ -4504,7 +4505,7 @@ var yargs_default = Yargs;
4504
4505
 
4505
4506
  //#endregion
4506
4507
  //#region package.json
4507
- var version = "0.9.5";
4508
+ var version = "1.0.0";
4508
4509
  var devDependencies = {
4509
4510
  "@hono/node-server": "^1.14.1",
4510
4511
  "@openspecui/server": "workspace:*",
@@ -4523,13 +4524,63 @@ var devDependencies = {
4523
4524
 
4524
4525
  //#endregion
4525
4526
  //#region src/export.ts
4527
+ var import_dist = require_dist();
4526
4528
  const __dirname$1 = dirname$1(fileURLToPath$1(import.meta.url));
4529
+ function parseCliJson(raw, schema, label) {
4530
+ const trimmed = raw.trim();
4531
+ if (!trimmed) throw new Error(`${label} returned empty output`);
4532
+ let parsed;
4533
+ try {
4534
+ parsed = JSON.parse(trimmed);
4535
+ } catch (err) {
4536
+ const message = err instanceof Error ? err.message : String(err);
4537
+ throw new Error(`${label} returned invalid JSON: ${message}`);
4538
+ }
4539
+ const result = schema.safeParse(parsed);
4540
+ if (!result.success) throw new Error(`${label} returned unexpected JSON: ${result.error.message}`);
4541
+ return result.data;
4542
+ }
4543
+ function parseSchemaYaml(content) {
4544
+ const raw = (0, import_dist.parse)(content);
4545
+ if (!raw || typeof raw !== "object") throw new Error("Invalid schema.yaml: expected YAML object");
4546
+ const schemaObj = raw;
4547
+ const artifacts = (Array.isArray(schemaObj.artifacts) ? schemaObj.artifacts : []).map((artifact) => {
4548
+ if (!artifact || typeof artifact !== "object") throw new Error("Invalid schema.yaml: artifacts must be objects");
4549
+ const artifactObj = artifact;
4550
+ return {
4551
+ id: typeof artifactObj.id === "string" ? artifactObj.id : "",
4552
+ outputPath: typeof artifactObj.generates === "string" ? artifactObj.generates : "",
4553
+ description: typeof artifactObj.description === "string" ? artifactObj.description : void 0,
4554
+ template: typeof artifactObj.template === "string" ? artifactObj.template : void 0,
4555
+ instruction: typeof artifactObj.instruction === "string" ? artifactObj.instruction : void 0,
4556
+ requires: Array.isArray(artifactObj.requires) ? artifactObj.requires.filter((value) => typeof value === "string") : []
4557
+ };
4558
+ });
4559
+ const apply = schemaObj.apply;
4560
+ const applyObj = apply && typeof apply === "object" ? apply : {};
4561
+ const applyRequires = Array.isArray(applyObj.requires) ? applyObj.requires.filter((value) => typeof value === "string") : [];
4562
+ const applyTracks = typeof applyObj.tracks === "string" ? applyObj.tracks : void 0;
4563
+ const applyInstruction = typeof applyObj.instruction === "string" ? applyObj.instruction : void 0;
4564
+ const detail = {
4565
+ name: typeof schemaObj.name === "string" ? schemaObj.name : "",
4566
+ description: typeof schemaObj.description === "string" ? schemaObj.description : void 0,
4567
+ version: typeof schemaObj.version === "string" || typeof schemaObj.version === "number" ? schemaObj.version : void 0,
4568
+ artifacts,
4569
+ applyRequires,
4570
+ applyTracks,
4571
+ applyInstruction
4572
+ };
4573
+ const validated = SchemaDetailSchema.safeParse(detail);
4574
+ if (!validated.success) throw new Error(`Invalid schema.yaml detail: ${validated.error.message}`);
4575
+ return validated.data;
4576
+ }
4527
4577
  /**
4528
4578
  * Generate a complete data snapshot of the OpenSpec project
4529
4579
  * (Kept for backwards compatibility and testing)
4530
4580
  */
4531
4581
  async function generateSnapshot(projectDir) {
4532
4582
  const adapter = new OpenSpecAdapter(projectDir);
4583
+ const cliExecutor = new CliExecutor(new ConfigManager(projectDir), projectDir);
4533
4584
  if (!await adapter.isInitialized()) throw new Error(`OpenSpec not initialized in ${projectDir}`);
4534
4585
  const specsMeta = await adapter.listSpecsWithMeta();
4535
4586
  const specs = await Promise.all(specsMeta.map(async (meta) => {
@@ -4600,6 +4651,48 @@ async function generateSnapshot(projectDir) {
4600
4651
  try {
4601
4652
  agentsMd = await adapter.readAgentsMd() ?? void 0;
4602
4653
  } catch {}
4654
+ let configYaml;
4655
+ let schemas = [];
4656
+ const schemaDetails = {};
4657
+ const schemaResolutions = {};
4658
+ const templates = {};
4659
+ const changeMetadata = {};
4660
+ try {
4661
+ configYaml = await readFile(join$1(projectDir, "openspec", "config.yaml"), "utf-8");
4662
+ } catch {
4663
+ configYaml = void 0;
4664
+ }
4665
+ try {
4666
+ const schemasResult = await cliExecutor.schemas();
4667
+ if (schemasResult.success) schemas = parseCliJson(schemasResult.stdout, SchemaInfoSchema.array(), "openspec schemas");
4668
+ } catch {
4669
+ schemas = [];
4670
+ }
4671
+ for (const schema of schemas) {
4672
+ try {
4673
+ const resolutionResult = await cliExecutor.schemaWhich(schema.name);
4674
+ if (resolutionResult.success) {
4675
+ const resolution = parseCliJson(resolutionResult.stdout, SchemaResolutionSchema, "openspec schema which");
4676
+ schemaResolutions[schema.name] = resolution;
4677
+ try {
4678
+ const schemaContent = await readFile(join$1(resolution.path, "schema.yaml"), "utf-8");
4679
+ schemaDetails[schema.name] = parseSchemaYaml(schemaContent);
4680
+ } catch {}
4681
+ }
4682
+ } catch {}
4683
+ try {
4684
+ const templatesResult = await cliExecutor.templates(schema.name);
4685
+ if (templatesResult.success) templates[schema.name] = parseCliJson(templatesResult.stdout, TemplatesSchema, "openspec templates");
4686
+ } catch {}
4687
+ }
4688
+ try {
4689
+ const changeIds = await adapter.listChanges();
4690
+ for (const changeId of changeIds) try {
4691
+ changeMetadata[changeId] = await readFile(join$1(projectDir, "openspec", "changes", changeId, ".openspec.yaml"), "utf-8");
4692
+ } catch {
4693
+ changeMetadata[changeId] = null;
4694
+ }
4695
+ } catch {}
4603
4696
  return {
4604
4697
  meta: {
4605
4698
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -4615,7 +4708,15 @@ async function generateSnapshot(projectDir) {
4615
4708
  changes: changes.filter((c) => c !== null),
4616
4709
  archives,
4617
4710
  projectMd,
4618
- agentsMd
4711
+ agentsMd,
4712
+ opsx: {
4713
+ configYaml,
4714
+ schemas,
4715
+ schemaDetails,
4716
+ schemaResolutions,
4717
+ templates,
4718
+ changeMetadata
4719
+ }
4619
4720
  };
4620
4721
  }
4621
4722
  /**
@@ -4875,7 +4976,7 @@ async function main() {
4875
4976
  console.log(`✅ Server running at ${server.url}`);
4876
4977
  console.log("");
4877
4978
  if (argv.open) {
4878
- await (await import("./open-CgagzOBo.mjs")).default(server.url);
4979
+ await (await import("./open-BVmQScxd.mjs")).default(server.url);
4879
4980
  console.log("🌐 Browser opened");
4880
4981
  }
4881
4982
  console.log("");
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { n as createServer, t as startServer } from "./src-5u2R3Fnr.mjs";
1
+ import { n as createServer, t as startServer } from "./src-9rYAmuTz.mjs";
2
2
 
3
3
  export { createServer, startServer };
@@ -1,12 +1,12 @@
1
1
  import fs, { constants } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import fs$1 from "node:fs";
4
- import os from "node:os";
5
4
  import { fileURLToPath } from "node:url";
6
5
  import childProcess, { execFile } from "node:child_process";
7
6
  import process from "node:process";
8
7
  import { Buffer } from "node:buffer";
9
8
  import { promisify } from "node:util";
9
+ import os from "node:os";
10
10
 
11
11
  //#region ../../node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js
12
12
  let isDockerCached;