superpowers-manager 0.6.0 → 0.7.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 (75) hide show
  1. package/README.md +42 -26
  2. package/dist/adapter-result.js +5 -9
  3. package/dist/atomic.js +4 -14
  4. package/dist/cli-arguments.js +1 -27
  5. package/dist/cli.js +25 -40
  6. package/dist/commands/adapter-call.js +28 -0
  7. package/dist/commands/install.js +25 -105
  8. package/dist/commands/pin.js +1 -1
  9. package/dist/commands/prepare.js +37 -81
  10. package/dist/commands/probe.js +35 -262
  11. package/dist/commands/track-latest.js +1 -1
  12. package/dist/commands/uninstall.js +15 -91
  13. package/dist/commands/update.js +5 -25
  14. package/dist/effective-selection.js +4 -6
  15. package/dist/git-tree.js +85 -0
  16. package/dist/harness-command-result.js +47 -0
  17. package/dist/harnesses/codex/adapter.js +12 -41
  18. package/dist/harnesses/codex/conflicts.js +2 -3
  19. package/dist/harnesses/codex/hooks.js +1 -1
  20. package/dist/harnesses/codex/json.js +1 -11
  21. package/dist/harnesses/codex/lifecycle.js +0 -48
  22. package/dist/harnesses/codex/manifest-overlay.js +1 -1
  23. package/dist/harnesses/codex/paths.js +14 -29
  24. package/dist/harnesses/codex/presentation.js +2 -23
  25. package/dist/harnesses/codex/publication.js +0 -6
  26. package/dist/harnesses/codex/recovery.js +5 -5
  27. package/dist/harnesses/codex/stored-state.js +1 -1
  28. package/dist/harnesses/opencode/config.js +256 -0
  29. package/dist/harnesses/opencode/discovery.js +587 -0
  30. package/dist/harnesses/opencode/harness.js +37 -0
  31. package/dist/harnesses/opencode/install.js +601 -0
  32. package/dist/harnesses/opencode/native.js +57 -0
  33. package/dist/harnesses/opencode/package.js +89 -0
  34. package/dist/harnesses/opencode/paths.js +38 -0
  35. package/dist/harnesses/opencode/prepare.js +30 -0
  36. package/dist/harnesses/opencode/presentation.js +28 -0
  37. package/dist/harnesses/opencode/state.js +174 -0
  38. package/dist/harnesses/pi/compatibility.js +5 -37
  39. package/dist/harnesses/pi/install.js +7 -5
  40. package/dist/harnesses/pi/native.js +3 -47
  41. package/dist/harnesses/pi/package.js +5 -107
  42. package/dist/harnesses/pi/prepare.js +13 -104
  43. package/dist/harnesses/pi/presentation.js +23 -66
  44. package/dist/harnesses/pi/shared-skills.js +28 -39
  45. package/dist/harnesses/pi/state.js +7 -27
  46. package/dist/provenance.js +2 -2
  47. package/dist/safe-path.js +2 -2
  48. package/dist/selection-store.js +2 -22
  49. package/dist/snapshot-package.js +78 -0
  50. package/dist/snapshot-prepare.js +99 -0
  51. package/dist/snapshot-presentation.js +44 -0
  52. package/dist/validator.js +4 -1
  53. package/node_modules/jsonc-parser/CHANGELOG.md +76 -0
  54. package/node_modules/jsonc-parser/LICENSE.md +21 -0
  55. package/node_modules/jsonc-parser/README.md +364 -0
  56. package/node_modules/jsonc-parser/SECURITY.md +41 -0
  57. package/node_modules/jsonc-parser/lib/esm/impl/edit.js +185 -0
  58. package/node_modules/jsonc-parser/lib/esm/impl/format.js +261 -0
  59. package/node_modules/jsonc-parser/lib/esm/impl/parser.js +659 -0
  60. package/node_modules/jsonc-parser/lib/esm/impl/scanner.js +443 -0
  61. package/node_modules/jsonc-parser/lib/esm/impl/string-intern.js +29 -0
  62. package/node_modules/jsonc-parser/lib/esm/main.d.ts +351 -0
  63. package/node_modules/jsonc-parser/lib/esm/main.js +178 -0
  64. package/node_modules/jsonc-parser/lib/umd/impl/edit.js +201 -0
  65. package/node_modules/jsonc-parser/lib/umd/impl/format.js +275 -0
  66. package/node_modules/jsonc-parser/lib/umd/impl/parser.js +682 -0
  67. package/node_modules/jsonc-parser/lib/umd/impl/scanner.js +456 -0
  68. package/node_modules/jsonc-parser/lib/umd/impl/string-intern.js +42 -0
  69. package/node_modules/jsonc-parser/lib/umd/main.d.ts +351 -0
  70. package/node_modules/jsonc-parser/lib/umd/main.js +194 -0
  71. package/node_modules/jsonc-parser/package.json +37 -0
  72. package/package.json +8 -4
  73. package/dist/domain/fingerprint.js +0 -4
  74. package/dist/status.js +0 -24
  75. package/dist/validate-generated-plugin-cli.js +0 -118
