aiblueprint-cli 1.0.1 → 1.0.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 +116 -29
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5123,6 +5123,48 @@ import { fileURLToPath } from "url";
|
|
|
5123
5123
|
import { dirname } from "path";
|
|
5124
5124
|
var __filename2 = fileURLToPath(import.meta.url);
|
|
5125
5125
|
var __dirname2 = dirname(__filename2);
|
|
5126
|
+
var GITHUB_RAW_BASE = "https://raw.githubusercontent.com/Melvynx/aiblueprint-cli/main/claude-code-config";
|
|
5127
|
+
async function downloadFromGitHub(relativePath, targetPath) {
|
|
5128
|
+
try {
|
|
5129
|
+
const url = `${GITHUB_RAW_BASE}/${relativePath}`;
|
|
5130
|
+
const response = await fetch(url);
|
|
5131
|
+
if (!response.ok) {
|
|
5132
|
+
return false;
|
|
5133
|
+
}
|
|
5134
|
+
const content = await response.arrayBuffer();
|
|
5135
|
+
await import_fs_extra.default.ensureDir(path.dirname(targetPath));
|
|
5136
|
+
await import_fs_extra.default.writeFile(targetPath, Buffer.from(content));
|
|
5137
|
+
return true;
|
|
5138
|
+
} catch (error) {
|
|
5139
|
+
return false;
|
|
5140
|
+
}
|
|
5141
|
+
}
|
|
5142
|
+
async function downloadDirectoryFromGitHub(dirPath, targetDir) {
|
|
5143
|
+
try {
|
|
5144
|
+
const apiUrl = `https://api.github.com/repos/Melvynx/aiblueprint-cli/contents/claude-code-config/${dirPath}`;
|
|
5145
|
+
const response = await fetch(apiUrl);
|
|
5146
|
+
if (!response.ok) {
|
|
5147
|
+
return false;
|
|
5148
|
+
}
|
|
5149
|
+
const files = await response.json();
|
|
5150
|
+
if (!Array.isArray(files)) {
|
|
5151
|
+
return false;
|
|
5152
|
+
}
|
|
5153
|
+
await import_fs_extra.default.ensureDir(targetDir);
|
|
5154
|
+
for (const file of files) {
|
|
5155
|
+
const relativePath = `${dirPath}/${file.name}`;
|
|
5156
|
+
const targetPath = path.join(targetDir, file.name);
|
|
5157
|
+
if (file.type === "file") {
|
|
5158
|
+
await downloadFromGitHub(relativePath, targetPath);
|
|
5159
|
+
} else if (file.type === "dir") {
|
|
5160
|
+
await downloadDirectoryFromGitHub(relativePath, targetPath);
|
|
5161
|
+
}
|
|
5162
|
+
}
|
|
5163
|
+
return true;
|
|
5164
|
+
} catch (error) {
|
|
5165
|
+
return false;
|
|
5166
|
+
}
|
|
5167
|
+
}
|
|
5126
5168
|
async function setupCommand(customFolder, skipInteractive) {
|
|
5127
5169
|
try {
|
|
5128
5170
|
console.log(source_default.blue.bold(`
|
|
@@ -5163,51 +5205,96 @@ async function setupCommand(customFolder, skipInteractive) {
|
|
|
5163
5205
|
};
|
|
5164
5206
|
const s = de();
|
|
5165
5207
|
const claudeDir = customFolder ? path.resolve(customFolder) : path.join(os2.homedir(), ".claude");
|
|
5166
|
-
let sourceDir;
|
|
5167
|
-
const currentDir = process.cwd();
|
|
5168
|
-
const possiblePaths = [
|
|
5169
|
-
path.join(currentDir, "claude-code-config"),
|
|
5170
|
-
path.join(__dirname2, "../../claude-code-config"),
|
|
5171
|
-
path.join(path.dirname(process.argv[1]), "../claude-code-config")
|
|
5172
|
-
];
|
|
5173
|
-
sourceDir = possiblePaths.find((p) => {
|
|
5174
|
-
try {
|
|
5175
|
-
return import_fs_extra.default.existsSync(p);
|
|
5176
|
-
} catch {
|
|
5177
|
-
return false;
|
|
5178
|
-
}
|
|
5179
|
-
}) || possiblePaths[0];
|
|
5180
5208
|
console.log(source_default.gray(`Installing to: ${claudeDir}`));
|
|
5181
5209
|
await import_fs_extra.default.ensureDir(claudeDir);
|
|
5210
|
+
let useGitHub = true;
|
|
5211
|
+
let sourceDir;
|
|
5212
|
+
const testUrl = `${GITHUB_RAW_BASE}/scripts/validate-command.js`;
|
|
5213
|
+
try {
|
|
5214
|
+
const testResponse = await fetch(testUrl);
|
|
5215
|
+
useGitHub = testResponse.ok;
|
|
5216
|
+
} catch {
|
|
5217
|
+
useGitHub = false;
|
|
5218
|
+
}
|
|
5219
|
+
if (!useGitHub) {
|
|
5220
|
+
const currentDir = process.cwd();
|
|
5221
|
+
const possiblePaths = [
|
|
5222
|
+
path.join(currentDir, "claude-code-config"),
|
|
5223
|
+
path.join(__dirname2, "../../claude-code-config"),
|
|
5224
|
+
path.join(__dirname2, "../claude-code-config"),
|
|
5225
|
+
path.join(path.dirname(process.argv[1]), "../claude-code-config")
|
|
5226
|
+
];
|
|
5227
|
+
sourceDir = possiblePaths.find((p) => {
|
|
5228
|
+
try {
|
|
5229
|
+
return import_fs_extra.default.existsSync(p);
|
|
5230
|
+
} catch {
|
|
5231
|
+
return false;
|
|
5232
|
+
}
|
|
5233
|
+
});
|
|
5234
|
+
if (!sourceDir) {
|
|
5235
|
+
throw new Error("Could not find claude-code-config directory locally and GitHub is not accessible");
|
|
5236
|
+
}
|
|
5237
|
+
console.log(source_default.yellow(" Using local configuration files (GitHub not accessible)"));
|
|
5238
|
+
} else {
|
|
5239
|
+
console.log(source_default.green(" Downloading latest configuration from GitHub"));
|
|
5240
|
+
}
|
|
5182
5241
|
if (options.shellShortcuts) {
|
|
5183
5242
|
s.start("Setting up shell shortcuts");
|
|
5184
5243
|
await setupShellShortcuts();
|
|
5185
5244
|
s.stop("Shell shortcuts configured");
|
|
5186
5245
|
}
|
|
5187
5246
|
if (options.commandValidation || options.customStatusline || options.notificationSounds) {
|
|
5188
|
-
s.start("
|
|
5189
|
-
|
|
5190
|
-
|
|
5247
|
+
s.start("Setting up scripts");
|
|
5248
|
+
if (useGitHub) {
|
|
5249
|
+
const scriptsDir = path.join(claudeDir, "scripts");
|
|
5250
|
+
await import_fs_extra.default.ensureDir(scriptsDir);
|
|
5251
|
+
const scriptFiles = ["validate-command.js", "statusline-ccusage.sh", "validate-command.readme.md", "statusline.readme.md"];
|
|
5252
|
+
for (const file of scriptFiles) {
|
|
5253
|
+
await downloadFromGitHub(`scripts/${file}`, path.join(scriptsDir, file));
|
|
5254
|
+
}
|
|
5255
|
+
} else {
|
|
5256
|
+
await import_fs_extra.default.copy(path.join(sourceDir, "scripts"), path.join(claudeDir, "scripts"), { overwrite: true });
|
|
5257
|
+
}
|
|
5258
|
+
s.stop("Scripts installed");
|
|
5191
5259
|
}
|
|
5192
5260
|
if (options.aiblueprintCommands) {
|
|
5193
|
-
s.start("
|
|
5194
|
-
|
|
5195
|
-
|
|
5261
|
+
s.start("Setting up AIBlueprint commands");
|
|
5262
|
+
if (useGitHub) {
|
|
5263
|
+
await downloadDirectoryFromGitHub("commands", path.join(claudeDir, "commands"));
|
|
5264
|
+
} else {
|
|
5265
|
+
await import_fs_extra.default.copy(path.join(sourceDir, "commands"), path.join(claudeDir, "commands"), { overwrite: true });
|
|
5266
|
+
}
|
|
5267
|
+
s.stop("Commands installed");
|
|
5196
5268
|
}
|
|
5197
5269
|
if (options.aiblueprintAgents) {
|
|
5198
|
-
s.start("
|
|
5199
|
-
|
|
5200
|
-
|
|
5270
|
+
s.start("Setting up AIBlueprint agents");
|
|
5271
|
+
if (useGitHub) {
|
|
5272
|
+
await downloadDirectoryFromGitHub("agents", path.join(claudeDir, "agents"));
|
|
5273
|
+
} else {
|
|
5274
|
+
await import_fs_extra.default.copy(path.join(sourceDir, "agents"), path.join(claudeDir, "agents"), { overwrite: true });
|
|
5275
|
+
}
|
|
5276
|
+
s.stop("Agents installed");
|
|
5201
5277
|
}
|
|
5202
5278
|
if (options.outputStyles) {
|
|
5203
|
-
s.start("
|
|
5204
|
-
|
|
5205
|
-
|
|
5279
|
+
s.start("Setting up output styles");
|
|
5280
|
+
if (useGitHub) {
|
|
5281
|
+
await downloadDirectoryFromGitHub("output-styles", path.join(claudeDir, "output-styles"));
|
|
5282
|
+
} else {
|
|
5283
|
+
await import_fs_extra.default.copy(path.join(sourceDir, "output-styles"), path.join(claudeDir, "output-styles"), { overwrite: true });
|
|
5284
|
+
}
|
|
5285
|
+
s.stop("Output styles installed");
|
|
5206
5286
|
}
|
|
5207
5287
|
if (options.notificationSounds) {
|
|
5208
|
-
s.start("
|
|
5209
|
-
|
|
5210
|
-
|
|
5288
|
+
s.start("Setting up notification sounds");
|
|
5289
|
+
if (useGitHub) {
|
|
5290
|
+
const songDir = path.join(claudeDir, "song");
|
|
5291
|
+
await import_fs_extra.default.ensureDir(songDir);
|
|
5292
|
+
await downloadFromGitHub("song/finish.mp3", path.join(songDir, "finish.mp3"));
|
|
5293
|
+
await downloadFromGitHub("song/need-human.mp3", path.join(songDir, "need-human.mp3"));
|
|
5294
|
+
} else {
|
|
5295
|
+
await import_fs_extra.default.copy(path.join(sourceDir, "song"), path.join(claudeDir, "song"), { overwrite: true });
|
|
5296
|
+
}
|
|
5297
|
+
s.stop("Notification sounds installed");
|
|
5211
5298
|
}
|
|
5212
5299
|
if (options.customStatusline) {
|
|
5213
5300
|
s.start("Checking dependencies");
|