@baton-dx/cli 0.3.0 → 0.3.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.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { c as Ve, h as defineCommand, i as Le, l as We, n as isInSourceRepo } from "./context-detection-DqOTnD6_.mjs";
3
- import { A as discoverProfilesInSourceRepo } from "./src-BgiJfm14.mjs";
3
+ import { A as discoverProfilesInSourceRepo } from "./src-C3-Vz-R7.mjs";
4
4
  import "./agent-detection-DTiVeO5W.mjs";
5
5
  import "./esm-BagM-kVd.mjs";
6
6
 
@@ -53,4 +53,4 @@ Note: Must be run from a source repository (directory with baton.source.yaml)`
53
53
 
54
54
  //#endregion
55
55
  export { profileListCommand };
56
- //# sourceMappingURL=list-CCzjta6J.mjs.map
56
+ //# sourceMappingURL=list-DmzVXCNF.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-CCzjta6J.mjs","names":[],"sources":["../src/commands/profile/list.ts"],"sourcesContent":["import { discoverProfilesInSourceRepo } from \"@baton-dx/core\";\nimport * as p from \"@clack/prompts\";\nimport { defineCommand } from \"citty\";\nimport { isInSourceRepo } from \"../../utils/context-detection.js\";\n\nexport const profileListCommand = defineCommand({\n meta: {\n name: \"profile list\",\n description: `List all profiles in the current source repository\n\nShows a table of all profiles with:\n - Profile name (root profile marked with \"(root)\")\n - Version from baton.profile.yaml\n - Description from profile manifest\n\nExamples:\n baton profile list\n\nNote: Must be run from a source repository (directory with baton.source.yaml)`,\n },\n run: async () => {\n p.intro(\"List Profiles\");\n\n // Check if we're in a source repo\n const inSourceRepo = await isInSourceRepo();\n if (!inSourceRepo) {\n p.outro(\n \"Error: Not in a source repository. Run this command from a directory containing baton.source.yaml\",\n );\n process.exit(1);\n }\n\n const cwd = process.cwd();\n\n // Discover all profiles in the profiles/ directory\n const profiles = await discoverProfilesInSourceRepo(cwd);\n\n if (profiles.length === 0) {\n p.outro(\"No profiles found.\");\n process.exit(0);\n }\n\n // Build table output\n const lines: string[] = [];\n lines.push(\"┌─────────────────────┬─────────┬────────────────────────────────────┐\");\n lines.push(\"│ Name │ Version │ Description │\");\n lines.push(\"├─────────────────────┼─────────┼────────────────────────────────────┤\");\n\n for (const profile of profiles) {\n const name = profile.name;\n const version = profile.version || \"-\";\n const description = profile.description || \"-\";\n\n // Pad columns to fixed width\n const namePadded = name.padEnd(19);\n const versionPadded = version.padEnd(7);\n const descPadded = description.padEnd(34);\n\n lines.push(`│ ${namePadded} │ ${versionPadded} │ ${descPadded} │`);\n }\n\n lines.push(\"└─────────────────────┴─────────┴────────────────────────────────────┘\");\n\n p.note(lines.join(\"\\n\"), \"Profiles\");\n p.outro(`Found ${profiles.length} profile${profiles.length === 1 ? \"\" : \"s\"}`);\n process.exit(0);\n },\n});\n"],"mappings":";;;;;;;AAKA,MAAa,qBAAqB,cAAc;CAC9C,MAAM;EACJ,MAAM;EACN,aAAa;;;;;;;;;;;EAWd;CACD,KAAK,YAAY;AACf,KAAQ,gBAAgB;AAIxB,MAAI,CADiB,MAAM,gBAAgB,EACxB;AACjB,MACE,oGACD;AACD,WAAQ,KAAK,EAAE;;EAMjB,MAAM,WAAW,MAAM,6BAHX,QAAQ,KAAK,CAG+B;AAExD,MAAI,SAAS,WAAW,GAAG;AACzB,MAAQ,qBAAqB;AAC7B,WAAQ,KAAK,EAAE;;EAIjB,MAAM,QAAkB,EAAE;AAC1B,QAAM,KAAK,yEAAyE;AACpF,QAAM,KAAK,yEAAyE;AACpF,QAAM,KAAK,yEAAyE;AAEpF,OAAK,MAAM,WAAW,UAAU;GAC9B,MAAM,OAAO,QAAQ;GACrB,MAAM,UAAU,QAAQ,WAAW;GACnC,MAAM,cAAc,QAAQ,eAAe;GAG3C,MAAM,aAAa,KAAK,OAAO,GAAG;GAClC,MAAM,gBAAgB,QAAQ,OAAO,EAAE;GACvC,MAAM,aAAa,YAAY,OAAO,GAAG;AAEzC,SAAM,KAAK,KAAK,WAAW,KAAK,cAAc,KAAK,WAAW,IAAI;;AAGpE,QAAM,KAAK,yEAAyE;AAEpF,KAAO,MAAM,KAAK,KAAK,EAAE,WAAW;AACpC,KAAQ,SAAS,SAAS,OAAO,UAAU,SAAS,WAAW,IAAI,KAAK,MAAM;AAC9E,UAAQ,KAAK,EAAE;;CAElB,CAAC"}
1
+ {"version":3,"file":"list-DmzVXCNF.mjs","names":[],"sources":["../src/commands/profile/list.ts"],"sourcesContent":["import { discoverProfilesInSourceRepo } from \"@baton-dx/core\";\nimport * as p from \"@clack/prompts\";\nimport { defineCommand } from \"citty\";\nimport { isInSourceRepo } from \"../../utils/context-detection.js\";\n\nexport const profileListCommand = defineCommand({\n meta: {\n name: \"profile list\",\n description: `List all profiles in the current source repository\n\nShows a table of all profiles with:\n - Profile name (root profile marked with \"(root)\")\n - Version from baton.profile.yaml\n - Description from profile manifest\n\nExamples:\n baton profile list\n\nNote: Must be run from a source repository (directory with baton.source.yaml)`,\n },\n run: async () => {\n p.intro(\"List Profiles\");\n\n // Check if we're in a source repo\n const inSourceRepo = await isInSourceRepo();\n if (!inSourceRepo) {\n p.outro(\n \"Error: Not in a source repository. Run this command from a directory containing baton.source.yaml\",\n );\n process.exit(1);\n }\n\n const cwd = process.cwd();\n\n // Discover all profiles in the profiles/ directory\n const profiles = await discoverProfilesInSourceRepo(cwd);\n\n if (profiles.length === 0) {\n p.outro(\"No profiles found.\");\n process.exit(0);\n }\n\n // Build table output\n const lines: string[] = [];\n lines.push(\"┌─────────────────────┬─────────┬────────────────────────────────────┐\");\n lines.push(\"│ Name │ Version │ Description │\");\n lines.push(\"├─────────────────────┼─────────┼────────────────────────────────────┤\");\n\n for (const profile of profiles) {\n const name = profile.name;\n const version = profile.version || \"-\";\n const description = profile.description || \"-\";\n\n // Pad columns to fixed width\n const namePadded = name.padEnd(19);\n const versionPadded = version.padEnd(7);\n const descPadded = description.padEnd(34);\n\n lines.push(`│ ${namePadded} │ ${versionPadded} │ ${descPadded} │`);\n }\n\n lines.push(\"└─────────────────────┴─────────┴────────────────────────────────────┘\");\n\n p.note(lines.join(\"\\n\"), \"Profiles\");\n p.outro(`Found ${profiles.length} profile${profiles.length === 1 ? \"\" : \"s\"}`);\n process.exit(0);\n },\n});\n"],"mappings":";;;;;;;AAKA,MAAa,qBAAqB,cAAc;CAC9C,MAAM;EACJ,MAAM;EACN,aAAa;;;;;;;;;;;EAWd;CACD,KAAK,YAAY;AACf,KAAQ,gBAAgB;AAIxB,MAAI,CADiB,MAAM,gBAAgB,EACxB;AACjB,MACE,oGACD;AACD,WAAQ,KAAK,EAAE;;EAMjB,MAAM,WAAW,MAAM,6BAHX,QAAQ,KAAK,CAG+B;AAExD,MAAI,SAAS,WAAW,GAAG;AACzB,MAAQ,qBAAqB;AAC7B,WAAQ,KAAK,EAAE;;EAIjB,MAAM,QAAkB,EAAE;AAC1B,QAAM,KAAK,yEAAyE;AACpF,QAAM,KAAK,yEAAyE;AACpF,QAAM,KAAK,yEAAyE;AAEpF,OAAK,MAAM,WAAW,UAAU;GAC9B,MAAM,OAAO,QAAQ;GACrB,MAAM,UAAU,QAAQ,WAAW;GACnC,MAAM,cAAc,QAAQ,eAAe;GAG3C,MAAM,aAAa,KAAK,OAAO,GAAG;GAClC,MAAM,gBAAgB,QAAQ,OAAO,EAAE;GACvC,MAAM,aAAa,YAAY,OAAO,GAAG;AAEzC,SAAM,KAAK,KAAK,WAAW,KAAK,cAAc,KAAK,WAAW,IAAI;;AAGpE,QAAM,KAAK,yEAAyE;AAEpF,KAAO,MAAM,KAAK,KAAK,EAAE,WAAW;AACpC,KAAQ,SAAS,SAAS,OAAO,UAAU,SAAS,WAAW,IAAI,KAAK,MAAM;AAC9E,UAAQ,KAAK,EAAE;;CAElB,CAAC"}
@@ -3,7 +3,7 @@ import { n as __require, r as __toESM, t as __commonJSMin } from "./chunk-BbwQpW
3
3
  import { m as require_dist } from "./context-detection-DqOTnD6_.mjs";
