@hasna/skills 0.1.66 → 0.1.67

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 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.66",
36863
+ version: "0.1.67",
36864
36864
  description: "Skills library for AI coding agents",
36865
36865
  type: "module",
36866
36866
  bin: {
@@ -36901,6 +36901,7 @@ var init_package = __esm(() => {
36901
36901
  scripts: {
36902
36902
  clean: "rm -rf bin/ dist/",
36903
36903
  build: "bun run clean && bun build ./src/cli/index.tsx --outdir ./bin --target bun && bun build ./src/mcp/index.ts --outfile ./bin/mcp.js --target bun && bun build ./src/server/index.ts --outfile ./bin/server.js --target bun && bun build ./src/server/worker.ts --outfile ./bin/worker.js --target bun && bun build ./src/server/migrate.ts --outfile ./bin/migrate.js --target bun && bun build ./src/index.ts ./src/storage.ts ./src/sdk/index.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
36904
+ "build:js": "rm -rf dist && bun build ./src/index.ts ./src/storage.ts ./src/sdk/index.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
36904
36905
  test: "bun test --timeout 30000",
36905
36906
  dev: "bun run ./src/cli/index.tsx",
36906
36907
  "dev:watch": "bun --watch run ./src/cli/index.tsx",
@@ -36910,6 +36911,7 @@ var init_package = __esm(() => {
36910
36911
  migrate: "bun run ./src/server/migrate.ts",
36911
36912
  typecheck: "tsc --noEmit",
36912
36913
  "verify:release": "bun run scripts/release-guard.ts",
36914
+ prepare: "bun run build:js",
36913
36915
  prepack: "bun run build && bun run verify:release",
36914
36916
  prepublishOnly: "bun run typecheck && bun run test",
36915
36917
  postinstall: "mkdir -p $HOME/.hasna/skills/custom 2>/dev/null || true"
@@ -56486,6 +56488,42 @@ var init_types2 = __esm(() => {
56486
56488
  });
56487
56489
 
56488
56490
  // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
56491
+ class ReadBuffer {
56492
+ constructor(options) {
56493
+ this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
56494
+ }
56495
+ append(chunk2) {
56496
+ const newSize = (this._buffer?.length ?? 0) + chunk2.length;
56497
+ if (newSize > this._maxBufferSize) {
56498
+ this.clear();
56499
+ throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
56500
+ }
56501
+ this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk2]) : chunk2;
56502
+ }
56503
+ readMessage() {
56504
+ if (!this._buffer) {
56505
+ return null;
56506
+ }
56507
+ const index = this._buffer.indexOf(`
56508
+ `);
56509
+ if (index === -1) {
56510
+ return null;
56511
+ }
56512
+ const line = this._buffer.toString("utf8", 0, index).replace(/\r$/, "");
56513
+ this._buffer = this._buffer.subarray(index + 1);
56514
+ return deserializeMessage(line);
56515
+ }
56516
+ clear() {
56517
+ this._buffer = undefined;
56518
+ }
56519
+ }
56520
+ function deserializeMessage(line) {
56521
+ return JSONRPCMessageSchema.parse(JSON.parse(line));
56522
+ }
56523
+ function serializeMessage(message) {
56524
+ return JSON.stringify(message) + `
56525
+ `;
56526
+ }
56489
56527
  var STDIO_DEFAULT_MAX_BUFFER_SIZE;
56490
56528
  var init_stdio = __esm(() => {
56491
56529
  init_types2();
@@ -56493,6 +56531,69 @@ var init_stdio = __esm(() => {
56493
56531
  });
56494
56532
 
56495
56533
  // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
56534
+ import process14 from "process";
56535
+
56536
+ class StdioServerTransport {
56537
+ constructor(_stdin = process14.stdin, _stdout = process14.stdout, options) {
56538
+ this._stdin = _stdin;
56539
+ this._stdout = _stdout;
56540
+ this._started = false;
56541
+ this._ondata = (chunk2) => {
56542
+ try {
56543
+ this._readBuffer.append(chunk2);
56544
+ this.processReadBuffer();
56545
+ } catch (error2) {
56546
+ this.onerror?.(error2);
56547
+ this.close().catch(() => {});
56548
+ }
56549
+ };
56550
+ this._onerror = (error2) => {
56551
+ this.onerror?.(error2);
56552
+ };
56553
+ this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize });
56554
+ }
56555
+ async start() {
56556
+ if (this._started) {
56557
+ throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");
56558
+ }
56559
+ this._started = true;
56560
+ this._stdin.on("data", this._ondata);
56561
+ this._stdin.on("error", this._onerror);
56562
+ }
56563
+ processReadBuffer() {
56564
+ while (true) {
56565
+ try {
56566
+ const message = this._readBuffer.readMessage();
56567
+ if (message === null) {
56568
+ break;
56569
+ }
56570
+ this.onmessage?.(message);
56571
+ } catch (error2) {
56572
+ this.onerror?.(error2);
56573
+ }
56574
+ }
56575
+ }
56576
+ async close() {
56577
+ this._stdin.off("data", this._ondata);
56578
+ this._stdin.off("error", this._onerror);
56579
+ const remainingDataListeners = this._stdin.listenerCount("data");
56580
+ if (remainingDataListeners === 0) {
56581
+ this._stdin.pause();
56582
+ }
56583
+ this._readBuffer.clear();
56584
+ this.onclose?.();
56585
+ }
56586
+ send(message) {
56587
+ return new Promise((resolve) => {
56588
+ const json = serializeMessage(message);
56589
+ if (this._stdout.write(json)) {
56590
+ resolve();
56591
+ } else {
56592
+ this._stdout.once("drain", resolve);
56593
+ }
56594
+ });
56595
+ }
56596
+ }
56496
56597
  var init_stdio2 = __esm(() => {
56497
56598
  init_stdio();
56498
56599
  });
@@ -70164,6 +70265,7 @@ var init_http = __esm(() => {
70164
70265
  // src/mcp/index.ts
70165
70266
  var exports_mcp = {};
70166
70267
  __export(exports_mcp, {
70268
+ startMcpStdio: () => startMcpStdio,
70167
70269
  buildServer: () => buildServer
70168
70270
  });
70169
70271
  function printHelp() {
@@ -70177,6 +70279,10 @@ Options:
70177
70279
  --http run Streamable HTTP transport on 127.0.0.1 (default port 8836)
70178
70280
  --port <n> HTTP port (--http or MCP_HTTP=1)`);
70179
70281
  }
70282
+ async function startMcpStdio() {
70283
+ const server2 = buildServer();
70284
+ await server2.connect(new StdioServerTransport);
70285
+ }
70180
70286
  var args;
70181
70287
  var init_mcp2 = __esm(() => {
70182
70288
  init_stdio2();
@@ -70232,7 +70338,8 @@ async function handleMcp(options) {
70232
70338
  process.exitCode = 1;
70233
70339
  return;
70234
70340
  }
70235
- await Promise.resolve().then(() => (init_mcp2(), exports_mcp));
70341
+ const { startMcpStdio: startMcpStdio2 } = await Promise.resolve().then(() => (init_mcp2(), exports_mcp));
70342
+ await startMcpStdio2();
70236
70343
  }
70237
70344
  async function registerMcpForAgent(agent, command) {
70238
70345
  switch (agent) {
@@ -70435,7 +70542,14 @@ function registerRuntime(parent) {
70435
70542
  const exportsCommand = parent.command("exports").description("Inspect or open skill run exports");
70436
70543
  exportsCommand.command("open").argument("<run-id>", "Run id").option("--json", "Output as JSON", false).description("Open the export directory for a run").action((runId, options) => handleExportsOpen(runId, options));
70437
70544
  exportsCommand.command("download").argument("<run-id>", "Remote run id").option("--json", "Output as JSON", false).description("Download remote run artifacts into .skills/exports").action((runId, options) => handleExportsDownload(runId, options));
70438
- parent.command("mcp").option("--register <agent>", "Register MCP server with agent").option("--json", "Output registration result as JSON", false).description("Start MCP server (stdio) or register with an agent").action(async (options) => handleMcp(options));
70545
+ parent.command("mcp").option("--register <agent>", "Register MCP server with agent").option("--json", "Output registration result as JSON", false).allowExcessArguments(true).description("Start MCP server (stdio) or register with an agent").action(async (options, command) => {
70546
+ const stray = command.args[0];
70547
+ if (stray !== undefined) {
70548
+ console.error(source_default.red(`error: unknown argument '${stray}'. 'skills mcp' takes no positional arguments. ` + `Valid forms: 'skills mcp' (start the MCP stdio server), ` + `'skills mcp --register <agent>', 'skills mcp --register all'`));
70549
+ process.exit(1);
70550
+ }
70551
+ await handleMcp(options);
70552
+ });
70439
70553
  const setup = parent.command("setup").description("Point this CLI at a Skills API server, or register agent integrations").option("--api-url <url>", "Skills API origin to send remote work to").option("--global", "Save the API origin globally instead of in this project", false).option("--json", "Output setup result as JSON", false).action(async (options) => handleSetup(options));
70440
70554
  setup.command("agents").option("--json", "Output registration result as JSON", false).description("Register the Skills MCP server with all supported agents").action(async (options) => handleMcp({ register: "all", json: options.json }));
70441
70555
  parent.command("self-update").description("Update @hasna/skills to the latest version").option("--json", "Output result as JSON", false).action(async (options) => {
package/bin/mcp.js CHANGED
@@ -12943,7 +12943,7 @@ class StdioServerTransport {
12943
12943
  // package.json
12944
12944
  var package_default = {
12945
12945
  name: "@hasna/skills",
12946
- version: "0.1.66",
12946
+ version: "0.1.67",
12947
12947
  description: "Skills library for AI coding agents",
12948
12948
  type: "module",
12949
12949
  bin: {
@@ -12984,6 +12984,7 @@ var package_default = {
12984
12984
  scripts: {
12985
12985
  clean: "rm -rf bin/ dist/",
12986
12986
  build: "bun run clean && bun build ./src/cli/index.tsx --outdir ./bin --target bun && bun build ./src/mcp/index.ts --outfile ./bin/mcp.js --target bun && bun build ./src/server/index.ts --outfile ./bin/server.js --target bun && bun build ./src/server/worker.ts --outfile ./bin/worker.js --target bun && bun build ./src/server/migrate.ts --outfile ./bin/migrate.js --target bun && bun build ./src/index.ts ./src/storage.ts ./src/sdk/index.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
12987
+ "build:js": "rm -rf dist && bun build ./src/index.ts ./src/storage.ts ./src/sdk/index.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
12987
12988
  test: "bun test --timeout 30000",
12988
12989
  dev: "bun run ./src/cli/index.tsx",
12989
12990
  "dev:watch": "bun --watch run ./src/cli/index.tsx",
@@ -12993,6 +12994,7 @@ var package_default = {
12993
12994
  migrate: "bun run ./src/server/migrate.ts",
12994
12995
  typecheck: "tsc --noEmit",
12995
12996
  "verify:release": "bun run scripts/release-guard.ts",
12997
+ prepare: "bun run build:js",
12996
12998
  prepack: "bun run build && bun run verify:release",
12997
12999
  prepublishOnly: "bun run typecheck && bun run test",
12998
13000
  postinstall: "mkdir -p $HOME/.hasna/skills/custom 2>/dev/null || true"
@@ -28409,10 +28411,13 @@ if (args.includes("--version") || args.includes("-V")) {
28409
28411
  console.log(package_default.version);
28410
28412
  process.exit(0);
28411
28413
  }
28414
+ async function startMcpStdio() {
28415
+ const server2 = buildServer();
28416
+ await server2.connect(new StdioServerTransport);
28417
+ }
28412
28418
  async function main() {
28413
28419
  if (isMcpStdioMode(args)) {
28414
- const server2 = buildServer();
28415
- await server2.connect(new StdioServerTransport);
28420
+ await startMcpStdio();
28416
28421
  return;
28417
28422
  }
28418
28423
  const port = parseMcpHttpPort(args);
@@ -28425,5 +28430,6 @@ if (import.meta.main) {
28425
28430
  });
28426
28431
  }
28427
28432
  export {
28433
+ startMcpStdio,
28428
28434
  buildServer
28429
28435
  };
package/bin/server.js CHANGED
@@ -22939,7 +22939,7 @@ var init_dist_es9 = __esm(() => {
22939
22939
  // package.json
22940
22940
  var package_default = {
22941
22941
  name: "@hasna/skills",
22942
- version: "0.1.66",
22942
+ version: "0.1.67",
22943
22943
  description: "Skills library for AI coding agents",
22944
22944
  type: "module",
22945
22945
  bin: {
@@ -22980,6 +22980,7 @@ var package_default = {
22980
22980
  scripts: {
22981
22981
  clean: "rm -rf bin/ dist/",
22982
22982
  build: "bun run clean && bun build ./src/cli/index.tsx --outdir ./bin --target bun && bun build ./src/mcp/index.ts --outfile ./bin/mcp.js --target bun && bun build ./src/server/index.ts --outfile ./bin/server.js --target bun && bun build ./src/server/worker.ts --outfile ./bin/worker.js --target bun && bun build ./src/server/migrate.ts --outfile ./bin/migrate.js --target bun && bun build ./src/index.ts ./src/storage.ts ./src/sdk/index.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
22983
+ "build:js": "rm -rf dist && bun build ./src/index.ts ./src/storage.ts ./src/sdk/index.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
22983
22984
  test: "bun test --timeout 30000",
22984
22985
  dev: "bun run ./src/cli/index.tsx",
22985
22986
  "dev:watch": "bun --watch run ./src/cli/index.tsx",
@@ -22989,6 +22990,7 @@ var package_default = {
22989
22990
  migrate: "bun run ./src/server/migrate.ts",
22990
22991
  typecheck: "tsc --noEmit",
22991
22992
  "verify:release": "bun run scripts/release-guard.ts",
22993
+ prepare: "bun run build:js",
22992
22994
  prepack: "bun run build && bun run verify:release",
22993
22995
  prepublishOnly: "bun run typecheck && bun run test",
22994
22996
  postinstall: "mkdir -p $HOME/.hasna/skills/custom 2>/dev/null || true"
package/dist/index.js CHANGED
@@ -10342,7 +10342,7 @@ import { dirname as dirname8, relative as relative3 } from "path";
10342
10342
  // package.json
10343
10343
  var package_default = {
10344
10344
  name: "@hasna/skills",
10345
- version: "0.1.66",
10345
+ version: "0.1.67",
10346
10346
  description: "Skills library for AI coding agents",
10347
10347
  type: "module",
10348
10348
  bin: {
@@ -10383,6 +10383,7 @@ var package_default = {
10383
10383
  scripts: {
10384
10384
  clean: "rm -rf bin/ dist/",
10385
10385
  build: "bun run clean && bun build ./src/cli/index.tsx --outdir ./bin --target bun && bun build ./src/mcp/index.ts --outfile ./bin/mcp.js --target bun && bun build ./src/server/index.ts --outfile ./bin/server.js --target bun && bun build ./src/server/worker.ts --outfile ./bin/worker.js --target bun && bun build ./src/server/migrate.ts --outfile ./bin/migrate.js --target bun && bun build ./src/index.ts ./src/storage.ts ./src/sdk/index.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
10386
+ "build:js": "rm -rf dist && bun build ./src/index.ts ./src/storage.ts ./src/sdk/index.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
10386
10387
  test: "bun test --timeout 30000",
10387
10388
  dev: "bun run ./src/cli/index.tsx",
10388
10389
  "dev:watch": "bun --watch run ./src/cli/index.tsx",
@@ -10392,6 +10393,7 @@ var package_default = {
10392
10393
  migrate: "bun run ./src/server/migrate.ts",
10393
10394
  typecheck: "tsc --noEmit",
10394
10395
  "verify:release": "bun run scripts/release-guard.ts",
10396
+ prepare: "bun run build:js",
10395
10397
  prepack: "bun run build && bun run verify:release",
10396
10398
  prepublishOnly: "bun run typecheck && bun run test",
10397
10399
  postinstall: "mkdir -p $HOME/.hasna/skills/custom 2>/dev/null || true"
@@ -8,4 +8,14 @@
8
8
  * skills-mcp # Direct binary
9
9
  * skills-mcp --http # Streamable HTTP on 127.0.0.1:8836
10
10
  */
11
+ /**
12
+ * Start the Skills MCP server on stdio (newline-delimited JSON-RPC).
13
+ *
14
+ * Exported so the `skills mcp` CLI subcommand can start the server directly:
15
+ * a bare dynamic import of this module is inert, because `import.meta.main`
16
+ * is false when the module is not the process entry point — which made
17
+ * `skills mcp` exit rc=0 with zero bytes instead of starting the documented
18
+ * stdio server (BUG e3997558).
19
+ */
20
+ export declare function startMcpStdio(): Promise<void>;
11
21
  export { buildServer } from "./server.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/skills",
3
- "version": "0.1.66",
3
+ "version": "0.1.67",
4
4
  "description": "Skills library for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -41,6 +41,7 @@
41
41
  "scripts": {
42
42
  "clean": "rm -rf bin/ dist/",
43
43
  "build": "bun run clean && bun build ./src/cli/index.tsx --outdir ./bin --target bun && bun build ./src/mcp/index.ts --outfile ./bin/mcp.js --target bun && bun build ./src/server/index.ts --outfile ./bin/server.js --target bun && bun build ./src/server/worker.ts --outfile ./bin/worker.js --target bun && bun build ./src/server/migrate.ts --outfile ./bin/migrate.js --target bun && bun build ./src/index.ts ./src/storage.ts ./src/sdk/index.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
44
+ "build:js": "rm -rf dist && bun build ./src/index.ts ./src/storage.ts ./src/sdk/index.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
44
45
  "test": "bun test --timeout 30000",
45
46
  "dev": "bun run ./src/cli/index.tsx",
46
47
  "dev:watch": "bun --watch run ./src/cli/index.tsx",
@@ -50,6 +51,7 @@
50
51
  "migrate": "bun run ./src/server/migrate.ts",
51
52
  "typecheck": "tsc --noEmit",
52
53
  "verify:release": "bun run scripts/release-guard.ts",
54
+ "prepare": "bun run build:js",
53
55
  "prepack": "bun run build && bun run verify:release",
54
56
  "prepublishOnly": "bun run typecheck && bun run test",
55
57
  "postinstall": "mkdir -p $HOME/.hasna/skills/custom 2>/dev/null || true"