sequant 1.20.3 → 2.0.1
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/.claude-plugin/marketplace.json +2 -4
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +36 -15
- package/dist/bin/cli.js +25 -2
- package/dist/src/commands/doctor.js +42 -9
- package/dist/src/commands/init.d.ts +1 -0
- package/dist/src/commands/init.js +52 -0
- package/dist/src/commands/logs.d.ts +1 -0
- package/dist/src/commands/logs.js +18 -2
- package/dist/src/commands/run.d.ts +7 -0
- package/dist/src/commands/run.js +235 -68
- package/dist/src/commands/serve.d.ts +13 -0
- package/dist/src/commands/serve.js +131 -0
- package/dist/src/commands/stats.d.ts +1 -0
- package/dist/src/commands/stats.js +185 -26
- package/dist/src/commands/status.d.ts +2 -0
- package/dist/src/commands/status.js +99 -50
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +4 -1
- package/dist/src/lib/ac-parser.d.ts +2 -0
- package/dist/src/lib/ac-parser.js +12 -2
- package/dist/src/lib/assess-comment-parser.d.ts +137 -0
- package/dist/src/lib/assess-comment-parser.js +344 -0
- package/dist/src/lib/ci/config.d.ts +22 -0
- package/dist/src/lib/ci/config.js +134 -0
- package/dist/src/lib/ci/index.d.ts +12 -0
- package/dist/src/lib/ci/index.js +10 -0
- package/dist/src/lib/ci/inputs.d.ts +29 -0
- package/dist/src/lib/ci/inputs.js +103 -0
- package/dist/src/lib/ci/labels.d.ts +34 -0
- package/dist/src/lib/ci/labels.js +101 -0
- package/dist/src/lib/ci/outputs.d.ts +25 -0
- package/dist/src/lib/ci/outputs.js +84 -0
- package/dist/src/lib/ci/triggers.d.ts +9 -0
- package/dist/src/lib/ci/triggers.js +86 -0
- package/dist/src/lib/ci/types.d.ts +131 -0
- package/dist/src/lib/ci/types.js +47 -0
- package/dist/src/lib/mcp-config.d.ts +54 -0
- package/dist/src/lib/mcp-config.js +172 -0
- package/dist/src/lib/merge-check/index.js +6 -12
- package/dist/src/lib/merge-check/types.d.ts +20 -7
- package/dist/src/lib/merge-check/types.js +11 -0
- package/dist/src/lib/phase-signal.d.ts +3 -3
- package/dist/src/lib/phase-signal.js +5 -3
- package/dist/src/lib/settings.d.ts +52 -0
- package/dist/src/lib/settings.js +41 -0
- package/dist/src/lib/shutdown.d.ts +16 -5
- package/dist/src/lib/shutdown.js +32 -12
- package/dist/src/lib/solve-comment-parser.d.ts +9 -102
- package/dist/src/lib/solve-comment-parser.js +13 -248
- package/dist/src/lib/stacks.d.ts +8 -0
- package/dist/src/lib/stacks.js +34 -0
- package/dist/src/lib/system.js +3 -7
- package/dist/src/lib/test-tautology-detector.d.ts +10 -0
- package/dist/src/lib/test-tautology-detector.js +43 -4
- package/dist/src/lib/upstream/assessment.js +9 -59
- package/dist/src/lib/upstream/issues.js +12 -75
- package/dist/src/lib/version-check.d.ts +2 -2
- package/dist/src/lib/version-check.js +6 -3
- package/dist/src/lib/version.d.ts +4 -0
- package/dist/src/lib/version.js +25 -0
- package/dist/src/lib/workflow/batch-executor.d.ts +26 -86
- package/dist/src/lib/workflow/batch-executor.js +269 -55
- package/dist/src/lib/workflow/drivers/agent-driver.d.ts +56 -0
- package/dist/src/lib/workflow/drivers/agent-driver.js +8 -0
- package/dist/src/lib/workflow/drivers/aider.d.ts +18 -0
- package/dist/src/lib/workflow/drivers/aider.js +160 -0
- package/dist/src/lib/workflow/drivers/claude-code.d.ts +17 -0
- package/dist/src/lib/workflow/drivers/claude-code.js +165 -0
- package/dist/src/lib/workflow/drivers/index.d.ts +20 -0
- package/dist/src/lib/workflow/drivers/index.js +27 -0
- package/dist/src/lib/workflow/error-classifier.d.ts +16 -0
- package/dist/src/lib/workflow/error-classifier.js +90 -0
- package/dist/src/lib/workflow/log-writer.d.ts +6 -3
- package/dist/src/lib/workflow/log-writer.js +57 -27
- package/dist/src/lib/workflow/metrics-schema.d.ts +9 -9
- package/dist/src/lib/workflow/phase-detection.d.ts +23 -0
- package/dist/src/lib/workflow/phase-detection.js +45 -29
- package/dist/src/lib/workflow/phase-executor.d.ts +42 -3
- package/dist/src/lib/workflow/phase-executor.js +375 -229
- package/dist/src/lib/workflow/phase-mapper.d.ts +1 -1
- package/dist/src/lib/workflow/phase-mapper.js +7 -7
- package/dist/src/lib/workflow/platforms/github.d.ts +157 -0
- package/dist/src/lib/workflow/platforms/github.js +466 -0
- package/dist/src/lib/workflow/platforms/index.d.ts +17 -0
- package/dist/src/lib/workflow/platforms/index.js +25 -0
- package/dist/src/lib/workflow/platforms/platform-provider.d.ts +67 -0
- package/dist/src/lib/workflow/platforms/platform-provider.js +8 -0
- package/dist/src/lib/workflow/pr-status.d.ts +2 -4
- package/dist/src/lib/workflow/pr-status.js +3 -16
- package/dist/src/lib/workflow/qa-cache.d.ts +58 -0
- package/dist/src/lib/workflow/qa-cache.js +88 -0
- package/dist/src/lib/workflow/reconcile.d.ts +69 -0
- package/dist/src/lib/workflow/reconcile.js +290 -0
- package/dist/src/lib/workflow/ring-buffer.d.ts +17 -0
- package/dist/src/lib/workflow/ring-buffer.js +37 -0
- package/dist/src/lib/workflow/run-log-schema.d.ts +115 -24
- package/dist/src/lib/workflow/run-log-schema.js +47 -12
- package/dist/src/lib/workflow/run-reflect.js +1 -1
- package/dist/src/lib/workflow/state-cleanup.js +21 -0
- package/dist/src/lib/workflow/state-manager.d.ts +34 -3
- package/dist/src/lib/workflow/state-manager.js +278 -126
- package/dist/src/lib/workflow/state-schema.d.ts +34 -30
- package/dist/src/lib/workflow/state-schema.js +35 -25
- package/dist/src/lib/workflow/state-utils.d.ts +3 -1
- package/dist/src/lib/workflow/state-utils.js +1 -0
- package/dist/src/lib/workflow/types.d.ts +224 -6
- package/dist/src/lib/workflow/types.js +20 -1
- package/dist/src/lib/workflow/worktree-discovery.d.ts +1 -1
- package/dist/src/lib/workflow/worktree-discovery.js +6 -14
- package/dist/src/lib/workflow/worktree-manager.js +33 -51
- package/dist/src/mcp/index.d.ts +4 -0
- package/dist/src/mcp/index.js +4 -0
- package/dist/src/mcp/resources.d.ts +7 -0
- package/dist/src/mcp/resources.js +111 -0
- package/dist/src/mcp/run-registry.d.ts +34 -0
- package/dist/src/mcp/run-registry.js +42 -0
- package/dist/src/mcp/server.d.ts +12 -0
- package/dist/src/mcp/server.js +50 -0
- package/dist/src/mcp/tools/logs.d.ts +7 -0
- package/dist/src/mcp/tools/logs.js +149 -0
- package/dist/src/mcp/tools/run.d.ts +121 -0
- package/dist/src/mcp/tools/run.js +591 -0
- package/dist/src/mcp/tools/status.d.ts +7 -0
- package/dist/src/mcp/tools/status.js +127 -0
- package/package.json +26 -7
- package/templates/hooks/post-tool.sh +19 -8
- package/templates/hooks/pre-tool.sh +36 -49
- package/templates/mcp.json +6 -0
- package/templates/skills/assess/SKILL.md +354 -352
- package/templates/skills/exec/SKILL.md +64 -1
- package/templates/skills/fullsolve/SKILL.md +35 -4
- package/templates/skills/qa/SKILL.md +486 -9
- package/templates/skills/qa/scripts/quality-checks.sh +1 -1
- package/templates/skills/setup/SKILL.md +386 -0
- package/templates/skills/solve/SKILL.md +38 -664
- package/templates/skills/spec/SKILL.md +90 -31
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Main assessment module for upstream analysis
|
|
3
3
|
* Coordinates release fetching, analysis, and output generation
|
|
4
4
|
*/
|
|
5
|
-
import { spawn } from "node:child_process";
|
|
6
5
|
import { readFile, writeFile, access, mkdir } from "node:fs/promises";
|
|
7
6
|
import { dirname, join } from "node:path";
|
|
7
|
+
import { GitHubProvider } from "../workflow/platforms/github.js";
|
|
8
8
|
import { analyzeRelease, getActionableFindings } from "./relevance.js";
|
|
9
9
|
import { calculateSummary, generateAssessmentReport, generateBatchedSummaryReport, generateLocalReport, } from "./report.js";
|
|
10
10
|
import { createAssessmentIssue, createOrLinkFinding } from "./issues.js";
|
|
@@ -22,62 +22,28 @@ export function validateVersion(version) {
|
|
|
22
22
|
throw new Error(`Invalid version format: "${version}". Expected semver format (e.g., v1.2.3 or 1.2.3-beta.1)`);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
* This prevents command injection by not using shell interpolation
|
|
28
|
-
*/
|
|
29
|
-
async function execCommand(command, args) {
|
|
30
|
-
return new Promise((resolve, reject) => {
|
|
31
|
-
const proc = spawn(command, args, { stdio: ["pipe", "pipe", "pipe"] });
|
|
32
|
-
let stdout = "";
|
|
33
|
-
let stderr = "";
|
|
34
|
-
proc.stdout.on("data", (data) => {
|
|
35
|
-
stdout += data.toString();
|
|
36
|
-
});
|
|
37
|
-
proc.stderr.on("data", (data) => {
|
|
38
|
-
stderr += data.toString();
|
|
39
|
-
});
|
|
40
|
-
proc.on("close", (code) => {
|
|
41
|
-
if (code === 0) {
|
|
42
|
-
resolve({ stdout, stderr });
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
reject(new Error(`Command failed with exit code ${code}: ${stderr}`));
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
proc.on("error", (err) => {
|
|
49
|
-
reject(err);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
}
|
|
25
|
+
/** Shared GitHubProvider instance for upstream gh CLI calls. */
|
|
26
|
+
const ghProvider = new GitHubProvider();
|
|
53
27
|
/**
|
|
54
28
|
* Check if gh CLI is available and authenticated
|
|
55
29
|
* @returns Object with availability status and error message if not available
|
|
56
30
|
*/
|
|
57
31
|
export async function checkGhCliAvailable() {
|
|
58
|
-
|
|
59
|
-
// Check if gh is installed
|
|
60
|
-
await execCommand("gh", ["--version"]);
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
32
|
+
if (!ghProvider.checkGhInstalledSync()) {
|
|
63
33
|
return {
|
|
64
34
|
available: false,
|
|
65
35
|
authenticated: false,
|
|
66
36
|
error: "GitHub CLI (gh) is not installed. Install from: https://cli.github.com/",
|
|
67
37
|
};
|
|
68
38
|
}
|
|
69
|
-
|
|
70
|
-
// Check if gh is authenticated
|
|
71
|
-
await execCommand("gh", ["auth", "status"]);
|
|
72
|
-
return { available: true, authenticated: true };
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
39
|
+
if (!ghProvider.checkAuthSync()) {
|
|
75
40
|
return {
|
|
76
41
|
available: true,
|
|
77
42
|
authenticated: false,
|
|
78
43
|
error: "GitHub CLI is not authenticated. Run: gh auth login",
|
|
79
44
|
};
|
|
80
45
|
}
|
|
46
|
+
return { available: true, authenticated: true };
|
|
81
47
|
}
|
|
82
48
|
/**
|
|
83
49
|
* Default paths for upstream files
|
|
@@ -93,14 +59,8 @@ export async function fetchRelease(version) {
|
|
|
93
59
|
if (version) {
|
|
94
60
|
validateVersion(version);
|
|
95
61
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (version) {
|
|
99
|
-
args.push(version);
|
|
100
|
-
}
|
|
101
|
-
args.push("--repo", "anthropics/claude-code", "--json", "tagName,name,body,publishedAt");
|
|
102
|
-
const { stdout } = await execCommand("gh", args);
|
|
103
|
-
return JSON.parse(stdout);
|
|
62
|
+
const data = ghProvider.fetchReleaseSync("anthropics/claude-code", version);
|
|
63
|
+
return data;
|
|
104
64
|
}
|
|
105
65
|
catch (error) {
|
|
106
66
|
console.error("Error fetching release:", error);
|
|
@@ -116,17 +76,7 @@ export async function listReleases(limit = 50) {
|
|
|
116
76
|
if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
|
|
117
77
|
throw new Error("Limit must be an integer between 1 and 100");
|
|
118
78
|
}
|
|
119
|
-
|
|
120
|
-
"release",
|
|
121
|
-
"list",
|
|
122
|
-
"--repo",
|
|
123
|
-
"anthropics/claude-code",
|
|
124
|
-
"--limit",
|
|
125
|
-
String(limit),
|
|
126
|
-
"--json",
|
|
127
|
-
"tagName,publishedAt",
|
|
128
|
-
]);
|
|
129
|
-
return JSON.parse(stdout);
|
|
79
|
+
return ghProvider.listReleasesSync("anthropics/claude-code", limit);
|
|
130
80
|
}
|
|
131
81
|
catch (error) {
|
|
132
82
|
console.error("Error listing releases:", error);
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* Security: All gh CLI calls use spawn() with argument arrays to prevent
|
|
6
6
|
* command injection. No shell interpolation is used.
|
|
7
7
|
*/
|
|
8
|
-
import { spawn } from "node:child_process";
|
|
9
8
|
import { writeFile, unlink } from "node:fs/promises";
|
|
10
9
|
import { tmpdir } from "node:os";
|
|
11
10
|
import { join } from "node:path";
|
|
11
|
+
import { GitHubProvider } from "../workflow/platforms/github.js";
|
|
12
12
|
import { generateFindingIssue } from "./report.js";
|
|
13
13
|
/**
|
|
14
14
|
* Regex pattern for valid GitHub owner/repo names
|
|
@@ -26,34 +26,8 @@ function validateRepoParams(owner, repo) {
|
|
|
26
26
|
throw new Error(`Invalid repo name: "${repo}"`);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
* This prevents command injection by not using shell interpolation
|
|
32
|
-
*/
|
|
33
|
-
async function execCommand(command, args) {
|
|
34
|
-
return new Promise((resolve, reject) => {
|
|
35
|
-
const proc = spawn(command, args, { stdio: ["pipe", "pipe", "pipe"] });
|
|
36
|
-
let stdout = "";
|
|
37
|
-
let stderr = "";
|
|
38
|
-
proc.stdout.on("data", (data) => {
|
|
39
|
-
stdout += data.toString();
|
|
40
|
-
});
|
|
41
|
-
proc.stderr.on("data", (data) => {
|
|
42
|
-
stderr += data.toString();
|
|
43
|
-
});
|
|
44
|
-
proc.on("close", (code) => {
|
|
45
|
-
if (code === 0) {
|
|
46
|
-
resolve({ stdout, stderr });
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
reject(new Error(`Command failed with exit code ${code}: ${stderr}`));
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
proc.on("error", (err) => {
|
|
53
|
-
reject(err);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|
|
29
|
+
/** Shared GitHubProvider instance for upstream gh CLI calls. */
|
|
30
|
+
const ghProvider = new GitHubProvider();
|
|
57
31
|
/**
|
|
58
32
|
* Check if a similar upstream issue already exists
|
|
59
33
|
*/
|
|
@@ -61,24 +35,8 @@ export async function checkForDuplicate(title, owner = "sequant-io", repo = "seq
|
|
|
61
35
|
try {
|
|
62
36
|
validateRepoParams(owner, repo);
|
|
63
37
|
// Search for existing upstream issues with similar title
|
|
64
|
-
// Extract key terms from title for search
|
|
65
38
|
const searchTerms = extractSearchTerms(title);
|
|
66
|
-
|
|
67
|
-
const { stdout } = await execCommand("gh", [
|
|
68
|
-
"issue",
|
|
69
|
-
"list",
|
|
70
|
-
"--repo",
|
|
71
|
-
`${owner}/${repo}`,
|
|
72
|
-
"--label",
|
|
73
|
-
"upstream",
|
|
74
|
-
"--search",
|
|
75
|
-
searchTerms,
|
|
76
|
-
"--json",
|
|
77
|
-
"number,title",
|
|
78
|
-
"--limit",
|
|
79
|
-
"10",
|
|
80
|
-
]);
|
|
81
|
-
const issues = JSON.parse(stdout);
|
|
39
|
+
const issues = ghProvider.searchIssuesSync(`${owner}/${repo}`, ["upstream"], searchTerms, 10);
|
|
82
40
|
// Check for similarity
|
|
83
41
|
for (const issue of issues) {
|
|
84
42
|
if (isSimilarTitle(title, issue.title)) {
|
|
@@ -158,27 +116,11 @@ export async function createIssue(params, owner = "sequant-io", repo = "sequant"
|
|
|
158
116
|
const tempFile = join(tmpdir(), `gh-issue-body-${Date.now()}.md`);
|
|
159
117
|
try {
|
|
160
118
|
await writeFile(tempFile, params.body, "utf-8");
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
"issue"
|
|
164
|
-
"create",
|
|
165
|
-
"--repo",
|
|
166
|
-
`${owner}/${repo}`,
|
|
167
|
-
"--title",
|
|
168
|
-
params.title,
|
|
169
|
-
"--body-file",
|
|
170
|
-
tempFile,
|
|
171
|
-
];
|
|
172
|
-
// Add labels
|
|
173
|
-
for (const label of params.labels) {
|
|
174
|
-
args.push("--label", label);
|
|
119
|
+
const result = ghProvider.createIssueWithBodyFileSync(`${owner}/${repo}`, params.title, tempFile, params.labels);
|
|
120
|
+
if (!result) {
|
|
121
|
+
throw new Error("Failed to create issue");
|
|
175
122
|
}
|
|
176
|
-
|
|
177
|
-
// Parse issue URL from output
|
|
178
|
-
const url = stdout.trim();
|
|
179
|
-
const numberMatch = url.match(/\/issues\/(\d+)$/);
|
|
180
|
-
const number = numberMatch ? parseInt(numberMatch[1], 10) : 0;
|
|
181
|
-
return { number, url };
|
|
123
|
+
return result;
|
|
182
124
|
}
|
|
183
125
|
finally {
|
|
184
126
|
// Clean up temp file
|
|
@@ -203,15 +145,10 @@ export async function addIssueComment(issueNumber, comment, owner = "sequant-io"
|
|
|
203
145
|
const tempFile = join(tmpdir(), `gh-comment-${Date.now()}.md`);
|
|
204
146
|
try {
|
|
205
147
|
await writeFile(tempFile, comment, "utf-8");
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
"--repo",
|
|
211
|
-
`${owner}/${repo}`,
|
|
212
|
-
"--body-file",
|
|
213
|
-
tempFile,
|
|
214
|
-
]);
|
|
148
|
+
const success = ghProvider.commentOnIssueWithBodyFileSync(`${owner}/${repo}`, issueNumber, tempFile);
|
|
149
|
+
if (!success) {
|
|
150
|
+
throw new Error(`Failed to comment on issue #${issueNumber}`);
|
|
151
|
+
}
|
|
215
152
|
}
|
|
216
153
|
finally {
|
|
217
154
|
// Clean up temp file
|
|
@@ -66,8 +66,8 @@ export declare function isOutdated(currentVersion: string, latestVersion: string
|
|
|
66
66
|
/**
|
|
67
67
|
* Get the version warning message
|
|
68
68
|
*
|
|
69
|
-
* For local node_modules installs, recommends
|
|
70
|
-
* For npx usage, recommends `npx sequant@latest
|
|
69
|
+
* For local node_modules installs, recommends the correct update command
|
|
70
|
+
* for the project's package manager. For npx usage, recommends `npx sequant@latest`.
|
|
71
71
|
*/
|
|
72
72
|
export declare function getVersionWarning(currentVersion: string, latestVersion: string, isLocal?: boolean): string;
|
|
73
73
|
/**
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import fs from "fs";
|
|
8
8
|
import path from "path";
|
|
9
9
|
import { fileURLToPath } from "url";
|
|
10
|
+
import { detectPackageManagerSync, getPackageManagerCommands, } from "./stacks.js";
|
|
10
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
11
12
|
const __dirname = path.dirname(__filename);
|
|
12
13
|
const PACKAGE_NAME = "sequant";
|
|
@@ -178,14 +179,16 @@ export function isOutdated(currentVersion, latestVersion) {
|
|
|
178
179
|
/**
|
|
179
180
|
* Get the version warning message
|
|
180
181
|
*
|
|
181
|
-
* For local node_modules installs, recommends
|
|
182
|
-
* For npx usage, recommends `npx sequant@latest
|
|
182
|
+
* For local node_modules installs, recommends the correct update command
|
|
183
|
+
* for the project's package manager. For npx usage, recommends `npx sequant@latest`.
|
|
183
184
|
*/
|
|
184
185
|
export function getVersionWarning(currentVersion, latestVersion, isLocal) {
|
|
185
186
|
const isLocalInstall = isLocal ?? isLocalNodeModulesInstall();
|
|
186
187
|
if (isLocalInstall) {
|
|
188
|
+
const pm = detectPackageManagerSync();
|
|
189
|
+
const pmConfig = getPackageManagerCommands(pm);
|
|
187
190
|
return `sequant ${latestVersion} is available (you have ${currentVersion})
|
|
188
|
-
Run:
|
|
191
|
+
Run: ${pmConfig.updatePkg} sequant
|
|
189
192
|
Note: You have sequant as a local dependency. npx uses your node_modules version.`;
|
|
190
193
|
}
|
|
191
194
|
return `sequant ${latestVersion} is available (you have ${currentVersion})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version utility - reads version from package.json
|
|
3
|
+
*/
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
import { dirname, resolve } from "path";
|
|
6
|
+
import { readFileSync } from "fs";
|
|
7
|
+
export function getVersion() {
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
let dir = __dirname;
|
|
10
|
+
while (dir !== dirname(dir)) {
|
|
11
|
+
const candidate = resolve(dir, "package.json");
|
|
12
|
+
try {
|
|
13
|
+
const content = readFileSync(candidate, "utf-8");
|
|
14
|
+
const pkg = JSON.parse(content);
|
|
15
|
+
if (pkg.name === "sequant") {
|
|
16
|
+
return pkg.version;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
// Not found, continue searching
|
|
21
|
+
}
|
|
22
|
+
dir = dirname(dir);
|
|
23
|
+
}
|
|
24
|
+
return "0.0.0";
|
|
25
|
+
}
|
|
@@ -7,87 +7,30 @@
|
|
|
7
7
|
* (including quality-loop retries, checkpoint commits, rebasing, and PR
|
|
8
8
|
* creation).
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
reuseWorktrees?: boolean;
|
|
35
|
-
/** Suppress version warnings and non-essential output */
|
|
36
|
-
quiet?: boolean;
|
|
37
|
-
/** Chain issues: each branches from previous (requires --sequential) */
|
|
38
|
-
chain?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Wait for QA pass before starting next issue in chain mode.
|
|
41
|
-
* When enabled, the chain pauses if QA fails, preventing downstream issues
|
|
42
|
-
* from building on potentially broken code.
|
|
43
|
-
*/
|
|
44
|
-
qaGate?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Base branch for worktree creation.
|
|
47
|
-
* Resolution priority: this CLI flag → settings.run.defaultBase → 'main'
|
|
48
|
-
*/
|
|
49
|
-
base?: string;
|
|
50
|
-
/**
|
|
51
|
-
* Disable MCP servers in headless mode.
|
|
52
|
-
* When true, MCPs are not passed to the SDK (faster/cheaper runs).
|
|
53
|
-
* Resolution priority: this CLI flag → settings.run.mcp → default (true)
|
|
54
|
-
*/
|
|
55
|
-
noMcp?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Resume from last completed phase.
|
|
58
|
-
* Reads phase markers from GitHub issue comments and skips completed phases.
|
|
59
|
-
*/
|
|
60
|
-
resume?: boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Disable automatic retry with MCP fallback.
|
|
63
|
-
* When true, no retry attempts are made on phase failure.
|
|
64
|
-
* Useful for debugging to see the actual failure without retry masking it.
|
|
65
|
-
*/
|
|
66
|
-
noRetry?: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Skip pre-PR rebase onto the base branch.
|
|
69
|
-
* When true, branches are not rebased before creating the PR.
|
|
70
|
-
* Use when you want to preserve branch state or handle rebasing manually.
|
|
71
|
-
*/
|
|
72
|
-
noRebase?: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Skip PR creation after successful QA.
|
|
75
|
-
* When true, branches are pushed but no PR is created.
|
|
76
|
-
* Useful for manual workflows where PRs are created separately.
|
|
77
|
-
*/
|
|
78
|
-
noPr?: boolean;
|
|
79
|
-
/**
|
|
80
|
-
* Force re-execution of issues even if they have completed status.
|
|
81
|
-
* Bypasses the pre-flight state guard that skips ready_for_merge/merged issues.
|
|
82
|
-
*/
|
|
83
|
-
force?: boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Analyze run results and suggest workflow improvements.
|
|
86
|
-
* Displays observations about timing patterns, phase mismatches, and
|
|
87
|
-
* actionable suggestions after the summary output.
|
|
88
|
-
*/
|
|
89
|
-
reflect?: boolean;
|
|
90
|
-
}
|
|
10
|
+
import { PhaseResult, IssueResult, type RunOptions, type IssueExecutionContext, type BatchExecutionContext } from "./types.js";
|
|
11
|
+
export type { RunOptions, ProgressCallback, IssueExecutionContext, BatchExecutionContext, } from "./types.js";
|
|
12
|
+
/**
|
|
13
|
+
* Emit a structured progress line to stderr for MCP progress notifications.
|
|
14
|
+
* Only emits when running under an orchestrator (e.g., MCP server).
|
|
15
|
+
* The MCP handler parses these lines to send `notifications/progress`.
|
|
16
|
+
*
|
|
17
|
+
* @param issue - GitHub issue number
|
|
18
|
+
* @param phase - Phase name (e.g., "spec", "exec", "qa")
|
|
19
|
+
* @param event - Phase lifecycle event: "start", "complete", or "failed"
|
|
20
|
+
* @param extra - Optional fields: durationSeconds (on complete), error (on failed)
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Build enriched prompt context for the /loop phase from a failed phase result (#488).
|
|
24
|
+
* Passes QA verdict, failed ACs, and error directly so the /loop skill doesn't need
|
|
25
|
+
* to reconstruct context from GitHub comments (which fails in subprocess).
|
|
26
|
+
*
|
|
27
|
+
* @internal Exported for testing only
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildLoopContext(failedResult: PhaseResult): string;
|
|
30
|
+
export declare function emitProgressLine(issue: number, phase: string, event?: "start" | "complete" | "failed", extra?: {
|
|
31
|
+
durationSeconds?: number;
|
|
32
|
+
error?: string;
|
|
33
|
+
}): void;
|
|
91
34
|
export declare function getIssueInfo(issueNumber: number): Promise<{
|
|
92
35
|
title: string;
|
|
93
36
|
labels: string[];
|
|
@@ -110,8 +53,5 @@ export declare function parseBatches(batchArgs: string[]): number[][];
|
|
|
110
53
|
* Parse environment variables for CI configuration
|
|
111
54
|
*/
|
|
112
55
|
export declare function getEnvConfig(): Partial<RunOptions>;
|
|
113
|
-
export declare function executeBatch(issueNumbers: number[],
|
|
114
|
-
|
|
115
|
-
labels: string[];
|
|
116
|
-
}>, worktreeMap: Map<number, WorktreeInfo>, shutdownManager?: ShutdownManager, packageManager?: string, baseBranch?: string): Promise<IssueResult[]>;
|
|
117
|
-
export declare function runIssueWithLogging(issueNumber: number, config: ExecutionConfig, logWriter: LogWriter | null, stateManager: StateManager | null, issueTitle: string, labels: string[], options: RunOptions, worktreePath?: string, branch?: string, shutdownManager?: ShutdownManager, chainMode?: boolean, packageManager?: string, isLastInChain?: boolean, baseBranch?: string): Promise<IssueResult>;
|
|
56
|
+
export declare function executeBatch(issueNumbers: number[], batchCtx: BatchExecutionContext): Promise<IssueResult[]>;
|
|
57
|
+
export declare function runIssueWithLogging(ctx: IssueExecutionContext): Promise<IssueResult>;
|