claudekit-cli 3.39.3-dev.4 → 3.39.3-dev.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.
Files changed (2) hide show
  1. package/dist/index.js +110 -49
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14335,6 +14335,32 @@ function truncateField(value, field, warnings) {
14335
14335
  }
14336
14336
  return value;
14337
14337
  }
14338
+ function parseFrontmatterFallback(content) {
14339
+ const fmMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
14340
+ if (!fmMatch)
14341
+ return null;
14342
+ const fmBlock = fmMatch[1];
14343
+ const body = content.slice(fmMatch[0].length);
14344
+ const frontmatter = {};
14345
+ const warnings = [];
14346
+ const lines = fmBlock.split(/\r?\n/);
14347
+ for (const line of lines) {
14348
+ const keyMatch = line.match(/^([a-zA-Z][\w-]*)\s*:\s*(.*)/);
14349
+ if (!keyMatch)
14350
+ continue;
14351
+ const [, rawKey, rawValue] = keyMatch;
14352
+ const value = rawValue.replace(/^(['"])(.*)\1$/, "$2").trim();
14353
+ if (!value)
14354
+ continue;
14355
+ const mappedKey = KNOWN_KEYS[rawKey];
14356
+ if (mappedKey) {
14357
+ frontmatter[mappedKey] = truncateField(value, String(mappedKey), warnings);
14358
+ } else {
14359
+ frontmatter[rawKey] = value;
14360
+ }
14361
+ }
14362
+ return { frontmatter, body: body.trim(), warnings };
14363
+ }
14338
14364
  function parseFrontmatter(content) {
14339
14365
  try {
14340
14366
  const { data, content: body } = import_gray_matter3.default(content);
@@ -14359,6 +14385,11 @@ function parseFrontmatter(content) {
14359
14385
  }
14360
14386
  return { frontmatter, body: body.trim(), warnings };
14361
14387
  } catch (error) {
14388
+ const fallback = parseFrontmatterFallback(content);
14389
+ if (fallback && Object.keys(fallback.frontmatter).length > 0) {
14390
+ logger.verbose(`Failed to parse frontmatter: ${error instanceof Error ? error.message : "Unknown error"} (recovered via fallback)`);
14391
+ return fallback;
14392
+ }
14362
14393
  logger.warning(`Failed to parse frontmatter: ${error instanceof Error ? error.message : "Unknown error"}`);
14363
14394
  return { frontmatter: {}, body: content.trim(), warnings: [] };
14364
14395
  }
@@ -14367,7 +14398,7 @@ async function parseFrontmatterFile(filePath) {
14367
14398
  const content = await readFile5(filePath, "utf-8");
14368
14399
  return parseFrontmatter(content);
14369
14400
  }
14370
- var import_gray_matter3, FRONTMATTER_LIMITS;
14401
+ var import_gray_matter3, FRONTMATTER_LIMITS, KNOWN_KEYS;
14371
14402
  var init_frontmatter_parser = __esm(() => {
14372
14403
  init_logger();
14373
14404
  import_gray_matter3 = __toESM(require_gray_matter(), 1);
@@ -14379,6 +14410,14 @@ var init_frontmatter_parser = __esm(() => {
14379
14410
  memory: 50,
14380
14411
  argumentHint: 500
14381
14412
  };
14413
+ KNOWN_KEYS = {
14414
+ name: "name",
14415
+ description: "description",
14416
+ model: "model",
14417
+ tools: "tools",
14418
+ memory: "memory",
14419
+ "argument-hint": "argumentHint"
14420
+ };
14382
14421
  });
14383
14422
 
14384
14423
  // src/commands/agents/agents-discovery.ts
@@ -57245,7 +57284,7 @@ var package_default;
57245
57284
  var init_package = __esm(() => {
57246
57285
  package_default = {
57247
57286
  name: "claudekit-cli",
57248
- version: "3.39.3-dev.4",
57287
+ version: "3.39.3-dev.6",
57249
57288
  description: "CLI tool for bootstrapping and updating ClaudeKit projects",
57250
57289
  type: "module",
57251
57290
  repository: {
@@ -58522,7 +58561,7 @@ var init_github_client = __esm(() => {
58522
58561
  });
58523
58562
 
58524
58563
  // src/commands/update-cli.ts
58525
- import { exec as exec2 } from "node:child_process";
58564
+ import { exec as exec2, spawn as spawn2 } from "node:child_process";
58526
58565
  import { join as join47 } from "node:path";
58527
58566
  import { promisify as promisify8 } from "node:util";
58528
58567
  function getDefaultUpdateCliCommandDeps() {
@@ -58691,35 +58730,57 @@ async function promptKitUpdate(beta, yes, deps) {
58691
58730
  } else {
58692
58731
  logger.verbose("Auto-proceeding with kit update (--yes flag)");
58693
58732
  }
58694
- const initCmd = buildInitCommand(selection.isGlobal, yes ? selection.kit : undefined, beta || isBetaInstalled, yes);
58695
- logger.info(`Running: ${initCmd}`);
58696
- const s = (deps?.spinnerFn ?? de)();
58697
- s.start("Updating ClaudeKit content...");
58698
- try {
58699
- await execFn(initCmd, {
58700
- timeout: 300000
58701
- });
58702
- let newKitVersion;
58733
+ const useBeta = beta || isBetaInstalled;
58734
+ if (yes) {
58735
+ const initCmd = buildInitCommand(selection.isGlobal, selection.kit, useBeta, true);
58736
+ logger.info(`Running: ${initCmd}`);
58737
+ const s = (deps?.spinnerFn ?? de)();
58738
+ s.start("Updating ClaudeKit content...");
58703
58739
  try {
58704
- const claudeDir2 = selection.isGlobal ? setup.global.path : setup.project.path;
58705
- const updatedMetadata = await readMetadataFile(claudeDir2);
58706
- newKitVersion = selection.kit ? updatedMetadata?.kits?.[selection.kit]?.version : undefined;
58707
- } catch {}
58708
- if (selection.kit && kitVersion && newKitVersion && kitVersion !== newKitVersion) {
58709
- s.stop(`Kit updated: ${selection.kit}@${kitVersion} -> ${newKitVersion}`);
58710
- } else if (selection.kit && newKitVersion) {
58711
- s.stop(`Kit content updated (${selection.kit}@${newKitVersion})`);
58712
- } else {
58713
- s.stop("Kit content updated");
58740
+ await execFn(initCmd, { timeout: 300000 });
58741
+ let newKitVersion;
58742
+ try {
58743
+ const claudeDir2 = selection.isGlobal ? setup.global.path : setup.project.path;
58744
+ const updatedMetadata = await readMetadataFile(claudeDir2);
58745
+ newKitVersion = selection.kit ? updatedMetadata?.kits?.[selection.kit]?.version : undefined;
58746
+ } catch {}
58747
+ if (selection.kit && kitVersion && newKitVersion && kitVersion !== newKitVersion) {
58748
+ s.stop(`Kit updated: ${selection.kit}@${kitVersion} -> ${newKitVersion}`);
58749
+ } else if (selection.kit && newKitVersion) {
58750
+ s.stop(`Kit content updated (${selection.kit}@${newKitVersion})`);
58751
+ } else {
58752
+ s.stop("Kit content updated");
58753
+ }
58754
+ } catch (error) {
58755
+ s.stop("Kit update finished");
58756
+ const errorMsg = error instanceof Error ? error.message : "unknown";
58757
+ if (errorMsg.includes("exit code") && !errorMsg.includes("exit code 0")) {
58758
+ logger.warning("Kit content update may have encountered issues");
58759
+ logger.verbose(`Error: ${errorMsg}`);
58760
+ } else {
58761
+ logger.verbose(`Init command completed: ${errorMsg}`);
58762
+ }
58714
58763
  }
58715
- } catch (error) {
58716
- s.stop("Kit update finished");
58717
- const errorMsg = error instanceof Error ? error.message : "unknown";
58718
- if (errorMsg.includes("exit code") && !errorMsg.includes("exit code 0")) {
58764
+ } else {
58765
+ const args = ["init"];
58766
+ if (selection.isGlobal)
58767
+ args.push("-g");
58768
+ args.push("--install-skills");
58769
+ if (useBeta)
58770
+ args.push("--beta");
58771
+ const displayCmd = `ck ${args.join(" ")}`;
58772
+ logger.info(`Running: ${displayCmd}`);
58773
+ const spawnFn = deps?.spawnInitFn ?? ((spawnArgs) => new Promise((resolve13) => {
58774
+ const child = spawn2("ck", spawnArgs, { stdio: "inherit", shell: true });
58775
+ child.on("close", (code) => resolve13(code ?? 1));
58776
+ child.on("error", (err) => {
58777
+ logger.verbose(`Failed to spawn ck init: ${err.message}`);
58778
+ resolve13(1);
58779
+ });
58780
+ }));
58781
+ const exitCode = await spawnFn(args);
58782
+ if (exitCode !== 0) {
58719
58783
  logger.warning("Kit content update may have encountered issues");
58720
- logger.verbose(`Error: ${errorMsg}`);
58721
- } else {
58722
- logger.verbose(`Init command completed: ${errorMsg}`);
58723
58784
  }
58724
58785
  }
58725
58786
  } catch (error) {
@@ -59280,7 +59341,7 @@ var init_version_checker = __esm(() => {
59280
59341
  });
59281
59342
 
59282
59343
  // src/domains/web-server/routes/system-routes.ts
59283
- import { spawn as spawn2 } from "node:child_process";
59344
+ import { spawn as spawn3 } from "node:child_process";
59284
59345
  import { existsSync as existsSync39 } from "node:fs";
59285
59346
  import { readFile as readFile29 } from "node:fs/promises";
59286
59347
  import { join as join49 } from "node:path";
@@ -59460,7 +59521,7 @@ function registerSystemRoutes(app) {
59460
59521
  `);
59461
59522
  }
59462
59523
  logger.debug(`Spawning update command: ${commandLine}`);
59463
- const childProcess4 = spawn2(commandLine, {
59524
+ const childProcess4 = spawn3(commandLine, {
59464
59525
  shell: true,
59465
59526
  env: { ...process.env }
59466
59527
  });
@@ -64495,11 +64556,11 @@ var require_picomatch2 = __commonJS((exports, module) => {
64495
64556
  });
64496
64557
 
64497
64558
  // src/services/package-installer/process-executor.ts
64498
- import { exec as exec7, execFile as execFile7, spawn as spawn3 } from "node:child_process";
64559
+ import { exec as exec7, execFile as execFile7, spawn as spawn4 } from "node:child_process";
64499
64560
  import { promisify as promisify13 } from "node:util";
64500
64561
  function executeInteractiveScript(command, args, options2) {
64501
64562
  return new Promise((resolve16, reject) => {
64502
- const child = spawn3(command, args, {
64563
+ const child = spawn4(command, args, {
64503
64564
  stdio: ["ignore", "inherit", "inherit"],
64504
64565
  cwd: options2?.cwd,
64505
64566
  env: options2?.env || process.env
@@ -67661,7 +67722,7 @@ var init_ownership_display = __esm(() => {
67661
67722
  });
67662
67723
 
67663
67724
  // src/commands/watch/phases/implementation-git-helpers.ts
67664
- import { spawn as spawn4 } from "node:child_process";
67725
+ import { spawn as spawn5 } from "node:child_process";
67665
67726
  async function getCurrentBranch(cwd2) {
67666
67727
  const output2 = await spawnAndCollect("git", ["rev-parse", "--abbrev-ref", "HEAD"], cwd2);
67667
67728
  return output2.trim() || "main";
@@ -67737,7 +67798,7 @@ async function restoreOriginalBranch(branchName, cwd2, issueNumber) {
67737
67798
  }
67738
67799
  function spawnAndCollect(command, args, cwd2) {
67739
67800
  return new Promise((resolve32, reject) => {
67740
- const child = spawn4(command, args, { ...cwd2 && { cwd: cwd2 }, stdio: ["ignore", "pipe", "pipe"] });
67801
+ const child = spawn5(command, args, { ...cwd2 && { cwd: cwd2 }, stdio: ["ignore", "pipe", "pipe"] });
67741
67802
  const chunks = [];
67742
67803
  const stderrChunks = [];
67743
67804
  child.stdout.on("data", (chunk) => chunks.push(chunk));
@@ -70338,8 +70399,8 @@ async function logsContent(options2) {
70338
70399
  return;
70339
70400
  }
70340
70401
  if (options2.tail) {
70341
- const { spawn: spawn10 } = await import("node:child_process");
70342
- const tail = spawn10("tail", ["-f", logPath], { stdio: "inherit" });
70402
+ const { spawn: spawn11 } = await import("node:child_process");
70403
+ const tail = spawn11("tail", ["-f", logPath], { stdio: "inherit" });
70343
70404
  process.on("SIGINT", () => {
70344
70405
  tail.kill();
70345
70406
  process.exit(0);
@@ -71822,7 +71883,7 @@ var init_help_colors = __esm(() => {
71822
71883
  });
71823
71884
 
71824
71885
  // src/domains/help/help-interactive.ts
71825
- import { spawn as spawn10 } from "node:child_process";
71886
+ import { spawn as spawn11 } from "node:child_process";
71826
71887
  import * as readline from "node:readline";
71827
71888
  function getTerminalHeight() {
71828
71889
  return process.stdout.rows || 24;
@@ -71857,7 +71918,7 @@ async function trySystemPager(content) {
71857
71918
  const pagerCmd = process.env.PAGER || "less";
71858
71919
  const pagerArgs = getPagerArgs(pagerCmd);
71859
71920
  try {
71860
- const pager = spawn10(pagerCmd, pagerArgs, {
71921
+ const pager = spawn11(pagerCmd, pagerArgs, {
71861
71922
  stdio: ["pipe", process.stdout, process.stderr],
71862
71923
  shell: false
71863
71924
  });
@@ -101203,15 +101264,15 @@ var import_picocolors39 = __toESM(require_picocolors(), 1);
101203
101264
  // src/commands/watch/phases/implementation-runner.ts
101204
101265
  init_logger();
101205
101266
  init_implementation_git_helpers();
101206
- import { spawn as spawn7 } from "node:child_process";
101267
+ import { spawn as spawn8 } from "node:child_process";
101207
101268
 
101208
101269
  // src/commands/watch/phases/response-poster.ts
101209
101270
  init_logger();
101210
- import { spawn as spawn6 } from "node:child_process";
101271
+ import { spawn as spawn7 } from "node:child_process";
101211
101272
 
101212
101273
  // src/commands/watch/phases/comment-poller.ts
101213
101274
  init_logger();
101214
- import { spawn as spawn5 } from "node:child_process";
101275
+ import { spawn as spawn6 } from "node:child_process";
101215
101276
  var AI_DISCLAIMER = "<!-- ck-watch-bot -->";
101216
101277
  async function pollComments(owner, repo, issueNumber, lastCommentId, maintainerLogins) {
101217
101278
  const args = [
@@ -101267,7 +101328,7 @@ function getDisclaimerMarker() {
101267
101328
  }
101268
101329
  function spawnAndCollect2(command, args) {
101269
101330
  return new Promise((resolve32, reject) => {
101270
- const child = spawn5(command, args, { stdio: ["ignore", "pipe", "pipe"] });
101331
+ const child = spawn6(command, args, { stdio: ["ignore", "pipe", "pipe"] });
101271
101332
  const chunks = [];
101272
101333
  const stderrChunks = [];
101273
101334
  child.stdout.on("data", (chunk) => chunks.push(chunk));
@@ -101397,7 +101458,7 @@ async function postViaGh(owner, repo, issueNumber, body) {
101397
101458
  "--body-file",
101398
101459
  "-"
101399
101460
  ];
101400
- const child = spawn6("gh", args, { stdio: ["pipe", "pipe", "pipe"] });
101461
+ const child = spawn7("gh", args, { stdio: ["pipe", "pipe", "pipe"] });
101401
101462
  const stderrChunks = [];
101402
101463
  child.stderr.on("data", (chunk) => stderrChunks.push(chunk));
101403
101464
  child.stdin.write(body);
@@ -101528,7 +101589,7 @@ After completing the implementation:
101528
101589
  tools
101529
101590
  ];
101530
101591
  await new Promise((resolve32, reject) => {
101531
- const child = spawn7("claude", args, { cwd: cwd2, stdio: ["pipe", "pipe", "pipe"], detached: false });
101592
+ const child = spawn8("claude", args, { cwd: cwd2, stdio: ["pipe", "pipe", "pipe"], detached: false });
101532
101593
  child.stdin.write(prompt);
101533
101594
  child.stdin.end();
101534
101595
  const stderrChunks = [];
@@ -101560,7 +101621,7 @@ After completing the implementation:
101560
101621
  // src/commands/watch/phases/issue-poller.ts
101561
101622
  init_logger();
101562
101623
  init_zod();
101563
- import { spawn as spawn8 } from "node:child_process";
101624
+ import { spawn as spawn9 } from "node:child_process";
101564
101625
 
101565
101626
  // src/commands/watch/types.ts
101566
101627
  init_zod();
@@ -101697,7 +101758,7 @@ function checkRateLimit2(processedThisHour, maxPerHour) {
101697
101758
  }
101698
101759
  function spawnAndCollect3(command, args) {
101699
101760
  return new Promise((resolve32, reject) => {
101700
- const child = spawn8(command, args, { stdio: ["ignore", "pipe", "pipe"] });
101761
+ const child = spawn9(command, args, { stdio: ["ignore", "pipe", "pipe"] });
101701
101762
  const chunks = [];
101702
101763
  const stderrChunks = [];
101703
101764
  child.stdout.on("data", (chunk) => chunks.push(chunk));
@@ -101723,7 +101784,7 @@ init_logger();
101723
101784
 
101724
101785
  // src/commands/watch/phases/claude-invoker.ts
101725
101786
  init_logger();
101726
- import { spawn as spawn9 } from "node:child_process";
101787
+ import { spawn as spawn10 } from "node:child_process";
101727
101788
  async function invokeClaude(options2) {
101728
101789
  if (options2.dryRun) {
101729
101790
  logger.info("[dry-run] Would invoke Claude with prompt");
@@ -101748,7 +101809,7 @@ async function invokeClaude(options2) {
101748
101809
  "--allowedTools",
101749
101810
  tools
101750
101811
  ];
101751
- const child = spawn9("claude", args, {
101812
+ const child = spawn10("claude", args, {
101752
101813
  cwd: options2.cwd,
101753
101814
  stdio: ["pipe", "pipe", "pipe"],
101754
101815
  detached: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudekit-cli",
3
- "version": "3.39.3-dev.4",
3
+ "version": "3.39.3-dev.6",
4
4
  "description": "CLI tool for bootstrapping and updating ClaudeKit projects",
5
5
  "type": "module",
6
6
  "repository": {