@ywldan/kiro 0.2.10 → 0.2.11

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
@@ -335,6 +335,7 @@ Slash commands:
335
335
  | `/usage` | Show or hide the Usage card, giving the transcript the full width |
336
336
  | `/skills` | List installed skills, their source, and any skipped entries |
337
337
  | `/skill <name> [request]` | Load a skill, optionally with your request in the same line |
338
+ | `/<skill name> [request]` | Call an installed skill directly, e.g. `/anti-slop rewrite this paragraph` |
338
339
  | `/compact` | Summarize older turns now, keeping the last four user turns verbatim |
339
340
  | `/sessions` | List saved sessions for this working directory |
340
341
  | `/resume <n\|id>` | Resume a session by list number or id (prefixes work) |
@@ -449,6 +450,8 @@ Only the name and description reach the system prompt. Every installed skill is
449
450
 
450
451
  `/skills` lists what was found, whether it came from the project or the user, and any folder that was skipped with the reason (no `SKILL.md`, a `SKILL.md` sitting loose in the skills root, a missing description, a duplicate name, an oversized file). `/skill anti-slop` loads a skill for your next message; `/skill anti-slop rewrite this paragraph` loads it and sends the request in the same turn. Either way the transcript keeps the compact command line you typed while the model receives the full instructions. The first time the model pulls a skill that came from the repository you are in, Kiro says so once in the transcript.
451
452
 
453
+ Every installed skill is also a slash command: `/anti-slop rewrite this paragraph` is the same turn as `/skill anti-slop rewrite this paragraph`. Skill names appear in the `/` menu (filtered as you type, `↑`/`↓` to choose, `Tab` to complete) labelled `skill · <description>`, and `/help` mentions the form rather than listing every skill. Built-in commands win a name clash, so a skill called `model` is reachable only as `/skill model` and `/skills` flags it. The command list refreshes after every turn, so a skill you add mid-session appears without a restart.
454
+
452
455
  The index is rebuilt every turn, so edits to `SKILL.md` apply on the next message. Set `KIRO_SKILLS_DIR` to replace both user roots, and `--no-skills` or `KIRO_NO_SKILLS=1` (which can live in `~/.kiro/.env`) to skip skill folders entirely.
453
456
 
454
457
  ## How it works
@@ -485,7 +488,7 @@ The suite covers streaming, multiple tool calls per response, approvals and deni
485
488
 
486
489
  Model workflow tests use a temp `$HOME` so the real `~/.kiro` is never touched. They cover atomic config saves that preserve unknown fields, profile-name and URL validation, corrupt-config backup/recovery, `.env` parsing and real-environment precedence, `0600` writes, masking, the exact preset list, discovery success/401/missing-`/models`/timeout, the connection test, and wizard add/edit/select/remove/last-profile refusal/cancel/manual-model fallback. Scripted `kiro model add`, `list`, `use`, `test`, and `remove` run through the real CLI against the in-process mock; a failed test saves nothing, keys never appear in `config.json`, and generated keys land in `.env`. The wizard screen renderer is unit-tested against a fake stream: alternate-screen enter/leave, a new menu replacing the previous one, the breadcrumb of answered prompts (menu title instead of `Choose`, the value kept by pressing Enter, confirmation of a `Y/n` default, and the reset on Escape or a return to the root menu), stale errors dropped at a step change, log trimming to the terminal height with the prompt always visible, keyboard scrolling of an over-long list (page, top, bottom, clamping, reset on new output), and replaying results after the screen is restored. `/model` groups profiles by endpoint so several models behind one base URL are listed as siblings.
487
490
 
