@ywldan/kiro 0.2.6 → 0.2.8

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/README.md CHANGED
@@ -129,6 +129,15 @@ Key handling for `kiro model add`:
129
129
  - `--api-key-env <VAR>` with no key stores nothing; it references the variable, which must already be set in the environment or in `~/.kiro/.env`.
130
130
  - Omitting both creates a profile with no key, suitable for local servers.
131
131
 
132
+ ### Staying up to date
133
+
134
+ ```bash
135
+ kiro check # installed version vs the latest on npm
136
+ kiro update # npm install -g @ywldan/kiro@latest
137
+ ```
138
+
139
+ `check` exits `0` when current, `1` when an update is available, `2` when the registry cannot be reached. `update` shows the npm output and needs the same permissions as a global npm install.
140
+
132
141
  ### Where keys live
133
142
 
134
143
  The config file contains only `apiKeyEnv`, the *name* of a variable. Values live in the environment or in `~/.kiro/.env`:
@@ -241,6 +250,9 @@ kiro [options]
241
250
  --no-alt-screen Do not switch to the terminal's alternate screen
242
251
  -h, --help Show help
243
252
  -v, --version Show version
253
+
254
+ kiro check Compare the installed version with the latest on npm
255
+ kiro update Install the latest version from npm globally
244
256
  ```
245
257
 
246
258
  `--flag=value` works as well. CLI overrides last for the current process only.
@@ -268,7 +280,7 @@ Exit codes: `0` success, `1` model/tool/session error, `2` usage error (includin
268
280
  | Key | Action |
269
281
  | --- | --- |
270
282
  | `Enter` | Send the prompt, or run the highlighted `/` command |
271
- | `Ctrl+C` | Cancel the running turn; press again to exit |
283
+ | `Ctrl+C` | Press twice to exit; while a turn runs, the first press cancels it |
272
284
  | `PgUp` / `PgDn` | Scroll the history (the wheel works too, unless you pass `--no-mouse`) |
273
285
  | `Ctrl+O` | Expand or collapse the full output of the most recent tool call |
274
286
  | `↑` / `↓` | Move through the `/` command menu; with an empty input, recall prompt history |
@@ -280,10 +292,12 @@ Exit codes: `0` success, `1` model/tool/session error, `2` usage error (includin
280
292
  | `Ctrl+W` | Delete the previous word |
281
293
  | Left / Right / Home / End | Move the cursor |
282
294
 
283
- The status bar shows the active profile and model, the working directory, the context meter (`ctx 42k/128k`), the number of queued messages, and the current state (`ready`, `thinking…`, `replying…`, `running <tool>…`, `approval needed`, `cancelling…`) with a spinner and the elapsed seconds for the current turn (`replying… · 12s`). A long profile name is shortened in the middle, so the model and directory stay readable. On a wide terminal the context meter moves into the Usage card described below, leaving more room for the profile and path.
295
+ The status bar shows the active profile and model, the working directory, the context meter (`ctx 42k/128k`), the number of queued messages, and the current state (`ready`, `thinking…`, `replying…`, `running <tool>…`, `approval needed`, `cancelling…`, `Ctrl+C again to quit`) with a spinner and the elapsed seconds for the current turn (`replying… · 12s`). A long profile name is shortened in the middle, so the model and directory stay readable. On a wide terminal the context meter moves into the Usage card described below, leaving more room for the profile and path.
284
296
 
285
297
  The input stays enabled while the agent works: type the next prompt and press Enter to queue it, and it runs as soon as the current turn ends. Queued prompts appear in the transcript right away, the status bar shows `N queued`, and Ctrl+C clears the queue together with the running turn. Slash commands typed while busy are queued the same way.
286
298
 
299
+ Pressing Ctrl+C while idle does not exit immediately: the status bar shows `Ctrl+C again to quit` for two seconds, and a second press within that window leaves. This makes an accidental Ctrl+C harmless. `/exit` still quits right away, and a running turn is cancelled by the first press.
300
+
287
301
  Prompt history is stored per working directory in `~/.kiro/history/` (mode `0600`, up to 200 entries). With an empty input, `↑` recalls the most recent prompt, `↓` walks forward again, and editing the recalled text leaves history mode. Registered API-key values are redacted before a prompt is written. Set `KIRO_HISTORY_DIR` to store the files elsewhere.
288
302
 
289
303
  Reasoning models stream their thinking traces live as a dim `thinking…` block. Once the visible answer starts, the trace collapses to a single `reasoning (done, not saved)` line: traces are display-only and are never written to sessions or `/export`. While the model is producing text the status bar switches from `thinking…` to `replying…`; tool execution shows `running <tool>…`.
@@ -298,7 +312,7 @@ Typing `/` opens a command palette. It is drawn over the bottom of the transcrip
298
312
 
299
313
  `/model` opens its picker as a centered overlay: the transcript, Usage card, and input row keep their places, and the input stays visible but disabled while the picker has focus. The list uses the frame's full height and reports hidden entries (`↑ 5 more · 6-15 of 30 · ↓ 15 more`) so long model lists are never silently cut off. On terminals narrower than 60 columns or shorter than 18 rows it falls back to the inline panel, which temporarily gives up transcript rows.
300
314
 
301
- On a real TTY, `kiro` switches to the terminal's alternate screen: you get a clean page instead of the TUI drawing underneath the command you just ran. When Kiro exits — `/exit`, `Ctrl+C`, or an error — the terminal restores the previous shell contents and prompt. Redirected output (pipes, CI logs) is left untouched. Pass `--no-alt-screen` to stay on the normal screen instead.
315
+ On a real TTY, `kiro` switches to the terminal's alternate screen: you get a clean page instead of the TUI drawing underneath the command you just ran. When Kiro exits — `/exit`, `Ctrl+C` twice, or an error — the terminal restores the previous shell contents and prompt. Redirected output (pipes, CI logs) is left untouched. Pass `--no-alt-screen` to stay on the normal screen instead.
302
316
 
303
317
  Mouse reporting is **on by default**, so the wheel scrolls the transcript. The cost is that the terminal hands clicks to Kiro instead of starting a text selection: to copy text, hold Shift while dragging (or your terminal's equivalent), or run `/mouse` — or start with `--no-mouse` — to get plain click-drag selection back, scrolling with `PgUp`/`PgDn` instead. `/mouse` toggles it at any time.
304
318
 
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ import { registerSecretEnv } from './secrets.js';
10
10
  import { latestSession, loadSession } from './sessions.js';
11
11
  import { MOUSE_OFF } from './ui/mouse.js';
12
12
  import { App } from './ui/App.js';
13
+ import { runCheck, runUpdate } from './update.js';
13
14
  import { VERSION } from './version.js';
14
15
  const HELP = `Kiro — a small terminal coding agent
