toolcraft-openapi 0.0.1 → 0.0.3

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/README.md CHANGED
@@ -7,7 +7,7 @@ Scaffold for OpenAPI-driven toolcraft clients.
7
7
  ## Usage
8
8
 
9
9
  ```ts
10
- import { bearerTokenAuth, requestJson } from "agent-kit-openapi";
10
+ import { bearerTokenAuth, requestJson } from "toolcraft-openapi";
11
11
 
12
12
  const auth = bearerTokenAuth({
13
13
  serviceName: "internal-agent",
@@ -18,7 +18,7 @@ const auth = bearerTokenAuth({
18
18
 
19
19
  ## Generator CLI
20
20
 
21
- `agent-kit-openapi-generate` reads an OpenAPI document from disk or a URL, writes generated
21
+ `toolcraft-openapi-generate` reads an OpenAPI document from disk or a URL, writes generated
22
22
  command files, and stores the current spec hash in `openapi.lock`.
23
23
 
24
24
  - `--input <path-or-url>` — OpenAPI document to read. Defaults to `openapi.json`.
@@ -29,7 +29,7 @@ command files, and stores the current spec hash in `openapi.lock`.
29
29
  ### CI drift check
30
30
 
31
31
  ```sh
32
- agent-kit-openapi-generate --check
32
+ toolcraft-openapi-generate --check
33
33
  ```
34
34
 
35
35
  ## Exports
@@ -1,6 +1,6 @@
1
- import type { Command } from "agent-kit";
2
- import { defineCommand } from "agent-kit";
3
- import type { ObjectSchema } from "agent-kit-schema";
1
+ import type { Command } from "toolcraft";
2
+ import { defineCommand } from "toolcraft";
3
+ import type { ObjectSchema } from "toolcraft-schema";
4
4
  import type { OpenApiClientServices } from "./define-client.js";
5
5
  type ApiScope = readonly ["cli", "mcp", "sdk"];
6
6
  export declare function defineApiCommand<TParamsSchema extends ObjectSchema<any>>(config: Parameters<typeof defineCommand<OpenApiClientServices, string, TParamsSchema, undefined, unknown, ApiScope>>[0]): Command<OpenApiClientServices, TParamsSchema, undefined, unknown>;
@@ -1,4 +1,4 @@
1
- import { defineCommand } from "agent-kit";
1
+ import { defineCommand } from "toolcraft";
2
2
  export function defineApiCommand(config) {
3
3
  return defineCommand(config);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { defineCommand, defineGroup, S, UserError } from "agent-kit";
1
+ import { defineCommand, defineGroup, S, UserError } from "toolcraft";
2
2
  import { isCancel, password } from "@poe-code/design-system";
3
3
  import { createSecretStore } from "auth-store";
4
4
  import { requestJson } from "../http.js";
@@ -9,13 +9,13 @@ const loginParams = S.Object({
9
9
  });
10
10
  const emptyParams = S.Object({});
11
11
  const KEYCHAIN_ACCOUNT = "token";
12
- const DEFAULT_STORE_DIRECTORY = ".agent-kit-openapi";
12
+ const DEFAULT_STORE_DIRECTORY = ".toolcraft-openapi";
13
13
  const DEFAULT_STORE_VERSION = "v1";
14
14
  export function bearerTokenAuth(options) {
15
15
  const commandPrefix = options.commandPrefix ?? DEFAULT_COMMAND_PREFIX;
16
16
  const { store, backend } = createSecretStore({
17
17
  fileStore: {
18
- salt: `${options.serviceName}:agent-kit-openapi:${DEFAULT_STORE_VERSION}`,
18
+ salt: `${options.serviceName}:toolcraft-openapi:${DEFAULT_STORE_VERSION}`,
19
19
  defaultDirectory: DEFAULT_STORE_DIRECTORY,
20
20
  defaultFileName: `${options.serviceName}.enc`,
21
21
  },
@@ -1,4 +1,4 @@
1
- import type { CommandNode } from "agent-kit";
1
+ import type { CommandNode } from "toolcraft";
2
2
  export interface TokenSource {
3
3
  getToken(): Promise<string>;
4
4
  invalidate?(): Promise<void>;
@@ -4,7 +4,7 @@ import fs from "node:fs/promises";
4
4
  import { realpathSync } from "node:fs";
5
5
  import path from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
- import { UserError } from "agent-kit";
7
+ import { UserError } from "toolcraft";
8
8
  import { generate } from "../generate.js";
9
9
  import { readOpenApiLock, writeOpenApiLock } from "../lock.js";
10
10
  import { parseOpenApiDocument, readOpenApiSourceText } from "../spec-source.js";
@@ -14,7 +14,7 @@ const DEFAULT_OPTIONS = {
14
14
  lockPath: "openapi.lock",
15
15
  outputDir: "src/generated"
16
16
  };
17
- const HELP_TEXT = `Usage: agent-kit-openapi-generate [options]
17
+ const HELP_TEXT = `Usage: toolcraft-openapi-generate [options]
18
18
 
19
19
  Options:
20
20
  --input <path-or-url> OpenAPI document to read (default: openapi.json)
@@ -1,4 +1,4 @@
1
- import type { CommandNode, Group } from "agent-kit";
1
+ import type { CommandNode, Group } from "toolcraft";
2
2
  import type { AuthProvider, TokenSource } from "./auth/types.js";
3
3
  export interface OpenApiClientServices {
4
4
  baseUrl: string;
@@ -1,4 +1,4 @@
1
- import { defineCommand, defineGroup, UserError } from "agent-kit";
1
+ import { defineCommand, defineGroup, UserError } from "toolcraft";
2
2
  import { toMcpPrefix } from "./naming.js";
3
3
  const CLI_SCOPE = ["cli"];
4
4
  export function defineClient(options) {
package/dist/generate.js CHANGED
@@ -1,4 +1,4 @@
1
- import { UserError } from "agent-kit";
1
+ import { UserError } from "toolcraft";
2
2
  import { METHOD_DEFAULTS, deriveNoun, deriveVerb, isIdentifierName, normalizeParamName, toCamelCase, toPascalCase } from "./naming.js";
3
3
  import { groupByNoun } from "./group-by-noun.js";
4
4
  import { renderPreflightBlock, renderRequestShape } from "./interpreter.js";
@@ -845,8 +845,8 @@ function createCommandFile(options) {
845
845
  `operation-id: ${options.operationId}`
846
846
  ]);
847
847
  lines.push(requiresUserError
848
- ? 'import { S, UserError } from "agent-kit";'
849
- : 'import { S } from "agent-kit";', 'import { requestJson, defineApiCommand } from "agent-kit-openapi";', "", `export const ${options.exportName} = defineApiCommand({`, ` name: ${JSON.stringify(options.verb)},`);
848
+ ? 'import { S, UserError } from "toolcraft";'
849
+ : 'import { S } from "toolcraft";', 'import { requestJson, defineApiCommand } from "toolcraft-openapi";', "", `export const ${options.exportName} = defineApiCommand({`, ` name: ${JSON.stringify(options.verb)},`);
850
850
  if (options.description !== undefined) {
851
851
  lines.push(` description: ${JSON.stringify(options.description)},`);
852
852
  }
@@ -1087,7 +1087,7 @@ function createIndexFile(commands) {
1087
1087
  };
1088
1088
  }
1089
1089
  const lines = createGeneratedTypeScriptFileLines();
1090
- lines.push('import { defineGroup } from "agent-kit";');
1090
+ lines.push('import { defineGroup } from "toolcraft";');
1091
1091
  for (const { commands: nounCommands } of groups) {
1092
1092
  for (const command of nounCommands) {
1093
1093
  lines.push(`import { ${command.exportName} } from ${JSON.stringify(`./${command.filePath.replace(/\.ts$/, ".js")}`)};`);
@@ -1114,7 +1114,7 @@ function createGeneratedTypeScriptFile(bodyLines, metadataLines = []) {
1114
1114
  function createGeneratedTypeScriptFileLines(metadataLines = []) {
1115
1115
  return [
1116
1116
  "/**",
1117
- " * Generated by agent-kit-openapi.",
1117
+ " * Generated by toolcraft-openapi.",
1118
1118
  ...metadataLines.map((line) => ` * ${line}`),
1119
1119
  " */"
1120
1120
  ];
package/dist/http.js CHANGED
@@ -1,4 +1,4 @@
1
- import { UserError } from "agent-kit";
1
+ import { UserError } from "toolcraft";
2
2
  export class HttpError extends Error {
3
3
  status;
4
4
  body;
@@ -1,4 +1,4 @@
1
- import { UserError } from "agent-kit";
1
+ import { UserError } from "toolcraft";
2
2
  import { isIdentifierName, toCliFlag } from "./naming.js";
3
3
  import { REQUEST_PARAM_SECTIONS } from "./request-shape.js";
4
4
  const QUERY_ARRAY_SERIALIZATION_SEPARATORS = {
package/dist/naming.js CHANGED
@@ -1,4 +1,4 @@
1
- import { UserError } from "agent-kit";
1
+ import { UserError } from "toolcraft";
2
2
  export const METHOD_DEFAULTS = {
3
3
  delete: {
4
4
  collection: "delete",
@@ -49,7 +49,7 @@ export function deriveVerb(method, path, operation, operationId, noun) {
49
49
  if (derived !== undefined) {
50
50
  return derived;
51
51
  }
52
- throw new UserError(`Operation ${JSON.stringify(operationId)} is missing an operationId, so agent-kit-openapi cannot derive a stable command verb.`);
52
+ throw new UserError(`Operation ${JSON.stringify(operationId)} is missing an operationId, so toolcraft-openapi cannot derive a stable command verb.`);
53
53
  }
54
54
  export function normalizeParamName(name) {
55
55
  return toCamelCase(name);
package/dist/runtime.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type CommandNode } from "agent-kit";
1
+ import { type CommandNode } from "toolcraft";
2
2
  import { type DefineClientOptions, type DefinedClient, type OpenApiClientServices } from "./define-client.js";
3
3
  import { type OpenApiDocument } from "./generate.js";
4
4
  import { type OpenApiSourceFileSystem } from "./spec-source.js";
package/dist/runtime.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import fs from "node:fs/promises";
2
- import { defineCommand, defineGroup, S } from "agent-kit";
2
+ import { defineCommand, defineGroup, S } from "toolcraft";
3
3
  import { defineClient } from "./define-client.js";
4
4
  import { collectSchemaOptionEntries, collectGeneratedCommands } from "./generate.js";
5
5
  import { groupByNoun } from "./group-by-noun.js";
@@ -1,7 +1,7 @@
1
1
  import path from "node:path";
2
2
  import { fileURLToPath } from "node:url";
3
3
  import { parse as parseYaml } from "yaml";
4
- import { UserError } from "agent-kit";
4
+ import { UserError } from "toolcraft";
5
5
  export async function readOpenApiSourceText(input, services) {
6
6
  const inputUrl = input instanceof URL ? input : tryParseUrl(input);
7
7
  const sourceLabel = formatSourceLabel(input);
@@ -1,2 +1,2 @@
1
- export { isCancel } from "@clack/core";
1
+ export { isCancel } from "@clack/prompts";
2
2
  export declare function cancel(msg?: string): void;
@@ -1,5 +1,5 @@
1
1
  import chalk from "chalk";
2
- export { isCancel } from "@clack/core";
2
+ export { isCancel } from "@clack/prompts";
3
3
  import { resolveOutputFormat } from "../../internal/output-format.js";
4
4
  export function cancel(msg = "") {
5
5
  if (resolveOutputFormat() !== "terminal") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft-openapi",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,8 +12,8 @@
12
12
  },
13
13
  "scripts": {
14
14
  "build": "rm -rf dist && tsc",
15
- "test": "cd ../.. && vitest run packages/agent-kit-openapi/src/*.test.ts",
16
- "test:unit": "cd ../.. && vitest run packages/agent-kit-openapi/src/*.test.ts",
15
+ "test": "cd ../.. && vitest run packages/toolcraft-openapi/src/*.test.ts",
16
+ "test:unit": "cd ../.. && vitest run packages/toolcraft-openapi/src/*.test.ts",
17
17
  "prepack": "node ../../scripts/manage-bundled-workspace-deps.mjs prepare . @poe-code/design-system auth-store",
18
18
  "postpack": "node ../../scripts/manage-bundled-workspace-deps.mjs cleanup . @poe-code/design-system auth-store"
19
19
  },
@@ -21,16 +21,16 @@
21
21
  "dist"
22
22
  ],
23
23
  "bin": {
24
- "agent-kit-openapi-generate": "dist/bin/generate.js"
24
+ "toolcraft-openapi-generate": "dist/bin/generate.js"
25
25
  },
26
26
  "dependencies": {
27
27
  "@clack/core": "^1.0.0",
28
28
  "@clack/prompts": "^1.0.0",
29
29
  "@poe-code/design-system": "^0.0.1",
30
- "toolcraft": "^0.0.1",
31
30
  "auth-store": "^0.0.1",
32
31
  "chalk": "^5.6.2",
33
32
  "console-table-printer": "^2.15.0",
33
+ "toolcraft": "^0.0.3",
34
34
  "yaml": "^2.8.2"
35
35
  },
36
36
  "engines": {
@@ -39,7 +39,7 @@
39
39
  "repository": {
40
40
  "type": "git",
41
41
  "url": "git+https://github.com/poe-platform/poe-code.git",
42
- "directory": "packages/agent-kit-openapi"
42
+ "directory": "packages/toolcraft-openapi"
43
43
  },
44
44
  "bundleDependencies": [
45
45
  "@poe-code/design-system",