@@ -1,118 +0,0 @@
1
- import { realpathSync } from "node:fs";
2
- import { oneLine, parseFlags, UsageError } from "./cli-arguments.js";
3
- import { validateGeneratedPlugin, } from "./harnesses/codex/generated-plugin.js";
4
- const FLAGS = [
5
- "plugin-root",
6
- "source",
7
- "requested-ref",
8
- "resolved-ref",
9
- "commit",
10
- "manifest-version",
11
- "manifest-source",
12
- "upstream-manifest-version",
13
- ];
14
- // `argparse` accepts a lone `-` and a bare negative number as a split value;
15
- // every other dash-leading split value is treated as an option and rejected.
16
- // CPython's `_negative_number_matcher` is `^-\d+$|^-\d*\.\d+$`, and `re` `\d` on
17
- // a `str` pattern matches every character in Unicode category Nd. JavaScript
18
- // `\d` is `[0-9]` whatever the flags, so `\p{Nd}` plus `u` is what mirrors it.
19
- // The `\.` stays a literal ASCII period: `argparse` accepts no other separator.
20
- const NEGATIVE_NUMBER_RE = /^-\p{Nd}+$|^-\p{Nd}*\.\p{Nd}+$/u;
21
- /** True when `argparse` would accept `value` in `--flag value` form. */
22
- export function isAcceptedSplitValue(value) {
23
- if (!value.startsWith("-"))
24
- return true;
25
- return value === "-" || NEGATIVE_NUMBER_RE.test(value);
26
- }
27
- /**
28
- * Node replaces an undecodable argv byte with U+FFFD before any JavaScript
29
- * runs, so the original byte is unrecoverable. Rejecting at the boundary is
30
- * the only portable fail-closed option.
31
- */
32
- export function hasReplacementCharacter(value) {
33
- return value.includes("�");
34
- }
35
- /** Pre-scan argv for split-form values the dash rule rejects. */
36
- function findRejectedSplitFlag(argv) {
37
- for (let index = 0; index < argv.length; index += 1) {
38
- const token = argv[index];
39
- if (!token.startsWith("--") || token.includes("="))
40
- continue;
41
- const value = argv[index + 1];
42
- if (value === undefined)
43
- continue;
44
- if (!isAcceptedSplitValue(value))
45
- return token;
46
- index += 1;
47
- }
48
- return undefined;
49
- }
50
- function parseOptions(argv) {
51
- const rejected = findRejectedSplitFlag(argv);
52
- if (rejected !== undefined) {
53
- throw new UsageError(`option ${rejected} rejects a dash-leading value`);
54
- }
55
- const flags = parseFlags(argv, FLAGS);
56
- if (hasReplacementCharacter(flags["plugin-root"])) {
57
- throw new UsageError("option --plugin-root contains an undecodable character");
58
- }
59
- const manifestSource = flags["manifest-source"];
60
- if (manifestSource !== "upstream" && manifestSource !== "fallback") {
61
- throw new UsageError("option --manifest-source must be `upstream` or `fallback`");
62
- }
63
- return {
64
- pluginRoot: flags["plugin-root"],
65
- source: flags.source,
66
- requestedRef: flags["requested-ref"],
67
- resolvedRef: flags["resolved-ref"],
68
- commit: flags.commit,
69
- manifestVersion: flags["manifest-version"],
70
- manifestSource,
71
- upstreamManifestVersion: flags["upstream-manifest-version"],
72
- };
73
- }
74
- export async function runValidateGeneratedPluginCli(argv) {
75
- let options;
76
- try {
77
- options = parseOptions(argv);
78
- }
79
- catch (cause) {
80
- process.stderr.write("usage: validate-generated-plugin-cli --plugin-root <path> --source <url> " +
81
- "--requested-ref <ref> --resolved-ref <ref> --commit <sha> " +
82
- "--manifest-version <version> --manifest-source <upstream|fallback> " +
83
- "--upstream-manifest-version <version>\n");
84
- process.stderr.write(`error: ${oneLine(cause)}\n`);
85
- return 2;
86
- }
87
- let errors;
88
- try {
89
- errors = await validateGeneratedPlugin(options);
90
- }
91
- catch (cause) {
92
- // A rejection must never escape as a traceback-shaped crash.
93
- process.stderr.write(`error: ${oneLine(cause)}\n`);
94
- return 2;
95
- }
96
- if (errors.length > 0) {
97
- process.stderr.write("Generated plugin validation failed:\n");
98
- for (const error of errors)
99
- process.stderr.write(`- ${error}\n`);
100
- return 1;
101
- }
102
- process.stdout.write(`generated plugin validation passed: ${options.pluginRoot}\n`);
103
- return 0;
104
- }
105
- const entry = process.argv[1];
106
- let entryRealpath;
107
- if (entry !== undefined) {
108
- try {
109
- entryRealpath = realpathSync(entry);
110
- }
111
- catch {
112
- // An unresolvable argv[1] means "not the entry point", not a crash.
113
- entryRealpath = undefined;
114
- }
115
- }
116
- if (entryRealpath !== undefined && import.meta.filename === entryRealpath) {
117
- process.exitCode = await runValidateGeneratedPluginCli(process.argv.slice(2));
118
- }