thinkwell 0.4.5 → 0.5.0-alpha.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.
Files changed (77) hide show
  1. package/README.md +3 -5
  2. package/bin/thinkwell +130 -174
  3. package/dist/agent.d.ts +82 -56
  4. package/dist/agent.d.ts.map +1 -1
  5. package/dist/agent.js +178 -174
  6. package/dist/agent.js.map +1 -1
  7. package/dist/cli/build.d.ts +15 -43
  8. package/dist/cli/build.d.ts.map +1 -1
  9. package/dist/cli/build.js +199 -1231
  10. package/dist/cli/build.js.map +1 -1
  11. package/dist/cli/bundle.d.ts +61 -0
  12. package/dist/cli/bundle.d.ts.map +1 -0
  13. package/dist/cli/bundle.js +1299 -0
  14. package/dist/cli/bundle.js.map +1 -0
  15. package/dist/cli/check.d.ts +19 -0
  16. package/dist/cli/check.d.ts.map +1 -0
  17. package/dist/cli/check.js +248 -0
  18. package/dist/cli/check.js.map +1 -0
  19. package/dist/cli/commands.d.ts +30 -0
  20. package/dist/cli/commands.d.ts.map +1 -0
  21. package/dist/cli/commands.js +64 -0
  22. package/dist/cli/commands.js.map +1 -0
  23. package/dist/cli/compiler-host.d.ts +109 -0
  24. package/dist/cli/compiler-host.d.ts.map +1 -0
  25. package/dist/cli/compiler-host.js +173 -0
  26. package/dist/cli/compiler-host.js.map +1 -0
  27. package/dist/cli/fmt.d.ts +13 -0
  28. package/dist/cli/fmt.d.ts.map +1 -0
  29. package/dist/cli/fmt.js +14 -0
  30. package/dist/cli/fmt.js.map +1 -0
  31. package/dist/cli/init-command.js +12 -12
  32. package/dist/cli/init-command.js.map +1 -1
  33. package/dist/cli/loader.d.ts +0 -21
  34. package/dist/cli/loader.d.ts.map +1 -1
  35. package/dist/cli/loader.js +1 -50
  36. package/dist/cli/loader.js.map +1 -1
  37. package/dist/cli/schema.d.ts +2 -0
  38. package/dist/cli/schema.d.ts.map +1 -1
  39. package/dist/cli/schema.js +11 -4
  40. package/dist/cli/schema.js.map +1 -1
  41. package/dist/cli/workspace.d.ts +82 -0
  42. package/dist/cli/workspace.d.ts.map +1 -0
  43. package/dist/cli/workspace.js +248 -0
  44. package/dist/cli/workspace.js.map +1 -0
  45. package/dist/index.d.ts +6 -3
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +3 -3
  48. package/dist/index.js.map +1 -1
  49. package/dist/think-builder.d.ts +50 -2
  50. package/dist/think-builder.d.ts.map +1 -1
  51. package/dist/think-builder.js +137 -14
  52. package/dist/think-builder.js.map +1 -1
  53. package/dist/thought-event.d.ts +80 -0
  54. package/dist/thought-event.d.ts.map +1 -0
  55. package/dist/thought-event.js +2 -0
  56. package/dist/thought-event.js.map +1 -0
  57. package/dist/thought-stream.d.ts +45 -0
  58. package/dist/thought-stream.d.ts.map +1 -0
  59. package/dist/thought-stream.js +99 -0
  60. package/dist/thought-stream.js.map +1 -0
  61. package/dist-pkg/acp.cjs +37 -11
  62. package/dist-pkg/thinkwell.cjs +49 -18
  63. package/package.json +4 -9
  64. package/dist/cli/index.d.ts +0 -11
  65. package/dist/cli/index.d.ts.map +0 -1
  66. package/dist/cli/index.js +0 -11
  67. package/dist/cli/index.js.map +0 -1
  68. package/dist/cli/main-pkg.d.ts +0 -18
  69. package/dist/cli/main-pkg.d.ts.map +0 -1
  70. package/dist/cli/main.d.ts +0 -14
  71. package/dist/cli/main.d.ts.map +0 -1
  72. package/dist/cli/main.js +0 -256
  73. package/dist/cli/main.js.map +0 -1
  74. package/dist/cli/types-command.d.ts +0 -8
  75. package/dist/cli/types-command.d.ts.map +0 -1
  76. package/dist/cli/types-command.js +0 -110
  77. package/dist/cli/types-command.js.map +0 -1
