@rendotdev/rig 0.0.17 → 0.0.19

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 (28) hide show
  1. package/README.md +4 -0
  2. package/dist/{run-y66hvyxg.js → cli-113n7c3t.js} +158 -16
  3. package/dist/{cli-ne7ed594.js → cli-13q90bjr.js} +12 -0
  4. package/dist/{cli-vx11bmzr.js → cli-1hm5dxfw.js} +2 -2
  5. package/dist/{cli-dshh1cp9.js → cli-884hpkjc.js} +1 -1
  6. package/dist/cli-es8j6mma.js +226 -0
  7. package/dist/{cli-7zqnqrah.js → cli-f7p31fzm.js} +106 -42
  8. package/dist/{cli-xv4m20sx.js → cli-nk194xv0.js} +198 -71
  9. package/dist/{cli-mswdavqx.js → cli-zgw1jbeg.js} +3 -3
  10. package/dist/{config-24gwe08t.js → config-20f90shh.js} +2 -3
  11. package/dist/{create-59myk91d.js → create-pvym2abv.js} +7 -8
  12. package/dist/cron-aw908dzn.js +18 -0
  13. package/dist/{dev-link-jpte1gq9.js → dev-link-e1mj8w17.js} +7 -4
  14. package/dist/{discover-fd9e6j9j.js → discover-95bpzy46.js} +3 -4
  15. package/dist/{help-6k8m07yv.js → help-qj75r0x3.js} +5 -6
  16. package/dist/{inspect-ks3x7s4n.js → inspect-0ckw7bs5.js} +5 -6
  17. package/dist/list-reekhy3q.js +13 -0
  18. package/dist/{paths-hq1vy0wh.js → paths-3vxw7dek.js} +1 -1
  19. package/dist/{registry-gng9br0x.js → registry-fzc3aeb8.js} +2 -3
  20. package/dist/rig.js +101 -32
  21. package/dist/run-thx15p83.js +13 -0
  22. package/dist/{runtime-comment-gvmkkcyh.js → runtime-comment-07cpchsr.js} +15 -9
  23. package/dist/{sync-zsc35m3f.js → sync-kkqh3axx.js} +33 -16
  24. package/dist/{typecheck-c2k87ppw.js → typecheck-971tmqbp.js} +5 -7
  25. package/dist/{update-check-87p71vrc.js → update-check-dpkh7hc6.js} +8 -5
  26. package/package.json +2 -2
  27. package/dist/cli-aj56a1ja.js +0 -48
  28. package/dist/list-f7r354tq.js +0 -14
@@ -1,18 +1,17 @@
1
1
  import {
2
2
  ToolLoader
3
- } from "./cli-7zqnqrah.js";
3
+ } from "./cli-f7p31fzm.js";
4
4
  import {
5
5
  RigToolEntryFiles,
6
6
  ToolDiscoveryService
7
- } from "./cli-vx11bmzr.js";
7
+ } from "./cli-1hm5dxfw.js";
8
8
  import {
9
9
  RigConfigStore
10
- } from "./cli-xv4m20sx.js";
11
- import"./cli-aj56a1ja.js";
10
+ } from "./cli-nk194xv0.js";
12
11
  import {
13
12
  RigError
14
13
  } from "./cli-1c7te5cg.js";
15
- import"./cli-ne7ed594.js";
14
+ import"./cli-13q90bjr.js";
16
15
  import"./cli-b7jgjgy7.js";
17
16
 
18
17
  // src/tools/create.ts
