kiro-10x-better 1.0.1 → 1.0.3

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
@@ -26,10 +26,18 @@ npx kiro-10x-better --global
26
26
  | :--- | :--- |
27
27
  | `-g`, `--global` | Install into `~/.kiro/` instead of `./.kiro/` |
28
28
  | `-f`, `--force` | Overwrite existing `.kiro` files (default: skip existing) |
29
- | `-y`, `--yes` | Skip interactive prompts and accept defaults |
29
+ | `-y`, `--yes` | Skip interactive prompts and accept core defaults |
30
30
  | `--with-skills` | Also install core `obra/superpowers` skills via `npx skills` |
31
+ | `--web` | Install Web App skills (`agent-browser` + `modern-web-guidance`) without prompting |
32
+ | `--security` | Install Security Audit skills + `better-auth` watcher hook without prompting |
31
33
  | `-h`, `--help` | Show usage help and exit |
32
34
 
35
+ ## Progressive Setup Flow
36
+
37
+ 1. **Fast Core Setup:** Always installs steering rules, the 3 bundled skills, core safety/lint/verify hooks, ignores, and global `permissions.yaml`.
38
+ 2. **Web App Prompt (Opt-In):** Detects web frameworks (`next`, `react`, `vite`, `vue`, `svelte`, `astro`, `nuxt`, `remix`, `@tanstack/react-start`) in `package.json` and asks whether to install `agent-browser` + `modern-web-guidance` (defaulting to `Y/n` when detected, `y/N` otherwise; skipped under `--yes` unless `--web` is passed). Also appends `agent-browser *` and `npx modern-web-guidance*` to `permissions.yaml` `allow:`.
39
+ 3. **Security Audit + Better Auth Watcher (Opt-In):** Prompts to install `security-audit` (Cloudflare) + `security-review` (Sentry), appends `pnpm audit*` / `npm audit*` to `permissions.yaml`, and installs the `stack-skill-sync.json` watcher hook (`SessionStart` + `PostFileSave` on `package.json`) so `better-auth-security-best-practices` is automatically installed whenever `better-auth` is present or added later.
40
+
33
41
  ## What Gets Installed
34
42
 
35
43
  - **Steering (`steering/core-rules.md`):** Karpathy-style minimal diffs, fast CLI preferences (`rg`, `ast-grep`, `jq`, `gh`), token-saving rules, and verification honesty.
@@ -47,7 +55,7 @@ npx kiro-10x-better --global
47
55
  ## Recommended Kiro CLI V3 Settings
48
56
 
49
57
  1. Enable **Approve for me** and **Workflows** (`chat.enableWorkflows`).
50
- 2. Set `/effort high` (or `xhigh`) on complex tasks and restart your `kiro-cli` session.
58
+ 2. Use `/effort medium` as your daily default to save Kiro credits, and switch to `/effort high` only for complex debugging or architecture tasks. Restart your `kiro-cli` session after setup.
51
59
 
52
60
  ## License
53
61
 
package/bin/cli.mjs CHANGED
@@ -9,6 +9,17 @@ import { fileURLToPath } from "node:url";
9
9
 
10
10
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
11
  const TEMPLATES_DIR = path.resolve(__dirname, "..", "templates");
12
+ const WEB_FRAMEWORKS = [
13
+ "next",
14
+ "react",
15
+ "vite",
16
+ "vue",
17
+ "svelte",
18
+ "astro",
19
+ "nuxt",
20
+ "remix",
21
+ "@tanstack/react-start"
22
+ ];
12
23
 
13
24
  function printHelp() {
14
25
  console.log(`kiro-10x-better — High-discipline Kiro CLI V3 setup
@@ -21,6 +32,8 @@ Options:
21
32
  -f, --force Overwrite existing files (default: skip existing)
22
33
  -y, --yes Skip interactive prompts and accept defaults
23
34
  --with-skills Install core obra/superpowers skills via npx skills
35
+ --web Install Web App skills (agent-browser + modern-web-guidance)
36
+ --security Install Security Audit skills + better-auth watcher hook
24
37
  -h, --help Show this help message and exit
25
38
  `);
26
39
  }
