clawmoney 0.8.1 → 0.8.2
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/commands/hub.js +15 -13
- package/package.json +1 -1
package/dist/commands/hub.js
CHANGED
|
@@ -18,9 +18,11 @@ export async function hubStartCommand(options) {
|
|
|
18
18
|
}
|
|
19
19
|
const spinner = ora("Starting Hub Provider...").start();
|
|
20
20
|
try {
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
const
|
|
21
|
+
// Resolve daemon script path relative to this file's directory
|
|
22
|
+
// Works for both compiled (dist/commands/hub.js) and dev (src/commands/hub.ts)
|
|
23
|
+
const thisDir = import.meta.url.replace("file://", "").replace(/\/[^/]+$/, "");
|
|
24
|
+
const parentDir = thisDir.replace(/\/[^/]+$/, "");
|
|
25
|
+
const daemonScript = join(parentDir, "hub", "daemon.js");
|
|
24
26
|
const args = [daemonScript];
|
|
25
27
|
if (options.cli) {
|
|
26
28
|
args.push("--cli", options.cli);
|
|
@@ -102,15 +104,16 @@ export async function hubRegisterCommand(options) {
|
|
|
102
104
|
const spinner = ora("Registering skill...").start();
|
|
103
105
|
try {
|
|
104
106
|
const resp = await apiPost("/api/v1/hub/skills", {
|
|
105
|
-
|
|
107
|
+
skill_name: options.name,
|
|
106
108
|
category: options.category,
|
|
107
109
|
description: options.description,
|
|
108
|
-
|
|
110
|
+
price: price,
|
|
109
111
|
}, config.api_key);
|
|
110
112
|
if (!resp.ok) {
|
|
111
|
-
const
|
|
113
|
+
const raw = resp.data && typeof resp.data === "object" && "detail" in resp.data
|
|
112
114
|
? resp.data.detail
|
|
113
|
-
:
|
|
115
|
+
: resp.data;
|
|
116
|
+
const detail = typeof raw === "string" ? raw : JSON.stringify(raw);
|
|
114
117
|
spinner.fail(chalk.red(`Failed to register skill (${resp.status}): ${detail}`));
|
|
115
118
|
process.exit(1);
|
|
116
119
|
}
|
|
@@ -147,13 +150,12 @@ export async function hubSkillsCommand() {
|
|
|
147
150
|
console.log(chalk.bold(` ${"Name".padEnd(20)} ${"Category".padEnd(20)} ${"Price".padEnd(10)} ${"Calls".padEnd(8)} ${"Status".padEnd(10)}`));
|
|
148
151
|
console.log(chalk.dim(" " + "-".repeat(70)));
|
|
149
152
|
for (const skill of skills) {
|
|
150
|
-
const name = (skill.name ?? "-").slice(0, 19);
|
|
153
|
+
const name = (skill.skill_name ?? skill.name ?? "-").slice(0, 19);
|
|
151
154
|
const category = (skill.category ?? "-").slice(0, 19);
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const
|
|
156
|
-
const status = skill.status ?? "-";
|
|
155
|
+
const rawPrice = skill.price ?? skill.price_per_call;
|
|
156
|
+
const price = rawPrice !== undefined ? `$${Number(rawPrice).toFixed(2)}` : "-";
|
|
157
|
+
const calls = String(skill.total_calls ?? skill.call_count ?? "-");
|
|
158
|
+
const status = skill.is_active !== undefined ? (skill.is_active ? "active" : "inactive") : (skill.status ?? "-");
|
|
157
159
|
console.log(` ${chalk.cyan(name.padEnd(20))} ${category.padEnd(20)} ${chalk.green(price.padEnd(10))} ${calls.padEnd(8)} ${status.padEnd(10)}`);
|
|
158
160
|
}
|
|
159
161
|
}
|