15
16
 
@@ -42,6 +43,10 @@ Model commands:
42
43
  kiro model remove <n>
43
44
  kiro model test [n]
44
45
 
46
+ Update commands:
47
+ kiro check Compare the installed version with the latest on npm
48
+ kiro update Install the latest version from npm globally
49
+
45
50
  Config: ~/.kiro/config.json (created with a template on first run)
46
51
  Keys: ~/.kiro/.env (mode 0600), or the environment variable named by "apiKeyEnv".
47
52
  Sessions: ~/.kiro/sessions (one directory per working directory)
@@ -180,6 +185,14 @@ async function main() {
180
185
  process.exitCode = await runModelCli(rawArgs.slice(1));
181
186
  return;
182
187
  }
188
+ if (rawArgs[0] === 'check') {
189
+ process.exitCode = await runCheck();
190
+ return;
191
+ }
192
+ if (rawArgs[0] === 'update') {
193
+ process.exitCode = await runUpdate();
194
+ return;
195
+ }
183
196
  let options;
184
197
  try {
185
198
  options = parseArgs(rawArgs);
package/dist/ui/App.js CHANGED
@@ -30,6 +30,8 @@ import { UsageCard, USAGE_CARD_GAP, USAGE_CARD_WIDTH, shouldShowUsageCard, } fro
30
30
  import { addUsage, EMPTY_USAGE } from '../usage.js';
31
31
  import { undoLastCheckpoint } from '../tools/checkpoint.js';
32
32
  import { MAX_EXPANDED_TOOL_CHARS, MAX_REASONING_CHARS, } from './types.js';
33
+ /** Idle Ctrl+C must be pressed again within this window to exit. */
34
+ const QUIT_CONFIRM_MS = 2_000;
33
35
  function useTerminalSize() {
34
36
  const { stdout } = useStdout();
35
37
  const read = useCallback(() => ({
@@ -80,6 +82,7 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
80
82
  const [cancelling, setCancelling] = useState(false);
81
83
  const [pendingApproval, setPendingApproval] = useState(null);
82
84
  const [pickerOpen, setPickerOpen] = useState(false);
85
+ const [quitArmed, setQuitArmed] = useState(false);
83
86
  const [palette, setPalette] = useState(null);
84
87
  const [usageCardEnabled, setUsageCardEnabled] = useState(true);
85
88
  const [mouseOn, setMouseOn] = useState(mouseEnabled);
@@ -118,6 +121,8 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
118
121
  const busyRef = useRef(false);
119
122
  const abortRef = useRef(null);
120
123
  const cancelRequestedRef = useRef(false);
124
+ const quitArmedRef = useRef(false);
125
+ const quitTimerRef = useRef(null);
121
126
  const [approvalPolicy] = useState(() => new ApprovalPolicy(yolo));
122
127
  const [autoAllowed, setAutoAllowed] = useState([]);
123
128
  const pendingApprovalRef = useRef(null);
@@ -357,6 +362,35 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
357
362
  exit();
358
363
  })();
359
364
  }, [exit, persistSession]);
365
+ const disarmQuit = useCallback(() => {
366
+ if (quitTimerRef.current !== null) {
367
+ clearTimeout(quitTimerRef.current);
368
+ quitTimerRef.current = null;
369
+ }
370
+ quitArmedRef.current = false;
371
+ setQuitArmed(false);
372
+ }, []);
373
+ const armQuit = useCallback(() => {
374
+ if (quitTimerRef.current !== null)
375
+ clearTimeout(quitTimerRef.current);
376
+ quitArmedRef.current = true;
377
+ setQuitArmed(true);
378
+ quitTimerRef.current = setTimeout(() => {
379
+ quitTimerRef.current = null;
380
+ quitArmedRef.current = false;
381
+ setQuitArmed(false);
382
+ }, QUIT_CONFIRM_MS);
383
+ }, []);
384
+ useEffect(() => {
385
+ return () => {
386
+ if (quitTimerRef.current !== null)
387
+ clearTimeout(quitTimerRef.current);
388
+ };
389
+ }, []);
390
+ useEffect(() => {
391
+ if (busy)
392
+ disarmQuit();
393
+ }, [busy, disarmQuit]);
360
394
  const flushText = useCallback(() => {
361
395
  if (flushTimerRef.current) {
362
396
  clearTimeout(flushTimerRef.current);
@@ -1202,14 +1236,17 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
1202
1236
  if (!(key.ctrl && input === 'c'))
1203
1237
  return;
1204
1238
  if (pickerOpen) {
1239
+ disarmQuit();
1205
1240
  setPickerOpen(false);
1206
1241
  return;
1207
1242
  }
1208
1243
  if (wizardActiveRef.current) {
1244
+ disarmQuit();
1209
1245
  cancelWizard();
1210
1246
  return;
1211
1247
  }
1212
1248
  if (pendingApprovalRef.current) {
1249
+ disarmQuit();
1213
1250
  cancelRequestedRef.current = true;
1214
1251
  setCancelling(true);
1215
1252
  resolveApproval('deny');
@@ -1226,7 +1263,12 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
1226
1263
  abortRef.current?.abort();
1227
1264
  return;
1228
1265
  }
1229
- quit();
1266
+ if (quitArmedRef.current) {
1267
+ disarmQuit();
1268
+ quit();
1269
+ return;
1270
+ }
1271
+ armQuit();
1230
1272
  });
1231
1273
  const activity = pendingApproval
1232
1274
  ? 'approval'
@@ -1256,6 +1298,6 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
1256
1298
  ? 'Kiro is working… type ahead, or Ctrl+C to cancel'
1257
1299
  : wizardActive
1258
1300
  ? 'Working… Esc to cancel'
1259
- : 'Ask Kiro to build or change something…', slashMenu: !wizardActive && !wizardPrompt, onSubmit: handleSubmit, onCancel: wizardActive ? cancelWizard : undefined }, wizardPrompt?.id ?? 0)), _jsx(StatusBar, { width: width, profile: profileName, model: activeProfile?.model ?? 'unknown', cwd: cwd, activity: activity, toolName: activeTool ?? undefined, busySince: busySince ?? undefined, queued: queuedCount > 0 ? queuedCount : undefined, yolo: yolo, autoAllowed: autoAllowed, contextTokens: showUsageCard ? undefined : contextTokens, contextWindow: showUsageCard ? undefined : contextWindow }), pickerOpen && pickerPopup ? (_jsx(Box, { position: "absolute", marginTop: pickerPopup.top, marginLeft: pickerPopup.left, children: _jsx(ModelPicker, { config: runtimeConfig, activeProfile: profileName, width: pickerPopup.width, height: pickerPopup.height, onSelect: (name, model) => void selectModel(name, model), onRefresh: refreshProfileModels, onCancel: () => setPickerOpen(false) }) })) : null] }));
1301
+ : 'Ask Kiro to build or change something…', slashMenu: !wizardActive && !wizardPrompt, onSubmit: handleSubmit, onCancel: wizardActive ? cancelWizard : undefined }, wizardPrompt?.id ?? 0)), _jsx(StatusBar, { width: width, profile: profileName, model: activeProfile?.model ?? 'unknown', cwd: cwd, activity: activity, toolName: activeTool ?? undefined, busySince: busySince ?? undefined, queued: queuedCount > 0 ? queuedCount : undefined, yolo: yolo, autoAllowed: autoAllowed, quitHint: quitArmed, contextTokens: showUsageCard ? undefined : contextTokens, contextWindow: showUsageCard ? undefined : contextWindow }), pickerOpen && pickerPopup ? (_jsx(Box, { position: "absolute", marginTop: pickerPopup.top, marginLeft: pickerPopup.left, children: _jsx(ModelPicker, { config: runtimeConfig, activeProfile: profileName, width: pickerPopup.width, height: pickerPopup.height, onSelect: (name, model) => void selectModel(name, model), onRefresh: refreshProfileModels, onCancel: () => setPickerOpen(false) }) })) : null] }));
1260
1302
  }