488
- The newer paths have their own coverage: `max_completion_tokens` selection for reasoning models and recovery from a `max_tokens` rejection, `reasoning_content` deltas reaching the agent and collapsing in the renderer, the stream idle timeout, checkpoint edit/create undo with backup files outside the manifest, and prompt-history dedupe/capping/redaction. Skills are covered from the file to the model: frontmatter with quoted and continued values, CRLF input, `.kiro` overriding `.claude`, symlinked and nested skill folders, skipped folders reported with their reason, an index that keeps every name while clipping descriptions, an invocation message that carries the user's request, `--no-skills`, and the read-only `read_skill` tool. A spawned `kiro -p` test runs a tool with `--yolo`, checks the reply and saved session, feeds a piped prompt through `-p -`, and verifies the non-TTY hint without `-p`.
491
+ The newer paths have their own coverage: `max_completion_tokens` selection for reasoning models and recovery from a `max_tokens` rejection, `reasoning_content` deltas reaching the agent and collapsing in the renderer, the stream idle timeout, checkpoint edit/create undo with backup files outside the manifest, and prompt-history dedupe/capping/redaction. Skills are covered from the file to the model: frontmatter with quoted and continued values, CRLF input, `.kiro` overriding `.claude`, symlinked and nested skill folders, skipped folders reported with their reason, an index that keeps every name while clipping descriptions, an invocation message that carries the user's request, skill names becoming slash commands with built-in clashes, `--no-skills`, and the read-only `read_skill` tool. A spawned `kiro -p` test runs a tool with `--yolo`, checks the reply and saved session, feeds a piped prompt through `-p -`, and verifies the non-TTY hint without `-p`.
489
492
 
490
493
  ## Project layout
491
494
 
@@ -364,10 +364,11 @@ export function skillInvocationMessage(skill, request = '') {
364
364
  }
365
365
  return `Use the "${skill.name}" skill. Its instructions follow; apply them to what I ask next.\n\n${body}`;
366
366
  }
367
- export function formatSkillList(inventory, cwd) {
367
+ export function formatSkillList(inventory, cwd, reserved = []) {
368
368
  if (inventory.disabled) {
369
369
  return 'Skills are disabled for this run (--no-skills or KIRO_NO_SKILLS).';
370
370
  }
371
+ const taken = new Set(reserved);
371
372
  const lines = [];
372
373
  if (inventory.skills.length === 0) {
373
374
  lines.push('No skills installed.');
@@ -381,8 +382,10 @@ export function formatSkillList(inventory, cwd) {
381
382
  lines.push(`Installed skills (${counts}):`);
382
383
  const width = Math.min(28, Math.max(...inventory.skills.map((skill) => skill.name.length)));
383
384
  for (const skill of inventory.skills) {
385
+ const shadowed = taken.has(skill.name.toLowerCase());
384
386
  lines.push(` ${skill.name.padEnd(width)} ${clipDescription(skill.description, 80)} ` +
385
- `[${skill.source}] (${shortPath(skill.dir, cwd)})`);
387
+ `[${skill.source}] (${shortPath(skill.dir, cwd)})` +
388
+ (shadowed ? ` · /${skill.name} is a built-in, use /skill ${skill.name}` : ''));
386
389
  }
387
390
  }
388
391
  lines.push('', `Looked in: ${inventory.roots.map((root) => shortPath(root, cwd)).join(', ')}`);
package/dist/ui/App.js CHANGED
@@ -15,7 +15,7 @@ import { createProvider } from '../providers/index.js';
15
15
  import { dropIncompleteToolCalls, formatSessionTime, isSessionId, listSessions, loadSession, newSessionId, projectSessionsDir, saveSession, titleFromMessages, } from '../sessions.js';
16
16
  import { ApprovalPrompt } from './ApprovalPrompt.js';
17
17
  import { ApprovalPolicy } from './approval-policy.js';
18
- import { slashHelpLines } from './commands.js';
18
+ import { builtinCommandNames, buildSkillCommands, SLASH_COMMANDS, slashHelpLines, } from './commands.js';
19
19
  import { defaultExportPath, renderTranscriptMarkdown } from './export.js';
20
20
  import { buildResumedView } from './history.js';
21
21
  import { Input } from './Input.js';
@@ -472,6 +472,14 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
472
472
  approvalPolicy.clear();
473
473
  setAutoAllowed([]);
474
474
  }, [approvalPolicy]);
