aiblueprint-cli 1.4.1 → 1.4.2
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 +419 -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,280 @@ 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
|
+
async function installOhMyZsh(homeDir) {
|
|
33899
|
+
return new Promise((resolve, reject) => {
|
|
33900
|
+
const installCmd = `sh -c "$(curl -fsSL ${OHMYZSH_INSTALL_URL})" "" --unattended`;
|
|
33901
|
+
const env2 = { ...process.env, HOME: homeDir, ZSH: path9.join(homeDir, ".oh-my-zsh") };
|
|
33902
|
+
exec(installCmd, { timeout: INSTALL_TIMEOUT, env: env2 }, (error, stdout, stderr) => {
|
|
33903
|
+
if (error) {
|
|
33904
|
+
if (error.killed) {
|
|
33905
|
+
reject(new Error("Oh My ZSH installation timed out. Please check your network connection."));
|
|
33906
|
+
} else {
|
|
33907
|
+
reject(new Error(`Failed to install Oh My ZSH: ${stderr || error.message}`));
|
|
33908
|
+
}
|
|
33909
|
+
} else {
|
|
33910
|
+
resolve();
|
|
33911
|
+
}
|
|
33912
|
+
});
|
|
33913
|
+
});
|
|
33914
|
+
}
|
|
33915
|
+
async function installPlugin(pluginName, repoUrl, homeDir) {
|
|
33916
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(pluginName)) {
|
|
33917
|
+
throw new Error(`Invalid plugin name: ${pluginName}`);
|
|
33918
|
+
}
|
|
33919
|
+
if (!/^https:\/\/github\.com\/[\w-]+\/[\w-]+$/.test(repoUrl)) {
|
|
33920
|
+
throw new Error(`Invalid repository URL: ${repoUrl}`);
|
|
33921
|
+
}
|
|
33922
|
+
const customPluginsDir = path9.join(homeDir, ".oh-my-zsh/custom/plugins", pluginName);
|
|
33923
|
+
if (import_fs_extra7.default.existsSync(customPluginsDir)) {
|
|
33924
|
+
return;
|
|
33925
|
+
}
|
|
33926
|
+
return new Promise((resolve, reject) => {
|
|
33927
|
+
exec(`git clone ${repoUrl} "${customPluginsDir}"`, { timeout: PLUGIN_TIMEOUT }, (error, stdout, stderr) => {
|
|
33928
|
+
if (error) {
|
|
33929
|
+
if (error.killed) {
|
|
33930
|
+
reject(new Error(`Plugin ${pluginName} installation timed out. Please check your network connection.`));
|
|
33931
|
+
} else {
|
|
33932
|
+
reject(new Error(`Failed to install ${pluginName}: ${stderr || error.message}`));
|
|
33933
|
+
}
|
|
33934
|
+
} else {
|
|
33935
|
+
resolve();
|
|
33936
|
+
}
|
|
33937
|
+
});
|
|
33938
|
+
});
|
|
33939
|
+
}
|
|
33940
|
+
function updateZshrcTheme(theme, homeDir) {
|
|
33941
|
+
const zshrcPath = path9.join(homeDir, ".zshrc");
|
|
33942
|
+
const sanitizedTheme = sanitizeThemeName(theme);
|
|
33943
|
+
if (!import_fs_extra7.default.existsSync(zshrcPath)) {
|
|
33944
|
+
throw new Error(".zshrc file not found. Please ensure Oh My ZSH is installed correctly.");
|
|
33945
|
+
}
|
|
33946
|
+
try {
|
|
33947
|
+
let content = import_fs_extra7.default.readFileSync(zshrcPath, "utf-8");
|
|
33948
|
+
if (content.match(/^ZSH_THEME=/m)) {
|
|
33949
|
+
content = content.replace(/^ZSH_THEME=.*/m, `ZSH_THEME="${sanitizedTheme}"`);
|
|
33950
|
+
} else {
|
|
33951
|
+
content = `ZSH_THEME="${sanitizedTheme}"
|
|
33952
|
+
${content}`;
|
|
33953
|
+
}
|
|
33954
|
+
import_fs_extra7.default.writeFileSync(zshrcPath, content);
|
|
33955
|
+
} catch (error) {
|
|
33956
|
+
if (error.message.includes(".zshrc file not found")) {
|
|
33957
|
+
throw error;
|
|
33958
|
+
}
|
|
33959
|
+
throw new Error(`Failed to update theme in .zshrc: ${error.message}`);
|
|
33960
|
+
}
|
|
33961
|
+
}
|
|
33962
|
+
function updateZshrcPlugins(plugins, homeDir) {
|
|
33963
|
+
const zshrcPath = path9.join(homeDir, ".zshrc");
|
|
33964
|
+
if (!import_fs_extra7.default.existsSync(zshrcPath)) {
|
|
33965
|
+
throw new Error(".zshrc file not found. Please ensure Oh My ZSH is installed correctly.");
|
|
33966
|
+
}
|
|
33967
|
+
try {
|
|
33968
|
+
let content = import_fs_extra7.default.readFileSync(zshrcPath, "utf-8");
|
|
33969
|
+
const pluginsString = plugins.join(" ");
|
|
33970
|
+
if (content.match(/^plugins=\(/m)) {
|
|
33971
|
+
content = content.replace(/^plugins=\([^)]*\)/m, `plugins=(${pluginsString})`);
|
|
33972
|
+
} else {
|
|
33973
|
+
content = `${content}
|
|
33974
|
+
plugins=(${pluginsString})`;
|
|
33975
|
+
}
|
|
33976
|
+
import_fs_extra7.default.writeFileSync(zshrcPath, content);
|
|
33977
|
+
} catch (error) {
|
|
33978
|
+
if (error.message.includes(".zshrc file not found")) {
|
|
33979
|
+
throw error;
|
|
33980
|
+
}
|
|
33981
|
+
throw new Error(`Failed to update plugins in .zshrc: ${error.message}`);
|
|
33982
|
+
}
|
|
33983
|
+
}
|
|
33984
|
+
async function setupTerminalCommand(options = {}) {
|
|
33985
|
+
const { skipInteractive, homeDir: customHomeDir } = options;
|
|
33986
|
+
const homeDir = customHomeDir || os9.homedir();
|
|
33987
|
+
try {
|
|
33988
|
+
console.log(source_default.blue.bold(`
|
|
33989
|
+
\uD83D\uDDA5️ AIBlueprint Terminal Setup ${source_default.gray(`v${getVersion()}`)}
|
|
33990
|
+
`));
|
|
33991
|
+
console.log(source_default.bgBlue(" Setting up your terminal with Oh My ZSH "));
|
|
33992
|
+
const platformInfo = getPlatformInfo();
|
|
33993
|
+
if (platformInfo.isWindows) {
|
|
33994
|
+
console.log(source_default.red(`
|
|
33995
|
+
❌ This command is not supported on Windows.`));
|
|
33996
|
+
console.log(source_default.yellow("Please use WSL (Windows Subsystem for Linux) instead:"));
|
|
33997
|
+
console.log(source_default.gray(" 1. Open PowerShell as Administrator"));
|
|
33998
|
+
console.log(source_default.gray(" 2. Run: wsl --install"));
|
|
33999
|
+
console.log(source_default.gray(" 3. Restart your computer"));
|
|
34000
|
+
console.log(source_default.gray(" 4. Open WSL and run this command again"));
|
|
34001
|
+
process.exit(1);
|
|
34002
|
+
}
|
|
34003
|
+
const s = new SimpleSpinner;
|
|
34004
|
+
s.start("Checking prerequisites");
|
|
34005
|
+
const missingPrereqs = [];
|
|
34006
|
+
if (!commandExists("curl")) {
|
|
34007
|
+
missingPrereqs.push("curl");
|
|
34008
|
+
}
|
|
34009
|
+
if (!commandExists("git")) {
|
|
34010
|
+
missingPrereqs.push("git");
|
|
34011
|
+
}
|
|
34012
|
+
if (!commandExists("zsh")) {
|
|
34013
|
+
missingPrereqs.push("zsh");
|
|
34014
|
+
}
|
|
34015
|
+
if (missingPrereqs.length > 0) {
|
|
34016
|
+
s.stop(source_default.red("Missing prerequisites"));
|
|
34017
|
+
console.log(source_default.red(`
|
|
34018
|
+
❌ Missing required tools: ${missingPrereqs.join(", ")}`));
|
|
34019
|
+
console.log(source_default.yellow(`
|
|
34020
|
+
Please install them first:`));
|
|
34021
|
+
if (platformInfo.isMacOS) {
|
|
34022
|
+
console.log(source_default.gray(" brew install " + missingPrereqs.join(" ")));
|
|
34023
|
+
} else {
|
|
34024
|
+
console.log(source_default.gray(" sudo apt install " + missingPrereqs.join(" ")));
|
|
34025
|
+
}
|
|
34026
|
+
process.exit(1);
|
|
34027
|
+
}
|
|
34028
|
+
s.stop("Prerequisites OK");
|
|
34029
|
+
let selectedTheme = "robbyrussell";
|
|
34030
|
+
if (!skipInteractive) {
|
|
34031
|
+
const themeAnswer = await lib_default.prompt([
|
|
34032
|
+
{
|
|
34033
|
+
type: "list",
|
|
34034
|
+
name: "theme",
|
|
34035
|
+
message: "Which theme would you like to use?",
|
|
34036
|
+
choices: THEMES,
|
|
34037
|
+
default: "robbyrussell"
|
|
34038
|
+
}
|
|
34039
|
+
]);
|
|
34040
|
+
if (themeAnswer.theme === "custom") {
|
|
34041
|
+
const customThemeAnswer = await lib_default.prompt([
|
|
34042
|
+
{
|
|
34043
|
+
type: "input",
|
|
34044
|
+
name: "customTheme",
|
|
34045
|
+
message: "Enter the theme name (see: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes):",
|
|
34046
|
+
default: "robbyrussell",
|
|
34047
|
+
validate: (value) => {
|
|
34048
|
+
const sanitized = sanitizeThemeName(value);
|
|
34049
|
+
if (sanitized !== value) {
|
|
34050
|
+
return `Theme name can only contain letters, numbers, hyphens, and underscores. Will use: "${sanitized}"`;
|
|
34051
|
+
}
|
|
34052
|
+
return true;
|
|
34053
|
+
}
|
|
34054
|
+
}
|
|
34055
|
+
]);
|
|
34056
|
+
selectedTheme = sanitizeThemeName(customThemeAnswer.customTheme);
|
|
34057
|
+
} else {
|
|
34058
|
+
selectedTheme = themeAnswer.theme;
|
|
34059
|
+
}
|
|
34060
|
+
}
|
|
34061
|
+
const zshrcPath = path9.join(homeDir, ".zshrc");
|
|
34062
|
+
if (import_fs_extra7.default.existsSync(zshrcPath)) {
|
|
34063
|
+
s.start("Backing up .zshrc");
|
|
34064
|
+
const backupPath = backupFile(zshrcPath);
|
|
34065
|
+
if (backupPath) {
|
|
34066
|
+
s.stop(`Backup created: ${source_default.gray(backupPath)}`);
|
|
34067
|
+
} else {
|
|
34068
|
+
s.stop("No backup needed");
|
|
34069
|
+
}
|
|
34070
|
+
}
|
|
34071
|
+
if (isOhMyZshInstalled(homeDir)) {
|
|
34072
|
+
console.log(source_default.green("✓ Oh My ZSH already installed"));
|
|
34073
|
+
} else {
|
|
34074
|
+
s.start("Installing Oh My ZSH (this may take a minute)");
|
|
34075
|
+
await installOhMyZsh(homeDir);
|
|
34076
|
+
s.stop("Oh My ZSH installed");
|
|
34077
|
+
}
|
|
34078
|
+
s.start("Installing zsh-autosuggestions plugin");
|
|
34079
|
+
await installPlugin("zsh-autosuggestions", "https://github.com/zsh-users/zsh-autosuggestions", homeDir);
|
|
34080
|
+
s.stop("zsh-autosuggestions installed");
|
|
34081
|
+
s.start("Installing zsh-syntax-highlighting plugin");
|
|
34082
|
+
await installPlugin("zsh-syntax-highlighting", "https://github.com/zsh-users/zsh-syntax-highlighting", homeDir);
|
|
34083
|
+
s.stop("zsh-syntax-highlighting installed");
|
|
34084
|
+
s.start(`Configuring theme: ${selectedTheme}`);
|
|
34085
|
+
updateZshrcTheme(selectedTheme, homeDir);
|
|
34086
|
+
s.stop(`Theme set to: ${selectedTheme}`);
|
|
34087
|
+
s.start("Configuring plugins");
|
|
34088
|
+
updateZshrcPlugins(PLUGINS, homeDir);
|
|
34089
|
+
s.stop("Plugins configured");
|
|
34090
|
+
console.log(source_default.green(`
|
|
34091
|
+
✨ Terminal setup complete!`));
|
|
34092
|
+
console.log(source_default.gray(`
|
|
34093
|
+
Next steps:`));
|
|
34094
|
+
console.log(source_default.gray(" • Restart your terminal or run: source ~/.zshrc"));
|
|
34095
|
+
console.log(source_default.gray(` • Theme: ${selectedTheme}`));
|
|
34096
|
+
console.log(source_default.gray(` • Plugins: ${PLUGINS.join(", ")}`));
|
|
34097
|
+
if (selectedTheme === "agnoster") {
|
|
34098
|
+
console.log(source_default.yellow(`
|
|
34099
|
+
⚠️ Note: agnoster theme requires a Powerline-patched font.`));
|
|
34100
|
+
console.log(source_default.gray(" Install from: https://github.com/powerline/fonts"));
|
|
34101
|
+
}
|
|
34102
|
+
console.log(source_default.blue(`
|
|
34103
|
+
\uD83D\uDCDA Explore more themes: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes`));
|
|
34104
|
+
} catch (error) {
|
|
34105
|
+
console.error(source_default.red(`
|
|
34106
|
+
❌ Setup failed:`), error);
|
|
34107
|
+
process.exit(1);
|
|
34108
|
+
}
|
|
34109
|
+
}
|
|
34110
|
+
|
|
33824
34111
|
// src/commands/addHook.ts
|
|
33825
|
-
var
|
|
33826
|
-
import
|
|
34112
|
+
var import_fs_extra11 = __toESM(require_lib4(), 1);
|
|
34113
|
+
import path13 from "path";
|
|
33827
34114
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
33828
34115
|
import { dirname as dirname4 } from "path";
|
|
33829
34116
|
|
|
33830
34117
|
// src/utils/claude-config.ts
|
|
33831
|
-
var
|
|
33832
|
-
import
|
|
34118
|
+
var import_fs_extra8 = __toESM(require_lib4(), 1);
|
|
34119
|
+
import path10 from "path";
|
|
33833
34120
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
33834
34121
|
import { dirname as dirname3 } from "path";
|
|
33835
34122
|
var __filename3 = fileURLToPath3(import.meta.url);
|
|
@@ -33860,14 +34147,14 @@ function parseYamlFrontmatter(content) {
|
|
|
33860
34147
|
}
|
|
33861
34148
|
function getLocalConfigPaths(subDir) {
|
|
33862
34149
|
return [
|
|
33863
|
-
|
|
33864
|
-
|
|
34150
|
+
path10.join(__dirname3, `../claude-code-config/${subDir}`),
|
|
34151
|
+
path10.join(__dirname3, `../../claude-code-config/${subDir}`)
|
|
33865
34152
|
];
|
|
33866
34153
|
}
|
|
33867
34154
|
async function findLocalConfigDir(subDir) {
|
|
33868
34155
|
const possiblePaths = getLocalConfigPaths(subDir);
|
|
33869
34156
|
for (const testPath of possiblePaths) {
|
|
33870
|
-
if (await
|
|
34157
|
+
if (await import_fs_extra8.default.pathExists(testPath)) {
|
|
33871
34158
|
return testPath;
|
|
33872
34159
|
}
|
|
33873
34160
|
}
|
|
@@ -33878,22 +34165,22 @@ async function getTargetDirectory(options) {
|
|
|
33878
34165
|
return options.folder;
|
|
33879
34166
|
}
|
|
33880
34167
|
const cwd = process.cwd();
|
|
33881
|
-
const localClaudeDir =
|
|
33882
|
-
const isGitRepo = await
|
|
33883
|
-
const hasClaudeConfig = await
|
|
34168
|
+
const localClaudeDir = path10.join(cwd, ".claude");
|
|
34169
|
+
const isGitRepo = await import_fs_extra8.default.pathExists(path10.join(cwd, ".git"));
|
|
34170
|
+
const hasClaudeConfig = await import_fs_extra8.default.pathExists(localClaudeDir);
|
|
33884
34171
|
if (isGitRepo || hasClaudeConfig) {
|
|
33885
34172
|
return localClaudeDir;
|
|
33886
34173
|
}
|
|
33887
|
-
return
|
|
34174
|
+
return path10.join(process.env.HOME || process.env.USERPROFILE || "~", ".claude");
|
|
33888
34175
|
}
|
|
33889
34176
|
|
|
33890
34177
|
// src/utils/file-installer.ts
|
|
33891
|
-
var
|
|
33892
|
-
import
|
|
34178
|
+
var import_fs_extra10 = __toESM(require_lib4(), 1);
|
|
34179
|
+
import path12 from "path";
|
|
33893
34180
|
|
|
33894
34181
|
// src/utils/github.ts
|
|
33895
|
-
var
|
|
33896
|
-
import
|
|
34182
|
+
var import_fs_extra9 = __toESM(require_lib4(), 1);
|
|
34183
|
+
import path11 from "path";
|
|
33897
34184
|
var GITHUB_RAW_BASE3 = "https://raw.githubusercontent.com/Melvynx/aiblueprint-cli/main/claude-code-config";
|
|
33898
34185
|
async function downloadFromGitHub2(relativePath) {
|
|
33899
34186
|
try {
|
|
@@ -33941,8 +34228,8 @@ async function isGitHubAvailable() {
|
|
|
33941
34228
|
async function downloadAndWriteFile(relativePath, targetPath) {
|
|
33942
34229
|
const content = await downloadFromGitHub2(relativePath);
|
|
33943
34230
|
if (content) {
|
|
33944
|
-
await
|
|
33945
|
-
await
|
|
34231
|
+
await import_fs_extra9.default.ensureDir(path11.dirname(targetPath));
|
|
34232
|
+
await import_fs_extra9.default.writeFile(targetPath, content);
|
|
33946
34233
|
return true;
|
|
33947
34234
|
}
|
|
33948
34235
|
return false;
|
|
@@ -33951,7 +34238,7 @@ async function downloadAndWriteFile(relativePath, targetPath) {
|
|
|
33951
34238
|
// src/utils/file-installer.ts
|
|
33952
34239
|
async function installFileWithGitHubFallback(options) {
|
|
33953
34240
|
const { sourceDir, targetPath, fileName } = options;
|
|
33954
|
-
await
|
|
34241
|
+
await import_fs_extra10.default.ensureDir(path12.dirname(targetPath));
|
|
33955
34242
|
const useGitHub = options.useGitHub ?? await isGitHubAvailable();
|
|
33956
34243
|
if (useGitHub) {
|
|
33957
34244
|
const relativePath = `${sourceDir}/${fileName}`;
|
|
@@ -33965,11 +34252,11 @@ async function installFileWithGitHubFallback(options) {
|
|
|
33965
34252
|
if (!localConfigDir) {
|
|
33966
34253
|
throw new Error(`Neither GitHub nor local ${sourceDir} directory found`);
|
|
33967
34254
|
}
|
|
33968
|
-
const localFilePath =
|
|
33969
|
-
if (!await
|
|
34255
|
+
const localFilePath = path12.join(localConfigDir, fileName);
|
|
34256
|
+
if (!await import_fs_extra10.default.pathExists(localFilePath)) {
|
|
33970
34257
|
throw new Error(`File not found: ${fileName}`);
|
|
33971
34258
|
}
|
|
33972
|
-
await
|
|
34259
|
+
await import_fs_extra10.default.copy(localFilePath, targetPath);
|
|
33973
34260
|
}
|
|
33974
34261
|
async function getFileContentWithGitHubFallback(sourceDir, fileName) {
|
|
33975
34262
|
const useGitHub = await isGitHubAvailable();
|
|
@@ -33984,11 +34271,11 @@ async function getFileContentWithGitHubFallback(sourceDir, fileName) {
|
|
|
33984
34271
|
if (!localConfigDir) {
|
|
33985
34272
|
throw new Error(`Neither GitHub nor local ${sourceDir} directory found`);
|
|
33986
34273
|
}
|
|
33987
|
-
const localFilePath =
|
|
33988
|
-
if (!await
|
|
34274
|
+
const localFilePath = path12.join(localConfigDir, fileName);
|
|
34275
|
+
if (!await import_fs_extra10.default.pathExists(localFilePath)) {
|
|
33989
34276
|
throw new Error(`File not found: ${fileName}`);
|
|
33990
34277
|
}
|
|
33991
|
-
return await
|
|
34278
|
+
return await import_fs_extra10.default.readFile(localFilePath, "utf-8");
|
|
33992
34279
|
}
|
|
33993
34280
|
|
|
33994
34281
|
// src/commands/addHook.ts
|
|
@@ -34030,10 +34317,10 @@ async function addHookCommand(hookType, options) {
|
|
|
34030
34317
|
const s = new SimpleSpinner2;
|
|
34031
34318
|
const targetDir = await getTargetDirectory(options);
|
|
34032
34319
|
const claudeDir = targetDir;
|
|
34033
|
-
const targetHookDir =
|
|
34034
|
-
const hookFilePath =
|
|
34035
|
-
const settingsPath =
|
|
34036
|
-
if (await
|
|
34320
|
+
const targetHookDir = path13.join(claudeDir, hook.targetDir || "hooks");
|
|
34321
|
+
const hookFilePath = path13.join(targetHookDir, hook.hookFile);
|
|
34322
|
+
const settingsPath = path13.join(claudeDir, "settings.json");
|
|
34323
|
+
if (await import_fs_extra11.default.pathExists(hookFilePath)) {
|
|
34037
34324
|
const overwriteAnswer = await lib_default.prompt([{
|
|
34038
34325
|
type: "confirm",
|
|
34039
34326
|
name: "overwrite",
|
|
@@ -34046,18 +34333,18 @@ async function addHookCommand(hookType, options) {
|
|
|
34046
34333
|
}
|
|
34047
34334
|
try {
|
|
34048
34335
|
s.start("Installing hook...");
|
|
34049
|
-
await
|
|
34336
|
+
await import_fs_extra11.default.ensureDir(targetHookDir);
|
|
34050
34337
|
await installFileWithGitHubFallback({
|
|
34051
34338
|
sourceDir: hook.sourceDir || "hooks",
|
|
34052
34339
|
targetPath: hookFilePath,
|
|
34053
34340
|
fileName: hook.hookFile
|
|
34054
34341
|
});
|
|
34055
|
-
await
|
|
34342
|
+
await import_fs_extra11.default.chmod(hookFilePath, 493);
|
|
34056
34343
|
s.stop("Hook file installed");
|
|
34057
34344
|
s.start("Updating settings.json...");
|
|
34058
34345
|
let settings = {};
|
|
34059
34346
|
try {
|
|
34060
|
-
const existingSettings = await
|
|
34347
|
+
const existingSettings = await import_fs_extra11.default.readFile(settingsPath, "utf-8");
|
|
34061
34348
|
settings = JSON.parse(existingSettings);
|
|
34062
34349
|
} catch {
|
|
34063
34350
|
settings = {};
|
|
@@ -34094,7 +34381,7 @@ async function addHookCommand(hookType, options) {
|
|
|
34094
34381
|
} else {
|
|
34095
34382
|
settings.hooks[hook.event].push(newHook);
|
|
34096
34383
|
}
|
|
34097
|
-
await
|
|
34384
|
+
await import_fs_extra11.default.writeFile(settingsPath, JSON.stringify(settings, null, 2));
|
|
34098
34385
|
s.stop("Settings updated");
|
|
34099
34386
|
console.log(source_default.green("✨ Hook installed successfully!"));
|
|
34100
34387
|
console.log(source_default.gray(`
|
|
@@ -34113,8 +34400,8 @@ The hook will run automatically when you edit TypeScript files with Claude Code.
|
|
|
34113
34400
|
}
|
|
34114
34401
|
|
|
34115
34402
|
// src/commands/addCommand.ts
|
|
34116
|
-
var
|
|
34117
|
-
import
|
|
34403
|
+
var import_fs_extra12 = __toESM(require_lib4(), 1);
|
|
34404
|
+
import path14 from "path";
|
|
34118
34405
|
class SimpleSpinner3 {
|
|
34119
34406
|
message = "";
|
|
34120
34407
|
start(message) {
|
|
@@ -34127,11 +34414,11 @@ class SimpleSpinner3 {
|
|
|
34127
34414
|
}
|
|
34128
34415
|
async function getLocalMdFilesRecursively(dir, basePath = "") {
|
|
34129
34416
|
const files = [];
|
|
34130
|
-
const entries = await
|
|
34417
|
+
const entries = await import_fs_extra12.default.readdir(dir, { withFileTypes: true });
|
|
34131
34418
|
for (const entry of entries) {
|
|
34132
34419
|
const relativePath = basePath ? `${basePath}/${entry.name}` : entry.name;
|
|
34133
34420
|
if (entry.isDirectory()) {
|
|
34134
|
-
const subFiles = await getLocalMdFilesRecursively(
|
|
34421
|
+
const subFiles = await getLocalMdFilesRecursively(path14.join(dir, entry.name), relativePath);
|
|
34135
34422
|
files.push(...subFiles);
|
|
34136
34423
|
} else if (entry.name.endsWith(".md")) {
|
|
34137
34424
|
files.push(relativePath);
|
|
@@ -34187,8 +34474,8 @@ function displayAvailableCommands(commands) {
|
|
|
34187
34474
|
console.log();
|
|
34188
34475
|
});
|
|
34189
34476
|
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"));
|
|
34477
|
+
console.log(source_default.gray(" npx aiblueprint-cli@latest claude-code add commands <command-name> # Install specific command"));
|
|
34478
|
+
console.log(source_default.gray(" npx aiblueprint-cli@latest claude-code add commands # Show this list"));
|
|
34192
34479
|
}
|
|
34193
34480
|
async function addCommandCommand(commandName, options = {}) {
|
|
34194
34481
|
console.log(source_default.bgBlue(` aiblueprint-cli v${getVersion()} `));
|
|
@@ -34211,9 +34498,9 @@ async function addCommandCommand(commandName, options = {}) {
|
|
|
34211
34498
|
if (options.folder) {
|
|
34212
34499
|
console.log(source_default.gray(`Using custom folder: ${targetDir}`));
|
|
34213
34500
|
}
|
|
34214
|
-
const commandsDir =
|
|
34215
|
-
const commandFilePath =
|
|
34216
|
-
if (await
|
|
34501
|
+
const commandsDir = path14.join(targetDir, "commands");
|
|
34502
|
+
const commandFilePath = path14.join(commandsDir, command.commandFile);
|
|
34503
|
+
if (await import_fs_extra12.default.pathExists(commandFilePath)) {
|
|
34217
34504
|
const overwriteAnswer = await lib_default.prompt([{
|
|
34218
34505
|
type: "confirm",
|
|
34219
34506
|
name: "overwrite",
|
|
@@ -34420,22 +34707,22 @@ async function symlinkCommand(params = {}) {
|
|
|
34420
34707
|
}
|
|
34421
34708
|
|
|
34422
34709
|
// src/commands/statusline.ts
|
|
34423
|
-
var
|
|
34424
|
-
import
|
|
34710
|
+
var import_fs_extra13 = __toESM(require_lib4(), 1);
|
|
34711
|
+
import path15 from "path";
|
|
34425
34712
|
import { homedir } from "os";
|
|
34426
34713
|
async function statuslineCommand(options) {
|
|
34427
|
-
const claudeDir = options.folder ?
|
|
34714
|
+
const claudeDir = options.folder ? path15.resolve(options.folder) : path15.join(homedir(), ".claude");
|
|
34428
34715
|
console.log(source_default.blue(`\uD83D\uDE80 Setting up AIBlueprint Statusline ${source_default.gray(`v${getVersion()}`)}...`));
|
|
34429
34716
|
console.log(source_default.gray(` Target: ${claudeDir}
|
|
34430
34717
|
`));
|
|
34431
|
-
await
|
|
34718
|
+
await import_fs_extra13.default.ensureDir(claudeDir);
|
|
34432
34719
|
console.log(source_default.cyan("\uD83D\uDCE6 Checking dependencies..."));
|
|
34433
34720
|
await checkAndInstallDependencies();
|
|
34434
34721
|
console.log(source_default.cyan(`
|
|
34435
34722
|
\uD83D\uDCE5 Downloading statusline files...`));
|
|
34436
|
-
const scriptsDir =
|
|
34437
|
-
await
|
|
34438
|
-
const success = await downloadDirectoryFromGitHub("scripts/statusline",
|
|
34723
|
+
const scriptsDir = path15.join(claudeDir, "scripts");
|
|
34724
|
+
await import_fs_extra13.default.ensureDir(scriptsDir);
|
|
34725
|
+
const success = await downloadDirectoryFromGitHub("scripts/statusline", path15.join(scriptsDir, "statusline"));
|
|
34439
34726
|
if (!success) {
|
|
34440
34727
|
console.log(source_default.red(" Failed to download statusline files from GitHub"));
|
|
34441
34728
|
return;
|
|
@@ -34445,19 +34732,19 @@ async function statuslineCommand(options) {
|
|
|
34445
34732
|
await installStatuslineDependencies(claudeDir);
|
|
34446
34733
|
console.log(source_default.cyan(`
|
|
34447
34734
|
⚙️ Configuring settings.json...`));
|
|
34448
|
-
const settingsPath =
|
|
34735
|
+
const settingsPath = path15.join(claudeDir, "settings.json");
|
|
34449
34736
|
let settings = {};
|
|
34450
34737
|
try {
|
|
34451
|
-
const existingSettings = await
|
|
34738
|
+
const existingSettings = await import_fs_extra13.default.readFile(settingsPath, "utf-8");
|
|
34452
34739
|
settings = JSON.parse(existingSettings);
|
|
34453
34740
|
} catch {
|
|
34454
34741
|
}
|
|
34455
34742
|
settings.statusLine = {
|
|
34456
34743
|
type: "command",
|
|
34457
|
-
command: `bun ${
|
|
34744
|
+
command: `bun ${path15.join(claudeDir, "scripts/statusline/src/index.ts")}`,
|
|
34458
34745
|
padding: 0
|
|
34459
34746
|
};
|
|
34460
|
-
await
|
|
34747
|
+
await import_fs_extra13.default.writeJson(settingsPath, settings, { spaces: 2 });
|
|
34461
34748
|
console.log(source_default.green(`
|
|
34462
34749
|
✅ Statusline setup complete!`));
|
|
34463
34750
|
console.log(source_default.gray(`
|
|
@@ -35121,13 +35408,13 @@ var de = () => {
|
|
|
35121
35408
|
};
|
|
35122
35409
|
|
|
35123
35410
|
// src/commands/pro.ts
|
|
35124
|
-
import
|
|
35125
|
-
import
|
|
35411
|
+
import os12 from "os";
|
|
35412
|
+
import path18 from "path";
|
|
35126
35413
|
|
|
35127
35414
|
// src/lib/pro-installer.ts
|
|
35128
|
-
var
|
|
35129
|
-
import
|
|
35130
|
-
import
|
|
35415
|
+
var import_fs_extra14 = __toESM(require_lib4(), 1);
|
|
35416
|
+
import os10 from "os";
|
|
35417
|
+
import path16 from "path";
|
|
35131
35418
|
var PREMIUM_REPO = "Melvynx/aiblueprint-cli-premium";
|
|
35132
35419
|
var PREMIUM_BRANCH = "main";
|
|
35133
35420
|
async function downloadFromPrivateGitHub(repo, branch, relativePath, targetPath, githubToken) {
|
|
@@ -35144,8 +35431,8 @@ async function downloadFromPrivateGitHub(repo, branch, relativePath, targetPath,
|
|
|
35144
35431
|
return false;
|
|
35145
35432
|
}
|
|
35146
35433
|
const content = await response.arrayBuffer();
|
|
35147
|
-
await
|
|
35148
|
-
await
|
|
35434
|
+
await import_fs_extra14.default.ensureDir(path16.dirname(targetPath));
|
|
35435
|
+
await import_fs_extra14.default.writeFile(targetPath, Buffer.from(content));
|
|
35149
35436
|
return true;
|
|
35150
35437
|
} catch (error) {
|
|
35151
35438
|
console.error(`Error downloading ${relativePath}:`, error);
|
|
@@ -35170,10 +35457,10 @@ async function downloadDirectoryFromPrivateGitHub(repo, branch, dirPath, targetD
|
|
|
35170
35457
|
console.error(`Unexpected response for directory ${dirPath}`);
|
|
35171
35458
|
return false;
|
|
35172
35459
|
}
|
|
35173
|
-
await
|
|
35460
|
+
await import_fs_extra14.default.ensureDir(targetDir);
|
|
35174
35461
|
for (const file of files) {
|
|
35175
35462
|
const relativePath = dirPath ? `${dirPath}/${file.name}` : file.name;
|
|
35176
|
-
const targetPath =
|
|
35463
|
+
const targetPath = path16.join(targetDir, file.name);
|
|
35177
35464
|
const displayPath = relativePath.replace("claude-code-config/", "");
|
|
35178
35465
|
if (file.type === "file") {
|
|
35179
35466
|
onProgress?.(displayPath, "file");
|
|
@@ -35190,14 +35477,14 @@ async function downloadDirectoryFromPrivateGitHub(repo, branch, dirPath, targetD
|
|
|
35190
35477
|
}
|
|
35191
35478
|
async function installProConfigs(options) {
|
|
35192
35479
|
const { githubToken, claudeCodeFolder, onProgress } = options;
|
|
35193
|
-
const claudeFolder = claudeCodeFolder ||
|
|
35194
|
-
const tempDir =
|
|
35480
|
+
const claudeFolder = claudeCodeFolder || path16.join(os10.homedir(), ".claude");
|
|
35481
|
+
const tempDir = path16.join(os10.tmpdir(), `aiblueprint-premium-${Date.now()}`);
|
|
35195
35482
|
try {
|
|
35196
35483
|
const success = await downloadDirectoryFromPrivateGitHub(PREMIUM_REPO, PREMIUM_BRANCH, "claude-code-config", tempDir, githubToken, onProgress);
|
|
35197
35484
|
if (!success) {
|
|
35198
35485
|
throw new Error("Failed to download premium configurations");
|
|
35199
35486
|
}
|
|
35200
|
-
await
|
|
35487
|
+
await import_fs_extra14.default.copy(tempDir, claudeFolder, {
|
|
35201
35488
|
overwrite: true,
|
|
35202
35489
|
recursive: true
|
|
35203
35490
|
});
|
|
@@ -35205,41 +35492,41 @@ async function installProConfigs(options) {
|
|
|
35205
35492
|
throw new Error(`Failed to install premium configs: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
35206
35493
|
} finally {
|
|
35207
35494
|
try {
|
|
35208
|
-
await
|
|
35495
|
+
await import_fs_extra14.default.remove(tempDir);
|
|
35209
35496
|
} catch {
|
|
35210
35497
|
}
|
|
35211
35498
|
}
|
|
35212
35499
|
}
|
|
35213
35500
|
|
|
35214
35501
|
// src/lib/token-storage.ts
|
|
35215
|
-
var
|
|
35216
|
-
import
|
|
35217
|
-
import
|
|
35502
|
+
var import_fs_extra15 = __toESM(require_lib4(), 1);
|
|
35503
|
+
import os11 from "os";
|
|
35504
|
+
import path17 from "path";
|
|
35218
35505
|
function getConfigDir() {
|
|
35219
|
-
const platform =
|
|
35506
|
+
const platform = os11.platform();
|
|
35220
35507
|
if (platform === "win32") {
|
|
35221
|
-
const appData = process.env.APPDATA ||
|
|
35222
|
-
return
|
|
35508
|
+
const appData = process.env.APPDATA || path17.join(os11.homedir(), "AppData", "Roaming");
|
|
35509
|
+
return path17.join(appData, "aiblueprint");
|
|
35223
35510
|
} else {
|
|
35224
|
-
const configHome = process.env.XDG_CONFIG_HOME ||
|
|
35225
|
-
return
|
|
35511
|
+
const configHome = process.env.XDG_CONFIG_HOME || path17.join(os11.homedir(), ".config");
|
|
35512
|
+
return path17.join(configHome, "aiblueprint");
|
|
35226
35513
|
}
|
|
35227
35514
|
}
|
|
35228
35515
|
function getTokenFilePath() {
|
|
35229
|
-
return
|
|
35516
|
+
return path17.join(getConfigDir(), "token.txt");
|
|
35230
35517
|
}
|
|
35231
35518
|
async function saveToken(githubToken) {
|
|
35232
35519
|
const tokenFile = getTokenFilePath();
|
|
35233
|
-
await
|
|
35234
|
-
await
|
|
35520
|
+
await import_fs_extra15.default.ensureDir(path17.dirname(tokenFile));
|
|
35521
|
+
await import_fs_extra15.default.writeFile(tokenFile, githubToken, { mode: 384 });
|
|
35235
35522
|
}
|
|
35236
35523
|
async function getToken() {
|
|
35237
35524
|
const tokenFile = getTokenFilePath();
|
|
35238
|
-
if (!await
|
|
35525
|
+
if (!await import_fs_extra15.default.pathExists(tokenFile)) {
|
|
35239
35526
|
return null;
|
|
35240
35527
|
}
|
|
35241
35528
|
try {
|
|
35242
|
-
const token = await
|
|
35529
|
+
const token = await import_fs_extra15.default.readFile(tokenFile, "utf-8");
|
|
35243
35530
|
return token.trim();
|
|
35244
35531
|
} catch (error) {
|
|
35245
35532
|
return null;
|
|
@@ -35248,12 +35535,12 @@ async function getToken() {
|
|
|
35248
35535
|
function getTokenInfo() {
|
|
35249
35536
|
return {
|
|
35250
35537
|
path: getTokenFilePath(),
|
|
35251
|
-
platform:
|
|
35538
|
+
platform: os11.platform()
|
|
35252
35539
|
};
|
|
35253
35540
|
}
|
|
35254
35541
|
|
|
35255
35542
|
// src/commands/pro.ts
|
|
35256
|
-
var
|
|
35543
|
+
var import_fs_extra16 = __toESM(require_lib4(), 1);
|
|
35257
35544
|
var API_URL = "https://codeline.app/api/products";
|
|
35258
35545
|
var PRODUCT_ID = "prd_XJVgxVPbGG";
|
|
35259
35546
|
async function countInstalledItems(claudeDir) {
|
|
@@ -35263,27 +35550,27 @@ async function countInstalledItems(claudeDir) {
|
|
|
35263
35550
|
skills: 0
|
|
35264
35551
|
};
|
|
35265
35552
|
try {
|
|
35266
|
-
const commandsDir =
|
|
35267
|
-
if (await
|
|
35268
|
-
const files = await
|
|
35553
|
+
const commandsDir = path18.join(claudeDir, "commands");
|
|
35554
|
+
if (await import_fs_extra16.default.pathExists(commandsDir)) {
|
|
35555
|
+
const files = await import_fs_extra16.default.readdir(commandsDir);
|
|
35269
35556
|
counts.commands = files.filter((f3) => f3.endsWith(".md")).length;
|
|
35270
35557
|
}
|
|
35271
35558
|
} catch {
|
|
35272
35559
|
}
|
|
35273
35560
|
try {
|
|
35274
|
-
const agentsDir =
|
|
35275
|
-
if (await
|
|
35276
|
-
const files = await
|
|
35561
|
+
const agentsDir = path18.join(claudeDir, "agents");
|
|
35562
|
+
if (await import_fs_extra16.default.pathExists(agentsDir)) {
|
|
35563
|
+
const files = await import_fs_extra16.default.readdir(agentsDir);
|
|
35277
35564
|
counts.agents = files.filter((f3) => f3.endsWith(".md")).length;
|
|
35278
35565
|
}
|
|
35279
35566
|
} catch {
|
|
35280
35567
|
}
|
|
35281
35568
|
try {
|
|
35282
|
-
const skillsDir =
|
|
35283
|
-
if (await
|
|
35284
|
-
const items = await
|
|
35569
|
+
const skillsDir = path18.join(claudeDir, "skills");
|
|
35570
|
+
if (await import_fs_extra16.default.pathExists(skillsDir)) {
|
|
35571
|
+
const items = await import_fs_extra16.default.readdir(skillsDir);
|
|
35285
35572
|
const dirs = await Promise.all(items.map(async (item) => {
|
|
35286
|
-
const stat = await
|
|
35573
|
+
const stat = await import_fs_extra16.default.stat(path18.join(skillsDir, item));
|
|
35287
35574
|
return stat.isDirectory();
|
|
35288
35575
|
}));
|
|
35289
35576
|
counts.skills = dirs.filter(Boolean).length;
|
|
@@ -35346,7 +35633,7 @@ async function proActivateCommand(userToken) {
|
|
|
35346
35633
|
f2.info(`Product: ${data.product.title}`);
|
|
35347
35634
|
f2.info(`Token saved to: ${tokenInfo.path}`);
|
|
35348
35635
|
f2.info(source_default.cyan(`
|
|
35349
|
-
\uD83D\uDCA1 Next step: Run 'aiblueprint claude-code pro setup' to install premium configs`));
|
|
35636
|
+
\uD83D\uDCA1 Next step: Run 'npx aiblueprint-cli@latest claude-code pro setup' to install premium configs`));
|
|
35350
35637
|
$e(source_default.green("✅ Activation complete!"));
|
|
35351
35638
|
} catch (error) {
|
|
35352
35639
|
if (error instanceof Error) {
|
|
@@ -35362,7 +35649,7 @@ async function proStatusCommand() {
|
|
|
35362
35649
|
const token = await getToken();
|
|
35363
35650
|
if (!token) {
|
|
35364
35651
|
f2.warn("No token found");
|
|
35365
|
-
f2.info("Run: aiblueprint claude-code pro activate <token>");
|
|
35652
|
+
f2.info("Run: npx aiblueprint-cli@latest claude-code pro activate <token>");
|
|
35366
35653
|
f2.info("Get your token at: https://mlv.sh/claude-cli");
|
|
35367
35654
|
$e(source_default.yellow("⚠️ Not activated"));
|
|
35368
35655
|
process.exit(0);
|
|
@@ -35386,11 +35673,11 @@ async function proSetupCommand(options = {}) {
|
|
|
35386
35673
|
const githubToken = await getToken();
|
|
35387
35674
|
if (!githubToken) {
|
|
35388
35675
|
f2.error("No token found");
|
|
35389
|
-
f2.info("Run: aiblueprint claude-code pro activate <token>");
|
|
35676
|
+
f2.info("Run: npx aiblueprint-cli@latest claude-code pro activate <token>");
|
|
35390
35677
|
$e(source_default.red("❌ Not activated"));
|
|
35391
35678
|
process.exit(1);
|
|
35392
35679
|
}
|
|
35393
|
-
const claudeDir = options.folder ?
|
|
35680
|
+
const claudeDir = options.folder ? path18.resolve(options.folder) : path18.join(os12.homedir(), ".claude");
|
|
35394
35681
|
const spinner = de();
|
|
35395
35682
|
const onProgress = (file, type) => {
|
|
35396
35683
|
spinner.message(`Installing: ${source_default.cyan(file)} ${source_default.gray(`(${type})`)}`);
|
|
@@ -35445,7 +35732,7 @@ async function proUpdateCommand(options = {}) {
|
|
|
35445
35732
|
const githubToken = await getToken();
|
|
35446
35733
|
if (!githubToken) {
|
|
35447
35734
|
f2.error("No token found");
|
|
35448
|
-
f2.info("Run: aiblueprint claude-code pro activate <token>");
|
|
35735
|
+
f2.info("Run: npx aiblueprint-cli@latest claude-code pro activate <token>");
|
|
35449
35736
|
$e(source_default.red("❌ Not activated"));
|
|
35450
35737
|
process.exit(1);
|
|
35451
35738
|
}
|
|
@@ -35467,12 +35754,12 @@ async function proUpdateCommand(options = {}) {
|
|
|
35467
35754
|
}
|
|
35468
35755
|
|
|
35469
35756
|
// src/commands/sync.ts
|
|
35470
|
-
import
|
|
35471
|
-
import
|
|
35757
|
+
import os13 from "os";
|
|
35758
|
+
import path20 from "path";
|
|
35472
35759
|
|
|
35473
35760
|
// src/lib/sync-utils.ts
|
|
35474
|
-
var
|
|
35475
|
-
import
|
|
35761
|
+
var import_fs_extra17 = __toESM(require_lib4(), 1);
|
|
35762
|
+
import path19 from "path";
|
|
35476
35763
|
import crypto from "crypto";
|
|
35477
35764
|
var PREMIUM_REPO2 = "Melvynx/aiblueprint-cli-premium";
|
|
35478
35765
|
var PREMIUM_BRANCH2 = "main";
|
|
@@ -35521,7 +35808,7 @@ async function listRemoteFilesRecursive(dirPath, githubToken, basePath = "") {
|
|
|
35521
35808
|
}
|
|
35522
35809
|
async function computeLocalFileSha(filePath) {
|
|
35523
35810
|
try {
|
|
35524
|
-
const content = await
|
|
35811
|
+
const content = await import_fs_extra17.default.readFile(filePath);
|
|
35525
35812
|
return computeFileSha(content);
|
|
35526
35813
|
} catch {
|
|
35527
35814
|
return null;
|
|
@@ -35529,15 +35816,15 @@ async function computeLocalFileSha(filePath) {
|
|
|
35529
35816
|
}
|
|
35530
35817
|
async function listLocalFiles(dir) {
|
|
35531
35818
|
const files = [];
|
|
35532
|
-
if (!await
|
|
35819
|
+
if (!await import_fs_extra17.default.pathExists(dir)) {
|
|
35533
35820
|
return files;
|
|
35534
35821
|
}
|
|
35535
|
-
const items = await
|
|
35822
|
+
const items = await import_fs_extra17.default.readdir(dir);
|
|
35536
35823
|
for (const item of items) {
|
|
35537
35824
|
if (item === "node_modules" || item === ".DS_Store")
|
|
35538
35825
|
continue;
|
|
35539
|
-
const fullPath =
|
|
35540
|
-
const stat = await
|
|
35826
|
+
const fullPath = path19.join(dir, item);
|
|
35827
|
+
const stat = await import_fs_extra17.default.stat(fullPath);
|
|
35541
35828
|
if (stat.isDirectory()) {
|
|
35542
35829
|
files.push(item);
|
|
35543
35830
|
const subFiles = await listLocalFilesRecursive(fullPath, item);
|
|
@@ -35550,13 +35837,13 @@ async function listLocalFiles(dir) {
|
|
|
35550
35837
|
}
|
|
35551
35838
|
async function listLocalFilesRecursive(dir, basePath) {
|
|
35552
35839
|
const files = [];
|
|
35553
|
-
const items = await
|
|
35840
|
+
const items = await import_fs_extra17.default.readdir(dir);
|
|
35554
35841
|
for (const item of items) {
|
|
35555
35842
|
if (item === "node_modules" || item === ".DS_Store")
|
|
35556
35843
|
continue;
|
|
35557
|
-
const fullPath =
|
|
35844
|
+
const fullPath = path19.join(dir, item);
|
|
35558
35845
|
const relativePath = `${basePath}/${item}`;
|
|
35559
|
-
const stat = await
|
|
35846
|
+
const stat = await import_fs_extra17.default.stat(fullPath);
|
|
35560
35847
|
if (stat.isDirectory()) {
|
|
35561
35848
|
files.push(relativePath);
|
|
35562
35849
|
const subFiles = await listLocalFilesRecursive(fullPath, relativePath);
|
|
@@ -35569,7 +35856,7 @@ async function listLocalFilesRecursive(dir, basePath) {
|
|
|
35569
35856
|
}
|
|
35570
35857
|
async function analyzeCategory(category, claudeDir, githubToken) {
|
|
35571
35858
|
const items = [];
|
|
35572
|
-
const localDir =
|
|
35859
|
+
const localDir = path19.join(claudeDir, category);
|
|
35573
35860
|
const remoteFiles = await listRemoteFilesRecursive(category, githubToken);
|
|
35574
35861
|
const localFiles = await listLocalFiles(localDir);
|
|
35575
35862
|
const remoteSet = new Map;
|
|
@@ -35578,7 +35865,7 @@ async function analyzeCategory(category, claudeDir, githubToken) {
|
|
|
35578
35865
|
}
|
|
35579
35866
|
const localSet = new Set(localFiles);
|
|
35580
35867
|
for (const [remotePath, { sha, isFolder }] of remoteSet) {
|
|
35581
|
-
const localPath =
|
|
35868
|
+
const localPath = path19.join(localDir, remotePath);
|
|
35582
35869
|
if (isFolder) {
|
|
35583
35870
|
continue;
|
|
35584
35871
|
}
|
|
@@ -35610,8 +35897,8 @@ async function analyzeCategory(category, claudeDir, githubToken) {
|
|
|
35610
35897
|
}
|
|
35611
35898
|
for (const localPath of localSet) {
|
|
35612
35899
|
if (!remoteSet.has(localPath)) {
|
|
35613
|
-
const fullPath =
|
|
35614
|
-
const stat = await
|
|
35900
|
+
const fullPath = path19.join(localDir, localPath);
|
|
35901
|
+
const stat = await import_fs_extra17.default.stat(fullPath).catch(() => null);
|
|
35615
35902
|
if (stat && !stat.isDirectory()) {
|
|
35616
35903
|
items.push({
|
|
35617
35904
|
name: localPath,
|
|
@@ -35642,9 +35929,9 @@ async function fetchRemoteSettings(githubToken) {
|
|
|
35642
35929
|
}
|
|
35643
35930
|
}
|
|
35644
35931
|
async function getLocalSettings(claudeDir) {
|
|
35645
|
-
const settingsPath =
|
|
35932
|
+
const settingsPath = path19.join(claudeDir, "settings.json");
|
|
35646
35933
|
try {
|
|
35647
|
-
const content = await
|
|
35934
|
+
const content = await import_fs_extra17.default.readFile(settingsPath, "utf-8");
|
|
35648
35935
|
return JSON.parse(content);
|
|
35649
35936
|
} catch {
|
|
35650
35937
|
return {};
|
|
@@ -35725,8 +36012,8 @@ async function downloadFromPrivateGitHub2(relativePath, targetPath, githubToken)
|
|
|
35725
36012
|
return false;
|
|
35726
36013
|
}
|
|
35727
36014
|
const content = await response.arrayBuffer();
|
|
35728
|
-
await
|
|
35729
|
-
await
|
|
36015
|
+
await import_fs_extra17.default.ensureDir(path19.dirname(targetPath));
|
|
36016
|
+
await import_fs_extra17.default.writeFile(targetPath, Buffer.from(content));
|
|
35730
36017
|
return true;
|
|
35731
36018
|
} catch {
|
|
35732
36019
|
return false;
|
|
@@ -35736,10 +36023,10 @@ async function syncSelectedHooks(claudeDir, hooks, onProgress) {
|
|
|
35736
36023
|
if (hooks.length === 0) {
|
|
35737
36024
|
return { success: 0, failed: 0 };
|
|
35738
36025
|
}
|
|
35739
|
-
const settingsPath =
|
|
36026
|
+
const settingsPath = path19.join(claudeDir, "settings.json");
|
|
35740
36027
|
let settings = {};
|
|
35741
36028
|
try {
|
|
35742
|
-
const content = await
|
|
36029
|
+
const content = await import_fs_extra17.default.readFile(settingsPath, "utf-8");
|
|
35743
36030
|
settings = JSON.parse(content);
|
|
35744
36031
|
} catch {
|
|
35745
36032
|
settings = {};
|
|
@@ -35767,7 +36054,7 @@ async function syncSelectedHooks(claudeDir, hooks, onProgress) {
|
|
|
35767
36054
|
failed++;
|
|
35768
36055
|
}
|
|
35769
36056
|
}
|
|
35770
|
-
await
|
|
36057
|
+
await import_fs_extra17.default.writeFile(settingsPath, JSON.stringify(settings, null, 2));
|
|
35771
36058
|
return { success, failed };
|
|
35772
36059
|
}
|
|
35773
36060
|
async function syncSelectedItems(claudeDir, items, githubToken, onProgress) {
|
|
@@ -35775,11 +36062,11 @@ async function syncSelectedItems(claudeDir, items, githubToken, onProgress) {
|
|
|
35775
36062
|
let failed = 0;
|
|
35776
36063
|
let deleted = 0;
|
|
35777
36064
|
for (const item of items) {
|
|
35778
|
-
const targetPath =
|
|
36065
|
+
const targetPath = path19.join(claudeDir, item.relativePath);
|
|
35779
36066
|
if (item.status === "deleted") {
|
|
35780
36067
|
onProgress?.(item.relativePath, "deleting");
|
|
35781
36068
|
try {
|
|
35782
|
-
await
|
|
36069
|
+
await import_fs_extra17.default.remove(targetPath);
|
|
35783
36070
|
deleted++;
|
|
35784
36071
|
} catch {
|
|
35785
36072
|
failed++;
|
|
@@ -35926,11 +36213,11 @@ async function proSyncCommand(options = {}) {
|
|
|
35926
36213
|
const githubToken = await getToken();
|
|
35927
36214
|
if (!githubToken) {
|
|
35928
36215
|
f2.error("No token found");
|
|
35929
|
-
f2.info("Run: aiblueprint claude-code pro activate <token>");
|
|
36216
|
+
f2.info("Run: npx aiblueprint-cli@latest claude-code pro activate <token>");
|
|
35930
36217
|
$e(source_default.red("❌ Not activated"));
|
|
35931
36218
|
process.exit(1);
|
|
35932
36219
|
}
|
|
35933
|
-
const claudeDir = options.folder ?
|
|
36220
|
+
const claudeDir = options.folder ? path20.resolve(options.folder) : path20.join(os13.homedir(), ".claude");
|
|
35934
36221
|
const spinner = de();
|
|
35935
36222
|
spinner.start("Analyzing changes...");
|
|
35936
36223
|
const result = await analyzeSyncChanges(claudeDir, githubToken);
|
|
@@ -36122,11 +36409,18 @@ claudeCodeCmd.command("setup").description("Setup Claude Code configuration with
|
|
|
36122
36409
|
skipInteractive: parentOptions.skip
|
|
36123
36410
|
});
|
|
36124
36411
|
});
|
|
36412
|
+
claudeCodeCmd.command("setup-terminal").description("Setup terminal with Oh My ZSH, plugins, and a beautiful theme").action((options, command) => {
|
|
36413
|
+
const parentOptions = command.parent.opts();
|
|
36414
|
+
setupTerminalCommand({
|
|
36415
|
+
skipInteractive: parentOptions.skip,
|
|
36416
|
+
homeDir: parentOptions.claudeCodeFolder || parentOptions.folder
|
|
36417
|
+
});
|
|
36418
|
+
});
|
|
36125
36419
|
var addCmd = claudeCodeCmd.command("add").description(`Add components to your Claude Code configuration
|
|
36126
36420
|
` + `Examples:
|
|
36127
|
-
` + ` aiblueprint claude-code add hook post-edit-typescript
|
|
36128
|
-
` + ` aiblueprint claude-code add commands
|
|
36129
|
-
` + " aiblueprint claude-code add commands commit");
|
|
36421
|
+
` + ` npx aiblueprint-cli@latest claude-code add hook post-edit-typescript
|
|
36422
|
+
` + ` npx aiblueprint-cli@latest claude-code add commands
|
|
36423
|
+
` + " npx aiblueprint-cli@latest claude-code add commands commit");
|
|
36130
36424
|
addCmd.command("hook <type>").description("Add a hook to your Claude Code configuration. Available types: post-edit-typescript").action((type, options, command) => {
|
|
36131
36425
|
const parentOptions = command.parent.parent.opts();
|
|
36132
36426
|
const claudeCodeFolder = parentOptions.claudeCodeFolder || parentOptions.folder;
|