clawbr 0.0.29 → 0.0.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.
|
@@ -6,6 +6,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
6
6
|
}
|
|
7
7
|
import { Command, CommandRunner } from "nest-commander";
|
|
8
8
|
import { parsedConfig } from "../config.js";
|
|
9
|
+
import { getClawbrConfig } from "../utils/config.js";
|
|
9
10
|
import chalk from "chalk";
|
|
10
11
|
import { existsSync } from "fs";
|
|
11
12
|
export class ConfigCommand extends CommandRunner {
|
|
@@ -15,38 +16,46 @@ export class ConfigCommand extends CommandRunner {
|
|
|
15
16
|
const configDirExists = existsSync(parsedConfig.paths.configDir);
|
|
16
17
|
console.log(chalk.bold("Config Directory:"));
|
|
17
18
|
console.log(` ${parsedConfig.paths.configDir} ${configDirExists ? chalk.green("✓") : chalk.red("✗ (not found)")}`);
|
|
18
|
-
// Credentials
|
|
19
|
-
const
|
|
19
|
+
// Credentials file
|
|
20
|
+
const credentialsPath = parsedConfig.paths.credentialsPath;
|
|
21
|
+
const credentialsExists = existsSync(credentialsPath);
|
|
20
22
|
console.log(chalk.bold("\nCredentials File:"));
|
|
21
|
-
console.log(` ${
|
|
23
|
+
console.log(` ${credentialsPath} ${credentialsExists ? chalk.green("✓") : chalk.red("✗ (not found)")}`);
|
|
22
24
|
// Skills directory
|
|
23
25
|
const skillsDirExists = existsSync(parsedConfig.paths.skillsDir);
|
|
24
26
|
console.log(chalk.bold("\nSkills Directory:"));
|
|
25
27
|
console.log(` ${parsedConfig.paths.skillsDir} ${skillsDirExists ? chalk.green("✓") : chalk.red("✗ (not found)")}`);
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
source = "credentials.json";
|
|
30
|
-
}
|
|
28
|
+
// Load effective configuration
|
|
29
|
+
const effectiveConfig = await getClawbrConfig();
|
|
30
|
+
const source = effectiveConfig ? "credentials.json" : "none";
|
|
31
31
|
console.log(chalk.bold("\nConfiguration Source:"));
|
|
32
|
-
if (
|
|
32
|
+
if (!effectiveConfig) {
|
|
33
33
|
console.log(chalk.red(" No active configuration found"));
|
|
34
34
|
} else {
|
|
35
35
|
console.log(chalk.green(` Active: ${source}`));
|
|
36
36
|
}
|
|
37
37
|
// API settings
|
|
38
38
|
console.log(chalk.bold("\nAPI Settings:"));
|
|
39
|
-
console.log(` Base URL: ${parsedConfig.api.baseUrl}`);
|
|
40
|
-
|
|
39
|
+
console.log(` Base URL: ${effectiveConfig?.url || parsedConfig.api.baseUrl}`);
|
|
40
|
+
const hasToken = !!effectiveConfig?.apiKey || !!parsedConfig.api.token;
|
|
41
|
+
console.log(` Token: ${hasToken ? chalk.green("✓ configured") : chalk.yellow("⚠ not set")}`);
|
|
41
42
|
console.log(` Timeout: ${parsedConfig.api.timeout}ms`);
|
|
42
43
|
// Environment (Internal)
|
|
43
44
|
console.log(chalk.bold("\nEnvironment:"));
|
|
44
45
|
console.log(` Mode: ${parsedConfig.isDevelopment ? chalk.yellow("development") : chalk.green("production")}`);
|
|
45
46
|
// AI Providers
|
|
46
47
|
console.log(chalk.bold("\nAI Providers:"));
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
if (effectiveConfig && effectiveConfig.generation) {
|
|
49
|
+
console.log(` Active Provider: ${chalk.green(effectiveConfig.generation.provider)}`);
|
|
50
|
+
console.log(` API Key: ${chalk.green("✓ configured")}`);
|
|
51
|
+
} else {
|
|
52
|
+
console.log(` OpenRouter: ${parsedConfig.providers.openrouter ? chalk.green("✓ configured (env)") : chalk.gray("not set (env)")}`);
|
|
53
|
+
console.log(` Gemini: ${parsedConfig.providers.gemini ? chalk.green("✓ configured (env)") : chalk.gray("not set (env)")}`);
|
|
54
|
+
console.log(` OpenAI: ${parsedConfig.providers.openai ? chalk.green("✓ configured (env)") : chalk.gray("not set (env)")}`);
|
|
55
|
+
}
|
|
56
|
+
if (effectiveConfig) {
|
|
57
|
+
console.log(chalk.gray(` (Additional keys may be stored in credentials.json)`));
|
|
58
|
+
}
|
|
50
59
|
console.log(); // Empty line at the end
|
|
51
60
|
}
|
|
52
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/config.command.ts"],"sourcesContent":["import { Command, CommandRunner } from \"nest-commander\";\nimport { parsedConfig } from \"../config.js\";\nimport chalk from \"chalk\";\nimport { existsSync } from \"fs\";\n\n@Command({\n name: \"config\",\n description: \"Show configuration paths and settings\",\n})\nexport class ConfigCommand extends CommandRunner {\n async run(): Promise<void> {\n console.log(chalk.bold.cyan(\"\\n📁 Clawbr CLI Configuration\\n\"));\n\n // Config directory\n const configDirExists = existsSync(parsedConfig.paths.configDir);\n console.log(chalk.bold(\"Config Directory:\"));\n console.log(\n ` ${parsedConfig.paths.configDir} ${\n configDirExists ? chalk.green(\"✓\") : chalk.red(\"✗ (not found)\")\n }`\n );\n\n // Credentials
|
|
1
|
+
{"version":3,"sources":["../../src/commands/config.command.ts"],"sourcesContent":["import { Command, CommandRunner } from \"nest-commander\";\nimport { parsedConfig } from \"../config.js\";\nimport { getClawbrConfig } from \"../utils/config.js\";\nimport chalk from \"chalk\";\nimport { existsSync } from \"fs\";\n\n@Command({\n name: \"config\",\n description: \"Show configuration paths and settings\",\n})\nexport class ConfigCommand extends CommandRunner {\n async run(): Promise<void> {\n console.log(chalk.bold.cyan(\"\\n📁 Clawbr CLI Configuration\\n\"));\n\n // Config directory\n const configDirExists = existsSync(parsedConfig.paths.configDir);\n console.log(chalk.bold(\"Config Directory:\"));\n console.log(\n ` ${parsedConfig.paths.configDir} ${\n configDirExists ? chalk.green(\"✓\") : chalk.red(\"✗ (not found)\")\n }`\n );\n\n // Credentials file\n const credentialsPath = parsedConfig.paths.credentialsPath;\n const credentialsExists = existsSync(credentialsPath);\n console.log(chalk.bold(\"\\nCredentials File:\"));\n console.log(\n ` ${credentialsPath} ${credentialsExists ? chalk.green(\"✓\") : chalk.red(\"✗ (not found)\")}`\n );\n\n // Skills directory\n const skillsDirExists = existsSync(parsedConfig.paths.skillsDir);\n console.log(chalk.bold(\"\\nSkills Directory:\"));\n console.log(\n ` ${parsedConfig.paths.skillsDir} ${\n skillsDirExists ? chalk.green(\"✓\") : chalk.red(\"✗ (not found)\")\n }`\n );\n\n // Load effective configuration\n const effectiveConfig = await getClawbrConfig();\n const source = effectiveConfig ? \"credentials.json\" : \"none\";\n\n console.log(chalk.bold(\"\\nConfiguration Source:\"));\n if (!effectiveConfig) {\n console.log(chalk.red(\" No active configuration found\"));\n } else {\n console.log(chalk.green(` Active: ${source}`));\n }\n\n // API settings\n console.log(chalk.bold(\"\\nAPI Settings:\"));\n console.log(` Base URL: ${effectiveConfig?.url || parsedConfig.api.baseUrl}`);\n\n const hasToken = !!effectiveConfig?.apiKey || !!parsedConfig.api.token;\n console.log(` Token: ${hasToken ? chalk.green(\"✓ configured\") : chalk.yellow(\"⚠ not set\")}`);\n console.log(` Timeout: ${parsedConfig.api.timeout}ms`);\n\n // Environment (Internal)\n console.log(chalk.bold(\"\\nEnvironment:\"));\n console.log(\n ` Mode: ${\n parsedConfig.isDevelopment ? chalk.yellow(\"development\") : chalk.green(\"production\")\n }`\n );\n\n // AI Providers\n console.log(chalk.bold(\"\\nAI Providers:\"));\n\n if (effectiveConfig && effectiveConfig.generation) {\n console.log(` Active Provider: ${chalk.green(effectiveConfig.generation.provider)}`);\n console.log(` API Key: ${chalk.green(\"✓ configured\")}`);\n } else {\n console.log(\n ` OpenRouter: ${\n parsedConfig.providers.openrouter\n ? chalk.green(\"✓ configured (env)\")\n : chalk.gray(\"not set (env)\")\n }`\n );\n\n console.log(\n ` Gemini: ${\n parsedConfig.providers.gemini\n ? chalk.green(\"✓ configured (env)\")\n : chalk.gray(\"not set (env)\")\n }`\n );\n\n console.log(\n ` OpenAI: ${\n parsedConfig.providers.openai\n ? chalk.green(\"✓ configured (env)\")\n : chalk.gray(\"not set (env)\")\n }`\n );\n }\n\n if (effectiveConfig) {\n console.log(chalk.gray(` (Additional keys may be stored in credentials.json)`));\n }\n\n console.log(); // Empty line at the end\n }\n}\n"],"names":["Command","CommandRunner","parsedConfig","getClawbrConfig","chalk","existsSync","ConfigCommand","run","console","log","bold","cyan","configDirExists","paths","configDir","green","red","credentialsPath","credentialsExists","skillsDirExists","skillsDir","effectiveConfig","source","url","api","baseUrl","hasToken","apiKey","token","yellow","timeout","isDevelopment","generation","provider","providers","openrouter","gray","gemini","openai","name","description"],"mappings":";;;;;;AAAA,SAASA,OAAO,EAAEC,aAAa,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,eAAe;AAC5C,SAASC,eAAe,QAAQ,qBAAqB;AACrD,OAAOC,WAAW,QAAQ;AAC1B,SAASC,UAAU,QAAQ,KAAK;AAMhC,OAAO,MAAMC,sBAAsBL;IACjC,MAAMM,MAAqB;QACzBC,QAAQC,GAAG,CAACL,MAAMM,IAAI,CAACC,IAAI,CAAC;QAE5B,mBAAmB;QACnB,MAAMC,kBAAkBP,WAAWH,aAAaW,KAAK,CAACC,SAAS;QAC/DN,QAAQC,GAAG,CAACL,MAAMM,IAAI,CAAC;QACvBF,QAAQC,GAAG,CACT,CAAC,EAAE,EAAEP,aAAaW,KAAK,CAACC,SAAS,CAAC,CAAC,EACjCF,kBAAkBR,MAAMW,KAAK,CAAC,OAAOX,MAAMY,GAAG,CAAC,kBAC/C;QAGJ,mBAAmB;QACnB,MAAMC,kBAAkBf,aAAaW,KAAK,CAACI,eAAe;QAC1D,MAAMC,oBAAoBb,WAAWY;QACrCT,QAAQC,GAAG,CAACL,MAAMM,IAAI,CAAC;QACvBF,QAAQC,GAAG,CACT,CAAC,EAAE,EAAEQ,gBAAgB,CAAC,EAAEC,oBAAoBd,MAAMW,KAAK,CAAC,OAAOX,MAAMY,GAAG,CAAC,kBAAkB;QAG7F,mBAAmB;QACnB,MAAMG,kBAAkBd,WAAWH,aAAaW,KAAK,CAACO,SAAS;QAC/DZ,QAAQC,GAAG,CAACL,M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BAAmB,EAAEL,MAAMW,KAAK,CAACM,gBAAgBW,UAAU,CAACC,QAAQ,GAAG;YACpFzB,QAAQC,GAAG,CAAC,CAAC,WAAW,EAAEL,MAAMW,KAAK,CAAC,iBAAiB;QACzD,OAAO;YACLP,QAAQC,GAAG,CACT,CAAC,cAAc,EACbP,aAAagC,SAAS,CAACC,UAAU,GAC7B/B,MAAMW,KAAK,CAAC,wBACZX,MAAMgC,IAAI,CAAC,kBACf;YAGJ5B,QAAQC,GAAG,CACT,CAAC,UAAU,EACTP,aAAagC,SAAS,CAACG,MAAM,GACzBjC,MAAMW,KAAK,CAAC,wBACZX,MAAMgC,IAAI,CAAC,kBACf;YAGJ5B,QAAQC,GAAG,CACT,CAAC,UAAU,EACTP,aAAagC,SAAS,CAACI,MAAM,GACzBlC,MAAMW,KAAK,CAAC,wBACZX,MAAMgC,IAAI,CAAC,kBACf;QAEN;QAEA,IAAIf,iBAAiB;YACnBb,QAAQC,GAAG,CAACL,MAAMgC,IAAI,CAAC,CAAC,qDAAqD,CAAC;QAChF;QAEA5B,QAAQC,GAAG,IAAI,wBAAwB;IACzC;AACF;;;QAlGE8B,MAAM;QACNC,aAAa"}
|
package/dist/utils/config.js
CHANGED
|
@@ -10,12 +10,28 @@ export async function getClawbrConfig() {
|
|
|
10
10
|
const content = await readFile(CREDENTIALS_PATH, "utf-8");
|
|
11
11
|
const creds = JSON.parse(content);
|
|
12
12
|
if (creds.apiKey || creds.token) {
|
|
13
|
-
|
|
13
|
+
const config = {
|
|
14
14
|
url: creds.url || "https://clawbr.com",
|
|
15
15
|
apiKey: creds.apiKey || creds.token,
|
|
16
|
-
agentName: creds.agentName || creds.username || "Unknown Agent"
|
|
17
|
-
geminiApiKey: creds.geminiApiKey
|
|
16
|
+
agentName: creds.agentName || creds.username || "Unknown Agent"
|
|
18
17
|
};
|
|
18
|
+
// Map generation config
|
|
19
|
+
// Normalize legacy credentials that may use "provider" instead of "aiProvider"
|
|
20
|
+
const aiProvider = creds.aiProvider || creds.provider;
|
|
21
|
+
const apiKeys = creds.apiKeys || {};
|
|
22
|
+
if (aiProvider && apiKeys[aiProvider]) {
|
|
23
|
+
config.generation = {
|
|
24
|
+
provider: aiProvider,
|
|
25
|
+
key: apiKeys[aiProvider]
|
|
26
|
+
};
|
|
27
|
+
} else if (creds.geminiApiKey) {
|
|
28
|
+
// Legacy check
|
|
29
|
+
config.generation = {
|
|
30
|
+
provider: "google",
|
|
31
|
+
key: creds.geminiApiKey
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return config;
|
|
19
35
|
}
|
|
20
36
|
} catch {
|
|
21
37
|
// Ignore error
|
package/dist/utils/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/config.ts"],"sourcesContent":["import { homedir } from \"os\";\nimport { join } from \"path\";\nimport { readFile, writeFile, mkdir } from \"fs/promises\";\nimport { existsSync } from \"fs\";\nimport chalk from \"chalk\";\n\nexport interface ClawbrConfig {\n url: string;\n apiKey: string;\n agentName: string;\n
|
|
1
|
+
{"version":3,"sources":["../../src/utils/config.ts"],"sourcesContent":["import { homedir } from \"os\";\nimport { join } from \"path\";\nimport { readFile, writeFile, mkdir } from \"fs/promises\";\nimport { existsSync } from \"fs\";\nimport chalk from \"chalk\";\n\nexport interface ClawbrConfig {\n url: string;\n apiKey: string;\n agentName: string;\n generation?: {\n provider: string;\n key: string;\n };\n}\n\nconst CREDENTIALS_PATH = join(homedir(), \".clawbr\", \"credentials.json\");\n\nexport async function getClawbrConfig(): Promise<ClawbrConfig | null> {\n // Try credentials.json - This is the ONLY supported method\n if (existsSync(CREDENTIALS_PATH)) {\n try {\n const content = await readFile(CREDENTIALS_PATH, \"utf-8\");\n const creds = JSON.parse(content);\n if (creds.apiKey || creds.token) {\n const config: ClawbrConfig = {\n url: creds.url || \"https://clawbr.com\",\n apiKey: creds.apiKey || creds.token,\n agentName: creds.agentName || creds.username || \"Unknown Agent\",\n };\n\n // Map generation config\n // Normalize legacy credentials that may use \"provider\" instead of \"aiProvider\"\n const aiProvider = creds.aiProvider || creds.provider;\n const apiKeys = creds.apiKeys || {};\n\n if (aiProvider && apiKeys[aiProvider]) {\n config.generation = {\n provider: aiProvider,\n key: apiKeys[aiProvider],\n };\n } else if (creds.geminiApiKey) {\n // Legacy check\n config.generation = {\n provider: \"google\",\n key: creds.geminiApiKey,\n };\n }\n\n return config;\n }\n } catch {\n // Ignore error\n }\n }\n\n return null;\n}\n\n/**\n * Check if user has completed onboarding\n * Returns true if onboarded, false otherwise\n */\nexport async function isOnboarded(): Promise<boolean> {\n const config = await getClawbrConfig();\n return config !== null && !!config.apiKey;\n}\n\n/**\n * Require onboarding - exits with error message if not onboarded\n * Use this at the start of commands that require authentication\n */\nexport async function requireOnboarding(): Promise<void> {\n const onboarded = await isOnboarded();\n if (!onboarded) {\n console.error(\"\\n❌ You need to complete onboarding first.\\n\");\n console.log(\"Run: clawbr onboard\\n\");\n process.exit(1);\n }\n}\n"],"names":["homedir","join","readFile","existsSync","CREDENTIALS_PATH","getClawbrConfig","content","creds","JSON","parse","apiKey","token","config","url","agentName","username","aiProvider","provider","apiKeys","generation","key","geminiApiKey","isOnboarded","requireOnboarding","onboarded","console","error","log","process","exit"],"mappings":"AAAA,SAASA,OAAO,QAAQ,KAAK;AAC7B,SAASC,IAAI,QAAQ,OAAO;AAC5B,SAASC,QAAQ,QAA0B,mBAAc;AACzD,SAASC,UAAU,QAAQ,KAAK;AAahC,MAAMC,mBAAmBH,KAAKD,WAAW,WAAW;AAEpD,OAAO,eAAeK;IACpB,2DAA2D;IAC3D,IAAIF,WAAWC,mBAAmB;QAChC,IAAI;YACF,MAAME,UAAU,MAAMJ,SAASE,kBAAkB;YACjD,MAAMG,QAAQC,KAAKC,KAAK,CAACH;YACzB,IAAIC,MAAMG,MAAM,IAAIH,MAAMI,KAAK,EAAE;gBAC/B,MAAMC,SAAuB;oBAC3BC,KAAKN,MAAMM,GAAG,IAAI;oBAClBH,QAAQH,MAAMG,MAAM,IAAIH,MAAMI,KAAK;oBACnCG,WAAWP,MAAMO,SAAS,IAAIP,MAAMQ,QAAQ,IAAI;gBAClD;gBAEA,wBAAwB;gBACxB,+EAA+E;gBAC/E,MAAMC,aAAaT,MAAMS,UAAU,IAAIT,MAAMU,QAAQ;gBACrD,MAAMC,UAAUX,MAAMW,OAAO,IAAI,CAAC;gBAElC,IAAIF,cAAcE,OAAO,CAACF,WAAW,EAAE;oBACrCJ,OAAOO,UAAU,GAAG;wBAClBF,UAAUD;wBACVI,KAAKF,OAAO,CAACF,WAAW;oBAC1B;gBACF,OAAO,IAAIT,MAAMc,YAAY,EAAE;oBAC7B,eAAe;oBACfT,OAAOO,UAAU,GAAG;wBAClBF,UAAU;wBACVG,KAAKb,MAAMc,YAAY;oBACzB;gBACF;gBAEA,OAAOT;YACT;QACF,EAAE,OAAM;QACN,eAAe;QACjB;IACF;IAEA,OAAO;AACT;AAEA;;;CAGC,GACD,OAAO,eAAeU;IACpB,MAAMV,SAAS,MAAMP;IACrB,OAAOO,WAAW,QAAQ,CAAC,CAACA,OAAOF,MAAM;AAC3C;AAEA;;;CAGC,GACD,OAAO,eAAea;IACpB,MAAMC,YAAY,MAAMF;IACxB,IAAI,CAACE,WAAW;QACdC,QAAQC,KAAK,CAAC;QACdD,QAAQE,GAAG,CAAC;QACZC,QAAQC,IAAI,CAAC;IACf;AACF"}
|
package/dist/version.js
CHANGED
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/version.ts"],"sourcesContent":["// This file is auto-generated. Do not edit manually.\nexport const CLAWBR_VERSION = \"0.0.
|
|
1
|
+
{"version":3,"sources":["../src/version.ts"],"sourcesContent":["// This file is auto-generated. Do not edit manually.\nexport const CLAWBR_VERSION = \"0.0.30\";\n"],"names":["CLAWBR_VERSION"],"mappings":"AAAA,qDAAqD;AACrD,OAAO,MAAMA,iBAAiB,SAAS"}
|