aiblueprint-cli 1.1.1 → 1.1.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.
Files changed (2) hide show
  1. package/dist/cli.js +83 -87
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -33220,12 +33220,74 @@ async function updateSettings(options, claudeDir) {
33220
33220
  }
33221
33221
 
33222
33222
  // src/commands/addHook.ts
33223
+ var import_fs_extra3 = __toESM(require_lib4(), 1);
33224
+ import path4 from "path";
33225
+ import { fileURLToPath as fileURLToPath3 } from "url";
33226
+ import { dirname as dirname3 } from "path";
33227
+
33228
+ // src/utils/claude-config.ts
33223
33229
  var import_fs_extra2 = __toESM(require_lib4(), 1);
33224
33230
  import path3 from "path";
33225
33231
  import { fileURLToPath as fileURLToPath2 } from "url";
33226
33232
  import { dirname as dirname2 } from "path";
33227
33233
  var __filename3 = fileURLToPath2(import.meta.url);
33228
33234
  var __dirname3 = dirname2(__filename3);
33235
+ function parseYamlFrontmatter(content) {
33236
+ const lines = content.split(`
33237
+ `);
33238
+ if (lines[0] !== "---") {
33239
+ return { metadata: {}, body: content };
33240
+ }
33241
+ const endIndex = lines.findIndex((line, index) => index > 0 && line === "---");
33242
+ if (endIndex === -1) {
33243
+ return { metadata: {}, body: content };
33244
+ }
33245
+ const frontmatterLines = lines.slice(1, endIndex);
33246
+ const body = lines.slice(endIndex + 1).join(`
33247
+ `);
33248
+ const metadata = {};
33249
+ frontmatterLines.forEach((line) => {
33250
+ const colonIndex = line.indexOf(":");
33251
+ if (colonIndex > -1) {
33252
+ const key = line.substring(0, colonIndex).trim();
33253
+ const value = line.substring(colonIndex + 1).trim();
33254
+ metadata[key] = value;
33255
+ }
33256
+ });
33257
+ return { metadata, body };
33258
+ }
33259
+ function getLocalConfigPaths(subDir) {
33260
+ return [
33261
+ path3.join(__dirname3, `../claude-code-config/${subDir}`),
33262
+ path3.join(__dirname3, `../../claude-code-config/${subDir}`)
33263
+ ];
33264
+ }
33265
+ async function findLocalConfigDir(subDir) {
33266
+ const possiblePaths = getLocalConfigPaths(subDir);
33267
+ for (const testPath of possiblePaths) {
33268
+ if (await import_fs_extra2.default.pathExists(testPath)) {
33269
+ return testPath;
33270
+ }
33271
+ }
33272
+ return null;
33273
+ }
33274
+ async function getTargetDirectory(options) {
33275
+ if (options.folder) {
33276
+ return options.folder;
33277
+ }
33278
+ const cwd = process.cwd();
33279
+ const localClaudeDir = path3.join(cwd, ".claude");
33280
+ const isGitRepo = await import_fs_extra2.default.pathExists(path3.join(cwd, ".git"));
33281
+ const hasClaudeConfig = await import_fs_extra2.default.pathExists(localClaudeDir);
33282
+ if (isGitRepo || hasClaudeConfig) {
33283
+ return localClaudeDir;
33284
+ }
33285
+ return path3.join(process.env.HOME || process.env.USERPROFILE || "~", ".claude");
33286
+ }
33287
+
33288
+ // src/commands/addHook.ts
33289
+ var __filename4 = fileURLToPath3(import.meta.url);
33290
+ var __dirname4 = dirname3(__filename4);
33229
33291
 
