@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
@@ -13285,10 +13285,7 @@ async function resolveVerifiedCapabilityEntrypoint(options) {
13285
13285
  }
13286
13286
 
13287
13287
  // packages/cli/src/release.ts
13288
- import { createRequire } from "node:module";
13289
- var require2 = createRequire(import.meta.url);
13290
- var packageMetadata = require2("../package.json");
13291
- var cliVersion = packageMetadata.version;
13288
+ var cliVersion = true ? "0.1.7" : createRequire(import.meta.url)("../../../package.json").version;
13292
13289
 
13293
13290
  // packages/adapters/antigravity/src/index.ts
13294
13291
  var adapter = createNativeAdapter("antigravity");
@@ -14833,9 +14830,10 @@ ${r2}
14833
14830
  }).prompt();
14834
14831
 
14835
14832
  // packages/cli/src/wizard.ts
14836
- import { mkdtemp as mkdtemp2, rm as rm3 } from "node:fs/promises";
14833
+ import { mkdtemp as mkdtemp2, readdir as readdir5, rm as rm3, writeFile as writeFile5 } from "node:fs/promises";
14837
14834
  import { tmpdir } from "node:os";
14838
- import { join as join6, resolve as resolve8 } from "node:path";
14835
+ import { dirname as dirname8, join as join6, resolve as resolve8 } from "node:path";
14836
+ import { fileURLToPath as fileURLToPath4 } from "node:url";
14839
14837
  var supportedRuntimes = [
14840
14838
  "oh-my-pi",
14841
14839
  "opencode",
@@ -14845,6 +14843,34 @@ var supportedRuntimes = [
14845
14843
  "antigravity",
14846
14844
  "dcode"
14847
14845
  ];
14846
+ async function findCatalogRoot() {
14847
+ const moduleDir = dirname8(fileURLToPath4(import.meta.url));
14848
+ const packagedCatalog = resolve8(moduleDir, "catalog");
14849
+ const sourceCatalog = resolve8(moduleDir, "../../../canonical");
14850
+ for (const candidate of [packagedCatalog, sourceCatalog]) {
14851
+ try {
14852
+ const roleEntries = await readdir5(resolve8(candidate, "roles"));
14853
+ const runtimeEntries = await readdir5(resolve8(candidate, "runtime-profiles"));
14854
+ const hasRoles = roleEntries.some(
14855
+ (entry) => entry.endsWith(".yaml") && !entry.startsWith("_")
14856
+ );
14857
+ const hasEveryRuntime = supportedRuntimes.every(
14858
+ (runtime) => runtimeEntries.includes(`${runtime}.yaml`)
14859
+ );
14860
+ if (hasRoles && hasEveryRuntime) return candidate;
14861
+ } catch {
14862
+ }
14863
+ }
14864
+ throw new Error(
14865
+ "Built-in capability catalog is unavailable or incomplete. Reinstall the CLI package."
14866
+ );
14867
+ }
14868
+ async function listCapabilities(catalogRoot) {
14869
+ return (await readdir5(resolve8(catalogRoot, "roles"))).filter((entry) => entry.endsWith(".yaml") && !entry.startsWith("_")).map((entry) => entry.slice(0, -5)).sort();
14870
+ }
14871
+ function yamlPath(value) {
14872
+ return JSON.stringify(value);
14873
+ }
14848
14874
  function unwrap(value) {
14849
14875
  if (isCancel(value)) {
14850
14876
  cancel("Setup cancelled.");
@@ -14857,14 +14883,23 @@ async function runInstallWizard() {
14857
14883
  intro("Portable Capabilities setup");
14858
14884
  let temporaryRoot = "";
14859
14885
  try {
14860
- const manifest = String(
14861
- unwrap(
14862
- await text({
14863
- message: "Canonical system manifest",
14864
- placeholder: "/absolute/path/to/system.yaml",
14865
- validate: (value) => value?.trim() ? void 0 : "System manifest is required"
14866
- })
14867
- )
14886
+ const catalogRoot = await findCatalogRoot();
14887
+ const availableCapabilities = await listCapabilities(catalogRoot);
14888
+ if (availableCapabilities.length === 0) {
14889
+ throw new Error("Built-in capability catalog contains no installable capabilities.");
14890
+ }
14891
+ const capabilityIds = unwrap(
14892
+ await multiselect({
14893
+ message: "Choose capabilities to install",
14894
+ options: availableCapabilities.map((value) => ({ value, label: value })),
14895
+ required: true
14896
+ })
14897
+ );
14898
+ const runtime = unwrap(
14899
+ await select2({
14900
+ message: "Choose a runtime",
14901
+ options: supportedRuntimes.map((value) => ({ value, label: value }))
14902
+ })
14868
14903
  );
14869
14904
  const target = String(
14870
14905
  unwrap(
@@ -14875,26 +14910,6 @@ async function runInstallWizard() {
14875
14910
  })
14876
14911
  )
14877
14912
  );
14878
- const runtime = unwrap(
14879
- await select2({
14880
- message: "Choose a runtime",
14881
- options: supportedRuntimes.map((value) => ({ value, label: value }))
14882
- })
14883
- );
14884
- const spinner2 = spinner();
14885
- spinner2.start("Reading available capabilities");
14886
- const system = await resolveSystem(resolve8(manifest));
14887
- const availableCapabilities = system.roles.map((role) => role.id);
14888
- spinner2.stop(
14889
- `Found ${availableCapabilities.length} capability${availableCapabilities.length === 1 ? "" : "ies"}`
14890
- );
14891
- const capabilityIds = unwrap(
14892
- await multiselect({
14893
- message: "Choose capabilities to install",
14894
- options: availableCapabilities.map((value) => ({ value, label: value })),
14895
- required: true
14896
- })
14897
- );
14898
14913
  const dryRun = unwrap(
14899
14914
  await confirm({
14900
14915
  message: "Preview changes without writing?",
@@ -14902,8 +14917,23 @@ async function runInstallWizard() {
14902
14917
  })
14903
14918
  );
14904
14919
  temporaryRoot = await mkdtemp2(join6(tmpdir(), "portable-capabilities-wizard-"));
14920
+ const manifestPath2 = join6(temporaryRoot, "system.yaml");
14905
14921
  const bundleRoot = join6(temporaryRoot, `${runtime}-bundle`);
14922
+ const rolePaths = capabilityIds.map((id) => resolve8(catalogRoot, "roles", `${id}.yaml`));
14923
+ const runtimePath = resolve8(catalogRoot, "runtime-profiles", `${runtime}.yaml`);
14924
+ const manifest = [
14925
+ 'schemaVersion: "1.0"',
14926
+ "id: portable-capabilities-wizard",
14927
+ "roles:",
14928
+ ...rolePaths.map((path9) => ` - ${yamlPath(path9)}`),
14929
+ "runtimes:",
14930
+ ` - ${yamlPath(runtimePath)}`,
14931
+ ""
14932
+ ].join("\n");
14933
+ await writeFile5(manifestPath2, manifest, "utf8");
14934
+ const spinner2 = spinner();
14906
14935
  spinner2.start("Building runtime bundle");
14936
+ const system = await resolveSystem(manifestPath2);
14907
14937
  const build = await buildProduction(system, {
14908
14938
  targets: [runtime],
14909
14939
  roles: capabilityIds
@@ -14919,14 +14949,24 @@ async function runInstallWizard() {
14919
14949
  capabilityIds,
14920
14950
  dryRun
14921
14951
  });
14922
- spinner2.stop(result2.ok ? "Installation complete" : "Installation failed");
14952
+ spinner2.stop(
14953
+ result2.ok ? dryRun ? "Installation plan complete" : "Installation complete" : dryRun ? "Installation planning failed" : "Installation failed"
14954
+ );
14923
14955
  if (!result2.ok) {
14924
14956
  for (const diagnostic of result2.diagnostics) log.error(diagnostic);
14925
14957
  process.exitCode = 4;
14926
14958
  return;
14927
14959
  }
14928
- if (result2.installed.length) log.success(`Installed ${result2.installed.length} file(s).`);
14929
- if (result2.preserved.length) log.info(`Preserved ${result2.preserved.length} file(s).`);
14960
+ if (result2.installed.length) {
14961
+ log.success(
14962
+ dryRun ? `Would install ${result2.installed.length} file(s).` : `Installed ${result2.installed.length} file(s).`
14963
+ );
14964
+ }
14965
+ if (result2.preserved.length) {
14966
+ log.info(
14967
+ dryRun ? `Would preserve ${result2.preserved.length} file(s).` : `Preserved ${result2.preserved.length} file(s).`
14968
+ );
14969
+ }
14930
14970
  outro(dryRun ? "Preview complete." : "Project is ready.");
14931
14971
  } catch (error) {
14932
14972
  if (error.message !== "cancelled") throw error;