@@ -83,7 +83,7 @@ var init_stdio = __esm({
83
83
  });
84
84
  process2.on("exit", (code, signal) => {
85
85
  this.closed = true;
86
- if (code !== 0 && code !== null) {
86
+ if (code !== 0 && code !== null && !this.closingGracefully) {
87
87
  console.error(`Process exited with code ${code}`);
88
88
  }
89
89
  if (signal && !this.closingGracefully) {
@@ -141,17 +141,26 @@ var init_stdio = __esm({
141
141
  this.closed = true;
142
142
  this.closingGracefully = true;
143
143
  this.readline.close();
144
+ this.process.stdout?.destroy();
144
145
  this.process.stdin?.end();
145
146
  await new Promise((resolve) => {
146
- const timeout = setTimeout(() => {
147
- this.process.kill("SIGKILL");
147
+ let sigtermTimeout = null;
148
+ let sigkillTimeout = null;
149
+ const onExit = /* @__PURE__ */ __name(() => {
150
+ if (sigtermTimeout)
151
+ clearTimeout(sigtermTimeout);
152
+ if (sigkillTimeout)
153
+ clearTimeout(sigkillTimeout);
148
154
  resolve();
149
- }, 5e3);
150
- this.process.once("exit", () => {
151
- clearTimeout(timeout);
152
- resolve();
153
- });
154
- this.process.kill("SIGTERM");
155
+ }, "onExit");
156
+ this.process.once("exit", onExit);
157
+ sigtermTimeout = setTimeout(() => {
158
+ this.process.kill("SIGTERM");
159
+ sigkillTimeout = setTimeout(() => {
160
+ this.process.kill("SIGKILL");
161
+ resolve();
162
+ }, 500);
163
+ }, 250);
155
164
  });
156
165
  }
157
166
  };
@@ -17450,6 +17459,7 @@ async function createHttpListener(options) {
17450
17459
  const { acpUrl, onMessage } = options;
17451
17460
  let sessionId = null;
17452
17461
  const connections = /* @__PURE__ */ new Map();
17462
+ const sockets = /* @__PURE__ */ new Set();
17453
17463
  let server = null;
17454
17464
  server = (0, import_node_http.createServer)(async (req, res) => {
17455
17465
  res.setHeader("Access-Control-Allow-Origin", "*");
@@ -17505,6 +17515,12 @@ async function createHttpListener(options) {
17505
17515
  server.listen(0, "127.0.0.1", () => resolve());
17506
17516
  server.on("error", reject);
17507
17517
  });
17518
+ server.on("connection", (socket) => {
17519
+ sockets.add(socket);
17520
+ socket.on("close", () => {
17521
+ sockets.delete(socket);
17522
+ });
17523
+ });
17508
17524
  const address = server.address();
17509
17525
  if (!address || typeof address === "string") {
17510
17526
  throw new Error("Failed to get server address");
@@ -17527,9 +17543,19 @@ async function createHttpListener(options) {
17527
17543
  });
17528
17544
  connections.delete(key);
17529
17545
  }
17546
+ for (const socket of sockets) {
17547
+ socket.destroy();
17548
+ }
17549
+ sockets.clear();
17530
17550
  if (server) {
17531
- await new Promise((resolve) => {
17532
- server.close(() => resolve());
17551
+ await new Promise((resolve, reject) => {
17552
+ server.close((err) => {
17553
+ if (err) {
17554
+ reject(err);
17555
+ } else {
17556
+ resolve();
17557
+ }
17558
+ });
17533
17559
  });
17534
17560
  }
17535
17561
  }
@@ -20111,7 +20137,9 @@ var Agent = class _Agent {
20111
20137
  // Set below after creating the client
20112
20138
  mcpHandler,
20113
20139
  sessionHandlers: /* @__PURE__ */ new Map(),
20114
- initialized: false
20140
+ initialized: false,
20141
+ conductorPromise: null
20142
+ // Set below after starting the conductor
20115
20143
  };
20116
20144
  const clientConnection = new ClientSideConnection((_agent) => createClient(conn, mcpHandler), stream);
20117
20145
  conn.connection = clientConnection;
@@ -20120,8 +20148,8 @@ var Agent = class _Agent {
20120
20148
  return pair.right;
20121
20149
  }
20122
20150
  };
20123
- const conductorPromise = conductor.connect(clientConnector);
20124
- conductorPromise.catch((error40) => {
20151
+ conn.conductorPromise = conductor.connect(clientConnector);
20152
+ conn.conductorPromise.catch((error40) => {
20125
20153
  console.error("Conductor error:", error40);
20126
20154
  });
20127
20155
  return new _Agent(conn);
@@ -20186,10 +20214,13 @@ var Agent = class _Agent {
20186
20214
  *
20187
20215
  * This shuts down the conductor. Any active sessions will be invalidated.
20188
20216
  */
20189
- close() {
20190
- this._conn.conductor.shutdown().catch((error40) => {
20191
- console.error("Conductor shutdown error:", error40);
20192
- });
20217
+ async close() {
20218
+ await this._conn.conductor.shutdown();
20219
+ try {
20220
+ await this._conn.conductorPromise;
20221
+ } catch (error40) {
20222
+ console.error("[Agent.close] Conductor promise error:", error40);
20223
+ }
20193
20224
  }
20194
20225
  /**
20195
20226
  * Get the internal connection for use by ThinkBuilder
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thinkwell",
3
- "version": "0.4.5",
3
+ "version": "0.5.0-alpha.2",
4
4
  "description": "TypeScript library for blending deterministic code with LLM-powered reasoning",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -13,11 +13,6 @@
13
13
  "types": "./dist/index.d.ts",
14
14
  "import": "./dist/index.js",
15
15
  "default": "./dist/index.js"
16
- },
17
- "./connectors": {
18
- "types": "./dist/connectors/index.d.ts",
19
- "import": "./dist/connectors/index.js",
20
- "default": "./dist/connectors/index.js"
21
16
  }
22
17
  },
23
18
  "engines": {
@@ -40,9 +35,9 @@
40
35
  "@agentclientprotocol/sdk": "^0.12.0",
41
36
  "ts-json-schema-generator": "^2.4.0",
42
37
  "typescript": "^5.7.2",
43
- "@thinkwell/acp": "0.4.5",
44
- "@thinkwell/conductor": "0.4.5",
45
- "@thinkwell/protocol": "0.4.5"
38
+ "@thinkwell/acp": "0.5.0-alpha.2",
39
+ "@thinkwell/conductor": "0.5.0-alpha.2",
40
+ "@thinkwell/protocol": "0.5.0-alpha.2"
46
41
  },
47
42
  "devDependencies": {
48
43
  "@types/node": "^24.10.4",
@@ -1,11 +0,0 @@
1
- /**
2
- * Thinkwell CLI
3
- *
4
- * This module provides the Bun-native entry point for the thinkwell CLI.
5
- * For npm distribution, see bin/thinkwell which is a Node.js launcher.
6
- *
7
- * @packageDocumentation
8
- */
9
- export declare const VERSION = "0.2.0";
10
- export { THINKWELL_MODULES } from "@thinkwell/bun-plugin";
11
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/cli/index.js DELETED
@@ -1,11 +0,0 @@
1
- /**
2
- * Thinkwell CLI
3
- *
4
- * This module provides the Bun-native entry point for the thinkwell CLI.
5
- * For npm distribution, see bin/thinkwell which is a Node.js launcher.
6
- *
7
- * @packageDocumentation
8
- */
9
- export const VERSION = "0.2.0";
10
- export { THINKWELL_MODULES } from "@thinkwell/bun-plugin";
11
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Thinkwell CLI - Node.js entry point for pkg-compiled binary.
4
- *
5
- * This is the main entry point for the pkg-compiled binary. Unlike the Bun
6
- * entry point (main.ts), this runs in Node.js with --experimental-strip-types
7
- * for native TypeScript support.
8
- *
9
- * The pkg binary uses a custom loader to:
10
- * - Route thinkwell:* imports to bundled packages
11
- * - Resolve external packages from user's node_modules
12
- * - Handle @JSONSchema type processing
13
- *
14
- * Phase 1 stub: This is a minimal implementation to verify pkg bundling works.
15
- * Full implementation will be added in Phase 2 (Loader) and Phase 3 (CLI).
16
- */
17
- export {};
18
- //# sourceMappingURL=main-pkg.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main-pkg.d.ts","sourceRoot":"","sources":["../../src/cli/main-pkg.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;GAcG"}
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env bun
2
- /**
3
- * Thinkwell CLI - Bun-native entry point for compiled binary.
4
- *
5
- * This is the main entry point for the self-contained Bun-compiled binary.
6
- * Unlike the Node.js launcher (bin/thinkwell), this runs directly in Bun
7
- * and can be compiled with `bun build --compile`.
8
- *
9
- * The bun-plugin is imported at the top level, which registers it with Bun's
10
- * plugin system. This means any TypeScript files loaded after this point
11
- * will automatically have @JSONSchema types processed.
12
- */
13
- export {};
14
- //# sourceMappingURL=main.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG"}
package/dist/cli/main.js DELETED
@@ -1,256 +0,0 @@
1
- #!/usr/bin/env bun
2
- /**
3
- * Thinkwell CLI - Bun-native entry point for compiled binary.
4
- *
5
- * This is the main entry point for the self-contained Bun-compiled binary.
6
- * Unlike the Node.js launcher (bin/thinkwell), this runs directly in Bun
7
- * and can be compiled with `bun build --compile`.
8
- *
9
- * The bun-plugin is imported at the top level, which registers it with Bun's
10
- * plugin system. This means any TypeScript files loaded after this point
11
- * will automatically have @JSONSchema types processed.
12
- */
13
- import { existsSync } from "node:fs";
14
- import { resolve, isAbsolute } from "node:path";
15
- import { pathToFileURL } from "node:url";
16
- // Import the bun-plugin - this registers it with Bun's plugin system.
17
- // The plugin will intercept all .ts/.tsx file loads and process @JSONSchema types.
18
- import { registerModule } from "@thinkwell/bun-plugin";
19
- // Import thinkwell packages so they get bundled into the compiled binary.
20
- // These are registered as virtual modules so user scripts can import from them.
21
- import * as thinkwell from "thinkwell";
22
- import * as thinkwellAcp from "@thinkwell/acp";
23
- import * as thinkwellProtocol from "@thinkwell/protocol";
24
- // Register modules for virtual resolution in compiled binary.
25
- // This enables user scripts to import from "thinkwell:agent" etc.
26
- registerModule("thinkwell", thinkwell);
27
- registerModule("@thinkwell/acp", thinkwellAcp);
28
- registerModule("@thinkwell/protocol", thinkwellProtocol);
29
- import { runInit } from "./init-command.js";
30
- import { parseBuildArgs, runBuild as executeBuild, showBuildHelp } from "./build.js";
31
- // Version must be updated manually to match package.json
32
- const VERSION = "0.4.2";
33
- function showHelp() {
34
- console.log(`
35
- thinkwell - Run TypeScript scripts with automatic schema generation
36
-
37
- Usage:
38
- thinkwell <script.ts> [args...] Run a TypeScript script
39
- thinkwell run <script.ts> [args...] Explicit run command
40
- thinkwell build <script.ts> Compile to standalone executable
41
- thinkwell init [project-name] Initialize a new project
42
- thinkwell types [dir] Generate .d.ts files for IDE support
43
- thinkwell types --watch [dir] Watch and regenerate .d.ts files
44
- thinkwell --help Show this help message
45
- thinkwell --version Show version
46
-
47
- Examples:
48
- thinkwell hello.ts Run hello.ts
49
- thinkwell run hello.ts --verbose Run with arguments
50
- thinkwell build src/agent.ts Compile to binary
51
- thinkwell init my-agent Create a new project
52
- ./script.ts Via shebang: #!/usr/bin/env thinkwell
53
- thinkwell types Generate declarations in current dir
54
- thinkwell types src Generate declarations in src/
55
- thinkwell types --watch Watch for changes and regenerate
56
-
57
- The thinkwell CLI automatically:
58
- - Generates JSON Schema for types marked with @JSONSchema
59
- - Resolves thinkwell:* imports to built-in modules
60
- - Creates .thinkwell.d.ts files for IDE autocomplete (types command)
61
-
62
- For more information, visit: https://github.com/dherman/thinkwell
63
- `);
64
- }
65
- async function runTypes(args) {
66
- // Import the types command implementation from the bundled bun-plugin
67
- const { generateDeclarations, watchDeclarations } = await import("@thinkwell/bun-plugin");
68
- const watchMode = args.includes("--watch") || args.includes("-w");
69
- const dirArg = args.find((arg) => !arg.startsWith("-"));
70
- const rootDir = dirArg ? resolve(dirArg) : process.cwd();
71
- // Validate directory exists
72
- if (!existsSync(rootDir)) {
73
- console.error(`Error: Directory not found: ${rootDir}`);
74
- process.exit(1);
75
- }
76
- const formatError = (error, sourceFile) => {
77
- const lines = [`Error processing: ${sourceFile}`, ` ${error.message}`];
78
- if (process.env.DEBUG) {
79
- lines.push(` Stack: ${error.stack?.split("\n").slice(1, 3).join("\n ")}`);
80
- }
81
- return lines.join("\n");
82
- };
83
- if (watchMode) {
84
- console.log(`Watching for changes in ${rootDir}...`);
85
- console.log("Press Ctrl+C to stop.\n");
86
- const watcher = watchDeclarations({
87
- rootDir,
88
- onWrite: (_source, decl) => {
89
- console.log(`✓ ${decl}`);
90
- },
91
- onRemove: (_source, decl) => {
92
- console.log(`✗ ${decl} (removed)`);
93
- },
94
- onError: (error, source) => {
95
- console.error(formatError(error, source));
96
- },
97
- });
98
- // Initial generation
99
- console.log("Generating initial declarations...\n");
100
- await generateDeclarations({
101
- rootDir,
102
- onWrite: (_source, decl) => {
103
- console.log(`✓ ${decl}`);
104
- },
105
- onError: (error, source) => {
106
- console.error(formatError(error, source));
107
- },
108
- });
109
- console.log("\nWatching for changes...\n");
110
- // Keep process alive
111
- process.on("SIGINT", () => {
112
- watcher.stop();
113
- console.log("\nStopped watching.");
114
- process.exit(0);
115
- });
116
- // Prevent the process from exiting
117
- await new Promise(() => { });
118
- }
119
- else {
120
- console.log(`Generating declarations in ${rootDir}...\n`);
121
- let errorCount = 0;
122
- const generated = await generateDeclarations({
123
- rootDir,
124
- onWrite: (_source, decl) => {
125
- console.log(`✓ ${decl}`);
126
- },
127
- onError: (error, source) => {
128
- errorCount++;
129
- console.error(formatError(error, source));
130
- },
131
- });
132
- if (generated.length === 0 && errorCount === 0) {
133
- console.log("No @JSONSchema types found.");
134
- console.log("");
135
- console.log("To mark a type for schema generation, add the @JSONSchema JSDoc tag:");
136
- console.log("");
137
- console.log(" /** @JSONSchema */");
138
- console.log(" interface MyType {");
139
- console.log(" name: string;");
140
- console.log(" }");
141
- }
142
- else {
143
- console.log(`\nGenerated ${generated.length} declaration file(s).`);
144
- if (errorCount > 0) {
145
- console.log(`Encountered ${errorCount} error(s).`);
146
- process.exit(1);
147
- }
148
- }
149
- }
150
- }
151
- async function runScript(args) {
152
- const scriptPath = args[0];
153
- // Resolve the script path
154
- const resolvedPath = isAbsolute(scriptPath)
155
- ? scriptPath
156
- : resolve(process.cwd(), scriptPath);
157
- // Check if the script file exists
158
- if (!existsSync(resolvedPath)) {
159
- console.error(`Error: Script not found: ${scriptPath}`);
160
- console.error("");
161
- console.error("Make sure the file exists and the path is correct.");
162
- process.exit(1);
163
- }
164
- // Set up process.argv for the script
165
- // The script should see: [bun, script.ts, ...args]
166
- const originalArgv = process.argv;
167
- process.argv = [process.argv[0], resolvedPath, ...args.slice(1)];
168
- try {
169
- // Dynamically import the script.
170
- // Because the bun-plugin is registered, it will intercept this import
171
- // and process any @JSONSchema types in the file.
172
- const scriptUrl = pathToFileURL(resolvedPath).href;
173
- await import(scriptUrl);
174
- }
175
- catch (error) {
176
- // Restore argv before handling error
177
- process.argv = originalArgv;
178
- if (error instanceof Error) {
179
- // Check if it's a module not found error for thinkwell packages
180
- if (error.message.includes("Cannot find module") ||
181
- error.message.includes("Cannot find package")) {
182
- console.error(`Error: ${error.message}`);
183
- console.error("");
184
- console.error("If your script uses thinkwell:* imports, make sure to use");
185
- console.error("the import syntax like: import { Agent } from 'thinkwell:agent'");
186
- process.exit(1);
187
- }
188
- throw error;
189
- }
190
- throw error;
191
- }
192
- }
193
- async function main() {
194
- const args = process.argv.slice(2);
195
- // Handle "init" subcommand first - does NOT require schema plugin
196
- if (args[0] === "init") {
197
- await runInit(args.slice(1));
198
- process.exit(0);
199
- }
200
- // Handle --help (global)
201
- if (args.includes("--help") || args.includes("-h") || args.length === 0) {
202
- showHelp();
203
- process.exit(0);
204
- }
205
- // Handle --version
206
- if (args.includes("--version") || args.includes("-v")) {
207
- console.log(`thinkwell ${VERSION}`);
208
- process.exit(0);
209
- }
210
- // Handle "types" subcommand
211
- if (args[0] === "types") {
212
- await runTypes(args.slice(1));
213
- process.exit(0);
214
- }
215
- // Handle "build" subcommand
216
- if (args[0] === "build") {
217
- const buildArgs = args.slice(1);
218
- if (buildArgs.includes("--help") || buildArgs.includes("-h")) {
219
- showBuildHelp();
220
- process.exit(0);
221
- }
222
- try {
223
- const options = parseBuildArgs(buildArgs);
224
- await executeBuild(options);
225
- }
226
- catch (error) {
227
- if (error instanceof Error) {
228
- console.error(`Error: ${error.message}`);
229
- }
230
- else {
231
- console.error(`Error: ${error}`);
232
- }
233
- process.exit(1);
234
- }
235
- process.exit(0);
236
- }
237
- // Handle "run" subcommand - just strip it
238
- const runArgs = args[0] === "run" ? args.slice(1) : args;
239
- // If no script provided after "run", show help
240
- if (runArgs.length === 0) {
241
- console.error("Error: No script provided.");
242
- console.error("");
243
- console.error("Usage: thinkwell run <script.ts> [args...]");
244
- process.exit(1);
245
- }
246
- await runScript(runArgs);
247
- }
248
- main().catch((error) => {
249
- console.error("Unexpected error:");
250
- console.error(` ${error.message || error}`);
251
- if (process.env.DEBUG) {
252
- console.error(error.stack);
253
- }
254
- process.exit(1);
255
- });
256
- //# sourceMappingURL=main.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,sEAAsE;AACtE,mFAAmF;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,0EAA0E;AAC1E,gFAAgF;AAChF,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AAEzD,8DAA8D;AAC9D,kEAAkE;AAClE,cAAc,CAAC,WAAW,EAAE,SAAoC,CAAC,CAAC;AAClE,cAAc,CAAC,gBAAgB,EAAE,YAAuC,CAAC,CAAC;AAC1E,cAAc,CAAC,qBAAqB,EAAE,iBAA4C,CAAC,CAAC;AAEpF,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,QAAQ,IAAI,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAErF,yDAAyD;AACzD,MAAM,OAAO,GAAG,OAAO,CAAC;AAExB,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Bb,CAAC,CAAC;AACH,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,IAAc;IACpC,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EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAC5C,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACnC,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC;IAC7C,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;QACtB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * CLI command for generating declaration files.
3
- *
4
- * This script is invoked by the thinkwell CLI when the user runs
5
- * `thinkwell types` or `thinkwell types --watch`.
6
- */
7
- export {};
8
- //# sourceMappingURL=types-command.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-command.d.ts","sourceRoot":"","sources":["../../src/cli/types-command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -1,110 +0,0 @@
1
- /**
2
- * CLI command for generating declaration files.
3
- *
4
- * This script is invoked by the thinkwell CLI when the user runs
5
- * `thinkwell types` or `thinkwell types --watch`.
6
- */
7
- import { existsSync } from "node:fs";
8
- import { resolve } from "node:path";
9
- import { generateDeclarations, watchDeclarations, } from "@thinkwell/bun-plugin";
10
- /**
11
- * Format an error for console output.
12
- */
13
- function formatError(error, sourceFile) {
14
- const lines = [
15
- `Error processing: ${sourceFile}`,
16
- ` ${error.message}`,
17
- ];
18
- // Add stack trace hint for debugging
19
- if (process.env.DEBUG) {
20
- lines.push(` Stack: ${error.stack?.split("\n").slice(1, 3).join("\n ")}`);
21
- }
22
- return lines.join("\n");
23
- }
24
- async function main() {
25
- const args = process.argv.slice(2);
26
- const watchMode = args.includes("--watch") || args.includes("-w");
27
- const dirArg = args.find((arg) => !arg.startsWith("-"));
28
- const rootDir = dirArg ? resolve(dirArg) : process.cwd();
29
- // Validate directory exists
30
- if (!existsSync(rootDir)) {
31
- console.error(`Error: Directory not found: ${rootDir}`);
32
- process.exit(1);
33
- }
34
- if (watchMode) {
35
- console.log(`Watching for changes in ${rootDir}...`);
36
- console.log("Press Ctrl+C to stop.\n");
37
- const watcher = watchDeclarations({
38
- rootDir,
39
- onWrite: (source, decl) => {
40
- console.log(`✓ ${decl}`);
41
- },
42
- onRemove: (source, decl) => {
43
- console.log(`✗ ${decl} (removed)`);
44
- },
45
- onError: (error, source) => {
46
- console.error(formatError(error, source));
47
- },
48
- });
49
- // Initial generation
50
- console.log("Generating initial declarations...\n");
51
- await generateDeclarations({
52
- rootDir,
53
- onWrite: (source, decl) => {
54
- console.log(`✓ ${decl}`);
55
- },
56
- onError: (error, source) => {
57
- console.error(formatError(error, source));
58
- },
59
- });
60
- console.log("\nWatching for changes...\n");
61
- // Keep process alive
62
- process.on("SIGINT", () => {
63
- watcher.stop();
64
- console.log("\nStopped watching.");
65
- process.exit(0);
66
- });
67
- // Prevent the process from exiting
68
- await new Promise(() => { });
69
- }
70
- else {
71
- console.log(`Generating declarations in ${rootDir}...\n`);
72
- let errorCount = 0;
73
- const generated = await generateDeclarations({
74
- rootDir,
75
- onWrite: (source, decl) => {
76
- console.log(`✓ ${decl}`);
77
- },
78
- onError: (error, source) => {
79
- errorCount++;
80
- console.error(formatError(error, source));
81
- },
82
- });
83
- if (generated.length === 0 && errorCount === 0) {
84
- console.log("No @JSONSchema types found.");
85
- console.log("");
86
- console.log("To mark a type for schema generation, add the @JSONSchema JSDoc tag:");
87
- console.log("");
88
- console.log(" /** @JSONSchema */");
89
- console.log(" interface MyType {");
90
- console.log(" name: string;");
91
- console.log(" }");
92
- }
93
- else {
94
- console.log(`\nGenerated ${generated.length} declaration file(s).`);
95
- if (errorCount > 0) {
96
- console.log(`Encountered ${errorCount} error(s).`);
97
- process.exit(1);
98
- }
99
- }
100
- }
101
- }
102
- main().catch((error) => {
103
- console.error("Unexpected error:");
104
- console.error(` ${error.message || error}`);
105
- if (process.env.DEBUG) {
106
- console.error(error.stack);
107
- }
108
- process.exit(1);
109
- });
110
- //# sourceMappingURL=types-command.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-command.js","sourceRoot":"","sources":["../../src/cli/types-command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAE/B;;GAEG;AACH,SAAS,WAAW,CAAC,KAAY,EAAE,UAAkB;IACnD,MAAM,KAAK,GAAG;QACZ,qBAAqB,UAAU,EAAE;QACjC,KAAK,KAAK,CAAC,OAAO,EAAE;KACrB,CAAC;IAEF,qCAAqC;IACrC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,YAAY,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAA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