475
+ const [skillCommands, setSkillCommands] = useState([]);
476
+ const refreshSkillCommands = useCallback(async () => {
477
+ const inventory = await loadSkills(cwd);
478
+ setSkillCommands(buildSkillCommands(inventory.skills));
479
+ }, [cwd]);
480
+ useEffect(() => {
481
+ void refreshSkillCommands();
482
+ }, [refreshSkillCommands]);
475
483
  /** Mentions once per run when the model pulls instructions that came from the repo. */
476
484
  const noteProjectSkill = useCallback(async (rawArguments) => {
477
485
  let name;
@@ -676,6 +684,7 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
676
684
  resolveApproval('deny');
677
685
  recomputeContext();
678
686
  void persistSession();
687
+ void refreshSkillCommands();
679
688
  if (!quittingRef.current) {
680
689
  if (cancelRequestedRef.current && queuedRef.current.length > 0) {
681
690
  queuedRef.current = [];
@@ -695,6 +704,7 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
695
704
  flushText,
696
705
  noteProjectSkill,
697
706
  persistSession,
707
+ refreshSkillCommands,
698
708
  profileName,
699
709
  queueText,
700
710
  recomputeContext,
@@ -787,11 +797,13 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
787
797
  return;
788
798
  const [command, ...rest] = input.trim().split(/\s+/);
789
799
  const argument = rest[0];
800
+ if (!command)
801
+ return;
790
802
  switch (command) {
791
803
  case '/help': {
792
804
  addNotice('info', [
793
805
  'Commands (type / to open the menu, ↑↓ to choose, Enter to run):',
794
- ...slashHelpLines(),
806
+ ...slashHelpLines(skillCommands.length),
795
807
  '',
796
808
  ' Model subcommands: /model <name> · /model add · /model edit [name] ·',
797
809
  ' /model remove [name] · /model test [name] · /model list --remote',
@@ -902,7 +914,7 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
902
914
  return;
903
915
  }
904
916
  const inventory = await loadSkills(cwd);
905
- addNotice(inventory.skills.length === 0 && inventory.invalid.length === 0 ? 'muted' : 'info', formatSkillList(inventory, cwd));
917
+ addNotice(inventory.skills.length === 0 && inventory.invalid.length === 0 ? 'muted' : 'info', formatSkillList(inventory, cwd, builtinCommandNames()));
906
918
  return;
907
919
  }
908
920
  case '/skill': {
@@ -1182,8 +1194,19 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
1182
1194
  case '/exit':
1183
1195
  quit();
1184
1196
  return;
1185
- default:
1197
+ default: {
1198
+ const skillName = command.startsWith('/') ? command.slice(1) : '';
1199
+ if (skillName) {
1200
+ const inventory = await loadSkills(cwd);
1201
+ const skill = findSkill(inventory.skills, skillName);
1202
+ if (skill) {
1203
+ const line = input.trim();
1204
+ void sendTurn(skillInvocationMessage(skill, line.slice(command.length).trim()), false, line);
1205
+ return;
1206
+ }
1207
+ }
1186
1208
  addNotice('error', `Unknown command "${command}". Type /help for commands.`);
1209
+ }
1187
1210
  }
1188
1211
  }, [
1189
1212
  addNotice,
@@ -1350,7 +1373,7 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
1350
1373
  const viewportHeight = Math.max(3, rows - 5 - (pendingApproval ? 12 : 0) - (pickerInline ? PICKER_INLINE_ROWS : 0));
1351
1374
  const showUsageCard = usageCardEnabled && shouldShowUsageCard(columns, viewportHeight);
1352
1375
  const chatWidth = showUsageCard ? Math.max(40, width - USAGE_CARD_WIDTH - USAGE_CARD_GAP) : width;
1353
- return (_jsxs(Box, { flexDirection: "column", width: columns, paddingX: 1, children: [_jsxs(Box, { flexDirection: "row", alignItems: "flex-end", width: width, children: [_jsx(MessageList, { items: items, width: chatWidth, height: viewportHeight, resetSignal: resetSignal, expandedToolId: expandedToolId, palette: palette, interactive: !pendingApproval && !pickerOpen && !wizardActive && wizardPrompt === null }), showUsageCard ? (_jsx(Box, { marginLeft: USAGE_CARD_GAP, flexShrink: 0, children: _jsx(UsageCard, { usage: sessionUsage, contextTokens: contextTokens, contextWindow: contextWindow, contextEstimated: usageRef.current === null, lastReply: lastReply, busy: busy }) })) : null] }), pendingApproval ? (_jsx(ApprovalPrompt, { request: pendingApproval, width: width, onDecision: resolveApproval })) : pickerInline ? (_jsx(ModelPicker, { config: runtimeConfig, activeProfile: profileName, width: width, onSelect: (name, model) => void selectModel(name, model), onRefresh: refreshProfileModels, onCancel: () => setPickerOpen(false) })) : (_jsx(Input, { disabled: pickerOpen, width: width, mask: wizardPrompt?.mask, allowEmpty: wizardPrompt?.allowEmpty, history: wizardPrompt || wizardActive ? undefined : promptHistory, onPaletteChange: setPalette, placeholder: pickerOpen
1376
+ return (_jsxs(Box, { flexDirection: "column", width: columns, paddingX: 1, children: [_jsxs(Box, { flexDirection: "row", alignItems: "flex-end", width: width, children: [_jsx(MessageList, { items: items, width: chatWidth, height: viewportHeight, resetSignal: resetSignal, expandedToolId: expandedToolId, palette: palette, interactive: !pendingApproval && !pickerOpen && !wizardActive && wizardPrompt === null }), showUsageCard ? (_jsx(Box, { marginLeft: USAGE_CARD_GAP, flexShrink: 0, children: _jsx(UsageCard, { usage: sessionUsage, contextTokens: contextTokens, contextWindow: contextWindow, contextEstimated: usageRef.current === null, lastReply: lastReply, busy: busy }) })) : null] }), pendingApproval ? (_jsx(ApprovalPrompt, { request: pendingApproval, width: width, onDecision: resolveApproval })) : pickerInline ? (_jsx(ModelPicker, { config: runtimeConfig, activeProfile: profileName, width: width, onSelect: (name, model) => void selectModel(name, model), onRefresh: refreshProfileModels, onCancel: () => setPickerOpen(false) })) : (_jsx(Input, { disabled: pickerOpen, width: width, mask: wizardPrompt?.mask, allowEmpty: wizardPrompt?.allowEmpty, history: wizardPrompt || wizardActive ? undefined : promptHistory, slashCommands: [...SLASH_COMMANDS, ...skillCommands], onPaletteChange: setPalette, placeholder: pickerOpen
1354
1377
  ? 'Model picker open · Esc to close'
1355
1378
  : wizardPrompt
1356
1379
  ? wizardPrompt.defaultValue && !wizardPrompt.mask
package/dist/ui/Input.js CHANGED
@@ -7,7 +7,7 @@ import { isMouseSequence } from './mouse.js';
7
7
  import { applyInputOps, parseEditSequence, parseInputChunk, } from './text.js';
8
8
  const MAX_INPUT_CHARS = 20_000;
9
9
  const MAX_MENU_ROWS = 6;
10
- export function Input({ disabled, placeholder, width, mask = false, allowEmpty = false, slashMenu = true, history, onSubmit, onCancel, onPaletteChange, }) {
10
+ export function Input({ disabled, placeholder, width, mask = false, allowEmpty = false, slashMenu = true, slashCommands, history, onSubmit, onCancel, onPaletteChange, }) {
11
11
  const { stdin } = useStdin();
12
12
  const [state, setState] = useState({ chars: [], cursor: 0 });
13
13
  const [selected, setSelected] = useState(0);
@@ -22,7 +22,7 @@ export function Input({ disabled, placeholder, width, mask = false, allowEmpty =
22
22
  setHistoryIndex(null);
23
23
  }
24
24
  }, [historyIndex, recalled, text]);
25
- const matches = slashMenu && !mask && !disabled ? filterSlashCommands(text) : [];
25
+ const matches = slashMenu && !mask && !disabled ? filterSlashCommands(text, slashCommands) : [];
26
26
  const menuOpen = matches.length > 0;
27
27
  const activeIndex = Math.min(selected, Math.max(0, matches.length - 1));
28
28
  const menuStart = Math.max(0, Math.min(activeIndex - Math.floor(MAX_MENU_ROWS / 2), matches.length - MAX_MENU_ROWS));
@@ -2,7 +2,7 @@ export const SLASH_COMMANDS = [
2
2
  { name: '/help', description: 'show this help' },
3
3
  { name: '/model', usage: '[name | add | edit | remove | test | list]', description: 'list or switch models' },
4
4
  { name: '/skills', description: 'list installed skills and where they were found' },
5
- { name: '/skill', usage: '<name>', description: 'load a skill and apply it to your next request' },
5
+ { name: '/skill', usage: '<name> [request]', description: 'load a skill and apply it to your next request' },
6
6
  { name: '/context', description: 'show approximate context usage' },
7
7
  { name: '/usage', description: 'show or hide the usage card' },
8
8
  { name: '/compact', description: 'summarize older turns to free context' },
@@ -15,20 +15,48 @@ export const SLASH_COMMANDS = [
15
15
  { name: '/allow', usage: '[clear]', description: 'manage tools that skip approval' },
16
16
  { name: '/exit', description: 'quit Kiro' },
17
17
  ];
18
+ /** A skill called `/model` would be unreachable, so built-in names are claimed. */
19
+ export function builtinCommandNames() {
20
+ return SLASH_COMMANDS.map((command) => command.name.slice(1).toLowerCase());
21
+ }
22
+ function shorten(text, max) {
23
+ return text.length > max ? `${text.slice(0, max - 1)}…` : text;
24
+ }
25
+ /** Skills become slash commands: `/anti-slop rewrite this`. Built-ins win a clash. */
26
+ export function buildSkillCommands(skills, reserved = builtinCommandNames()) {
27
+ const taken = new Set(reserved);
28
+ const seen = new Set();
29
+ const commands = [];
30
+ for (const skill of skills) {
31
+ const key = skill.name.toLowerCase();
32
+ if (taken.has(key) || seen.has(key))
33
+ continue;
34
+ seen.add(key);
35
+ commands.push({ name: `/${skill.name}`, description: `skill · ${shorten(skill.description, 60)}` });
36
+ }
37
+ return commands;
38
+ }
18
39
  /** Matches only while the user is still typing the command name, before any space. */
19
- export function filterSlashCommands(query) {
40
+ export function filterSlashCommands(query, commands = SLASH_COMMANDS) {
20
41
  const text = query.trimStart();
21
42
  if (!text.startsWith('/') || /\s/.test(text))
22
43
  return [];
23
44
  const needle = text.toLowerCase();
24
- return SLASH_COMMANDS.filter((command) => command.name.startsWith(needle));
45
+ return commands.filter((command) => command.name.toLowerCase().startsWith(needle));
25
46
  }
26
47
  export function slashCommandLabel(command) {
27
48
  return command.usage ? `${command.name} ${command.usage}` : command.name;
28
49
  }
29
- export function slashHelpLines() {
50
+ export function slashHelpLines(skillCount = 0) {
30
51
  const labels = SLASH_COMMANDS.map((command) => ` ${slashCommandLabel(command)}`);
52
+ if (skillCount > 0) {
53
+ labels.push(` /<skill> [request]`);
54
+ }
31
55
  const width = Math.max(...labels.map((label) => label.length)) + 2;
32
- return SLASH_COMMANDS.map((command, index) => `${labels[index].padEnd(width)}${command.description}`);
56
+ const lines = SLASH_COMMANDS.map((command, index) => `${labels[index].padEnd(width)}${command.description}`);
57
+ if (skillCount > 0) {
58
+ lines.push(`${labels[labels.length - 1].padEnd(width)}run one of your ${skillCount} installed skill${skillCount === 1 ? '' : 's'}`);
59
+ }
60
+ return lines;
33
61
  }
34
62
  //# sourceMappingURL=commands.js.map
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.2.10';
1
+ export const VERSION = '0.2.11';
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.10",
3
+ "version": "0.2.11",
4
4
  "description": "A small terminal coding agent with your own OpenAI-compatible endpoint",
5
5
  "keywords": [
6
6
  "ai",