automata-cli 0.1.0-013-implement-next-selection.120 → 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.
Files changed (2) hide show
  1. package/dist/index.js +19 -20
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1750,17 +1750,23 @@ function invokeCodexCodeSync(prompt, yolo) {
1750
1750
  }
1751
1751
 
1752
1752
  // src/commands/getReady.ts
1753
- async function promptSelection(issues, limit) {
1754
- process.stdout.write("\nAvailable issues:\n");
1755
- for (let i = 0; i < issues.length; i++) {
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
- if (issues.length === limit) {
1760
- process.stdout.write(`(Showing first ${limit} ready issues \u2014 there may be more. Use --limit to fetch more.)
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
- const rl = createInterface2({ input: process.stdin, output: process.stdout });
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)
@@ -1795,35 +1801,28 @@ function validateConfig(config) {
1795
1801
  }
1796
1802
  }
1797
1803
  async function resolveIssue(issues, options, limit) {
1804
+ const selectionOutput = options.json ? process.stderr : process.stdout;
1798
1805
  if (issues.length === 0) {
1799
1806
  process.stdout.write("No issues found matching the configured filter.\n");
1800
1807
  process.exit(0);
1801
1808
  }
1802
1809
  if (issues.length > 1 && options.queryOnly) {
1803
- process.stdout.write("\nAvailable issues:\n");
1804
- for (let i = 0; i < issues.length; i++) {
1805
- process.stdout.write(` [${i + 1}] #${issues[i].number} - ${issues[i].title}
1806
- `);
1807
- }
1808
- if (issues.length === limit) {
1809
- process.stdout.write(`(Showing first ${limit} ready issues \u2014 there may be more. Use --limit to fetch more.)
1810
- `);
1811
- }
1810
+ writeIssueList(selectionOutput, issues, limit);
1812
1811
  process.exit(0);
1813
1812
  }
1814
1813
  let issue;
1815
1814
  if (issues.length === 1) {
1816
1815
  issue = issues[0];
1817
- process.stdout.write(`Issue: #${issue.number}
1816
+ selectionOutput.write(`Issue: #${issue.number}
1818
1817
  Title: ${issue.title}
1819
1818
  `);
1820
1819
  } else if (options.takeFirst) {
1821
1820
  issue = issues[0];
1822
- process.stdout.write(`Selecting issue #${issue.number}: ${issue.title}
1821
+ selectionOutput.write(`Selecting issue #${issue.number}: ${issue.title}
1823
1822
  `);
1824
1823
  } else {
1825
- issue = await promptSelection(issues, limit);
1826
- process.stdout.write(`
1824
+ issue = await promptSelection(issues, limit, selectionOutput);
1825
+ selectionOutput.write(`
1827
1826
  Issue: #${issue.number}
1828
1827
  Title: ${issue.title}
1829
1828
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "automata-cli",
3
- "version": "0.1.0-013-implement-next-selection.120",
3
+ "version": "0.1.0-013-implement-next-selection.122",
4
4
  "description": "Automata CLI tool",
5
5
  "type": "module",
6
6
  "bin": {