@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.
- package/README.md +4 -0
- package/dist/{run-y66hvyxg.js → cli-113n7c3t.js} +158 -16
- package/dist/{cli-ne7ed594.js → cli-13q90bjr.js} +12 -0
- package/dist/{cli-vx11bmzr.js → cli-1hm5dxfw.js} +2 -2
- package/dist/{cli-dshh1cp9.js → cli-884hpkjc.js} +1 -1
- package/dist/cli-es8j6mma.js +226 -0
- package/dist/{cli-7zqnqrah.js → cli-f7p31fzm.js} +106 -42
- package/dist/{cli-xv4m20sx.js → cli-nk194xv0.js} +198 -71
- package/dist/{cli-mswdavqx.js → cli-zgw1jbeg.js} +3 -3
- package/dist/{config-24gwe08t.js → config-20f90shh.js} +2 -3
- package/dist/{create-59myk91d.js → create-pvym2abv.js} +7 -8
- package/dist/cron-aw908dzn.js +18 -0
- package/dist/{dev-link-jpte1gq9.js → dev-link-e1mj8w17.js} +7 -4
- package/dist/{discover-fd9e6j9j.js → discover-95bpzy46.js} +3 -4
- package/dist/{help-6k8m07yv.js → help-qj75r0x3.js} +5 -6
- package/dist/{inspect-ks3x7s4n.js → inspect-0ckw7bs5.js} +5 -6
- package/dist/list-reekhy3q.js +13 -0
- package/dist/{paths-hq1vy0wh.js → paths-3vxw7dek.js} +1 -1
- package/dist/{registry-gng9br0x.js → registry-fzc3aeb8.js} +2 -3
- package/dist/rig.js +101 -32
- package/dist/run-thx15p83.js +13 -0
- package/dist/{runtime-comment-gvmkkcyh.js → runtime-comment-07cpchsr.js} +15 -9
- package/dist/{sync-zsc35m3f.js → sync-kkqh3axx.js} +33 -16
- package/dist/{typecheck-c2k87ppw.js → typecheck-971tmqbp.js} +5 -7
- package/dist/{update-check-87p71vrc.js → update-check-dpkh7hc6.js} +8 -5
- package/package.json +2 -2
- package/dist/cli-aj56a1ja.js +0 -48
- package/dist/list-f7r354tq.js +0 -14
|
@@ -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-zgw1jbeg.js";
|
|
4
|
+
import"./cli-884hpkjc.js";
|
|
5
|
+
import"./cli-f7p31fzm.js";
|
|
6
|
+
import"./cli-1hm5dxfw.js";
|
|
7
|
+
import"./cli-nk194xv0.js";
|
|
9
8
|
import"./cli-1c7te5cg.js";
|
|
10
9
|
import {
|
|
11
10
|
RigPaths
|
|
12
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-13q90bjr.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-f7p31fzm.js";
|
|
4
4
|
import {
|
|
5
5
|
ToolDiscoveryService
|
|
6
|
-
} from "./cli-
|
|
7
|
-
import {
|
|
8
|
-
RigConfigStore
|
|
9
|
-
} from "./cli-xv4m20sx.js";
|
|
6
|
+
} from "./cli-1hm5dxfw.js";
|
|
10
7
|
import {
|
|
8
|
+
RigConfigStore,
|
|
11
9
|
RigPackageRoot
|
|
12
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-nk194xv0.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-13q90bjr.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-13q90bjr.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.19",
|
|
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
|
-
};
|