agentic-dev 0.2.14 → 0.2.16

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.
package/lib/github.mjs DELETED
@@ -1,246 +0,0 @@
1
- import process from "node:process";
2
- import { spawnSync } from "node:child_process";
3
-
4
- function ghToken() {
5
- const envToken =
6
- process.env.GH_TOKEN || process.env.GITHUB_TOKEN || process.env.AGENTIC_GITHUB_TOKEN || "";
7
- if (envToken) {
8
- return envToken;
9
- }
10
-
11
- const result = spawnSync("gh", ["auth", "token"], {
12
- encoding: "utf-8",
13
- stdio: ["ignore", "pipe", "ignore"],
14
- });
15
- if (result.status === 0) {
16
- return (result.stdout || "").trim();
17
- }
18
- return "";
19
- }
20
-
21
- async function githubRequest(url, { method = "GET", body } = {}) {
22
- const token = ghToken();
23
- if (!token) {
24
- throw new Error("GitHub authentication is required. Set GH_TOKEN, GITHUB_TOKEN, or AGENTIC_GITHUB_TOKEN.");
25
- }
26
-
27
- const response = await fetch(url, {
28
- method,
29
- headers: {
30
- Accept: "application/vnd.github+json",
31
- "Content-Type": "application/json",
32
- "User-Agent": "agentic-dev",
33
- Authorization: `Bearer ${token}`,
34
- },
35
- body: body ? JSON.stringify(body) : undefined,
36
- });
37
-
38
- if (!response.ok) {
39
- const payload = await response.text();
40
- throw new Error(`GitHub API request failed (${response.status}): ${payload}`);
41
- }
42
-
43
- if (response.status === 204) {
44
- return null;
45
- }
46
- return response.json();
47
- }
48
-
49
- async function githubGraphql(query, variables = {}) {
50
- const token = ghToken();
51
- if (!token) {
52
- throw new Error("GitHub authentication is required. Set GH_TOKEN, GITHUB_TOKEN, or AGENTIC_GITHUB_TOKEN.");
53
- }
54
-
55
- const response = await fetch("https://api.github.com/graphql", {
56
- method: "POST",
57
- headers: {
58
- Accept: "application/vnd.github+json",
59
- "Content-Type": "application/json",
60
- "User-Agent": "agentic-dev",
61
- Authorization: `Bearer ${token}`,
62
- },
63
- body: JSON.stringify({ query, variables }),
64
- });
65
-
66
- const payload = await response.json();
67
- if (!response.ok || payload.errors) {
68
- throw new Error(`GitHub GraphQL request failed: ${JSON.stringify(payload.errors || payload)}`);
69
- }
70
- return payload.data;
71
- }
72
-
73
- export function normalizeRepoInput(input, { fallbackOwner = "say828", fallbackName = "agentic-service" } = {}) {
74
- const normalized = (input || "").trim();
75
- if (!normalized) {
76
- return {
77
- owner: fallbackOwner,
78
- name: fallbackName,
79
- slug: `${fallbackOwner}/${fallbackName}`,
80
- cloneUrl: `https://github.com/${fallbackOwner}/${fallbackName}.git`,
81
- htmlUrl: `https://github.com/${fallbackOwner}/${fallbackName}`,
82
- };
83
- }
84
-
85
- const withoutGit = normalized.replace(/\.git$/, "");
86
- const httpsMatch = withoutGit.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)$/);
87
- if (httpsMatch) {
88
- const [, owner, name] = httpsMatch;
89
- return {
90
- owner,
91
- name,
92
- slug: `${owner}/${name}`,
93
- cloneUrl: `https://github.com/${owner}/${name}.git`,
94
- htmlUrl: `https://github.com/${owner}/${name}`,
95
- };
96
- }
97
-
98
- const slugMatch = withoutGit.match(/^([^/]+)\/([^/]+)$/);
99
- if (slugMatch) {
100
- const [, owner, name] = slugMatch;
101
- return {
102
- owner,
103
- name,
104
- slug: `${owner}/${name}`,
105
- cloneUrl: `https://github.com/${owner}/${name}.git`,
106
- htmlUrl: `https://github.com/${owner}/${name}`,
107
- };
108
- }
109
-
110
- return {
111
- owner: fallbackOwner,
112
- name: withoutGit,
113
- slug: `${fallbackOwner}/${withoutGit}`,
114
- cloneUrl: `https://github.com/${fallbackOwner}/${withoutGit}.git`,
115
- htmlUrl: `https://github.com/${fallbackOwner}/${withoutGit}`,
116
- };
117
- }
118
-
119
- export async function getAuthenticatedViewer() {
120
- const data = await githubGraphql(`
121
- query ViewerIdentity {
122
- viewer {
123
- login
124
- id
125
- }
126
- }
127
- `);
128
- return data.viewer;
129
- }
130
-
131
- export async function ensureGitHubRepository(repoInput, { visibility = "private" } = {}) {
132
- const viewer = await getAuthenticatedViewer();
133
- const target = normalizeRepoInput(repoInput, {
134
- fallbackOwner: viewer.login,
135
- });
136
-
137
- try {
138
- const existing = await githubRequest(`https://api.github.com/repos/${target.owner}/${target.name}`);
139
- return {
140
- owner: existing.owner.login,
141
- name: existing.name,
142
- slug: existing.full_name,
143
- cloneUrl: existing.clone_url,
144
- htmlUrl: existing.html_url,
145
- created: false,
146
- };
147
- } catch (error) {
148
- const message = String(error.message || error);
149
- if (!message.includes("(404)")) {
150
- throw error;
151
- }
152
- }
153
-
154
- if (target.owner !== viewer.login) {
155
- throw new Error(
156
- `Repository ${target.slug} does not exist. Automatic creation currently supports only the authenticated user namespace (${viewer.login}).`,
157
- );
158
- }
159
-
160
- const created = await githubRequest("https://api.github.com/user/repos", {
161
- method: "POST",
162
- body: {
163
- name: target.name,
164
- private: visibility !== "public",
165
- auto_init: false,
166
- },
167
- });
168
-
169
- return {
170
- owner: created.owner.login,
171
- name: created.name,
172
- slug: created.full_name,
173
- cloneUrl: created.clone_url,
174
- htmlUrl: created.html_url,
175
- created: true,
176
- };
177
- }
178
-
179
- export async function ensureGitHubProject({ ownerLogin, title, mode = "create-if-missing" }) {
180
- const data = await githubGraphql(
181
- `
182
- query OwnerProjects($login: String!) {
183
- user(login: $login) {
184
- id
185
- projectsV2(first: 50) {
186
- nodes {
187
- id
188
- title
189
- number
190
- url
191
- }
192
- }
193
- }
194
- }
195
- `,
196
- { login: ownerLogin },
197
- );
198
-
199
- const owner = data.user;
200
- if (!owner) {
201
- throw new Error(`Unable to load GitHub projects for ${ownerLogin}.`);
202
- }
203
-
204
- const existing = owner.projectsV2.nodes.find((project) => project.title === title);
205
- if (existing) {
206
- return {
207
- id: existing.id,
208
- title: existing.title,
209
- number: existing.number,
210
- url: existing.url,
211
- created: false,
212
- };
213
- }
214
-
215
- if (mode !== "create-if-missing") {
216
- throw new Error(`GitHub project not found: ${title}`);
217
- }
218
-
219
- const created = await githubGraphql(
220
- `
221
- mutation CreateProject($ownerId: ID!, $title: String!) {
222
- createProjectV2(input: { ownerId: $ownerId, title: $title }) {
223
- projectV2 {
224
- id
225
- title
226
- number
227
- url
228
- }
229
- }
230
- }
231
- `,
232
- {
233
- ownerId: owner.id,
234
- title,
235
- },
236
- );
237
-
238
- const project = created.createProjectV2.projectV2;
239
- return {
240
- id: project.id,
241
- title: project.title,
242
- number: project.number,
243
- url: project.url,
244
- created: true,
245
- };
246
- }
@@ -1,430 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
-
4
- const SPECIALIZED_AGENTS = [
5
- { id: "architecture", description: "Drive boundaries, system shape, and migration decisions." },
6
- { id: "specs", description: "Translate SDD planning artifacts into actionable task structure." },
7
- { id: "runtime", description: "Own application/runtime implementation work." },
8
- { id: "ui", description: "Own screen and UI delivery tasks." },
9
- { id: "api", description: "Own contract and API work." },
10
- { id: "quality", description: "Run verification and regression closure." },
11
- { id: "gitops", description: "Own GitHub Projects, workflow automation, and delivery closure." },
12
- ];
13
-
14
- function repoRootDir() {
15
- return path.resolve(new URL("..", import.meta.url).pathname);
16
- }
17
-
18
- function copyRecursive(sourceRoot, destinationRoot) {
19
- fs.mkdirSync(destinationRoot, { recursive: true });
20
- for (const entry of fs.readdirSync(sourceRoot, { withFileTypes: true })) {
21
- const sourcePath = path.join(sourceRoot, entry.name);
22
- const destinationPath = path.join(destinationRoot, entry.name);
23
- if (entry.isDirectory()) {
24
- copyRecursive(sourcePath, destinationPath);
25
- } else {
26
- fs.copyFileSync(sourcePath, destinationPath);
27
- }
28
- }
29
- }
30
-
31
- function writeFile(filePath, content) {
32
- fs.mkdirSync(path.dirname(filePath), { recursive: true });
33
- fs.writeFileSync(filePath, content);
34
- }
35
-
36
- function workflowYaml() {
37
- return `name: Agentic Orchestration
38
-
39
- on:
40
- push:
41
- paths:
42
- - "sdd/02_plan/**"
43
- - ".agentic-dev/orchestration.json"
44
- - ".agentic-dev/runtime/**"
45
- workflow_dispatch:
46
-
47
- jobs:
48
- orchestrate:
49
- runs-on: ubuntu-latest
50
- permissions:
51
- contents: read
52
- issues: write
53
- repository-projects: write
54
- steps:
55
- - name: Checkout
56
- uses: actions/checkout@v4
57
-
58
- - name: Setup Node
59
- uses: actions/setup-node@v4
60
- with:
61
- node-version: "20"
62
-
63
- - name: Start orchestration server
64
- env:
65
- GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
66
- run: |
67
- node .agentic-dev/runtime/server.mjs > /tmp/agentic-orchestration.log 2>&1 &
68
- echo $! > /tmp/agentic-orchestration.pid
69
- for i in $(seq 1 30); do
70
- if curl -fsS http://127.0.0.1:4310/health >/dev/null; then
71
- exit 0
72
- fi
73
- sleep 1
74
- done
75
- cat /tmp/agentic-orchestration.log
76
- exit 1
77
-
78
- - name: Build task IR from SDD planning
79
- run: curl -fsS -X POST http://127.0.0.1:4310/sync/ir
80
-
81
- - name: Sync GitHub project tasks
82
- env:
83
- GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
84
- run: curl -fsS -X POST http://127.0.0.1:4310/sync/tasks
85
-
86
- - name: Plan multi-agent queue
87
- env:
88
- GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
89
- run: curl -fsS -X POST http://127.0.0.1:4310/queue/plan
90
-
91
- - name: Build dispatch plan
92
- env:
93
- GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
94
- run: curl -fsS -X POST http://127.0.0.1:4310/queue/dispatch
95
-
96
- - name: Close completed tasks
97
- env:
98
- GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
99
- run: curl -fsS -X POST http://127.0.0.1:4310/tasks/close
100
-
101
- - name: Stop orchestration server
102
- if: always()
103
- run: |
104
- if [ -f /tmp/agentic-orchestration.pid ]; then
105
- kill $(cat /tmp/agentic-orchestration.pid) || true
106
- fi
107
- `;
108
- }
109
-
110
- function runtimeLibScript() {
111
- return `#!/usr/bin/env node
112
- import fs from "node:fs";
113
- import path from "node:path";
114
- import { execFileSync } from "node:child_process";
115
-
116
- export function ensureDir(dir) {
117
- fs.mkdirSync(dir, { recursive: true });
118
- }
119
-
120
- export function readJson(filePath, fallback = null) {
121
- if (!fs.existsSync(filePath)) return fallback;
122
- return JSON.parse(fs.readFileSync(filePath, "utf-8"));
123
- }
124
-
125
- export function writeJson(filePath, payload) {
126
- ensureDir(path.dirname(filePath));
127
- fs.writeFileSync(filePath, JSON.stringify(payload, null, 2) + "\\n");
128
- }
129
-
130
- export function generatedDir() {
131
- return path.resolve(".agentic-dev/generated");
132
- }
133
-
134
- export function generatedPath(name) {
135
- return path.join(generatedDir(), name);
136
- }
137
-
138
- export function orchestrationConfig() {
139
- return readJson(path.resolve(".agentic-dev/orchestration.json"), {});
140
- }
141
-
142
- export function ghJson(args) {
143
- return JSON.parse(execFileSync("gh", args, { encoding: "utf-8" }));
144
- }
145
-
146
- export function gh(args) {
147
- return execFileSync("gh", args, { encoding: "utf-8" }).trim();
148
- }
149
-
150
- export function loadTaskIr() {
151
- return readJson(generatedPath("task-ir.json"), { tasks: [] });
152
- }
153
-
154
- export function loadQueue() {
155
- return readJson(generatedPath("agent-queue.json"), { queue: [] });
156
- }
157
- `;
158
- }
159
-
160
- function sddToIrScript() {
161
- return `#!/usr/bin/env node
162
- import fs from "node:fs";
163
- import path from "node:path";
164
- import { generatedPath, writeJson } from "./runtime-lib.mjs";
165
-
166
- function walk(root) {
167
- if (!fs.existsSync(root)) return [];
168
- const files = [];
169
- for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
170
- const full = path.join(root, entry.name);
171
- if (entry.isDirectory()) files.push(...walk(full));
172
- else if (entry.name.endsWith(".md")) files.push(full);
173
- }
174
- return files;
175
- }
176
-
177
- function parseChecklist(markdown, source) {
178
- const tasks = [];
179
- const lines = markdown.split(/\\r?\\n/);
180
- for (const [index, line] of lines.entries()) {
181
- const match = line.match(/^- \\[( |x)\\] (.+)$/);
182
- if (!match) continue;
183
- const status = match[1] === "x" ? "closed" : "open";
184
- const title = match[2].trim();
185
- const id = \`\${path.basename(source, ".md")}:\${index + 1}\`;
186
- tasks.push({ id, title, status, source });
187
- }
188
- return tasks;
189
- }
190
-
191
- const planRoot = path.resolve("sdd/02_plan");
192
- const files = walk(planRoot);
193
- const tasks = files.flatMap((file) => parseChecklist(fs.readFileSync(file, "utf-8"), path.relative(process.cwd(), file)));
194
- const outputPath = generatedPath("task-ir.json");
195
- writeJson(outputPath, { generated_at: new Date().toISOString(), tasks });
196
- console.log(\`task_ir=\${outputPath}\`);
197
- console.log(\`tasks=\${tasks.length}\`);
198
- `;
199
- }
200
-
201
- function syncProjectTasksScript() {
202
- return `#!/usr/bin/env node
203
- import { gh, ghJson, loadTaskIr, orchestrationConfig, writeJson, generatedPath } from "./runtime-lib.mjs";
204
-
205
- const orchestration = orchestrationConfig();
206
- const taskIr = loadTaskIr();
207
- const existingIssues = ghJson(["issue", "list", "--repo", orchestration.github.repository.slug, "--state", "all", "--limit", "200", "--json", "number,title,state"]);
208
- const syncResult = { created: [], closed: [] };
209
-
210
- for (const task of taskIr.tasks) {
211
- const issueTitle = \`[agentic-task] \${task.id} \${task.title}\`;
212
- const found = existingIssues.find((issue) => issue.title.startsWith(\`[agentic-task] \${task.id} \`));
213
- if (!found && task.status === "open") {
214
- const url = gh(["issue", "create", "--repo", orchestration.github.repository.slug, "--title", issueTitle, "--body", \`SDD source: \${task.source}\\n\\nManaged by agentic-dev orchestration.\`, "--label", "agentic-task"]);
215
- syncResult.created.push({ id: task.id, title: task.title, issue_url: url });
216
- }
217
- if (found && task.status === "closed" && found.state !== "CLOSED") {
218
- gh(["issue", "close", String(found.number), "--repo", orchestration.github.repository.slug, "--comment", "Closed from SDD task IR."]);
219
- syncResult.closed.push({ id: task.id, issue_number: found.number });
220
- }
221
- }
222
-
223
- writeJson(generatedPath("task-sync.json"), syncResult);
224
- console.log(\`synced_tasks=\${taskIr.tasks.length}\`);
225
- `;
226
- }
227
-
228
- function runQueueScript() {
229
- return `#!/usr/bin/env node
230
- import { generatedPath, loadTaskIr, orchestrationConfig, writeJson } from "./runtime-lib.mjs";
231
-
232
- const orchestration = orchestrationConfig();
233
- const taskIr = loadTaskIr();
234
-
235
- function classifyAgent(title) {
236
- const lower = title.toLowerCase();
237
- if (lower.includes("api") || lower.includes("contract")) return "api";
238
- if (lower.includes("screen") || lower.includes("ui")) return "ui";
239
- if (lower.includes("verify") || lower.includes("test") || lower.includes("proof")) return "quality";
240
- if (lower.includes("workflow") || lower.includes("project") || lower.includes("github")) return "gitops";
241
- if (lower.includes("arch") || lower.includes("boundary") || lower.includes("structure")) return "architecture";
242
- return "runtime";
243
- }
244
-
245
- const openTasks = taskIr.tasks.filter((task) => task.status === "open");
246
- const queue = openTasks.map((task) => ({
247
- ...task,
248
- assigned_agent: classifyAgent(task.title),
249
- preferred_provider:
250
- orchestration.providers.find((provider) => provider.startsWith("codex")) ||
251
- orchestration.providers[0] ||
252
- "codex-subscription",
253
- }));
254
-
255
- const outputPath = generatedPath("agent-queue.json");
256
- writeJson(outputPath, { providers: orchestration.providers, queue });
257
- console.log(\`agent_queue=\${outputPath}\`);
258
- console.log(\`queued=\${queue.length}\`);
259
- `;
260
- }
261
-
262
- function dispatchQueueScript() {
263
- return `#!/usr/bin/env node
264
- import { generatedPath, loadQueue, orchestrationConfig, writeJson } from "./runtime-lib.mjs";
265
-
266
- const orchestration = orchestrationConfig();
267
- const queuePayload = loadQueue();
268
-
269
- const dispatch = queuePayload.queue.map((task) => ({
270
- task_id: task.id,
271
- title: task.title,
272
- assigned_agent: task.assigned_agent,
273
- provider: task.preferred_provider,
274
- repository: orchestration.github.repository.slug,
275
- project_title: orchestration.github.project.title,
276
- execution_state: "planned",
277
- }));
278
-
279
- const outputPath = generatedPath("dispatch-plan.json");
280
- writeJson(outputPath, {
281
- generated_at: new Date().toISOString(),
282
- dispatch,
283
- });
284
- console.log(\`dispatch_plan=\${outputPath}\`);
285
- console.log(\`planned=\${dispatch.length}\`);
286
- `;
287
- }
288
-
289
- function closeTasksScript() {
290
- return `#!/usr/bin/env node
291
- import { gh, ghJson, generatedPath, loadTaskIr, orchestrationConfig, writeJson } from "./runtime-lib.mjs";
292
-
293
- const orchestration = orchestrationConfig();
294
- const taskIr = loadTaskIr();
295
- const closedIds = new Set(taskIr.tasks.filter((task) => task.status === "closed").map((task) => task.id));
296
- const issues = ghJson(["issue", "list", "--repo", orchestration.github.repository.slug, "--state", "open", "--limit", "200", "--json", "number,title"]);
297
- const closed = [];
298
-
299
- for (const issue of issues) {
300
- const match = issue.title.match(/^\\[agentic-task\\] ([^ ]+) /);
301
- if (!match) continue;
302
- if (!closedIds.has(match[1])) continue;
303
- gh(["issue", "close", String(issue.number), "--repo", orchestration.github.repository.slug, "--comment", "Closed from SDD orchestration close pass."]);
304
- closed.push({ id: match[1], issue_number: issue.number });
305
- }
306
-
307
- writeJson(generatedPath("closed-tasks.json"), { closed });
308
- console.log(\`closed_candidates=\${closedIds.size}\`);
309
- `;
310
- }
311
-
312
- function serverScript() {
313
- return `#!/usr/bin/env node
314
- import http from "node:http";
315
- import { spawn } from "node:child_process";
316
-
317
- const port = Number(process.env.AGENTIC_ORCHESTRATION_PORT || 4310);
318
-
319
- function runNodeScript(script) {
320
- return new Promise((resolve, reject) => {
321
- const child = spawn(process.execPath, [script], {
322
- stdio: ["ignore", "pipe", "pipe"],
323
- });
324
-
325
- let stdout = "";
326
- let stderr = "";
327
-
328
- child.stdout.on("data", (chunk) => {
329
- stdout += chunk.toString();
330
- });
331
-
332
- child.stderr.on("data", (chunk) => {
333
- stderr += chunk.toString();
334
- });
335
-
336
- child.on("close", (code) => {
337
- if (code !== 0) {
338
- reject(new Error(stderr || stdout || \`Script failed: \${script}\`));
339
- return;
340
- }
341
- resolve({ stdout, stderr });
342
- });
343
- });
344
- }
345
-
346
- const routes = {
347
- "POST /sync/ir": ".agentic-dev/runtime/sdd_to_ir.mjs",
348
- "POST /sync/tasks": ".agentic-dev/runtime/sync_project_tasks.mjs",
349
- "POST /queue/plan": ".agentic-dev/runtime/run_multi_agent_queue.mjs",
350
- "POST /queue/dispatch": ".agentic-dev/runtime/dispatch_agents.mjs",
351
- "POST /tasks/close": ".agentic-dev/runtime/close_completed_tasks.mjs",
352
- };
353
-
354
- const server = http.createServer(async (req, res) => {
355
- const routeKey = \`\${req.method} \${req.url}\`;
356
- if (req.method === "GET" && req.url === "/health") {
357
- res.writeHead(200, { "Content-Type": "application/json" });
358
- res.end(JSON.stringify({ ok: true, port }));
359
- return;
360
- }
361
-
362
- const script = routes[routeKey];
363
- if (!script) {
364
- res.writeHead(404, { "Content-Type": "application/json" });
365
- res.end(JSON.stringify({ error: "not_found" }));
366
- return;
367
- }
368
-
369
- try {
370
- const result = await runNodeScript(script);
371
- res.writeHead(200, { "Content-Type": "application/json" });
372
- res.end(JSON.stringify({ ok: true, stdout: result.stdout.trim() }));
373
- } catch (error) {
374
- res.writeHead(500, { "Content-Type": "application/json" });
375
- res.end(JSON.stringify({ ok: false, error: String(error.message || error) }));
376
- }
377
- });
378
-
379
- server.listen(port, "127.0.0.1", () => {
380
- console.log(\`agentic_orchestration_server=http://127.0.0.1:\${port}\`);
381
- });
382
- `;
383
- }
384
-
385
- export function installSharedAgentAssets(destinationRoot) {
386
- const root = repoRootDir();
387
- copyRecursive(path.join(root, ".agent"), path.join(destinationRoot, ".agent"));
388
- copyRecursive(path.join(root, ".claude"), path.join(destinationRoot, ".claude"));
389
- copyRecursive(path.join(root, ".codex"), path.join(destinationRoot, ".codex"));
390
- }
391
-
392
- export function installOrchestrationAssets(destinationRoot) {
393
- writeFile(path.join(destinationRoot, ".github/workflows/agentic-orchestration.yml"), workflowYaml());
394
- writeFile(path.join(destinationRoot, ".agentic-dev/runtime/runtime-lib.mjs"), runtimeLibScript());
395
- writeFile(path.join(destinationRoot, ".agentic-dev/runtime/sdd_to_ir.mjs"), sddToIrScript());
396
- writeFile(path.join(destinationRoot, ".agentic-dev/runtime/sync_project_tasks.mjs"), syncProjectTasksScript());
397
- writeFile(path.join(destinationRoot, ".agentic-dev/runtime/run_multi_agent_queue.mjs"), runQueueScript());
398
- writeFile(path.join(destinationRoot, ".agentic-dev/runtime/dispatch_agents.mjs"), dispatchQueueScript());
399
- writeFile(path.join(destinationRoot, ".agentic-dev/runtime/close_completed_tasks.mjs"), closeTasksScript());
400
- writeFile(path.join(destinationRoot, ".agentic-dev/runtime/server.mjs"), serverScript());
401
- }
402
-
403
- export function buildOrchestrationConfig(setupSelections = {}) {
404
- return {
405
- project_name: setupSelections.projectName || "",
406
- specialized_agents: SPECIALIZED_AGENTS,
407
- providers: Array.isArray(setupSelections.providerProfiles) ? setupSelections.providerProfiles : [],
408
- github: {
409
- repository: setupSelections.githubRepository || {},
410
- project: setupSelections.githubProject || {},
411
- project_mode: setupSelections.githubProjectMode || "create-if-missing",
412
- },
413
- workflow: {
414
- ir_output: ".agentic-dev/generated/task-ir.json",
415
- queue_output: ".agentic-dev/generated/agent-queue.json",
416
- dispatch_output: ".agentic-dev/generated/dispatch-plan.json",
417
- workflow_file: ".github/workflows/agentic-orchestration.yml",
418
- server_entry: ".agentic-dev/runtime/server.mjs",
419
- server_port: 4310,
420
- },
421
- };
422
- }
423
-
424
- export function writeOrchestrationConfig(destinationRoot, setupSelections = {}) {
425
- const config = buildOrchestrationConfig(setupSelections);
426
- writeFile(
427
- path.join(destinationRoot, ".agentic-dev/orchestration.json"),
428
- `${JSON.stringify(config, null, 2)}\n`,
429
- );
430
- }