@@ -51,12 +50,12 @@ class ToolCreator {
51
50
  name: ${JSON.stringify(name)},
52
51
  description: "Describe what this tool does.",
53
52
  commands: {
54
- example: rig.command({
53
+ example: rig.defineCommand({
55
54
  description: "Example command. Replace this with a real command.",
56
- input: rig.input({
55
+ input: rig.z.object({
57
56
  text: rig.z.string().default("example"),
58
57
  }),
59
- output: rig.output({
58
+ output: rig.z.object({
60
59
  text: rig.z.string(),
61
60
  }),
62
61
  examples: [
@@ -0,0 +1,18 @@
1
+ import {
2
+ RigCronService,
3
+ RigCronWorker,
4
+ cronModuleUrl
5
+ } from "./cli-es8j6mma.js";
6
+ import"./cli-113n7c3t.js";
7
+ import"./cli-884hpkjc.js";
8
+ import"./cli-f7p31fzm.js";
9
+ import"./cli-1hm5dxfw.js";
10
+ import"./cli-nk194xv0.js";
11
+ import"./cli-1c7te5cg.js";
12
+ import"./cli-13q90bjr.js";
13
+ import"./cli-b7jgjgy7.js";
14
+ export {
15
+ cronModuleUrl,
16
+ RigCronWorker,
17
+ RigCronService
18
+ };
@@ -3,7 +3,7 @@ import {
3
3
  } from "./cli-1c7te5cg.js";
4
4
  import {
5
5
  RigPaths
6
- } from "./cli-ne7ed594.js";
6
+ } from "./cli-13q90bjr.js";
7
7
  import"./cli-b7jgjgy7.js";
8
8
 
9
9
  // src/dev/dev-link.ts
@@ -29,7 +29,10 @@ class DevLinkService {
29
29
  });
30
30
  }
31
31
  await mkdir(binDir, { recursive: true });
32
- await writeFile(shimPath, this.shimSource(repoRoot), "utf8");
32
+ if (typeof Bun !== "undefined")
33
+ await Bun.write(shimPath, this.shimSource(repoRoot));
34
+ else
35
+ await writeFile(shimPath, this.shimSource(repoRoot), "utf8");
33
36
  await chmod(shimPath, 493);
34
37
  return this.status(options);
35
38
  }
@@ -102,7 +105,7 @@ class DevLinkService {
102
105
  return `#!/usr/bin/env bash
103
106
  # Rig dev shim. Safe to overwrite with \`rig dev link\`.
104
107
  RIG_DEV_REPO=${JSON.stringify(repoRoot)}
105
- exec bun run "$RIG_DEV_REPO/src/cli.ts" "$@"
108
+ exec bun --install=fallback run "$RIG_DEV_REPO/src/cli.ts" "$@"
106
109
  `;
107
110
  }
108
111
  async readExistingShim(shimPath) {
@@ -111,7 +114,7 @@ exec bun run "$RIG_DEV_REPO/src/cli.ts" "$@"
111
114
  const stat = await lstat(shimPath);
112
115
  if (!stat.isFile())
113
116
  return { exists: true, isRigDevShim: false, content: "" };
114
- const content = await readFile(shimPath, "utf8");
117
+ const content = typeof Bun !== "undefined" ? await Bun.file(shimPath).text() : await readFile(shimPath, "utf8");
115
118
  return {
116
119
  exists: true,
117
120
  isRigDevShim: content.includes("Rig dev shim"),
@@ -1,11 +1,10 @@
1
1
  import {
2
2
  RigToolEntryFiles,
3
3
  ToolDiscoveryService
4
- } from "./cli-vx11bmzr.js";
5
- import"./cli-xv4m20sx.js";
6
- import"./cli-aj56a1ja.js";
4
+ } from "./cli-1hm5dxfw.js";
5
+ import"./cli-nk194xv0.js";
7
6
  import"./cli-1c7te5cg.js";
8
- import"./cli-ne7ed594.js";
7
+ import"./cli-13q90bjr.js";
9
8
  import"./cli-b7jgjgy7.js";
10
9
  export {
11
10
  ToolDiscoveryService,
@@ -1,17 +1,16 @@
1
1
  import {
2
2
  SchemaRenderer
3
- } from "./cli-dshh1cp9.js";
3
+ } from "./cli-884hpkjc.js";
4
4
  import {
5
5
  CommandIds,
6
6
  ToolLoader
7
- } from "./cli-7zqnqrah.js";
8
- import"./cli-vx11bmzr.js";
9
- import"./cli-xv4m20sx.js";
10
- import"./cli-aj56a1ja.js";
7
+ } from "./cli-f7p31fzm.js";
8
+ import"./cli-1hm5dxfw.js";
9
+ import"./cli-nk194xv0.js";
11
10
  import {
12
11
  RigError
13
12
  } from "./cli-1c7te5cg.js";
14
- import"./cli-ne7ed594.js";
13
+ import"./cli-13q90bjr.js";
15
14
  import"./cli-b7jgjgy7.js";
16
15
 
17
16
  // src/tools/help.ts
@@ -1,17 +1,16 @@
1
1
  import {
2
2
  SchemaRenderer
3
- } from "./cli-dshh1cp9.js";
3
+ } from "./cli-884hpkjc.js";
4
4
  import {
5
5
  CommandIds,
6
6
  ToolLoader
7
- } from "./cli-7zqnqrah.js";
8
- import"./cli-vx11bmzr.js";
9
- import"./cli-xv4m20sx.js";
10
- import"./cli-aj56a1ja.js";
7
+ } from "./cli-f7p31fzm.js";
8
+ import"./cli-1hm5dxfw.js";
9
+ import"./cli-nk194xv0.js";
11
10
  import {
12
11
  RigError
13
12
  } from "./cli-1c7te5cg.js";
14
- import"./cli-ne7ed594.js";
13
+ import"./cli-13q90bjr.js";
15
14
  import"./cli-b7jgjgy7.js";
16
15
 
17
16
  // src/tools/inspect.ts
@@ -0,0 +1,13 @@
1
+ import {
2
+ ToolListService
3
+ } from "./cli-zgw1jbeg.js";
4
+ import"./cli-884hpkjc.js";
5
+ import"./cli-f7p31fzm.js";
6
+ import"./cli-1hm5dxfw.js";
7
+ import"./cli-nk194xv0.js";
8
+ import"./cli-1c7te5cg.js";
9
+ import"./cli-13q90bjr.js";
10
+ import"./cli-b7jgjgy7.js";
11
+ export {
12
+ ToolListService
13
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RigPaths
3
- } from "./cli-ne7ed594.js";
3
+ } from "./cli-13q90bjr.js";
4
4
  import"./cli-b7jgjgy7.js";
5
5
  export {
6
6
  RigPaths
@@ -1,13 +1,12 @@
1
1
  import {
2
2
  RigConfigStore
3
- } from "./cli-xv4m20sx.js";
4
- import"./cli-aj56a1ja.js";
3
+ } from "./cli-nk194xv0.js";
5
4
  import {
6
5
  RigError
7
6
  } from "./cli-1c7te5cg.js";
8
7
  import {
9
8
  RigPaths
10
- } from "./cli-ne7ed594.js";
9
+ } from "./cli-13q90bjr.js";
11
10
  import"./cli-b7jgjgy7.js";
12
11
 
13
12
  // src/registry/registry.ts
package/dist/rig.js CHANGED
@@ -1,11 +1,19 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ RigCronWorker
4
+ } from "./cli-es8j6mma.js";
5
+ import"./cli-113n7c3t.js";
6
+ import"./cli-884hpkjc.js";
7
+ import"./cli-f7p31fzm.js";
8
+ import"./cli-1hm5dxfw.js";
2
9
  import {
3
10
  RigPackageRoot
4
- } from "./cli-aj56a1ja.js";
11
+ } from "./cli-nk194xv0.js";
5
12
  import {
6
13
  RigError,
7
14
  RigErrors
8
15
  } from "./cli-1c7te5cg.js";
16
+ import"./cli-13q90bjr.js";
9
17
  import {
10
18
  __require
11
19
  } from "./cli-b7jgjgy7.js";
@@ -32,7 +40,7 @@ class BunRuntimeBootstrap {
32
40
  const bunPath = this.resolveBunPath();
33
41
  if (!bunPath)
34
42
  return;
35
- const result = this.spawn(bunPath, [fileURLToPath(metaUrl), ...argv.slice(2)], {
43
+ const result = this.spawn(bunPath, [this.autoInstallFlag(), fileURLToPath(metaUrl), ...argv.slice(2)], {
36
44
  stdio: "inherit",
37
45
  env: { ...this.env, RIG_BUN_BOOTSTRAPPED: "1" }
38
46
  });
@@ -50,6 +58,9 @@ class BunRuntimeBootstrap {
50
58
  ].filter((value) => Boolean(value));
51
59
  return candidates.find((candidate) => existsSync(candidate));
52
60
  }
61
+ autoInstallFlag() {
62
+ return "--install=fallback";
63
+ }
53
64
  }
54
65
 
55
66
  class CliApplication {
@@ -84,17 +95,22 @@ class CliApplication {
84
95
  this.configureEditCommand();
85
96
  this.configureRemoveCommand();
86
97
  this.configureRunCommand();
98
+ this.configureCronCommands();
87
99
  this.configureTypecheckCommand();
88
100
  this.configureDevCommands();
89
101
  this.configureUpdateCommand();
90
102
  this.program.command("help").argument("[target]", "Tool name or command id (<tool>.<command>).").description("Print general help or tool docs.").action(async (target) => {
91
103
  if (!target) {
92
104
  const readmePath = join(fileURLToPath(import.meta.url), "..", "..", "README.md");
93
- console.log(existsSync(readmePath) ? readFileSync(readmePath, "utf8") : this.program.helpInformation());
105
+ if (existsSync(readmePath)) {
106
+ console.log(readFileSync(readmePath, "utf8"));
107
+ } else {
108
+ console.log(this.program.helpInformation());
109
+ }
94
110
  return;
95
111
  }
96
112
  this.requestGeneratedSync();
97
- const { ToolHelpService } = await import("./help-6k8m07yv.js");
113
+ const { ToolHelpService } = await import("./help-qj75r0x3.js");
98
114
  console.log(await new ToolHelpService(this.pathOptions()).render(target));
99
115
  });
100
116
  }
@@ -111,37 +127,37 @@ class CliApplication {
111
127
  configureConfigCommands() {
112
128
  const configCommand = this.program.command("config").description("Manage Rig config.");
113
129
  configCommand.command("show").description("Print config JSON.").action(async () => {
114
- const { RigConfigStore } = await import("./config-24gwe08t.js");
130
+ const { RigConfigStore } = await import("./config-20f90shh.js");
115
131
  const configStore = new RigConfigStore(this.pathOptions());
116
132
  await configStore.ensure();
117
133
  this.printJson(await configStore.read());
118
134
  });
119
135
  configCommand.command("path").description("Print absolute config path.").action(async () => {
120
- const { RigPaths } = await import("./paths-hq1vy0wh.js");
136
+ const { RigPaths } = await import("./paths-3vxw7dek.js");
121
137
  console.log(new RigPaths(this.pathOptions()).configPath);
122
138
  });
123
139
  }
124
140
  configureRegistryCommands() {
125
141
  const registryCommand = this.program.command("registry").description("Manage tool registries.");
126
142
  registryCommand.command("list").description("List registries as JSON.").action(async () => {
127
- const { RegistryConfigService } = await import("./registry-gng9br0x.js");
143
+ const { RegistryConfigService } = await import("./registry-fzc3aeb8.js");
128
144
  this.printJson(await new RegistryConfigService(this.pathOptions()).list());
129
145
  });
130
146
  registryCommand.command("create").argument("[path]").description("Add a custom registry. Defaults to the current directory.").action(async (pathValue) => {
131
147
  this.requestGeneratedSync();
132
- const { RegistryConfigService } = await import("./registry-gng9br0x.js");
148
+ const { RegistryConfigService } = await import("./registry-fzc3aeb8.js");
133
149
  this.printJson(await new RegistryConfigService(this.pathOptions()).add(pathValue ?? process.cwd()));
134
150
  });
135
151
  registryCommand.command("remove").argument("<path>").description("Remove a custom registry.").action(async (pathValue) => {
136
152
  this.requestGeneratedSync();
137
- const { RegistryConfigService } = await import("./registry-gng9br0x.js");
153
+ const { RegistryConfigService } = await import("./registry-fzc3aeb8.js");
138
154
  this.printJson(await new RegistryConfigService(this.pathOptions()).remove(pathValue));
139
155
  });
140
156
  }
141
157
  configureListCommand() {
142
158
  this.program.command("list").alias("ls").description("List discovered tools and commands.").option("--json", "Print full JSON metadata.").option("--plain", "Print a compact plain text command list.").option("--for-path <path>", "Only list tools from registries visible from a path.").action(async (commandOptions) => {
143
159
  this.requestGeneratedSync();
144
- const { ToolListService } = await import("./list-f7r354tq.js");
160
+ const { ToolListService } = await import("./list-reekhy3q.js");
145
161
  const service = new ToolListService(this.pathOptions());
146
162
  const data = await service.list({ visibleFromPath: commandOptions.forPath });
147
163
  if (commandOptions.json)
@@ -153,7 +169,7 @@ class CliApplication {
153
169
  configureInspectCommand() {
154
170
  this.program.command("inspect").argument("<target>", "Tool name or command id (<tool>.<command>.)").description("Print tool or command metadata as JSON.").action(async (target) => {
155
171
  this.requestGeneratedSync();
156
- const { ToolInspector } = await import("./inspect-ks3x7s4n.js");
172
+ const { ToolInspector } = await import("./inspect-0ckw7bs5.js");
157
173
  this.printJson(await new ToolInspector(this.pathOptions()).inspect(target));
158
174
  });
159
175
  }
@@ -166,7 +182,7 @@ class CliApplication {
166
182
  configureEditCommand() {
167
183
  this.program.command("edit").argument("<tool>").description("Print the TypeScript file path for a tool.").action(async (name) => {
168
184
  this.requestGeneratedSync();
169
- const { ToolFileService } = await import("./create-59myk91d.js");
185
+ const { ToolFileService } = await import("./create-pvym2abv.js");
170
186
  const result = await new ToolFileService(this.pathOptions()).path(name);
171
187
  console.log(result.toolPath);
172
188
  });
@@ -174,7 +190,7 @@ class CliApplication {
174
190
  configureRemoveCommand() {
175
191
  this.program.command("remove").argument("<tool>").description("Remove a local tool directory.").action(async (name) => {
176
192
  this.requestGeneratedSync();
177
- const { ToolRemover } = await import("./create-59myk91d.js");
193
+ const { ToolRemover } = await import("./create-pvym2abv.js");
178
194
  const result = await new ToolRemover(this.pathOptions()).remove(name);
179
195
  console.log(`Removed tool ${result.name}`);
180
196
  console.log(`Tool directory: ${result.toolDir}`);
@@ -186,10 +202,39 @@ class CliApplication {
186
202
  await this.runToolCommand(commandId, args, commandOptions);
187
203
  });
188
204
  }
205
+ configureCronCommands() {
206
+ const cronCommand = this.program.command("cron").description("Manage scheduled Rig tool commands.");
207
+ cronCommand.command("list").description("List scheduled Rig tool commands as JSON.").action(async () => {
208
+ const { RigCronService } = await import("./cron-aw908dzn.js");
209
+ this.printJson(await new RigCronService(this.pathOptions()).list());
210
+ });
211
+ cronCommand.command("add").argument("<name>", "Unique job name, using letters, numbers, hyphens, or underscores.").argument("<command>", "Command id, formatted as <tool>.<command>.").argument("<schedule>", "Cron expression or nickname, such as @weekly.").description("Schedule a Rig tool command with fixed JSON input.").option("--input <json>", "JSON input string.").option("--input-file <path>", "Read JSON input from a file.").action(async (name, commandId, schedule, commandOptions) => {
212
+ const { cronModuleUrl, RigCronService } = await import("./cron-aw908dzn.js");
213
+ const result = await new RigCronService(this.pathOptions()).add({
214
+ name,
215
+ command: commandId,
216
+ schedule,
217
+ input: commandOptions.input,
218
+ inputFile: commandOptions.inputFile,
219
+ moduleUrl: cronModuleUrl(import.meta.url)
220
+ });
221
+ this.printJson(result);
222
+ });
223
+ cronCommand.command("remove").argument("<name>", "Cron job name.").description("Remove a scheduled Rig tool command.").action(async (name) => {
224
+ const { RigCronService } = await import("./cron-aw908dzn.js");
225
+ this.printJson(await new RigCronService(this.pathOptions()).remove(name));
226
+ });
227
+ cronCommand.command("run").argument("<name>", "Cron job name.").description("Run a scheduled Rig tool command now.").action(async (name) => {
228
+ const { RigCronService } = await import("./cron-aw908dzn.js");
229
+ const result = await new RigCronService(this.pathOptions()).run(name);
230
+ this.printJson(result.envelope);
231
+ process.exitCode = result.exitCode;
232
+ });
233
+ }
189
234
  configureTypecheckCommand() {
190
235
  this.program.command("typecheck").argument("[tool]").description("Type-check local tool files with the injected Rig tool runtime types.").action(async (tool) => {
191
236
  this.requestGeneratedSync();
192
- const { ToolTypecheckService } = await import("./typecheck-c2k87ppw.js");
237
+ const { ToolTypecheckService } = await import("./typecheck-971tmqbp.js");
193
238
  const result = await new ToolTypecheckService(this.pathOptions()).typecheck(tool);
194
239
  this.printJson(result);
195
240
  process.exitCode = result.exitCode;
@@ -219,7 +264,7 @@ class CliApplication {
219
264
  configureDevCommands() {
220
265
  const devCommand = this.program.command("dev").description("Local development helpers.");
221
266
  devCommand.command("link").description("Link this checkout as the local rig command for development.").option("--bin-dir <path>", "Directory where the rig shim should be written.").option("--force", "Overwrite an existing non-Rig shim.").action(async (commandOptions) => {
222
- const { DevLinkService } = await import("./dev-link-jpte1gq9.js");
267
+ const { DevLinkService } = await import("./dev-link-e1mj8w17.js");
223
268
  const service = new DevLinkService(this.pathOptions());
224
269
  const status = await service.link({
225
270
  binDir: commandOptions.binDir,
@@ -228,7 +273,7 @@ class CliApplication {
228
273
  console.log(service.renderLinkResult(status));
229
274
  });
230
275
  devCommand.command("unlink").description("Remove the local rig development shim.").option("--bin-dir <path>", "Directory where the rig shim was written.").option("--force", "Remove even if the file is not a Rig dev shim.").action(async (commandOptions) => {
231
- const { DevLinkService } = await import("./dev-link-jpte1gq9.js");
276
+ const { DevLinkService } = await import("./dev-link-e1mj8w17.js");
232
277
  const service = new DevLinkService(this.pathOptions());
233
278
  const status = await service.unlink({
234
279
  binDir: commandOptions.binDir,
@@ -237,12 +282,12 @@ class CliApplication {
237
282
  console.log(service.renderUnlinkResult(status));
238
283
  });
239
284
  devCommand.command("status").description("Show local rig development shim status as JSON.").option("--bin-dir <path>", "Directory where the rig shim should be checked.").action(async (commandOptions) => {
240
- const { DevLinkService } = await import("./dev-link-jpte1gq9.js");
285
+ const { DevLinkService } = await import("./dev-link-e1mj8w17.js");
241
286
  this.printJson(await new DevLinkService(this.pathOptions()).status(commandOptions));
242
287
  });
243
288
  }
244
289
  async runToolCommand(commandId, args, commandOptions) {
245
- const { ToolRunner } = await import("./run-y66hvyxg.js");
290
+ const { ToolRunner } = await import("./run-thx15p83.js");
246
291
  const commandTarget = this.commandTarget(commandId);
247
292
  const result = await new ToolRunner(this.pathOptions()).run(commandTarget.tool, commandTarget.command, {
248
293
  ...this.pathOptions(),
@@ -256,9 +301,9 @@ class CliApplication {
256
301
  }
257
302
  async showDefaultStatus() {
258
303
  const [{ RigConfigStore }, { RigPaths }, { ToolDiscoveryService }] = await Promise.all([
259
- import("./config-24gwe08t.js"),
260
- import("./paths-hq1vy0wh.js"),
261
- import("./discover-fd9e6j9j.js")
304
+ import("./config-20f90shh.js"),
305
+ import("./paths-3vxw7dek.js"),
306
+ import("./discover-95bpzy46.js")
262
307
  ]);
263
308
  const options = this.pathOptions();
264
309
  const paths = new RigPaths(options);
@@ -266,8 +311,11 @@ class CliApplication {
266
311
  const config = await configStore.ensure();
267
312
  const tools = await new ToolDiscoveryService(options).discover();
268
313
  const registries = configStore.registryEntries(config);
314
+ const currentVersion = this.version();
315
+ this.printMigrationNotice(configStore.migrationResult());
269
316
  console.log(`Rig is ready.
270
317
  `);
318
+ console.log(`Version: ${currentVersion}`);
271
319
  console.log(`Config: ${paths.configPath}`);
272
320
  console.log(`Base registry: ${registries[0]?.path}`);
273
321
  console.log(`Tools found: ${tools.length}`);
@@ -276,10 +324,10 @@ Next steps:`);
276
324
  console.log(" rig list");
277
325
  console.log(`
278
326
  Run "rig doctor" if you want to verify your setup.`);
279
- await this.printUpdateNotice();
327
+ await this.printUpdateNotice(currentVersion);
280
328
  }
281
329
  async createTool(name) {
282
- const { ToolCreator } = await import("./create-59myk91d.js");
330
+ const { ToolCreator } = await import("./create-pvym2abv.js");
283
331
  const result = await new ToolCreator(this.pathOptions()).create(name);
284
332
  console.log(`Created tool ${result.name}`);
285
333
  console.log(`
@@ -299,14 +347,15 @@ Try:`);
299
347
  }
300
348
  async doctor() {
301
349
  const [{ RigConfigStore }, { RigPaths }, { ToolDiscoveryService }] = await Promise.all([
302
- import("./config-24gwe08t.js"),
303
- import("./paths-hq1vy0wh.js"),
304
- import("./discover-fd9e6j9j.js")
350
+ import("./config-20f90shh.js"),
351
+ import("./paths-3vxw7dek.js"),
352
+ import("./discover-95bpzy46.js")
305
353
  ]);
306
354
  const options = this.pathOptions();
307
355
  const paths = new RigPaths(options);
308
356
  const configStore = new RigConfigStore(options);
309
357
  const config = await configStore.ensure();
358
+ this.printMigrationNotice(configStore.migrationResult());
310
359
  const registries = configStore.registryEntries(config);
311
360
  const tools = await new ToolDiscoveryService(options).discover();
312
361
  console.log(`Rig doctor
@@ -320,12 +369,31 @@ Try:`);
320
369
  console.log(`Tools: ${tools.length}`);
321
370
  console.log(`
322
371
  Status: OK`);
323
- await this.printUpdateNotice();
372
+ await this.printUpdateNotice(this.version());
324
373
  }
325
- async printUpdateNotice() {
374
+ printMigrationNotice(migration) {
375
+ if (!migration)
376
+ return;
377
+ if (migration.status === "migrated") {
378
+ console.log("Rig moved its home folder:");
379
+ console.log(` From: ${migration.legacyDir}`);
380
+ console.log(` To: ${migration.currentDir}`);
381
+ if (migration.configUpdated)
382
+ console.log(" Updated base registry: ~/rig/tools");
383
+ console.log("");
384
+ return;
385
+ }
386
+ console.log("Rig home folder migration needs your attention:");
387
+ console.log(` Old folder: ${migration.legacyDir}`);
388
+ console.log(` New folder: ${migration.currentDir}`);
389
+ console.log(` Reason: ${migration.reason}`);
390
+ console.log("Move the files you want to keep into the new folder, then remove the old folder.");
391
+ console.log("");
392
+ }
393
+ async printUpdateNotice(currentVersion) {
326
394
  await this.ignoreSyncErrors(async () => {
327
- const { NpmUpdateCheckService } = await import("./update-check-87p71vrc.js");
328
- const notice = await new NpmUpdateCheckService(this.pathOptions()).check(this.version());
395
+ const { NpmUpdateCheckService } = await import("./update-check-dpkh7hc6.js");
396
+ const notice = await new NpmUpdateCheckService(this.pathOptions()).check(currentVersion);
329
397
  if (notice)
330
398
  console.log(`
331
399
  ${notice.message}`);
@@ -336,13 +404,13 @@ ${notice.message}`);
336
404
  }
337
405
  async syncGeneratedFiles() {
338
406
  await this.ignoreSyncErrors(async () => {
339
- const { ToolRuntimeCommentSyncService } = await import("./runtime-comment-gvmkkcyh.js");
407
+ const { ToolRuntimeCommentSyncService } = await import("./runtime-comment-07cpchsr.js");
340
408
  await new ToolRuntimeCommentSyncService(this.pathOptions()).sync();
341
409
  });
342
410
  if (process.env.RIG_AGENT_SYNC === "0")
343
411
  return;
344
412
  await this.ignoreSyncErrors(async () => {
345
- const { AgentInstructionSyncService } = await import("./sync-zsc35m3f.js");
413
+ const { AgentInstructionSyncService } = await import("./sync-kkqh3axx.js");
346
414
  await new AgentInstructionSyncService(this.pathOptions()).sync();
347
415
  });
348
416
  }
@@ -400,6 +468,7 @@ if (isCliEntrypoint(import.meta.url)) {
400
468
  }
401
469
  export {
402
470
  isCliEntrypoint,
471
+ RigCronWorker,
403
472
  CliApplication,
404
473
  BunRuntimeBootstrap
405
474
  };
@@ -0,0 +1,13 @@
1
+ import {
2
+ ToolRunner
3
+ } from "./cli-113n7c3t.js";
4
+ import"./cli-884hpkjc.js";
5
+ import"./cli-f7p31fzm.js";
6
+ import"./cli-1hm5dxfw.js";
7
+ import"./cli-nk194xv0.js";
8
+ import"./cli-1c7te5cg.js";
9
+ import"./cli-13q90bjr.js";
10
+ import"./cli-b7jgjgy7.js";
11
+ export {
12
+ ToolRunner
13
+ };
@@ -1,10 +1,9 @@
1
1
  import {
2
2
  ToolDiscoveryService
3
- } from "./cli-vx11bmzr.js";
4
- import"./cli-xv4m20sx.js";
5
- import"./cli-aj56a1ja.js";
3
+ } from "./cli-1hm5dxfw.js";
4
+ import"./cli-nk194xv0.js";
6
5
  import"./cli-1c7te5cg.js";
7
- import"./cli-ne7ed594.js";
6
+ import"./cli-13q90bjr.js";
8
7
  import"./cli-b7jgjgy7.js";
9
8
 
10
9
  // src/tools/runtime-comment.ts
@@ -17,19 +16,26 @@ Rig tool runtime:
17
16
  - Export a default \`RigToolFactory\`: \`const tool: RigToolFactory = (rig) => rig.defineTool({ ... }); export default tool;\`.
18
17
  - \`rig.z\` is Zod. Docs: https://zod.dev/
19
18
  - \`rig.defineTool(definition)\` defines the tool.
20
- - \`rig.command(definition)\` defines one command.
21
- - \`rig.input(shapeOrSchema)\` validates command input.
22
- - \`rig.output(shapeOrSchema)\` validates command output.
19
+ - \`rig.defineCommand(definition)\` defines one command with \`{ description, input, output, run }\`.
20
+ - Use \`rig.z.object({ ... })\` for input/output schemas.
23
21
  - \`rig.run({ command: "tool.command", input })\` runs another registered Rig command and returns its data.
24
22
  - \`rig.$\` runs a Bun Shell tagged template command with escaped interpolations. Docs: https://bun.com/docs/runtime/shell
25
23
  - \`rig.args()\` builds argv arrays with \`.raw()\`, \`.flag()\`, \`.value()\`, \`.values()\`, and \`.toArray()\`.
26
24
  - \`rig.paths.home()\`, \`rig.paths.resolve(cwd, path)\`, \`rig.paths.ensureParent(path)\`, and \`rig.paths.size(path)\` cover common path work.
25
+ - Add \`env: rig.z.object({ KEY: rig.z.string() })\` to validate a \`.env\` file beside the tool entry file and receive parsed values on \`context.env\`.
26
+
27
+ Tool SQLite database:
28
+ - Add \`setupDb: (db) => { db.migrate(1, "create table", "create table ..."); }\` when a tool needs persistent state.
29
+ - Rig stores the database beside the tool entry file as \`index.sqlite\` and runs \`setupDb\` before every command.
30
+ - \`db\` is Bun SQLite with \`strict: true\`, WAL mode, and an extra \`db.migrate(version, name, sql)\` helper. Docs: https://bun.com/docs/runtime/sqlite
27
31
 
28
32
  Command run context:
29
- - Use \`run: async (context) => { ... }\`. Do not destructure the context object in examples.
30
33
  - \`context.input\` is already validated by the input schema.
31
- - \`context.env\` is the process environment.
34
+ - \`context.env\` is already validated by the tool env schema when defined.
35
+ - \`context.processEnv\` is the process environment.
32
36
  - \`context.cwd\` is the current working directory.
37
+ - \`context.db\` is available when the tool defines \`setupDb\`.
38
+ - \`context.rig\` is the toolkit (same as the factory \`rig\` arg, useful for nested tool calls).
33
39
  - Return a value that matches the output schema.
34
40
  `;
35
41