aiblueprint-cli 1.4.52 → 1.4.54
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/agents-config/codex-config/AGENTS.md +5 -0
- package/dist/cli.js +326 -216
- package/package.json +1 -1
- /package/agents-config/{scripts → claude-config/scripts}/.claude/commands/fix-on-my-computer.md +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/CLAUDE.md +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/biome.json +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/bun.lockb +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/package.json +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/CLAUDE.md +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/README.md +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/__tests__/context.test.ts +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/__tests__/formatters.test.ts +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/__tests__/statusline.test.ts +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/data/.gitignore +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/data/.gitkeep +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/defaults.json +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/docs/ARCHITECTURE.md +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/fixtures/mock-transcript.jsonl +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/fixtures/test-input.json +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/src/index.ts +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/src/lib/config-types.ts +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/src/lib/config.ts +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/src/lib/context.ts +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/src/lib/formatters.ts +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/src/lib/git.ts +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/src/lib/menu-factories.ts +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/src/lib/presets.ts +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/src/lib/render-pure.ts +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/src/lib/types.ts +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/src/lib/utils.ts +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/src/tests/spend-v2.test.ts +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/statusline.config.json +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/test-with-fixtures.ts +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/test.ts +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/statusline/tsconfig.json +0 -0
- /package/agents-config/{scripts → claude-config/scripts}/tsconfig.json +0 -0
package/dist/cli.js
CHANGED
|
@@ -32264,8 +32264,8 @@ var lib_default = inquirer;
|
|
|
32264
32264
|
|
|
32265
32265
|
// src/commands/setup.ts
|
|
32266
32266
|
var import_fs_extra8 = __toESM(require_lib4(), 1);
|
|
32267
|
-
import
|
|
32268
|
-
import
|
|
32267
|
+
import path12 from "path";
|
|
32268
|
+
import os12 from "os";
|
|
32269
32269
|
|
|
32270
32270
|
// node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
32271
32271
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
@@ -33535,18 +33535,40 @@ async function flushTelemetry() {
|
|
|
33535
33535
|
var import_fs_extra7 = __toESM(require_lib4(), 1);
|
|
33536
33536
|
import os10 from "os";
|
|
33537
33537
|
import path10 from "path";
|
|
33538
|
-
|
|
33539
|
-
|
|
33540
|
-
|
|
33538
|
+
async function applyPathPlaceholders(target, claudeDir) {
|
|
33539
|
+
const stat = await import_fs_extra7.default.stat(target).catch(() => null);
|
|
33540
|
+
if (!stat)
|
|
33541
|
+
return;
|
|
33542
|
+
if (stat.isDirectory()) {
|
|
33543
|
+
await replacePathPlaceholdersInDir(target, claudeDir);
|
|
33544
|
+
} else if (isTextFile(target)) {
|
|
33545
|
+
const content = await import_fs_extra7.default.readFile(target, "utf-8");
|
|
33546
|
+
const replaced = replaceClaudePathPlaceholder(content, claudeDir);
|
|
33547
|
+
if (replaced !== content) {
|
|
33548
|
+
await import_fs_extra7.default.writeFile(target, replaced, "utf-8");
|
|
33549
|
+
}
|
|
33550
|
+
}
|
|
33541
33551
|
}
|
|
33552
|
+
var AGENT_CATEGORIES = ["skills", "agents"];
|
|
33542
33553
|
async function platformSymlink(source, target) {
|
|
33543
33554
|
await import_fs_extra7.default.ensureDir(path10.dirname(target));
|
|
33544
33555
|
const isWindows2 = os10.platform() === "win32";
|
|
33545
33556
|
const sourceStat = await import_fs_extra7.default.stat(source).catch(() => null);
|
|
33546
|
-
|
|
33557
|
+
const isDir = sourceStat?.isDirectory() ?? false;
|
|
33558
|
+
if (isWindows2 && isDir) {
|
|
33547
33559
|
await import_fs_extra7.default.symlink(source, target, "junction");
|
|
33548
|
-
|
|
33560
|
+
return;
|
|
33561
|
+
}
|
|
33562
|
+
try {
|
|
33549
33563
|
await import_fs_extra7.default.symlink(source, target);
|
|
33564
|
+
} catch (error) {
|
|
33565
|
+
if (!isWindows2 || isDir)
|
|
33566
|
+
throw error;
|
|
33567
|
+
try {
|
|
33568
|
+
await import_fs_extra7.default.link(source, target);
|
|
33569
|
+
} catch {
|
|
33570
|
+
await import_fs_extra7.default.copy(source, target, { overwrite: true });
|
|
33571
|
+
}
|
|
33550
33572
|
}
|
|
33551
33573
|
}
|
|
33552
33574
|
async function installCategoryToAgents(sourceCategoryDir, category, agentsDir, claudeDir, options = {}) {
|
|
@@ -33581,13 +33603,13 @@ async function installCategoryToAgents(sourceCategoryDir, category, agentsDir, c
|
|
|
33581
33603
|
}
|
|
33582
33604
|
if (!migrated) {
|
|
33583
33605
|
await import_fs_extra7.default.copy(sourcePath, agentsTarget, { overwrite: false });
|
|
33584
|
-
await
|
|
33606
|
+
await applyPathPlaceholders(agentsTarget, claudeDir);
|
|
33585
33607
|
result.copied.push(entry.name);
|
|
33586
33608
|
}
|
|
33587
33609
|
} else if (options.overwrite) {
|
|
33588
33610
|
await import_fs_extra7.default.remove(agentsTarget);
|
|
33589
33611
|
await import_fs_extra7.default.copy(sourcePath, agentsTarget, { overwrite: false });
|
|
33590
|
-
await
|
|
33612
|
+
await applyPathPlaceholders(agentsTarget, claudeDir);
|
|
33591
33613
|
result.copied.push(entry.name);
|
|
33592
33614
|
}
|
|
33593
33615
|
}
|
|
@@ -33641,15 +33663,38 @@ function isAgentCategory(category) {
|
|
|
33641
33663
|
return AGENT_CATEGORIES.includes(category);
|
|
33642
33664
|
}
|
|
33643
33665
|
|
|
33666
|
+
// src/lib/folder-paths.ts
|
|
33667
|
+
import os11 from "os";
|
|
33668
|
+
import path11 from "path";
|
|
33669
|
+
function resolveFolders(options = {}) {
|
|
33670
|
+
const rootDir = options.folder ? path11.resolve(options.folder) : os11.homedir();
|
|
33671
|
+
const claudeDir = options.claudeCodeFolder ? path11.resolve(options.claudeCodeFolder) : path11.join(rootDir, ".claude");
|
|
33672
|
+
const codexDir = options.codexFolder ? path11.resolve(options.codexFolder) : path11.join(rootDir, ".codex");
|
|
33673
|
+
const agentsDir = options.agentsFolder ? path11.resolve(options.agentsFolder) : path11.join(rootDir, ".agents");
|
|
33674
|
+
return { rootDir, claudeDir, codexDir, agentsDir };
|
|
33675
|
+
}
|
|
33676
|
+
|
|
33644
33677
|
// src/commands/setup.ts
|
|
33645
33678
|
var __filename2 = fileURLToPath2(import.meta.url);
|
|
33646
33679
|
var __dirname2 = dirname2(__filename2);
|
|
33680
|
+
async function resolveClaudeAssetPath(sourceDir, name) {
|
|
33681
|
+
const candidates = [
|
|
33682
|
+
path12.join(sourceDir, "claude-config", name),
|
|
33683
|
+
path12.join(sourceDir, name)
|
|
33684
|
+
];
|
|
33685
|
+
for (const candidate of candidates) {
|
|
33686
|
+
if (await import_fs_extra8.default.pathExists(candidate))
|
|
33687
|
+
return candidate;
|
|
33688
|
+
}
|
|
33689
|
+
return null;
|
|
33690
|
+
}
|
|
33647
33691
|
async function setupCommand(params = {}) {
|
|
33648
33692
|
const {
|
|
33649
|
-
|
|
33650
|
-
|
|
33651
|
-
|
|
33652
|
-
|
|
33693
|
+
folder,
|
|
33694
|
+
claudeCodeFolder,
|
|
33695
|
+
codexFolder,
|
|
33696
|
+
openCodeFolder,
|
|
33697
|
+
agentsFolder,
|
|
33653
33698
|
skipInteractive
|
|
33654
33699
|
} = params;
|
|
33655
33700
|
let repoPath = null;
|
|
@@ -33704,7 +33749,7 @@ async function setupCommand(params = {}) {
|
|
|
33704
33749
|
},
|
|
33705
33750
|
{
|
|
33706
33751
|
value: "codexSymlink",
|
|
33707
|
-
name: "Codex symlink - Link commands to ~/.codex
|
|
33752
|
+
name: "Codex symlink - Link commands/skills/agents to ~/.codex",
|
|
33708
33753
|
checked: false
|
|
33709
33754
|
},
|
|
33710
33755
|
{
|
|
@@ -33732,10 +33777,15 @@ async function setupCommand(params = {}) {
|
|
|
33732
33777
|
skipInteractive
|
|
33733
33778
|
};
|
|
33734
33779
|
const s = new SimpleSpinner;
|
|
33735
|
-
const claudeDir
|
|
33736
|
-
|
|
33737
|
-
|
|
33738
|
-
|
|
33780
|
+
const { claudeDir, codexDir, agentsDir } = resolveFolders({
|
|
33781
|
+
folder,
|
|
33782
|
+
claudeCodeFolder,
|
|
33783
|
+
codexFolder,
|
|
33784
|
+
agentsFolder
|
|
33785
|
+
});
|
|
33786
|
+
console.log(source_default.gray(`Claude: ${claudeDir}`));
|
|
33787
|
+
console.log(source_default.gray(`Codex: ${codexDir}`));
|
|
33788
|
+
console.log(source_default.gray(`Agents: ${agentsDir}`));
|
|
33739
33789
|
await import_fs_extra8.default.ensureDir(claudeDir);
|
|
33740
33790
|
await import_fs_extra8.default.ensureDir(agentsDir);
|
|
33741
33791
|
s.start("Creating backup of existing configuration");
|
|
@@ -33763,43 +33813,50 @@ async function setupCommand(params = {}) {
|
|
|
33763
33813
|
}
|
|
33764
33814
|
if (options.customStatusline) {
|
|
33765
33815
|
s.start("Setting up scripts");
|
|
33766
|
-
await
|
|
33767
|
-
|
|
33768
|
-
|
|
33769
|
-
|
|
33816
|
+
const scriptsSource = await resolveClaudeAssetPath(sourceDir, "scripts");
|
|
33817
|
+
if (scriptsSource) {
|
|
33818
|
+
await import_fs_extra8.default.copy(scriptsSource, path12.join(claudeDir, "scripts"), {
|
|
33819
|
+
overwrite: true
|
|
33820
|
+
});
|
|
33821
|
+
await replacePathPlaceholdersInDir(path12.join(claudeDir, "scripts"), claudeDir);
|
|
33822
|
+
await import_fs_extra8.default.ensureDir(path12.join(claudeDir, "scripts/statusline/data"));
|
|
33823
|
+
s.stop("Scripts installed");
|
|
33824
|
+
} else {
|
|
33825
|
+
s.stop("Scripts not available in repository");
|
|
33770
33826
|
}
|
|
33771
|
-
s.stop("Scripts installed");
|
|
33772
33827
|
}
|
|
33773
33828
|
if (options.aiblueprintCommands) {
|
|
33774
33829
|
s.start("Setting up AIBlueprint commands");
|
|
33775
|
-
const
|
|
33776
|
-
if (
|
|
33777
|
-
await import_fs_extra8.default.copy(
|
|
33778
|
-
|
|
33830
|
+
const commandsSource = await resolveClaudeAssetPath(sourceDir, "commands");
|
|
33831
|
+
if (commandsSource) {
|
|
33832
|
+
await import_fs_extra8.default.copy(commandsSource, path12.join(claudeDir, "commands"), {
|
|
33833
|
+
overwrite: true
|
|
33834
|
+
});
|
|
33835
|
+
await replacePathPlaceholdersInDir(path12.join(claudeDir, "commands"), claudeDir);
|
|
33779
33836
|
s.stop("Commands installed");
|
|
33780
33837
|
} else {
|
|
33781
33838
|
s.stop("Commands not available in repository");
|
|
33782
33839
|
}
|
|
33783
33840
|
}
|
|
33784
|
-
if (options.codexSymlink && options.aiblueprintCommands) {
|
|
33785
|
-
s.start("Setting up Codex symlink");
|
|
33786
|
-
await setupCodexSymlink(claudeDir, customCodexFolder, customClaudeCodeFolder);
|
|
33787
|
-
s.stop("Codex symlink configured");
|
|
33788
|
-
}
|
|
33789
|
-
if (options.openCodeSymlink && options.aiblueprintCommands) {
|
|
33790
|
-
s.start("Setting up OpenCode symlink");
|
|
33791
|
-
await setupOpenCodeSymlink(claudeDir, customOpenCodeFolder, customClaudeCodeFolder);
|
|
33792
|
-
s.stop("OpenCode symlink configured");
|
|
33793
|
-
}
|
|
33794
33841
|
if (options.aiblueprintAgents) {
|
|
33795
33842
|
s.start("Setting up AIBlueprint agents");
|
|
33796
|
-
|
|
33797
|
-
await
|
|
33798
|
-
|
|
33843
|
+
const agentsSource = path12.join(sourceDir, "agents");
|
|
33844
|
+
if (await import_fs_extra8.default.pathExists(agentsSource)) {
|
|
33845
|
+
const installResult = await installCategoryToAgents(agentsSource, "agents", agentsDir, claudeDir, { migrateClaudeDirs: true, silent: true });
|
|
33846
|
+
const summary = [
|
|
33847
|
+
installResult.copied.length && `${installResult.copied.length} copied`,
|
|
33848
|
+
installResult.migrated.length && `${installResult.migrated.length} migrated`,
|
|
33849
|
+
installResult.symlinked.length && `${installResult.symlinked.length} linked`,
|
|
33850
|
+
installResult.skipped.length && `${installResult.skipped.length} skipped`
|
|
33851
|
+
].filter(Boolean).join(", ");
|
|
33852
|
+
s.stop(`Agents installed${summary ? ` (${summary})` : ""}`);
|
|
33853
|
+
} else {
|
|
33854
|
+
s.stop("Agents not available in repository");
|
|
33855
|
+
}
|
|
33799
33856
|
}
|
|
33800
33857
|
if (options.aiblueprintSkills) {
|
|
33801
33858
|
s.start("Setting up AIBlueprint Skills");
|
|
33802
|
-
const skillsSourcePath =
|
|
33859
|
+
const skillsSourcePath = path12.join(sourceDir, "skills");
|
|
33803
33860
|
if (await import_fs_extra8.default.pathExists(skillsSourcePath)) {
|
|
33804
33861
|
const installResult = await installCategoryToAgents(skillsSourcePath, "skills", agentsDir, claudeDir, { migrateClaudeDirs: true, silent: true });
|
|
33805
33862
|
const summary = [
|
|
@@ -33818,6 +33875,28 @@ async function setupCommand(params = {}) {
|
|
|
33818
33875
|
s.stop("Skills not available in repository");
|
|
33819
33876
|
}
|
|
33820
33877
|
}
|
|
33878
|
+
if (options.codexSymlink) {
|
|
33879
|
+
s.start("Setting up Codex configuration");
|
|
33880
|
+
const codexConfigSource = path12.join(sourceDir, "codex-config");
|
|
33881
|
+
if (await import_fs_extra8.default.pathExists(codexConfigSource)) {
|
|
33882
|
+
await import_fs_extra8.default.copy(codexConfigSource, codexDir, { overwrite: false });
|
|
33883
|
+
}
|
|
33884
|
+
if (options.aiblueprintCommands) {
|
|
33885
|
+
await setupCodexSymlink(claudeDir, codexDir, claudeCodeFolder);
|
|
33886
|
+
}
|
|
33887
|
+
if (options.aiblueprintSkills) {
|
|
33888
|
+
await syncCategorySymlinks("skills", agentsDir, codexDir, undefined, true);
|
|
33889
|
+
}
|
|
33890
|
+
if (options.aiblueprintAgents) {
|
|
33891
|
+
await syncCategorySymlinks("agents", agentsDir, codexDir, undefined, true);
|
|
33892
|
+
}
|
|
33893
|
+
s.stop("Codex configured");
|
|
33894
|
+
}
|
|
33895
|
+
if (options.openCodeSymlink && options.aiblueprintCommands) {
|
|
33896
|
+
s.start("Setting up OpenCode symlink");
|
|
33897
|
+
await setupOpenCodeSymlink(claudeDir, openCodeFolder, claudeCodeFolder);
|
|
33898
|
+
s.stop("OpenCode symlink configured");
|
|
33899
|
+
}
|
|
33821
33900
|
if (options.customStatusline) {
|
|
33822
33901
|
s.start("Checking dependencies");
|
|
33823
33902
|
await checkAndInstallDependencies();
|
|
@@ -33854,7 +33933,7 @@ async function setupCommand(params = {}) {
|
|
|
33854
33933
|
console.log(source_default.gray(`
|
|
33855
33934
|
Next steps:`));
|
|
33856
33935
|
if (options.shellShortcuts) {
|
|
33857
|
-
const platform =
|
|
33936
|
+
const platform = os12.platform();
|
|
33858
33937
|
if (platform === "win32") {
|
|
33859
33938
|
console.log(source_default.gray(" • Restart PowerShell to load the new functions"));
|
|
33860
33939
|
} else {
|
|
@@ -33881,8 +33960,8 @@ Next steps:`));
|
|
|
33881
33960
|
|
|
33882
33961
|
// src/commands/setup-terminal.ts
|
|
33883
33962
|
var import_fs_extra9 = __toESM(require_lib4(), 1);
|
|
33884
|
-
import
|
|
33885
|
-
import
|
|
33963
|
+
import path13 from "path";
|
|
33964
|
+
import os13 from "os";
|
|
33886
33965
|
import { execSync as execSync3, exec as exec2 } from "child_process";
|
|
33887
33966
|
var OHMYZSH_INSTALL_URL = "https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh";
|
|
33888
33967
|
var INSTALL_TIMEOUT = 120000;
|
|
@@ -33916,7 +33995,7 @@ function commandExists(cmd) {
|
|
|
33916
33995
|
}
|
|
33917
33996
|
}
|
|
33918
33997
|
function isOhMyZshInstalled(homeDir) {
|
|
33919
|
-
const ohMyZshDir =
|
|
33998
|
+
const ohMyZshDir = path13.join(homeDir, ".oh-my-zsh");
|
|
33920
33999
|
return import_fs_extra9.default.existsSync(ohMyZshDir);
|
|
33921
34000
|
}
|
|
33922
34001
|
function backupFile(filePath) {
|
|
@@ -33964,7 +34043,7 @@ function installPrerequisiteSync(packageName, installCmd) {
|
|
|
33964
34043
|
async function installOhMyZsh(homeDir) {
|
|
33965
34044
|
return new Promise((resolve, reject) => {
|
|
33966
34045
|
const installCmd = `sh -c "$(curl -fsSL ${OHMYZSH_INSTALL_URL})" "" --unattended`;
|
|
33967
|
-
const env2 = { ...process.env, HOME: homeDir, ZSH:
|
|
34046
|
+
const env2 = { ...process.env, HOME: homeDir, ZSH: path13.join(homeDir, ".oh-my-zsh") };
|
|
33968
34047
|
exec2(installCmd, { timeout: INSTALL_TIMEOUT, env: env2 }, (error, stdout, stderr) => {
|
|
33969
34048
|
if (error) {
|
|
33970
34049
|
if ("killed" in error && error.killed) {
|
|
@@ -33985,7 +34064,7 @@ async function installPlugin(pluginName, repoUrl, homeDir) {
|
|
|
33985
34064
|
if (!/^https:\/\/github\.com\/[\w-]+\/[\w-]+$/.test(repoUrl)) {
|
|
33986
34065
|
throw new Error(`Invalid repository URL: ${repoUrl}`);
|
|
33987
34066
|
}
|
|
33988
|
-
const customPluginsDir =
|
|
34067
|
+
const customPluginsDir = path13.join(homeDir, ".oh-my-zsh/custom/plugins", pluginName);
|
|
33989
34068
|
if (import_fs_extra9.default.existsSync(customPluginsDir)) {
|
|
33990
34069
|
return;
|
|
33991
34070
|
}
|
|
@@ -34004,7 +34083,7 @@ async function installPlugin(pluginName, repoUrl, homeDir) {
|
|
|
34004
34083
|
});
|
|
34005
34084
|
}
|
|
34006
34085
|
function updateZshrcTheme(theme, homeDir) {
|
|
34007
|
-
const zshrcPath =
|
|
34086
|
+
const zshrcPath = path13.join(homeDir, ".zshrc");
|
|
34008
34087
|
const sanitizedTheme = sanitizeThemeName(theme);
|
|
34009
34088
|
if (!import_fs_extra9.default.existsSync(zshrcPath)) {
|
|
34010
34089
|
throw new Error(".zshrc file not found. Please ensure Oh My ZSH is installed correctly.");
|
|
@@ -34026,7 +34105,7 @@ ${content}`;
|
|
|
34026
34105
|
}
|
|
34027
34106
|
}
|
|
34028
34107
|
function updateZshrcPlugins(plugins, homeDir) {
|
|
34029
|
-
const zshrcPath =
|
|
34108
|
+
const zshrcPath = path13.join(homeDir, ".zshrc");
|
|
34030
34109
|
if (!import_fs_extra9.default.existsSync(zshrcPath)) {
|
|
34031
34110
|
throw new Error(".zshrc file not found. Please ensure Oh My ZSH is installed correctly.");
|
|
34032
34111
|
}
|
|
@@ -34049,7 +34128,7 @@ plugins=(${pluginsString})`;
|
|
|
34049
34128
|
}
|
|
34050
34129
|
async function setupTerminalCommand(options = {}) {
|
|
34051
34130
|
const { skipInteractive, homeDir: customHomeDir } = options;
|
|
34052
|
-
const homeDir = customHomeDir ||
|
|
34131
|
+
const homeDir = customHomeDir || os13.homedir();
|
|
34053
34132
|
try {
|
|
34054
34133
|
console.log(source_default.blue.bold(`
|
|
34055
34134
|
\uD83D\uDDA5️ AIBlueprint Terminal Setup ${source_default.gray(`v${getVersion()}`)}
|
|
@@ -34146,7 +34225,7 @@ Installing missing prerequisites: ${missingPrereqs.join(", ")}`));
|
|
|
34146
34225
|
selectedTheme = themeAnswer.theme;
|
|
34147
34226
|
}
|
|
34148
34227
|
}
|
|
34149
|
-
const zshrcPath =
|
|
34228
|
+
const zshrcPath = path13.join(homeDir, ".zshrc");
|
|
34150
34229
|
if (import_fs_extra9.default.existsSync(zshrcPath)) {
|
|
34151
34230
|
s.start("Backing up .zshrc");
|
|
34152
34231
|
const backupPath = backupFile(zshrcPath);
|
|
@@ -34313,9 +34392,14 @@ async function symlinkCommand(params = {}) {
|
|
|
34313
34392
|
}
|
|
34314
34393
|
]);
|
|
34315
34394
|
const selectedDestinations = destinationAnswer.destinations;
|
|
34395
|
+
const { claudeDir, codexDir } = resolveFolders({
|
|
34396
|
+
folder: params.folder,
|
|
34397
|
+
claudeCodeFolder: params.claudeCodeFolder,
|
|
34398
|
+
codexFolder: params.codexFolder
|
|
34399
|
+
});
|
|
34316
34400
|
const customFolders = {
|
|
34317
|
-
"claude-code":
|
|
34318
|
-
codex:
|
|
34401
|
+
"claude-code": claudeDir,
|
|
34402
|
+
codex: codexDir,
|
|
34319
34403
|
opencode: params.openCodeFolder,
|
|
34320
34404
|
factoryai: params.factoryAiFolder
|
|
34321
34405
|
};
|
|
@@ -35078,28 +35162,38 @@ var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
|
35078
35162
|
};
|
|
35079
35163
|
|
|
35080
35164
|
// src/commands/pro.ts
|
|
35081
|
-
import
|
|
35082
|
-
import path15 from "path";
|
|
35165
|
+
import path16 from "path";
|
|
35083
35166
|
|
|
35084
35167
|
// src/lib/pro-installer.ts
|
|
35085
35168
|
var import_fs_extra10 = __toESM(require_lib4(), 1);
|
|
35086
|
-
import
|
|
35087
|
-
import
|
|
35169
|
+
import os14 from "os";
|
|
35170
|
+
import path14 from "path";
|
|
35088
35171
|
import { exec as exec3 } from "child_process";
|
|
35089
35172
|
import { promisify as promisify2 } from "util";
|
|
35090
35173
|
var execAsync2 = promisify2(exec3);
|
|
35091
35174
|
var PREMIUM_REPO = "Melvynx/aiblueprint-cli-premium";
|
|
35092
35175
|
var PREMIUM_BRANCH = "main";
|
|
35093
35176
|
var CONFIG_FOLDER_CANDIDATES2 = ["agents-config", "ai-coding", "claude-code-config", "ai-config"];
|
|
35094
|
-
function
|
|
35095
|
-
const
|
|
35096
|
-
|
|
35097
|
-
|
|
35177
|
+
function routePath(relativePath) {
|
|
35178
|
+
const segments = relativePath.split(path14.sep);
|
|
35179
|
+
const first = segments[0];
|
|
35180
|
+
const rest = segments.slice(1).join(path14.sep);
|
|
35181
|
+
if (first === "claude-config") {
|
|
35182
|
+
return { kind: "claude", relativePath: rest };
|
|
35183
|
+
}
|
|
35184
|
+
if (first === "codex-config") {
|
|
35185
|
+
return { kind: "codex", relativePath: rest };
|
|
35098
35186
|
}
|
|
35099
|
-
|
|
35187
|
+
if (isAgentCategory(first)) {
|
|
35188
|
+
return { kind: "agents-category", category: first, relativePath };
|
|
35189
|
+
}
|
|
35190
|
+
if (first === ".claude") {
|
|
35191
|
+
return { kind: "claude", relativePath: rest };
|
|
35192
|
+
}
|
|
35193
|
+
return { kind: "claude", relativePath };
|
|
35100
35194
|
}
|
|
35101
35195
|
function getCacheRepoDir() {
|
|
35102
|
-
return
|
|
35196
|
+
return path14.join(os14.homedir(), ".config", "aiblueprint", "pro-repos", "aiblueprint-cli-premium");
|
|
35103
35197
|
}
|
|
35104
35198
|
async function execGitWithAuth(command, token, repoUrl, cwd) {
|
|
35105
35199
|
const authenticatedUrl = `https://x-access-token:${token}@${repoUrl.replace(/^https?:\/\//, "")}`;
|
|
@@ -35113,57 +35207,53 @@ async function execGitWithAuth(command, token, repoUrl, cwd) {
|
|
|
35113
35207
|
async function cloneOrUpdateRepo(token) {
|
|
35114
35208
|
const cacheDir = getCacheRepoDir();
|
|
35115
35209
|
const repoUrl = `https://github.com/${PREMIUM_REPO}.git`;
|
|
35116
|
-
if (await import_fs_extra10.default.pathExists(
|
|
35210
|
+
if (await import_fs_extra10.default.pathExists(path14.join(cacheDir, ".git"))) {
|
|
35117
35211
|
try {
|
|
35118
35212
|
await execGitWithAuth("pull", token, repoUrl, cacheDir);
|
|
35119
35213
|
} catch (error) {
|
|
35120
35214
|
await import_fs_extra10.default.remove(cacheDir);
|
|
35121
|
-
await import_fs_extra10.default.ensureDir(
|
|
35215
|
+
await import_fs_extra10.default.ensureDir(path14.dirname(cacheDir));
|
|
35122
35216
|
await execGitWithAuth(`clone ${repoUrl} ${cacheDir}`, token, repoUrl);
|
|
35123
35217
|
}
|
|
35124
35218
|
} else {
|
|
35125
|
-
await import_fs_extra10.default.ensureDir(
|
|
35219
|
+
await import_fs_extra10.default.ensureDir(path14.dirname(cacheDir));
|
|
35126
35220
|
await execGitWithAuth(`clone ${repoUrl} ${cacheDir}`, token, repoUrl);
|
|
35127
35221
|
}
|
|
35128
35222
|
for (const candidate of CONFIG_FOLDER_CANDIDATES2) {
|
|
35129
|
-
const candidatePath =
|
|
35223
|
+
const candidatePath = path14.join(cacheDir, candidate);
|
|
35130
35224
|
if (await import_fs_extra10.default.pathExists(candidatePath)) {
|
|
35131
35225
|
return candidatePath;
|
|
35132
35226
|
}
|
|
35133
35227
|
}
|
|
35134
35228
|
throw new Error("Premium repo missing config folder (agents-config, ai-coding, or claude-code-config)");
|
|
35135
35229
|
}
|
|
35136
|
-
async function copyConfigFromCache(cacheConfigDir,
|
|
35230
|
+
async function copyConfigFromCache(cacheConfigDir, dest, onProgress) {
|
|
35137
35231
|
const walk = async (dir, baseDir = dir) => {
|
|
35138
35232
|
const entries = await import_fs_extra10.default.readdir(dir, { withFileTypes: true });
|
|
35139
35233
|
for (const entry of entries) {
|
|
35140
|
-
|
|
35141
|
-
const relativePath = path13.relative(baseDir, sourcePath);
|
|
35142
|
-
if (entry.isDirectory() && entry.name === ".claude" && dir === baseDir) {
|
|
35143
|
-
await walk(sourcePath, sourcePath);
|
|
35234
|
+
if (entry.name === ".DS_Store" || entry.name === "node_modules")
|
|
35144
35235
|
continue;
|
|
35145
|
-
|
|
35146
|
-
const
|
|
35147
|
-
const
|
|
35148
|
-
if (
|
|
35149
|
-
|
|
35150
|
-
|
|
35151
|
-
|
|
35152
|
-
|
|
35153
|
-
if (claudeStat && !claudeStat.isSymbolicLink()) {
|
|
35154
|
-
onProgress?.(`${relativePath} (skipped - real dir)`, "file");
|
|
35155
|
-
continue;
|
|
35156
|
-
}
|
|
35236
|
+
const sourcePath = path14.join(dir, entry.name);
|
|
35237
|
+
const relativePath = path14.relative(baseDir, sourcePath);
|
|
35238
|
+
const route = routePath(relativePath);
|
|
35239
|
+
if (route.kind === "skip")
|
|
35240
|
+
continue;
|
|
35241
|
+
if (route.kind === "agents-category") {
|
|
35242
|
+
if (relativePath.split(path14.sep).length === 1) {
|
|
35243
|
+
await copyAgentCategory(sourcePath, route.category, dest.agentsDir, dest.claudeDir, onProgress);
|
|
35157
35244
|
}
|
|
35245
|
+
continue;
|
|
35158
35246
|
}
|
|
35247
|
+
const targetBase = route.kind === "claude" ? dest.claudeDir : dest.codexDir;
|
|
35248
|
+
const targetPath = path14.join(targetBase, route.relativePath);
|
|
35159
35249
|
if (entry.isDirectory()) {
|
|
35160
35250
|
await import_fs_extra10.default.ensureDir(targetPath);
|
|
35161
35251
|
onProgress?.(relativePath, "directory");
|
|
35162
35252
|
await walk(sourcePath, baseDir);
|
|
35163
35253
|
} else if (isTextFile(entry.name)) {
|
|
35164
35254
|
const content = await import_fs_extra10.default.readFile(sourcePath, "utf-8");
|
|
35165
|
-
const replaced = replaceClaudePathPlaceholder(content, claudeDir);
|
|
35166
|
-
await import_fs_extra10.default.ensureDir(
|
|
35255
|
+
const replaced = replaceClaudePathPlaceholder(content, dest.claudeDir);
|
|
35256
|
+
await import_fs_extra10.default.ensureDir(path14.dirname(targetPath));
|
|
35167
35257
|
await import_fs_extra10.default.writeFile(targetPath, replaced, "utf-8");
|
|
35168
35258
|
onProgress?.(relativePath, "file");
|
|
35169
35259
|
} else {
|
|
@@ -35174,6 +35264,26 @@ async function copyConfigFromCache(cacheConfigDir, claudeDir, agentsDir, onProgr
|
|
|
35174
35264
|
};
|
|
35175
35265
|
await walk(cacheConfigDir);
|
|
35176
35266
|
}
|
|
35267
|
+
async function copyAgentCategory(sourceCategoryDir, category, agentsDir, claudeDir, onProgress) {
|
|
35268
|
+
const agentsCategoryDir = path14.join(agentsDir, category);
|
|
35269
|
+
await import_fs_extra10.default.ensureDir(agentsCategoryDir);
|
|
35270
|
+
const entries = await import_fs_extra10.default.readdir(sourceCategoryDir, { withFileTypes: true });
|
|
35271
|
+
for (const entry of entries) {
|
|
35272
|
+
if (entry.name === ".DS_Store")
|
|
35273
|
+
continue;
|
|
35274
|
+
const src = path14.join(sourceCategoryDir, entry.name);
|
|
35275
|
+
const dst = path14.join(agentsCategoryDir, entry.name);
|
|
35276
|
+
const claudeTop = path14.join(claudeDir, category, entry.name);
|
|
35277
|
+
const claudeStat = await import_fs_extra10.default.lstat(claudeTop).catch(() => null);
|
|
35278
|
+
if (claudeStat && !claudeStat.isSymbolicLink()) {
|
|
35279
|
+
onProgress?.(`${category}/${entry.name} (skipped - real dir in claude)`, "file");
|
|
35280
|
+
continue;
|
|
35281
|
+
}
|
|
35282
|
+
await import_fs_extra10.default.copy(src, dst, { overwrite: true });
|
|
35283
|
+
await replacePathPlaceholdersInDir(dst, claudeDir);
|
|
35284
|
+
onProgress?.(`${category}/${entry.name}`, entry.isDirectory() ? "directory" : "file");
|
|
35285
|
+
}
|
|
35286
|
+
}
|
|
35177
35287
|
async function downloadFromPrivateGitHub(repo, branch, relativePath, targetPath, githubToken) {
|
|
35178
35288
|
try {
|
|
35179
35289
|
const url = `https://raw.githubusercontent.com/${repo}/${branch}/${relativePath}`;
|
|
@@ -35188,7 +35298,7 @@ async function downloadFromPrivateGitHub(repo, branch, relativePath, targetPath,
|
|
|
35188
35298
|
return false;
|
|
35189
35299
|
}
|
|
35190
35300
|
const content = await response.arrayBuffer();
|
|
35191
|
-
await import_fs_extra10.default.ensureDir(
|
|
35301
|
+
await import_fs_extra10.default.ensureDir(path14.dirname(targetPath));
|
|
35192
35302
|
await import_fs_extra10.default.writeFile(targetPath, Buffer.from(content));
|
|
35193
35303
|
return true;
|
|
35194
35304
|
} catch (error) {
|
|
@@ -35217,7 +35327,7 @@ async function downloadDirectoryFromPrivateGitHub(repo, branch, dirPath, targetD
|
|
|
35217
35327
|
await import_fs_extra10.default.ensureDir(targetDir);
|
|
35218
35328
|
for (const file of files) {
|
|
35219
35329
|
const relativePath = dirPath ? `${dirPath}/${file.name}` : file.name;
|
|
35220
|
-
const targetPath =
|
|
35330
|
+
const targetPath = path14.join(targetDir, file.name);
|
|
35221
35331
|
const displayPath = relativePath.replace(/^(agents-config|ai-coding|claude-code-config|ai-config)\//, "");
|
|
35222
35332
|
if (file.type === "file") {
|
|
35223
35333
|
onProgress?.(displayPath, "file");
|
|
@@ -35233,20 +35343,25 @@ async function downloadDirectoryFromPrivateGitHub(repo, branch, dirPath, targetD
|
|
|
35233
35343
|
}
|
|
35234
35344
|
}
|
|
35235
35345
|
async function installProConfigs(options) {
|
|
35236
|
-
const { githubToken, claudeCodeFolder, agentsFolder, onProgress } = options;
|
|
35237
|
-
const
|
|
35238
|
-
|
|
35239
|
-
|
|
35346
|
+
const { githubToken, folder, claudeCodeFolder, codexFolder, agentsFolder, onProgress } = options;
|
|
35347
|
+
const { claudeDir, codexDir, agentsDir } = resolveFolders({
|
|
35348
|
+
folder,
|
|
35349
|
+
claudeCodeFolder,
|
|
35350
|
+
codexFolder,
|
|
35351
|
+
agentsFolder
|
|
35352
|
+
});
|
|
35353
|
+
await import_fs_extra10.default.ensureDir(claudeDir);
|
|
35240
35354
|
await import_fs_extra10.default.ensureDir(agentsDir);
|
|
35355
|
+
const dest = { claudeDir, codexDir, agentsDir };
|
|
35241
35356
|
try {
|
|
35242
35357
|
const cacheConfigDir = await cloneOrUpdateRepo(githubToken);
|
|
35243
|
-
await copyConfigFromCache(cacheConfigDir,
|
|
35244
|
-
await syncAllAgentSymlinks(agentsDir,
|
|
35358
|
+
await copyConfigFromCache(cacheConfigDir, dest, onProgress);
|
|
35359
|
+
await syncAllAgentSymlinks(agentsDir, claudeDir);
|
|
35245
35360
|
return;
|
|
35246
35361
|
} catch (error) {
|
|
35247
35362
|
console.warn("Git caching failed, falling back to API download");
|
|
35248
35363
|
}
|
|
35249
|
-
const tempDir =
|
|
35364
|
+
const tempDir = path14.join(os14.tmpdir(), `aiblueprint-premium-${Date.now()}`);
|
|
35250
35365
|
try {
|
|
35251
35366
|
let success = false;
|
|
35252
35367
|
for (const candidate of CONFIG_FOLDER_CANDIDATES2) {
|
|
@@ -35257,20 +35372,15 @@ async function installProConfigs(options) {
|
|
|
35257
35372
|
if (!success) {
|
|
35258
35373
|
throw new Error("Failed to download premium configurations");
|
|
35259
35374
|
}
|
|
35260
|
-
|
|
35261
|
-
|
|
35262
|
-
await import_fs_extra10.default.copy(dotClaudeDir, tempDir, { overwrite: true });
|
|
35263
|
-
await import_fs_extra10.default.remove(dotClaudeDir);
|
|
35264
|
-
}
|
|
35265
|
-
await copyTreeWithRouting(tempDir, claudeFolder, agentsDir);
|
|
35266
|
-
await replacePathPlaceholdersInDir(claudeFolder, claudeFolder);
|
|
35375
|
+
await copyConfigFromCache(tempDir, dest, onProgress);
|
|
35376
|
+
await replacePathPlaceholdersInDir(claudeDir, claudeDir);
|
|
35267
35377
|
for (const category of AGENT_CATEGORIES) {
|
|
35268
|
-
const agentsCategoryDir =
|
|
35378
|
+
const agentsCategoryDir = path14.join(agentsDir, category);
|
|
35269
35379
|
if (await import_fs_extra10.default.pathExists(agentsCategoryDir)) {
|
|
35270
|
-
await replacePathPlaceholdersInDir(agentsCategoryDir,
|
|
35380
|
+
await replacePathPlaceholdersInDir(agentsCategoryDir, claudeDir);
|
|
35271
35381
|
}
|
|
35272
35382
|
}
|
|
35273
|
-
await syncAllAgentSymlinks(agentsDir,
|
|
35383
|
+
await syncAllAgentSymlinks(agentsDir, claudeDir);
|
|
35274
35384
|
} catch (error) {
|
|
35275
35385
|
throw new Error(`Failed to install premium configs: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
35276
35386
|
} finally {
|
|
@@ -35279,28 +35389,6 @@ async function installProConfigs(options) {
|
|
|
35279
35389
|
} catch {}
|
|
35280
35390
|
}
|
|
35281
35391
|
}
|
|
35282
|
-
async function copyTreeWithRouting(source, claudeDir, agentsDir) {
|
|
35283
|
-
const entries = await import_fs_extra10.default.readdir(source, { withFileTypes: true });
|
|
35284
|
-
for (const entry of entries) {
|
|
35285
|
-
const src = path13.join(source, entry.name);
|
|
35286
|
-
const { base } = resolveBaseDir(entry.name, claudeDir, agentsDir);
|
|
35287
|
-
const dst = path13.join(base, entry.name);
|
|
35288
|
-
if (entry.isDirectory() && isAgentCategory(entry.name)) {
|
|
35289
|
-
const inner = await import_fs_extra10.default.readdir(src, { withFileTypes: true });
|
|
35290
|
-
for (const innerEntry of inner) {
|
|
35291
|
-
const innerSrc = path13.join(src, innerEntry.name);
|
|
35292
|
-
const innerDst = path13.join(dst, innerEntry.name);
|
|
35293
|
-
const claudeTop = path13.join(claudeDir, entry.name, innerEntry.name);
|
|
35294
|
-
const claudeStat = await import_fs_extra10.default.lstat(claudeTop).catch(() => null);
|
|
35295
|
-
if (claudeStat && !claudeStat.isSymbolicLink())
|
|
35296
|
-
continue;
|
|
35297
|
-
await import_fs_extra10.default.copy(innerSrc, innerDst, { overwrite: true });
|
|
35298
|
-
}
|
|
35299
|
-
} else {
|
|
35300
|
-
await import_fs_extra10.default.copy(src, dst, { overwrite: true });
|
|
35301
|
-
}
|
|
35302
|
-
}
|
|
35303
|
-
}
|
|
35304
35392
|
async function syncAllAgentSymlinks(agentsDir, claudeDir) {
|
|
35305
35393
|
for (const category of AGENT_CATEGORIES) {
|
|
35306
35394
|
await syncCategorySymlinks(category, agentsDir, claudeDir, undefined, true);
|
|
@@ -35309,24 +35397,24 @@ async function syncAllAgentSymlinks(agentsDir, claudeDir) {
|
|
|
35309
35397
|
|
|
35310
35398
|
// src/lib/token-storage.ts
|
|
35311
35399
|
var import_fs_extra11 = __toESM(require_lib4(), 1);
|
|
35312
|
-
import
|
|
35313
|
-
import
|
|
35400
|
+
import os15 from "os";
|
|
35401
|
+
import path15 from "path";
|
|
35314
35402
|
function getConfigDir() {
|
|
35315
|
-
const platform =
|
|
35403
|
+
const platform = os15.platform();
|
|
35316
35404
|
if (platform === "win32") {
|
|
35317
|
-
const appData = process.env.APPDATA ||
|
|
35318
|
-
return
|
|
35405
|
+
const appData = process.env.APPDATA || path15.join(os15.homedir(), "AppData", "Roaming");
|
|
35406
|
+
return path15.join(appData, "aiblueprint");
|
|
35319
35407
|
} else {
|
|
35320
|
-
const configHome = process.env.XDG_CONFIG_HOME ||
|
|
35321
|
-
return
|
|
35408
|
+
const configHome = process.env.XDG_CONFIG_HOME || path15.join(os15.homedir(), ".config");
|
|
35409
|
+
return path15.join(configHome, "aiblueprint");
|
|
35322
35410
|
}
|
|
35323
35411
|
}
|
|
35324
35412
|
function getTokenFilePath2() {
|
|
35325
|
-
return
|
|
35413
|
+
return path15.join(getConfigDir(), "token.txt");
|
|
35326
35414
|
}
|
|
35327
35415
|
async function saveToken(githubToken) {
|
|
35328
35416
|
const tokenFile = getTokenFilePath2();
|
|
35329
|
-
const configDir =
|
|
35417
|
+
const configDir = path15.dirname(tokenFile);
|
|
35330
35418
|
try {
|
|
35331
35419
|
await import_fs_extra11.default.ensureDir(configDir);
|
|
35332
35420
|
} catch (error) {
|
|
@@ -35353,7 +35441,7 @@ async function getToken() {
|
|
|
35353
35441
|
function getTokenInfo() {
|
|
35354
35442
|
return {
|
|
35355
35443
|
path: getTokenFilePath2(),
|
|
35356
|
-
platform:
|
|
35444
|
+
platform: os15.platform()
|
|
35357
35445
|
};
|
|
35358
35446
|
}
|
|
35359
35447
|
|
|
@@ -35368,7 +35456,7 @@ async function countInstalledItems(claudeDir) {
|
|
|
35368
35456
|
skills: 0
|
|
35369
35457
|
};
|
|
35370
35458
|
try {
|
|
35371
|
-
const commandsDir =
|
|
35459
|
+
const commandsDir = path16.join(claudeDir, "commands");
|
|
35372
35460
|
if (await import_fs_extra12.default.pathExists(commandsDir)) {
|
|
35373
35461
|
const files = await import_fs_extra12.default.readdir(commandsDir);
|
|
35374
35462
|
counts.commands = files.filter((f) => f.endsWith(".md")).length;
|
|
@@ -35377,7 +35465,7 @@ async function countInstalledItems(claudeDir) {
|
|
|
35377
35465
|
console.error("Failed to count commands:", error instanceof Error ? error.message : error);
|
|
35378
35466
|
}
|
|
35379
35467
|
try {
|
|
35380
|
-
const agentsDir =
|
|
35468
|
+
const agentsDir = path16.join(claudeDir, "agents");
|
|
35381
35469
|
if (await import_fs_extra12.default.pathExists(agentsDir)) {
|
|
35382
35470
|
const files = await import_fs_extra12.default.readdir(agentsDir);
|
|
35383
35471
|
counts.agents = files.filter((f) => f.endsWith(".md")).length;
|
|
@@ -35386,11 +35474,11 @@ async function countInstalledItems(claudeDir) {
|
|
|
35386
35474
|
console.error("Failed to count agents:", error instanceof Error ? error.message : error);
|
|
35387
35475
|
}
|
|
35388
35476
|
try {
|
|
35389
|
-
const skillsDir =
|
|
35477
|
+
const skillsDir = path16.join(claudeDir, "skills");
|
|
35390
35478
|
if (await import_fs_extra12.default.pathExists(skillsDir)) {
|
|
35391
35479
|
const items = await import_fs_extra12.default.readdir(skillsDir);
|
|
35392
35480
|
const dirs = await Promise.all(items.map(async (item) => {
|
|
35393
|
-
const stat = await import_fs_extra12.default.stat(
|
|
35481
|
+
const stat = await import_fs_extra12.default.stat(path16.join(skillsDir, item));
|
|
35394
35482
|
return stat.isDirectory();
|
|
35395
35483
|
}));
|
|
35396
35484
|
counts.skills = dirs.filter(Boolean).length;
|
|
@@ -35506,7 +35594,7 @@ async function proSetupCommand(options = {}) {
|
|
|
35506
35594
|
Se(source_default.red("❌ Not activated"));
|
|
35507
35595
|
process.exit(1);
|
|
35508
35596
|
}
|
|
35509
|
-
const claudeDir =
|
|
35597
|
+
const { claudeDir } = resolveFolders(options);
|
|
35510
35598
|
const spinner = Y2();
|
|
35511
35599
|
const onProgress = (file, type) => {
|
|
35512
35600
|
spinner.message(`Installing: ${source_default.cyan(file)} ${source_default.gray(`(${type})`)}`);
|
|
@@ -35514,7 +35602,9 @@ async function proSetupCommand(options = {}) {
|
|
|
35514
35602
|
spinner.start("Installing premium configurations...");
|
|
35515
35603
|
await installProConfigs({
|
|
35516
35604
|
githubToken,
|
|
35517
|
-
|
|
35605
|
+
folder: options.folder,
|
|
35606
|
+
claudeCodeFolder: options.claudeCodeFolder,
|
|
35607
|
+
codexFolder: options.codexFolder,
|
|
35518
35608
|
agentsFolder: options.agentsFolder,
|
|
35519
35609
|
onProgress
|
|
35520
35610
|
});
|
|
@@ -35580,7 +35670,9 @@ async function proUpdateCommand(options = {}) {
|
|
|
35580
35670
|
spinner.start("Updating premium configurations...");
|
|
35581
35671
|
await installProConfigs({
|
|
35582
35672
|
githubToken,
|
|
35583
|
-
|
|
35673
|
+
folder: options.folder,
|
|
35674
|
+
claudeCodeFolder: options.claudeCodeFolder,
|
|
35675
|
+
codexFolder: options.codexFolder,
|
|
35584
35676
|
agentsFolder: options.agentsFolder
|
|
35585
35677
|
});
|
|
35586
35678
|
spinner.stop("Premium configurations updated");
|
|
@@ -35597,13 +35689,9 @@ async function proUpdateCommand(options = {}) {
|
|
|
35597
35689
|
}
|
|
35598
35690
|
}
|
|
35599
35691
|
|
|
35600
|
-
// src/commands/sync.ts
|
|
35601
|
-
import os16 from "os";
|
|
35602
|
-
import path17 from "path";
|
|
35603
|
-
|
|
35604
35692
|
// src/lib/sync-utils.ts
|
|
35605
35693
|
var import_fs_extra13 = __toESM(require_lib4(), 1);
|
|
35606
|
-
import
|
|
35694
|
+
import path17 from "path";
|
|
35607
35695
|
import crypto from "crypto";
|
|
35608
35696
|
var PREMIUM_REPO2 = "Melvynx/aiblueprint-cli-premium";
|
|
35609
35697
|
var PREMIUM_BRANCH2 = "main";
|
|
@@ -35689,7 +35777,7 @@ async function listLocalFiles(dir) {
|
|
|
35689
35777
|
for (const item of items) {
|
|
35690
35778
|
if (item === "node_modules" || item === ".DS_Store")
|
|
35691
35779
|
continue;
|
|
35692
|
-
const fullPath =
|
|
35780
|
+
const fullPath = path17.join(dir, item);
|
|
35693
35781
|
const stat = await import_fs_extra13.default.stat(fullPath).catch(() => null);
|
|
35694
35782
|
if (!stat)
|
|
35695
35783
|
continue;
|
|
@@ -35709,7 +35797,7 @@ async function listLocalFilesRecursive(dir, basePath) {
|
|
|
35709
35797
|
for (const item of items) {
|
|
35710
35798
|
if (item === "node_modules" || item === ".DS_Store")
|
|
35711
35799
|
continue;
|
|
35712
|
-
const fullPath =
|
|
35800
|
+
const fullPath = path17.join(dir, item);
|
|
35713
35801
|
const relativePath = `${basePath}/${item}`;
|
|
35714
35802
|
const stat = await import_fs_extra13.default.stat(fullPath).catch(() => null);
|
|
35715
35803
|
if (!stat)
|
|
@@ -35732,7 +35820,7 @@ async function listClaudeRealTopLevel(claudeCategoryDir) {
|
|
|
35732
35820
|
for (const name of entries) {
|
|
35733
35821
|
if (name === "node_modules" || name === ".DS_Store")
|
|
35734
35822
|
continue;
|
|
35735
|
-
const stat = await import_fs_extra13.default.lstat(
|
|
35823
|
+
const stat = await import_fs_extra13.default.lstat(path17.join(claudeCategoryDir, name)).catch(() => null);
|
|
35736
35824
|
if (!stat)
|
|
35737
35825
|
continue;
|
|
35738
35826
|
if (stat.isDirectory())
|
|
@@ -35740,12 +35828,18 @@ async function listClaudeRealTopLevel(claudeCategoryDir) {
|
|
|
35740
35828
|
}
|
|
35741
35829
|
return real;
|
|
35742
35830
|
}
|
|
35831
|
+
function getRemoteCategoryPath(category) {
|
|
35832
|
+
if (category === "scripts")
|
|
35833
|
+
return "claude-config/scripts";
|
|
35834
|
+
return category;
|
|
35835
|
+
}
|
|
35743
35836
|
async function analyzeCategory(category, claudeDir, agentsDir, githubToken) {
|
|
35744
35837
|
const items = [];
|
|
35745
35838
|
const useAgents = isAgentCategory(category);
|
|
35746
35839
|
const localBase = useAgents ? agentsDir : claudeDir;
|
|
35747
|
-
const localDir =
|
|
35748
|
-
const
|
|
35840
|
+
const localDir = path17.join(localBase, category);
|
|
35841
|
+
const remoteCategoryPath = getRemoteCategoryPath(category);
|
|
35842
|
+
const remoteFiles = await listRemoteFilesRecursive(remoteCategoryPath, githubToken);
|
|
35749
35843
|
const localFiles = await listLocalFiles(localDir);
|
|
35750
35844
|
const remoteSet = new Map;
|
|
35751
35845
|
for (const rf of remoteFiles) {
|
|
@@ -35757,7 +35851,7 @@ async function analyzeCategory(category, claudeDir, agentsDir, githubToken) {
|
|
|
35757
35851
|
}
|
|
35758
35852
|
const localSet = new Set(localFiles);
|
|
35759
35853
|
for (const [remotePath, { sha, isFolder }] of remoteSet) {
|
|
35760
|
-
const localPath =
|
|
35854
|
+
const localPath = path17.join(localDir, remotePath);
|
|
35761
35855
|
if (isFolder) {
|
|
35762
35856
|
continue;
|
|
35763
35857
|
}
|
|
@@ -35792,7 +35886,7 @@ async function analyzeCategory(category, claudeDir, agentsDir, githubToken) {
|
|
|
35792
35886
|
for (const localPath of localSet) {
|
|
35793
35887
|
agentsTopLevels.add(localPath.split("/")[0]);
|
|
35794
35888
|
}
|
|
35795
|
-
const claudeCategoryDir =
|
|
35889
|
+
const claudeCategoryDir = path17.join(claudeDir, category);
|
|
35796
35890
|
const claudeRealEntries = await listClaudeRealTopLevel(claudeCategoryDir);
|
|
35797
35891
|
for (const top of claudeRealEntries) {
|
|
35798
35892
|
if (!remoteTopLevels.has(top))
|
|
@@ -35832,10 +35926,16 @@ async function analyzeSyncChanges(claudeDir, githubToken, agentsDir) {
|
|
|
35832
35926
|
migrationCount: allItems.filter((i) => i.status === "migration").length
|
|
35833
35927
|
};
|
|
35834
35928
|
}
|
|
35929
|
+
function translateRemotePath(relativePath) {
|
|
35930
|
+
const [first, ...rest] = relativePath.split("/");
|
|
35931
|
+
const remoteFirst = getRemoteCategoryPath(first);
|
|
35932
|
+
return [remoteFirst, ...rest].join("/");
|
|
35933
|
+
}
|
|
35835
35934
|
async function downloadFromPrivateGitHub2(relativePath, targetPath, githubToken, claudeDir) {
|
|
35836
35935
|
try {
|
|
35837
35936
|
const configFolder = await resolveRemoteConfigFolder(githubToken);
|
|
35838
|
-
const
|
|
35937
|
+
const remotePath = translateRemotePath(relativePath);
|
|
35938
|
+
const url = `https://raw.githubusercontent.com/${PREMIUM_REPO2}/${PREMIUM_BRANCH2}/${configFolder}/${remotePath}`;
|
|
35839
35939
|
const response = await fetch(url, {
|
|
35840
35940
|
headers: {
|
|
35841
35941
|
Authorization: `token ${githubToken}`,
|
|
@@ -35846,7 +35946,7 @@ async function downloadFromPrivateGitHub2(relativePath, targetPath, githubToken,
|
|
|
35846
35946
|
return false;
|
|
35847
35947
|
}
|
|
35848
35948
|
const content = await response.arrayBuffer();
|
|
35849
|
-
await import_fs_extra13.default.ensureDir(
|
|
35949
|
+
await import_fs_extra13.default.ensureDir(path17.dirname(targetPath));
|
|
35850
35950
|
if (isTextFile(relativePath)) {
|
|
35851
35951
|
const textContent = Buffer.from(content).toString("utf-8");
|
|
35852
35952
|
const transformedContent = transformFileContent(textContent, claudeDir);
|
|
@@ -35868,11 +35968,11 @@ async function syncSelectedItems(claudeDir, items, githubToken, agentsDir, onPro
|
|
|
35868
35968
|
for (const item of items) {
|
|
35869
35969
|
const useAgents = isAgentCategory(item.category);
|
|
35870
35970
|
const baseDir = useAgents ? agentsDir : claudeDir;
|
|
35871
|
-
const targetPath =
|
|
35971
|
+
const targetPath = path17.join(baseDir, item.relativePath);
|
|
35872
35972
|
if (item.status === "migration" && useAgents) {
|
|
35873
35973
|
const topName = item.name.split("/")[0];
|
|
35874
|
-
const agentsTop =
|
|
35875
|
-
const claudeTop =
|
|
35974
|
+
const agentsTop = path17.join(agentsDir, item.category, topName);
|
|
35975
|
+
const claudeTop = path17.join(claudeDir, item.category, topName);
|
|
35876
35976
|
try {
|
|
35877
35977
|
const claudeStat = await import_fs_extra13.default.lstat(claudeTop).catch(() => null);
|
|
35878
35978
|
if (!claudeStat || claudeStat.isSymbolicLink()) {
|
|
@@ -35887,7 +35987,7 @@ async function syncSelectedItems(claudeDir, items, githubToken, agentsDir, onPro
|
|
|
35887
35987
|
continue;
|
|
35888
35988
|
}
|
|
35889
35989
|
onProgress?.(item.relativePath, "moving to .agents");
|
|
35890
|
-
await import_fs_extra13.default.ensureDir(
|
|
35990
|
+
await import_fs_extra13.default.ensureDir(path17.dirname(agentsTop));
|
|
35891
35991
|
await import_fs_extra13.default.move(claudeTop, agentsTop);
|
|
35892
35992
|
migrated++;
|
|
35893
35993
|
touchedAgentCategories.add(item.category);
|
|
@@ -35898,7 +35998,7 @@ async function syncSelectedItems(claudeDir, items, githubToken, agentsDir, onPro
|
|
|
35898
35998
|
}
|
|
35899
35999
|
if (useAgents) {
|
|
35900
36000
|
const topName = item.name.split("/")[0];
|
|
35901
|
-
const claudeTop =
|
|
36001
|
+
const claudeTop = path17.join(claudeDir, item.category, topName);
|
|
35902
36002
|
const claudeTopStat = await import_fs_extra13.default.lstat(claudeTop).catch(() => null);
|
|
35903
36003
|
if (claudeTopStat && !claudeTopStat.isSymbolicLink()) {
|
|
35904
36004
|
onProgress?.(item.relativePath, "skipping (real dir in .claude)");
|
|
@@ -36084,8 +36184,7 @@ async function proSyncCommand(options = {}) {
|
|
|
36084
36184
|
Se(source_default.red("❌ Not activated"));
|
|
36085
36185
|
process.exit(1);
|
|
36086
36186
|
}
|
|
36087
|
-
const claudeDir
|
|
36088
|
-
const agentsDir = getAgentsDir(options.agentsFolder);
|
|
36187
|
+
const { claudeDir, agentsDir } = resolveFolders(options);
|
|
36089
36188
|
const spinner = Y2();
|
|
36090
36189
|
spinner.start("Analyzing changes...");
|
|
36091
36190
|
const result = await analyzeSyncChanges(claudeDir, githubToken, agentsDir);
|
|
@@ -36248,8 +36347,6 @@ async function proSyncCommand(options = {}) {
|
|
|
36248
36347
|
}
|
|
36249
36348
|
|
|
36250
36349
|
// src/commands/backup.ts
|
|
36251
|
-
import os17 from "os";
|
|
36252
|
-
import path18 from "path";
|
|
36253
36350
|
function formatBackupDate(date) {
|
|
36254
36351
|
const now = new Date;
|
|
36255
36352
|
const diffMs = now.getTime() - date.getTime();
|
|
@@ -36269,8 +36366,7 @@ function formatBackupDate(date) {
|
|
|
36269
36366
|
return `${date.toLocaleString()} (${relative})`;
|
|
36270
36367
|
}
|
|
36271
36368
|
async function backupLoadCommand(options = {}) {
|
|
36272
|
-
const claudeDir
|
|
36273
|
-
const agentsDir = getAgentsDir(options.agentsFolder);
|
|
36369
|
+
const { claudeDir, agentsDir } = resolveFolders(options);
|
|
36274
36370
|
Ie(source_default.blue("\uD83D\uDCE6 Load Backup"));
|
|
36275
36371
|
const spinner = Y2();
|
|
36276
36372
|
spinner.start("Scanning for backups...");
|
|
@@ -36326,19 +36422,19 @@ async function backupLoadCommand(options = {}) {
|
|
|
36326
36422
|
}
|
|
36327
36423
|
|
|
36328
36424
|
// src/commands/openclaw-pro.ts
|
|
36329
|
-
import
|
|
36330
|
-
import
|
|
36425
|
+
import os18 from "os";
|
|
36426
|
+
import path20 from "path";
|
|
36331
36427
|
|
|
36332
36428
|
// src/lib/openclaw-installer.ts
|
|
36333
36429
|
var import_fs_extra14 = __toESM(require_lib4(), 1);
|
|
36334
|
-
import
|
|
36335
|
-
import
|
|
36430
|
+
import os16 from "os";
|
|
36431
|
+
import path18 from "path";
|
|
36336
36432
|
import { exec as exec4 } from "child_process";
|
|
36337
36433
|
import { promisify as promisify3 } from "util";
|
|
36338
36434
|
var execAsync3 = promisify3(exec4);
|
|
36339
36435
|
var OPENCLAW_PRO_REPO = "Melvynx/openclawpro";
|
|
36340
36436
|
function getCacheRepoDir2() {
|
|
36341
|
-
return
|
|
36437
|
+
return path18.join(os16.homedir(), ".config", "openclaw", "pro-repos", "openclawpro");
|
|
36342
36438
|
}
|
|
36343
36439
|
async function execGitWithAuth2(command, token, repoUrl, cwd) {
|
|
36344
36440
|
const authenticatedUrl = `https://x-access-token:${token}@${repoUrl.replace(/^https?:\/\//, "")}`;
|
|
@@ -36352,27 +36448,27 @@ async function execGitWithAuth2(command, token, repoUrl, cwd) {
|
|
|
36352
36448
|
async function cloneOrUpdateRepo2(token) {
|
|
36353
36449
|
const cacheDir = getCacheRepoDir2();
|
|
36354
36450
|
const repoUrl = `https://github.com/${OPENCLAW_PRO_REPO}.git`;
|
|
36355
|
-
if (await import_fs_extra14.default.pathExists(
|
|
36451
|
+
if (await import_fs_extra14.default.pathExists(path18.join(cacheDir, ".git"))) {
|
|
36356
36452
|
try {
|
|
36357
36453
|
await execGitWithAuth2("pull", token, repoUrl, cacheDir);
|
|
36358
36454
|
} catch (error) {
|
|
36359
36455
|
await import_fs_extra14.default.remove(cacheDir);
|
|
36360
|
-
await import_fs_extra14.default.ensureDir(
|
|
36456
|
+
await import_fs_extra14.default.ensureDir(path18.dirname(cacheDir));
|
|
36361
36457
|
await execGitWithAuth2(`clone ${repoUrl} ${cacheDir}`, token, repoUrl);
|
|
36362
36458
|
}
|
|
36363
36459
|
} else {
|
|
36364
|
-
await import_fs_extra14.default.ensureDir(
|
|
36460
|
+
await import_fs_extra14.default.ensureDir(path18.dirname(cacheDir));
|
|
36365
36461
|
await execGitWithAuth2(`clone ${repoUrl} ${cacheDir}`, token, repoUrl);
|
|
36366
36462
|
}
|
|
36367
|
-
return
|
|
36463
|
+
return path18.join(cacheDir, "openclaw-config");
|
|
36368
36464
|
}
|
|
36369
36465
|
async function copyConfigFromCache2(cacheConfigDir, targetDir, onProgress) {
|
|
36370
36466
|
const walk = async (dir, baseDir = dir) => {
|
|
36371
36467
|
const entries = await import_fs_extra14.default.readdir(dir, { withFileTypes: true });
|
|
36372
36468
|
for (const entry of entries) {
|
|
36373
|
-
const sourcePath =
|
|
36374
|
-
const relativePath =
|
|
36375
|
-
const targetPath =
|
|
36469
|
+
const sourcePath = path18.join(dir, entry.name);
|
|
36470
|
+
const relativePath = path18.relative(baseDir, sourcePath);
|
|
36471
|
+
const targetPath = path18.join(targetDir, relativePath);
|
|
36376
36472
|
if (entry.isDirectory()) {
|
|
36377
36473
|
await import_fs_extra14.default.ensureDir(targetPath);
|
|
36378
36474
|
onProgress?.(relativePath, "directory");
|
|
@@ -36387,7 +36483,7 @@ async function copyConfigFromCache2(cacheConfigDir, targetDir, onProgress) {
|
|
|
36387
36483
|
}
|
|
36388
36484
|
async function installOpenclawProConfigs(options) {
|
|
36389
36485
|
const { githubToken, openclawFolder, onProgress } = options;
|
|
36390
|
-
const targetFolder = openclawFolder ||
|
|
36486
|
+
const targetFolder = openclawFolder || path18.join(os16.homedir(), ".openclaw");
|
|
36391
36487
|
try {
|
|
36392
36488
|
const cacheConfigDir = await cloneOrUpdateRepo2(githubToken);
|
|
36393
36489
|
await copyConfigFromCache2(cacheConfigDir, targetFolder, onProgress);
|
|
@@ -36399,17 +36495,17 @@ async function installOpenclawProConfigs(options) {
|
|
|
36399
36495
|
|
|
36400
36496
|
// src/lib/openclaw-token-storage.ts
|
|
36401
36497
|
var import_fs_extra15 = __toESM(require_lib4(), 1);
|
|
36402
|
-
import
|
|
36403
|
-
import
|
|
36498
|
+
import os17 from "os";
|
|
36499
|
+
import path19 from "path";
|
|
36404
36500
|
function getConfigDir2() {
|
|
36405
|
-
const platform =
|
|
36501
|
+
const platform = os17.platform();
|
|
36406
36502
|
if (platform === "win32") {
|
|
36407
|
-
return
|
|
36503
|
+
return path19.join(process.env.APPDATA || os17.homedir(), "openclaw");
|
|
36408
36504
|
}
|
|
36409
|
-
return
|
|
36505
|
+
return path19.join(os17.homedir(), ".config", "openclaw");
|
|
36410
36506
|
}
|
|
36411
36507
|
function getTokenPath() {
|
|
36412
|
-
return
|
|
36508
|
+
return path19.join(getConfigDir2(), "token.txt");
|
|
36413
36509
|
}
|
|
36414
36510
|
async function saveOpenclawToken(githubToken) {
|
|
36415
36511
|
const configDir = getConfigDir2();
|
|
@@ -36427,7 +36523,7 @@ async function getOpenclawToken() {
|
|
|
36427
36523
|
function getOpenclawTokenInfo() {
|
|
36428
36524
|
return {
|
|
36429
36525
|
path: getTokenPath(),
|
|
36430
|
-
platform:
|
|
36526
|
+
platform: os17.platform()
|
|
36431
36527
|
};
|
|
36432
36528
|
}
|
|
36433
36529
|
|
|
@@ -36539,7 +36635,7 @@ async function openclawProSetupCommand(options = {}) {
|
|
|
36539
36635
|
Se(source_default.red("❌ Not activated"));
|
|
36540
36636
|
process.exit(1);
|
|
36541
36637
|
}
|
|
36542
|
-
const openclawDir = options.folder ?
|
|
36638
|
+
const openclawDir = options.folder ? path20.resolve(options.folder) : path20.join(os18.homedir(), ".openclaw");
|
|
36543
36639
|
const spinner = Y2();
|
|
36544
36640
|
const onProgress = (file, type) => {
|
|
36545
36641
|
spinner.message(`Installing: ${source_default.cyan(file)} ${source_default.gray(`(${type})`)}`);
|
|
@@ -36552,18 +36648,18 @@ async function openclawProSetupCommand(options = {}) {
|
|
|
36552
36648
|
});
|
|
36553
36649
|
spinner.stop("OpenClaw Pro configurations installed");
|
|
36554
36650
|
let skillCount = 0;
|
|
36555
|
-
const skillsDir =
|
|
36651
|
+
const skillsDir = path20.join(openclawDir, "skills");
|
|
36556
36652
|
if (await import_fs_extra16.default.pathExists(skillsDir)) {
|
|
36557
36653
|
const items = await import_fs_extra16.default.readdir(skillsDir);
|
|
36558
36654
|
const dirs = await Promise.all(items.map(async (item) => {
|
|
36559
|
-
const stat = await import_fs_extra16.default.stat(
|
|
36655
|
+
const stat = await import_fs_extra16.default.stat(path20.join(skillsDir, item));
|
|
36560
36656
|
return stat.isDirectory();
|
|
36561
36657
|
}));
|
|
36562
36658
|
skillCount = dirs.filter(Boolean).length;
|
|
36563
36659
|
}
|
|
36564
36660
|
spinner.start("Setting up workspace TOOLS.md...");
|
|
36565
|
-
const workspaceDir =
|
|
36566
|
-
const toolsPath =
|
|
36661
|
+
const workspaceDir = path20.join(openclawDir, "workspace");
|
|
36662
|
+
const toolsPath = path20.join(workspaceDir, "TOOLS.md");
|
|
36567
36663
|
await import_fs_extra16.default.ensureDir(workspaceDir);
|
|
36568
36664
|
if (await import_fs_extra16.default.pathExists(toolsPath)) {
|
|
36569
36665
|
const existingContent = await import_fs_extra16.default.readFile(toolsPath, "utf-8");
|
|
@@ -36593,7 +36689,7 @@ ${CLAUDE_CODE_TOOLS_INSTRUCTIONS}
|
|
|
36593
36689
|
script -q -c "claude $*" /dev/null
|
|
36594
36690
|
`;
|
|
36595
36691
|
const binDir = "/usr/local/bin";
|
|
36596
|
-
const wrapperPath =
|
|
36692
|
+
const wrapperPath = path20.join(binDir, "claude-run");
|
|
36597
36693
|
try {
|
|
36598
36694
|
await import_fs_extra16.default.writeFile(wrapperPath, claudeRunWrapper, { mode: 493 });
|
|
36599
36695
|
spinner.stop("claude-run wrapper created");
|
|
@@ -36644,12 +36740,12 @@ async function openclawProUpdateCommand(options = {}) {
|
|
|
36644
36740
|
}
|
|
36645
36741
|
|
|
36646
36742
|
// src/commands/dynamic-scripts.ts
|
|
36647
|
-
import
|
|
36743
|
+
import path23 from "path";
|
|
36648
36744
|
import { homedir } from "os";
|
|
36649
36745
|
|
|
36650
36746
|
// src/lib/script-parser.ts
|
|
36651
36747
|
var import_fs_extra17 = __toESM(require_lib4(), 1);
|
|
36652
|
-
import
|
|
36748
|
+
import path21 from "path";
|
|
36653
36749
|
var EXCLUDED_SCRIPTS = ["test", "lint", "format", "start"];
|
|
36654
36750
|
var EXCLUDED_SUFFIXES = [":test", ":lint", ":test-fixtures", ":start"];
|
|
36655
36751
|
function shouldIncludeScript(scriptName) {
|
|
@@ -36660,7 +36756,7 @@ function shouldIncludeScript(scriptName) {
|
|
|
36660
36756
|
return true;
|
|
36661
36757
|
}
|
|
36662
36758
|
async function readScriptsPackageJson(claudeDir) {
|
|
36663
|
-
const packageJsonPath =
|
|
36759
|
+
const packageJsonPath = path21.join(claudeDir, "scripts", "package.json");
|
|
36664
36760
|
try {
|
|
36665
36761
|
if (!await import_fs_extra17.default.pathExists(packageJsonPath)) {
|
|
36666
36762
|
return null;
|
|
@@ -36712,11 +36808,11 @@ function groupScriptsByPrefix(commands) {
|
|
|
36712
36808
|
var import_fs_extra18 = __toESM(require_lib4(), 1);
|
|
36713
36809
|
import { spawn as spawn2 } from "child_process";
|
|
36714
36810
|
import { execSync as execSync4 } from "child_process";
|
|
36715
|
-
import
|
|
36716
|
-
import
|
|
36811
|
+
import path22 from "path";
|
|
36812
|
+
import os19 from "os";
|
|
36717
36813
|
function checkCommand2(cmd) {
|
|
36718
36814
|
try {
|
|
36719
|
-
const isWindows2 =
|
|
36815
|
+
const isWindows2 = os19.platform() === "win32";
|
|
36720
36816
|
const whichCmd = isWindows2 ? `where ${cmd}` : `which ${cmd}`;
|
|
36721
36817
|
execSync4(whichCmd, { stdio: "ignore" });
|
|
36722
36818
|
return true;
|
|
@@ -36742,13 +36838,13 @@ async function executeScript(scriptName, claudeDir) {
|
|
|
36742
36838
|
console.error(source_default.red("Bun is not installed. Install with: npm install -g bun"));
|
|
36743
36839
|
return 1;
|
|
36744
36840
|
}
|
|
36745
|
-
const scriptsDir =
|
|
36841
|
+
const scriptsDir = path22.join(claudeDir, "scripts");
|
|
36746
36842
|
if (!await import_fs_extra18.default.pathExists(scriptsDir)) {
|
|
36747
36843
|
console.error(source_default.red(`Scripts directory not found at ${scriptsDir}`));
|
|
36748
36844
|
console.log(source_default.gray("Run: aiblueprint agents setup"));
|
|
36749
36845
|
return 1;
|
|
36750
36846
|
}
|
|
36751
|
-
const packageJsonPath =
|
|
36847
|
+
const packageJsonPath = path22.join(scriptsDir, "package.json");
|
|
36752
36848
|
if (!await import_fs_extra18.default.pathExists(packageJsonPath)) {
|
|
36753
36849
|
console.error(source_default.red(`package.json not found in ${scriptsDir}`));
|
|
36754
36850
|
return 1;
|
|
@@ -36776,7 +36872,7 @@ async function executeScript(scriptName, claudeDir) {
|
|
|
36776
36872
|
|
|
36777
36873
|
// src/commands/dynamic-scripts.ts
|
|
36778
36874
|
function getClaudeDir(parentOptions) {
|
|
36779
|
-
return parentOptions.claudeCodeFolder || parentOptions.folder ?
|
|
36875
|
+
return parentOptions.claudeCodeFolder || parentOptions.folder ? path23.resolve(parentOptions.claudeCodeFolder || parentOptions.folder) : path23.join(homedir(), ".claude");
|
|
36780
36876
|
}
|
|
36781
36877
|
async function registerDynamicScriptCommands(claudeCodeCmd, claudeDir) {
|
|
36782
36878
|
const scripts = await readScriptsPackageJson(claudeDir);
|
|
@@ -36812,11 +36908,12 @@ var packageJson = JSON.parse(readFileSync3(join2(__dirname3, "../package.json"),
|
|
|
36812
36908
|
var program2 = new Command;
|
|
36813
36909
|
program2.name("aiblueprint").description("AIBlueprint CLI for setting up AI coding configurations").version(packageJson.version);
|
|
36814
36910
|
function registerAgentsCommands(cmd) {
|
|
36815
|
-
cmd.option("-f, --folder <path>", "
|
|
36911
|
+
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("--openCodeFolder <path>", "Override OpenCode folder (default: ~/.config/opencode)").option("--factoryAiFolder <path>", "Override FactoryAI folder (default: ~/.factory)").option("--agentsFolder <path>", "Override shared agents folder (default: {folder}/.agents)").option("-s, --skip", "Skip interactive prompts and install all features");
|
|
36816
36912
|
cmd.command("setup").description("Setup AI coding configuration with AIBlueprint defaults").action((options, command) => {
|
|
36817
36913
|
const parentOptions = command.parent.opts();
|
|
36818
36914
|
setupCommand({
|
|
36819
|
-
|
|
36915
|
+
folder: parentOptions.folder,
|
|
36916
|
+
claudeCodeFolder: parentOptions.claudeCodeFolder,
|
|
36820
36917
|
codexFolder: parentOptions.codexFolder,
|
|
36821
36918
|
openCodeFolder: parentOptions.openCodeFolder,
|
|
36822
36919
|
agentsFolder: parentOptions.agentsFolder,
|
|
@@ -36827,13 +36924,14 @@ function registerAgentsCommands(cmd) {
|
|
|
36827
36924
|
const parentOptions = command.parent.opts();
|
|
36828
36925
|
setupTerminalCommand({
|
|
36829
36926
|
skipInteractive: parentOptions.skip,
|
|
36830
|
-
homeDir: parentOptions.
|
|
36927
|
+
homeDir: parentOptions.folder
|
|
36831
36928
|
});
|
|
36832
36929
|
});
|
|
36833
36930
|
cmd.command("symlink").description("Create symlinks between different AI coding tools (Claude Code, Codex, OpenCode, FactoryAI)").action((options, command) => {
|
|
36834
36931
|
const parentOptions = command.parent.opts();
|
|
36835
36932
|
symlinkCommand({
|
|
36836
|
-
|
|
36933
|
+
folder: parentOptions.folder,
|
|
36934
|
+
claudeCodeFolder: parentOptions.claudeCodeFolder,
|
|
36837
36935
|
codexFolder: parentOptions.codexFolder,
|
|
36838
36936
|
openCodeFolder: parentOptions.openCodeFolder,
|
|
36839
36937
|
factoryAiFolder: parentOptions.factoryAiFolder
|
|
@@ -36848,25 +36946,37 @@ function registerAgentsCommands(cmd) {
|
|
|
36848
36946
|
});
|
|
36849
36947
|
proCmd.command("setup").description("Install premium configurations (requires activation)").action((options, command) => {
|
|
36850
36948
|
const parentOptions = command.parent.parent.opts();
|
|
36851
|
-
|
|
36852
|
-
|
|
36949
|
+
proSetupCommand({
|
|
36950
|
+
folder: parentOptions.folder,
|
|
36951
|
+
claudeCodeFolder: parentOptions.claudeCodeFolder,
|
|
36952
|
+
codexFolder: parentOptions.codexFolder,
|
|
36953
|
+
agentsFolder: parentOptions.agentsFolder
|
|
36954
|
+
});
|
|
36853
36955
|
});
|
|
36854
36956
|
proCmd.command("update").description("Update premium configurations").action((options, command) => {
|
|
36855
36957
|
const parentOptions = command.parent.parent.opts();
|
|
36856
|
-
|
|
36857
|
-
|
|
36958
|
+
proUpdateCommand({
|
|
36959
|
+
folder: parentOptions.folder,
|
|
36960
|
+
claudeCodeFolder: parentOptions.claudeCodeFolder,
|
|
36961
|
+
codexFolder: parentOptions.codexFolder,
|
|
36962
|
+
agentsFolder: parentOptions.agentsFolder
|
|
36963
|
+
});
|
|
36858
36964
|
});
|
|
36859
36965
|
proCmd.command("sync").description("Sync premium configurations with selective update").action((options, command) => {
|
|
36860
36966
|
const parentOptions = command.parent.parent.opts();
|
|
36861
|
-
|
|
36862
|
-
|
|
36967
|
+
proSyncCommand({
|
|
36968
|
+
folder: parentOptions.folder,
|
|
36969
|
+
claudeCodeFolder: parentOptions.claudeCodeFolder,
|
|
36970
|
+
codexFolder: parentOptions.codexFolder,
|
|
36971
|
+
agentsFolder: parentOptions.agentsFolder
|
|
36972
|
+
});
|
|
36863
36973
|
});
|
|
36864
36974
|
const backupCmd = cmd.command("backup").description("Manage AI coding configuration backups");
|
|
36865
36975
|
backupCmd.command("load").description("Load a previous backup interactively").action((options, command) => {
|
|
36866
36976
|
const parentOptions = command.parent.parent.opts();
|
|
36867
|
-
const claudeCodeFolder = parentOptions.claudeCodeFolder || parentOptions.folder;
|
|
36868
36977
|
backupLoadCommand({
|
|
36869
|
-
folder:
|
|
36978
|
+
folder: parentOptions.folder,
|
|
36979
|
+
claudeCodeFolder: parentOptions.claudeCodeFolder,
|
|
36870
36980
|
agentsFolder: parentOptions.agentsFolder
|
|
36871
36981
|
});
|
|
36872
36982
|
});
|