@zhiman_innies/innies-codex 0.122.39 → 0.122.40

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 (55) hide show
  1. package/README.md +350 -0
  2. package/assets/innies-catalog.json +969 -0
  3. package/assets/superpowers/LICENSE +21 -0
  4. package/assets/superpowers/skills/brainstorming/SKILL.md +195 -0
  5. package/assets/superpowers/skills/brainstorming/scripts/frame-template.html +214 -0
  6. package/assets/superpowers/skills/brainstorming/scripts/helper.js +88 -0
  7. package/assets/superpowers/skills/brainstorming/scripts/server.cjs +354 -0
  8. package/assets/superpowers/skills/brainstorming/scripts/start-server.sh +148 -0
  9. package/assets/superpowers/skills/brainstorming/scripts/stop-server.sh +56 -0
  10. package/assets/superpowers/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  11. package/assets/superpowers/skills/brainstorming/visual-companion.md +287 -0
  12. package/assets/superpowers/skills/dispatching-parallel-agents/SKILL.md +182 -0
  13. package/assets/superpowers/skills/executing-plans/SKILL.md +70 -0
  14. package/assets/superpowers/skills/finishing-a-development-branch/SKILL.md +200 -0
  15. package/assets/superpowers/skills/receiving-code-review/SKILL.md +213 -0
  16. package/assets/superpowers/skills/requesting-code-review/SKILL.md +105 -0
  17. package/assets/superpowers/skills/requesting-code-review/code-reviewer.md +146 -0
  18. package/assets/superpowers/skills/subagent-driven-development/SKILL.md +277 -0
  19. package/assets/superpowers/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
  20. package/assets/superpowers/skills/subagent-driven-development/implementer-prompt.md +113 -0
  21. package/assets/superpowers/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  22. package/assets/superpowers/skills/systematic-debugging/CREATION-LOG.md +119 -0
  23. package/assets/superpowers/skills/systematic-debugging/SKILL.md +296 -0
  24. package/assets/superpowers/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  25. package/assets/superpowers/skills/systematic-debugging/condition-based-waiting.md +115 -0
  26. package/assets/superpowers/skills/systematic-debugging/defense-in-depth.md +122 -0
  27. package/assets/superpowers/skills/systematic-debugging/find-polluter.sh +63 -0
  28. package/assets/superpowers/skills/systematic-debugging/root-cause-tracing.md +169 -0
  29. package/assets/superpowers/skills/systematic-debugging/test-academic.md +14 -0
  30. package/assets/superpowers/skills/systematic-debugging/test-pressure-1.md +58 -0
  31. package/assets/superpowers/skills/systematic-debugging/test-pressure-2.md +68 -0
  32. package/assets/superpowers/skills/systematic-debugging/test-pressure-3.md +69 -0
  33. package/assets/superpowers/skills/test-driven-development/SKILL.md +371 -0
  34. package/assets/superpowers/skills/test-driven-development/testing-anti-patterns.md +299 -0
  35. package/assets/superpowers/skills/using-git-worktrees/SKILL.md +218 -0
  36. package/assets/superpowers/skills/using-superpowers/SKILL.md +125 -0
  37. package/assets/superpowers/skills/using-superpowers/references/codex-tools.md +104 -0
  38. package/assets/superpowers/skills/using-superpowers/references/gemini-tools.md +33 -0
  39. package/assets/superpowers/skills/verification-before-completion/SKILL.md +139 -0
  40. package/assets/superpowers/skills/writing-plans/SKILL.md +152 -0
  41. package/assets/superpowers/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
  42. package/assets/superpowers/skills/writing-skills/SKILL.md +655 -0
  43. package/assets/superpowers/skills/writing-skills/anthropic-best-practices.md +1150 -0
  44. package/assets/superpowers/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  45. package/assets/superpowers/skills/writing-skills/graphviz-conventions.dot +172 -0
  46. package/assets/superpowers/skills/writing-skills/persuasion-principles.md +187 -0
  47. package/assets/superpowers/skills/writing-skills/render-graphs.js +168 -0
  48. package/assets/superpowers/skills/writing-skills/testing-skills-with-subagents.md +384 -0
  49. package/bin/codex.js +216 -0
  50. package/bin/innies-coding-runtime.js +786 -0
  51. package/bin/innies-config.js +573 -0
  52. package/bin/innies-init.js +9 -0
  53. package/bin/innies.js +77 -0
  54. package/bin/rg +79 -0
  55. package/package.json +29 -1