4
4
  import { i as AGENT_PATHS, r as evaluateDetection } from "./agent-detection-DTiVeO5W.mjs";
5
5
  import { d as esm_default, m as simpleGit } from "./esm-BagM-kVd.mjs";
6
- import { access, mkdir, readFile, readdir, rm, stat, symlink, writeFile } from "node:fs/promises";
6
+ import { access, mkdir, readFile, readdir, rm, rmdir, stat, symlink, unlink, writeFile } from "node:fs/promises";
7
7
  import { dirname, isAbsolute, join, relative, resolve } from "node:path";
8
8
  import { promisify } from "node:util";
9
9
  import { homedir } from "node:os";
@@ -6414,6 +6414,47 @@ async function readLock(filePath) {
6414
6414
  }
6415
6415
  }
6416
6416
 
6417
+ //#endregion
6418
+ //#region ../core/src/lockfile/cleanup.ts
6419
+ /**
6420
+ * Removes placed files and directories, then cleans up empty parent directories.
6421
+ *
6422
+ * Handles both files and directories (fixes EISDIR bug where unlink fails on dirs).
6423
+ * Already-deleted paths (ENOENT) are silently skipped.
6424
+ * After each removal, walks up and removes empty parent directories up to projectRoot.
6425
+ *
6426
+ * @param filePaths - Paths to remove (relative to projectRoot or absolute)
6427
+ * @param projectRoot - Project root directory (parent cleanup stops here)
6428
+ * @returns Count of successfully removed items
6429
+ */
6430
+ async function removePlacedFiles(filePaths, projectRoot) {
6431
+ let removedCount = 0;
6432
+ for (const filePath of filePaths) {
6433
+ const absolutePath = isAbsolute(filePath) ? filePath : resolve(projectRoot, filePath);
6434
+ try {
6435
+ if ((await stat(absolutePath)).isDirectory()) await rm(absolutePath, {
6436
+ recursive: true,
6437
+ force: true
6438
+ });
6439
+ else await unlink(absolutePath);
6440
+ removedCount++;
6441
+ let dir = dirname(absolutePath);
6442
+ while (dir !== projectRoot && dir.startsWith(projectRoot)) try {
6443
+ if ((await readdir(dir)).length === 0) {
6444
+ await rmdir(dir);
6445
+ dir = dirname(dir);
6446
+ } else break;
6447
+ } catch {
6448
+ break;
6449
+ }
6450
+ } catch (error) {
6451
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") continue;
6452
+ throw error;
6453
+ }
6454
+ }
6455
+ return removedCount;
6456
+ }
6457
+
6417
6458
  //#endregion
