aiblueprint-cli 1.4.1 → 1.4.3
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 +471 -125
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -33219,7 +33219,29 @@ import { execSync as execSync2 } from "child_process";
|
|
|
33219
33219
|
function escapeShellArg(arg) {
|
|
33220
33220
|
return "'" + arg.replace(/'/g, "'\\''") + "'";
|
|
33221
33221
|
}
|
|
33222
|
+
var cachedPlatformInfo = null;
|
|
33222
33223
|
var cachedAudioPlayer = undefined;
|
|
33224
|
+
function isWSL() {
|
|
33225
|
+
if (os6.platform() !== "linux")
|
|
33226
|
+
return false;
|
|
33227
|
+
const release = os6.release().toLowerCase();
|
|
33228
|
+
return release.includes("microsoft") || release.includes("wsl");
|
|
33229
|
+
}
|
|
33230
|
+
function getPlatformInfo() {
|
|
33231
|
+
if (cachedPlatformInfo)
|
|
33232
|
+
return cachedPlatformInfo;
|
|
33233
|
+
const platform = os6.platform();
|
|
33234
|
+
const wsl = isWSL();
|
|
33235
|
+
cachedPlatformInfo = {
|
|
33236
|
+
platform,
|
|
33237
|
+
isWindows: platform === "win32",
|
|
33238
|
+
isMacOS: platform === "darwin",
|
|
33239
|
+
isLinux: platform === "linux" && !wsl,
|
|
33240
|
+
isWSL: wsl,
|
|
33241
|
+
homeDir: os6.homedir()
|
|
33242
|
+
};
|
|
33243
|
+
return cachedPlatformInfo;
|
|
33244
|
+
}
|
|
33223
33245
|
function detectAudioPlayer() {
|
|
33224
33246
|
if (cachedAudioPlayer !== undefined)
|
|
33225
33247
|
return cachedAudioPlayer;
|
|
@@ -33821,15 +33843,332 @@ Next steps:`));
|
|
|
33821
33843
|
}
|
|
33822
33844
|
}
|
|
33823
33845
|
|
|
33846
|
+
// src/commands/setup-terminal.ts
|
|
33847
|
+
var import_fs_extra7 = __toESM(require_lib4(), 1);
|
|
33848
|
+
import path9 from "path";
|
|
33849
|
+
import os9 from "os";
|
|
33850
|
+
import { execSync as execSync3, exec } from "child_process";
|
|
33851
|
+
var OHMYZSH_INSTALL_URL = "https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh";
|
|
33852
|
+
var INSTALL_TIMEOUT = 120000;
|
|
33853
|
+
var PLUGIN_TIMEOUT = 60000;
|
|
33854
|
+
var THEMES = [
|
|
33855
|
+
{ value: "robbyrussell", name: "robbyrussell (default) - Clean and minimal" },
|
|
33856
|
+
{ value: "agnoster", name: "agnoster - Powerline style (requires patched font)" },
|
|
33857
|
+
{ value: "af-magic", name: "af-magic - Colorful with git info" },
|
|
33858
|
+
{ value: "dst", name: "dst - Clean with directory path" },
|
|
33859
|
+
{ value: "simple", name: "simple - Minimalist" },
|
|
33860
|
+
{ value: "bira", name: "bira - Two-line prompt with user info" },
|
|
33861
|
+
{ value: "custom", name: "Custom theme (enter name manually)" }
|
|
33862
|
+
];
|
|
33863
|
+
var PLUGINS = ["git", "zsh-autosuggestions", "zsh-syntax-highlighting"];
|
|
33864
|
+
function sanitizeThemeName(theme) {
|
|
33865
|
+
const sanitized = theme.replace(/[^a-zA-Z0-9_-]/g, "");
|
|
33866
|
+
if (sanitized.length === 0) {
|
|
33867
|
+
return "robbyrussell";
|
|
33868
|
+
}
|
|
33869
|
+
return sanitized;
|
|
33870
|
+
}
|
|
33871
|
+
function commandExists(cmd) {
|
|
33872
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(cmd)) {
|
|
33873
|
+
return false;
|
|
33874
|
+
}
|
|
33875
|
+
try {
|
|
33876
|
+
execSync3(`which ${cmd}`, { stdio: "ignore" });
|
|
33877
|
+
return true;
|
|
33878
|
+
} catch {
|
|
33879
|
+
return false;
|
|
33880
|
+
}
|
|
33881
|
+
}
|
|
33882
|
+
function isOhMyZshInstalled(homeDir) {
|
|
33883
|
+
const ohMyZshDir = path9.join(homeDir, ".oh-my-zsh");
|
|
33884
|
+
return import_fs_extra7.default.existsSync(ohMyZshDir);
|
|
33885
|
+
}
|
|
33886
|
+
function backupFile(filePath) {
|
|
33887
|
+
if (!import_fs_extra7.default.existsSync(filePath))
|
|
33888
|
+
return null;
|
|
33889
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
33890
|
+
const backupPath = `${filePath}.backup-${timestamp}`;
|
|
33891
|
+
try {
|
|
33892
|
+
import_fs_extra7.default.copyFileSync(filePath, backupPath);
|
|
33893
|
+
return backupPath;
|
|
33894
|
+
} catch (error) {
|
|
33895
|
+
throw new Error(`Failed to create backup: ${error.message}`);
|
|
33896
|
+
}
|
|
33897
|
+
}
|
|
33898
|
+
function getPackageManager() {
|
|
33899
|
+
if (commandExists("apt")) {
|
|
33900
|
+
return { cmd: "apt", installCmd: "sudo apt install -y" };
|
|
33901
|
+
}
|
|
33902
|
+
if (commandExists("apt-get")) {
|
|
33903
|
+
return { cmd: "apt-get", installCmd: "sudo apt-get install -y" };
|
|
33904
|
+
}
|
|
33905
|
+
if (commandExists("brew")) {
|
|
33906
|
+
return { cmd: "brew", installCmd: "brew install" };
|
|
33907
|
+
}
|
|
33908
|
+
if (commandExists("dnf")) {
|
|
33909
|
+
return { cmd: "dnf", installCmd: "sudo dnf install -y" };
|
|
33910
|
+
}
|
|
33911
|
+
if (commandExists("yum")) {
|
|
33912
|
+
return { cmd: "yum", installCmd: "sudo yum install -y" };
|
|
33913
|
+
}
|
|
33914
|
+
if (commandExists("pacman")) {
|
|
33915
|
+
return { cmd: "pacman", installCmd: "sudo pacman -S --noconfirm" };
|
|
33916
|
+
}
|
|
33917
|
+
return null;
|
|
33918
|
+
}
|
|
33919
|
+
function installPrerequisiteSync(packageName, installCmd) {
|
|
33920
|
+
try {
|
|
33921
|
+
const fullCmd = `${installCmd} ${packageName}`;
|
|
33922
|
+
execSync3(fullCmd, { stdio: "inherit", timeout: INSTALL_TIMEOUT });
|
|
33923
|
+
return true;
|
|
33924
|
+
} catch {
|
|
33925
|
+
return false;
|
|
33926
|
+
}
|
|
33927
|
+
}
|
|
33928
|
+
async function installOhMyZsh(homeDir) {
|
|
33929
|
+
return new Promise((resolve, reject) => {
|
|
33930
|
+
const installCmd = `sh -c "$(curl -fsSL ${OHMYZSH_INSTALL_URL})" "" --unattended`;
|
|
33931
|
+
const env2 = { ...process.env, HOME: homeDir, ZSH: path9.join(homeDir, ".oh-my-zsh") };
|
|
33932
|
+
exec(installCmd, { timeout: INSTALL_TIMEOUT, env: env2 }, (error, stdout, stderr) => {
|
|
33933
|
+
if (error) {
|
|
33934
|
+
if (error.killed) {
|
|
33935
|
+
reject(new Error("Oh My ZSH installation timed out. Please check your network connection."));
|
|
33936
|
+
} else {
|
|
33937
|
+
reject(new Error(`Failed to install Oh My ZSH: ${stderr || error.message}`));
|
|
33938
|
+
}
|
|
33939
|
+
} else {
|
|
33940
|
+
resolve();
|
|
33941
|
+
}
|
|
33942
|
+
});
|
|
33943
|
+
});
|
|
33944
|
+
}
|
|
33945
|
+
async function installPlugin(pluginName, repoUrl, homeDir) {
|
|
33946
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(pluginName)) {
|
|
33947
|
+
throw new Error(`Invalid plugin name: ${pluginName}`);
|
|
33948
|
+
}
|
|
33949
|
+
if (!/^https:\/\/github\.com\/[\w-]+\/[\w-]+$/.test(repoUrl)) {
|
|
33950
|
+
throw new Error(`Invalid repository URL: ${repoUrl}`);
|
|
33951
|
+
}
|
|
33952
|
+
const customPluginsDir = path9.join(homeDir, ".oh-my-zsh/custom/plugins", pluginName);
|
|
33953
|
+
if (import_fs_extra7.default.existsSync(customPluginsDir)) {
|
|
33954
|
+
return;
|
|
33955
|
+
}
|
|
33956
|
+
return new Promise((resolve, reject) => {
|
|
33957
|
+
exec(`git clone ${repoUrl} "${customPluginsDir}"`, { timeout: PLUGIN_TIMEOUT }, (error, stdout, stderr) => {
|
|
33958
|
+
if (error) {
|
|
33959
|
+
if (error.killed) {
|
|
33960
|
+
reject(new Error(`Plugin ${pluginName} installation timed out. Please check your network connection.`));
|
|
33961
|
+
} else {
|
|
33962
|
+
reject(new Error(`Failed to install ${pluginName}: ${stderr || error.message}`));
|
|
33963
|
+
}
|
|
33964
|
+
} else {
|
|
33965
|
+
resolve();
|
|
33966
|
+
}
|
|
33967
|
+
});
|
|
33968
|
+
});
|
|
33969
|
+
}
|
|
33970
|
+
function updateZshrcTheme(theme, homeDir) {
|
|
33971
|
+
const zshrcPath = path9.join(homeDir, ".zshrc");
|
|
33972
|
+
const sanitizedTheme = sanitizeThemeName(theme);
|
|
33973
|
+
if (!import_fs_extra7.default.existsSync(zshrcPath)) {
|
|
33974
|
+
throw new Error(".zshrc file not found. Please ensure Oh My ZSH is installed correctly.");
|
|
33975
|
+
}
|
|
33976
|
+
try {
|
|
33977
|
+
let content = import_fs_extra7.default.readFileSync(zshrcPath, "utf-8");
|
|
33978
|
+
if (content.match(/^ZSH_THEME=/m)) {
|
|
33979
|
+
content = content.replace(/^ZSH_THEME=.*/m, `ZSH_THEME="${sanitizedTheme}"`);
|
|
33980
|
+
} else {
|
|
33981
|
+
content = `ZSH_THEME="${sanitizedTheme}"
|
|
33982
|
+
${content}`;
|
|
33983
|
+
}
|
|
33984
|
+
import_fs_extra7.default.writeFileSync(zshrcPath, content);
|
|
33985
|
+
} catch (error) {
|
|
33986
|
+
if (error.message.includes(".zshrc file not found")) {
|
|
33987
|
+
throw error;
|
|
33988
|
+
}
|
|
33989
|
+
throw new Error(`Failed to update theme in .zshrc: ${error.message}`);
|
|
33990
|
+
}
|
|
33991
|
+
}
|
|
33992
|
+
function updateZshrcPlugins(plugins, homeDir) {
|
|
33993
|
+
const zshrcPath = path9.join(homeDir, ".zshrc");
|
|
33994
|
+
if (!import_fs_extra7.default.existsSync(zshrcPath)) {
|
|
33995
|
+
throw new Error(".zshrc file not found. Please ensure Oh My ZSH is installed correctly.");
|
|
33996
|
+
}
|
|
33997
|
+
try {
|
|
33998
|
+
let content = import_fs_extra7.default.readFileSync(zshrcPath, "utf-8");
|
|
33999
|
+
const pluginsString = plugins.join(" ");
|
|
34000
|
+
if (content.match(/^plugins=\(/m)) {
|
|
34001
|
+
content = content.replace(/^plugins=\([^)]*\)/m, `plugins=(${pluginsString})`);
|
|
34002
|
+
} else {
|
|
34003
|
+
content = `${content}
|
|
34004
|
+
plugins=(${pluginsString})`;
|
|
34005
|
+
}
|
|
34006
|
+
import_fs_extra7.default.writeFileSync(zshrcPath, content);
|
|
34007
|
+
} catch (error) {
|
|
34008
|
+
if (error.message.includes(".zshrc file not found")) {
|
|
34009
|
+
throw error;
|
|
34010
|
+
}
|
|
34011
|
+
throw new Error(`Failed to update plugins in .zshrc: ${error.message}`);
|
|
34012
|
+
}
|
|
34013
|
+
}
|
|
34014
|
+
async function setupTerminalCommand(options = {}) {
|
|
34015
|
+
const { skipInteractive, homeDir: customHomeDir } = options;
|
|
34016
|
+
const homeDir = customHomeDir || os9.homedir();
|
|
34017
|
+
try {
|
|
34018
|
+
console.log(source_default.blue.bold(`
|
|
34019
|
+
\uD83D\uDDA5️ AIBlueprint Terminal Setup ${source_default.gray(`v${getVersion()}`)}
|
|
34020
|
+
`));
|
|
34021
|
+
console.log(source_default.bgBlue(" Setting up your terminal with Oh My ZSH "));
|
|
34022
|
+
const platformInfo = getPlatformInfo();
|
|
34023
|
+
if (platformInfo.isWindows) {
|
|
34024
|
+
console.log(source_default.red(`
|
|
34025
|
+
❌ This command is not supported on Windows.`));
|
|
34026
|
+
console.log(source_default.yellow("Please use WSL (Windows Subsystem for Linux) instead:"));
|
|
34027
|
+
console.log(source_default.gray(" 1. Open PowerShell as Administrator"));
|
|
34028
|
+
console.log(source_default.gray(" 2. Run: wsl --install"));
|
|
34029
|
+
console.log(source_default.gray(" 3. Restart your computer"));
|
|
34030
|
+
console.log(source_default.gray(" 4. Open WSL and run this command again"));
|
|
34031
|
+
process.exit(1);
|
|
34032
|
+
}
|
|
34033
|
+
const s = new SimpleSpinner;
|
|
34034
|
+
s.start("Checking prerequisites");
|
|
34035
|
+
const missingPrereqs = [];
|
|
34036
|
+
if (!commandExists("curl")) {
|
|
34037
|
+
missingPrereqs.push("curl");
|
|
34038
|
+
}
|
|
34039
|
+
if (!commandExists("git")) {
|
|
34040
|
+
missingPrereqs.push("git");
|
|
34041
|
+
}
|
|
34042
|
+
if (!commandExists("zsh")) {
|
|
34043
|
+
missingPrereqs.push("zsh");
|
|
34044
|
+
}
|
|
34045
|
+
if (missingPrereqs.length > 0) {
|
|
34046
|
+
s.stop(`Missing: ${missingPrereqs.join(", ")}`);
|
|
34047
|
+
const packageManager = getPackageManager();
|
|
34048
|
+
if (!packageManager) {
|
|
34049
|
+
console.log(source_default.red(`
|
|
34050
|
+
❌ Missing required tools: ${missingPrereqs.join(", ")}`));
|
|
34051
|
+
console.log(source_default.yellow(`
|
|
34052
|
+
Could not detect package manager. Please install manually:`));
|
|
34053
|
+
if (platformInfo.isMacOS) {
|
|
34054
|
+
console.log(source_default.gray(" brew install " + missingPrereqs.join(" ")));
|
|
34055
|
+
} else {
|
|
34056
|
+
console.log(source_default.gray(" sudo apt install " + missingPrereqs.join(" ")));
|
|
34057
|
+
}
|
|
34058
|
+
process.exit(1);
|
|
34059
|
+
}
|
|
34060
|
+
console.log(source_default.yellow(`
|
|
34061
|
+
Installing missing prerequisites: ${missingPrereqs.join(", ")}`));
|
|
34062
|
+
console.log(source_default.gray(`Using package manager: ${packageManager.cmd}`));
|
|
34063
|
+
for (const pkg of missingPrereqs) {
|
|
34064
|
+
console.log(source_default.yellow(`
|
|
34065
|
+
\uD83D\uDCE6 Installing ${pkg}...`));
|
|
34066
|
+
const success = installPrerequisiteSync(pkg, packageManager.installCmd);
|
|
34067
|
+
if (success) {
|
|
34068
|
+
console.log(source_default.green(`✓ ${pkg} installed`));
|
|
34069
|
+
} else {
|
|
34070
|
+
console.log(source_default.red(`
|
|
34071
|
+
❌ Failed to install ${pkg}`));
|
|
34072
|
+
console.log(source_default.yellow("Please install it manually:"));
|
|
34073
|
+
console.log(source_default.gray(` ${packageManager.installCmd} ${pkg}`));
|
|
34074
|
+
process.exit(1);
|
|
34075
|
+
}
|
|
34076
|
+
}
|
|
34077
|
+
console.log(source_default.green("✓ All prerequisites installed"));
|
|
34078
|
+
} else {
|
|
34079
|
+
s.stop("Prerequisites OK");
|
|
34080
|
+
}
|
|
34081
|
+
let selectedTheme = "robbyrussell";
|
|
34082
|
+
if (!skipInteractive) {
|
|
34083
|
+
const themeAnswer = await lib_default.prompt([
|
|
34084
|
+
{
|
|
34085
|
+
type: "list",
|
|
34086
|
+
name: "theme",
|
|
34087
|
+
message: "Which theme would you like to use?",
|
|
34088
|
+
choices: THEMES,
|
|
34089
|
+
default: "robbyrussell"
|
|
34090
|
+
}
|
|
34091
|
+
]);
|
|
34092
|
+
if (themeAnswer.theme === "custom") {
|
|
34093
|
+
const customThemeAnswer = await lib_default.prompt([
|
|
34094
|
+
{
|
|
34095
|
+
type: "input",
|
|
34096
|
+
name: "customTheme",
|
|
34097
|
+
message: "Enter the theme name (see: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes):",
|
|
34098
|
+
default: "robbyrussell",
|
|
34099
|
+
validate: (value) => {
|
|
34100
|
+
const sanitized = sanitizeThemeName(value);
|
|
34101
|
+
if (sanitized !== value) {
|
|
34102
|
+
return `Theme name can only contain letters, numbers, hyphens, and underscores. Will use: "${sanitized}"`;
|
|
34103
|
+
}
|
|
34104
|
+
return true;
|
|
34105
|
+
}
|
|
34106
|
+
}
|
|
34107
|
+
]);
|
|
34108
|
+
selectedTheme = sanitizeThemeName(customThemeAnswer.customTheme);
|
|
34109
|
+
} else {
|
|
34110
|
+
selectedTheme = themeAnswer.theme;
|
|
34111
|
+
}
|
|
34112
|
+
}
|
|
34113
|
+
const zshrcPath = path9.join(homeDir, ".zshrc");
|
|
34114
|
+
if (import_fs_extra7.default.existsSync(zshrcPath)) {
|
|
34115
|
+
s.start("Backing up .zshrc");
|
|
34116
|
+
const backupPath = backupFile(zshrcPath);
|
|
34117
|
+
if (backupPath) {
|
|
34118
|
+
s.stop(`Backup created: ${source_default.gray(backupPath)}`);
|
|
34119
|
+
} else {
|
|
34120
|
+
s.stop("No backup needed");
|
|
34121
|
+
}
|
|
34122
|
+
}
|
|
34123
|
+
if (isOhMyZshInstalled(homeDir)) {
|
|
34124
|
+
console.log(source_default.green("✓ Oh My ZSH already installed"));
|
|
34125
|
+
} else {
|
|
34126
|
+
s.start("Installing Oh My ZSH (this may take a minute)");
|
|
34127
|
+
await installOhMyZsh(homeDir);
|
|
34128
|
+
s.stop("Oh My ZSH installed");
|
|
34129
|
+
}
|
|
34130
|
+
s.start("Installing zsh-autosuggestions plugin");
|
|
34131
|
+
await installPlugin("zsh-autosuggestions", "https://github.com/zsh-users/zsh-autosuggestions", homeDir);
|
|
34132
|
+
s.stop("zsh-autosuggestions installed");
|
|
34133
|
+
s.start("Installing zsh-syntax-highlighting plugin");
|
|
34134
|
+
await installPlugin("zsh-syntax-highlighting", "https://github.com/zsh-users/zsh-syntax-highlighting", homeDir);
|
|
34135
|
+
s.stop("zsh-syntax-highlighting installed");
|
|
34136
|
+
s.start(`Configuring theme: ${selectedTheme}`);
|
|
34137
|
+
updateZshrcTheme(selectedTheme, homeDir);
|
|
34138
|
+
s.stop(`Theme set to: ${selectedTheme}`);
|
|
34139
|
+
s.start("Configuring plugins");
|
|
34140
|
+
updateZshrcPlugins(PLUGINS, homeDir);
|
|
34141
|
+
s.stop("Plugins configured");
|
|
34142
|
+
console.log(source_default.green(`
|
|
34143
|
+
✨ Terminal setup complete!`));
|
|
34144
|
+
console.log(source_default.gray(`
|
|
34145
|
+
Next steps:`));
|
|
34146
|
+
console.log(source_default.gray(" • Restart your terminal or run: source ~/.zshrc"));
|
|
34147
|
+
console.log(source_default.gray(` • Theme: ${selectedTheme}`));
|
|
34148
|
+
console.log(source_default.gray(` • Plugins: ${PLUGINS.join(", ")}`));
|
|
34149
|
+
if (selectedTheme === "agnoster") {
|
|
34150
|
+
console.log(source_default.yellow(`
|
|
34151
|
+
⚠️ Note: agnoster theme requires a Powerline-patched font.`));
|
|
34152
|
+
console.log(source_default.gray(" Install from: https://github.com/powerline/fonts"));
|
|
34153
|
+
}
|
|
34154
|
+
console.log(source_default.blue(`
|
|
34155
|
+
\uD83D\uDCDA Explore more themes: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes`));
|
|
34156
|
+
} catch (error) {
|
|
34157
|
+
console.error(source_default.red(`
|
|
34158
|
+
❌ Setup failed:`), error);
|
|
34159
|
+
process.exit(1);
|
|
34160
|
+
}
|
|
34161
|
+
}
|
|
34162
|
+
|
|
33824
34163
|
// src/commands/addHook.ts
|
|
33825
|
-
var
|
|
33826
|
-
import
|
|
34164
|
+
var import_fs_extra11 = __toESM(require_lib4(), 1);
|
|
34165
|
+
import path13 from "path";
|
|
33827
34166
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
33828
34167
|
import { dirname as dirname4 } from "path";
|
|
33829
34168
|
|
|
33830
34169
|
// src/utils/claude-config.ts
|
|
33831
|
-
var
|
|
33832
|
-
import
|
|
34170
|
+
var import_fs_extra8 = __toESM(require_lib4(), 1);
|
|
34171
|
+
import path10 from "path";
|
|
33833
34172
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
33834
34173
|
import { dirname as dirname3 } from "path";
|
|
33835
34174
|
var __filename3 = fileURLToPath3(import.meta.url);
|
|
@@ -33860,14 +34199,14 @@ function parseYamlFrontmatter(content) {
|
|
|
33860
34199
|
}
|
|
33861
34200
|
function getLocalConfigPaths(subDir) {
|
|
33862
34201
|
return [
|
|
33863
|
-
|
|
33864
|
-
|
|
34202
|
+
path10.join(__dirname3, `../claude-code-config/${subDir}`),
|
|
34203
|
+
path10.join(__dirname3, `../../claude-code-config/${subDir}`)
|
|
33865
34204
|
];
|
|
33866
34205
|
}
|
|
33867
34206
|
async function findLocalConfigDir(subDir) {
|
|
33868
34207
|
const possiblePaths = getLocalConfigPaths(subDir);
|
|
33869
34208
|
for (const testPath of possiblePaths) {
|
|
33870
|
-
if (await
|
|
34209
|
+
if (await import_fs_extra8.default.pathExists(testPath)) {
|
|
33871
34210
|
return testPath;
|
|
33872
34211
|
}
|
|
33873
34212
|
}
|
|
@@ -33878,22 +34217,22 @@ async function getTargetDirectory(options) {
|
|
|
33878
34217
|
return options.folder;
|
|
33879
34218
|
}
|
|
33880
34219
|
const cwd = process.cwd();
|
|
33881
|
-
const localClaudeDir =
|
|
33882
|
-
const isGitRepo = await
|
|
33883
|
-
const hasClaudeConfig = await
|
|
34220
|
+
const localClaudeDir = path10.join(cwd, ".claude");
|
|
34221
|
+
const isGitRepo = await import_fs_extra8.default.pathExists(path10.join(cwd, ".git"));
|
|
34222
|
+
const hasClaudeConfig = await import_fs_extra8.default.pathExists(localClaudeDir);
|
|
33884
34223
|
if (isGitRepo || hasClaudeConfig) {
|
|
33885
34224
|
return localClaudeDir;
|
|
33886
34225
|
}
|
|
33887
|
-
return
|
|
34226
|
+
return path10.join(process.env.HOME || process.env.USERPROFILE || "~", ".claude");
|
|
33888
34227
|
}
|
|
33889
34228
|
|
|
33890
34229
|
// src/utils/file-installer.ts
|
|
33891
|
-
var
|
|
33892
|
-
import
|
|
34230
|
+
var import_fs_extra10 = __toESM(require_lib4(), 1);
|
|
34231
|
+
import path12 from "path";
|
|
33893
34232
|
|
|
33894
34233
|
// src/utils/github.ts
|
|
33895
|
-
var
|
|
33896
|
-
import
|
|
34234
|
+
var import_fs_extra9 = __toESM(require_lib4(), 1);
|
|
34235
|
+
import path11 from "path";
|
|
33897
34236
|
var GITHUB_RAW_BASE3 = "https://raw.githubusercontent.com/Melvynx/aiblueprint-cli/main/claude-code-config";
|
|
33898
34237
|
async function downloadFromGitHub2(relativePath) {
|
|
33899
34238
|
try {
|
|
@@ -33941,8 +34280,8 @@ async function isGitHubAvailable() {
|
|
|
33941
34280
|
async function downloadAndWriteFile(relativePath, targetPath) {
|
|
33942
34281
|
const content = await downloadFromGitHub2(relativePath);
|
|
33943
34282
|
if (content) {
|
|
33944
|
-
await
|
|
33945
|
-
await
|
|
34283
|
+
await import_fs_extra9.default.ensureDir(path11.dirname(targetPath));
|
|
34284
|
+
await import_fs_extra9.default.writeFile(targetPath, content);
|
|
33946
34285
|
return true;
|
|
33947
34286
|
}
|
|
33948
34287
|
return false;
|
|
@@ -33951,7 +34290,7 @@ async function downloadAndWriteFile(relativePath, targetPath) {
|
|
|
33951
34290
|
// src/utils/file-installer.ts
|
|
33952
34291
|
async function installFileWithGitHubFallback(options) {
|
|
33953
34292
|
const { sourceDir, targetPath, fileName } = options;
|
|
33954
|
-
await
|
|
34293
|
+
await import_fs_extra10.default.ensureDir(path12.dirname(targetPath));
|
|
33955
34294
|
const useGitHub = options.useGitHub ?? await isGitHubAvailable();
|
|
33956
34295
|
if (useGitHub) {
|
|
33957
34296
|
const relativePath = `${sourceDir}/${fileName}`;
|
|
@@ -33965,11 +34304,11 @@ async function installFileWithGitHubFallback(options) {
|
|
|
33965
34304
|
if (!localConfigDir) {
|
|
33966
34305
|
throw new Error(`Neither GitHub nor local ${sourceDir} directory found`);
|
|
33967
34306
|
}
|
|
33968
|
-
const localFilePath =
|
|
33969
|
-
if (!await
|
|
34307
|
+
const localFilePath = path12.join(localConfigDir, fileName);
|
|
34308
|
+
if (!await import_fs_extra10.default.pathExists(localFilePath)) {
|
|
33970
34309
|
throw new Error(`File not found: ${fileName}`);
|
|
33971
34310
|
}
|
|
33972
|
-
await
|
|
34311
|
+
await import_fs_extra10.default.copy(localFilePath, targetPath);
|
|
33973
34312
|
}
|
|
33974
34313
|
async function getFileContentWithGitHubFallback(sourceDir, fileName) {
|
|
33975
34314
|
const useGitHub = await isGitHubAvailable();
|
|
@@ -33984,11 +34323,11 @@ async function getFileContentWithGitHubFallback(sourceDir, fileName) {
|
|
|
33984
34323
|
if (!localConfigDir) {
|
|
33985
34324
|
throw new Error(`Neither GitHub nor local ${sourceDir} directory found`);
|
|
33986
34325
|
}
|
|
33987
|
-
const localFilePath =
|
|
33988
|
-
if (!await
|
|
34326
|
+
const localFilePath = path12.join(localConfigDir, fileName);
|
|
34327
|
+
if (!await import_fs_extra10.default.pathExists(localFilePath)) {
|
|
33989
34328
|
throw new Error(`File not found: ${fileName}`);
|
|
33990
34329
|
}
|
|
33991
|
-
return await
|
|
34330
|
+
return await import_fs_extra10.default.readFile(localFilePath, "utf-8");
|
|
33992
34331
|
}
|
|
33993
34332
|
|
|
33994
34333
|
// src/commands/addHook.ts
|
|
@@ -34030,10 +34369,10 @@ async function addHookCommand(hookType, options) {
|
|
|
34030
34369
|
const s = new SimpleSpinner2;
|
|
34031
34370
|
const targetDir = await getTargetDirectory(options);
|
|
34032
34371
|
const claudeDir = targetDir;
|
|
34033
|
-
const targetHookDir =
|
|
34034
|
-
const hookFilePath =
|
|
34035
|
-
const settingsPath =
|
|
34036
|
-
if (await
|
|
34372
|
+
const targetHookDir = path13.join(claudeDir, hook.targetDir || "hooks");
|
|
34373
|
+
const hookFilePath = path13.join(targetHookDir, hook.hookFile);
|
|
34374
|
+
const settingsPath = path13.join(claudeDir, "settings.json");
|
|
34375
|
+
if (await import_fs_extra11.default.pathExists(hookFilePath)) {
|
|
34037
34376
|
const overwriteAnswer = await lib_default.prompt([{
|
|
34038
34377
|
type: "confirm",
|
|
34039
34378
|
name: "overwrite",
|
|
@@ -34046,18 +34385,18 @@ async function addHookCommand(hookType, options) {
|
|
|
34046
34385
|
}
|
|
34047
34386
|
try {
|
|
34048
34387
|
s.start("Installing hook...");
|
|
34049
|
-
await
|
|
34388
|
+
await import_fs_extra11.default.ensureDir(targetHookDir);
|
|
34050
34389
|
await installFileWithGitHubFallback({
|
|
34051
34390
|
sourceDir: hook.sourceDir || "hooks",
|
|
34052
34391
|
targetPath: hookFilePath,
|
|
34053
34392
|
fileName: hook.hookFile
|
|
34054
34393
|
});
|
|
34055
|
-
await
|
|
34394
|
+
await import_fs_extra11.default.chmod(hookFilePath, 493);
|
|
34056
34395
|
s.stop("Hook file installed");
|
|
34057
34396
|
s.start("Updating settings.json...");
|
|
34058
34397
|
let settings = {};
|
|
34059
34398
|
try {
|
|
34060
|
-
const existingSettings = await
|
|
34399
|
+
const existingSettings = await import_fs_extra11.default.readFile(settingsPath, "utf-8");
|
|
34061
34400
|
settings = JSON.parse(existingSettings);
|
|
34062
34401
|
} catch {
|
|
34063
34402
|
settings = {};
|
|
@@ -34094,7 +34433,7 @@ async function addHookCommand(hookType, options) {
|
|
|
34094
34433
|
} else {
|
|
34095
34434
|
settings.hooks[hook.event].push(newHook);
|
|
34096
34435
|
}
|
|
34097
|
-
await
|
|
34436
|
+
await import_fs_extra11.default.writeFile(settingsPath, JSON.stringify(settings, null, 2));
|
|
34098
34437
|
s.stop("Settings updated");
|
|
34099
34438
|
console.log(source_default.green("✨ Hook installed successfully!"));
|
|
34100
34439
|
console.log(source_default.gray(`
|
|
@@ -34113,8 +34452,8 @@ The hook will run automatically when you edit TypeScript files with Claude Code.
|
|
|
34113
34452
|
}
|
|
34114
34453
|
|
|
34115
34454
|
// src/commands/addCommand.ts
|
|
34116
|
-
var
|
|
34117
|
-
import
|
|
34455
|
+
var import_fs_extra12 = __toESM(require_lib4(), 1);
|
|
34456
|
+
import path14 from "path";
|
|
34118
34457
|
class SimpleSpinner3 {
|
|
34119
34458
|
message = "";
|
|
34120
34459
|
start(message) {
|
|
@@ -34127,11 +34466,11 @@ class SimpleSpinner3 {
|
|
|
34127
34466
|
}
|
|
34128
34467
|
async function getLocalMdFilesRecursively(dir, basePath = "") {
|
|
34129
34468
|
const files = [];
|
|
34130
|
-
const entries = await
|
|
34469
|
+
const entries = await import_fs_extra12.default.readdir(dir, { withFileTypes: true });
|
|
34131
34470
|
for (const entry of entries) {
|
|
34132
34471
|
const relativePath = basePath ? `${basePath}/${entry.name}` : entry.name;
|
|
34133
34472
|
if (entry.isDirectory()) {
|
|
34134
|
-
const subFiles = await getLocalMdFilesRecursively(
|
|
34473
|
+
const subFiles = await getLocalMdFilesRecursively(path14.join(dir, entry.name), relativePath);
|
|
34135
34474
|
files.push(...subFiles);
|
|
34136
34475
|
} else if (entry.name.endsWith(".md")) {
|
|
34137
34476
|
files.push(relativePath);
|
|
@@ -34187,8 +34526,8 @@ function displayAvailableCommands(commands) {
|
|
|
34187
34526
|
console.log();
|
|
34188
34527
|
});
|
|
34189
34528
|
console.log(source_default.gray("Usage:"));
|
|
34190
|
-
console.log(source_default.gray(" aiblueprint claude-code add commands <command-name> # Install specific command"));
|
|
34191
|
-
console.log(source_default.gray(" aiblueprint claude-code add commands # Show this list"));
|
|
34529
|
+
console.log(source_default.gray(" npx aiblueprint-cli@latest claude-code add commands <command-name> # Install specific command"));
|
|
34530
|
+
console.log(source_default.gray(" npx aiblueprint-cli@latest claude-code add commands # Show this list"));
|
|
34192
34531
|
}
|
|
34193
34532
|
async function addCommandCommand(commandName, options = {}) {
|
|
34194
34533
|
console.log(source_default.bgBlue(` aiblueprint-cli v${getVersion()} `));
|
|
@@ -34211,9 +34550,9 @@ async function addCommandCommand(commandName, options = {}) {
|
|
|
34211
34550
|
if (options.folder) {
|
|
34212
34551
|
console.log(source_default.gray(`Using custom folder: ${targetDir}`));
|
|
34213
34552
|
}
|
|
34214
|
-
const commandsDir =
|
|
34215
|
-
const commandFilePath =
|
|
34216
|
-
if (await
|
|
34553
|
+
const commandsDir = path14.join(targetDir, "commands");
|
|
34554
|
+
const commandFilePath = path14.join(commandsDir, command.commandFile);
|
|
34555
|
+
if (await import_fs_extra12.default.pathExists(commandFilePath)) {
|
|
34217
34556
|
const overwriteAnswer = await lib_default.prompt([{
|
|
34218
34557
|
type: "confirm",
|
|
34219
34558
|
name: "overwrite",
|
|
@@ -34420,22 +34759,22 @@ async function symlinkCommand(params = {}) {
|
|
|
34420
34759
|
}
|
|
34421
34760
|
|
|
34422
34761
|
// src/commands/statusline.ts
|
|
34423
|
-
var
|
|
34424
|
-
import
|
|
34762
|
+
var import_fs_extra13 = __toESM(require_lib4(), 1);
|
|
34763
|
+
import path15 from "path";
|
|
34425
34764
|
import { homedir } from "os";
|
|
34426
34765
|
async function statuslineCommand(options) {
|
|
34427
|
-
const claudeDir = options.folder ?
|
|
34766
|
+
const claudeDir = options.folder ? path15.resolve(options.folder) : path15.join(homedir(), ".claude");
|
|
34428
34767
|
console.log(source_default.blue(`\uD83D\uDE80 Setting up AIBlueprint Statusline ${source_default.gray(`v${getVersion()}`)}...`));
|
|
34429
34768
|
console.log(source_default.gray(` Target: ${claudeDir}
|
|
34430
34769
|
`));
|
|
34431
|
-
await
|
|
34770
|
+
await import_fs_extra13.default.ensureDir(claudeDir);
|
|
34432
34771
|
console.log(source_default.cyan("\uD83D\uDCE6 Checking dependencies..."));
|
|
34433
34772
|
await checkAndInstallDependencies();
|
|
34434
34773
|
console.log(source_default.cyan(`
|
|
34435
34774
|
\uD83D\uDCE5 Downloading statusline files...`));
|
|
34436
|
-
const scriptsDir =
|
|
34437
|
-
await
|
|
34438
|
-
const success = await downloadDirectoryFromGitHub("scripts/statusline",
|
|
34775
|
+
const scriptsDir = path15.join(claudeDir, "scripts");
|
|
34776
|
+
await import_fs_extra13.default.ensureDir(scriptsDir);
|
|
34777
|
+
const success = await downloadDirectoryFromGitHub("scripts/statusline", path15.join(scriptsDir, "statusline"));
|
|
34439
34778
|
if (!success) {
|
|
34440
34779
|
console.log(source_default.red(" Failed to download statusline files from GitHub"));
|
|
34441
34780
|
return;
|
|
@@ -34445,19 +34784,19 @@ async function statuslineCommand(options) {
|
|
|
34445
34784
|
await installStatuslineDependencies(claudeDir);
|
|
34446
34785
|
console.log(source_default.cyan(`
|
|
34447
34786
|
⚙️ Configuring settings.json...`));
|
|
34448
|
-
const settingsPath =
|
|
34787
|
+
const settingsPath = path15.join(claudeDir, "settings.json");
|
|
34449
34788
|
let settings = {};
|
|
34450
34789
|
try {
|
|
34451
|
-
const existingSettings = await
|
|
34790
|
+
const existingSettings = await import_fs_extra13.default.readFile(settingsPath, "utf-8");
|
|
34452
34791
|
settings = JSON.parse(existingSettings);
|
|
34453
34792
|
} catch {
|
|
34454
34793
|
}
|
|
34455
34794
|
settings.statusLine = {
|
|
34456
34795
|
type: "command",
|
|
34457
|
-
command: `bun ${
|
|
34796
|
+
command: `bun ${path15.join(claudeDir, "scripts/statusline/src/index.ts")}`,
|
|
34458
34797
|
padding: 0
|
|
34459
34798
|
};
|
|
34460
|
-
await
|
|
34799
|
+
await import_fs_extra13.default.writeJson(settingsPath, settings, { spaces: 2 });
|
|
34461
34800
|
console.log(source_default.green(`
|
|
34462
34801
|
✅ Statusline setup complete!`));
|
|
34463
34802
|
console.log(source_default.gray(`
|
|
@@ -35121,13 +35460,13 @@ var de = () => {
|
|
|
35121
35460
|
};
|
|
35122
35461
|
|
|
35123
35462
|
// src/commands/pro.ts
|
|
35124
|
-
import
|
|
35125
|
-
import
|
|
35463
|
+
import os12 from "os";
|
|
35464
|
+
import path18 from "path";
|
|
35126
35465
|
|
|
35127
35466
|
// src/lib/pro-installer.ts
|
|
35128
|
-
var
|
|
35129
|
-
import
|
|
35130
|
-
import
|
|
35467
|
+
var import_fs_extra14 = __toESM(require_lib4(), 1);
|
|
35468
|
+
import os10 from "os";
|
|
35469
|
+
import path16 from "path";
|
|
35131
35470
|
var PREMIUM_REPO = "Melvynx/aiblueprint-cli-premium";
|
|
35132
35471
|
var PREMIUM_BRANCH = "main";
|
|
35133
35472
|
async function downloadFromPrivateGitHub(repo, branch, relativePath, targetPath, githubToken) {
|
|
@@ -35144,8 +35483,8 @@ async function downloadFromPrivateGitHub(repo, branch, relativePath, targetPath,
|
|
|
35144
35483
|
return false;
|
|
35145
35484
|
}
|
|
35146
35485
|
const content = await response.arrayBuffer();
|
|
35147
|
-
await
|
|
35148
|
-
await
|
|
35486
|
+
await import_fs_extra14.default.ensureDir(path16.dirname(targetPath));
|
|
35487
|
+
await import_fs_extra14.default.writeFile(targetPath, Buffer.from(content));
|
|
35149
35488
|
return true;
|
|
35150
35489
|
} catch (error) {
|
|
35151
35490
|
console.error(`Error downloading ${relativePath}:`, error);
|
|
@@ -35170,10 +35509,10 @@ async function downloadDirectoryFromPrivateGitHub(repo, branch, dirPath, targetD
|
|
|
35170
35509
|
console.error(`Unexpected response for directory ${dirPath}`);
|
|
35171
35510
|
return false;
|
|
35172
35511
|
}
|
|
35173
|
-
await
|
|
35512
|
+
await import_fs_extra14.default.ensureDir(targetDir);
|
|
35174
35513
|
for (const file of files) {
|
|
35175
35514
|
const relativePath = dirPath ? `${dirPath}/${file.name}` : file.name;
|
|
35176
|
-
const targetPath =
|
|
35515
|
+
const targetPath = path16.join(targetDir, file.name);
|
|
35177
35516
|
const displayPath = relativePath.replace("claude-code-config/", "");
|
|
35178
35517
|
if (file.type === "file") {
|
|
35179
35518
|
onProgress?.(displayPath, "file");
|
|
@@ -35190,14 +35529,14 @@ async function downloadDirectoryFromPrivateGitHub(repo, branch, dirPath, targetD
|
|
|
35190
35529
|
}
|
|
35191
35530
|
async function installProConfigs(options) {
|
|
35192
35531
|
const { githubToken, claudeCodeFolder, onProgress } = options;
|
|
35193
|
-
const claudeFolder = claudeCodeFolder ||
|
|
35194
|
-
const tempDir =
|
|
35532
|
+
const claudeFolder = claudeCodeFolder || path16.join(os10.homedir(), ".claude");
|
|
35533
|
+
const tempDir = path16.join(os10.tmpdir(), `aiblueprint-premium-${Date.now()}`);
|
|
35195
35534
|
try {
|
|
35196
35535
|
const success = await downloadDirectoryFromPrivateGitHub(PREMIUM_REPO, PREMIUM_BRANCH, "claude-code-config", tempDir, githubToken, onProgress);
|
|
35197
35536
|
if (!success) {
|
|
35198
35537
|
throw new Error("Failed to download premium configurations");
|
|
35199
35538
|
}
|
|
35200
|
-
await
|
|
35539
|
+
await import_fs_extra14.default.copy(tempDir, claudeFolder, {
|
|
35201
35540
|
overwrite: true,
|
|
35202
35541
|
recursive: true
|
|
35203
35542
|
});
|
|
@@ -35205,41 +35544,41 @@ async function installProConfigs(options) {
|
|
|
35205
35544
|
throw new Error(`Failed to install premium configs: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
35206
35545
|
} finally {
|
|
35207
35546
|
try {
|
|
35208
|
-
await
|
|
35547
|
+
await import_fs_extra14.default.remove(tempDir);
|
|
35209
35548
|
} catch {
|
|
35210
35549
|
}
|
|
35211
35550
|
}
|
|
35212
35551
|
}
|
|
35213
35552
|
|
|
35214
35553
|
// src/lib/token-storage.ts
|
|
35215
|
-
var
|
|
35216
|
-
import
|
|
35217
|
-
import
|
|
35554
|
+
var import_fs_extra15 = __toESM(require_lib4(), 1);
|
|
35555
|
+
import os11 from "os";
|
|
35556
|
+
import path17 from "path";
|
|
35218
35557
|
function getConfigDir() {
|
|
35219
|
-
const platform =
|
|
35558
|
+
const platform = os11.platform();
|
|
35220
35559
|
if (platform === "win32") {
|
|
35221
|
-
const appData = process.env.APPDATA ||
|
|
35222
|
-
return
|
|
35560
|
+
const appData = process.env.APPDATA || path17.join(os11.homedir(), "AppData", "Roaming");
|
|
35561
|
+
return path17.join(appData, "aiblueprint");
|
|
35223
35562
|
} else {
|
|
35224
|
-
const configHome = process.env.XDG_CONFIG_HOME ||
|
|
35225
|
-
return
|
|
35563
|
+
const configHome = process.env.XDG_CONFIG_HOME || path17.join(os11.homedir(), ".config");
|
|
35564
|
+
return path17.join(configHome, "aiblueprint");
|
|
35226
35565
|
}
|
|
35227
35566
|
}
|
|
35228
35567
|
function getTokenFilePath() {
|
|
35229
|
-
return
|
|
35568
|
+
return path17.join(getConfigDir(), "token.txt");
|
|
35230
35569
|
}
|
|
35231
35570
|
async function saveToken(githubToken) {
|
|
35232
35571
|
const tokenFile = getTokenFilePath();
|
|
35233
|
-
await
|
|
35234
|
-
await
|
|
35572
|
+
await import_fs_extra15.default.ensureDir(path17.dirname(tokenFile));
|
|
35573
|
+
await import_fs_extra15.default.writeFile(tokenFile, githubToken, { mode: 384 });
|
|
35235
35574
|
}
|
|
35236
35575
|
async function getToken() {
|
|
35237
35576
|
const tokenFile = getTokenFilePath();
|
|
35238
|
-
if (!await
|
|
35577
|
+
if (!await import_fs_extra15.default.pathExists(tokenFile)) {
|
|
35239
35578
|
return null;
|
|
35240
35579
|
}
|
|
35241
35580
|
try {
|
|
35242
|
-
const token = await
|
|
35581
|
+
const token = await import_fs_extra15.default.readFile(tokenFile, "utf-8");
|
|
35243
35582
|
return token.trim();
|
|
35244
35583
|
} catch (error) {
|
|
35245
35584
|
return null;
|
|
@@ -35248,12 +35587,12 @@ async function getToken() {
|
|
|
35248
35587
|
function getTokenInfo() {
|
|
35249
35588
|
return {
|
|
35250
35589
|
path: getTokenFilePath(),
|
|
35251
|
-
platform:
|
|
35590
|
+
platform: os11.platform()
|
|
35252
35591
|
};
|
|
35253
35592
|
}
|
|
35254
35593
|
|
|
35255
35594
|
// src/commands/pro.ts
|
|
35256
|
-
var
|
|
35595
|
+
var import_fs_extra16 = __toESM(require_lib4(), 1);
|
|
35257
35596
|
var API_URL = "https://codeline.app/api/products";
|
|
35258
35597
|
var PRODUCT_ID = "prd_XJVgxVPbGG";
|
|
35259
35598
|
async function countInstalledItems(claudeDir) {
|
|
@@ -35263,27 +35602,27 @@ async function countInstalledItems(claudeDir) {
|
|
|
35263
35602
|
skills: 0
|
|
35264
35603
|
};
|
|
35265
35604
|
try {
|
|
35266
|
-
const commandsDir =
|
|
35267
|
-
if (await
|
|
35268
|
-
const files = await
|
|
35605
|
+
const commandsDir = path18.join(claudeDir, "commands");
|
|
35606
|
+
if (await import_fs_extra16.default.pathExists(commandsDir)) {
|
|
35607
|
+
const files = await import_fs_extra16.default.readdir(commandsDir);
|
|
35269
35608
|
counts.commands = files.filter((f3) => f3.endsWith(".md")).length;
|
|
35270
35609
|
}
|
|
35271
35610
|
} catch {
|
|
35272
35611
|
}
|
|
35273
35612
|
try {
|
|
35274
|
-
const agentsDir =
|
|
35275
|
-
if (await
|
|
35276
|
-
const files = await
|
|
35613
|
+
const agentsDir = path18.join(claudeDir, "agents");
|
|
35614
|
+
if (await import_fs_extra16.default.pathExists(agentsDir)) {
|
|
35615
|
+
const files = await import_fs_extra16.default.readdir(agentsDir);
|
|
35277
35616
|
counts.agents = files.filter((f3) => f3.endsWith(".md")).length;
|
|
35278
35617
|
}
|
|
35279
35618
|
} catch {
|
|
35280
35619
|
}
|
|
35281
35620
|
try {
|
|
35282
|
-
const skillsDir =
|
|
35283
|
-
if (await
|
|
35284
|
-
const items = await
|
|
35621
|
+
const skillsDir = path18.join(claudeDir, "skills");
|
|
35622
|
+
if (await import_fs_extra16.default.pathExists(skillsDir)) {
|
|
35623
|
+
const items = await import_fs_extra16.default.readdir(skillsDir);
|
|
35285
35624
|
const dirs = await Promise.all(items.map(async (item) => {
|
|
35286
|
-
const stat = await
|
|
35625
|
+
const stat = await import_fs_extra16.default.stat(path18.join(skillsDir, item));
|
|
35287
35626
|
return stat.isDirectory();
|
|
35288
35627
|
}));
|
|
35289
35628
|
counts.skills = dirs.filter(Boolean).length;
|
|
@@ -35346,7 +35685,7 @@ async function proActivateCommand(userToken) {
|
|
|
35346
35685
|
f2.info(`Product: ${data.product.title}`);
|
|
35347
35686
|
f2.info(`Token saved to: ${tokenInfo.path}`);
|
|
35348
35687
|
f2.info(source_default.cyan(`
|
|
35349
|
-
\uD83D\uDCA1 Next step: Run 'aiblueprint claude-code pro setup' to install premium configs`));
|
|
35688
|
+
\uD83D\uDCA1 Next step: Run 'npx aiblueprint-cli@latest claude-code pro setup' to install premium configs`));
|
|
35350
35689
|
$e(source_default.green("✅ Activation complete!"));
|
|
35351
35690
|
} catch (error) {
|
|
35352
35691
|
if (error instanceof Error) {
|
|
@@ -35362,7 +35701,7 @@ async function proStatusCommand() {
|
|
|
35362
35701
|
const token = await getToken();
|
|
35363
35702
|
if (!token) {
|
|
35364
35703
|
f2.warn("No token found");
|
|
35365
|
-
f2.info("Run: aiblueprint claude-code pro activate <token>");
|
|
35704
|
+
f2.info("Run: npx aiblueprint-cli@latest claude-code pro activate <token>");
|
|
35366
35705
|
f2.info("Get your token at: https://mlv.sh/claude-cli");
|
|
35367
35706
|
$e(source_default.yellow("⚠️ Not activated"));
|
|
35368
35707
|
process.exit(0);
|
|
@@ -35386,11 +35725,11 @@ async function proSetupCommand(options = {}) {
|
|
|
35386
35725
|
const githubToken = await getToken();
|
|
35387
35726
|
if (!githubToken) {
|
|
35388
35727
|
f2.error("No token found");
|
|
35389
|
-
f2.info("Run: aiblueprint claude-code pro activate <token>");
|
|
35728
|
+
f2.info("Run: npx aiblueprint-cli@latest claude-code pro activate <token>");
|
|
35390
35729
|
$e(source_default.red("❌ Not activated"));
|
|
35391
35730
|
process.exit(1);
|
|
35392
35731
|
}
|
|
35393
|
-
const claudeDir = options.folder ?
|
|
35732
|
+
const claudeDir = options.folder ? path18.resolve(options.folder) : path18.join(os12.homedir(), ".claude");
|
|
35394
35733
|
const spinner = de();
|
|
35395
35734
|
const onProgress = (file, type) => {
|
|
35396
35735
|
spinner.message(`Installing: ${source_default.cyan(file)} ${source_default.gray(`(${type})`)}`);
|
|
@@ -35445,7 +35784,7 @@ async function proUpdateCommand(options = {}) {
|
|
|
35445
35784
|
const githubToken = await getToken();
|
|
35446
35785
|
if (!githubToken) {
|
|
35447
35786
|
f2.error("No token found");
|
|
35448
|
-
f2.info("Run: aiblueprint claude-code pro activate <token>");
|
|
35787
|
+
f2.info("Run: npx aiblueprint-cli@latest claude-code pro activate <token>");
|
|
35449
35788
|
$e(source_default.red("❌ Not activated"));
|
|
35450
35789
|
process.exit(1);
|
|
35451
35790
|
}
|
|
@@ -35467,12 +35806,12 @@ async function proUpdateCommand(options = {}) {
|
|
|
35467
35806
|
}
|
|
35468
35807
|
|
|
35469
35808
|
// src/commands/sync.ts
|
|
35470
|
-
import
|
|
35471
|
-
import
|
|
35809
|
+
import os13 from "os";
|
|
35810
|
+
import path20 from "path";
|
|
35472
35811
|
|
|
35473
35812
|
// src/lib/sync-utils.ts
|
|
35474
|
-
var
|
|
35475
|
-
import
|
|
35813
|
+
var import_fs_extra17 = __toESM(require_lib4(), 1);
|
|
35814
|
+
import path19 from "path";
|
|
35476
35815
|
import crypto from "crypto";
|
|
35477
35816
|
var PREMIUM_REPO2 = "Melvynx/aiblueprint-cli-premium";
|
|
35478
35817
|
var PREMIUM_BRANCH2 = "main";
|
|
@@ -35521,7 +35860,7 @@ async function listRemoteFilesRecursive(dirPath, githubToken, basePath = "") {
|
|
|
35521
35860
|
}
|
|
35522
35861
|
async function computeLocalFileSha(filePath) {
|
|
35523
35862
|
try {
|
|
35524
|
-
const content = await
|
|
35863
|
+
const content = await import_fs_extra17.default.readFile(filePath);
|
|
35525
35864
|
return computeFileSha(content);
|
|
35526
35865
|
} catch {
|
|
35527
35866
|
return null;
|
|
@@ -35529,15 +35868,15 @@ async function computeLocalFileSha(filePath) {
|
|
|
35529
35868
|
}
|
|
35530
35869
|
async function listLocalFiles(dir) {
|
|
35531
35870
|
const files = [];
|
|
35532
|
-
if (!await
|
|
35871
|
+
if (!await import_fs_extra17.default.pathExists(dir)) {
|
|
35533
35872
|
return files;
|
|
35534
35873
|
}
|
|
35535
|
-
const items = await
|
|
35874
|
+
const items = await import_fs_extra17.default.readdir(dir);
|
|
35536
35875
|
for (const item of items) {
|
|
35537
35876
|
if (item === "node_modules" || item === ".DS_Store")
|
|
35538
35877
|
continue;
|
|
35539
|
-
const fullPath =
|
|
35540
|
-
const stat = await
|
|
35878
|
+
const fullPath = path19.join(dir, item);
|
|
35879
|
+
const stat = await import_fs_extra17.default.stat(fullPath);
|
|
35541
35880
|
if (stat.isDirectory()) {
|
|
35542
35881
|
files.push(item);
|
|
35543
35882
|
const subFiles = await listLocalFilesRecursive(fullPath, item);
|
|
@@ -35550,13 +35889,13 @@ async function listLocalFiles(dir) {
|
|
|
35550
35889
|
}
|
|
35551
35890
|
async function listLocalFilesRecursive(dir, basePath) {
|
|
35552
35891
|
const files = [];
|
|
35553
|
-
const items = await
|
|
35892
|
+
const items = await import_fs_extra17.default.readdir(dir);
|
|
35554
35893
|
for (const item of items) {
|
|
35555
35894
|
if (item === "node_modules" || item === ".DS_Store")
|
|
35556
35895
|
continue;
|
|
35557
|
-
const fullPath =
|
|
35896
|
+
const fullPath = path19.join(dir, item);
|
|
35558
35897
|
const relativePath = `${basePath}/${item}`;
|
|
35559
|
-
const stat = await
|
|
35898
|
+
const stat = await import_fs_extra17.default.stat(fullPath);
|
|
35560
35899
|
if (stat.isDirectory()) {
|
|
35561
35900
|
files.push(relativePath);
|
|
35562
35901
|
const subFiles = await listLocalFilesRecursive(fullPath, relativePath);
|
|
@@ -35569,7 +35908,7 @@ async function listLocalFilesRecursive(dir, basePath) {
|
|
|
35569
35908
|
}
|
|
35570
35909
|
async function analyzeCategory(category, claudeDir, githubToken) {
|
|
35571
35910
|
const items = [];
|
|
35572
|
-
const localDir =
|
|
35911
|
+
const localDir = path19.join(claudeDir, category);
|
|
35573
35912
|
const remoteFiles = await listRemoteFilesRecursive(category, githubToken);
|
|
35574
35913
|
const localFiles = await listLocalFiles(localDir);
|
|
35575
35914
|
const remoteSet = new Map;
|
|
@@ -35578,7 +35917,7 @@ async function analyzeCategory(category, claudeDir, githubToken) {
|
|
|
35578
35917
|
}
|
|
35579
35918
|
const localSet = new Set(localFiles);
|
|
35580
35919
|
for (const [remotePath, { sha, isFolder }] of remoteSet) {
|
|
35581
|
-
const localPath =
|
|
35920
|
+
const localPath = path19.join(localDir, remotePath);
|
|
35582
35921
|
if (isFolder) {
|
|
35583
35922
|
continue;
|
|
35584
35923
|
}
|
|
@@ -35610,8 +35949,8 @@ async function analyzeCategory(category, claudeDir, githubToken) {
|
|
|
35610
35949
|
}
|
|
35611
35950
|
for (const localPath of localSet) {
|
|
35612
35951
|
if (!remoteSet.has(localPath)) {
|
|
35613
|
-
const fullPath =
|
|
35614
|
-
const stat = await
|
|
35952
|
+
const fullPath = path19.join(localDir, localPath);
|
|
35953
|
+
const stat = await import_fs_extra17.default.stat(fullPath).catch(() => null);
|
|
35615
35954
|
if (stat && !stat.isDirectory()) {
|
|
35616
35955
|
items.push({
|
|
35617
35956
|
name: localPath,
|
|
@@ -35642,9 +35981,9 @@ async function fetchRemoteSettings(githubToken) {
|
|
|
35642
35981
|
}
|
|
35643
35982
|
}
|
|
35644
35983
|
async function getLocalSettings(claudeDir) {
|
|
35645
|
-
const settingsPath =
|
|
35984
|
+
const settingsPath = path19.join(claudeDir, "settings.json");
|
|
35646
35985
|
try {
|
|
35647
|
-
const content = await
|
|
35986
|
+
const content = await import_fs_extra17.default.readFile(settingsPath, "utf-8");
|
|
35648
35987
|
return JSON.parse(content);
|
|
35649
35988
|
} catch {
|
|
35650
35989
|
return {};
|
|
@@ -35725,8 +36064,8 @@ async function downloadFromPrivateGitHub2(relativePath, targetPath, githubToken)
|
|
|
35725
36064
|
return false;
|
|
35726
36065
|
}
|
|
35727
36066
|
const content = await response.arrayBuffer();
|
|
35728
|
-
await
|
|
35729
|
-
await
|
|
36067
|
+
await import_fs_extra17.default.ensureDir(path19.dirname(targetPath));
|
|
36068
|
+
await import_fs_extra17.default.writeFile(targetPath, Buffer.from(content));
|
|
35730
36069
|
return true;
|
|
35731
36070
|
} catch {
|
|
35732
36071
|
return false;
|
|
@@ -35736,10 +36075,10 @@ async function syncSelectedHooks(claudeDir, hooks, onProgress) {
|
|
|
35736
36075
|
if (hooks.length === 0) {
|
|
35737
36076
|
return { success: 0, failed: 0 };
|
|
35738
36077
|
}
|
|
35739
|
-
const settingsPath =
|
|
36078
|
+
const settingsPath = path19.join(claudeDir, "settings.json");
|
|
35740
36079
|
let settings = {};
|
|
35741
36080
|
try {
|
|
35742
|
-
const content = await
|
|
36081
|
+
const content = await import_fs_extra17.default.readFile(settingsPath, "utf-8");
|
|
35743
36082
|
settings = JSON.parse(content);
|
|
35744
36083
|
} catch {
|
|
35745
36084
|
settings = {};
|
|
@@ -35767,7 +36106,7 @@ async function syncSelectedHooks(claudeDir, hooks, onProgress) {
|
|
|
35767
36106
|
failed++;
|
|
35768
36107
|
}
|
|
35769
36108
|
}
|
|
35770
|
-
await
|
|
36109
|
+
await import_fs_extra17.default.writeFile(settingsPath, JSON.stringify(settings, null, 2));
|
|
35771
36110
|
return { success, failed };
|
|
35772
36111
|
}
|
|
35773
36112
|
async function syncSelectedItems(claudeDir, items, githubToken, onProgress) {
|
|
@@ -35775,11 +36114,11 @@ async function syncSelectedItems(claudeDir, items, githubToken, onProgress) {
|
|
|
35775
36114
|
let failed = 0;
|
|
35776
36115
|
let deleted = 0;
|
|
35777
36116
|
for (const item of items) {
|
|
35778
|
-
const targetPath =
|
|
36117
|
+
const targetPath = path19.join(claudeDir, item.relativePath);
|
|
35779
36118
|
if (item.status === "deleted") {
|
|
35780
36119
|
onProgress?.(item.relativePath, "deleting");
|
|
35781
36120
|
try {
|
|
35782
|
-
await
|
|
36121
|
+
await import_fs_extra17.default.remove(targetPath);
|
|
35783
36122
|
deleted++;
|
|
35784
36123
|
} catch {
|
|
35785
36124
|
failed++;
|
|
@@ -35926,11 +36265,11 @@ async function proSyncCommand(options = {}) {
|
|
|
35926
36265
|
const githubToken = await getToken();
|
|
35927
36266
|
if (!githubToken) {
|
|
35928
36267
|
f2.error("No token found");
|
|
35929
|
-
f2.info("Run: aiblueprint claude-code pro activate <token>");
|
|
36268
|
+
f2.info("Run: npx aiblueprint-cli@latest claude-code pro activate <token>");
|
|
35930
36269
|
$e(source_default.red("❌ Not activated"));
|
|
35931
36270
|
process.exit(1);
|
|
35932
36271
|
}
|
|
35933
|
-
const claudeDir = options.folder ?
|
|
36272
|
+
const claudeDir = options.folder ? path20.resolve(options.folder) : path20.join(os13.homedir(), ".claude");
|
|
35934
36273
|
const spinner = de();
|
|
35935
36274
|
spinner.start("Analyzing changes...");
|
|
35936
36275
|
const result = await analyzeSyncChanges(claudeDir, githubToken);
|
|
@@ -36122,11 +36461,18 @@ claudeCodeCmd.command("setup").description("Setup Claude Code configuration with
|
|
|
36122
36461
|
skipInteractive: parentOptions.skip
|
|
36123
36462
|
});
|
|
36124
36463
|
});
|
|
36464
|
+
claudeCodeCmd.command("setup-terminal").description("Setup terminal with Oh My ZSH, plugins, and a beautiful theme").action((options, command) => {
|
|
36465
|
+
const parentOptions = command.parent.opts();
|
|
36466
|
+
setupTerminalCommand({
|
|
36467
|
+
skipInteractive: parentOptions.skip,
|
|
36468
|
+
homeDir: parentOptions.claudeCodeFolder || parentOptions.folder
|
|
36469
|
+
});
|
|
36470
|
+
});
|
|
36125
36471
|
var addCmd = claudeCodeCmd.command("add").description(`Add components to your Claude Code configuration
|
|
36126
36472
|
` + `Examples:
|
|
36127
|
-
` + ` aiblueprint claude-code add hook post-edit-typescript
|
|
36128
|
-
` + ` aiblueprint claude-code add commands
|
|
36129
|
-
` + " aiblueprint claude-code add commands commit");
|
|
36473
|
+
` + ` npx aiblueprint-cli@latest claude-code add hook post-edit-typescript
|
|
36474
|
+
` + ` npx aiblueprint-cli@latest claude-code add commands
|
|
36475
|
+
` + " npx aiblueprint-cli@latest claude-code add commands commit");
|
|
36130
36476
|
addCmd.command("hook <type>").description("Add a hook to your Claude Code configuration. Available types: post-edit-typescript").action((type, options, command) => {
|
|
36131
36477
|
const parentOptions = command.parent.parent.opts();
|
|
36132
36478
|
const claudeCodeFolder = parentOptions.claudeCodeFolder || parentOptions.folder;
|