@hasna/skills 0.1.59 → 0.1.60
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/bin/index.js +52 -9
- package/bin/mcp.js +1 -1
- package/bin/server.js +1 -1
- package/bin/worker.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -36860,7 +36860,7 @@ var package_default;
|
|
|
36860
36860
|
var init_package = __esm(() => {
|
|
36861
36861
|
package_default = {
|
|
36862
36862
|
name: "@hasna/skills",
|
|
36863
|
-
version: "0.1.
|
|
36863
|
+
version: "0.1.60",
|
|
36864
36864
|
description: "Skills library for AI coding agents",
|
|
36865
36865
|
type: "module",
|
|
36866
36866
|
bin: {
|
|
@@ -80638,8 +80638,22 @@ function prompt(question) {
|
|
|
80638
80638
|
});
|
|
80639
80639
|
});
|
|
80640
80640
|
}
|
|
80641
|
+
function redactUrl(url2) {
|
|
80642
|
+
try {
|
|
80643
|
+
const parsed = new URL(url2);
|
|
80644
|
+
if (!parsed.username && !parsed.password)
|
|
80645
|
+
return url2;
|
|
80646
|
+
parsed.username = "";
|
|
80647
|
+
parsed.password = "";
|
|
80648
|
+
return parsed.toString().replace(/\/+$/, "");
|
|
80649
|
+
} catch {
|
|
80650
|
+
return url2;
|
|
80651
|
+
}
|
|
80652
|
+
}
|
|
80641
80653
|
async function apiRequest(path, options) {
|
|
80642
80654
|
const url2 = getApiUrl();
|
|
80655
|
+
const safeUrl = redactUrl(url2);
|
|
80656
|
+
const endpoint = `${(options?.method || "GET").toUpperCase()} ${safeUrl}${path}`;
|
|
80643
80657
|
let res;
|
|
80644
80658
|
try {
|
|
80645
80659
|
res = await fetch(`${url2}${path}`, {
|
|
@@ -80647,7 +80661,10 @@ async function apiRequest(path, options) {
|
|
|
80647
80661
|
headers: { "Content-Type": "application/json", ...options?.headers }
|
|
80648
80662
|
});
|
|
80649
80663
|
} catch (err) {
|
|
80650
|
-
throw new HostedApiError(`Unable to reach
|
|
80664
|
+
throw new HostedApiError(`Unable to reach the Skills API: ${err.message}`, {
|
|
80665
|
+
endpoint,
|
|
80666
|
+
apiUrl: safeUrl
|
|
80667
|
+
});
|
|
80651
80668
|
}
|
|
80652
80669
|
const text = await res.text();
|
|
80653
80670
|
const body = text ? parseJsonBody(text) : {};
|
|
@@ -80659,7 +80676,9 @@ async function apiRequest(path, options) {
|
|
|
80659
80676
|
throw new HostedApiError(detail || error48 || `${res.status} ${res.statusText}`, {
|
|
80660
80677
|
status: res.status,
|
|
80661
80678
|
code,
|
|
80662
|
-
detail
|
|
80679
|
+
detail,
|
|
80680
|
+
endpoint,
|
|
80681
|
+
apiUrl: safeUrl
|
|
80663
80682
|
});
|
|
80664
80683
|
}
|
|
80665
80684
|
return body;
|
|
@@ -80668,9 +80687,16 @@ function parseJsonBody(text) {
|
|
|
80668
80687
|
try {
|
|
80669
80688
|
return JSON.parse(text);
|
|
80670
80689
|
} catch {
|
|
80671
|
-
return { detail: text };
|
|
80690
|
+
return { detail: condenseErrorBody(text) };
|
|
80672
80691
|
}
|
|
80673
80692
|
}
|
|
80693
|
+
function condenseErrorBody(text) {
|
|
80694
|
+
const stripped = /<[a-z!/]/i.test(text) ? text.replace(/<(script|style)[\s\S]*?<\/\1>/gi, " ").replace(/<[^>]*>/g, " ") : text;
|
|
80695
|
+
const collapsed = stripped.replace(/\s+/g, " ").trim();
|
|
80696
|
+
if (collapsed.length <= MAX_ERROR_DETAIL_LENGTH)
|
|
80697
|
+
return collapsed;
|
|
80698
|
+
return `${collapsed.slice(0, MAX_ERROR_DETAIL_LENGTH - 1).trimEnd()}\u2026`;
|
|
80699
|
+
}
|
|
80674
80700
|
function isRecord3(value) {
|
|
80675
80701
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
80676
80702
|
}
|
|
@@ -80680,17 +80706,29 @@ function commandErrorPayload(err, fallback) {
|
|
|
80680
80706
|
error: err.message || fallback,
|
|
80681
80707
|
...err.status !== undefined ? { status: err.status } : {},
|
|
80682
80708
|
...err.code ? { code: err.code } : {},
|
|
80683
|
-
...err.detail && err.detail !== err.message ? { detail: err.detail } : {}
|
|
80709
|
+
...err.detail && err.detail !== err.message ? { detail: err.detail } : {},
|
|
80710
|
+
...err.endpoint ? { endpoint: err.endpoint } : {},
|
|
80711
|
+
...err.apiUrl ? { apiUrl: err.apiUrl } : {}
|
|
80684
80712
|
};
|
|
80685
80713
|
}
|
|
80686
80714
|
return { error: err?.message || fallback };
|
|
80687
80715
|
}
|
|
80688
80716
|
function writeCommandError(err, fallback, json2) {
|
|
80689
80717
|
const payload = commandErrorPayload(err, fallback);
|
|
80690
|
-
if (json2)
|
|
80718
|
+
if (json2) {
|
|
80691
80719
|
console.log(JSON.stringify(payload, null, 2));
|
|
80692
|
-
|
|
80693
|
-
|
|
80720
|
+
process.exitCode = 1;
|
|
80721
|
+
return;
|
|
80722
|
+
}
|
|
80723
|
+
const message = String(payload.detail || payload.error || fallback);
|
|
80724
|
+
const status = typeof payload.status === "number" ? payload.status : undefined;
|
|
80725
|
+
const showStatus = status !== undefined && !message.startsWith(String(status));
|
|
80726
|
+
console.error(source_default.red(showStatus ? `${message} (HTTP ${status})` : message));
|
|
80727
|
+
if (payload.endpoint)
|
|
80728
|
+
console.error(source_default.dim(`Endpoint: ${payload.endpoint}`));
|
|
80729
|
+
if (status !== undefined && CONFIG_HINT_STATUSES.has(status)) {
|
|
80730
|
+
console.error(source_default.dim(`Hint: check SKILLS_API_URL (currently ${payload.apiUrl}) or run: skills setup`));
|
|
80731
|
+
}
|
|
80694
80732
|
process.exitCode = 1;
|
|
80695
80733
|
}
|
|
80696
80734
|
function envApiKey() {
|
|
@@ -81225,22 +81263,27 @@ function registerCredits(parent) {
|
|
|
81225
81263
|
credits.command("buy").description("Create a credit pack checkout session").argument("<amount>", "Credit pack amount: 1, 5, 20, 50, or 100").option("--json", "Output as JSON", false).action(handleBuyCredits);
|
|
81226
81264
|
credits.command("packs").description("List available credit packs").option("--json", "Output as JSON", false).action(handleListCreditPacks);
|
|
81227
81265
|
}
|
|
81228
|
-
var isTTY, DEFAULT_DEVICE_POLL_TIMEOUT_MS, HostedApiError;
|
|
81266
|
+
var isTTY, DEFAULT_DEVICE_POLL_TIMEOUT_MS, MAX_ERROR_DETAIL_LENGTH = 200, CONFIG_HINT_STATUSES, HostedApiError;
|
|
81229
81267
|
var init_auth = __esm(() => {
|
|
81230
81268
|
init_source();
|
|
81231
81269
|
init_auth_store();
|
|
81232
81270
|
isTTY = process.stdin.isTTY && process.stdout.isTTY;
|
|
81233
81271
|
DEFAULT_DEVICE_POLL_TIMEOUT_MS = 10 * 60 * 1000;
|
|
81272
|
+
CONFIG_HINT_STATUSES = new Set([401, 403, 404, 405, 501]);
|
|
81234
81273
|
HostedApiError = class HostedApiError extends Error {
|
|
81235
81274
|
status;
|
|
81236
81275
|
code;
|
|
81237
81276
|
detail;
|
|
81277
|
+
endpoint;
|
|
81278
|
+
apiUrl;
|
|
81238
81279
|
constructor(message, options = {}) {
|
|
81239
81280
|
super(message);
|
|
81240
81281
|
this.name = "HostedApiError";
|
|
81241
81282
|
this.status = options.status;
|
|
81242
81283
|
this.code = options.code;
|
|
81243
81284
|
this.detail = options.detail;
|
|
81285
|
+
this.endpoint = options.endpoint;
|
|
81286
|
+
this.apiUrl = options.apiUrl;
|
|
81244
81287
|
}
|
|
81245
81288
|
};
|
|
81246
81289
|
});
|
package/bin/mcp.js
CHANGED
|
@@ -21824,7 +21824,7 @@ class StdioServerTransport {
|
|
|
21824
21824
|
// package.json
|
|
21825
21825
|
var package_default = {
|
|
21826
21826
|
name: "@hasna/skills",
|
|
21827
|
-
version: "0.1.
|
|
21827
|
+
version: "0.1.60",
|
|
21828
21828
|
description: "Skills library for AI coding agents",
|
|
21829
21829
|
type: "module",
|
|
21830
21830
|
bin: {
|
package/bin/server.js
CHANGED
|
@@ -9724,7 +9724,7 @@ var require_es5 = __commonJS((exports, module) => {
|
|
|
9724
9724
|
|
|
9725
9725
|
// node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js
|
|
9726
9726
|
var require_client2 = __commonJS((exports) => {
|
|
9727
|
-
var __dirname = "/home/hasna/.hasna/repos/worktrees/skills-
|
|
9727
|
+
var __dirname = "/home/hasna/.hasna/repos/worktrees/skills-issue24/node_modules/@aws-sdk/core/dist-cjs/submodules/client";
|
|
9728
9728
|
var { Retry, RETRY_MODES } = require_retry();
|
|
9729
9729
|
var { HttpRequest, parseUrl } = require_protocols();
|
|
9730
9730
|
var { InvokeStore } = require_invoke_store();
|
package/bin/worker.js
CHANGED
|
@@ -9724,7 +9724,7 @@ var require_es5 = __commonJS((exports, module) => {
|
|
|
9724
9724
|
|
|
9725
9725
|
// node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js
|
|
9726
9726
|
var require_client2 = __commonJS((exports) => {
|
|
9727
|
-
var __dirname = "/home/hasna/.hasna/repos/worktrees/skills-
|
|
9727
|
+
var __dirname = "/home/hasna/.hasna/repos/worktrees/skills-issue24/node_modules/@aws-sdk/core/dist-cjs/submodules/client";
|
|
9728
9728
|
var { Retry, RETRY_MODES } = require_retry();
|
|
9729
9729
|
var { HttpRequest, parseUrl } = require_protocols();
|
|
9730
9730
|
var { InvokeStore } = require_invoke_store();
|
package/dist/index.js
CHANGED
|
@@ -19592,7 +19592,7 @@ import { dirname as dirname4, relative as relative3 } from "path";
|
|
|
19592
19592
|
// package.json
|
|
19593
19593
|
var package_default = {
|
|
19594
19594
|
name: "@hasna/skills",
|
|
19595
|
-
version: "0.1.
|
|
19595
|
+
version: "0.1.60",
|
|
19596
19596
|
description: "Skills library for AI coding agents",
|
|
19597
19597
|
type: "module",
|
|
19598
19598
|
bin: {
|