@baton-dx/cli 0.4.0 → 0.4.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.
- package/dist/{create-SYKl8g0B.mjs → create-DYQJmn8s.mjs} +2 -2
- package/dist/{create-SYKl8g0B.mjs.map → create-DYQJmn8s.mjs.map} +1 -1
- package/dist/index.mjs +9 -120
- package/dist/index.mjs.map +1 -1
- package/dist/{list-UzuMEqbc.mjs → list-o1wqD5W_.mjs} +2 -2
- package/dist/{list-UzuMEqbc.mjs.map → list-o1wqD5W_.mjs.map} +1 -1
- package/dist/{src-D41VR6ro.mjs → src-CHISlTPa.mjs} +2 -2
- package/dist/{src-D41VR6ro.mjs.map → src-CHISlTPa.mjs.map} +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { r as __toESM } from "./chunk-BbwQpWto.mjs";
|
|
3
3
|
import { a as Ne, h as defineCommand, i as Le, l as We, p as Ct, t as findSourceRoot, u as Ze } from "./context-detection-DqOTnD6_.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { et as KEBAB_CASE_REGEX, h as require_lib } from "./src-CHISlTPa.mjs";
|
|
5
5
|
import "./ai-tool-detection-CMsBNa9e.mjs";
|
|
6
6
|
import "./esm-BagM-kVd.mjs";
|
|
7
7
|
import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
|
@@ -79,4 +79,4 @@ async function copyProfileTemplate(sourceDir, targetDir, variables) {
|
|
|
79
79
|
|
|
80
80
|
//#endregion
|
|
81
81
|
export { createCommand };
|
|
82
|
-
//# sourceMappingURL=create-
|
|
82
|
+
//# sourceMappingURL=create-DYQJmn8s.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-
|
|
1
|
+
{"version":3,"file":"create-DYQJmn8s.mjs","names":["p.text","p.isCancel","Handlebars"],"sources":["../src/commands/profile/create.ts"],"sourcesContent":["import { mkdir, readFile, readdir, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { KEBAB_CASE_REGEX } from \"@baton-dx/core\";\nimport * as p from \"@clack/prompts\";\nimport { defineCommand } from \"citty\";\nimport Handlebars from \"handlebars\";\nimport { findSourceRoot } from \"../../utils/context-detection.js\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport const createCommand = defineCommand({\n meta: {\n name: \"create\",\n description: \"Create a new profile in your source repository\",\n },\n args: {\n name: {\n type: \"positional\",\n description: \"Profile name (kebab-case)\",\n required: false,\n },\n },\n async run({ args }) {\n p.intro(\"Create Profile\");\n\n // Check for baton.source.yaml in current or parent directories\n const sourceRoot = await findSourceRoot();\n if (!sourceRoot) {\n p.cancel(\"This command must be run inside a source directory (baton.source.yaml not found)\");\n process.exit(1);\n }\n\n // Get profile name — from argument or wizard prompt\n let name = args.name as string | undefined;\n\n if (!name) {\n const nameInput = await p.text({\n message: \"Profile name (kebab-case)\",\n placeholder: \"e.g., backend, frontend, my-profile\",\n validate(value) {\n if (!value || value.trim().length === 0) {\n return \"Profile name is required\";\n }\n if (!KEBAB_CASE_REGEX.test(value.trim())) {\n return \"Profile name must be in kebab-case (e.g., my-profile, backend, frontend)\";\n }\n },\n });\n\n if (p.isCancel(nameInput)) {\n p.cancel(\"Cancelled.\");\n process.exit(0);\n }\n\n name = (nameInput as string).trim();\n }\n\n // Validate name format (kebab-case)\n if (!KEBAB_CASE_REGEX.test(name)) {\n p.cancel(\"Profile name must be in kebab-case (e.g., my-profile, backend, frontend)\");\n process.exit(1);\n }\n\n // Check if profile already exists in profiles/ directory\n const targetDir = join(sourceRoot, \"profiles\", name);\n try {\n await readdir(targetDir);\n p.cancel(`Profile '${name}' already exists in profiles/${name}/`);\n process.exit(1);\n } catch {\n // Directory doesn't exist - good to proceed\n }\n\n // Create profile directory\n await mkdir(targetDir, { recursive: true });\n\n // Copy minimal template files\n const templateDir = join(__dirname, \"templates\", \"profile\", \"minimal\");\n await copyProfileTemplate(templateDir, targetDir, { name });\n\n p.outro(`Profile '${name}' created in profiles/${name}/`);\n },\n});\n\n/**\n * Recursively copy profile template with variable substitution\n */\nasync function copyProfileTemplate(\n sourceDir: string,\n targetDir: string,\n variables: { name: string },\n): Promise<void> {\n const entries = await readdir(sourceDir, { withFileTypes: true });\n\n for (const entry of entries) {\n const sourcePath = join(sourceDir, entry.name);\n const targetPath = join(targetDir, entry.name);\n\n if (entry.isDirectory()) {\n await mkdir(targetPath, { recursive: true });\n await copyProfileTemplate(sourcePath, targetPath, variables);\n } else {\n // Read file content\n const content = await readFile(sourcePath, \"utf-8\");\n\n // Apply Handlebars substitution for text files\n const processed = Handlebars.compile(content, { noEscape: true })(variables);\n\n // Write processed content\n await writeFile(targetPath, processed, \"utf-8\");\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AASA,MAAM,YAAY,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAEzD,MAAa,gBAAgB,cAAc;CACzC,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAAM,EACJ,MAAM;EACJ,MAAM;EACN,aAAa;EACb,UAAU;EACX,EACF;CACD,MAAM,IAAI,EAAE,QAAQ;AAClB,KAAQ,iBAAiB;EAGzB,MAAM,aAAa,MAAM,gBAAgB;AACzC,MAAI,CAAC,YAAY;AACf,MAAS,mFAAmF;AAC5F,WAAQ,KAAK,EAAE;;EAIjB,IAAI,OAAO,KAAK;AAEhB,MAAI,CAAC,MAAM;GACT,MAAM,YAAY,MAAMA,GAAO;IAC7B,SAAS;IACT,aAAa;IACb,SAAS,OAAO;AACd,SAAI,CAAC,SAAS,MAAM,MAAM,CAAC,WAAW,EACpC,QAAO;AAET,SAAI,CAAC,iBAAiB,KAAK,MAAM,MAAM,CAAC,CACtC,QAAO;;IAGZ,CAAC;AAEF,OAAIC,GAAW,UAAU,EAAE;AACzB,OAAS,aAAa;AACtB,YAAQ,KAAK,EAAE;;AAGjB,UAAQ,UAAqB,MAAM;;AAIrC,MAAI,CAAC,iBAAiB,KAAK,KAAK,EAAE;AAChC,MAAS,2EAA2E;AACpF,WAAQ,KAAK,EAAE;;EAIjB,MAAM,YAAY,KAAK,YAAY,YAAY,KAAK;AACpD,MAAI;AACF,SAAM,QAAQ,UAAU;AACxB,MAAS,YAAY,KAAK,+BAA+B,KAAK,GAAG;AACjE,WAAQ,KAAK,EAAE;UACT;AAKR,QAAM,MAAM,WAAW,EAAE,WAAW,MAAM,CAAC;AAI3C,QAAM,oBADc,KAAK,WAAW,aAAa,WAAW,UAAU,EAC/B,WAAW,EAAE,MAAM,CAAC;AAE3D,KAAQ,YAAY,KAAK,wBAAwB,KAAK,GAAG;;CAE5D,CAAC;;;;AAKF,eAAe,oBACb,WACA,WACA,WACe;CACf,MAAM,UAAU,MAAM,QAAQ,WAAW,EAAE,eAAe,MAAM,CAAC;AAEjE,MAAK,MAAM,SAAS,SAAS;EAC3B,MAAM,aAAa,KAAK,WAAW,MAAM,KAAK;EAC9C,MAAM,aAAa,KAAK,WAAW,MAAM,KAAK;AAE9C,MAAI,MAAM,aAAa,EAAE;AACvB,SAAM,MAAM,YAAY,EAAE,WAAW,MAAM,CAAC;AAC5C,SAAM,oBAAoB,YAAY,YAAY,UAAU;SACvD;GAEL,MAAM,UAAU,MAAM,SAAS,YAAY,QAAQ;AAMnD,SAAM,UAAU,YAHEC,mBAAW,QAAQ,SAAS,EAAE,UAAU,MAAM,CAAC,CAAC,UAAU,EAGrC,QAAQ"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { r as __toESM } from "./chunk-BbwQpWto.mjs";
|
|
3
3
|
import { a as Ne, c as Ve, d as bt, f as je, g as runMain, h as defineCommand, i as Le, l as We, m as require_dist, o as R, p as Ct, r as Je, s as Re, t as findSourceRoot, u as Ze } from "./context-detection-DqOTnD6_.mjs";
|
|
4
|
-
import { $ as
|
|
4
|
+
import { $ as loadProjectManifest, A as placeFile, B as ensureBatonDirGitignored, C as getProfileWeight, D as resolveProfileSupport, E as mergeContentParts, F as readLock, G as idePlatformRegistry, H as updateGitignore, I as writeLock, J as getAllAIToolAdapters, K as isKnownIdePlatform, L as resolveVersion, M as findSourceManifest, N as removePlacedFiles, O as resolveProfileChain, P as generateLock, Q as loadProfileManifest, R as cloneGitSource, S as mergeSkillsWithWarnings, T as sortProfilesByWeight, U as getIdePlatformTargetDir, V as removeGitignoreManagedSection, W as getRegisteredIdePlatforms, X as parseSource, Y as parseFrontmatter, Z as loadLockfile, _ as mergeMemoryWithWarnings, a as clearIdeCache, at as getAllAIToolKeys, b as mergeRulesWithWarnings, c as getDefaultGlobalSource, d as getGlobalSources, et as KEBAB_CASE_REGEX, f as removeGlobalSource, g as mergeMemory, h as require_lib, i as computeIntersection, it as getAIToolPath, j as discoverProfilesInSourceRepo, k as detectLegacyPaths, l as getGlobalAiTools, m as setGlobalIdePlatforms, n as readProjectPreferences, nt as SourceParseError, o as detectInstalledIdes, p as setGlobalAiTools, q as getAIToolAdaptersForKeys, r as writeProjectPreferences, rt as getAIToolConfig, s as addGlobalSource, t as resolvePreferences, tt as FileNotFoundError, u as getGlobalIdePlatforms, v as mergeAgentsWithWarnings, w as isLockedProfile, x as mergeSkills, y as mergeRules, z as collectComprehensivePatterns } from "./src-CHISlTPa.mjs";
|
|
5
5
|
import { n as detectInstalledAITools, t as clearAIToolCache } from "./ai-tool-detection-CMsBNa9e.mjs";
|
|
6
6
|
import { d as esm_default } from "./esm-BagM-kVd.mjs";
|
|
7
7
|
import { access, mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
|
|
@@ -252,7 +252,7 @@ const aiToolsListCommand = defineCommand({
|
|
|
252
252
|
}
|
|
253
253
|
console.log("");
|
|
254
254
|
}
|
|
255
|
-
Le("Manage tools: 'baton ai-tools scan' (detect) | 'baton
|
|
255
|
+
Le("Manage tools: 'baton ai-tools scan' (detect) | 'baton ai-tools configure' (select)");
|
|
256
256
|
}
|
|
257
257
|
});
|
|
258
258
|
/**
|
|
@@ -341,7 +341,6 @@ const aiToolsCommand = defineCommand({
|
|
|
341
341
|
|
|
342
342
|
//#endregion
|
|
343
343
|
//#region src/utils/build-intersection.ts
|
|
344
|
-
var import_dist = require_dist();
|
|
345
344
|
/**
|
|
346
345
|
* Compute the intersection for a single profile source string.
|
|
347
346
|
* Shared utility used by sync, config, and manage commands.
|
|
@@ -420,26 +419,6 @@ function formatIntersectionSummary(intersection) {
|
|
|
420
419
|
|
|
421
420
|
//#endregion
|
|
422
421
|
//#region src/commands/config.ts
|
|
423
|
-
const VALID_KEYS = [
|
|
424
|
-
"cache-dir",
|
|
425
|
-
"default-scope",
|
|
426
|
-
"symlink-mode",
|
|
427
|
-
"default-tools"
|
|
428
|
-
];
|
|
429
|
-
async function loadConfig() {
|
|
430
|
-
const configFile = getGlobalConfigPath();
|
|
431
|
-
try {
|
|
432
|
-
await access(configFile);
|
|
433
|
-
} catch {
|
|
434
|
-
return {};
|
|
435
|
-
}
|
|
436
|
-
return (0, import_dist.parse)(await readFile(configFile, "utf-8"));
|
|
437
|
-
}
|
|
438
|
-
async function saveConfig(config) {
|
|
439
|
-
const configFile = getGlobalConfigPath();
|
|
440
|
-
await mkdir(getBatonHome(), { recursive: true });
|
|
441
|
-
await writeFile(configFile, (0, import_dist.stringify)(config), "utf-8");
|
|
442
|
-
}
|
|
443
422
|
async function showDashboard() {
|
|
444
423
|
We("Baton Dashboard");
|
|
445
424
|
const [sources, aiTools, idePlatforms, projectManifest] = await Promise.all([
|
|
@@ -520,7 +499,7 @@ async function showDashboard() {
|
|
|
520
499
|
}
|
|
521
500
|
}
|
|
522
501
|
console.log("");
|
|
523
|
-
Le("
|
|
502
|
+
Le("Manage tools: 'baton ai-tools configure' | 'baton ides configure'");
|
|
524
503
|
}
|
|
525
504
|
async function loadProjectManifestSafe$1() {
|
|
526
505
|
try {
|
|
@@ -532,101 +511,10 @@ async function loadProjectManifestSafe$1() {
|
|
|
532
511
|
const configCommand = defineCommand({
|
|
533
512
|
meta: {
|
|
534
513
|
name: "config",
|
|
535
|
-
description: "Show Baton dashboard overview
|
|
536
|
-
},
|
|
537
|
-
args: {
|
|
538
|
-
action: {
|
|
539
|
-
type: "positional",
|
|
540
|
-
description: "Action: set, get, or list",
|
|
541
|
-
required: false
|
|
542
|
-
},
|
|
543
|
-
key: {
|
|
544
|
-
type: "positional",
|
|
545
|
-
description: "Configuration key",
|
|
546
|
-
required: false
|
|
547
|
-
},
|
|
548
|
-
value: {
|
|
549
|
-
type: "positional",
|
|
550
|
-
description: "Configuration value (for set)",
|
|
551
|
-
required: false
|
|
552
|
-
}
|
|
514
|
+
description: "Show Baton dashboard overview"
|
|
553
515
|
},
|
|
554
|
-
async run(
|
|
555
|
-
|
|
556
|
-
const key = args.key;
|
|
557
|
-
const value = args.value;
|
|
558
|
-
if (!action) {
|
|
559
|
-
await showDashboard();
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
562
|
-
const selectedAction = action;
|
|
563
|
-
if (selectedAction === "list") {
|
|
564
|
-
We("⚙️ Baton Configuration");
|
|
565
|
-
const config = await loadConfig();
|
|
566
|
-
if (Object.keys(config).length === 0) {
|
|
567
|
-
Le("No configuration set. Using defaults.");
|
|
568
|
-
return;
|
|
569
|
-
}
|
|
570
|
-
console.log("");
|
|
571
|
-
for (const [configKey, configValue] of Object.entries(config)) console.log(`${configKey}: ${Array.isArray(configValue) ? configValue.join(", ") : configValue}`);
|
|
572
|
-
console.log("");
|
|
573
|
-
Le("Configuration loaded");
|
|
574
|
-
return;
|
|
575
|
-
}
|
|
576
|
-
if (selectedAction === "get") {
|
|
577
|
-
if (!key) {
|
|
578
|
-
We("⚙️ Baton Configuration");
|
|
579
|
-
Le("Error: Missing key argument. Usage: baton config get <key>");
|
|
580
|
-
process.exit(1);
|
|
581
|
-
}
|
|
582
|
-
if (!VALID_KEYS.includes(key)) {
|
|
583
|
-
We("⚙️ Baton Configuration");
|
|
584
|
-
Le(`Error: Invalid key "${key}". Valid keys: ${VALID_KEYS.join(", ")}`);
|
|
585
|
-
process.exit(1);
|
|
586
|
-
}
|
|
587
|
-
const configValue = (await loadConfig())[key];
|
|
588
|
-
if (configValue === void 0) {
|
|
589
|
-
We("⚙️ Baton Configuration");
|
|
590
|
-
Le(`"${key}" is not set (using default)`);
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
console.log(Array.isArray(configValue) ? configValue.join(", ") : configValue);
|
|
594
|
-
return;
|
|
595
|
-
}
|
|
596
|
-
if (selectedAction === "set") {
|
|
597
|
-
if (!key || !value) {
|
|
598
|
-
We("⚙️ Baton Configuration");
|
|
599
|
-
Le("Error: Missing arguments. Usage: baton config set <key> <value>");
|
|
600
|
-
process.exit(1);
|
|
601
|
-
}
|
|
602
|
-
if (!VALID_KEYS.includes(key)) {
|
|
603
|
-
We("⚙️ Baton Configuration");
|
|
604
|
-
Le(`Error: Invalid key "${key}". Valid keys: ${VALID_KEYS.join(", ")}`);
|
|
605
|
-
process.exit(1);
|
|
606
|
-
}
|
|
607
|
-
We("⚙️ Baton Configuration");
|
|
608
|
-
const config = await loadConfig();
|
|
609
|
-
if (key === "default-scope") {
|
|
610
|
-
if (value !== "project" && value !== "global") {
|
|
611
|
-
Le("Error: default-scope must be either \"project\" or \"global\"");
|
|
612
|
-
process.exit(1);
|
|
613
|
-
}
|
|
614
|
-
config["default-scope"] = value;
|
|
615
|
-
} else if (key === "symlink-mode") {
|
|
616
|
-
if (value !== "true" && value !== "false") {
|
|
617
|
-
Le("Error: symlink-mode must be either \"true\" or \"false\"");
|
|
618
|
-
process.exit(1);
|
|
619
|
-
}
|
|
620
|
-
config["symlink-mode"] = value === "true";
|
|
621
|
-
} else if (key === "default-tools") config["default-tools"] = value.split(",").map((s) => s.trim());
|
|
622
|
-
else if (key === "cache-dir") config["cache-dir"] = value;
|
|
623
|
-
await saveConfig(config);
|
|
624
|
-
Le(`✓ Set ${key} = ${Array.isArray(config[key]) ? config[key].join(", ") : config[key]}`);
|
|
625
|
-
return;
|
|
626
|
-
}
|
|
627
|
-
We("⚙️ Baton Configuration");
|
|
628
|
-
Le(`Error: Unknown action "${selectedAction}". Use: set, get, or list`);
|
|
629
|
-
process.exit(1);
|
|
516
|
+
async run() {
|
|
517
|
+
await showDashboard();
|
|
630
518
|
}
|
|
631
519
|
});
|
|
632
520
|
|
|
@@ -1283,6 +1171,7 @@ const idesCommand = defineCommand({
|
|
|
1283
1171
|
|
|
1284
1172
|
//#endregion
|
|
1285
1173
|
//#region src/utils/first-run-preferences.ts
|
|
1174
|
+
var import_dist = require_dist();
|
|
1286
1175
|
/**
|
|
1287
1176
|
* Format an IDE platform key into a display name.
|
|
1288
1177
|
* Duplicated here to avoid circular dependency with ides/utils.
|
|
@@ -2279,8 +2168,8 @@ const profileCommand = defineCommand({
|
|
|
2279
2168
|
description: "Manage profiles (create, list, remove)"
|
|
2280
2169
|
},
|
|
2281
2170
|
subCommands: {
|
|
2282
|
-
create: () => import("./create-
|
|
2283
|
-
list: () => import("./list-
|
|
2171
|
+
create: () => import("./create-DYQJmn8s.mjs").then((m) => m.createCommand),
|
|
2172
|
+
list: () => import("./list-o1wqD5W_.mjs").then((m) => m.profileListCommand),
|
|
2284
2173
|
remove: () => import("./remove-BBs6Mv8t.mjs").then((m) => m.profileRemoveCommand)
|
|
2285
2174
|
}
|
|
2286
2175
|
});
|