package/bin/codex.js ADDED
@@ -0,0 +1,216 @@
1
+ #!/usr/bin/env node
2
+ // Unified entry point for the Innies Codex CLI.
3
+
4
+ import { spawn } from "node:child_process";
5
+ import { existsSync } from "fs";
6
+ import { createRequire } from "node:module";
7
+ import path from "path";
8
+ import { fileURLToPath } from "url";
9
+
10
+ // __dirname equivalent in ESM
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
13
+ const require = createRequire(import.meta.url);
14
+
15
+ const PLATFORM_PACKAGE_BY_TARGET = {
16
+ "x86_64-apple-darwin": "@zhiman_innies/innies-codex-darwin-x64",
17
+ "aarch64-apple-darwin": "@zhiman_innies/innies-codex-darwin-arm64",
18
+ "x86_64-pc-windows-msvc": "@zhiman_innies/innies-codex-win32-x64",
19
+ "aarch64-pc-windows-msvc": "@zhiman_innies/innies-codex-win32-arm64",
20
+ };
21
+
22
+ const { platform, arch } = process;
23
+
24
+ let targetTriple = null;
25
+ switch (platform) {
26
+ case "darwin":
27
+ switch (arch) {
28
+ case "x64":
29
+ targetTriple = "x86_64-apple-darwin";
30
+ break;
31
+ case "arm64":
32
+ targetTriple = "aarch64-apple-darwin";
33
+ break;
34
+ default:
35
+ break;
36
+ }
37
+ break;
38
+ case "win32":
39
+ switch (arch) {
40
+ case "x64":
41
+ targetTriple = "x86_64-pc-windows-msvc";
42
+ break;
43
+ case "arm64":
44
+ targetTriple = "aarch64-pc-windows-msvc";
45
+ break;
46
+ default:
47
+ break;
48
+ }
49
+ break;
50
+ default:
51
+ break;
52
+ }
53
+
54
+ if (!targetTriple) {
55
+ throw new Error(
56
+ `Unsupported platform: ${platform} (${arch}). Innies Codex currently ships macOS and Windows builds only.`,
57
+ );
58
+ }
59
+
60
+ const platformPackage = PLATFORM_PACKAGE_BY_TARGET[targetTriple];
61
+ if (!platformPackage) {
62
+ throw new Error(`Unsupported target triple: ${targetTriple}`);
63
+ }
64
+
65
+ const inniesBinaryName = platform === "win32" ? "innies.exe" : "innies";
66
+ const localVendorRoot = path.join(__dirname, "..", "vendor");
67
+ const localBinaryPath = path.join(
68
+ localVendorRoot,
69
+ targetTriple,
70
+ "codex",
71
+ inniesBinaryName,
72
+ );
73
+
74
+ let vendorRoot;
75
+ try {
76
+ const packageJsonPath = require.resolve(`${platformPackage}/package.json`);
77
+ vendorRoot = path.join(path.dirname(packageJsonPath), "vendor");
78
+ } catch {
79
+ if (existsSync(localBinaryPath)) {
80
+ vendorRoot = localVendorRoot;
81
+ } else {
82
+ const packageManager = detectPackageManager();
83
+ const updateCommand =
84
+ packageManager === "bun"
85
+ ? "bun install -g @zhiman_innies/innies-codex@latest"
86
+ : "npm install -g @zhiman_innies/innies-codex@latest";
87
+ throw new Error(
88
+ `Missing optional dependency ${platformPackage}. Reinstall Innies Codex: ${updateCommand}`,
89
+ );
90
+ }
91
+ }
92
+
93
+ if (!vendorRoot) {
94
+ const packageManager = detectPackageManager();
95
+ const updateCommand =
96
+ packageManager === "bun"
97
+ ? "bun install -g @zhiman_innies/innies-codex@latest"
98
+ : "npm install -g @zhiman_innies/innies-codex@latest";
99
+ throw new Error(
100
+ `Missing optional dependency ${platformPackage}. Reinstall Innies Codex: ${updateCommand}`,
101
+ );
102
+ }
103
+
104
+ const archRoot = path.join(vendorRoot, targetTriple);
105
+ const binaryPath = path.join(archRoot, "codex", inniesBinaryName);
106
+
107
+ // Use an asynchronous spawn instead of spawnSync so that Node is able to
108
+ // respond to signals (e.g. Ctrl-C / SIGINT) while the native binary is
109
+ // executing. This allows us to forward those signals to the child process
110
+ // and guarantees that when either the child terminates or the parent
111
+ // receives a fatal signal, both processes exit in a predictable manner.
112
+
113
+ function getUpdatedPath(newDirs) {
114
+ const pathSep = process.platform === "win32" ? ";" : ":";
115
+ const existingPath = process.env.PATH || "";
116
+ const updatedPath = [
117
+ ...newDirs,
118
+ ...existingPath.split(pathSep).filter(Boolean),
119
+ ].join(pathSep);
120
+ return updatedPath;
121
+ }
122
+
123
+ /**
124
+ * Use heuristics to detect the package manager that was used to install Innies Codex
125
+ * in order to give the user a hint about how to update it.
126
+ */
127
+ function detectPackageManager() {
128
+ const userAgent = process.env.npm_config_user_agent || "";
129
+ if (/\bbun\//.test(userAgent)) {
130
+ return "bun";
131
+ }
132
+
133
+ const execPath = process.env.npm_execpath || "";
134
+ if (execPath.includes("bun")) {
135
+ return "bun";
136
+ }
137
+
138
+ if (
139
+ __dirname.includes(".bun/install/global") ||
140
+ __dirname.includes(".bun\\install\\global")
141
+ ) {
142
+ return "bun";
143
+ }
144
+
145
+ return userAgent ? "npm" : null;
146
+ }
147
+
148
+ const additionalDirs = [];
149
+ const pathDir = path.join(archRoot, "path");
150
+ if (existsSync(pathDir)) {
151
+ additionalDirs.push(pathDir);
152
+ }
153
+ const updatedPath = getUpdatedPath(additionalDirs);
154
+
155
+ const env = { ...process.env, PATH: updatedPath };
156
+ const packageManagerEnvVar =
157
+ detectPackageManager() === "bun"
158
+ ? "CODEX_MANAGED_BY_BUN"
159
+ : "CODEX_MANAGED_BY_NPM";
160
+ env[packageManagerEnvVar] = "1";
161
+
162
+ const child = spawn(binaryPath, process.argv.slice(2), {
163
+ stdio: "inherit",
164
+ env,
165
+ });
166
+
167
+ child.on("error", (err) => {
168
+ // Typically triggered when the binary is missing or not executable.
169
+ // Re-throwing here will terminate the parent with a non-zero exit code
170
+ // while still printing a helpful stack trace.
171
+ // eslint-disable-next-line no-console
172
+ console.error(err);
173
+ process.exit(1);
174
+ });
175
+
176
+ // Forward common termination signals to the child so that it shuts down
177
+ // gracefully. In the handler we temporarily disable the default behavior of
178
+ // exiting immediately; once the child has been signaled we simply wait for
179
+ // its exit event which will in turn terminate the parent (see below).
180
+ const forwardSignal = (signal) => {
181
+ if (child.killed) {
182
+ return;
183
+ }
184
+ try {
185
+ child.kill(signal);
186
+ } catch {
187
+ /* ignore */
188
+ }
189
+ };
190
+
191
+ ["SIGINT", "SIGTERM", "SIGHUP"].forEach((sig) => {
192
+ process.on(sig, () => forwardSignal(sig));
193
+ });
194
+
195
+ // When the child exits, mirror its termination reason in the parent so that
196
+ // shell scripts and other tooling observe the correct exit status.
197
+ // Wrap the lifetime of the child process in a Promise so that we can await
198
+ // its termination in a structured way. The Promise resolves with an object
199
+ // describing how the child exited: either via exit code or due to a signal.
200
+ const childResult = await new Promise((resolve) => {
201
+ child.on("exit", (code, signal) => {
202
+ if (signal) {
203
+ resolve({ type: "signal", signal });
204
+ } else {
205
+ resolve({ type: "code", exitCode: code ?? 1 });
206
+ }
207
+ });
208
+ });
209
+
210
+ if (childResult.type === "signal") {
211
+ // Re-emit the same signal so that the parent terminates with the expected
212
+ // semantics (this also sets the correct exit code of 128 + n).
213
+ process.kill(process.pid, childResult.signal);
214
+ } else {
215
+ process.exit(childResult.exitCode);
216
+ }