1261
1303
  //# sourceMappingURL=App.js.map
@@ -14,7 +14,7 @@ function prettyCwd(cwd) {
14
14
  }
15
15
  return cwd;
16
16
  }
17
- export function StatusBar({ width, profile, model, cwd, activity, toolName, busySince, queued, yolo = false, autoAllowed = [], contextTokens, contextWindow, }) {
17
+ export function StatusBar({ width, profile, model, cwd, activity, toolName, busySince, queued, yolo = false, autoAllowed = [], quitHint = false, contextTokens, contextWindow, }) {
18
18
  const busy = activity !== null;
19
19
  const [frame, setFrame] = useState(0);
20
20
  useEffect(() => {
@@ -23,18 +23,26 @@ export function StatusBar({ width, profile, model, cwd, activity, toolName, busy
23
23
  const interval = setInterval(() => setFrame((current) => (current + 1) % SPINNER.length), 100);
24
24
  return () => clearInterval(interval);
25
25
  }, [busy]);
26
- const stateText = activity === 'approval'
27
- ? 'approval needed'
26
+ const stateText = quitHint
27
+ ? 'Ctrl+C again to quit'
28
+ : activity === 'approval'
29
+ ? 'approval needed'
30
+ : activity === 'cancelling'
31
+ ? 'cancelling…'
32
+ : activity === 'running'
33
+ ? `running ${toolName ?? 'tool'}…`
34
+ : activity === 'replying'
35
+ ? 'replying…'
36
+ : activity === 'thinking'
37
+ ? 'thinking…'
38
+ : 'ready';
39
+ const stateColor = quitHint
40
+ ? 'red'
28
41
  : activity === 'cancelling'
29
- ? 'cancelling…'
30
- : activity === 'running'
31
- ? `running ${toolName ?? 'tool'}…`
32
- : activity === 'replying'
33
- ? 'replying…'
34
- : activity === 'thinking'
35
- ? 'thinking…'
36
- : 'ready';
37
- const stateColor = activity === 'cancelling' ? 'red' : activity === null ? 'green' : 'yellow';
42
+ ? 'red'
43
+ : activity === null
44
+ ? 'green'
45
+ : 'yellow';
38
46
  const spinner = busy ? `${SPINNER[frame] ?? '⠋'} ` : '';
39
47
  const elapsedMs = busy && busySince !== undefined ? Math.max(0, Date.now() - busySince) : 0;
40
48
  // Whole seconds keep the re-rendering spinner from making the timer flicker.
package/dist/update.js ADDED
@@ -0,0 +1,95 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { VERSION } from './version.js';
3
+ const PACKAGE_NAME = '@ywldan/kiro';
4
+ /** npm on Windows is npm.cmd; only .cmd/.bat need a shell when spawning. */
5
+ function npmCommand() {
6
+ if (process.platform === 'win32')
7
+ return { command: 'npm.cmd', shell: true };
8
+ return { command: 'npm', shell: false };
9
+ }
10
+ function runNpm(args, capture) {
11
+ const { command, shell } = npmCommand();
12
+ return new Promise((resolve, reject) => {
13
+ const child = spawn(command, args, {
14
+ stdio: capture ? ['ignore', 'pipe', 'pipe'] : 'inherit',
15
+ shell,
16
+ windowsHide: true,
17
+ });
18
+ let stdout = '';
19
+ if (capture && child.stdout)
20
+ child.stdout.on('data', (chunk) => (stdout += String(chunk)));
21
+ child.on('error', reject);
22
+ child.on('close', (code) => resolve({ code: code ?? 1, stdout }));
23
+ });
24
+ }
25
+ /** Compares dotted numeric versions; returns -1, 0 or 1. Non-numeric parts fall back to string compare. */
26
+ function compareVersions(a, b) {
27
+ if (a === b)
28
+ return 0;
29
+ const left = a.split('.').map(Number);
30
+ const right = b.split('.').map(Number);
31
+ if (left.some(Number.isNaN) || right.some(Number.isNaN))
32
+ return a < b ? -1 : 1;
33
+ const length = Math.max(left.length, right.length);
34
+ for (let index = 0; index < length; index++) {
35
+ const x = left[index] ?? 0;
36
+ const y = right[index] ?? 0;
37
+ if (x !== y)
38
+ return x < y ? -1 : 1;
39
+ }
40
+ return 0;
41
+ }
42
+ async function latestVersion() {
43
+ const { code, stdout } = await runNpm(['view', PACKAGE_NAME, 'version'], true);
44
+ const latest = stdout.trim().split(/\r?\n/).pop() ?? '';
45
+ if (code !== 0 || !/^\d+\.\d+\.\d+/.test(latest)) {
46
+ throw new Error('Could not read the latest version from the npm registry.');
47
+ }
48
+ return latest;
49
+ }
50
+ /** `kiro check` — compare the installed version with the registry. Exit 0 current, 1 update available, 2 check failed. */
51
+ export async function runCheck() {
52
+ let latest;
53
+ try {
54
+ latest = await latestVersion();
55
+ }
56
+ catch (error) {
57
+ console.error(`Kiro ${VERSION} — version check failed: ${error.message}`);
58
+ console.error('Check manually with: npm view @ywldan/kiro version');
59
+ return 2;
60
+ }
61
+ if (compareVersions(VERSION, latest) >= 0) {
62
+ process.stdout.write(`Kiro ${VERSION} — up to date\n`);
63
+ return 0;
64
+ }
65
+ process.stdout.write(`Kiro ${VERSION} → ${latest} available. Run "kiro update" to upgrade.\n`);
66
+ return 1;
67
+ }
68
+ /** `kiro update` — install the latest published version globally through npm. */
69
+ export async function runUpdate() {
70
+ let latest;
71
+ try {
72
+ latest = await latestVersion();
73
+ }
74
+ catch {
75
+ latest = 'latest';
76
+ }
77
+ if (latest !== 'latest' && compareVersions(VERSION, latest) >= 0) {
78
+ process.stdout.write(`Kiro ${VERSION} — already up to date, nothing to do\n`);
79
+ return 0;
80
+ }
81
+ process.stdout.write(`Updating Kiro ${VERSION} → ${latest} via npm…\n`);
82
+ const { command, shell } = npmCommand();
83
+ const result = await runNpm(['install', '-g', `${PACKAGE_NAME}@latest`], false).catch((error) => {
84
+ console.error(`Kiro: could not start "${command}": ${error.message}`);
85
+ return { code: 2, stdout: '' };
86
+ });
87
+ if (result.code !== 0) {
88
+ console.error(`Kiro: npm exited with code ${result.code}. Update manually with:`);
89
+ console.error(` ${command} install -g ${PACKAGE_NAME}@latest`);
90
+ return result.code;
91
+ }
92
+ process.stdout.write(`Kiro updated to ${latest}. Restart kiro to use the new version.\n`);
93
+ return 0;
94
+ }
95
+ //# sourceMappingURL=update.js.map
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.2.6';
1
+ export const VERSION = '0.2.8';
2
2
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ywldan/kiro",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "A small terminal coding agent with your own OpenAI-compatible endpoint",
5
5
  "keywords": [
6
6
  "ai",