waypoint-codex 0.1.5 → 0.1.6
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, statSync, writeFileSync } from "node:fs";
|
|
4
|
-
import {
|
|
4
|
+
import { execFileSync } from "node:child_process";
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
@@ -25,7 +25,7 @@ function ensureDir(dirPath) {
|
|
|
25
25
|
|
|
26
26
|
function safeExec(command, cwd) {
|
|
27
27
|
try {
|
|
28
|
-
return
|
|
28
|
+
return execFileSync(command[0], command.slice(1), {
|
|
29
29
|
cwd,
|
|
30
30
|
stdio: ["ignore", "pipe", "ignore"],
|
|
31
31
|
encoding: "utf8",
|
|
@@ -329,21 +329,43 @@ function main() {
|
|
|
329
329
|
contextDir,
|
|
330
330
|
"UNCOMMITTED_CHANGES.md",
|
|
331
331
|
"Uncommitted Changes",
|
|
332
|
-
|
|
332
|
+
[
|
|
333
|
+
"## Status",
|
|
334
|
+
"",
|
|
335
|
+
"```",
|
|
336
|
+
safeExec(["git", "status", "--short", "--branch"], projectRoot) || "No uncommitted changes.",
|
|
337
|
+
"```",
|
|
338
|
+
"",
|
|
339
|
+
"## Diff Stat",
|
|
340
|
+
"",
|
|
341
|
+
"```",
|
|
342
|
+
safeExec(["git", "diff", "--stat"], projectRoot) || "No unstaged tracked diff.",
|
|
343
|
+
"```",
|
|
344
|
+
"",
|
|
345
|
+
"## Staged Diff Stat",
|
|
346
|
+
"",
|
|
347
|
+
"```",
|
|
348
|
+
safeExec(["git", "diff", "--stat", "--cached"], projectRoot) || "No staged diff.",
|
|
349
|
+
"```",
|
|
350
|
+
].join("\n")
|
|
333
351
|
);
|
|
334
352
|
|
|
335
353
|
const recentCommitsPath = writeContextFile(
|
|
336
354
|
contextDir,
|
|
337
355
|
"RECENT_COMMITS.md",
|
|
338
356
|
"Recent Commits",
|
|
339
|
-
|
|
357
|
+
[
|
|
358
|
+
"```",
|
|
359
|
+
safeExec(["git", "log", "--format=%h%d %s (%cr)", "-20", "--all"], projectRoot) || "No recent commits found.",
|
|
360
|
+
"```",
|
|
361
|
+
].join("\n")
|
|
340
362
|
);
|
|
341
363
|
|
|
342
364
|
const nestedRepos = collectNestedGitRepos(projectRoot);
|
|
343
365
|
const nestedRepoSections = nestedRepos.map((repoPath) => {
|
|
344
366
|
const rel = path.relative(projectRoot, repoPath) || ".";
|
|
345
|
-
const branch = safeExec("git branch --show-current", repoPath) || "unknown";
|
|
346
|
-
const commits = safeExec("git log --format=%h %s (%cr) -10", repoPath) || "No recent commits found.";
|
|
367
|
+
const branch = safeExec(["git", "branch", "--show-current"], repoPath) || "unknown";
|
|
368
|
+
const commits = safeExec(["git", "log", "--format=%h %s (%cr)", "-10"], repoPath) || "No recent commits found.";
|
|
347
369
|
return `## ${rel}\n\nBranch: ${branch}\n\n\`\`\`\n${commits}\n\`\`\``;
|
|
348
370
|
});
|
|
349
371
|
const nestedReposPath = writeContextFile(
|
|
@@ -354,11 +376,39 @@ function main() {
|
|
|
354
376
|
);
|
|
355
377
|
|
|
356
378
|
const openPrs = safeExec(
|
|
357
|
-
|
|
379
|
+
[
|
|
380
|
+
"gh",
|
|
381
|
+
"pr",
|
|
382
|
+
"list",
|
|
383
|
+
"--state",
|
|
384
|
+
"open",
|
|
385
|
+
"--author",
|
|
386
|
+
"@me",
|
|
387
|
+
"--limit",
|
|
388
|
+
"5",
|
|
389
|
+
"--json",
|
|
390
|
+
"number,title,author,headRefName",
|
|
391
|
+
"--template",
|
|
392
|
+
"{{range .}}#{{.number}} {{.title}} ({{.author.login}}) [{{.headRefName}}]\n{{end}}",
|
|
393
|
+
],
|
|
358
394
|
projectRoot
|
|
359
395
|
);
|
|
360
396
|
const mergedPrs = safeExec(
|
|
361
|
-
|
|
397
|
+
[
|
|
398
|
+
"gh",
|
|
399
|
+
"pr",
|
|
400
|
+
"list",
|
|
401
|
+
"--state",
|
|
402
|
+
"merged",
|
|
403
|
+
"--author",
|
|
404
|
+
"@me",
|
|
405
|
+
"--limit",
|
|
406
|
+
"5",
|
|
407
|
+
"--json",
|
|
408
|
+
"number,title,author,mergedAt",
|
|
409
|
+
"--template",
|
|
410
|
+
"{{range .}}#{{.number}} {{.title}} ({{.author.login}}) merged {{timeago .mergedAt}}\n{{end}}",
|
|
411
|
+
],
|
|
362
412
|
projectRoot
|
|
363
413
|
);
|
|
364
414
|
const prsPath = writeContextFile(
|