@rendotdev/rig 0.0.5 → 0.0.7
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/dist/rig.js +29 -2
- package/package.json +2 -2
package/dist/rig.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
// src/cli.ts
|
|
14
14
|
import { spawnSync } from "node:child_process";
|
|
15
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
15
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
16
16
|
import { join } from "node:path";
|
|
17
17
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
18
18
|
class BunRuntimeBootstrap {
|
|
@@ -86,6 +86,7 @@ class CliApplication {
|
|
|
86
86
|
this.configureRunCommand();
|
|
87
87
|
this.configureTypecheckCommand();
|
|
88
88
|
this.configureDevCommands();
|
|
89
|
+
this.configureUpdateCommand();
|
|
89
90
|
this.program.command("help").argument("<target>", "Tool name or command id (<tool>.<command>.)").description("Print tool docs.").action(async (target) => {
|
|
90
91
|
this.requestGeneratedSync();
|
|
91
92
|
const { ToolHelpService } = await import("./help-dz0f9jjb.js");
|
|
@@ -198,6 +199,27 @@ class CliApplication {
|
|
|
198
199
|
process.exitCode = result.exitCode;
|
|
199
200
|
});
|
|
200
201
|
}
|
|
202
|
+
configureUpdateCommand() {
|
|
203
|
+
this.program.command("update").description("Update rig to the latest published version.").action(async () => {
|
|
204
|
+
const currentVersion = this.version();
|
|
205
|
+
console.log(`Current version: ${currentVersion}`);
|
|
206
|
+
console.log("Checking for updates...");
|
|
207
|
+
const result = spawnSync("npm", ["install", "-g", "@rendotdev/rig@latest", "--force"], {
|
|
208
|
+
stdio: "inherit"
|
|
209
|
+
});
|
|
210
|
+
if (result.status !== 0) {
|
|
211
|
+
console.error("Update failed.");
|
|
212
|
+
process.exit(1);
|
|
213
|
+
}
|
|
214
|
+
const check = spawnSync("rig", ["--version"], { encoding: "utf8", stdio: "pipe" });
|
|
215
|
+
const newVersion = check.stdout?.trim() ?? "unknown";
|
|
216
|
+
if (newVersion === currentVersion) {
|
|
217
|
+
console.log(`Already on the latest version (${currentVersion}).`);
|
|
218
|
+
} else {
|
|
219
|
+
console.log(`Updated: ${currentVersion} -> ${newVersion}`);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
}
|
|
201
223
|
configureDevCommands() {
|
|
202
224
|
const devCommand = this.program.command("dev").description("Local development helpers.");
|
|
203
225
|
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) => {
|
|
@@ -367,7 +389,12 @@ ${notice.message}`);
|
|
|
367
389
|
function isCliEntrypoint(metaUrl, argvPath = process.argv[1]) {
|
|
368
390
|
if (!argvPath)
|
|
369
391
|
return false;
|
|
370
|
-
|
|
392
|
+
try {
|
|
393
|
+
const resolved = realpathSync(argvPath);
|
|
394
|
+
return metaUrl === pathToFileURL(resolved).href;
|
|
395
|
+
} catch {
|
|
396
|
+
return metaUrl === pathToFileURL(argvPath).href;
|
|
397
|
+
}
|
|
371
398
|
}
|
|
372
399
|
if (isCliEntrypoint(import.meta.url)) {
|
|
373
400
|
const bootstrapped = new BunRuntimeBootstrap().run(import.meta.url, process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rendotdev/rig",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
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 run src/cli.ts",
|
|
27
|
+
"dev": "bun --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",
|