automata-cli 0.1.0-013-implement-next-selection.118 → 0.1.0-013-implement-next-selection.122
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/index.js +45 -39
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1750,32 +1750,37 @@ function invokeCodexCodeSync(prompt, yolo) {
|
|
|
1750
1750
|
}
|
|
1751
1751
|
|
|
1752
1752
|
// src/commands/getReady.ts
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
process.stdout.write(` [${i + 1}] #${issues[i].number} - ${issues[i].title}
|
|
1753
|
+
function writeOverflowHint(output, issues, limit) {
|
|
1754
|
+
if (issues.length === limit) {
|
|
1755
|
+
output.write(`(Showing first ${limit} matching issues \u2014 there may be more. Use --limit to fetch more.)
|
|
1757
1756
|
`);
|
|
1758
1757
|
}
|
|
1759
|
-
|
|
1760
|
-
|
|
1758
|
+
}
|
|
1759
|
+
function writeIssueList(output, issues, limit) {
|
|
1760
|
+
output.write("\nAvailable issues:\n");
|
|
1761
|
+
for (let i = 0; i < issues.length; i++) {
|
|
1762
|
+
output.write(` [${i + 1}] #${issues[i].number} - ${issues[i].title}
|
|
1761
1763
|
`);
|
|
1762
1764
|
}
|
|
1763
|
-
|
|
1765
|
+
writeOverflowHint(output, issues, limit);
|
|
1766
|
+
}
|
|
1767
|
+
async function promptSelection(issues, limit, output) {
|
|
1768
|
+
writeIssueList(output, issues, limit);
|
|
1769
|
+
const rl = createInterface2({ input: process.stdin, output });
|
|
1764
1770
|
const answer = await new Promise(
|
|
1765
1771
|
(resolve3) => rl.question(`
|
|
1766
1772
|
Select issue (1-${issues.length}): `, resolve3)
|
|
1767
1773
|
);
|
|
1768
1774
|
rl.close();
|
|
1769
|
-
const n = parseInt(answer.trim(), 10);
|
|
1770
|
-
if (isNaN(n) || n < 1 || n > issues.length) {
|
|
1775
|
+
const n = Number.parseInt(answer.trim(), 10);
|
|
1776
|
+
if (Number.isNaN(n) || n < 1 || n > issues.length) {
|
|
1771
1777
|
process.stderr.write(`Error: Invalid selection "${answer.trim()}". Enter a number between 1 and ${issues.length}.
|
|
1772
1778
|
`);
|
|
1773
1779
|
process.exit(1);
|
|
1774
1780
|
}
|
|
1775
1781
|
return issues[n - 1];
|
|
1776
1782
|
}
|
|
1777
|
-
|
|
1778
|
-
const config = readConfig();
|
|
1783
|
+
function validateConfig(config) {
|
|
1779
1784
|
if (config.remoteType !== "gh") {
|
|
1780
1785
|
process.stderr.write(
|
|
1781
1786
|
"Error: implement-next is not supported in Azure DevOps mode. Work item discovery is not available in azdo-cli. See docs/azdo-gap.md for details.\n"
|
|
@@ -1794,53 +1799,54 @@ var implementNextCommand = new Command3("implement-next").description("Find the
|
|
|
1794
1799
|
);
|
|
1795
1800
|
process.exit(1);
|
|
1796
1801
|
}
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
`);
|
|
1801
|
-
process.exit(1);
|
|
1802
|
-
}
|
|
1803
|
-
let issues;
|
|
1804
|
-
try {
|
|
1805
|
-
issues = listIssues(config.issueDiscoveryTechnique, config.issueDiscoveryValue, limit);
|
|
1806
|
-
} catch (err) {
|
|
1807
|
-
process.stderr.write(`Error: ${err.message}
|
|
1808
|
-
`);
|
|
1809
|
-
process.exit(1);
|
|
1810
|
-
}
|
|
1802
|
+
}
|
|
1803
|
+
async function resolveIssue(issues, options, limit) {
|
|
1804
|
+
const selectionOutput = options.json ? process.stderr : process.stdout;
|
|
1811
1805
|
if (issues.length === 0) {
|
|
1812
1806
|
process.stdout.write("No issues found matching the configured filter.\n");
|
|
1813
1807
|
process.exit(0);
|
|
1814
1808
|
}
|
|
1815
|
-
let issue;
|
|
1816
1809
|
if (issues.length > 1 && options.queryOnly) {
|
|
1817
|
-
|
|
1818
|
-
for (let i = 0; i < issues.length; i++) {
|
|
1819
|
-
process.stdout.write(` [${i + 1}] #${issues[i].number} - ${issues[i].title}
|
|
1820
|
-
`);
|
|
1821
|
-
}
|
|
1822
|
-
if (issues.length === limit) {
|
|
1823
|
-
process.stdout.write(`(Showing first ${limit} ready issues \u2014 there may be more. Use --limit to fetch more.)
|
|
1824
|
-
`);
|
|
1825
|
-
}
|
|
1810
|
+
writeIssueList(selectionOutput, issues, limit);
|
|
1826
1811
|
process.exit(0);
|
|
1827
1812
|
}
|
|
1813
|
+
let issue;
|
|
1828
1814
|
if (issues.length === 1) {
|
|
1829
1815
|
issue = issues[0];
|
|
1830
|
-
|
|
1816
|
+
selectionOutput.write(`Issue: #${issue.number}
|
|
1831
1817
|
Title: ${issue.title}
|
|
1832
1818
|
`);
|
|
1833
1819
|
} else if (options.takeFirst) {
|
|
1834
1820
|
issue = issues[0];
|
|
1835
|
-
|
|
1821
|
+
selectionOutput.write(`Selecting issue #${issue.number}: ${issue.title}
|
|
1836
1822
|
`);
|
|
1837
1823
|
} else {
|
|
1838
|
-
issue = await promptSelection(issues, limit);
|
|
1839
|
-
|
|
1824
|
+
issue = await promptSelection(issues, limit, selectionOutput);
|
|
1825
|
+
selectionOutput.write(`
|
|
1840
1826
|
Issue: #${issue.number}
|
|
1841
1827
|
Title: ${issue.title}
|
|
1842
1828
|
`);
|
|
1843
1829
|
}
|
|
1830
|
+
return issue;
|
|
1831
|
+
}
|
|
1832
|
+
var implementNextCommand = new Command3("implement-next").description("Find the next open GitHub issue matching the configured filter, claim it, and invoke the AI code assistant (Claude or Codex)").option("--json", "Output issue details as JSON").option("--no-claude", "Skip all AI invocation (Claude or Codex) after claiming the issue").option("--codex", "Use Codex CLI instead of Claude Code").option("--query-only", "Print issue content and exit without claiming or invoking any AI tools").option("--yolo", "Launch with --dangerously-skip-permissions (Claude) or --dangerously-bypass-approvals-and-sandbox (Codex)").option("--verbose", "Show step-by-step progress summary and final result").option("--opus", "Use claude-opus-4-6").option("--sonnet", "Use claude-sonnet-4-6").option("--haiku", "Use claude-haiku-4-5-20251001").option("--take-first", "When multiple issues match, pick the first without prompting").option("--limit <n>", "Max issues to fetch and display (default: 10)", "10").action(async (options) => {
|
|
1833
|
+
const config = readConfig();
|
|
1834
|
+
validateConfig(config);
|
|
1835
|
+
const limit = Number.parseInt(options.limit, 10);
|
|
1836
|
+
if (Number.isNaN(limit) || limit <= 0) {
|
|
1837
|
+
process.stderr.write(`Error: --limit must be a positive integer (got "${options.limit}").
|
|
1838
|
+
`);
|
|
1839
|
+
process.exit(1);
|
|
1840
|
+
}
|
|
1841
|
+
let issues;
|
|
1842
|
+
try {
|
|
1843
|
+
issues = listIssues(config.issueDiscoveryTechnique, config.issueDiscoveryValue, limit);
|
|
1844
|
+
} catch (err) {
|
|
1845
|
+
process.stderr.write(`Error: ${err.message}
|
|
1846
|
+
`);
|
|
1847
|
+
process.exit(1);
|
|
1848
|
+
}
|
|
1849
|
+
const issue = await resolveIssue(issues, options, limit);
|
|
1844
1850
|
if (options.json) {
|
|
1845
1851
|
process.stdout.write(JSON.stringify({ number: issue.number, title: issue.title, body: issue.body, url: issue.url }, null, 2) + "\n");
|
|
1846
1852
|
} else {
|