claudekit-cli 3.35.0-dev.20 → 3.35.0-dev.22

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 +130 -16
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -10824,31 +10824,30 @@ var init_provider_registry = __esm(() => {
10824
10824
  commands: null,
10825
10825
  skills: {
10826
10826
  projectPath: ".github/skills",
10827
- globalPath: join(home, ".copilot/skills"),
10827
+ globalPath: null,
10828
10828
  format: "direct-copy",
10829
10829
  writeStrategy: "per-file",
10830
10830
  fileExtension: ".md"
10831
10831
  },
10832
10832
  config: {
10833
10833
  projectPath: ".github/copilot-instructions.md",
10834
- globalPath: join(home, ".copilot/instructions.md"),
10834
+ globalPath: null,
10835
10835
  format: "md-strip",
10836
- writeStrategy: "merge-single",
10836
+ writeStrategy: "single-file",
10837
10837
  fileExtension: ".md"
10838
10838
  },
10839
10839
  rules: {
10840
- projectPath: ".github/copilot-instructions.md",
10841
- globalPath: join(home, ".copilot/instructions.md"),
10840
+ projectPath: ".github/instructions",
10841
+ globalPath: null,
10842
10842
  format: "md-strip",
10843
- writeStrategy: "merge-single",
10844
- fileExtension: ".md"
10843
+ writeStrategy: "per-file",
10844
+ fileExtension: ".instructions.md"
10845
10845
  },
10846
10846
  detect: async () => hasAnyInstallSignal([
10847
10847
  join(cwd, ".github/agents"),
10848
10848
  join(cwd, ".github/skills"),
10849
- join(cwd, ".github/copilot-instructions.md"),
10850
- join(home, ".copilot/skills"),
10851
- join(home, ".copilot/instructions.md")
10849
+ join(cwd, ".github/instructions"),
10850
+ join(cwd, ".github/copilot-instructions.md")
10852
10851
  ])
10853
10852
  },
10854
10853
  codex: {
@@ -11067,7 +11066,8 @@ var init_provider_registry = __esm(() => {
11067
11066
  format: "md-strip",
11068
11067
  writeStrategy: "per-file",
11069
11068
  fileExtension: ".md",
11070
- charLimit: 6000
11069
+ charLimit: 6000,
11070
+ totalCharLimit: 12000
11071
11071
  },
11072
11072
  detect: async () => hasAnyInstallSignal([
11073
11073
  join(cwd, ".windsurf/rules"),
@@ -11384,6 +11384,70 @@ function rewriteClaudeDirectoryRefs(input, sourceDir, target, fallbackPrefix, is
11384
11384
  });
11385
11385
  return output2;
11386
11386
  }
11387
+ function truncateAtCleanBoundary(content, limit) {
11388
+ const originalLength = content.length;
11389
+ if (limit <= 0) {
11390
+ return { result: "", originalLength, removedSections: [] };
11391
+ }
11392
+ if (content.length <= limit) {
11393
+ return { result: content, originalLength, removedSections: [] };
11394
+ }
11395
+ const sectionRegex = /^(#{2,3})\s+(.+)$/gm;
11396
+ const sectionStarts = [];
11397
+ for (const match of content.matchAll(sectionRegex)) {
11398
+ if (match.index !== undefined) {
11399
+ sectionStarts.push({ index: match.index, title: match[2].trim() });
11400
+ }
11401
+ }
11402
+ if (sectionStarts.length === 0) {
11403
+ return truncateAtParagraphBoundary(content, limit, originalLength);
11404
+ }
11405
+ const sections = [];
11406
+ for (let i = 0;i < sectionStarts.length; i++) {
11407
+ const start = sectionStarts[i].index;
11408
+ const end = i + 1 < sectionStarts.length ? sectionStarts[i + 1].index : content.length;
11409
+ sections.push({ title: sectionStarts[i].title, start, end });
11410
+ }
11411
+ const preamble = content.slice(0, sections[0]?.start ?? content.length);
11412
+ const removedSections = [];
11413
+ const keptSections = [...sections];
11414
+ while (keptSections.length > 0) {
11415
+ const candidate = preamble + keptSections.map((s) => content.slice(s.start, s.end)).join("");
11416
+ if (candidate.trim().length <= limit) {
11417
+ return { result: candidate.trim(), originalLength, removedSections };
11418
+ }
11419
+ const removed = keptSections.pop();
11420
+ if (removed)
11421
+ removedSections.push(removed.title);
11422
+ }
11423
+ if (preamble.trim().length > limit) {
11424
+ return truncateAtParagraphBoundary(preamble, limit, originalLength);
11425
+ }
11426
+ return { result: preamble.trim(), originalLength, removedSections };
11427
+ }
11428
+ function truncateAtParagraphBoundary(content, limit, originalLength) {
11429
+ const truncated = content.slice(0, limit);
11430
+ const lastParagraphBreak = truncated.lastIndexOf(`
11431
+
11432
+ `);
11433
+ if (lastParagraphBreak >= limit * 0.5) {
11434
+ return {
11435
+ result: truncated.slice(0, lastParagraphBreak).trimEnd(),
11436
+ originalLength,
11437
+ removedSections: []
11438
+ };
11439
+ }
11440
+ const lastNewline = truncated.lastIndexOf(`
11441
+ `);
11442
+ if (lastNewline >= limit * 0.3) {
11443
+ return {
11444
+ result: truncated.slice(0, lastNewline).trimEnd(),
11445
+ originalLength,
11446
+ removedSections: []
11447
+ };
11448
+ }
11449
+ return { result: truncated.trimEnd(), originalLength, removedSections: [] };
11450
+ }
11387
11451
  function stripClaudeRefs(content, options2) {
11388
11452
  const warnings = [];
11389
11453
  const removedSections = [];
@@ -11517,11 +11581,22 @@ function stripClaudeRefs(content, options2) {
11517
11581
  `);
11518
11582
  result = result.trim();
11519
11583
  if (options2?.charLimit && result.length > options2.charLimit) {
11520
- result = result.slice(0, options2.charLimit);
11521
- warnings.push(`Content truncated to ${options2.charLimit} characters for ${options2.provider}`);
11584
+ const truncated = truncateAtCleanBoundary(result, options2.charLimit);
11585
+ result = truncated.result;
11586
+ const overBy = truncated.originalLength - options2.charLimit;
11587
+ const pct = Math.round(overBy / options2.charLimit * 100);
11588
+ let msg = `Content truncated from ${truncated.originalLength} to ${result.length} chars (${pct}% over ${options2.charLimit} limit)`;
11589
+ if (truncated.removedSections.length > 0) {
11590
+ msg += `; removed sections: ${truncated.removedSections.join(", ")}`;
11591
+ }
11592
+ if (options2.provider) {
11593
+ msg += ` [${options2.provider}]`;
11594
+ }
11595
+ warnings.push(msg);
11522
11596
  }
11523
11597
  if (!result || result.length === 0) {
11524
- warnings.push("All content was Claude-specific");
11598
+ const providerTag = options2?.provider ? ` [${options2.provider}]` : "";
11599
+ warnings.push(`All content was Claude-specific${providerTag}`);
11525
11600
  }
11526
11601
  return { content: result, warnings, removedSections };
11527
11602
  }
@@ -12992,8 +13067,46 @@ async function installPortableItem(items, provider, portableType, options2) {
12992
13067
  return installPerFile(items[0], provider, portableType, options2);
12993
13068
  case "per-file": {
12994
13069
  const results = [];
13070
+ let aggregateChars = 0;
13071
+ const totalCharLimit = pathConfig.totalCharLimit;
12995
13072
  for (const item of items) {
12996
- results.push(await installPerFile(item, provider, portableType, options2));
13073
+ let itemSize = 0;
13074
+ if (totalCharLimit) {
13075
+ try {
13076
+ const converted = convertItem(item, pathConfig.format, provider);
13077
+ itemSize = converted.content.length;
13078
+ } catch {
13079
+ results.push({
13080
+ provider,
13081
+ providerDisplayName: config.displayName,
13082
+ success: true,
13083
+ path: "",
13084
+ skipped: true,
13085
+ skipReason: `Failed to measure "${item.name}" for aggregate limit`,
13086
+ warnings: [`Skipped "${item.name}": conversion measurement failed`]
13087
+ });
13088
+ continue;
13089
+ }
13090
+ if (aggregateChars + itemSize > totalCharLimit) {
13091
+ results.push({
13092
+ provider,
13093
+ providerDisplayName: config.displayName,
13094
+ success: true,
13095
+ path: "",
13096
+ skipped: true,
13097
+ skipReason: `${aggregateChars + itemSize} of ${totalCharLimit} chars used`,
13098
+ warnings: [
13099
+ `Skipped "${item.name}": would use ${aggregateChars + itemSize} of ${totalCharLimit} char limit`
13100
+ ]
13101
+ });
13102
+ continue;
13103
+ }
13104
+ }
13105
+ const result = await installPerFile(item, provider, portableType, options2);
13106
+ if (totalCharLimit && result.success && !result.skipped) {
13107
+ aggregateChars += itemSize;
13108
+ }
13109
+ results.push(result);
12997
13110
  }
12998
13111
  const successes = results.filter((r2) => r2.success && !r2.skipped);
12999
13112
  const failures = results.filter((r2) => !r2.success);
@@ -53166,7 +53279,7 @@ var package_default;
53166
53279
  var init_package = __esm(() => {
53167
53280
  package_default = {
53168
53281
  name: "claudekit-cli",
53169
- version: "3.35.0-dev.20",
53282
+ version: "3.35.0-dev.22",
53170
53283
  description: "CLI tool for bootstrapping and updating ClaudeKit projects",
53171
53284
  type: "module",
53172
53285
  repository: {
@@ -53265,6 +53378,7 @@ var init_package = __esm(() => {
53265
53378
  "@types/tar": "^6.1.13",
53266
53379
  "@types/tmp": "^0.2.6",
53267
53380
  "@types/ws": "^8.18.1",
53381
+ "conventional-changelog-conventionalcommits": "^9.1.0",
53268
53382
  "semantic-release": "^24.2.0",
53269
53383
  typescript: "^5.7.2"
53270
53384
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudekit-cli",
3
- "version": "3.35.0-dev.20",
3
+ "version": "3.35.0-dev.22",
4
4
  "description": "CLI tool for bootstrapping and updating ClaudeKit projects",
5
5
  "type": "module",
6
6
  "repository": {
@@ -99,6 +99,7 @@
99
99
  "@types/tar": "^6.1.13",
100
100
  "@types/tmp": "^0.2.6",
101
101
  "@types/ws": "^8.18.1",
102
+ "conventional-changelog-conventionalcommits": "^9.1.0",
102
103
  "semantic-release": "^24.2.0",
103
104
  "typescript": "^5.7.2"
104
105
  }