@smicolon/ai-kit 0.2.0 → 0.2.1

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 +13 -27
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -260,6 +260,11 @@ function createDefaultConfig(tools) {
260
260
  import fs3 from "fs";
261
261
  import path3 from "path";
262
262
  var MANAGED_COMMENT = "# AI coding tools (managed by @smicolon/ai-kit)";
263
+ var LOCAL_PATTERNS = [
264
+ ".ai-kit.json",
265
+ "**/*.local.*",
266
+ "**/*.local.md"
267
+ ];
263
268
  function findGitRoot(startDir) {
264
269
  let dir = startDir;
265
270
  while (true) {
@@ -297,16 +302,15 @@ ${newEntries.join("\n")}
297
302
  }
298
303
  fs3.writeFileSync(gitignorePath, updated);
299
304
  }
300
- function updateGitignore(projectDir, dirs) {
301
- if (dirs.length === 0) return;
302
- const entries = dirs.map((d) => d.endsWith("/") ? d : `${d}/`);
303
- entries.push(".ai-kit.json");
305
+ function updateGitignore(projectDir) {
304
306
  const projectGitignore = path3.join(projectDir, ".gitignore");
305
- appendToGitignore(projectGitignore, entries);
307
+ appendToGitignore(projectGitignore, LOCAL_PATTERNS);
306
308
  const gitRoot = findGitRoot(projectDir);
307
309
  if (gitRoot && path3.resolve(gitRoot) !== path3.resolve(projectDir)) {
308
310
  const relFromRoot = path3.relative(gitRoot, projectDir);
309
- const rootEntries = entries.map((e) => `${relFromRoot}/${e}`);
311
+ const rootEntries = LOCAL_PATTERNS.map(
312
+ (e) => e.startsWith("**/") ? e : `${relFromRoot}/${e}`
313
+ );
310
314
  appendToGitignore(path3.join(gitRoot, ".gitignore"), rootEntries);
311
315
  }
312
316
  }
@@ -575,20 +579,6 @@ function isSymlink(p3) {
575
579
  return false;
576
580
  }
577
581
  }
578
- function getWrittenDirs(tools, hadSkills) {
579
- const dirs = /* @__PURE__ */ new Set();
580
- if (hadSkills) {
581
- dirs.add(CANONICAL_SKILLS_DIR);
582
- }
583
- for (const toolId of tools) {
584
- const config = TOOL_REGISTRY[toolId];
585
- for (const dir of Object.values(config.components)) {
586
- const topLevel = dir.split("/")[0];
587
- dirs.add(topLevel);
588
- }
589
- }
590
- return [...dirs];
591
- }
592
582
 
593
583
  // src/global-config.ts
594
584
  import fs6 from "fs";
@@ -722,7 +712,6 @@ var initCommand = new Command("init").description("Interactive first-time setup"
722
712
  s.start("Installing packs...");
723
713
  let config = createDefaultConfig(selectedTools);
724
714
  const selectedPacks = packs.filter((p3) => selectedPackNames.includes(p3.name));
725
- let hadSkills = false;
726
715
  for (const pack of selectedPacks) {
727
716
  const result = installPack({
728
717
  pack,
@@ -731,10 +720,9 @@ var initCommand = new Command("init").description("Interactive first-time setup"
731
720
  projectDir
732
721
  });
733
722
  config = mergeInstall(config, result);
734
- if (result.installed.skills > 0) hadSkills = true;
735
723
  }
736
724
  writeConfig(projectDir, config);
737
- updateGitignore(projectDir, getWrittenDirs(selectedTools, hadSkills));
725
+ updateGitignore(projectDir);
738
726
  s.stop("Done!");
739
727
  p.log.success(`Installed ${selectedPacks.length} pack(s) for ${selectedTools.length} tool(s):`);
740
728
  for (const pack of selectedPacks) {
@@ -801,7 +789,7 @@ var addCommand = new Command2("add").description("Add a pack to your project").a
801
789
  const updated = mergeInstall(config, result);
802
790
  updated.packs[pack.name].version = pack.version;
803
791
  writeConfig(projectDir, updated);
804
- updateGitignore(projectDir, getWrittenDirs(tools, result.installed.skills > 0));
792
+ updateGitignore(projectDir);
805
793
  const parts = [];
806
794
  for (const [type, count] of Object.entries(result.installed)) {
807
795
  if (count > 0) parts.push(`${count} ${type}`);
@@ -906,7 +894,6 @@ var updateCommand = new Command5("update").description("Update installed packs")
906
894
  const packsToUpdate = packName ? [packName] : Object.keys(config.packs);
907
895
  let updated = 0;
908
896
  let skipped = 0;
909
- let hadSkills = false;
910
897
  for (const name of packsToUpdate) {
911
898
  const installed = config.packs[name];
912
899
  if (!installed) {
@@ -936,14 +923,13 @@ var updateCommand = new Command5("update").description("Update installed packs")
936
923
  const merged = mergeInstall(config, result);
937
924
  merged.packs[name].version = available.version;
938
925
  Object.assign(config, merged);
939
- if (result.installed.skills > 0) hadSkills = true;
940
926
  console.log(
941
927
  pc5.green(` ${name}`) + ` ${pc5.dim(installed.version)} \u2192 ${pc5.cyan(available.version)}`
942
928
  );
943
929
  updated++;
944
930
  }
945
931
  writeConfig(projectDir, config);
946
- updateGitignore(projectDir, getWrittenDirs(config.tools, hadSkills));
932
+ updateGitignore(projectDir);
947
933
  if (updated > 0) {
948
934
  console.log(pc5.green(`
949
935
  Updated ${updated} pack(s).`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smicolon/ai-kit",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "AI coding tool pack manager for Smicolon standards",
5
5
  "license": "MIT",
6
6
  "repository": {