codex-orchestrator 0.1.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 (122) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +94 -0
  3. package/dist/src/cli.d.ts +3 -0
  4. package/dist/src/cli.d.ts.map +1 -0
  5. package/dist/src/cli.js +253 -0
  6. package/dist/src/cli.js.map +1 -0
  7. package/dist/src/codex/command-adapter.d.ts +27 -0
  8. package/dist/src/codex/command-adapter.d.ts.map +1 -0
  9. package/dist/src/codex/command-adapter.js +49 -0
  10. package/dist/src/codex/command-adapter.js.map +1 -0
  11. package/dist/src/config/constants.d.ts +6 -0
  12. package/dist/src/config/constants.d.ts.map +1 -0
  13. package/dist/src/config/constants.js +13 -0
  14. package/dist/src/config/constants.js.map +1 -0
  15. package/dist/src/config/schema.d.ts +87 -0
  16. package/dist/src/config/schema.d.ts.map +1 -0
  17. package/dist/src/config/schema.js +180 -0
  18. package/dist/src/config/schema.js.map +1 -0
  19. package/dist/src/git/worktree.d.ts +50 -0
  20. package/dist/src/git/worktree.d.ts.map +1 -0
  21. package/dist/src/git/worktree.js +139 -0
  22. package/dist/src/git/worktree.js.map +1 -0
  23. package/dist/src/github/gh-cli.d.ts +11 -0
  24. package/dist/src/github/gh-cli.d.ts.map +1 -0
  25. package/dist/src/github/gh-cli.js +28 -0
  26. package/dist/src/github/gh-cli.js.map +1 -0
  27. package/dist/src/github/gh-issue-adapter.d.ts +15 -0
  28. package/dist/src/github/gh-issue-adapter.d.ts.map +1 -0
  29. package/dist/src/github/gh-issue-adapter.js +193 -0
  30. package/dist/src/github/gh-issue-adapter.js.map +1 -0
  31. package/dist/src/github/gh-pull-request-adapter.d.ts +9 -0
  32. package/dist/src/github/gh-pull-request-adapter.d.ts.map +1 -0
  33. package/dist/src/github/gh-pull-request-adapter.js +39 -0
  34. package/dist/src/github/gh-pull-request-adapter.js.map +1 -0
  35. package/dist/src/github/issues.d.ts +80 -0
  36. package/dist/src/github/issues.d.ts.map +1 -0
  37. package/dist/src/github/issues.js +122 -0
  38. package/dist/src/github/issues.js.map +1 -0
  39. package/dist/src/github/pull-requests.d.ts +24 -0
  40. package/dist/src/github/pull-requests.d.ts.map +1 -0
  41. package/dist/src/github/pull-requests.js +21 -0
  42. package/dist/src/github/pull-requests.js.map +1 -0
  43. package/dist/src/index.d.ts +31 -0
  44. package/dist/src/index.d.ts.map +1 -0
  45. package/dist/src/index.js +17 -0
  46. package/dist/src/index.js.map +1 -0
  47. package/dist/src/package-info.d.ts +6 -0
  48. package/dist/src/package-info.d.ts.map +1 -0
  49. package/dist/src/package-info.js +13 -0
  50. package/dist/src/package-info.js.map +1 -0
  51. package/dist/src/process/command.d.ts +15 -0
  52. package/dist/src/process/command.d.ts.map +1 -0
  53. package/dist/src/process/command.js +34 -0
  54. package/dist/src/process/command.js.map +1 -0
  55. package/dist/src/runner/command-utils.d.ts +5 -0
  56. package/dist/src/runner/command-utils.d.ts.map +1 -0
  57. package/dist/src/runner/command-utils.js +19 -0
  58. package/dist/src/runner/command-utils.js.map +1 -0
  59. package/dist/src/runner/issue-state-machine.d.ts +39 -0
  60. package/dist/src/runner/issue-state-machine.d.ts.map +1 -0
  61. package/dist/src/runner/issue-state-machine.js +119 -0
  62. package/dist/src/runner/issue-state-machine.js.map +1 -0
  63. package/dist/src/runner/issue-tree.d.ts +62 -0
  64. package/dist/src/runner/issue-tree.d.ts.map +1 -0
  65. package/dist/src/runner/issue-tree.js +376 -0
  66. package/dist/src/runner/issue-tree.js.map +1 -0
  67. package/dist/src/runner/local-state.d.ts +31 -0
  68. package/dist/src/runner/local-state.d.ts.map +1 -0
  69. package/dist/src/runner/local-state.js +125 -0
  70. package/dist/src/runner/local-state.js.map +1 -0
  71. package/dist/src/runner/plan-auto-command.d.ts +30 -0
  72. package/dist/src/runner/plan-auto-command.d.ts.map +1 -0
  73. package/dist/src/runner/plan-auto-command.js +611 -0
  74. package/dist/src/runner/plan-auto-command.js.map +1 -0
  75. package/dist/src/runner/prompt.d.ts +108 -0
  76. package/dist/src/runner/prompt.d.ts.map +1 -0
  77. package/dist/src/runner/prompt.js +322 -0
  78. package/dist/src/runner/prompt.js.map +1 -0
  79. package/dist/src/runner/recovery.d.ts +24 -0
  80. package/dist/src/runner/recovery.d.ts.map +1 -0
  81. package/dist/src/runner/recovery.js +62 -0
  82. package/dist/src/runner/recovery.js.map +1 -0
  83. package/dist/src/runner/safety.d.ts +14 -0
  84. package/dist/src/runner/safety.d.ts.map +1 -0
  85. package/dist/src/runner/safety.js +46 -0
  86. package/dist/src/runner/safety.js.map +1 -0
  87. package/dist/src/runner/scoped-auto-command.d.ts +29 -0
  88. package/dist/src/runner/scoped-auto-command.d.ts.map +1 -0
  89. package/dist/src/runner/scoped-auto-command.js +262 -0
  90. package/dist/src/runner/scoped-auto-command.js.map +1 -0
  91. package/dist/src/runner/status-command.d.ts +17 -0
  92. package/dist/src/runner/status-command.d.ts.map +1 -0
  93. package/dist/src/runner/status-command.js +72 -0
  94. package/dist/src/runner/status-command.js.map +1 -0
  95. package/dist/src/setup/github-label-adapter.d.ts +13 -0
  96. package/dist/src/setup/github-label-adapter.d.ts.map +1 -0
  97. package/dist/src/setup/github-label-adapter.js +28 -0
  98. package/dist/src/setup/github-label-adapter.js.map +1 -0
  99. package/dist/src/setup/labels.d.ts +27 -0
  100. package/dist/src/setup/labels.d.ts.map +1 -0
  101. package/dist/src/setup/labels.js +42 -0
  102. package/dist/src/setup/labels.js.map +1 -0
  103. package/dist/src/setup/project-config.d.ts +15 -0
  104. package/dist/src/setup/project-config.d.ts.map +1 -0
  105. package/dist/src/setup/project-config.js +124 -0
  106. package/dist/src/setup/project-config.js.map +1 -0
  107. package/dist/src/setup/setup-command.d.ts +22 -0
  108. package/dist/src/setup/setup-command.d.ts.map +1 -0
  109. package/dist/src/setup/setup-command.js +104 -0
  110. package/dist/src/setup/setup-command.js.map +1 -0
  111. package/dist/src/setup/workflows.d.ts +11 -0
  112. package/dist/src/setup/workflows.d.ts.map +1 -0
  113. package/dist/src/setup/workflows.js +60 -0
  114. package/dist/src/setup/workflows.js.map +1 -0
  115. package/package.json +45 -0
  116. package/prompts/setup-skill.md +11 -0
  117. package/prompts/workflows/breakdown-review.md +4 -0
  118. package/prompts/workflows/issue-breakdown.md +4 -0
  119. package/prompts/workflows/issue-tree-orchestration.md +4 -0
  120. package/prompts/workflows/prd.md +4 -0
  121. package/prompts/workflows/scoped-implementation.md +4 -0
  122. package/prompts/workflows/triage.md +4 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SergiiMytakii
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # codex-orchestrator
2
+
3
+ `codex-orchestrator` is a reusable npm package and CLI for coordinating Codex work from GitHub Issues.
4
+
5
+ This repository is intentionally separate from IntelliOutreach. It is not an IntelliOutreach workspace package, and installed projects should keep their own policy under `.codex-orchestrator/`.
6
+
7
+ ## Initial scope
8
+
9
+ The first package contract supports:
10
+
11
+ - GitHub Issues as the work source.
12
+ - A local runner boundary.
13
+ - A Codex adapter boundary, starting with `codex-cli`.
14
+ - Project-local `.codex-orchestrator/` config.
15
+ - Setup, status, scoped issue execution, parent issue-tree planning, and parent issue-tree execution.
16
+
17
+ Always-on polling, auto-merge, hosted runner infrastructure, and npm publication are not implemented in this scope.
18
+
19
+ ## CLI
20
+
21
+ ```sh
22
+ codex-orchestrator --help
23
+ codex-orchestrator --version
24
+ codex-orchestrator health
25
+ codex-orchestrator setup --target <path> --github-owner <owner> --github-repo <repo> --dry-run
26
+ codex-orchestrator status --target <path> --dry-run
27
+ codex-orchestrator run --target <path> --issue <number>
28
+ ```
29
+
30
+ The `health` command is a no-op local check for the initial CLI boot contract.
31
+
32
+ The `setup` command creates project-local configuration under `.codex-orchestrator/`.
33
+ Use `--dry-run` to validate the config plan, label status, workflow sources, checks, branch naming, and pull request policy without writing files or launching Codex.
34
+
35
+ Setup never commits changes and never opens a setup pull request.
36
+
37
+ Useful setup flags:
38
+
39
+ - `--prepare-labels` creates missing GitHub labels through the local `gh` CLI when not in dry-run mode.
40
+ - `--skills-root <path>` changes where existing local Codex skills are detected.
41
+ - `--replace-package-skills` allows package-owned prompt files under `.codex-orchestrator/prompts/` to be replaced.
42
+
43
+ By default, setup reports missing labels only and never overwrites existing prompt files.
44
+
45
+ The `status` command reads configured GitHub issues and local runner metadata, then prints eligible work, skipped issues with reason codes, and restart recovery state.
46
+ Use `--dry-run` to make the read-only intent explicit. Status and dry-run modes do not launch Codex or mutate GitHub labels/comments.
47
+
48
+ The `run` command executes one authorized issue:
49
+
50
+ - `agent:auto` runs one scoped implementation issue. It mutates GitHub labels/comments, creates a worktree and branch, runs the configured Codex command with a durable prompt, commits/pushes runner-owned changes, and opens one draft pull request.
51
+ - `agent:plan-auto` runs one parent issue tree. It claims the parent, sends the PRD, issue-breakdown, breakdown-review, and triage workflow prompts to Codex, requires a structured planning report, updates the parent PRD, creates or updates marked child issues, executes AFK-ready children in dependency-aware waves, merges child commits into one parent integration branch, pushes that branch, and opens one integration draft pull request.
52
+
53
+ Autonomous child membership is explicit. A child belongs to a parent tree only when it has the configured `agent:child` label and its body contains:
54
+
55
+ ```md
56
+ <!-- codex-orchestrator:autonomous-child parent=#<parentIssueNumber> -->
57
+ ```
58
+
59
+ Arbitrary issue links, milestones, projects, comments, and generic parent references do not authorize child membership. `agent:auto` is added to generated child issues only when the planning report marks that child as AFK-ready and the runner has persisted and verified the explicit child marker for the parent.
60
+
61
+ Child execution is deliberately constrained:
62
+
63
+ - Only children with both `agent:child` and the exact parent marker are considered.
64
+ - Children marked HITL, manual, blocked, running, review, closed, malformed, or missing `agent:auto` block the parent tree before execution.
65
+ - At most three child implementations run in parallel, and children with overlapping ownership scopes are serialized into later batches.
66
+ - Every parallel child runs in its own temporary worktree and branch. Codex changes files only; the runner owns commits, merges, pushes, labels, comments, and pull requests.
67
+ - Completed child commits merge sequentially into the parent integration branch. Merge conflicts block the parent tree, preserve relevant worktrees/branches for inspection, and do not push or open a PR.
68
+ - Successful issue trees open one integration draft PR. The runner does not create separate child PRs in this POC.
69
+
70
+ The runner never auto-merges and rejects configured secret file changes, reported secret reads/changes, reported destructive database/cache actions, reported production deploy/release actions, Codex-owned git commits, incoherent planning graphs, planning sessions that modify repository files, and child safety violations.
71
+
72
+ ## Project config
73
+
74
+ Generated config is written to `.codex-orchestrator/config.json`. It records labels, workflow prompt paths, validation checks, deny rules, concurrency, branch naming, pull request templates, and issue classification settings.
75
+
76
+ Runtime process state is excluded from committed config. State directories may be configured as policy paths, but active sessions, locks, retries, worktrees, and cache snapshots are not valid config.
77
+
78
+ ## Workflow prompts
79
+
80
+ The package ships original setup and workflow fallback prompts under `prompts/`. Setup copies them into `.codex-orchestrator/prompts/` when a target repository does not already provide prompt files.
81
+
82
+ If compatible local skills exist, setup records them as `existing-skill`. Missing workflow capabilities use package-owned prompt fallbacks.
83
+
84
+ ## Development
85
+
86
+ ```sh
87
+ npm test
88
+ npm run build
89
+ npm run typecheck
90
+ ```
91
+
92
+ ## npm publication
93
+
94
+ Publishing to npm is out of scope until separately approved. This scaffold establishes the package contract, tests, and repository boundary only.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":""}
@@ -0,0 +1,253 @@
1
+ #!/usr/bin/env node
2
+ import { resolve } from 'node:path';
3
+ import { GhCliIssueAdapter } from './github/gh-issue-adapter.js';
4
+ import { readPackageInfo } from './package-info.js';
5
+ import { readRunnerConfig } from './runner/command-utils.js';
6
+ import { discoverIssueWork } from './runner/issue-state-machine.js';
7
+ import { runPlanAutoCommand } from './runner/plan-auto-command.js';
8
+ import { runScopedAutoCommand } from './runner/scoped-auto-command.js';
9
+ import { runStatusCommand } from './runner/status-command.js';
10
+ import { runSetupCommand } from './setup/setup-command.js';
11
+ const helpText = `codex-orchestrator
12
+
13
+ Usage:
14
+ codex-orchestrator --help
15
+ codex-orchestrator --version
16
+ codex-orchestrator health
17
+ codex-orchestrator setup --target <path> --github-owner <owner> --github-repo <repo> [--dry-run] [--prepare-labels]
18
+ codex-orchestrator status --target <path> [--dry-run]
19
+ codex-orchestrator run --target <path> --issue <number>
20
+
21
+ Commands:
22
+ health Run a no-op local health check.
23
+ setup Create or dry-run project-local orchestrator config. Use --prepare-labels to create missing agent labels.
24
+ status Show eligible/skipped issue work and local recovery state.
25
+ run Execute one authorized issue: scoped agent:auto or full agent:plan-auto issue tree.
26
+
27
+ Options:
28
+ --help, -h Show this help.
29
+ --version, -v Show package version.
30
+ `;
31
+ async function main(args) {
32
+ const [command] = args;
33
+ if (command === undefined || command === '--help' || command === '-h' || command === 'help') {
34
+ process.stdout.write(helpText);
35
+ return 0;
36
+ }
37
+ if (command === '--version' || command === '-v') {
38
+ const packageInfo = await readPackageInfo();
39
+ process.stdout.write(`${packageInfo.name} ${packageInfo.version}\n`);
40
+ return 0;
41
+ }
42
+ if (command === 'health') {
43
+ process.stdout.write('codex-orchestrator health: ok\n');
44
+ return 0;
45
+ }
46
+ if (command === 'setup') {
47
+ const parsed = parseSetupArgs(args.slice(1));
48
+ if (!parsed.ok) {
49
+ process.stderr.write(`${parsed.error}\nRun codex-orchestrator --help for usage.\n`);
50
+ return 2;
51
+ }
52
+ try {
53
+ const result = await runSetupCommand({
54
+ targetRoot: parsed.value.target,
55
+ githubOwner: parsed.value.githubOwner,
56
+ githubRepo: parsed.value.githubRepo,
57
+ dryRun: parsed.value.dryRun,
58
+ prepareLabels: parsed.value.prepareLabels,
59
+ skillsRoot: parsed.value.skillsRoot,
60
+ replacePackageSkills: parsed.value.replacePackageSkills,
61
+ });
62
+ process.stdout.write(`${result.output}\n`);
63
+ return 0;
64
+ }
65
+ catch (error) {
66
+ const message = error instanceof Error ? error.message : 'setup failed';
67
+ process.stderr.write(`${message}\n`);
68
+ return 1;
69
+ }
70
+ }
71
+ if (command === 'status') {
72
+ const parsed = parseStatusArgs(args.slice(1));
73
+ if (!parsed.ok) {
74
+ process.stderr.write(`${parsed.error}\nRun codex-orchestrator --help for usage.\n`);
75
+ return 2;
76
+ }
77
+ try {
78
+ const result = await runStatusCommand({
79
+ targetRoot: parsed.value.target,
80
+ dryRun: parsed.value.dryRun,
81
+ });
82
+ process.stdout.write(`${result.output}\n`);
83
+ return 0;
84
+ }
85
+ catch (error) {
86
+ const message = error instanceof Error ? error.message : 'status failed';
87
+ process.stderr.write(`${message}\n`);
88
+ return 1;
89
+ }
90
+ }
91
+ if (command === 'run') {
92
+ const parsed = parseRunArgs(args.slice(1));
93
+ if (!parsed.ok) {
94
+ process.stderr.write(`${parsed.error}\nRun codex-orchestrator --help for usage.\n`);
95
+ return 2;
96
+ }
97
+ try {
98
+ const result = await runIssueCommand(parsed.value.target, parsed.value.issue);
99
+ process.stdout.write(`${result.reportComment}\n`);
100
+ return 0;
101
+ }
102
+ catch (error) {
103
+ const message = error instanceof Error ? error.message : 'run failed';
104
+ process.stderr.write(`${message}\n`);
105
+ return 1;
106
+ }
107
+ }
108
+ process.stderr.write(`Unknown command: ${command}\nRun codex-orchestrator --help for usage.\n`);
109
+ return 1;
110
+ }
111
+ async function runIssueCommand(targetRootInput, issueNumber) {
112
+ const targetRoot = resolve(targetRootInput);
113
+ const config = await readRunnerConfig(targetRoot);
114
+ const issueAdapter = new GhCliIssueAdapter(config.github.owner, config.github.repo);
115
+ const issue = await issueAdapter.getIssue(issueNumber);
116
+ if (!issue) {
117
+ throw new Error(`Issue #${issueNumber} was not found`);
118
+ }
119
+ const decision = discoverIssueWork([issue], config)[0];
120
+ if (!decision || decision.kind !== 'eligible') {
121
+ const reason = decision?.kind === 'skipped' ? decision.reason : 'not eligible';
122
+ throw new Error(`Issue #${issueNumber} is not eligible for autonomous work: ${reason}`);
123
+ }
124
+ if (decision.mode === 'plan-parent') {
125
+ return runPlanAutoCommand({ targetRoot, issueNumber });
126
+ }
127
+ return runScopedAutoCommand({ targetRoot, issueNumber });
128
+ }
129
+ function parseRunArgs(args) {
130
+ const parsed = {};
131
+ for (let index = 0; index < args.length; index += 1) {
132
+ const arg = args[index];
133
+ const next = args[index + 1];
134
+ switch (arg) {
135
+ case '--target':
136
+ if (!next || next.startsWith('--')) {
137
+ return { ok: false, error: `${arg} requires a value` };
138
+ }
139
+ parsed.target = next;
140
+ index += 1;
141
+ break;
142
+ case '--issue':
143
+ if (!next || next.startsWith('--') || !Number.isInteger(Number(next)) || Number(next) < 1) {
144
+ return { ok: false, error: 'run requires --issue <number>' };
145
+ }
146
+ parsed.issue = Number(next);
147
+ index += 1;
148
+ break;
149
+ default:
150
+ return { ok: false, error: `Unknown run option: ${arg ?? ''}` };
151
+ }
152
+ }
153
+ if (!parsed.target) {
154
+ return { ok: false, error: 'run requires --target <path>' };
155
+ }
156
+ if (!parsed.issue) {
157
+ return { ok: false, error: 'run requires --issue <number>' };
158
+ }
159
+ return { ok: true, value: { ...parsed, target: parsed.target, issue: parsed.issue } };
160
+ }
161
+ function parseStatusArgs(args) {
162
+ const parsed = {
163
+ dryRun: false,
164
+ };
165
+ for (let index = 0; index < args.length; index += 1) {
166
+ const arg = args[index];
167
+ const next = args[index + 1];
168
+ switch (arg) {
169
+ case '--target':
170
+ if (!next || next.startsWith('--')) {
171
+ return { ok: false, error: `${arg} requires a value` };
172
+ }
173
+ parsed.target = next;
174
+ index += 1;
175
+ break;
176
+ case '--dry-run':
177
+ parsed.dryRun = true;
178
+ break;
179
+ default:
180
+ return { ok: false, error: `Unknown status option: ${arg ?? ''}` };
181
+ }
182
+ }
183
+ if (!parsed.target) {
184
+ return { ok: false, error: 'status requires --target <path>' };
185
+ }
186
+ return { ok: true, value: { ...parsed, target: parsed.target } };
187
+ }
188
+ function parseSetupArgs(args) {
189
+ const parsed = {
190
+ dryRun: false,
191
+ prepareLabels: false,
192
+ replacePackageSkills: false,
193
+ };
194
+ for (let index = 0; index < args.length; index += 1) {
195
+ const arg = args[index];
196
+ const next = args[index + 1];
197
+ switch (arg) {
198
+ case '--target':
199
+ if (!next || next.startsWith('--')) {
200
+ return { ok: false, error: `${arg} requires a value` };
201
+ }
202
+ parsed.target = next;
203
+ index += 1;
204
+ break;
205
+ case '--github-owner':
206
+ if (!next || next.startsWith('--')) {
207
+ return { ok: false, error: `${arg} requires a value` };
208
+ }
209
+ parsed.githubOwner = next;
210
+ index += 1;
211
+ break;
212
+ case '--github-repo':
213
+ if (!next || next.startsWith('--')) {
214
+ return { ok: false, error: `${arg} requires a value` };
215
+ }
216
+ parsed.githubRepo = next;
217
+ index += 1;
218
+ break;
219
+ case '--skills-root':
220
+ if (!next || next.startsWith('--')) {
221
+ return { ok: false, error: `${arg} requires a value` };
222
+ }
223
+ parsed.skillsRoot = next;
224
+ index += 1;
225
+ break;
226
+ case '--dry-run':
227
+ parsed.dryRun = true;
228
+ break;
229
+ case '--prepare-labels':
230
+ parsed.prepareLabels = true;
231
+ break;
232
+ case '--replace-package-skills':
233
+ parsed.replacePackageSkills = true;
234
+ break;
235
+ default:
236
+ return { ok: false, error: `Unknown setup option: ${arg ?? ''}` };
237
+ }
238
+ }
239
+ if (!parsed.target) {
240
+ return { ok: false, error: 'setup requires --target <path>' };
241
+ }
242
+ return { ok: true, value: { ...parsed, target: parsed.target } };
243
+ }
244
+ main(process.argv.slice(2))
245
+ .then((exitCode) => {
246
+ process.exitCode = exitCode;
247
+ })
248
+ .catch((error) => {
249
+ const message = error instanceof Error ? error.message : 'Unexpected error';
250
+ process.stderr.write(`${message}\n`);
251
+ process.exitCode = 1;
252
+ });
253
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;CAmBhB,CAAC;AAsBF,KAAK,UAAU,IAAI,CAAC,IAAc;IAChC,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IAEvB,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,QAAQ,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from '../config/schema.js';
2
+ import type { ProcessExecutor } from '../process/command.js';
3
+ export interface CodexCommandRunInput {
4
+ targetRoot: string;
5
+ config: CodexOrchestratorConfig;
6
+ worktreePath: string;
7
+ promptPath: string;
8
+ promptText: string;
9
+ reportPath: string;
10
+ isolatedHomePath: string;
11
+ issueNumber: number;
12
+ sessionId: string;
13
+ branchName: string;
14
+ }
15
+ export interface CodexCommandRunResult {
16
+ exitCode: number;
17
+ stdout: string;
18
+ stderr: string;
19
+ }
20
+ export declare class CodexCommandAdapter {
21
+ private readonly config;
22
+ private readonly executor;
23
+ constructor(config: CodexOrchestratorConfig, executor?: ProcessExecutor);
24
+ run(input: CodexCommandRunInput): Promise<CodexCommandRunResult>;
25
+ }
26
+ export declare function buildCodexProcessEnv(input: CodexCommandRunInput, sourceEnv: NodeJS.ProcessEnv): Record<string, string>;
27
+ //# sourceMappingURL=command-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-adapter.d.ts","sourceRoot":"","sources":["../../../src/codex/command-adapter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,uBAAuB,CAAC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,mBAAmB;IAE5B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBADR,MAAM,EAAE,uBAAuB,EAC/B,QAAQ,GAAE,eAAwC;IAGxD,GAAG,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAS9E;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,oBAAoB,EAC3B,SAAS,EAAE,MAAM,CAAC,UAAU,GAC3B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAcxB"}
@@ -0,0 +1,49 @@
1
+ import { homedir } from 'node:os';
2
+ import { join } from 'node:path';
3
+ import { defaultProcessExecutor } from '../process/command.js';
4
+ export class CodexCommandAdapter {
5
+ config;
6
+ executor;
7
+ constructor(config, executor = defaultProcessExecutor) {
8
+ this.config = config;
9
+ this.executor = executor;
10
+ }
11
+ async run(input) {
12
+ const args = this.config.codex.args.map((arg) => renderCodexArg(arg, input));
13
+ const result = await this.executor(this.config.codex.command, args, {
14
+ cwd: input.worktreePath,
15
+ stdin: input.promptText,
16
+ env: buildCodexProcessEnv(input, process.env),
17
+ });
18
+ return result;
19
+ }
20
+ }
21
+ export function buildCodexProcessEnv(input, sourceEnv) {
22
+ const allowed = ['PATH', 'CODEX_HOME', 'LANG', 'LC_ALL', 'TMPDIR'];
23
+ const env = {};
24
+ for (const key of allowed) {
25
+ const value = sourceEnv[key];
26
+ if (value) {
27
+ env[key] = value;
28
+ }
29
+ }
30
+ env.CODEX_HOME = env.CODEX_HOME || join(homedir(), '.codex');
31
+ env.HOME = input.isolatedHomePath;
32
+ env[input.config.codex.promptFileEnv] = input.promptPath;
33
+ env[input.config.codex.reportFileEnv] = input.reportPath;
34
+ return env;
35
+ }
36
+ function renderCodexArg(arg, input) {
37
+ return arg
38
+ .replaceAll('${targetRoot}', input.targetRoot)
39
+ .replaceAll('${stateDir}', join(input.targetRoot, input.config.runner.stateDir))
40
+ .replaceAll('${worktreePath}', input.worktreePath)
41
+ .replaceAll('${promptFile}', input.promptPath)
42
+ .replaceAll('${promptPath}', input.promptPath)
43
+ .replaceAll('${reportFile}', input.reportPath)
44
+ .replaceAll('${reportPath}', input.reportPath)
45
+ .replaceAll('${issueNumber}', String(input.issueNumber))
46
+ .replaceAll('${sessionId}', input.sessionId)
47
+ .replaceAll('${branchName}', input.branchName);
48
+ }
49
+ //# sourceMappingURL=command-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-adapter.js","sourceRoot":"","sources":["../../../src/codex/command-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAqB/D,MAAM,OAAO,mBAAmB;IAEX;IACA;IAFnB,YACmB,MAA+B,EAC/B,WAA4B,sBAAsB;QADlD,WAAM,GAAN,MAAM,CAAyB;QAC/B,aAAQ,GAAR,QAAQ,CAA0C;IAClE,CAAC;IAEG,KAAK,CAAC,GAAG,CAAC,KAA2B;QAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;QAC7E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE;YAClE,GAAG,EAAE,KAAK,CAAC,YAAY;YACvB,KAAK,EAAE,KAAK,CAAC,UAAU;YACvB,GAAG,EAAE,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC;SAC9C,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAED,MAAM,UAAU,oBA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U,CAAC,eAAe,EAAE,KAAK,CAAC,UAAU,CAAC;SAC7C,UAAU,CAAC,gBAAgB,EAAE,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;SACvD,UAAU,CAAC,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC;SAC3C,UAAU,CAAC,eAAe,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;AACnD,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const labelKeys: readonly ["auto", "planAuto", "running", "blocked", "manual", "review", "child"];
2
+ export declare const workflowKeys: readonly ["prd", "issueBreakdown", "breakdownReview", "triage", "scopedImplementation", "issueTreeOrchestration"];
3
+ export declare const labelPreparationPolicies: readonly ["report-only", "create-missing"];
4
+ export declare const workflowSources: readonly ["existing-skill", "package-owned-skill", "package-owned-prompt-fallback"];
5
+ export declare const forbiddenRuntimeKeys: readonly ["runtime", "state", "locks", "sessions", "worktrees", "retries", "cache"];
6
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/config/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,kFAAmF,CAAC;AAE1G,eAAO,MAAM,YAAY,mHAOf,CAAC;AAEX,eAAO,MAAM,wBAAwB,4CAA6C,CAAC;AAEnF,eAAO,MAAM,eAAe,qFAAsF,CAAC;AAEnH,eAAO,MAAM,oBAAoB,qFAAsF,CAAC"}
@@ -0,0 +1,13 @@
1
+ export const labelKeys = ['auto', 'planAuto', 'running', 'blocked', 'manual', 'review', 'child'];
2
+ export const workflowKeys = [
3
+ 'prd',
4
+ 'issueBreakdown',
5
+ 'breakdownReview',
6
+ 'triage',
7
+ 'scopedImplementation',
8
+ 'issueTreeOrchestration',
9
+ ];
10
+ export const labelPreparationPolicies = ['report-only', 'create-missing'];
11
+ export const workflowSources = ['existing-skill', 'package-owned-skill', 'package-owned-prompt-fallback'];
12
+ export const forbiddenRuntimeKeys = ['runtime', 'state', 'locks', 'sessions', 'worktrees', 'retries', 'cache'];
13
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/config/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AAE1G,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,KAAK;IACL,gBAAgB;IAChB,iBAAiB;IACjB,QAAQ;IACR,sBAAsB;IACtB,wBAAwB;CAChB,CAAC;AAEX,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,aAAa,EAAE,gBAAgB,CAAU,CAAC;AAEnF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,gBAAgB,EAAE,qBAAqB,EAAE,+BAA+B,CAAU,CAAC;AAEnH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,CAAU,CAAC"}
@@ -0,0 +1,87 @@
1
+ import { labelKeys, workflowKeys, workflowSources } from './constants.js';
2
+ export type LabelKey = (typeof labelKeys)[number];
3
+ export type LabelPreparationPolicy = 'report-only' | 'create-missing';
4
+ export type WorkflowId = (typeof workflowKeys)[number];
5
+ export type WorkflowSource = (typeof workflowSources)[number];
6
+ export type ClarificationGate = 'block-and-comment';
7
+ export interface LabelDefinition {
8
+ name: string;
9
+ color: string;
10
+ description: string;
11
+ }
12
+ export interface WorkflowConfig {
13
+ skillName: string;
14
+ source: WorkflowSource;
15
+ promptPath?: string;
16
+ skillPath?: string;
17
+ }
18
+ export interface CodexOrchestratorConfig {
19
+ version: 1;
20
+ github: {
21
+ owner: string;
22
+ repo: string;
23
+ prepareLabels: LabelPreparationPolicy;
24
+ labels: {
25
+ auto: LabelDefinition;
26
+ planAuto: LabelDefinition;
27
+ running: LabelDefinition;
28
+ blocked: LabelDefinition;
29
+ manual: LabelDefinition;
30
+ review: LabelDefinition;
31
+ child: LabelDefinition;
32
+ };
33
+ };
34
+ runner: {
35
+ workspaceRoot: string;
36
+ maxParallelChildren: number;
37
+ stateDir: string;
38
+ };
39
+ codex: {
40
+ adapter: 'codex-cli';
41
+ command: string;
42
+ args: string[];
43
+ promptFileEnv: 'CODEX_ORCHESTRATOR_PROMPT_FILE';
44
+ reportFileEnv: 'CODEX_ORCHESTRATOR_REPORT_FILE';
45
+ };
46
+ project: {
47
+ configDir: '.codex-orchestrator';
48
+ promptsDir: '.codex-orchestrator/prompts';
49
+ };
50
+ workflows: {
51
+ prd: WorkflowConfig;
52
+ issueBreakdown: WorkflowConfig;
53
+ breakdownReview: WorkflowConfig;
54
+ triage: WorkflowConfig;
55
+ scopedImplementation: WorkflowConfig;
56
+ issueTreeOrchestration: WorkflowConfig;
57
+ };
58
+ checks: Record<string, string>;
59
+ deny: {
60
+ secretFiles: string[];
61
+ destructiveDbOrCache: boolean;
62
+ productionDeployOrRelease: boolean;
63
+ additionalPathGlobs: string[];
64
+ };
65
+ branches: {
66
+ base: string;
67
+ scopedIssue: string;
68
+ issueTree: string;
69
+ };
70
+ pullRequests: {
71
+ scopedIssueTitle: string;
72
+ issueTreeTitle: string;
73
+ };
74
+ issueClassification: {
75
+ promotionCriteria: string[];
76
+ clarificationGate: ClarificationGate;
77
+ };
78
+ }
79
+ export type ConfigValidationResult = {
80
+ ok: true;
81
+ value: CodexOrchestratorConfig;
82
+ } | {
83
+ ok: false;
84
+ errors: string[];
85
+ };
86
+ export declare function validateConfig(input: unknown): ConfigValidationResult;
87
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EAET,YAAY,EACZ,eAAe,EAChB,MAAM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