@acidicsoil/portable-capabilities 0.1.4 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist-release/catalog/roles/acceptance-criteria-synthesis.yaml +84 -0
  2. package/dist-release/catalog/roles/anti-pattern-inversion.yaml +83 -0
  3. package/dist-release/catalog/roles/behavior-preserving-refactor.yaml +88 -0
  4. package/dist-release/catalog/roles/canonical-exemplar-generalization.yaml +84 -0
  5. package/dist-release/catalog/roles/constrained-exemplar-adaptation.yaml +85 -0
  6. package/dist-release/catalog/roles/convention-mining.yaml +81 -0
  7. package/dist-release/catalog/roles/conversation-to-specification.yaml +83 -0
  8. package/dist-release/catalog/roles/delta-analysis.yaml +84 -0
  9. package/dist-release/catalog/roles/domain-context-boundary.yaml +82 -0
  10. package/dist-release/catalog/roles/evaluation-harness-design.yaml +86 -0
  11. package/dist-release/catalog/roles/failure-to-guardrail.yaml +81 -0
  12. package/dist-release/catalog/roles/multi-exemplar-consensus.yaml +81 -0
  13. package/dist-release/catalog/roles/reference-trace-mapping.yaml +83 -0
  14. package/dist-release/catalog/roles/reusable-workflow-abstraction.yaml +82 -0
  15. package/dist-release/catalog/roles/structural-pattern-extraction.yaml +82 -0
  16. package/dist-release/catalog/roles/template-family-generation.yaml +83 -0
  17. package/dist-release/catalog/runtime-profiles/antigravity.yaml +60 -0
  18. package/dist-release/catalog/runtime-profiles/claude-code.yaml +65 -0
  19. package/dist-release/catalog/runtime-profiles/codex.yaml +71 -0
  20. package/dist-release/catalog/runtime-profiles/dcode.yaml +67 -0
  21. package/dist-release/catalog/runtime-profiles/oh-my-pi.yaml +62 -0
  22. package/dist-release/catalog/runtime-profiles/opencode.yaml +65 -0
  23. package/dist-release/catalog/runtime-profiles/pi.yaml +66 -0
  24. package/dist-release/cli.js +77 -37
  25. package/dist-release/cli.js.map +3 -3
  26. package/dist-release/index.js +77 -37
  27. package/dist-release/index.js.map +3 -3
  28. package/package.json +3 -1
@@ -13168,10 +13168,7 @@ function writeEnvelope(envelope, format2) {
13168
13168
  }
13169
13169
 
13170
13170
  // packages/cli/src/release.ts
13171
- import { createRequire } from "node:module";
13172
- var require2 = createRequire(import.meta.url);
13173
- var packageMetadata = require2("../package.json");
13174
- var cliVersion = packageMetadata.version;
13171
+ var cliVersion = true ? "0.1.7" : createRequire(import.meta.url)("../../../package.json").version;
13175
13172
 
13176
13173
  // packages/adapters/antigravity/src/index.ts
13177
13174
  var adapter = createNativeAdapter("antigravity");
@@ -14719,9 +14716,10 @@ ${r2}
14719
14716
  }).prompt();
14720
14717
 
14721
14718
  // packages/cli/src/wizard.ts
14722
- import { mkdtemp as mkdtemp2, rm as rm3 } from "node:fs/promises";
14719
+ import { mkdtemp as mkdtemp2, readdir as readdir5, rm as rm3, writeFile as writeFile5 } from "node:fs/promises";
14723
14720
  import { tmpdir } from "node:os";
