@kurtel/cli 0.1.5 → 0.1.6

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.
@@ -1,12 +1,11 @@
1
1
  import * as readline from "node:readline";
2
2
  import { c, symbols } from "../ui/colors.js";
3
3
  import { banner, welcomeBox } from "../ui/banner.js";
4
- import { Spinner, sleep } from "../ui/spinner.js";
5
4
  import { loadConfig } from "../lib/config.js";
6
5
  import { agentsCommand } from "../commands/agents.js";
7
6
  import { loginCommand } from "../commands/auth.js";
8
7
  import { configCommand } from "../commands/config.js";
9
- import { previewNotice } from "../commands/_shared.js";
8
+ import { runCommand } from "../commands/run.js";
10
9
  const SLASH_COMMANDS = [
11
10
  ["/help", "Show this help"],
12
11
  ["/run <task>", "Launch a cloud agent on a task"],
@@ -29,14 +28,43 @@ function printHelp() {
29
28
  console.log(c.dim("Anything else you type is treated as a task and launches an agent."));
30
29
  console.log("");
31
30
  }
32
- async function launchFromPrompt(task) {
33
- const id = "agent-" + Math.random().toString(16).slice(2, 6);
34
- const spin = new Spinner("Provisioning sandbox & booting agent…").start();
35
- await sleep(700);
36
- spin.update("Planning approach…");
37
- await sleep(700);
38
- spin.succeed(`Queued ${c.indigo(id)} for: ${c.white(task)}`);
39
- previewNotice("Launching agents");
31
+ // While we're collecting answers via rl.question, the main "line" handler must
32
+ // stand down so it doesn't re-interpret the answers as new commands.
33
+ let asking = false;
34
+ function ask(rl, query) {
35
+ return new Promise((resolve) => {
36
+ rl.question(query, (answer) => resolve(answer.trim()));
37
+ });
38
+ }
39
+ // Interactive launch: ask for repo / branch / engine / model (with sensible
40
+ // defaults from local config), then hand off to the real run command.
41
+ async function launchFromPrompt(rl, task) {
42
+ const cfg = loadConfig();
43
+ const defBranch = cfg.defaultBranch || "main";
44
+ const defEngine = cfg.engine || "claude-code";
45
+ let repo = "";
46
+ let branch = defBranch;
47
+ let engine = defEngine;
48
+ let model = "";
49
+ asking = true;
50
+ try {
51
+ console.log("");
52
+ repo = await ask(rl, ` ${c.gray("repo")} ${c.dim("(owner/name, empty for none)")} ${c.indigo(symbols.arrow)} `);
53
+ branch =
54
+ (await ask(rl, ` ${c.gray("branch")} ${c.dim(`(default ${defBranch})`)} ${c.indigo(symbols.arrow)} `)) || defBranch;
55
+ engine =
56
+ (await ask(rl, ` ${c.gray("engine")} ${c.dim(`(default ${defEngine})`)} ${c.indigo(symbols.arrow)} `)) || defEngine;
57
+ model = await ask(rl, ` ${c.gray("model")} ${c.dim("(optional)")} ${c.indigo(symbols.arrow)} `);
58
+ }
59
+ finally {
60
+ asking = false;
61
+ }
62
+ await runCommand(task, {
63
+ repo: repo || undefined,
64
+ branch,
65
+ engine,
66
+ model: model || undefined,
67
+ });
40
68
  }
41
69
  export async function startSession(model) {
42
70
  console.log(banner());
@@ -53,6 +81,9 @@ export async function startSession(model) {
53
81
  });
54
82
  rl.prompt();
55
83
  rl.on("line", async (input) => {
84
+ // Standing down while collecting answers to /run questions.
85
+ if (asking)
86
+ return;
56
87
  const line = input.trim();
57
88
  if (line === "") {
58
89
  rl.prompt();
@@ -92,14 +123,12 @@ export async function startSession(model) {
92
123
  rl.resume();
93
124
  break;
94
125
  case "run":
95
- rl.pause();
96
126
  if (!arg) {
97
127
  console.log(`${c.red(symbols.cross)} Usage: ${c.indigo("/run <task>")}`);
98
128
  }
99
129
  else {
100
- await launchFromPrompt(arg);
130
+ await launchFromPrompt(rl, arg);
101
131
  }
102
- rl.resume();
103
132
  break;
104
133
  default:
105
134
  console.log(`${c.red(symbols.cross)} Unknown command ${c.white("/" + cmd)}. Type ${c.indigo("/help")}.`);
@@ -107,10 +136,8 @@ export async function startSession(model) {
107
136
  rl.prompt();
108
137
  return;
109
138
  }
110
- // Free text -> treat as a task
111
- rl.pause();
112
- await launchFromPrompt(line);
113
- rl.resume();
139
+ // Free text -> treat as a task (interactive launch).
140
+ await launchFromPrompt(rl, line);
114
141
  rl.prompt();
115
142
  });
116
143
  rl.on("close", () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kurtel/cli",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Launch self-improving coding agents in the cloud — the Kurtel CLI.",
5
5
  "type": "module",
6
6
  "bin": {