aiblueprint-cli 1.4.57 → 1.4.58
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/cli.js +99 -46
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -33587,6 +33587,46 @@ async function mergeCodexConfigFile(sourceConfigPath, codexDir) {
|
|
|
33587
33587
|
// src/lib/configs-store.ts
|
|
33588
33588
|
var import_fs_extra7 = __toESM(require_lib4(), 1);
|
|
33589
33589
|
import path11 from "path";
|
|
33590
|
+
var COMMON_EXCLUDED_NAMES = new Set([
|
|
33591
|
+
".git",
|
|
33592
|
+
".DS_Store",
|
|
33593
|
+
"node_modules"
|
|
33594
|
+
]);
|
|
33595
|
+
var EXCLUDED_RUNTIME_PATHS = {
|
|
33596
|
+
".claude": new Set([
|
|
33597
|
+
"backups",
|
|
33598
|
+
"cache",
|
|
33599
|
+
"debug",
|
|
33600
|
+
"file-history",
|
|
33601
|
+
"logs",
|
|
33602
|
+
"output",
|
|
33603
|
+
"paste-cache",
|
|
33604
|
+
"plugins/cache",
|
|
33605
|
+
"projects",
|
|
33606
|
+
"session-env",
|
|
33607
|
+
"sessions",
|
|
33608
|
+
"stats-cache.json",
|
|
33609
|
+
"security.log"
|
|
33610
|
+
]),
|
|
33611
|
+
".codex": new Set([
|
|
33612
|
+
"archived_sessions",
|
|
33613
|
+
"browser/sessions",
|
|
33614
|
+
"cache",
|
|
33615
|
+
"log",
|
|
33616
|
+
"logs_2.sqlite",
|
|
33617
|
+
"logs_2.sqlite-shm",
|
|
33618
|
+
"logs_2.sqlite-wal",
|
|
33619
|
+
"models_cache.json",
|
|
33620
|
+
"plugins/cache",
|
|
33621
|
+
"sessions",
|
|
33622
|
+
"vendor_imports/skills-curated-cache.json"
|
|
33623
|
+
]),
|
|
33624
|
+
".agents": new Set([
|
|
33625
|
+
"cache",
|
|
33626
|
+
"logs",
|
|
33627
|
+
"sessions"
|
|
33628
|
+
])
|
|
33629
|
+
};
|
|
33590
33630
|
function getConfigStorePaths(rootDir) {
|
|
33591
33631
|
const baseDir = path11.join(rootDir, ".aiblueprint");
|
|
33592
33632
|
return {
|
|
@@ -33633,14 +33673,33 @@ async function hasContent(folderPath) {
|
|
|
33633
33673
|
const entries = await import_fs_extra7.default.readdir(folderPath);
|
|
33634
33674
|
return entries.some((entry) => entry !== ".DS_Store");
|
|
33635
33675
|
}
|
|
33636
|
-
|
|
33676
|
+
function normalizeRelativePath(relativePath) {
|
|
33677
|
+
return relativePath.split(path11.sep).join("/");
|
|
33678
|
+
}
|
|
33679
|
+
function shouldCopyManagedPath(folderName, sourceRoot, sourcePath) {
|
|
33680
|
+
const basename = path11.basename(sourcePath);
|
|
33681
|
+
if (COMMON_EXCLUDED_NAMES.has(basename))
|
|
33682
|
+
return false;
|
|
33683
|
+
const relativePath = normalizeRelativePath(path11.relative(sourceRoot, sourcePath));
|
|
33684
|
+
if (!relativePath)
|
|
33685
|
+
return true;
|
|
33686
|
+
const excludedPaths = EXCLUDED_RUNTIME_PATHS[folderName];
|
|
33687
|
+
if (excludedPaths.has(relativePath))
|
|
33688
|
+
return false;
|
|
33689
|
+
for (const excludedPath of excludedPaths) {
|
|
33690
|
+
if (relativePath.startsWith(`${excludedPath}/`))
|
|
33691
|
+
return false;
|
|
33692
|
+
}
|
|
33693
|
+
return true;
|
|
33694
|
+
}
|
|
33695
|
+
async function copyManagedFolder(name, source, destination) {
|
|
33637
33696
|
await import_fs_extra7.default.copy(source, destination, {
|
|
33638
33697
|
overwrite: true,
|
|
33639
33698
|
dereference: false,
|
|
33640
33699
|
filter: async (src) => {
|
|
33641
33700
|
try {
|
|
33642
33701
|
const stat = await import_fs_extra7.default.lstat(src);
|
|
33643
|
-
return !stat.isSymbolicLink();
|
|
33702
|
+
return !stat.isSymbolicLink() && shouldCopyManagedPath(name, source, src);
|
|
33644
33703
|
} catch {
|
|
33645
33704
|
return true;
|
|
33646
33705
|
}
|
|
@@ -33676,7 +33735,7 @@ async function snapshotByCopy(snapshotPath, folders, metadata) {
|
|
|
33676
33735
|
for (const folder of managedFolders(folders)) {
|
|
33677
33736
|
if (!await hasContent(folder.path))
|
|
33678
33737
|
continue;
|
|
33679
|
-
await copyManagedFolder(folder.path, path11.join(snapshotPath, folder.name));
|
|
33738
|
+
await copyManagedFolder(folder.name, folder.path, path11.join(snapshotPath, folder.name));
|
|
33680
33739
|
copied.push(folder.name);
|
|
33681
33740
|
}
|
|
33682
33741
|
if (copied.length === 0) {
|
|
@@ -33769,7 +33828,7 @@ async function restoreSnapshot(snapshotPath, folders) {
|
|
|
33769
33828
|
if (!await import_fs_extra7.default.pathExists(source))
|
|
33770
33829
|
continue;
|
|
33771
33830
|
await import_fs_extra7.default.ensureDir(path11.dirname(folder.path));
|
|
33772
|
-
await copyManagedFolder(source, folder.path);
|
|
33831
|
+
await copyManagedFolder(folder.name, source, folder.path);
|
|
33773
33832
|
restored.push(folder.name);
|
|
33774
33833
|
}
|
|
33775
33834
|
return restored;
|
|
@@ -36740,6 +36799,7 @@ function printSnapshots(title, snapshots) {
|
|
|
36740
36799
|
}
|
|
36741
36800
|
async function configsSaveCommand(name, options = {}) {
|
|
36742
36801
|
try {
|
|
36802
|
+
console.log(source_default.gray("Saving .claude, .codex, and .agents config files..."));
|
|
36743
36803
|
const snapshotPath = await saveNamedConfig(name, options);
|
|
36744
36804
|
console.log(source_default.green(`Saved config "${name}"`));
|
|
36745
36805
|
console.log(source_default.gray(snapshotPath));
|
|
@@ -36750,6 +36810,7 @@ async function configsSaveCommand(name, options = {}) {
|
|
|
36750
36810
|
}
|
|
36751
36811
|
async function configsLoadCommand(name, options = {}) {
|
|
36752
36812
|
try {
|
|
36813
|
+
console.log(source_default.gray(`Loading config "${name}"...`));
|
|
36753
36814
|
const result = await loadNamedConfig(name, options);
|
|
36754
36815
|
console.log(source_default.green(`Loaded config "${name}"`));
|
|
36755
36816
|
if (result.backupPath) {
|
|
@@ -36763,6 +36824,7 @@ async function configsLoadCommand(name, options = {}) {
|
|
|
36763
36824
|
}
|
|
36764
36825
|
async function configsUndoCommand(options = {}) {
|
|
36765
36826
|
try {
|
|
36827
|
+
console.log(source_default.gray("Restoring the previous config backup..."));
|
|
36766
36828
|
const result = await undoLastLoad(options);
|
|
36767
36829
|
console.log(source_default.green(`Undid last config load using backup "${result.backupName}"`));
|
|
36768
36830
|
if (result.backupPath) {
|
|
@@ -36784,6 +36846,7 @@ async function configsBackupsListCommand(options = {}) {
|
|
|
36784
36846
|
}
|
|
36785
36847
|
async function configsBackupsLoadCommand(name, options = {}) {
|
|
36786
36848
|
try {
|
|
36849
|
+
console.log(source_default.gray(`Loading backup "${name}"...`));
|
|
36787
36850
|
const result = await loadBackupSnapshot(name, options);
|
|
36788
36851
|
console.log(source_default.green(`Loaded backup "${name}"`));
|
|
36789
36852
|
if (result.backupPath) {
|
|
@@ -36797,6 +36860,7 @@ async function configsBackupsLoadCommand(name, options = {}) {
|
|
|
36797
36860
|
}
|
|
36798
36861
|
async function configsBackupsCreateCommand(reason, options = {}) {
|
|
36799
36862
|
try {
|
|
36863
|
+
console.log(source_default.gray("Creating config backup..."));
|
|
36800
36864
|
const backupPath = await createConfigBackup(options, reason ?? "Manual backup from configs backups create", "manual-backup", "manual");
|
|
36801
36865
|
if (!backupPath) {
|
|
36802
36866
|
console.log(source_default.gray("No .claude, .codex, or .agents configuration found to backup."));
|
|
@@ -37370,6 +37434,16 @@ function registerAgentsCommands(cmd) {
|
|
|
37370
37434
|
function addConfigFolderOptions(cmd) {
|
|
37371
37435
|
return cmd.option("-f, --folder <path>", "Root folder that contains .claude/, .codex/, .agents/ (default: $HOME)").option("--claudeCodeFolder <path>", "Override Claude Code folder (default: {folder}/.claude)").option("--codexFolder <path>", "Override Codex folder (default: {folder}/.codex)").option("--agentsFolder <path>", "Override shared agents folder (default: {folder}/.agents)");
|
|
37372
37436
|
}
|
|
37437
|
+
function readConfigOptions(command, options = {}) {
|
|
37438
|
+
const parentOptions = command.parent?.opts() ?? {};
|
|
37439
|
+
const grandParentOptions = command.parent?.parent?.opts() ?? {};
|
|
37440
|
+
return {
|
|
37441
|
+
folder: options.folder ?? parentOptions.folder ?? grandParentOptions.folder,
|
|
37442
|
+
claudeCodeFolder: options.claudeCodeFolder ?? parentOptions.claudeCodeFolder ?? grandParentOptions.claudeCodeFolder,
|
|
37443
|
+
codexFolder: options.codexFolder ?? parentOptions.codexFolder ?? grandParentOptions.codexFolder,
|
|
37444
|
+
agentsFolder: options.agentsFolder ?? parentOptions.agentsFolder ?? grandParentOptions.agentsFolder
|
|
37445
|
+
};
|
|
37446
|
+
}
|
|
37373
37447
|
var agentsCmd = program2.command("agents").description("AI coding configuration commands");
|
|
37374
37448
|
registerAgentsCommands(agentsCmd);
|
|
37375
37449
|
var aiCodingCmd = program2.command("ai-coding").description("Legacy alias for agents configuration commands");
|
|
@@ -37377,69 +37451,48 @@ registerAgentsCommands(aiCodingCmd);
|
|
|
37377
37451
|
var claudeCodeCmd = program2.command("claude-code").description("Legacy alias for agents configuration commands");
|
|
37378
37452
|
registerAgentsCommands(claudeCodeCmd);
|
|
37379
37453
|
var configsCmd = addConfigFolderOptions(program2.command("configs").description("Save, load, undo, and inspect .claude/.codex/.agents configurations"));
|
|
37380
|
-
configsCmd.command("save <name>").description("Save the current .claude, .codex, and .agents folders as a named config").option("--force", "Overwrite an existing saved config with the same name").action((name, options, command) => {
|
|
37381
|
-
const
|
|
37454
|
+
addConfigFolderOptions(configsCmd.command("save <name>").description("Save the current .claude, .codex, and .agents folders as a named config").option("--force", "Overwrite an existing saved config with the same name")).action((name, options, command) => {
|
|
37455
|
+
const folderOptions = readConfigOptions(command, options);
|
|
37382
37456
|
configsSaveCommand(name, {
|
|
37383
|
-
|
|
37384
|
-
claudeCodeFolder: parentOptions.claudeCodeFolder,
|
|
37385
|
-
codexFolder: parentOptions.codexFolder,
|
|
37386
|
-
agentsFolder: parentOptions.agentsFolder,
|
|
37457
|
+
...folderOptions,
|
|
37387
37458
|
force: options.force
|
|
37388
37459
|
});
|
|
37389
37460
|
});
|
|
37390
|
-
configsCmd.command("load <name>").description("Load a named config and backup the current folders first").action((name, options, command) => {
|
|
37391
|
-
const
|
|
37461
|
+
addConfigFolderOptions(configsCmd.command("load <name>").description("Load a named config and backup the current folders first")).action((name, options, command) => {
|
|
37462
|
+
const folderOptions = readConfigOptions(command, options);
|
|
37392
37463
|
configsLoadCommand(name, {
|
|
37393
|
-
|
|
37394
|
-
claudeCodeFolder: parentOptions.claudeCodeFolder,
|
|
37395
|
-
codexFolder: parentOptions.codexFolder,
|
|
37396
|
-
agentsFolder: parentOptions.agentsFolder
|
|
37464
|
+
...folderOptions
|
|
37397
37465
|
});
|
|
37398
37466
|
});
|
|
37399
|
-
configsCmd.command("undo").description("Undo the most recent configs load by restoring its automatic backup").action((options, command) => {
|
|
37400
|
-
const
|
|
37467
|
+
addConfigFolderOptions(configsCmd.command("undo").description("Undo the most recent configs load by restoring its automatic backup")).action((options, command) => {
|
|
37468
|
+
const folderOptions = readConfigOptions(command, options);
|
|
37401
37469
|
configsUndoCommand({
|
|
37402
|
-
|
|
37403
|
-
claudeCodeFolder: parentOptions.claudeCodeFolder,
|
|
37404
|
-
codexFolder: parentOptions.codexFolder,
|
|
37405
|
-
agentsFolder: parentOptions.agentsFolder
|
|
37470
|
+
...folderOptions
|
|
37406
37471
|
});
|
|
37407
37472
|
});
|
|
37408
|
-
configsCmd.command("list").description("List saved named configs").action((options, command) => {
|
|
37409
|
-
const
|
|
37473
|
+
addConfigFolderOptions(configsCmd.command("list").description("List saved named configs")).action((options, command) => {
|
|
37474
|
+
const folderOptions = readConfigOptions(command, options);
|
|
37410
37475
|
configsListCommand({
|
|
37411
|
-
|
|
37412
|
-
claudeCodeFolder: parentOptions.claudeCodeFolder,
|
|
37413
|
-
codexFolder: parentOptions.codexFolder,
|
|
37414
|
-
agentsFolder: parentOptions.agentsFolder
|
|
37476
|
+
...folderOptions
|
|
37415
37477
|
});
|
|
37416
37478
|
});
|
|
37417
37479
|
var configsBackupsCmd = configsCmd.command("backups").description("Manage automatic config backups");
|
|
37418
|
-
configsBackupsCmd.command("list").description("List automatic backups with reasons").action((options, command) => {
|
|
37419
|
-
const
|
|
37480
|
+
addConfigFolderOptions(configsBackupsCmd.command("list").description("List automatic backups with reasons")).action((options, command) => {
|
|
37481
|
+
const folderOptions = readConfigOptions(command, options);
|
|
37420
37482
|
configsBackupsListCommand({
|
|
37421
|
-
|
|
37422
|
-
claudeCodeFolder: parentOptions.claudeCodeFolder,
|
|
37423
|
-
codexFolder: parentOptions.codexFolder,
|
|
37424
|
-
agentsFolder: parentOptions.agentsFolder
|
|
37483
|
+
...folderOptions
|
|
37425
37484
|
});
|
|
37426
37485
|
});
|
|
37427
|
-
configsBackupsCmd.command("load <name>").description("Load a backup and backup the current folders first").action((name, options, command) => {
|
|
37428
|
-
const
|
|
37486
|
+
addConfigFolderOptions(configsBackupsCmd.command("load <name>").description("Load a backup and backup the current folders first")).action((name, options, command) => {
|
|
37487
|
+
const folderOptions = readConfigOptions(command, options);
|
|
37429
37488
|
configsBackupsLoadCommand(name, {
|
|
37430
|
-
|
|
37431
|
-
claudeCodeFolder: parentOptions.claudeCodeFolder,
|
|
37432
|
-
codexFolder: parentOptions.codexFolder,
|
|
37433
|
-
agentsFolder: parentOptions.agentsFolder
|
|
37489
|
+
...folderOptions
|
|
37434
37490
|
});
|
|
37435
37491
|
});
|
|
37436
|
-
configsBackupsCmd.command("create [reason]").description("Create a manual backup of the current config folders").action((reason, options, command) => {
|
|
37437
|
-
const
|
|
37492
|
+
addConfigFolderOptions(configsBackupsCmd.command("create [reason]").description("Create a manual backup of the current config folders")).action((reason, options, command) => {
|
|
37493
|
+
const folderOptions = readConfigOptions(command, options);
|
|
37438
37494
|
configsBackupsCreateCommand(reason, {
|
|
37439
|
-
|
|
37440
|
-
claudeCodeFolder: parentOptions.claudeCodeFolder,
|
|
37441
|
-
codexFolder: parentOptions.codexFolder,
|
|
37442
|
-
agentsFolder: parentOptions.agentsFolder
|
|
37495
|
+
...folderOptions
|
|
37443
37496
|
});
|
|
37444
37497
|
});
|
|
37445
37498
|
var openclawCmd = program2.command("openclaw").description("OpenClaw configuration commands").option("-f, --folder <path>", "Specify custom OpenClaw folder path (default: ~/.openclaw)");
|