automata-cli 0.1.0-013-implement-next-selection.118 → 0.1.0-013-implement-next-selection.120

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.
Files changed (2) hide show
  1. package/dist/index.js +26 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1766,16 +1766,15 @@ async function promptSelection(issues, limit) {
1766
1766
  Select issue (1-${issues.length}): `, resolve3)
1767
1767
  );
1768
1768
  rl.close();
1769
- const n = parseInt(answer.trim(), 10);
1770
- if (isNaN(n) || n < 1 || n > issues.length) {
1769
+ const n = Number.parseInt(answer.trim(), 10);
1770
+ if (Number.isNaN(n) || n < 1 || n > issues.length) {
1771
1771
  process.stderr.write(`Error: Invalid selection "${answer.trim()}". Enter a number between 1 and ${issues.length}.
1772
1772
  `);
1773
1773
  process.exit(1);
1774
1774
  }
1775
1775
  return issues[n - 1];
1776
1776
  }
1777
- 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) => {
1778
- const config = readConfig();
1777
+ function validateConfig(config) {
1779
1778
  if (config.remoteType !== "gh") {
1780
1779
  process.stderr.write(
1781
1780
  "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,25 +1793,12 @@ var implementNextCommand = new Command3("implement-next").description("Find the
1794
1793
  );
1795
1794
  process.exit(1);
1796
1795
  }
1797
- const limit = parseInt(options.limit, 10);
1798
- if (isNaN(limit) || limit <= 0) {
1799
- process.stderr.write(`Error: --limit must be a positive integer (got "${options.limit}").
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
- }
1796
+ }
1797
+ async function resolveIssue(issues, options, limit) {
1811
1798
  if (issues.length === 0) {
1812
1799
  process.stdout.write("No issues found matching the configured filter.\n");
1813
1800
  process.exit(0);
1814
1801
  }
1815
- let issue;
1816
1802
  if (issues.length > 1 && options.queryOnly) {
1817
1803
  process.stdout.write("\nAvailable issues:\n");
1818
1804
  for (let i = 0; i < issues.length; i++) {
@@ -1825,6 +1811,7 @@ var implementNextCommand = new Command3("implement-next").description("Find the
1825
1811
  }
1826
1812
  process.exit(0);
1827
1813
  }
1814
+ let issue;
1828
1815
  if (issues.length === 1) {
1829
1816
  issue = issues[0];
1830
1817
  process.stdout.write(`Issue: #${issue.number}
@@ -1841,6 +1828,26 @@ Issue: #${issue.number}
1841
1828
  Title: ${issue.title}
1842
1829
  `);
1843
1830
  }
1831
+ return issue;
1832
+ }
1833
+ 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) => {
1834
+ const config = readConfig();
1835
+ validateConfig(config);
1836
+ const limit = Number.parseInt(options.limit, 10);
1837
+ if (Number.isNaN(limit) || limit <= 0) {
1838
+ process.stderr.write(`Error: --limit must be a positive integer (got "${options.limit}").
1839
+ `);
1840
+ process.exit(1);
1841
+ }
1842
+ let issues;
1843
+ try {
1844
+ issues = listIssues(config.issueDiscoveryTechnique, config.issueDiscoveryValue, limit);
1845
+ } catch (err) {
1846
+ process.stderr.write(`Error: ${err.message}
1847
+ `);
1848
+ process.exit(1);
1849
+ }
1850
+ const issue = await resolveIssue(issues, options, limit);
1844
1851
  if (options.json) {
1845
1852
  process.stdout.write(JSON.stringify({ number: issue.number, title: issue.title, body: issue.body, url: issue.url }, null, 2) + "\n");
1846
1853
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "automata-cli",
3
- "version": "0.1.0-013-implement-next-selection.118",
3
+ "version": "0.1.0-013-implement-next-selection.120",
4
4
  "description": "Automata CLI tool",
5
5
  "type": "module",
6
6
  "bin": {