@ywldan/kiro 0.2.9 → 0.2.10
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 +9 -4
- package/dist/agent/skills.js +180 -70
- package/dist/index.js +9 -0
- package/dist/tools/skill.js +5 -1
- package/dist/ui/App.js +41 -10
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -248,6 +248,7 @@ kiro [options]
|
|
|
248
248
|
--mouse Mouse reporting (on by default): wheel scrolls the transcript
|
|
249
249
|
--no-mouse Disable mouse reporting so plain click-drag selection works
|
|
250
250
|
--no-alt-screen Do not switch to the terminal's alternate screen
|
|
251
|
+
--no-skills Do not read skill folders at all (KIRO_NO_SKILLS=1 does the same)
|
|
251
252
|
-h, --help Show help
|
|
252
253
|
-v, --version Show version
|
|
253
254
|
|
|
@@ -333,7 +334,7 @@ Slash commands:
|
|
|
333
334
|
| `/context` | Show approximate context use by message role plus session token totals |
|
|
334
335
|
| `/usage` | Show or hide the Usage card, giving the transcript the full width |
|
|
335
336
|
| `/skills` | List installed skills, their source, and any skipped entries |
|
|
336
|
-
| `/skill <name
|
|
337
|
+
| `/skill <name> [request]` | Load a skill, optionally with your request in the same line |
|
|
337
338
|
| `/compact` | Summarize older turns now, keeping the last four user turns verbatim |
|
|
338
339
|
| `/sessions` | List saved sessions for this working directory |
|
|
339
340
|
| `/resume <n\|id>` | Resume a session by list number or id (prefixes work) |
|
|
@@ -442,9 +443,13 @@ description: Remove AI-slop patterns from prose before answering.
|
|
|
442
443
|
Delete "delve", "tapestry", and stacked em dashes. Prefer concrete nouns.
|
|
443
444
|
```
|
|
444
445
|
|
|
445
|
-
Only
|
|
446
|
+
Only `name` and `description` are read from the frontmatter; `allowed-tools`, `license`, and any other key are ignored, and a skill can never skip an approval prompt. A folder is a skill when it holds `SKILL.md`, searched two levels deep, so `skills/<name>/SKILL.md` and `skills/<group>/<name>/SKILL.md` both work, and symlinked skill folders are followed (loops are detected). Supporting files inside the folder — references, templates, scripts — are read or run like any other file, so `read_file` and `run_command` rules still apply.
|
|
446
447
|
|
|
447
|
-
|
|
448
|
+
Only the name and description reach the system prompt. Every installed skill is listed by name: up to 30 keep a full description, more than that clip theirs to 60 characters, and an enormous collection falls back to bare names so the prompt always stays bounded. When a request matches, the model calls `read_skill` to load the body, so fifty installed skills cost a few hundred tokens instead of their full text. `read_skill` is read-only: it needs no approval and can run alongside other reads, and it says whether the skill came from the project or your user folder.
|
|
449
|
+
|
|
450
|
+
`/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
|
+
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.
|
|
448
453
|
|
|
449
454
|
## How it works
|
|
450
455
|
|
|
@@ -480,7 +485,7 @@ The suite covers streaming, multiple tool calls per response, approvals and deni
|
|
|
480
485
|
|
|
481
486
|
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.
|
|
482
487
|
|
|
483
|
-
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`,
|
|
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`.
|
|
484
489
|
|
|
485
490
|
## Project layout
|
|
486
491
|
|
package/dist/agent/skills.js
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
import { readdir, readFile, stat } from 'node:fs/promises';
|
|
1
|
+
import { readdir, readFile, realpath, stat } from 'node:fs/promises';
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
export const MAX_SKILLS_IN_PROMPT = 30;
|
|
5
5
|
export const MAX_SKILL_DESCRIPTION_CHARS = 300;
|
|
6
|
+
export const MAX_SKILL_SHORT_DESCRIPTION_CHARS = 60;
|
|
6
7
|
export const MAX_SKILL_BODY_CHARS = 50_000;
|
|
7
8
|
export const MAX_SKILL_FILE_BYTES = 200_000;
|
|
8
9
|
export const MAX_SKILLS_INDEX_CHARS = 8_000;
|
|
10
|
+
/** Skills are found at <root>/<name>/SKILL.md and <root>/<group>/<name>/SKILL.md. */
|
|
11
|
+
export const MAX_SKILL_DEPTH = 2;
|
|
9
12
|
const MAX_SKILL_NAME_CHARS = 64;
|
|
13
|
+
const MAX_SKILL_DIRS_PER_ROOT = 500;
|
|
10
14
|
const SKILL_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
15
|
+
const SKIP_DIR_NAMES = new Set(['node_modules', '.git']);
|
|
16
|
+
let skillsEnabled = true;
|
|
17
|
+
/** Turned off by --no-skills or KIRO_NO_SKILLS; nothing is read from disk then. */
|
|
18
|
+
export function setSkillsEnabled(enabled) {
|
|
19
|
+
skillsEnabled = enabled;
|
|
20
|
+
}
|
|
21
|
+
export function skillsAreEnabled() {
|
|
22
|
+
return skillsEnabled;
|
|
23
|
+
}
|
|
11
24
|
/** `.claude/skills` is read too, so skills installed for other CLIs work unchanged. */
|
|
12
25
|
export function skillRoots(cwd) {
|
|
13
26
|
const roots = [
|
|
@@ -107,8 +120,24 @@ export function parseSkillFile(raw) {
|
|
|
107
120
|
value: { name: meta.get('name')?.trim() || undefined, description, body },
|
|
108
121
|
};
|
|
109
122
|
}
|
|
110
|
-
async function
|
|
111
|
-
|
|
123
|
+
async function isFile(target) {
|
|
124
|
+
try {
|
|
125
|
+
return (await stat(target)).isFile();
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
async function isDirectory(target) {
|
|
132
|
+
try {
|
|
133
|
+
return (await stat(target)).isDirectory();
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async function readSkillAt(dir, folder) {
|
|
140
|
+
const file = path.join(dir, 'SKILL.md');
|
|
112
141
|
let info;
|
|
113
142
|
try {
|
|
114
143
|
info = await stat(file);
|
|
@@ -117,14 +146,14 @@ async function readSkillDir(root, source, entry) {
|
|
|
117
146
|
const code = error.code;
|
|
118
147
|
if (code === 'ENOENT' || code === 'ENOTDIR')
|
|
119
148
|
return {};
|
|
120
|
-
return { invalid: { name:
|
|
149
|
+
return { invalid: { name: folder, file, reason: error.message } };
|
|
121
150
|
}
|
|
122
151
|
if (!info.isFile())
|
|
123
152
|
return {};
|
|
124
153
|
if (info.size > MAX_SKILL_FILE_BYTES) {
|
|
125
154
|
return {
|
|
126
155
|
invalid: {
|
|
127
|
-
name:
|
|
156
|
+
name: folder,
|
|
128
157
|
file,
|
|
129
158
|
reason: `SKILL.md is larger than ${MAX_SKILL_FILE_BYTES.toLocaleString()} bytes`,
|
|
130
159
|
},
|
|
@@ -135,12 +164,12 @@ async function readSkillDir(root, source, entry) {
|
|
|
135
164
|
raw = await readFile(file, 'utf8');
|
|
136
165
|
}
|
|
137
166
|
catch (error) {
|
|
138
|
-
return { invalid: { name:
|
|
167
|
+
return { invalid: { name: folder, file, reason: error.message } };
|
|
139
168
|
}
|
|
140
169
|
const parsed = parseSkillFile(raw);
|
|
141
170
|
if (!parsed.ok)
|
|
142
|
-
return { invalid: { name:
|
|
143
|
-
const name = parsed.value.name ??
|
|
171
|
+
return { invalid: { name: folder, file, reason: parsed.reason } };
|
|
172
|
+
const name = parsed.value.name ?? folder;
|
|
144
173
|
if (name.length > MAX_SKILL_NAME_CHARS || !SKILL_NAME_PATTERN.test(name)) {
|
|
145
174
|
return {
|
|
146
175
|
invalid: {
|
|
@@ -155,64 +184,126 @@ async function readSkillDir(root, source, entry) {
|
|
|
155
184
|
name,
|
|
156
185
|
description: parsed.value.description,
|
|
157
186
|
body: parsed.value.body,
|
|
158
|
-
dir
|
|
187
|
+
dir,
|
|
159
188
|
file,
|
|
160
189
|
},
|
|
161
190
|
};
|
|
162
191
|
}
|
|
192
|
+
function addSkill(ctx, skill, source) {
|
|
193
|
+
const existing = ctx.byName.get(skill.name.toLowerCase());
|
|
194
|
+
if (existing) {
|
|
195
|
+
ctx.invalid.push({
|
|
196
|
+
name: skill.name,
|
|
197
|
+
file: skill.file,
|
|
198
|
+
source,
|
|
199
|
+
reason: `duplicate name; ${existing.file} already defines it`,
|
|
200
|
+
});
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const complete = { ...skill, source };
|
|
204
|
+
ctx.skills.push(complete);
|
|
205
|
+
ctx.byName.set(skill.name.toLowerCase(), complete);
|
|
206
|
+
}
|
|
207
|
+
/** Returns true when a skill was found at or below dir. */
|
|
208
|
+
async function walk(ctx, dir, depth, source) {
|
|
209
|
+
let resolved;
|
|
210
|
+
try {
|
|
211
|
+
resolved = await realpath(dir);
|
|
212
|
+
}
|
|
213
|
+
catch {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
if (ctx.visited.has(resolved))
|
|
217
|
+
return false;
|
|
218
|
+
ctx.visited.add(resolved);
|
|
219
|
+
if (depth >= 1 && (await isFile(path.join(dir, 'SKILL.md')))) {
|
|
220
|
+
const result = await readSkillAt(dir, path.basename(dir));
|
|
221
|
+
if (result.invalid)
|
|
222
|
+
ctx.invalid.push({ ...result.invalid, source });
|
|
223
|
+
else if (result.skill)
|
|
224
|
+
addSkill(ctx, result.skill, source);
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
if (depth === 0 && (await isFile(path.join(dir, 'SKILL.md')))) {
|
|
228
|
+
ctx.invalid.push({
|
|
229
|
+
name: path.basename(dir),
|
|
230
|
+
file: path.join(dir, 'SKILL.md'),
|
|
231
|
+
source,
|
|
232
|
+
reason: 'SKILL.md must sit in its own folder (<skills>/<name>/SKILL.md)',
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
if (depth >= MAX_SKILL_DEPTH)
|
|
236
|
+
return false;
|
|
237
|
+
let entries;
|
|
238
|
+
try {
|
|
239
|
+
entries = await readdir(dir, { withFileTypes: true });
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
const code = error.code;
|
|
243
|
+
if (depth === 0 && code !== 'ENOENT' && code !== 'ENOTDIR') {
|
|
244
|
+
ctx.invalid.push({
|
|
245
|
+
name: path.basename(dir),
|
|
246
|
+
file: dir,
|
|
247
|
+
source,
|
|
248
|
+
reason: `cannot read the directory: ${error.message}`,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
const names = entries
|
|
254
|
+
.filter((entry) => !entry.name.startsWith('.') &&
|
|
255
|
+
!SKIP_DIR_NAMES.has(entry.name) &&
|
|
256
|
+
(entry.isDirectory() || entry.isSymbolicLink()))
|
|
257
|
+
.map((entry) => entry.name)
|
|
258
|
+
.sort((a, b) => a.localeCompare(b, 'en'));
|
|
259
|
+
let found = false;
|
|
260
|
+
for (const name of names) {
|
|
261
|
+
if (ctx.dirs++ >= MAX_SKILL_DIRS_PER_ROOT) {
|
|
262
|
+
ctx.invalid.push({
|
|
263
|
+
name: path.basename(dir),
|
|
264
|
+
file: dir,
|
|
265
|
+
source,
|
|
266
|
+
reason: `stopped after ${MAX_SKILL_DIRS_PER_ROOT} folders in this skills root`,
|
|
267
|
+
});
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
const child = path.join(dir, name);
|
|
271
|
+
if (!(await isDirectory(child)))
|
|
272
|
+
continue;
|
|
273
|
+
if (await walk(ctx, child, depth + 1, source))
|
|
274
|
+
found = true;
|
|
275
|
+
}
|
|
276
|
+
if (!found && depth >= 1) {
|
|
277
|
+
ctx.invalid.push({
|
|
278
|
+
name: path.basename(dir),
|
|
279
|
+
file: dir,
|
|
280
|
+
source,
|
|
281
|
+
reason: 'no SKILL.md in this folder (or one level deeper)',
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
return found;
|
|
285
|
+
}
|
|
163
286
|
/** Project roots win over user roots; the first definition of a name is kept. */
|
|
164
287
|
export async function loadSkills(cwd) {
|
|
165
288
|
const roots = skillRoots(cwd);
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if (code !== 'ENOENT' && code !== 'ENOTDIR') {
|
|
177
|
-
invalid.push({
|
|
178
|
-
name: path.basename(root),
|
|
179
|
-
file: root,
|
|
180
|
-
source,
|
|
181
|
-
reason: `cannot read the directory: ${error.message}`,
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
const names = entries
|
|
187
|
-
.filter((entry) => entry.isDirectory() && !entry.name.startsWith('.'))
|
|
188
|
-
.map((entry) => entry.name)
|
|
189
|
-
.sort((a, b) => a.localeCompare(b, 'en'));
|
|
190
|
-
for (const entryName of names) {
|
|
191
|
-
const result = await readSkillDir(root, source, entryName);
|
|
192
|
-
if (result.invalid) {
|
|
193
|
-
invalid.push({ ...result.invalid, source });
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
const skill = result.skill;
|
|
197
|
-
if (!skill)
|
|
198
|
-
continue;
|
|
199
|
-
const existing = byName.get(skill.name.toLowerCase());
|
|
200
|
-
if (existing) {
|
|
201
|
-
invalid.push({
|
|
202
|
-
name: skill.name,
|
|
203
|
-
file: skill.file,
|
|
204
|
-
source,
|
|
205
|
-
reason: `duplicate name; ${existing.file} already defines it`,
|
|
206
|
-
});
|
|
207
|
-
continue;
|
|
208
|
-
}
|
|
209
|
-
const complete = { ...skill, source };
|
|
210
|
-
skills.push(complete);
|
|
211
|
-
byName.set(skill.name.toLowerCase(), complete);
|
|
212
|
-
}
|
|
289
|
+
const ctx = {
|
|
290
|
+
skills: [],
|
|
291
|
+
invalid: [],
|
|
292
|
+
byName: new Map(),
|
|
293
|
+
visited: new Set(),
|
|
294
|
+
dirs: 0,
|
|
295
|
+
};
|
|
296
|
+
if (skillsEnabled) {
|
|
297
|
+
for (const { root, source } of roots)
|
|
298
|
+
await walk(ctx, root, 0, source);
|
|
213
299
|
}
|
|
214
|
-
skills.sort((a, b) => a.name.localeCompare(b.name, 'en'));
|
|
215
|
-
return {
|
|
300
|
+
ctx.skills.sort((a, b) => a.name.localeCompare(b.name, 'en'));
|
|
301
|
+
return {
|
|
302
|
+
skills: ctx.skills,
|
|
303
|
+
invalid: ctx.invalid,
|
|
304
|
+
roots: roots.map(({ root }) => root),
|
|
305
|
+
disabled: !skillsEnabled,
|
|
306
|
+
};
|
|
216
307
|
}
|
|
217
308
|
export function findSkill(skills, name) {
|
|
218
309
|
const needle = name.trim().toLowerCase();
|
|
@@ -238,26 +329,45 @@ function clipDescription(description, max) {
|
|
|
238
329
|
export function formatSkillIndex(skills) {
|
|
239
330
|
if (skills.length === 0)
|
|
240
331
|
return '';
|
|
241
|
-
const
|
|
332
|
+
const header = [
|
|
242
333
|
'# Skills',
|
|
243
334
|
'Installed skills extend how you work. When a request matches one, call the read_skill tool with the exact name first and follow the instructions it returns. Do not guess what a skill contains.',
|
|
244
335
|
];
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
336
|
+
const budget = MAX_SKILLS_INDEX_CHARS - header.join('\n').length - 1;
|
|
337
|
+
const descriptionLimit = skills.length > MAX_SKILLS_IN_PROMPT
|
|
338
|
+
? MAX_SKILL_SHORT_DESCRIPTION_CHARS
|
|
339
|
+
: MAX_SKILL_DESCRIPTION_CHARS;
|
|
340
|
+
let lines = skills.map((skill) => `- ${skill.name}: ${clipDescription(skill.description, descriptionLimit)}`);
|
|
341
|
+
if (lines.join('\n').length > budget)
|
|
342
|
+
lines = skills.map((skill) => `- ${skill.name}`);
|
|
343
|
+
const kept = [];
|
|
344
|
+
let used = 0;
|
|
345
|
+
for (const line of lines) {
|
|
346
|
+
if (kept.length > 0 && used + line.length + 1 > budget)
|
|
250
347
|
break;
|
|
251
|
-
lines.push(line);
|
|
252
348
|
used += line.length + 1;
|
|
253
|
-
|
|
349
|
+
kept.push(line);
|
|
254
350
|
}
|
|
255
|
-
const
|
|
256
|
-
if (
|
|
257
|
-
|
|
258
|
-
return
|
|
351
|
+
const omitted = skills.length - kept.length;
|
|
352
|
+
if (omitted > 0)
|
|
353
|
+
kept.push(`(+${omitted} more skills; run /skills to list all.)`);
|
|
354
|
+
return [...header, ...kept].join('\n');
|
|
355
|
+
}
|
|
356
|
+
/** The user message /skill produces: full instructions plus, when given, the request. */
|
|
357
|
+
export function skillInvocationMessage(skill, request = '') {
|
|
358
|
+
const body = skill.body.length > MAX_SKILL_BODY_CHARS
|
|
359
|
+
? `${skill.body.slice(0, MAX_SKILL_BODY_CHARS)}\n\n[Skill truncated; the rest is in ${skill.file}]`
|
|
360
|
+
: skill.body;
|
|
361
|
+
const ask = request.trim();
|
|
362
|
+
if (ask) {
|
|
363
|
+
return `Use the "${skill.name}" skill for this request.\n\n${body}\n\nRequest: ${ask}`;
|
|
364
|
+
}
|
|
365
|
+
return `Use the "${skill.name}" skill. Its instructions follow; apply them to what I ask next.\n\n${body}`;
|
|
259
366
|
}
|
|
260
367
|
export function formatSkillList(inventory, cwd) {
|
|
368
|
+
if (inventory.disabled) {
|
|
369
|
+
return 'Skills are disabled for this run (--no-skills or KIRO_NO_SKILLS).';
|
|
370
|
+
}
|
|
261
371
|
const lines = [];
|
|
262
372
|
if (inventory.skills.length === 0) {
|
|
263
373
|
lines.push('No skills installed.');
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { render } from 'ink';
|
|
4
4
|
import { applyOverrides, configPath, ConfigError, loadConfig, recoverConfig, } from './config.js';
|
|
5
|
+
import { setSkillsEnabled } from './agent/skills.js';
|
|
5
6
|
import { loadEnvFile } from './env.js';
|
|
6
7
|
import { runModelCli } from './model/cli.js';
|
|
7
8
|
import { readLine } from './model/cli-ui.js';
|
|
@@ -32,6 +33,8 @@ Options:
|
|
|
32
33
|
transcript, Shift+drag selects text for copying.
|
|
33
34
|
--no-mouse Disable mouse reporting so plain click-drag selection works.
|
|
34
35
|
--no-alt-screen Do not switch to the terminal's alternate screen
|
|
36
|
+
--no-skills Do not load skills from .kiro/skills, .claude/skills, or
|
|
37
|
+
~/.kiro/skills (KIRO_NO_SKILLS=1 does the same)
|
|
35
38
|
-h, --help Show this help
|
|
36
39
|
-v, --version Show the version
|
|
37
40
|
|
|
@@ -86,6 +89,7 @@ function parseArgs(argv) {
|
|
|
86
89
|
yolo: false,
|
|
87
90
|
mouse: true,
|
|
88
91
|
altScreen: true,
|
|
92
|
+
skills: true,
|
|
89
93
|
help: false,
|
|
90
94
|
version: false,
|
|
91
95
|
};
|
|
@@ -119,6 +123,10 @@ function parseArgs(argv) {
|
|
|
119
123
|
options.altScreen = false;
|
|
120
124
|
continue;
|
|
121
125
|
}
|
|
126
|
+
if (arg === '--no-skills') {
|
|
127
|
+
options.skills = false;
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
122
130
|
const equals = arg.indexOf('=');
|
|
123
131
|
const flag = equals === -1 ? arg : arg.slice(0, equals);
|
|
124
132
|
if (flag === '--profile' ||
|
|
@@ -234,6 +242,7 @@ async function main() {
|
|
|
234
242
|
}
|
|
235
243
|
}
|
|
236
244
|
await loadEnvFile();
|
|
245
|
+
setSkillsEnabled(options.skills && process.env.KIRO_NO_SKILLS !== '1');
|
|
237
246
|
const { loaded, backup } = await loadConfigWithRecovery();
|
|
238
247
|
const overrides = {
|
|
239
248
|
profile: options.profile,
|
package/dist/tools/skill.js
CHANGED
|
@@ -21,6 +21,9 @@ const readSkillTool = {
|
|
|
21
21
|
async run(input, ctx) {
|
|
22
22
|
const name = stringArg(input, 'name');
|
|
23
23
|
const inventory = await loadSkills(ctx.cwd);
|
|
24
|
+
if (inventory.disabled) {
|
|
25
|
+
return toolError('Skills are disabled for this run (--no-skills), so nothing can be loaded.');
|
|
26
|
+
}
|
|
24
27
|
if (inventory.skills.length === 0) {
|
|
25
28
|
return toolError('No skills are installed. Add one at .kiro/skills/<name>/SKILL.md or ~/.kiro/skills/<name>/SKILL.md.');
|
|
26
29
|
}
|
|
@@ -33,7 +36,8 @@ const readSkillTool = {
|
|
|
33
36
|
`${MAX_SKILL_BODY_CHARS.toLocaleString()} characters; read the rest with read_file on ${skill.file}]`
|
|
34
37
|
: skill.body;
|
|
35
38
|
return ok(`# Skill: ${skill.name}\n\n${clipped}\n\n` +
|
|
36
|
-
`[
|
|
39
|
+
`[${skill.source} skill · directory: ${skill.dir}. ` +
|
|
40
|
+
'Read supporting files with read_file or run bundled scripts with run_command.]', `read_skill ${skill.name}`);
|
|
37
41
|
},
|
|
38
42
|
};
|
|
39
43
|
export const skillTools = [readSkillTool];
|
package/dist/ui/App.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Box, useApp, useInput, useStdout } from 'ink';
|
|
|
4
4
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { buildSystemPrompt } from '../agent/prompt.js';
|
|
7
|
-
import { findSkill, formatSkillList, loadSkills,
|
|
7
|
+
import { findSkill, formatSkillList, loadSkills, shortPath, skillInvocationMessage, } from '../agent/skills.js';
|
|
8
8
|
import { runAgentTurn } from '../agent/loop.js';
|
|
9
9
|
import { COMPACT_KEEP_USER_TURNS, COMPACT_THRESHOLD, compactMessages, shouldCompact, } from '../agent/compact.js';
|
|
10
10
|
import { estimateMessagesTokens, formatPercent, formatTokens } from '../agent/tokens.js';
|
|
@@ -122,6 +122,7 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
|
|
|
122
122
|
const busyRef = useRef(false);
|
|
123
123
|
const abortRef = useRef(null);
|
|
124
124
|
const cancelRequestedRef = useRef(false);
|
|
125
|
+
const projectSkillNotedRef = useRef(false);
|
|
125
126
|
const quitArmedRef = useRef(false);
|
|
126
127
|
const quitTimerRef = useRef(null);
|
|
127
128
|
const [approvalPolicy] = useState(() => new ApprovalPolicy(yolo));
|
|
@@ -471,6 +472,24 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
|
|
|
471
472
|
approvalPolicy.clear();
|
|
472
473
|
setAutoAllowed([]);
|
|
473
474
|
}, [approvalPolicy]);
|
|
475
|
+
/** Mentions once per run when the model pulls instructions that came from the repo. */
|
|
476
|
+
const noteProjectSkill = useCallback(async (rawArguments) => {
|
|
477
|
+
let name;
|
|
478
|
+
try {
|
|
479
|
+
name = JSON.parse(rawArguments || '{}').name;
|
|
480
|
+
}
|
|
481
|
+
catch {
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
if (typeof name !== 'string')
|
|
485
|
+
return;
|
|
486
|
+
const inventory = await loadSkills(cwd);
|
|
487
|
+
const skill = findSkill(inventory.skills, name);
|
|
488
|
+
if (skill?.source !== 'project')
|
|
489
|
+
return;
|
|
490
|
+
addNotice('muted', `"${skill.name}" was loaded from this repository (${shortPath(skill.dir, cwd)}), not your ` +
|
|
491
|
+
'~/.kiro settings. Its text steers the model; tool approvals still apply.');
|
|
492
|
+
}, [addNotice, cwd]);
|
|
474
493
|
const sendTurn = useCallback(async (rawInput, alreadyDisplayed = false, displayText) => {
|
|
475
494
|
if (busyRef.current || transitioningRef.current)
|
|
476
495
|
return;
|
|
@@ -599,6 +618,12 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
|
|
|
599
618
|
return next;
|
|
600
619
|
});
|
|
601
620
|
recomputeContext();
|
|
621
|
+
if (event.toolCall.function.name === 'read_skill' &&
|
|
622
|
+
event.result.status === 'ok' &&
|
|
623
|
+
!projectSkillNotedRef.current) {
|
|
624
|
+
projectSkillNotedRef.current = true;
|
|
625
|
+
void noteProjectSkill(event.toolCall.function.arguments);
|
|
626
|
+
}
|
|
602
627
|
// The next model round starts once the tools for this one finish.
|
|
603
628
|
roundStartedAtRef.current = Date.now();
|
|
604
629
|
roundCompletionTokensRef.current = null;
|
|
@@ -668,6 +693,7 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
|
|
|
668
693
|
cwd,
|
|
669
694
|
finalizeAssistant,
|
|
670
695
|
flushText,
|
|
696
|
+
noteProjectSkill,
|
|
671
697
|
persistSession,
|
|
672
698
|
profileName,
|
|
673
699
|
queueText,
|
|
@@ -880,22 +906,27 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
|
|
|
880
906
|
return;
|
|
881
907
|
}
|
|
882
908
|
case '/skill': {
|
|
883
|
-
if (!argument
|
|
884
|
-
addNotice('error', 'Usage: /skill <name
|
|
909
|
+
if (!argument) {
|
|
910
|
+
addNotice('error', 'Usage: /skill <name> [request]. Run /skills to list installed skills.');
|
|
885
911
|
return;
|
|
886
912
|
}
|
|
913
|
+
const line = input.trim();
|
|
914
|
+
const request = line
|
|
915
|
+
.slice(command.length)
|
|
916
|
+
.trim()
|
|
917
|
+
.slice(argument.length)
|
|
918
|
+
.trim();
|
|
887
919
|
const inventory = await loadSkills(cwd);
|
|
888
920
|
const skill = findSkill(inventory.skills, argument);
|
|
889
921
|
if (!skill) {
|
|
890
|
-
addNotice('error', inventory.
|
|
891
|
-
? '
|
|
892
|
-
:
|
|
922
|
+
addNotice('error', inventory.disabled
|
|
923
|
+
? 'Skills are disabled for this run (--no-skills).'
|
|
924
|
+
: inventory.skills.length === 0
|
|
925
|
+
? 'No skills installed. Add one at .kiro/skills/<name>/SKILL.md.'
|
|
926
|
+
: `Unknown skill "${argument}". Installed: ${inventory.skills.map((entry) => entry.name).join(', ')}.`);
|
|
893
927
|
return;
|
|
894
928
|
}
|
|
895
|
-
|
|
896
|
-
? `${skill.body.slice(0, MAX_SKILL_BODY_CHARS)}\n\n[Skill truncated; the rest is in ${skill.file}]`
|
|
897
|
-
: skill.body;
|
|
898
|
-
void sendTurn(`Use the "${skill.name}" skill. Its instructions follow; apply them to what I ask next.\n\n${body}`, false, `/skill ${skill.name}`);
|
|
929
|
+
void sendTurn(skillInvocationMessage(skill, request), false, line);
|
|
899
930
|
return;
|
|
900
931
|
}
|
|
901
932
|
case '/compact': {
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.2.
|
|
1
|
+
export const VERSION = '0.2.10';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|