ai-foreman 1.6.1 → 1.6.2
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/dist/cli/start.d.ts +2 -0
- package/dist/cli/start.js +37 -3
- package/dist/foreman.js +5 -1
- package/package.json +1 -1
package/dist/cli/start.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
+
export declare function formatStartResumeCommand(executable: "ai-foreman", projectDir: string, steps: number, sessionId: string): string;
|
|
3
|
+
export declare function formatResumeGuidance(executable: "rafi" | "ai-foreman", projectDir: string, steps: number, sessionId?: string): string[];
|
|
2
4
|
export declare function buildStartCommand(): Command;
|
package/dist/cli/start.js
CHANGED
|
@@ -53,6 +53,31 @@ function collectTicket(value, previous) {
|
|
|
53
53
|
function unique(values) {
|
|
54
54
|
return [...new Set(values)];
|
|
55
55
|
}
|
|
56
|
+
export function formatStartResumeCommand(executable, projectDir, steps, sessionId) {
|
|
57
|
+
return [
|
|
58
|
+
executable,
|
|
59
|
+
"start",
|
|
60
|
+
shellQuote(projectDir),
|
|
61
|
+
"--steps",
|
|
62
|
+
String(steps),
|
|
63
|
+
"--resume",
|
|
64
|
+
shellQuote(sessionId),
|
|
65
|
+
].join(" ");
|
|
66
|
+
}
|
|
67
|
+
export function formatResumeGuidance(executable, projectDir, steps, sessionId) {
|
|
68
|
+
if (executable === "rafi") {
|
|
69
|
+
return [
|
|
70
|
+
"foreman: resume this run with:",
|
|
71
|
+
` rafi build:resume ${shellQuote(projectDir)}`,
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
if (!sessionId)
|
|
75
|
+
return [];
|
|
76
|
+
return [
|
|
77
|
+
"foreman: resume this builder with:",
|
|
78
|
+
` ${formatStartResumeCommand("ai-foreman", projectDir, steps, sessionId)}`,
|
|
79
|
+
];
|
|
80
|
+
}
|
|
56
81
|
function optionWasProvided(command, name) {
|
|
57
82
|
const source = command.getOptionValueSource(name);
|
|
58
83
|
return source !== undefined && source !== "default";
|
|
@@ -752,9 +777,13 @@ export function buildStartCommand() {
|
|
|
752
777
|
console.log(`foreman: outcome — ${result.outcome}`);
|
|
753
778
|
if (result.detail)
|
|
754
779
|
console.log(`foreman: ${result.detail}`);
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
780
|
+
if (result.outcome !== "all-done" && result.outcome !== "plan-complete") {
|
|
781
|
+
const executable = command.parent?.name() === "rafi" ? "rafi" : "ai-foreman";
|
|
782
|
+
const remainingSteps = Math.max(1, result.requested - result.completed);
|
|
783
|
+
for (const line of formatResumeGuidance(executable, cwd, remainingSteps, builder.sessionId())) {
|
|
784
|
+
console.log(line);
|
|
785
|
+
}
|
|
786
|
+
}
|
|
758
787
|
process.exit(result.outcome === "needs-human" ? 2 : 0);
|
|
759
788
|
}
|
|
760
789
|
catch (err) {
|
|
@@ -787,3 +816,8 @@ function explicitDefaultValue(value) {
|
|
|
787
816
|
function explicitEffort(value) {
|
|
788
817
|
return value && ["low", "medium", "high", "xhigh"].includes(value) ? value : undefined;
|
|
789
818
|
}
|
|
819
|
+
function shellQuote(value) {
|
|
820
|
+
return /^[A-Za-z0-9_./:@%+=,-]+$/.test(value)
|
|
821
|
+
? value
|
|
822
|
+
: `'${value.replace(/'/g, `'"'"'`)}'`;
|
|
823
|
+
}
|
package/dist/foreman.js
CHANGED
|
@@ -477,7 +477,11 @@ function fingerprintProtectedTree(root) {
|
|
|
477
477
|
const path = join(directory, entry.name);
|
|
478
478
|
const rel = relative(root, path).replace(/\\/g, "/");
|
|
479
479
|
if (entry.isDirectory()) {
|
|
480
|
-
if (ignored.has(entry.name)
|
|
480
|
+
if (ignored.has(entry.name)
|
|
481
|
+
|| rel === ".foreman"
|
|
482
|
+
|| rel.startsWith(".foreman/")
|
|
483
|
+
|| rel === ".rafi/cache"
|
|
484
|
+
|| rel.startsWith(".rafi/cache/"))
|
|
481
485
|
continue;
|
|
482
486
|
visit(path);
|
|
483
487
|
}
|
package/package.json
CHANGED