6418
6459
  //#region ../core/src/sources/load-profile-safe.ts
6419
6460
  /**
@@ -14640,5 +14681,5 @@ async function resolvePreferences(projectRoot) {
14640
14681
  }
14641
14682
 
14642
14683
  //#endregion
14643
- export { getAgentConfig as $, discoverProfilesInSourceRepo as A, getRegisteredIdePlatforms as B, isLockedProfile as C, resolveProfileChain as D, resolveProfileSupport as E, resolveVersion as F, parseFrontmatter as G, isKnownIdePlatform as H, cloneGitSource as I, loadProfileManifest as J, parseSource as K, collectProfileSupportPatterns as L, generateLock as M, readLock as N, detectLegacyPaths as O, writeLock as P, SourceParseError as Q, updateGitignore as R, getProfileWeight as S, mergeContentParts as T, getAdaptersForKeys as U, idePlatformRegistry as V, getAllAdapters as W, KEBAB_CASE_REGEX as X, loadProjectManifest as Y, FileNotFoundError as Z, mergeMemoryWithWarnings as _, clearIdeCache as a, mergeSkills as b, getDefaultGlobalSource as c, getGlobalSources as d, getAgentPath as et, removeGlobalSource as f, mergeMemory as g, require_lib as h, computeIntersection as i, findSourceManifest as j, placeFile as k, getGlobalAiTools as l, setGlobalIdePlatforms as m, readProjectPreferences as n, detectInstalledIdes as o, setGlobalAiTools as p, loadLockfile as q, writeProjectPreferences as r, addGlobalSource as s, resolvePreferences as t, getAllAgentKeys as tt, getGlobalIdePlatforms as u, mergeRules as v, sortProfilesByWeight as w, mergeSkillsWithWarnings as x, mergeRulesWithWarnings as y, getIdePlatformTargetDir as z };
14644
- //# sourceMappingURL=src-BgiJfm14.mjs.map
14684
+ export { SourceParseError as $, discoverProfilesInSourceRepo as A, getIdePlatformTargetDir as B, isLockedProfile as C, resolveProfileChain as D, resolveProfileSupport as E, writeLock as F, getAllAdapters as G, idePlatformRegistry as H, resolveVersion as I, loadLockfile as J, parseFrontmatter as K, cloneGitSource as L, removePlacedFiles as M, generateLock as N, detectLegacyPaths as O, readLock as P, FileNotFoundError as Q, collectProfileSupportPatterns as R, getProfileWeight as S, mergeContentParts as T, isKnownIdePlatform as U, getRegisteredIdePlatforms as V, getAdaptersForKeys as W, loadProjectManifest as X, loadProfileManifest as Y, KEBAB_CASE_REGEX as Z, mergeMemoryWithWarnings as _, clearIdeCache as a, mergeSkills as b, getDefaultGlobalSource as c, getGlobalSources as d, getAgentConfig as et, removeGlobalSource as f, mergeMemory as g, require_lib as h, computeIntersection as i, findSourceManifest as j, placeFile as k, getGlobalAiTools as l, setGlobalIdePlatforms as m, readProjectPreferences as n, getAllAgentKeys as nt, detectInstalledIdes as o, setGlobalAiTools as p, parseSource as q, writeProjectPreferences as r, addGlobalSource as s, resolvePreferences as t, getAgentPath as tt, getGlobalIdePlatforms as u, mergeRules as v, sortProfilesByWeight as w, mergeSkillsWithWarnings as x, mergeRulesWithWarnings as y, updateGitignore as z };
14685
+ //# sourceMappingURL=src-C3-Vz-R7.mjs.map