33230
33292
  class SimpleSpinner2 {
33231
33293
  message = "";
@@ -33258,24 +33320,12 @@ async function addHookCommand(hookType, options) {
33258
33320
  }
33259
33321
  const hook = supportedHooks[hookType];
33260
33322
  const s = new SimpleSpinner2;
33261
- const targetDir = options.folder || path3.join(process.env.HOME || process.env.USERPROFILE || "~", ".claude");
33262
- if (!options.folder) {
33263
- const cwd = process.cwd();
33264
- const isGitRepo = await import_fs_extra2.default.pathExists(path3.join(cwd, ".git"));
33265
- const hasClaudeConfig = await import_fs_extra2.default.pathExists(path3.join(cwd, ".claude"));
33266
- if (!isGitRepo && !hasClaudeConfig) {
33267
- console.log(source_default.red("❌ Not in a project directory. Please run this command in a Git repository or a directory with .claude/ configuration."));
33268
- process.exit(1);
33269
- }
33270
- const claudeDir2 = path3.join(cwd, ".claude");
33271
- } else {
33272
- console.log(source_default.gray(`Using custom folder: ${targetDir}`));
33273
- }
33323
+ const targetDir = await getTargetDirectory(options);
33274
33324
  const claudeDir = targetDir;
33275
- const hooksDir = path3.join(claudeDir, "hooks");
33276
- const hookFilePath = path3.join(hooksDir, hook.hookFile);
33277
- const settingsPath = path3.join(claudeDir, "settings.json");
33278
- if (await import_fs_extra2.default.pathExists(hookFilePath)) {
33325
+ const hooksDir = path4.join(claudeDir, "hooks");
33326
+ const hookFilePath = path4.join(hooksDir, hook.hookFile);
33327
+ const settingsPath = path4.join(claudeDir, "settings.json");
33328
+ if (await import_fs_extra3.default.pathExists(hookFilePath)) {
33279
33329
  const overwriteAnswer = await lib_default.prompt([{
33280
33330
  type: "confirm",
33281
33331
  name: "overwrite",
@@ -33288,15 +33338,15 @@ async function addHookCommand(hookType, options) {
33288
33338
  }
33289
33339
  try {
33290
33340
  s.start("Installing hook...");
33291
- await import_fs_extra2.default.ensureDir(hooksDir);
33292
- const templatePath = path3.join(__dirname3, "../../claude-code-config/hooks", hook.hookFile);
33293
- await import_fs_extra2.default.copy(templatePath, hookFilePath);
33294
- await import_fs_extra2.default.chmod(hookFilePath, 493);
33341
+ await import_fs_extra3.default.ensureDir(hooksDir);
33342
+ const templatePath = path4.join(__dirname4, "../../claude-code-config/hooks", hook.hookFile);
33343
+ await import_fs_extra3.default.copy(templatePath, hookFilePath);
33344
+ await import_fs_extra3.default.chmod(hookFilePath, 493);
33295
33345
  s.stop("Hook file installed");
33296
33346
  s.start("Updating settings.json...");
33297
33347
  let settings = {};
33298
33348
  try {
33299
- const existingSettings = await import_fs_extra2.default.readFile(settingsPath, "utf-8");
33349
+ const existingSettings = await import_fs_extra3.default.readFile(settingsPath, "utf-8");
33300
33350
  settings = JSON.parse(existingSettings);
33301
33351
  } catch {
33302
33352
  settings = {};
@@ -33333,7 +33383,7 @@ async function addHookCommand(hookType, options) {
33333
33383
  } else {
33334
33384
  settings.hooks[hook.event].push(newHook);
33335
33385
  }
33336
- await import_fs_extra2.default.writeFile(settingsPath, JSON.stringify(settings, null, 2));
33386
+ await import_fs_extra3.default.writeFile(settingsPath, JSON.stringify(settings, null, 2));
33337
33387
  s.stop("Settings updated");
33338
33388
  console.log(source_default.green("✨ Hook installed successfully!"));
33339
33389
  console.log(source_default.gray(`
@@ -33356,8 +33406,8 @@ var import_fs_extra6 = __toESM(require_lib4(), 1);
33356
33406
  import path7 from "path";
33357
33407
 
33358
33408
  // src/utils/github.ts
33359
- var import_fs_extra3 = __toESM(require_lib4(), 1);
33360
- import path4 from "path";
33409
+ var import_fs_extra4 = __toESM(require_lib4(), 1);
33410
+ import path5 from "path";
33361
33411
  var GITHUB_RAW_BASE2 = "https://raw.githubusercontent.com/Melvynx/aiblueprint-cli/main/claude-code-config";
33362
33412
  async function downloadFromGitHub2(relativePath) {
33363
33413
  try {
@@ -33396,72 +33446,13 @@ async function isGitHubAvailable() {
33396
33446
  async function downloadAndWriteFile(relativePath, targetPath) {
33397
33447
  const content = await downloadFromGitHub2(relativePath);
33398
33448
  if (content) {
33399
- await import_fs_extra3.default.ensureDir(path4.dirname(targetPath));
33400
- await import_fs_extra3.default.writeFile(targetPath, content);
33449
+ await import_fs_extra4.default.ensureDir(path5.dirname(targetPath));
33450
+ await import_fs_extra4.default.writeFile(targetPath, content);
33401
33451
  return true;
33402
33452
  }
33403
33453
  return false;
33404
33454
  }
33405
33455
 
33406
- // src/utils/claude-config.ts
33407
- var import_fs_extra4 = __toESM(require_lib4(), 1);
33408
- import path5 from "path";
33409
- import { fileURLToPath as fileURLToPath3 } from "url";
33410
- import { dirname as dirname3 } from "path";
33411
- var __filename4 = fileURLToPath3(import.meta.url);
33412
- var __dirname4 = dirname3(__filename4);
33413
- function parseYamlFrontmatter(content) {
33414
- const lines = content.split(`
33415
- `);
33416
- if (lines[0] !== "---") {
33417
- return { metadata: {}, body: content };
33418
- }
33419
- const endIndex = lines.findIndex((line, index) => index > 0 && line === "---");
33420
- if (endIndex === -1) {
33421
- return { metadata: {}, body: content };
33422
- }
33423
- const frontmatterLines = lines.slice(1, endIndex);
33424
- const body = lines.slice(endIndex + 1).join(`
33425
- `);
33426
- const metadata = {};
33427
- frontmatterLines.forEach((line) => {
33428
- const colonIndex = line.indexOf(":");
33429
- if (colonIndex > -1) {
33430
- const key = line.substring(0, colonIndex).trim();
33431
- const value = line.substring(colonIndex + 1).trim();
33432
- metadata[key] = value;
33433
- }
33434
- });
33435
- return { metadata, body };
33436
- }
33437
- function getLocalConfigPaths(subDir) {
33438
- return [
33439
- path5.join(__dirname4, `../claude-code-config/${subDir}`),
33440
- path5.join(__dirname4, `../../claude-code-config/${subDir}`)
33441
- ];
33442
- }
33443
- async function findLocalConfigDir(subDir) {
33444
- const possiblePaths = getLocalConfigPaths(subDir);
33445
- for (const testPath of possiblePaths) {
33446
- if (await import_fs_extra4.default.pathExists(testPath)) {
33447
- return testPath;
33448
- }
33449
- }
33450
- return null;
33451
- }
33452
- async function getTargetDirectory(options) {
33453
- let targetDir = options.folder || path5.join(process.env.HOME || process.env.USERPROFILE || "~", ".claude");
33454
- if (!options.folder) {
33455
- const cwd = process.cwd();
33456
- const isGitRepo = await import_fs_extra4.default.pathExists(path5.join(cwd, ".git"));
33457
- const hasClaudeConfig = await import_fs_extra4.default.pathExists(path5.join(cwd, ".claude"));
33458
- if (isGitRepo || hasClaudeConfig) {
33459
- targetDir = path5.join(cwd, ".claude");
33460
- }
33461
- }
33462
- return targetDir;
33463
- }
33464
-
33465
33456
  // src/utils/file-installer.ts
33466
33457
  var import_fs_extra5 = __toESM(require_lib4(), 1);
33467
33458
  import path6 from "path";
@@ -33633,8 +33624,13 @@ The command will be available immediately in Claude Code.`));
33633
33624
  }
33634
33625
 
33635
33626
  // src/cli.ts
33627
+ import { readFileSync as readFileSync2 } from "fs";
33628
+ import { dirname as dirname4, join } from "path";
33629
+ import { fileURLToPath as fileURLToPath4 } from "url";
33630
+ var __dirname5 = dirname4(fileURLToPath4(import.meta.url));
33631
+ var packageJson = JSON.parse(readFileSync2(join(__dirname5, "../package.json"), "utf8"));
33636
33632
  var program2 = new Command;
33637
- program2.name("aiblueprint").description("AIBlueprint CLI for setting up Claude Code configurations").version("1.0.0");
33633
+ program2.name("aiblueprint").description("AIBlueprint CLI for setting up Claude Code configurations").version(packageJson.version);
33638
33634
  var claudeCodeCmd = program2.command("claude-code").description("Claude Code configuration commands").option("-f, --folder <path>", "Specify custom folder path (default: ~/.claude)").option("-s, --skip", "Skip interactive prompts and install all features");
33639
33635
  claudeCodeCmd.command("setup").description("Setup Claude Code configuration with AIBlueprint defaults").action((options, command) => {
33640
33636
  const parentOptions = command.parent.opts();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiblueprint-cli",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "AIBlueprint CLI for setting up Claude Code configurations",
5
5
  "author": "AIBlueprint",
6
6
  "license": "MIT",