@rendotdev/rig 0.0.17 → 0.0.18
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 +4 -0
- package/dist/cli-0p4wnh3p.js +226 -0
- package/dist/{cli-mswdavqx.js → cli-96n231pn.js} +3 -3
- package/dist/{cli-7zqnqrah.js → cli-c6y9p8v9.js} +106 -42
- package/dist/{cli-dshh1cp9.js → cli-f4k31gtc.js} +1 -1
- package/dist/{cli-vx11bmzr.js → cli-ggk7t6dg.js} +2 -2
- package/dist/{cli-xv4m20sx.js → cli-jbscjyqq.js} +93 -65
- package/dist/{cli-ne7ed594.js → cli-vkw9rcke.js} +8 -2
- package/dist/{run-y66hvyxg.js → cli-yahk2r84.js} +158 -16
- package/dist/{config-24gwe08t.js → config-8mr59m0q.js} +2 -3
- package/dist/{create-59myk91d.js → create-9frp1c7g.js} +7 -8
- package/dist/cron-e6whgdf7.js +18 -0
- package/dist/{dev-link-jpte1gq9.js → dev-link-x3hjyy3j.js} +7 -4
- package/dist/{discover-fd9e6j9j.js → discover-9n7b9ra2.js} +3 -4
- package/dist/{help-6k8m07yv.js → help-17a9ywd9.js} +5 -6
- package/dist/{inspect-ks3x7s4n.js → inspect-k2g3dt1g.js} +5 -6
- package/dist/list-pahq60sp.js +13 -0
- package/dist/{paths-hq1vy0wh.js → paths-cxq6fvhp.js} +1 -1
- package/dist/{registry-gng9br0x.js → registry-e68a7b4v.js} +2 -3
- package/dist/rig.js +74 -28
- package/dist/run-apb4mx5d.js +13 -0
- package/dist/{runtime-comment-gvmkkcyh.js → runtime-comment-3yq1pmaf.js} +15 -9
- package/dist/{sync-zsc35m3f.js → sync-3362wne1.js} +33 -16
- package/dist/{typecheck-c2k87ppw.js → typecheck-5325aspe.js} +5 -7
- package/dist/{update-check-87p71vrc.js → update-check-a02ydxdb.js} +8 -5
- package/package.json +2 -2
- package/dist/cli-aj56a1ja.js +0 -48
- package/dist/list-f7r354tq.js +0 -14
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SchemaRenderer
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-f4k31gtc.js";
|
|
4
4
|
import {
|
|
5
5
|
CommandIds,
|
|
6
6
|
ToolLoader
|
|
7
|
-
} from "./cli-
|
|
8
|
-
import"./cli-
|
|
9
|
-
import"./cli-
|
|
10
|
-
import"./cli-aj56a1ja.js";
|
|
7
|
+
} from "./cli-c6y9p8v9.js";
|
|
8
|
+
import"./cli-ggk7t6dg.js";
|
|
9
|
+
import"./cli-jbscjyqq.js";
|
|
11
10
|
import {
|
|
12
11
|
RigError
|
|
13
12
|
} from "./cli-1c7te5cg.js";
|
|
14
|
-
import"./cli-
|
|
13
|
+
import"./cli-vkw9rcke.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-
|
|
3
|
+
} from "./cli-f4k31gtc.js";
|
|
4
4
|
import {
|
|
5
5
|
CommandIds,
|
|
6
6
|
ToolLoader
|
|
7
|
-
} from "./cli-
|
|
8
|
-
import"./cli-
|
|
9
|
-
import"./cli-
|
|
10
|
-
import"./cli-aj56a1ja.js";
|
|
7
|
+
} from "./cli-c6y9p8v9.js";
|
|
8
|
+
import"./cli-ggk7t6dg.js";
|
|
9
|
+
import"./cli-jbscjyqq.js";
|
|
11
10
|
import {
|
|
12
11
|
RigError
|
|
13
12
|
} from "./cli-1c7te5cg.js";
|
|
14
|
-
import"./cli-
|
|
13
|
+
import"./cli-vkw9rcke.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-96n231pn.js";
|
|
4
|
+
import"./cli-f4k31gtc.js";
|
|
5
|
+
import"./cli-c6y9p8v9.js";
|
|
6
|
+
import"./cli-ggk7t6dg.js";
|
|
7
|
+
import"./cli-jbscjyqq.js";
|
|
8
|
+
import"./cli-1c7te5cg.js";
|
|
9
|
+
import"./cli-vkw9rcke.js";
|
|
10
|
+
import"./cli-b7jgjgy7.js";
|
|
11
|
+
export {
|
|
12
|
+
ToolListService
|
|
13
|
+
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RigConfigStore
|
|
3
|
-
} from "./cli-
|
|
4
|
-
import"./cli-aj56a1ja.js";
|
|
3
|
+
} from "./cli-jbscjyqq.js";
|
|
5
4
|
import {
|
|
6
5
|
RigError
|
|
7
6
|
} from "./cli-1c7te5cg.js";
|
|
8
7
|
import {
|
|
9
8
|
RigPaths
|
|
10
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-vkw9rcke.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-0p4wnh3p.js";
|
|
5
|
+
import"./cli-yahk2r84.js";
|
|
6
|
+
import"./cli-f4k31gtc.js";
|
|
7
|
+
import"./cli-c6y9p8v9.js";
|
|
8
|
+
import"./cli-ggk7t6dg.js";
|
|
2
9
|
import {
|
|
3
10
|
RigPackageRoot
|
|
4
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-jbscjyqq.js";
|
|
5
12
|
import {
|
|
6
13
|
RigError,
|
|
7
14
|
RigErrors
|
|
8
15
|
} from "./cli-1c7te5cg.js";
|
|
16
|
+
import"./cli-vkw9rcke.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
|
-
|
|
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-
|
|
113
|
+
const { ToolHelpService } = await import("./help-17a9ywd9.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-
|
|
130
|
+
const { RigConfigStore } = await import("./config-8mr59m0q.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-
|
|
136
|
+
const { RigPaths } = await import("./paths-cxq6fvhp.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-
|
|
143
|
+
const { RegistryConfigService } = await import("./registry-e68a7b4v.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-
|
|
148
|
+
const { RegistryConfigService } = await import("./registry-e68a7b4v.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-
|
|
153
|
+
const { RegistryConfigService } = await import("./registry-e68a7b4v.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-
|
|
160
|
+
const { ToolListService } = await import("./list-pahq60sp.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-
|
|
172
|
+
const { ToolInspector } = await import("./inspect-k2g3dt1g.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-
|
|
185
|
+
const { ToolFileService } = await import("./create-9frp1c7g.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-
|
|
193
|
+
const { ToolRemover } = await import("./create-9frp1c7g.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-e6whgdf7.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-e6whgdf7.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-e6whgdf7.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-e6whgdf7.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-
|
|
237
|
+
const { ToolTypecheckService } = await import("./typecheck-5325aspe.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-
|
|
267
|
+
const { DevLinkService } = await import("./dev-link-x3hjyy3j.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-
|
|
276
|
+
const { DevLinkService } = await import("./dev-link-x3hjyy3j.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-
|
|
285
|
+
const { DevLinkService } = await import("./dev-link-x3hjyy3j.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-
|
|
290
|
+
const { ToolRunner } = await import("./run-apb4mx5d.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-
|
|
260
|
-
import("./paths-
|
|
261
|
-
import("./discover-
|
|
304
|
+
import("./config-8mr59m0q.js"),
|
|
305
|
+
import("./paths-cxq6fvhp.js"),
|
|
306
|
+
import("./discover-9n7b9ra2.js")
|
|
262
307
|
]);
|
|
263
308
|
const options = this.pathOptions();
|
|
264
309
|
const paths = new RigPaths(options);
|
|
@@ -279,7 +324,7 @@ Run "rig doctor" if you want to verify your setup.`);
|
|
|
279
324
|
await this.printUpdateNotice();
|
|
280
325
|
}
|
|
281
326
|
async createTool(name) {
|
|
282
|
-
const { ToolCreator } = await import("./create-
|
|
327
|
+
const { ToolCreator } = await import("./create-9frp1c7g.js");
|
|
283
328
|
const result = await new ToolCreator(this.pathOptions()).create(name);
|
|
284
329
|
console.log(`Created tool ${result.name}`);
|
|
285
330
|
console.log(`
|
|
@@ -299,9 +344,9 @@ Try:`);
|
|
|
299
344
|
}
|
|
300
345
|
async doctor() {
|
|
301
346
|
const [{ RigConfigStore }, { RigPaths }, { ToolDiscoveryService }] = await Promise.all([
|
|
302
|
-
import("./config-
|
|
303
|
-
import("./paths-
|
|
304
|
-
import("./discover-
|
|
347
|
+
import("./config-8mr59m0q.js"),
|
|
348
|
+
import("./paths-cxq6fvhp.js"),
|
|
349
|
+
import("./discover-9n7b9ra2.js")
|
|
305
350
|
]);
|
|
306
351
|
const options = this.pathOptions();
|
|
307
352
|
const paths = new RigPaths(options);
|
|
@@ -324,7 +369,7 @@ Status: OK`);
|
|
|
324
369
|
}
|
|
325
370
|
async printUpdateNotice() {
|
|
326
371
|
await this.ignoreSyncErrors(async () => {
|
|
327
|
-
const { NpmUpdateCheckService } = await import("./update-check-
|
|
372
|
+
const { NpmUpdateCheckService } = await import("./update-check-a02ydxdb.js");
|
|
328
373
|
const notice = await new NpmUpdateCheckService(this.pathOptions()).check(this.version());
|
|
329
374
|
if (notice)
|
|
330
375
|
console.log(`
|
|
@@ -336,13 +381,13 @@ ${notice.message}`);
|
|
|
336
381
|
}
|
|
337
382
|
async syncGeneratedFiles() {
|
|
338
383
|
await this.ignoreSyncErrors(async () => {
|
|
339
|
-
const { ToolRuntimeCommentSyncService } = await import("./runtime-comment-
|
|
384
|
+
const { ToolRuntimeCommentSyncService } = await import("./runtime-comment-3yq1pmaf.js");
|
|
340
385
|
await new ToolRuntimeCommentSyncService(this.pathOptions()).sync();
|
|
341
386
|
});
|
|
342
387
|
if (process.env.RIG_AGENT_SYNC === "0")
|
|
343
388
|
return;
|
|
344
389
|
await this.ignoreSyncErrors(async () => {
|
|
345
|
-
const { AgentInstructionSyncService } = await import("./sync-
|
|
390
|
+
const { AgentInstructionSyncService } = await import("./sync-3362wne1.js");
|
|
346
391
|
await new AgentInstructionSyncService(this.pathOptions()).sync();
|
|
347
392
|
});
|
|
348
393
|
}
|
|
@@ -400,6 +445,7 @@ if (isCliEntrypoint(import.meta.url)) {
|
|
|
400
445
|
}
|
|
401
446
|
export {
|
|
402
447
|
isCliEntrypoint,
|
|
448
|
+
RigCronWorker,
|
|
403
449
|
CliApplication,
|
|
404
450
|
BunRuntimeBootstrap
|
|
405
451
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ToolRunner
|
|
3
|
+
} from "./cli-yahk2r84.js";
|
|
4
|
+
import"./cli-f4k31gtc.js";
|
|
5
|
+
import"./cli-c6y9p8v9.js";
|
|
6
|
+
import"./cli-ggk7t6dg.js";
|
|
7
|
+
import"./cli-jbscjyqq.js";
|
|
8
|
+
import"./cli-1c7te5cg.js";
|
|
9
|
+
import"./cli-vkw9rcke.js";
|
|
10
|
+
import"./cli-b7jgjgy7.js";
|
|
11
|
+
export {
|
|
12
|
+
ToolRunner
|
|
13
|
+
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ToolDiscoveryService
|
|
3
|
-
} from "./cli-
|
|
4
|
-
import"./cli-
|
|
5
|
-
import"./cli-aj56a1ja.js";
|
|
3
|
+
} from "./cli-ggk7t6dg.js";
|
|
4
|
+
import"./cli-jbscjyqq.js";
|
|
6
5
|
import"./cli-1c7te5cg.js";
|
|
7
|
-
import"./cli-
|
|
6
|
+
import"./cli-vkw9rcke.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.
|
|
21
|
-
- \`rig.
|
|
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
|
|
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
|
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ToolListService
|
|
3
|
-
} from "./cli-
|
|
4
|
-
import"./cli-
|
|
5
|
-
import"./cli-
|
|
6
|
-
import"./cli-
|
|
7
|
-
import"./cli-
|
|
8
|
-
import"./cli-aj56a1ja.js";
|
|
3
|
+
} from "./cli-96n231pn.js";
|
|
4
|
+
import"./cli-f4k31gtc.js";
|
|
5
|
+
import"./cli-c6y9p8v9.js";
|
|
6
|
+
import"./cli-ggk7t6dg.js";
|
|
7
|
+
import"./cli-jbscjyqq.js";
|
|
9
8
|
import"./cli-1c7te5cg.js";
|
|
10
9
|
import {
|
|
11
10
|
RigPaths
|
|
12
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-vkw9rcke.js";
|
|
13
12
|
import"./cli-b7jgjgy7.js";
|
|
14
13
|
|
|
15
14
|
// src/agents/sync.ts
|
|
@@ -24,11 +23,15 @@ var RigAgentInstructions = `The \`rig\` CLI is installed on this machine. It all
|
|
|
24
23
|
- To discover available tools, run \`rig list\`.
|
|
25
24
|
- To learn about a tool's usage, run \`rig help <tool>\`.
|
|
26
25
|
- To run a tool, use \`rig run <tool>.<command> [args]\`.
|
|
26
|
+
- Tools run under Bun with fallback auto-install enabled, so tool files can import npm packages; add explicit package versions when reproducibility matters.
|
|
27
|
+
- To schedule a tool command, use \`rig cron add <name> <tool>.<command> <schedule> --input '<json>'\`; use \`rig cron list\`, \`rig cron run <name>\`, and \`rig cron remove <name>\` to manage scheduled runs.
|
|
28
|
+
- If a tool needs local secrets or settings, put them in the tool folder's \`.env\`, add an \`env\` Zod schema to the tool definition, and read validated values from \`context.env\`.
|
|
27
29
|
- To create a new tool, run \`rig create <tool>\`.
|
|
28
30
|
- To edit an existing tool, run \`rig edit <tool>\` and open the printed file path.
|
|
29
31
|
- To remove an existing tool, run \`rig remove <tool>\`.
|
|
30
32
|
- To list tool registries, run \`rig registry list\`.
|
|
31
33
|
- To add a registry, run \`rig registry create [path]\` (defaults to current directory).
|
|
34
|
+
- If a tool needs persistent state, define \`setupDb\` and use \`context.db\`; Rig stores that SQLite database beside the tool entry file as \`index.sqlite\`.
|
|
32
35
|
`;
|
|
33
36
|
|
|
34
37
|
// src/agents/sync.ts
|
|
@@ -116,15 +119,9 @@ ${EndMarker}`;
|
|
|
116
119
|
await Promise.all(AgentInstructionSyncLocations.openCodeConfigFiles.map((path) => this.addOpenCodeConfigTargets(targets, join(this.paths.homeDir, ...path))));
|
|
117
120
|
}
|
|
118
121
|
async addOpenCodeConfigTargets(targets, configPath) {
|
|
119
|
-
let raw;
|
|
120
|
-
try {
|
|
121
|
-
raw = await readFile(configPath, "utf8");
|
|
122
|
-
} catch {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
122
|
let parsed;
|
|
126
123
|
try {
|
|
127
|
-
parsed = JSON.parse(
|
|
124
|
+
parsed = JSON.parse(await this.readText(configPath));
|
|
128
125
|
} catch {
|
|
129
126
|
return;
|
|
130
127
|
}
|
|
@@ -170,15 +167,35 @@ ${EndMarker}`;
|
|
|
170
167
|
current.scope = nextScope;
|
|
171
168
|
}
|
|
172
169
|
async upsertManagedBlock(target, block) {
|
|
173
|
-
const existing = target.existed ? await
|
|
170
|
+
const existing = target.existed ? await this.readText(target.path) : "";
|
|
174
171
|
const nextBody = this.managedBlockPattern().test(existing) ? existing.replace(this.managedBlockPattern(), block) : this.appendBlock(existing, block);
|
|
175
172
|
const next = `${nextBody.trimEnd()}
|
|
176
173
|
`;
|
|
177
174
|
if (next === existing)
|
|
178
175
|
return false;
|
|
179
|
-
await
|
|
176
|
+
await this.writeText(target.path, next);
|
|
180
177
|
return true;
|
|
181
178
|
}
|
|
179
|
+
async readText(path) {
|
|
180
|
+
const bun = this.bunFileApi();
|
|
181
|
+
if (bun)
|
|
182
|
+
return bun.file(path).text();
|
|
183
|
+
return readFile(path, "utf8");
|
|
184
|
+
}
|
|
185
|
+
async writeText(path, content) {
|
|
186
|
+
const bun = this.bunFileApi();
|
|
187
|
+
if (bun) {
|
|
188
|
+
await bun.write(path, content);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
await writeFile(path, content, "utf8");
|
|
192
|
+
}
|
|
193
|
+
bunFileApi() {
|
|
194
|
+
const candidate = globalThis.Bun;
|
|
195
|
+
if (typeof candidate?.file === "function" && typeof candidate.write === "function")
|
|
196
|
+
return candidate;
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
182
199
|
appendBlock(existing, block) {
|
|
183
200
|
return [existing.trimEnd(), block].filter(Boolean).join(`
|
|
184
201
|
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ToolLoader
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-c6y9p8v9.js";
|
|
4
4
|
import {
|
|
5
5
|
ToolDiscoveryService
|
|
6
|
-
} from "./cli-
|
|
7
|
-
import {
|
|
8
|
-
RigConfigStore
|
|
9
|
-
} from "./cli-xv4m20sx.js";
|
|
6
|
+
} from "./cli-ggk7t6dg.js";
|
|
10
7
|
import {
|
|
8
|
+
RigConfigStore,
|
|
11
9
|
RigPackageRoot
|
|
12
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-jbscjyqq.js";
|
|
13
11
|
import {
|
|
14
12
|
RigError
|
|
15
13
|
} from "./cli-1c7te5cg.js";
|
|
16
14
|
import {
|
|
17
15
|
RigPaths
|
|
18
|
-
} from "./cli-
|
|
16
|
+
} from "./cli-vkw9rcke.js";
|
|
19
17
|
import {
|
|
20
18
|
__commonJS,
|
|
21
19
|
__require,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RigPaths
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-vkw9rcke.js";
|
|
4
4
|
import"./cli-b7jgjgy7.js";
|
|
5
5
|
|
|
6
6
|
// src/runtime/update-check.ts
|
|
@@ -92,8 +92,7 @@ class NpmUpdateCheckService {
|
|
|
92
92
|
}
|
|
93
93
|
async readCache() {
|
|
94
94
|
try {
|
|
95
|
-
const
|
|
96
|
-
const data = JSON.parse(raw);
|
|
95
|
+
const data = typeof Bun !== "undefined" ? await Bun.file(this.paths.updateCheckCachePath).json() : JSON.parse(await readFile(this.paths.updateCheckCachePath, "utf8"));
|
|
97
96
|
if (!this.isRecord(data) || typeof data.checkedAt !== "number")
|
|
98
97
|
return;
|
|
99
98
|
return {
|
|
@@ -106,8 +105,12 @@ class NpmUpdateCheckService {
|
|
|
106
105
|
}
|
|
107
106
|
async writeCache(cache) {
|
|
108
107
|
await mkdir(dirname(this.paths.updateCheckCachePath), { recursive: true });
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
const content = `${JSON.stringify(cache, null, 2)}
|
|
109
|
+
`;
|
|
110
|
+
if (typeof Bun !== "undefined")
|
|
111
|
+
await Bun.write(this.paths.updateCheckCachePath, content);
|
|
112
|
+
else
|
|
113
|
+
await writeFile(this.paths.updateCheckCachePath, content, "utf8");
|
|
111
114
|
}
|
|
112
115
|
isRecord(value) {
|
|
113
116
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rendotdev/rig",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"description": "Local typed command runtime for agents.",
|
|
5
5
|
"homepage": "https://github.com/rendotdev/rig#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
|
-
"dev": "bun --watch run src/cli.ts",
|
|
27
|
+
"dev": "bun --install=fallback --watch run src/cli.ts",
|
|
28
28
|
"build": "bun run scripts/build.ts",
|
|
29
29
|
"bench": "bun run scripts/bench.ts",
|
|
30
30
|
"release": "bun run scripts/release.ts",
|
package/dist/cli-aj56a1ja.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// src/runtime/package-root.ts
|
|
2
|
-
import { existsSync, realpathSync } from "node:fs";
|
|
3
|
-
import { basename, dirname, join, resolve } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
|
|
6
|
-
class RigPackageRoot {
|
|
7
|
-
static find(metaUrl) {
|
|
8
|
-
if (process.env.RIG_PACKAGE_ROOT)
|
|
9
|
-
return resolve(process.env.RIG_PACKAGE_ROOT);
|
|
10
|
-
const argvRoot = this.fromEntrypoint(process.argv[1]);
|
|
11
|
-
if (argvRoot)
|
|
12
|
-
return argvRoot;
|
|
13
|
-
const execRoot = this.fromEntrypoint(process.execPath);
|
|
14
|
-
if (execRoot)
|
|
15
|
-
return execRoot;
|
|
16
|
-
if (this.isBunBinary(metaUrl))
|
|
17
|
-
return dirname(process.execPath);
|
|
18
|
-
return join(dirname(fileURLToPath(metaUrl)), "..", "..");
|
|
19
|
-
}
|
|
20
|
-
static packageFile(metaUrl, ...parts) {
|
|
21
|
-
return join(this.find(metaUrl), ...parts);
|
|
22
|
-
}
|
|
23
|
-
static isBunBinary(metaUrl) {
|
|
24
|
-
return metaUrl.includes("$bunfs") || metaUrl.includes("~BUN") || metaUrl.includes("%7EBUN");
|
|
25
|
-
}
|
|
26
|
-
static fromEntrypoint(entrypoint) {
|
|
27
|
-
if (!entrypoint)
|
|
28
|
-
return;
|
|
29
|
-
const resolved = this.safeRealpath(entrypoint);
|
|
30
|
-
if (!resolved)
|
|
31
|
-
return;
|
|
32
|
-
const parent = dirname(resolved);
|
|
33
|
-
const parentName = basename(parent);
|
|
34
|
-
if (parentName === "src" || parentName === "dist")
|
|
35
|
-
return dirname(parent);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
static safeRealpath(pathValue) {
|
|
39
|
-
try {
|
|
40
|
-
return realpathSync(pathValue);
|
|
41
|
-
} catch {
|
|
42
|
-
const absolute = resolve(pathValue);
|
|
43
|
-
return existsSync(absolute) ? absolute : undefined;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export { RigPackageRoot };
|
package/dist/list-f7r354tq.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ToolListService
|
|
3
|
-
} from "./cli-mswdavqx.js";
|
|
4
|
-
import"./cli-dshh1cp9.js";
|
|
5
|
-
import"./cli-7zqnqrah.js";
|
|
6
|
-
import"./cli-vx11bmzr.js";
|
|
7
|
-
import"./cli-xv4m20sx.js";
|
|
8
|
-
import"./cli-aj56a1ja.js";
|
|
9
|
-
import"./cli-1c7te5cg.js";
|
|
10
|
-
import"./cli-ne7ed594.js";
|
|
11
|
-
import"./cli-b7jgjgy7.js";
|
|
12
|
-
export {
|
|
13
|
-
ToolListService
|
|
14
|
-
};
|