aiblueprint-cli 1.4.76 → 1.4.77

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 (3) hide show
  1. package/README.md +4 -4
  2. package/dist/cli.js +84 -60
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -169,11 +169,11 @@ npx skills add Melvynx/aiblueprint --skill skill-manager
169
169
  Unlock advanced features at [mlv.sh/claude-cli](https://mlv.sh/claude-cli)
170
170
 
171
171
  ```bash
172
- # Activate premium
173
- npx aiblueprint-cli@latest agents pro activate YOUR_TOKEN
174
-
175
- # Setup premium configs
172
+ # Setup premium configs (prompts for your token if needed)
176
173
  npx aiblueprint-cli@latest agents pro setup
174
+
175
+ # Or activate first if you prefer
176
+ npx aiblueprint-cli@latest agents pro activate YOUR_TOKEN
177
177
  ```
178
178
 
179
179
  ## 🛠️ Development
package/dist/cli.js CHANGED
@@ -37809,6 +37809,74 @@ function getTokenInfo() {
37809
37809
  var import_fs_extra17 = __toESM(require_lib4(), 1);
37810
37810
  var API_URL = "https://codeline.app/api/products";
37811
37811
  var PRODUCT_IDS = ["prd_XJVgxVPbGG", "prd_NKabAkdOkw"];
37812
+
37813
+ class PremiumActivationError extends Error {
37814
+ code;
37815
+ constructor(code, message) {
37816
+ super(message);
37817
+ this.code = code;
37818
+ this.name = "PremiumActivationError";
37819
+ }
37820
+ }
37821
+ function isPremiumActivationError(error) {
37822
+ return error instanceof PremiumActivationError;
37823
+ }
37824
+ function logPremiumActivationError(error) {
37825
+ M2.error(error.message);
37826
+ if (error.code === "invalid-token") {
37827
+ M2.info("\uD83D\uDC8E Get AIBlueprint CLI Premium at: https://mlv.sh/claude-cli");
37828
+ }
37829
+ }
37830
+ async function promptForPremiumToken() {
37831
+ const result = await he({
37832
+ message: "Enter your Premium access token:",
37833
+ placeholder: "Your ProductsOnUsers ID from codeline.app",
37834
+ validate: (value) => {
37835
+ if (!value)
37836
+ return "Token is required";
37837
+ if (value.length < 5)
37838
+ return "Token seems invalid";
37839
+ return;
37840
+ }
37841
+ });
37842
+ if (pD(result)) {
37843
+ xe("Premium activation cancelled");
37844
+ process.exit(0);
37845
+ }
37846
+ return result;
37847
+ }
37848
+ async function fetchPremiumActivationData(userToken) {
37849
+ const encodedToken = encodeURIComponent(userToken);
37850
+ for (const productId of PRODUCT_IDS) {
37851
+ const response = await fetch(`${API_URL}/${productId}/have-access?token=${encodedToken}`);
37852
+ if (response.ok) {
37853
+ const responseData = await response.json();
37854
+ if (responseData.hasAccess) {
37855
+ return responseData;
37856
+ }
37857
+ }
37858
+ }
37859
+ return null;
37860
+ }
37861
+ async function activatePremiumToken(userToken) {
37862
+ const premiumToken = userToken ?? await promptForPremiumToken();
37863
+ const spinner = Y2();
37864
+ spinner.start("Validating token against premium products...");
37865
+ const data = await fetchPremiumActivationData(premiumToken);
37866
+ if (!data) {
37867
+ spinner.stop("Token validation failed");
37868
+ throw new PremiumActivationError("invalid-token", "Invalid token or no access to premium products");
37869
+ }
37870
+ spinner.stop("Token validated");
37871
+ const githubToken = data.product?.metadata?.["cli-github-token"];
37872
+ if (!githubToken) {
37873
+ throw new PremiumActivationError("missing-github-token", "No GitHub token found in product metadata. Please contact support.");
37874
+ }
37875
+ spinner.start("Saving token...");
37876
+ await saveToken(githubToken);
37877
+ spinner.stop("Token saved");
37878
+ return { githubToken, data };
37879
+ }
37812
37880
  async function countInstalledItems(claudeDir) {
37813
37881
  const counts = {
37814
37882
  agents: 0,
@@ -37841,60 +37909,11 @@ async function countInstalledItems(claudeDir) {
37841
37909
  async function proActivateCommand(userToken) {
37842
37910
  Ie(source_default.blue(`\uD83D\uDD11 Activate AIBlueprint CLI Premium ${source_default.gray(`v${getVersion()}`)}`));
37843
37911
  try {
37844
- if (!userToken) {
37845
- const result = await he({
37846
- message: "Enter your Premium access token:",
37847
- placeholder: "Your ProductsOnUsers ID from codeline.app",
37848
- validate: (value) => {
37849
- if (!value)
37850
- return "Token is required";
37851
- if (value.length < 5)
37852
- return "Token seems invalid";
37853
- return;
37854
- }
37855
- });
37856
- if (pD(result)) {
37857
- xe("Activation cancelled");
37858
- process.exit(0);
37859
- }
37860
- userToken = result;
37861
- }
37862
- const spinner = Y2();
37863
- spinner.start("Validating token against premium products...");
37864
- let validationSuccess = false;
37865
- let data = null;
37866
- for (const productId of PRODUCT_IDS) {
37867
- const response = await fetch(`${API_URL}/${productId}/have-access?token=${userToken}`);
37868
- if (response.ok) {
37869
- const responseData = await response.json();
37870
- if (responseData.hasAccess) {
37871
- data = responseData;
37872
- validationSuccess = true;
37873
- break;
37874
- }
37875
- }
37876
- }
37877
- if (!validationSuccess || !data) {
37878
- spinner.stop("Token validation failed");
37879
- M2.error("Invalid token or no access to premium products");
37880
- M2.info("\uD83D\uDC8E Get AIBlueprint CLI Premium at: https://mlv.sh/claude-cli");
37881
- Se(source_default.red("❌ Activation failed"));
37882
- process.exit(1);
37883
- }
37884
- spinner.stop("Token validated");
37885
- const githubToken = data.product.metadata?.["cli-github-token"];
37886
- if (!githubToken) {
37887
- M2.error("No GitHub token found in product metadata. Please contact support.");
37888
- Se(source_default.red("❌ Activation failed"));
37889
- process.exit(1);
37890
- }
37891
- spinner.start("Saving token...");
37892
- await saveToken(githubToken);
37893
- spinner.stop("Token saved");
37912
+ const { data } = await activatePremiumToken(userToken);
37894
37913
  const tokenInfo = getTokenInfo();
37895
37914
  M2.success("✅ Token activated!");
37896
- M2.info(`User: ${data.user.name} (${data.user.email})`);
37897
- M2.info(`Product: ${data.product.title}`);
37915
+ M2.info(`User: ${data.user?.name ?? "Unknown"} (${data.user?.email ?? "unknown email"})`);
37916
+ M2.info(`Product: ${data.product?.title ?? "Premium"}`);
37898
37917
  M2.info(`Token saved to: ${tokenInfo.path}`);
37899
37918
  M2.info(source_default.cyan(`
37900
37919
  \uD83D\uDCA1 Next step: Run 'npx aiblueprint-cli@latest agents pro setup' to install premium configs`));
@@ -37903,7 +37922,9 @@ async function proActivateCommand(userToken) {
37903
37922
  } catch (error) {
37904
37923
  trackError(error, { command: "pro-activate" });
37905
37924
  await flushTelemetry();
37906
- if (error instanceof Error) {
37925
+ if (isPremiumActivationError(error)) {
37926
+ logPremiumActivationError(error);
37927
+ } else if (error instanceof Error) {
37907
37928
  M2.error(error.message);
37908
37929
  }
37909
37930
  Se(source_default.red("❌ Activation failed"));
@@ -37937,12 +37958,13 @@ async function proStatusCommand() {
37937
37958
  async function proSetupCommand(options = {}) {
37938
37959
  Ie(source_default.blue(`⚙️ Setup AIBlueprint CLI Premium ${source_default.gray(`v${getVersion()}`)}`));
37939
37960
  try {
37940
- const githubToken = await getToken();
37961
+ let githubToken = await getToken();
37941
37962
  if (!githubToken) {
37942
- M2.error("No token found");
37943
- M2.info("Run: npx aiblueprint-cli@latest agents pro activate <token>");
37944
- Se(source_default.red("❌ Not activated"));
37945
- process.exit(1);
37963
+ M2.warn("No token found");
37964
+ M2.info("Enter your Premium access token to activate and continue setup.");
37965
+ const activation = await activatePremiumToken();
37966
+ githubToken = activation.githubToken;
37967
+ M2.success("✅ Token activated. Continuing setup...");
37946
37968
  }
37947
37969
  const { claudeDir } = resolveFolders(options);
37948
37970
  const spinner = Y2();
@@ -37995,7 +38017,9 @@ async function proSetupCommand(options = {}) {
37995
38017
  } catch (error) {
37996
38018
  trackError(error, { command: "pro-setup" });
37997
38019
  await flushTelemetry();
37998
- if (error instanceof Error) {
38020
+ if (isPremiumActivationError(error)) {
38021
+ logPremiumActivationError(error);
38022
+ } else if (error instanceof Error) {
37999
38023
  M2.error(error.message);
38000
38024
  }
38001
38025
  Se(source_default.red("❌ Setup failed"));
@@ -39464,7 +39488,7 @@ function registerAgentsCommands(cmd) {
39464
39488
  proCmd.command("status").description("Check your Premium token status").action(() => {
39465
39489
  proStatusCommand();
39466
39490
  });
39467
- proCmd.command("setup").description("Install premium configurations (requires activation)").action((options, command) => {
39491
+ proCmd.command("setup").description("Install premium configurations, prompting for activation if needed").action((options, command) => {
39468
39492
  const parentOptions = command.parent.parent.opts();
39469
39493
  proSetupCommand({
39470
39494
  folder: parentOptions.folder,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiblueprint-cli",
3
- "version": "1.4.76",
3
+ "version": "1.4.77",
4
4
  "description": "AIBlueprint CLI for setting up AI coding configurations",
5
5
  "author": "AIBlueprint",
6
6
  "license": "MIT",