@@ -31,6 +44,8 @@ function parseArgs(argv) {
31
44
  force: false,
32
45
  yes: false,
33
46
  withSkills: false,
47
+ web: false,
48
+ security: false,
34
49
  help: false
35
50
  };
36
51
 
@@ -51,6 +66,12 @@ function parseArgs(argv) {
51
66
  case "--with-skills":
52
67
  flags.withSkills = true;
53
68
  break;
69
+ case "--web":
70
+ flags.web = true;
71
+ break;
72
+ case "--security":
73
+ flags.security = true;
74
+ break;
54
75
  case "--help":
55
76
  case "-h":
56
77
  flags.help = true;
@@ -63,7 +84,20 @@ function parseArgs(argv) {
63
84
  return flags;
64
85
  }
65
86
 
66
- function detectProjectStack(cwd) {
87
+ function readPackageDeps(cwd) {
88
+ const pkgPath = path.join(cwd, "package.json");
89
+ if (!fs.existsSync(pkgPath)) {
90
+ return {};
91
+ }
92
+ try {
93
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8").replace(/^\uFEFF/, ""));
94
+ return { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) };
95
+ } catch {
96
+ return {};
97
+ }
98
+ }
99
+
100
+ function detectProjectStack(cwd, deps) {
67
101
  let pm = "npm";
68
102
  if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) {
69
103
  pm = "pnpm";
@@ -72,21 +106,12 @@ function detectProjectStack(cwd) {
72
106
  }
73
107
 
74
108
  let linter = null;
75
- const pkgPath = path.join(cwd, "package.json");
76
- if (fs.existsSync(pkgPath)) {
77
- try {
78
- const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
79
- const deps = { ...pkg.dependencies, ...pkg.devDependencies };
80
- if ("@biomejs/biome" in deps || "biome" in deps) {
81
- linter = "biome";
82
- } else if ("eslint" in deps) {
83
- linter = "eslint";
84
- } else if ("prettier" in deps) {
85
- linter = "prettier";
86
- }
87
- } catch {
88
- // Ignore malformed package.json and fall back to defaults
89
- }
109
+ if ("@biomejs/biome" in deps || "biome" in deps) {
110
+ linter = "biome";
111
+ } else if ("eslint" in deps) {
112
+ linter = "eslint";
113
+ } else if ("prettier" in deps) {
114
+ linter = "prettier";
90
115
  }
91
116
 
92
117
  const typescript = fs.existsSync(path.join(cwd, "tsconfig.json"));
@@ -202,47 +227,139 @@ function updateGitignore(cwd, tracker) {
202
227
  console.log(" update .gitignore (added .kiro/)");
203
228
  }
204
229
 
205
- async function promptYesNo(question) {
230
+ function configureMediumEffort(homeKiroDir, tracker) {
231
+ const cliJsonPath = path.join(homeKiroDir, "settings", "cli.json");
232
+ if (!fs.existsSync(cliJsonPath)) {
233
+ return;
234
+ }
235
+
236
+ let cliConfig;
237
+ try {
238
+ const raw = fs.readFileSync(cliJsonPath, "utf8").replace(/^\uFEFF/, "");
239
+ cliConfig = JSON.parse(raw);
240
+ } catch {
241
+ console.log(" skip ~/.kiro/settings/cli.json (could not parse JSON)");
242
+ return;
243
+ }
244
+
245
+ const modelDefaults = cliConfig?.["chat.modelDefaults"];
246
+ if (!modelDefaults || typeof modelDefaults !== "object" || Array.isArray(modelDefaults)) {
247
+ return;
248
+ }
249
+
250
+ let updated = false;
251
+ for (const [modelName, entry] of Object.entries(modelDefaults)) {
252
+ if (
253
+ /(claude|opus)/i.test(modelName) &&
254
+ entry &&
255
+ typeof entry === "object" &&
256
+ !Array.isArray(entry) &&
257
+ !entry.effort
258
+ ) {
259
+ entry.effort = "medium";
260
+ updated = true;
261
+ }
262
+ }
263
+
264
+ if (updated) {
265
+ fs.writeFileSync(cliJsonPath, `${JSON.stringify(cliConfig, null, 2)}\n`, "utf8");
266
+ tracker.created.push("~/.kiro/settings/cli.json (set effort: medium)");
267
+ console.log(" update ~/.kiro/settings/cli.json (set default effort: medium)");
268
+ }
269
+ }
270
+
271
+ function appendAllowRules(homeKiroDir, commands, tracker) {
272
+ const permPath = path.join(homeKiroDir, "settings", "permissions.yaml");
273
+ if (!fs.existsSync(permPath)) {
274
+ return;
275
+ }
276
+
277
+ const content = fs.readFileSync(permPath, "utf8");
278
+ const eol = content.includes("\r\n") ? "\r\n" : "\n";
279
+ const missing = commands.filter((cmd) => !content.includes(`command: "${cmd}"`));
280
+ if (missing.length === 0) {
281
+ return;
282
+ }
283
+
284
+ const block = missing
285
+ .map((cmd) => ` - tool: shell${eol} command: "${cmd}"`)
286
+ .join(eol);
287
+
288
+ let updatedContent;
289
+ const allowMatch = content.match(/^allow:[ \t]*\r?\n/m);
290
+ if (allowMatch) {
291
+ const insertPos = allowMatch.index + allowMatch[0].length;
292
+ updatedContent = `${content.slice(0, insertPos)}${block}${eol}${content.slice(insertPos)}`;
293
+ } else {
294
+ const prefix = content.length === 0 || content.endsWith("\n") ? "" : eol;
295
+ updatedContent = `${content}${prefix}allow:${eol}${block}${eol}`;
296
+ }
297
+
298
+ fs.writeFileSync(permPath, updatedContent, "utf8");
299
+ tracker.created.push(`~/.kiro/settings/permissions.yaml (+${missing.length} allow rules)`);
300
+ console.log(` update ~/.kiro/settings/permissions.yaml (added ${missing.join(", ")})`);
301
+ }
302
+
303
+ async function promptYesNo(question, defaultYes = true) {
206
304
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
207
305
  try {
208
306
  const answer = await rl.question(question);
209
307
  const normalized = answer.trim().toLowerCase();
210
- return normalized === "" || normalized === "y" || normalized === "yes";
308
+ if (normalized === "") {
309
+ return defaultYes;
310
+ }
311
+ return normalized === "y" || normalized === "yes";
211
312
  } finally {
212
313
  rl.close();
213
314
  }
214
315
  }
215
316
 
216
- function runSkillsInstall(isGlobal) {
217
- const args = [
218
- "skills",
219
- "add",
220
- "obra/superpowers",
221
- "-s",
222
- "using-git-worktrees",
223
- "-s",
224
- "subagent-driven-development",
225
- "-s",
226
- "verification-before-completion",
227
- "-s",
228
- "systematic-debugging",
229
- "-a",
230
- "kiro-cli"
231
- ];
232
- if (isGlobal) {
233
- args.push("-g");
317
+ function runNpxSkills(args, isGlobal) {
318
+ const fullArgs = isGlobal ? [...args, "-g"] : [...args];
319
+ const manualCmd = `npx ${fullArgs.join(" ")}`;
320
+ console.log(`\nRunning: ${manualCmd}`);
321
+ try {
322
+ const res = spawnSync("npx", fullArgs, {
323
+ stdio: "inherit",
324
+ shell: process.platform === "win32"
325
+ });
326
+ if (res.error) {
327
+ console.error(`Warning: Failed to run "${manualCmd}": ${res.error.message}`);
328
+ console.error(`Run manually later: ${manualCmd}`);
329
+ return false;
330
+ }
331
+ if (res.status !== 0) {
332
+ console.error(`Warning: "${manualCmd}" exited with status ${res.status}`);
333
+ console.error(`Run manually later: ${manualCmd}`);
334
+ return false;
335
+ }
336
+ return true;
337
+ } catch (err) {
338
+ console.error(`Warning: Failed to run "${manualCmd}": ${err.message}`);
339
+ console.error(`Run manually later: ${manualCmd}`);
340
+ return false;
234
341
  }
342
+ }
235
343
 
236
- console.log(`\nInstalling core skills: npx ${args.join(" ")}`);
237
- const res = spawnSync("npx", args, {
238
- stdio: "inherit",
239
- shell: process.platform === "win32"
240
- });
241
- if (res.error) {
242
- console.error(`Warning: Failed to run npx skills: ${res.error.message}`);
243
- } else if (res.status !== 0) {
244
- console.error(`Warning: npx skills exited with status ${res.status}`);
245
- }
344
+ function runSkillsInstall(isGlobal) {
345
+ runNpxSkills(
346
+ [
347
+ "skills",
348
+ "add",
349
+ "obra/superpowers",
350
+ "-s",
351
+ "using-git-worktrees",
352
+ "-s",
353
+ "subagent-driven-development",
354
+ "-s",
355
+ "verification-before-completion",
356
+ "-s",
357
+ "systematic-debugging",
358
+ "-a",
359
+ "kiro-cli"
360
+ ],
361
+ isGlobal
362
+ );
246
363
  }
247
364
 
248
365
  async function main() {
@@ -258,11 +375,12 @@ async function main() {
258
375
  const prefixLabel = flags.global ? "~/.kiro" : ".kiro";
259
376
  const tracker = { created: [], skipped: [] };
260
377
 
261
- const stack = flags.global ? null : detectProjectStack(cwd);
378
+ const pkgDeps = readPackageDeps(cwd);
379
+ const stack = flags.global ? null : detectProjectStack(cwd, pkgDeps);
262
380
 
263
381
  console.log(`\nSetting up Kiro CLI V3 in ${targetKiroDir}\n`);
264
382
 
265
- // Copy core steering, skills (recursively), and guard script
383
+ // Step 1: Fast Core Setup (steering, bundled skills, core hooks, ignores, global permissions)
266
384
  copyTemplateFile(
267
385
  path.join("steering", "core-rules.md"),
268
386
  path.join(targetKiroDir, "steering", "core-rules.md"),
@@ -280,7 +398,6 @@ async function main() {
280
398
  { force: flags.force, label: `${prefixLabel}/hooks/scripts/guard.cjs`, tracker }
281
399
  );
282
400
 
283
- // Write configured hooks
284
401
  writeTargetFile(
285
402
  path.join(targetKiroDir, "hooks", "security-guard.json"),
286
403
  buildSecurityGuardConfig(flags.global),
@@ -297,7 +414,6 @@ async function main() {
297
414
  { force: flags.force, label: `${prefixLabel}/hooks/verify-after-task.json`, tracker }
298
415
  );
299
416
 
300
- // Project-only .gitignore & .kiroignore
301
417
  if (!flags.global) {
302
418
  updateGitignore(cwd, tracker);
303
419
  copyTemplateFile("kiroignore", path.join(cwd, ".kiroignore"), {
@@ -307,7 +423,6 @@ async function main() {
307
423
  });
308
424
  }
309
425
 
310
- // Global permissions.yaml (Kiro CLI V3 reads permissions.yaml only from ~/.kiro/settings/)
311
426
  const shouldInstallPermissions = flags.global || flags.yes ||
312
427
  (await promptYesNo("\nInstall global permissions.yaml to ~/.kiro/settings/permissions.yaml? (Y/n) "));
313
428
 
@@ -317,12 +432,95 @@ async function main() {
317
432
  path.join(homeKiroDir, "settings", "permissions.yaml"),
318
433
  { force: flags.force, label: "~/.kiro/settings/permissions.yaml", tracker }
319
434
  );
435
+ configureMediumEffort(homeKiroDir, tracker);
320
436
  }
321
437
 
322
438
  if (flags.withSkills) {
323
439
  runSkillsInstall(flags.global);
324
440
  }
325
441
 
442
+ // Step 2: Web App Prompt (Opt-In)
443
+ const hasWebFramework = !flags.global && WEB_FRAMEWORKS.some((fw) => fw in pkgDeps);
444
+ let installWeb = false;
445
+ if (flags.web) {
446
+ installWeb = true;
447
+ } else if (!flags.yes) {
448
+ const webPrompt = hasWebFramework
449
+ ? "\nIs this a web app? Installs agent-browser + modern-web-guidance (Y/n): "
450
+ : "\nIs this a web app? Installs agent-browser + modern-web-guidance (y/N): ";
451
+ installWeb = await promptYesNo(webPrompt, hasWebFramework);
452
+ }
453
+
454
+ if (installWeb) {
455
+ runNpxSkills(
456
+ [
457
+ "skills",
458
+ "add",
459
+ "vercel-labs/agent-browser",
460
+ "--skill",
461
+ "agent-browser",
462
+ "--skill",
463
+ "modern-web-guidance",
464
+ "-a",
465
+ "kiro-cli",
466
+ "-y"
467
+ ],
468
+ flags.global
469
+ );
470
+ appendAllowRules(homeKiroDir, ["agent-browser *", "npx modern-web-guidance*"], tracker);
471
+ }
472
+
473
+ // Step 3: Security Audit Prompt + Auto-Watcher (Opt-In)
474
+ let installSecurity = false;
475
+ if (flags.security) {
476
+ installSecurity = true;
477
+ } else if (!flags.yes) {
478
+ installSecurity = await promptYesNo("\nAdd code security-audit skills? (y/N): ", false);
479
+ }
480
+
481
+ if (installSecurity) {
482
+ runNpxSkills(
483
+ ["skills", "add", "cloudflare/security-audit-skill", "--skill", "security-audit", "-a", "kiro-cli", "-y"],
484
+ flags.global
485
+ );
486
+ runNpxSkills(
487
+ ["skills", "add", "getsentry/skills", "--skill", "security-review", "-a", "kiro-cli", "-y"],
488
+ flags.global
489
+ );
490
+ copyTemplateFile(
491
+ path.join("hooks", "stack-skill-sync.json"),
492
+ path.join(targetKiroDir, "hooks", "stack-skill-sync.json"),
493
+ { force: flags.force, label: `${prefixLabel}/hooks/stack-skill-sync.json`, tracker }
494
+ );
495
+ copyTemplateFile(
496
+ path.join("hooks", "scripts", "sync-stack-skills.cjs"),
497
+ path.join(targetKiroDir, "hooks", "scripts", "sync-stack-skills.cjs"),
498
+ { force: flags.force, label: `${prefixLabel}/hooks/scripts/sync-stack-skills.cjs`, tracker }
499
+ );
500
+
501
+ if ("better-auth" in pkgDeps) {
502
+ runNpxSkills(
503
+ [
504
+ "skills",
505
+ "add",
506
+ "better-auth/skills",
507
+ "--skill",
508
+ "better-auth-security-best-practices",
509
+ "-a",
510
+ "kiro-cli",
511
+ "-y"
512
+ ],
513
+ flags.global
514
+ );
515
+ } else {
516
+ console.log(
517
+ "ℹ better-auth not in package.json yet — added auto-watcher to install better-auth-security-best-practices if you add it later!"
518
+ );
519
+ }
520
+
521
+ appendAllowRules(homeKiroDir, ["pnpm audit*", "npm audit*"], tracker);
522
+ }
523
+
326
524
  // Summary
327
525
  const bundledSkills = fs
328
526
  .readdirSync(path.join(TEMPLATES_DIR, "skills"), { withFileTypes: true })
@@ -338,9 +536,14 @@ async function main() {
338
536
  `Detected Stack: pm=${stack.pm}, linter=${stack.linter ?? "none (disabled)"}, typescript=${stack.typescript ? "yes" : "no (disabled)"}`
339
537
  );
340
538
  }
539
+ if (installWeb) {
540
+ console.log(
541
+ "\nWeb tip: Run \"npm install -g agent-browser && agent-browser install\" once if you haven't installed the browser binary yet."
542
+ );
543
+ }
341
544
  console.log("\nNext steps in Kiro CLI V3:");
342
545
  console.log(" 1. Enable \"Approve for me\" and Workflows (chat.enableWorkflows) in Kiro settings.");
343
- console.log(" 2. Set /effort high (or xhigh) and start a fresh kiro-cli session.");
546
+ console.log(" 2. Set /effort medium for daily work (or high for complex debugging) and start a fresh kiro-cli session.");
344
547
  }
345
548
 
346
549
  main().catch((err) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kiro-10x-better",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Instant, zero-dependency CLI to set up a high-discipline Kiro CLI V3 environment with hooks, steering rules, skills, and permissions.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,32 @@
1
+ const fs = require("node:fs");
2
+ const path = require("node:path");
3
+ const os = require("node:os");
4
+ const { execFileSync } = require("node:child_process");
5
+
6
+ try {
7
+ const pkgPath = path.join(process.cwd(), "package.json");
8
+ if (!fs.existsSync(pkgPath)) process.exit(0);
9
+
10
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
11
+ const deps = { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) };
12
+ if (!deps["better-auth"]) process.exit(0);
13
+
14
+ const skillName = "better-auth-security-best-practices";
15
+ const localSkill = path.join(process.cwd(), ".kiro", "skills", skillName, "SKILL.md");
16
+ const globalSkill = path.join(os.homedir(), ".kiro", "skills", skillName, "SKILL.md");
17
+ if (fs.existsSync(localSkill) || fs.existsSync(globalSkill)) process.exit(0);
18
+
19
+ console.log("[kiro-10x-better] Detected better-auth in package.json — installing security skill...");
20
+ execFileSync(
21
+ "npx",
22
+ ["skills", "add", "better-auth/skills", "--skill", skillName, "-a", "kiro-cli", "-y"],
23
+ {
24
+ stdio: "inherit",
25
+ shell: process.platform === "win32",
26
+ timeout: 40000
27
+ }
28
+ );
29
+ } catch {
30
+ // Never block Kiro CLI startup or file saves if offline or npx is unavailable
31
+ process.exit(0);
32
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "version": "v1",
3
+ "hooks": [
4
+ {
5
+ "name": "sync-better-auth-skill-on-start",
6
+ "description": "Auto-installs better-auth-security-best-practices skill if better-auth is added to package.json",
7
+ "trigger": "SessionStart",
8
+ "action": {
9
+ "type": "command",
10
+ "command": "node -e \"const fs=require('fs'),p=require('path'),os=require('os'),loc=p.join('.kiro','hooks','scripts','sync-stack-skills.cjs'),glob=p.join(os.homedir(),'.kiro','hooks','scripts','sync-stack-skills.cjs');require(fs.existsSync(loc)?p.resolve(loc):glob)\""
11
+ },
12
+ "timeout": 45,
13
+ "enabled": true
14
+ },
15
+ {
16
+ "name": "sync-better-auth-skill-on-pkg-save",
17
+ "description": "Auto-installs better-auth-security-best-practices skill when package.json is saved with better-auth",
18
+ "trigger": "PostFileSave",
19
+ "matcher": "package\\.json$",
20
+ "action": {
21
+ "type": "command",
22
+ "command": "node -e \"const fs=require('fs'),p=require('path'),os=require('os'),loc=p.join('.kiro','hooks','scripts','sync-stack-skills.cjs'),glob=p.join(os.homedir(),'.kiro','hooks','scripts','sync-stack-skills.cjs');require(fs.existsSync(loc)?p.resolve(loc):glob)\""
23
+ },
24
+ "timeout": 45,
25
+ "enabled": true
26
+ }
27
+ ]
28
+ }