14724
- import { join as join6, resolve as resolve8 } from "node:path";
14721
+ import { dirname as dirname8, join as join6, resolve as resolve8 } from "node:path";
14722
+ import { fileURLToPath as fileURLToPath4 } from "node:url";
14725
14723
  var supportedRuntimes = [
14726
14724
  "oh-my-pi",
14727
14725
  "opencode",
@@ -14731,6 +14729,34 @@ var supportedRuntimes = [
14731
14729
  "antigravity",
14732
14730
  "dcode"
14733
14731
  ];
14732
+ async function findCatalogRoot() {
14733
+ const moduleDir = dirname8(fileURLToPath4(import.meta.url));
14734
+ const packagedCatalog = resolve8(moduleDir, "catalog");
14735
+ const sourceCatalog = resolve8(moduleDir, "../../../canonical");
14736
+ for (const candidate of [packagedCatalog, sourceCatalog]) {
14737
+ try {
14738
+ const roleEntries = await readdir5(resolve8(candidate, "roles"));
14739
+ const runtimeEntries = await readdir5(resolve8(candidate, "runtime-profiles"));
14740
+ const hasRoles = roleEntries.some(
14741
+ (entry) => entry.endsWith(".yaml") && !entry.startsWith("_")
14742
+ );
14743
+ const hasEveryRuntime = supportedRuntimes.every(
14744
+ (runtime) => runtimeEntries.includes(`${runtime}.yaml`)
14745
+ );
14746
+ if (hasRoles && hasEveryRuntime) return candidate;
14747
+ } catch {
14748
+ }
14749
+ }
14750
+ throw new Error(
14751
+ "Built-in capability catalog is unavailable or incomplete. Reinstall the CLI package."
14752
+ );
14753
+ }
14754
+ async function listCapabilities(catalogRoot) {
14755
+ return (await readdir5(resolve8(catalogRoot, "roles"))).filter((entry) => entry.endsWith(".yaml") && !entry.startsWith("_")).map((entry) => entry.slice(0, -5)).sort();
14756
+ }
14757
+ function yamlPath(value) {
14758
+ return JSON.stringify(value);
14759
+ }
14734
14760
  function unwrap(value) {
14735
14761
  if (isCancel(value)) {
14736
14762
  cancel("Setup cancelled.");
@@ -14743,14 +14769,23 @@ async function runInstallWizard() {
14743
14769
  intro("Portable Capabilities setup");
14744
14770
  let temporaryRoot = "";
14745
14771
  try {
14746
- const manifest = String(
14747
- unwrap(
14748
- await text({
14749
- message: "Canonical system manifest",
14750
- placeholder: "/absolute/path/to/system.yaml",
14751
- validate: (value) => value?.trim() ? void 0 : "System manifest is required"
14752
- })
14753
- )
14772
+ const catalogRoot = await findCatalogRoot();
14773
+ const availableCapabilities = await listCapabilities(catalogRoot);
14774
+ if (availableCapabilities.length === 0) {
14775
+ throw new Error("Built-in capability catalog contains no installable capabilities.");
14776
+ }
14777
+ const capabilityIds = unwrap(
14778
+ await multiselect({
14779
+ message: "Choose capabilities to install",
14780
+ options: availableCapabilities.map((value) => ({ value, label: value })),
14781
+ required: true
14782
+ })
14783
+ );
14784
+ const runtime = unwrap(
14785
+ await select2({
14786
+ message: "Choose a runtime",
14787
+ options: supportedRuntimes.map((value) => ({ value, label: value }))
14788
+ })
14754
14789
  );
14755
14790
  const target = String(
14756
14791
  unwrap(
@@ -14761,26 +14796,6 @@ async function runInstallWizard() {
14761
14796
  })
14762
14797
  )
14763
14798
  );
14764
- const runtime = unwrap(
14765
- await select2({
14766
- message: "Choose a runtime",
14767
- options: supportedRuntimes.map((value) => ({ value, label: value }))
14768
- })
14769
- );
14770
- const spinner2 = spinner();
14771
- spinner2.start("Reading available capabilities");
14772
- const system = await resolveSystem(resolve8(manifest));
14773
- const availableCapabilities = system.roles.map((role) => role.id);
14774
- spinner2.stop(
14775
- `Found ${availableCapabilities.length} capability${availableCapabilities.length === 1 ? "" : "ies"}`
14776
- );
14777
- const capabilityIds = unwrap(
14778
- await multiselect({
14779
- message: "Choose capabilities to install",
14780
- options: availableCapabilities.map((value) => ({ value, label: value })),
14781
- required: true
14782
- })
14783
- );
14784
14799
  const dryRun = unwrap(
14785
14800
  await confirm({
14786
14801
  message: "Preview changes without writing?",
@@ -14788,8 +14803,23 @@ async function runInstallWizard() {
14788
14803
  })
14789
14804
  );
14790
14805
  temporaryRoot = await mkdtemp2(join6(tmpdir(), "portable-capabilities-wizard-"));
14806
+ const manifestPath2 = join6(temporaryRoot, "system.yaml");
14791
14807
  const bundleRoot = join6(temporaryRoot, `${runtime}-bundle`);
14808
+ const rolePaths = capabilityIds.map((id) => resolve8(catalogRoot, "roles", `${id}.yaml`));
14809
+ const runtimePath = resolve8(catalogRoot, "runtime-profiles", `${runtime}.yaml`);
14810
+ const manifest = [
14811
+ 'schemaVersion: "1.0"',
14812
+ "id: portable-capabilities-wizard",
14813
+ "roles:",
14814
+ ...rolePaths.map((path9) => ` - ${yamlPath(path9)}`),
14815
+ "runtimes:",
14816
+ ` - ${yamlPath(runtimePath)}`,
14817
+ ""
14818
+ ].join("\n");
14819
+ await writeFile5(manifestPath2, manifest, "utf8");
14820
+ const spinner2 = spinner();
14792
14821
  spinner2.start("Building runtime bundle");
14822
+ const system = await resolveSystem(manifestPath2);
14793
14823
  const build = await buildProduction(system, {
14794
14824
  targets: [runtime],
14795
14825
  roles: capabilityIds
@@ -14805,14 +14835,24 @@ async function runInstallWizard() {
14805
14835
  capabilityIds,
14806
14836
  dryRun
14807
14837
  });
14808
- spinner2.stop(result2.ok ? "Installation complete" : "Installation failed");
14838
+ spinner2.stop(
14839
+ result2.ok ? dryRun ? "Installation plan complete" : "Installation complete" : dryRun ? "Installation planning failed" : "Installation failed"
14840
+ );
14809
14841
  if (!result2.ok) {
14810
14842
  for (const diagnostic of result2.diagnostics) log.error(diagnostic);
14811
14843
  process.exitCode = 4;
14812
14844
  return;
14813
14845
  }
14814
- if (result2.installed.length) log.success(`Installed ${result2.installed.length} file(s).`);
14815
- if (result2.preserved.length) log.info(`Preserved ${result2.preserved.length} file(s).`);
14846
+ if (result2.installed.length) {
14847
+ log.success(
14848
+ dryRun ? `Would install ${result2.installed.length} file(s).` : `Installed ${result2.installed.length} file(s).`
14849
+ );
14850
+ }
14851
+ if (result2.preserved.length) {
14852
+ log.info(
14853
+ dryRun ? `Would preserve ${result2.preserved.length} file(s).` : `Preserved ${result2.preserved.length} file(s).`
14854
+ );
14855
+ }
14816
14856
  outro(dryRun ? "Preview complete." : "Project is ready.");
14817
14857
  } catch (error) {
14818
14858
  if (error.message !== "cancelled") throw error;