aiblueprint-cli 1.4.28 → 1.4.30
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 +324 -24
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -32932,22 +32932,34 @@ async function checkAndInstallDependencies() {
|
|
|
32932
32932
|
return false;
|
|
32933
32933
|
}
|
|
32934
32934
|
};
|
|
32935
|
-
if (
|
|
32935
|
+
if (checkCommand("bun")) {
|
|
32936
|
+
console.log(source_default.gray(" bun already installed, skipping..."));
|
|
32937
|
+
} else {
|
|
32936
32938
|
console.log(source_default.yellow(`
|
|
32937
32939
|
Installing bun...`));
|
|
32938
32940
|
try {
|
|
32939
|
-
execSync("npm install -g bun", {
|
|
32940
|
-
|
|
32941
|
-
|
|
32941
|
+
execSync("npm install -g bun", {
|
|
32942
|
+
stdio: "inherit",
|
|
32943
|
+
timeout: 60000,
|
|
32944
|
+
env: { ...process.env, CI: "true" }
|
|
32945
|
+
});
|
|
32946
|
+
} catch {
|
|
32947
|
+
console.log(source_default.yellow(" ⚠ Failed to install bun. Please install it manually: npm install -g bun"));
|
|
32942
32948
|
}
|
|
32943
32949
|
}
|
|
32944
|
-
if (
|
|
32950
|
+
if (checkCommand("ccusage")) {
|
|
32951
|
+
console.log(source_default.gray(" ccusage already installed, skipping..."));
|
|
32952
|
+
} else {
|
|
32945
32953
|
console.log(source_default.yellow(`
|
|
32946
32954
|
Installing ccusage...`));
|
|
32947
32955
|
try {
|
|
32948
|
-
execSync("npm install -g ccusage", {
|
|
32949
|
-
|
|
32950
|
-
|
|
32956
|
+
execSync("npm install -g ccusage", {
|
|
32957
|
+
stdio: "inherit",
|
|
32958
|
+
timeout: 60000,
|
|
32959
|
+
env: { ...process.env, CI: "true" }
|
|
32960
|
+
});
|
|
32961
|
+
} catch {
|
|
32962
|
+
console.log(source_default.yellow(" ⚠ Failed to install ccusage. Please install it manually: npm install -g ccusage"));
|
|
32951
32963
|
}
|
|
32952
32964
|
}
|
|
32953
32965
|
}
|
|
@@ -36034,13 +36046,283 @@ async function backupLoadCommand(options = {}) {
|
|
|
36034
36046
|
}
|
|
36035
36047
|
}
|
|
36036
36048
|
|
|
36037
|
-
// src/commands/
|
|
36049
|
+
// src/commands/openclaw-pro.ts
|
|
36050
|
+
import os18 from "os";
|
|
36038
36051
|
import path18 from "path";
|
|
36039
|
-
import { homedir } from "os";
|
|
36040
36052
|
|
|
36041
|
-
// src/lib/
|
|
36053
|
+
// src/lib/openclaw-installer.ts
|
|
36042
36054
|
var import_fs_extra12 = __toESM(require_lib4(), 1);
|
|
36055
|
+
import os16 from "os";
|
|
36043
36056
|
import path16 from "path";
|
|
36057
|
+
import { exec as exec4 } from "child_process";
|
|
36058
|
+
import { promisify as promisify3 } from "util";
|
|
36059
|
+
var execAsync3 = promisify3(exec4);
|
|
36060
|
+
var OPENCLAW_PRO_REPO = "Melvynx/openclawpro";
|
|
36061
|
+
function getCacheRepoDir2() {
|
|
36062
|
+
return path16.join(os16.homedir(), ".config", "openclaw", "pro-repos", "openclawpro");
|
|
36063
|
+
}
|
|
36064
|
+
async function execGitWithAuth2(command, token, repoUrl, cwd) {
|
|
36065
|
+
const authenticatedUrl = `https://x-access-token:${token}@${repoUrl.replace(/^https?:\/\//, "")}`;
|
|
36066
|
+
const fullCommand = `git ${command.replace(repoUrl, authenticatedUrl)}`;
|
|
36067
|
+
try {
|
|
36068
|
+
await execAsync3(fullCommand, { cwd, timeout: 120000 });
|
|
36069
|
+
} catch (error) {
|
|
36070
|
+
throw new Error(`Git command failed: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
36071
|
+
}
|
|
36072
|
+
}
|
|
36073
|
+
async function cloneOrUpdateRepo2(token) {
|
|
36074
|
+
const cacheDir = getCacheRepoDir2();
|
|
36075
|
+
const repoUrl = `https://github.com/${OPENCLAW_PRO_REPO}.git`;
|
|
36076
|
+
if (await import_fs_extra12.default.pathExists(path16.join(cacheDir, ".git"))) {
|
|
36077
|
+
try {
|
|
36078
|
+
await execGitWithAuth2("pull", token, repoUrl, cacheDir);
|
|
36079
|
+
} catch (error) {
|
|
36080
|
+
await import_fs_extra12.default.remove(cacheDir);
|
|
36081
|
+
await import_fs_extra12.default.ensureDir(path16.dirname(cacheDir));
|
|
36082
|
+
await execGitWithAuth2(`clone ${repoUrl} ${cacheDir}`, token, repoUrl);
|
|
36083
|
+
}
|
|
36084
|
+
} else {
|
|
36085
|
+
await import_fs_extra12.default.ensureDir(path16.dirname(cacheDir));
|
|
36086
|
+
await execGitWithAuth2(`clone ${repoUrl} ${cacheDir}`, token, repoUrl);
|
|
36087
|
+
}
|
|
36088
|
+
return path16.join(cacheDir, "openclaw-config");
|
|
36089
|
+
}
|
|
36090
|
+
async function copyConfigFromCache2(cacheConfigDir, targetDir, onProgress) {
|
|
36091
|
+
const walk = async (dir, baseDir = dir) => {
|
|
36092
|
+
const entries = await import_fs_extra12.default.readdir(dir, { withFileTypes: true });
|
|
36093
|
+
for (const entry of entries) {
|
|
36094
|
+
const sourcePath = path16.join(dir, entry.name);
|
|
36095
|
+
const relativePath = path16.relative(baseDir, sourcePath);
|
|
36096
|
+
const targetPath = path16.join(targetDir, relativePath);
|
|
36097
|
+
if (entry.isDirectory()) {
|
|
36098
|
+
await import_fs_extra12.default.ensureDir(targetPath);
|
|
36099
|
+
onProgress?.(relativePath, "directory");
|
|
36100
|
+
await walk(sourcePath, baseDir);
|
|
36101
|
+
} else {
|
|
36102
|
+
await import_fs_extra12.default.copy(sourcePath, targetPath, { overwrite: true });
|
|
36103
|
+
onProgress?.(relativePath, "file");
|
|
36104
|
+
}
|
|
36105
|
+
}
|
|
36106
|
+
};
|
|
36107
|
+
await walk(cacheConfigDir);
|
|
36108
|
+
}
|
|
36109
|
+
async function installOpenclawProConfigs(options) {
|
|
36110
|
+
const { githubToken, openclawFolder, onProgress } = options;
|
|
36111
|
+
const targetFolder = openclawFolder || path16.join(os16.homedir(), ".openclaw");
|
|
36112
|
+
try {
|
|
36113
|
+
const cacheConfigDir = await cloneOrUpdateRepo2(githubToken);
|
|
36114
|
+
await copyConfigFromCache2(cacheConfigDir, targetFolder, onProgress);
|
|
36115
|
+
return;
|
|
36116
|
+
} catch (error) {
|
|
36117
|
+
throw new Error(`Failed to install OpenClaw Pro configs: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
36118
|
+
}
|
|
36119
|
+
}
|
|
36120
|
+
|
|
36121
|
+
// src/lib/openclaw-token-storage.ts
|
|
36122
|
+
var import_fs_extra13 = __toESM(require_lib4(), 1);
|
|
36123
|
+
import os17 from "os";
|
|
36124
|
+
import path17 from "path";
|
|
36125
|
+
function getConfigDir2() {
|
|
36126
|
+
const platform = os17.platform();
|
|
36127
|
+
if (platform === "win32") {
|
|
36128
|
+
return path17.join(process.env.APPDATA || os17.homedir(), "openclaw");
|
|
36129
|
+
}
|
|
36130
|
+
return path17.join(os17.homedir(), ".config", "openclaw");
|
|
36131
|
+
}
|
|
36132
|
+
function getTokenPath() {
|
|
36133
|
+
return path17.join(getConfigDir2(), "token.txt");
|
|
36134
|
+
}
|
|
36135
|
+
async function saveOpenclawToken(githubToken) {
|
|
36136
|
+
const configDir = getConfigDir2();
|
|
36137
|
+
await import_fs_extra13.default.ensureDir(configDir);
|
|
36138
|
+
await import_fs_extra13.default.writeFile(getTokenPath(), githubToken, { mode: 384 });
|
|
36139
|
+
}
|
|
36140
|
+
async function getOpenclawToken() {
|
|
36141
|
+
const tokenPath = getTokenPath();
|
|
36142
|
+
if (await import_fs_extra13.default.pathExists(tokenPath)) {
|
|
36143
|
+
const token = await import_fs_extra13.default.readFile(tokenPath, "utf8");
|
|
36144
|
+
return token.trim();
|
|
36145
|
+
}
|
|
36146
|
+
return null;
|
|
36147
|
+
}
|
|
36148
|
+
function getOpenclawTokenInfo() {
|
|
36149
|
+
return {
|
|
36150
|
+
path: getTokenPath(),
|
|
36151
|
+
platform: os17.platform()
|
|
36152
|
+
};
|
|
36153
|
+
}
|
|
36154
|
+
|
|
36155
|
+
// src/commands/openclaw-pro.ts
|
|
36156
|
+
var import_fs_extra14 = __toESM(require_lib4(), 1);
|
|
36157
|
+
var API_URL2 = "https://codeline.app/api/products";
|
|
36158
|
+
var OPENCLAW_PRODUCT_ID = "prd_t2GRwX3aH1";
|
|
36159
|
+
async function openclawProActivateCommand(userToken) {
|
|
36160
|
+
Ie(source_default.blue(`\uD83D\uDD11 Activate OpenClaw Pro ${source_default.gray(`v${getVersion()}`)}`));
|
|
36161
|
+
try {
|
|
36162
|
+
if (!userToken) {
|
|
36163
|
+
const result = await he({
|
|
36164
|
+
message: "Enter your OpenClaw Pro access token:",
|
|
36165
|
+
placeholder: "Your ProductsOnUsers ID from codeline.app",
|
|
36166
|
+
validate: (value) => {
|
|
36167
|
+
if (!value)
|
|
36168
|
+
return "Token is required";
|
|
36169
|
+
if (value.length < 5)
|
|
36170
|
+
return "Token seems invalid";
|
|
36171
|
+
return;
|
|
36172
|
+
}
|
|
36173
|
+
});
|
|
36174
|
+
if (pD(result)) {
|
|
36175
|
+
xe("Activation cancelled");
|
|
36176
|
+
process.exit(0);
|
|
36177
|
+
}
|
|
36178
|
+
userToken = result;
|
|
36179
|
+
}
|
|
36180
|
+
const spinner = Y2();
|
|
36181
|
+
spinner.start("Validating token...");
|
|
36182
|
+
const response = await fetch(`${API_URL2}/${OPENCLAW_PRODUCT_ID}/have-access?token=${userToken}`);
|
|
36183
|
+
if (!response.ok) {
|
|
36184
|
+
spinner.stop("Token validation failed");
|
|
36185
|
+
M2.error("Invalid token or no access");
|
|
36186
|
+
M2.info("Get OpenClaw Pro at: https://codeline.app");
|
|
36187
|
+
Se(source_default.red("❌ Activation failed"));
|
|
36188
|
+
process.exit(1);
|
|
36189
|
+
}
|
|
36190
|
+
const data = await response.json();
|
|
36191
|
+
if (!data.hasAccess) {
|
|
36192
|
+
spinner.stop("Token validation failed");
|
|
36193
|
+
M2.error("No access to OpenClaw Pro");
|
|
36194
|
+
Se(source_default.red("❌ Activation failed"));
|
|
36195
|
+
process.exit(1);
|
|
36196
|
+
}
|
|
36197
|
+
spinner.stop("Token validated");
|
|
36198
|
+
const githubToken = data.product.metadata?.["cli-github-token"];
|
|
36199
|
+
if (!githubToken) {
|
|
36200
|
+
M2.error("No GitHub token found in product metadata. Contact support.");
|
|
36201
|
+
Se(source_default.red("❌ Activation failed"));
|
|
36202
|
+
process.exit(1);
|
|
36203
|
+
}
|
|
36204
|
+
spinner.start("Saving token...");
|
|
36205
|
+
await saveOpenclawToken(githubToken);
|
|
36206
|
+
spinner.stop("Token saved");
|
|
36207
|
+
const tokenInfo = getOpenclawTokenInfo();
|
|
36208
|
+
M2.success("✅ Token activated!");
|
|
36209
|
+
M2.info(`User: ${data.user.name} (${data.user.email})`);
|
|
36210
|
+
M2.info(`Product: ${data.product.title}`);
|
|
36211
|
+
M2.info(`Token saved to: ${tokenInfo.path}`);
|
|
36212
|
+
M2.info(source_default.cyan(`
|
|
36213
|
+
\uD83D\uDCA1 Next step: Run 'npx aiblueprint-cli@latest openclaw pro setup'`));
|
|
36214
|
+
Se(source_default.green("✅ Activation complete!"));
|
|
36215
|
+
} catch (error) {
|
|
36216
|
+
if (error instanceof Error) {
|
|
36217
|
+
M2.error(error.message);
|
|
36218
|
+
}
|
|
36219
|
+
Se(source_default.red("❌ Activation failed"));
|
|
36220
|
+
process.exit(1);
|
|
36221
|
+
}
|
|
36222
|
+
}
|
|
36223
|
+
async function openclawProStatusCommand() {
|
|
36224
|
+
Ie(source_default.blue(`\uD83D\uDCCA OpenClaw Pro Status ${source_default.gray(`v${getVersion()}`)}`));
|
|
36225
|
+
try {
|
|
36226
|
+
const token = await getOpenclawToken();
|
|
36227
|
+
if (!token) {
|
|
36228
|
+
M2.warn("No token found");
|
|
36229
|
+
M2.info("Run: npx aiblueprint-cli@latest openclaw pro activate <token>");
|
|
36230
|
+
Se(source_default.yellow("⚠️ Not activated"));
|
|
36231
|
+
process.exit(0);
|
|
36232
|
+
}
|
|
36233
|
+
const tokenInfo = getOpenclawTokenInfo();
|
|
36234
|
+
M2.success("✅ Token active");
|
|
36235
|
+
M2.info(`Token file: ${tokenInfo.path}`);
|
|
36236
|
+
Se(source_default.green("Token is saved"));
|
|
36237
|
+
} catch (error) {
|
|
36238
|
+
if (error instanceof Error) {
|
|
36239
|
+
M2.error(error.message);
|
|
36240
|
+
}
|
|
36241
|
+
Se(source_default.red("❌ Failed to check status"));
|
|
36242
|
+
process.exit(1);
|
|
36243
|
+
}
|
|
36244
|
+
}
|
|
36245
|
+
async function openclawProSetupCommand(options = {}) {
|
|
36246
|
+
Ie(source_default.blue(`⚙️ Setup OpenClaw Pro ${source_default.gray(`v${getVersion()}`)}`));
|
|
36247
|
+
try {
|
|
36248
|
+
const githubToken = await getOpenclawToken();
|
|
36249
|
+
if (!githubToken) {
|
|
36250
|
+
M2.error("No token found");
|
|
36251
|
+
M2.info("Run: npx aiblueprint-cli@latest openclaw pro activate <token>");
|
|
36252
|
+
Se(source_default.red("❌ Not activated"));
|
|
36253
|
+
process.exit(1);
|
|
36254
|
+
}
|
|
36255
|
+
const openclawDir = options.folder ? path18.resolve(options.folder) : path18.join(os18.homedir(), ".openclaw");
|
|
36256
|
+
const spinner = Y2();
|
|
36257
|
+
const onProgress = (file, type) => {
|
|
36258
|
+
spinner.message(`Installing: ${source_default.cyan(file)} ${source_default.gray(`(${type})`)}`);
|
|
36259
|
+
};
|
|
36260
|
+
spinner.start("Installing OpenClaw Pro configurations...");
|
|
36261
|
+
await installOpenclawProConfigs({
|
|
36262
|
+
githubToken,
|
|
36263
|
+
openclawFolder: openclawDir,
|
|
36264
|
+
onProgress
|
|
36265
|
+
});
|
|
36266
|
+
spinner.stop("OpenClaw Pro configurations installed");
|
|
36267
|
+
let skillCount = 0;
|
|
36268
|
+
const skillsDir = path18.join(openclawDir, "skills");
|
|
36269
|
+
if (await import_fs_extra14.default.pathExists(skillsDir)) {
|
|
36270
|
+
const items = await import_fs_extra14.default.readdir(skillsDir);
|
|
36271
|
+
const dirs = await Promise.all(items.map(async (item) => {
|
|
36272
|
+
const stat = await import_fs_extra14.default.stat(path18.join(skillsDir, item));
|
|
36273
|
+
return stat.isDirectory();
|
|
36274
|
+
}));
|
|
36275
|
+
skillCount = dirs.filter(Boolean).length;
|
|
36276
|
+
}
|
|
36277
|
+
M2.success("✅ Setup complete!");
|
|
36278
|
+
M2.info("Installed:");
|
|
36279
|
+
M2.info(` • Skills (${skillCount})`);
|
|
36280
|
+
M2.info(` • IDENTITY.md`);
|
|
36281
|
+
M2.info(source_default.cyan(`
|
|
36282
|
+
\uD83D\uDCA1 Skills installed to: ` + skillsDir));
|
|
36283
|
+
Se(source_default.green("\uD83D\uDE80 OpenClaw Pro ready!"));
|
|
36284
|
+
} catch (error) {
|
|
36285
|
+
if (error instanceof Error) {
|
|
36286
|
+
M2.error(error.message);
|
|
36287
|
+
}
|
|
36288
|
+
Se(source_default.red("❌ Setup failed"));
|
|
36289
|
+
process.exit(1);
|
|
36290
|
+
}
|
|
36291
|
+
}
|
|
36292
|
+
async function openclawProUpdateCommand(options = {}) {
|
|
36293
|
+
Ie(source_default.blue(`\uD83D\uDD04 Update OpenClaw Pro ${source_default.gray(`v${getVersion()}`)}`));
|
|
36294
|
+
try {
|
|
36295
|
+
const githubToken = await getOpenclawToken();
|
|
36296
|
+
if (!githubToken) {
|
|
36297
|
+
M2.error("No token found");
|
|
36298
|
+
M2.info("Run: npx aiblueprint-cli@latest openclaw pro activate <token>");
|
|
36299
|
+
Se(source_default.red("❌ Not activated"));
|
|
36300
|
+
process.exit(1);
|
|
36301
|
+
}
|
|
36302
|
+
const spinner = Y2();
|
|
36303
|
+
spinner.start("Updating OpenClaw Pro configurations...");
|
|
36304
|
+
await installOpenclawProConfigs({
|
|
36305
|
+
githubToken,
|
|
36306
|
+
openclawFolder: options.folder
|
|
36307
|
+
});
|
|
36308
|
+
spinner.stop("OpenClaw Pro configurations updated");
|
|
36309
|
+
Se(source_default.green("✅ Update completed"));
|
|
36310
|
+
} catch (error) {
|
|
36311
|
+
if (error instanceof Error) {
|
|
36312
|
+
M2.error(error.message);
|
|
36313
|
+
}
|
|
36314
|
+
Se(source_default.red("❌ Update failed"));
|
|
36315
|
+
process.exit(1);
|
|
36316
|
+
}
|
|
36317
|
+
}
|
|
36318
|
+
|
|
36319
|
+
// src/commands/dynamic-scripts.ts
|
|
36320
|
+
import path21 from "path";
|
|
36321
|
+
import { homedir } from "os";
|
|
36322
|
+
|
|
36323
|
+
// src/lib/script-parser.ts
|
|
36324
|
+
var import_fs_extra15 = __toESM(require_lib4(), 1);
|
|
36325
|
+
import path19 from "path";
|
|
36044
36326
|
var EXCLUDED_SCRIPTS = ["test", "lint", "format", "start"];
|
|
36045
36327
|
var EXCLUDED_SUFFIXES = [":test", ":lint", ":test-fixtures", ":start"];
|
|
36046
36328
|
function shouldIncludeScript(scriptName) {
|
|
@@ -36051,12 +36333,12 @@ function shouldIncludeScript(scriptName) {
|
|
|
36051
36333
|
return true;
|
|
36052
36334
|
}
|
|
36053
36335
|
async function readScriptsPackageJson(claudeDir) {
|
|
36054
|
-
const packageJsonPath =
|
|
36336
|
+
const packageJsonPath = path19.join(claudeDir, "scripts", "package.json");
|
|
36055
36337
|
try {
|
|
36056
|
-
if (!await
|
|
36338
|
+
if (!await import_fs_extra15.default.pathExists(packageJsonPath)) {
|
|
36057
36339
|
return null;
|
|
36058
36340
|
}
|
|
36059
|
-
const content = await
|
|
36341
|
+
const content = await import_fs_extra15.default.readFile(packageJsonPath, "utf-8");
|
|
36060
36342
|
const parsed = JSON.parse(content);
|
|
36061
36343
|
return parsed.scripts || null;
|
|
36062
36344
|
} catch (error) {
|
|
@@ -36100,14 +36382,14 @@ function groupScriptsByPrefix(commands) {
|
|
|
36100
36382
|
}
|
|
36101
36383
|
|
|
36102
36384
|
// src/commands/script-runner.ts
|
|
36103
|
-
var
|
|
36385
|
+
var import_fs_extra16 = __toESM(require_lib4(), 1);
|
|
36104
36386
|
import { spawn as spawn2 } from "child_process";
|
|
36105
36387
|
import { execSync as execSync4 } from "child_process";
|
|
36106
|
-
import
|
|
36107
|
-
import
|
|
36388
|
+
import path20 from "path";
|
|
36389
|
+
import os19 from "os";
|
|
36108
36390
|
function checkCommand(cmd) {
|
|
36109
36391
|
try {
|
|
36110
|
-
const isWindows =
|
|
36392
|
+
const isWindows = os19.platform() === "win32";
|
|
36111
36393
|
const whichCmd = isWindows ? `where ${cmd}` : `which ${cmd}`;
|
|
36112
36394
|
execSync4(whichCmd, { stdio: "ignore" });
|
|
36113
36395
|
return true;
|
|
@@ -36133,18 +36415,18 @@ async function executeScript(scriptName, claudeDir) {
|
|
|
36133
36415
|
console.error(source_default.red("Bun is not installed. Install with: npm install -g bun"));
|
|
36134
36416
|
return 1;
|
|
36135
36417
|
}
|
|
36136
|
-
const scriptsDir =
|
|
36137
|
-
if (!await
|
|
36418
|
+
const scriptsDir = path20.join(claudeDir, "scripts");
|
|
36419
|
+
if (!await import_fs_extra16.default.pathExists(scriptsDir)) {
|
|
36138
36420
|
console.error(source_default.red(`Scripts directory not found at ${scriptsDir}`));
|
|
36139
36421
|
console.log(source_default.gray("Run: aiblueprint claude-code setup"));
|
|
36140
36422
|
return 1;
|
|
36141
36423
|
}
|
|
36142
|
-
const packageJsonPath =
|
|
36143
|
-
if (!await
|
|
36424
|
+
const packageJsonPath = path20.join(scriptsDir, "package.json");
|
|
36425
|
+
if (!await import_fs_extra16.default.pathExists(packageJsonPath)) {
|
|
36144
36426
|
console.error(source_default.red(`package.json not found in ${scriptsDir}`));
|
|
36145
36427
|
return 1;
|
|
36146
36428
|
}
|
|
36147
|
-
const packageJson = await
|
|
36429
|
+
const packageJson = await import_fs_extra16.default.readJson(packageJsonPath);
|
|
36148
36430
|
if (!packageJson.scripts || !packageJson.scripts[scriptName]) {
|
|
36149
36431
|
console.error(source_default.red(`Script "${scriptName}" not found in package.json`));
|
|
36150
36432
|
return 1;
|
|
@@ -36167,7 +36449,7 @@ async function executeScript(scriptName, claudeDir) {
|
|
|
36167
36449
|
|
|
36168
36450
|
// src/commands/dynamic-scripts.ts
|
|
36169
36451
|
function getClaudeDir(parentOptions) {
|
|
36170
|
-
return parentOptions.claudeCodeFolder || parentOptions.folder ?
|
|
36452
|
+
return parentOptions.claudeCodeFolder || parentOptions.folder ? path21.resolve(parentOptions.claudeCodeFolder || parentOptions.folder) : path21.join(homedir(), ".claude");
|
|
36171
36453
|
}
|
|
36172
36454
|
async function registerDynamicScriptCommands(claudeCodeCmd, claudeDir) {
|
|
36173
36455
|
const scripts = await readScriptsPackageJson(claudeDir);
|
|
@@ -36256,6 +36538,24 @@ backupCmd.command("load").description("Load a previous backup interactively").ac
|
|
|
36256
36538
|
const claudeCodeFolder = parentOptions.claudeCodeFolder || parentOptions.folder;
|
|
36257
36539
|
backupLoadCommand({ folder: claudeCodeFolder });
|
|
36258
36540
|
});
|
|
36541
|
+
var openclawCmd = program2.command("openclaw").description("OpenClaw configuration commands").option("-f, --folder <path>", "Specify custom OpenClaw folder path (default: ~/.openclaw)");
|
|
36542
|
+
var openclawProCmd = openclawCmd.command("pro").description("Manage OpenClaw Pro features");
|
|
36543
|
+
openclawProCmd.command("activate [token]").description("Activate OpenClaw Pro with your access token").action((token) => {
|
|
36544
|
+
openclawProActivateCommand(token);
|
|
36545
|
+
});
|
|
36546
|
+
openclawProCmd.command("status").description("Check your OpenClaw Pro token status").action(() => {
|
|
36547
|
+
openclawProStatusCommand();
|
|
36548
|
+
});
|
|
36549
|
+
openclawProCmd.command("setup").description("Install OpenClaw Pro configurations (requires activation)").action((options, command) => {
|
|
36550
|
+
const parentOptions = command.parent.parent.opts();
|
|
36551
|
+
const folder = parentOptions.folder;
|
|
36552
|
+
openclawProSetupCommand({ folder });
|
|
36553
|
+
});
|
|
36554
|
+
openclawProCmd.command("update").description("Update OpenClaw Pro configurations").action((options, command) => {
|
|
36555
|
+
const parentOptions = command.parent.parent.opts();
|
|
36556
|
+
const folder = parentOptions.folder;
|
|
36557
|
+
openclawProUpdateCommand({ folder });
|
|
36558
|
+
});
|
|
36259
36559
|
try {
|
|
36260
36560
|
const claudeDir = join2(homedir2(), ".claude");
|
|
36261
36561
|
await registerDynamicScriptCommands(claudeCodeCmd, claudeDir);
|