rigline 1.0.0-alpha.2 → 1.0.0-alpha.5
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 +3 -0
- package/dist/build.js +11 -1
- package/dist/index.js +66 -26
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -51,4 +51,7 @@ there is nothing to resolve. A version must reach a minimum age (a day, by defau
|
|
|
51
51
|
form. [Anchors](https://github.com/Rigline/Rigline/blob/main/docs/anchors.md) is what to read when
|
|
52
52
|
an extension update breaks a plugin and you would rather not wait for a release.
|
|
53
53
|
|
|
54
|
+
[Changelog](https://github.com/Rigline/Rigline/blob/main/CHANGELOG.md) — every package in this
|
|
55
|
+
workspace shares it, and one version number.
|
|
56
|
+
|
|
54
57
|
MIT.
|
package/dist/build.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join, relative, resolve } from "node:path";
|
|
3
3
|
import { UserError } from "@rigline/core";
|
|
4
|
-
|
|
4
|
+
async function rolldown() {
|
|
5
|
+
try {
|
|
6
|
+
return (await import("rolldown")).build;
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
throw new UserError("`rigline build` needs rolldown, which is not installed here. Add it to your workspace: " +
|
|
10
|
+
"`pnpm add -D rolldown`. A plugin is one browser ES module and a manifest however you " +
|
|
11
|
+
"build it, so any bundler will do; this command is the shortcut, not the contract.");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
5
14
|
export async function buildPlugin(options = {}) {
|
|
6
15
|
const dir = resolve(options.dir ?? process.cwd());
|
|
7
16
|
const manifestPath = join(dir, "rigline.json");
|
|
@@ -15,6 +24,7 @@ export async function buildPlugin(options = {}) {
|
|
|
15
24
|
if (!existsSync(input))
|
|
16
25
|
throw new UserError(`no plugin source at ${input}`);
|
|
17
26
|
const output = resolve(dir, manifest.entry);
|
|
27
|
+
const bundle = await rolldown();
|
|
18
28
|
await bundle({
|
|
19
29
|
input,
|
|
20
30
|
platform: "browser",
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { existsSync, watch as fsWatch, readdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { basename,
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { basename, join, relative, resolve } from "node:path";
|
|
5
4
|
import { parseArgs } from "node:util";
|
|
6
|
-
import { addFromNpm, addPlugin, CORE_VERSION, check, collect, diffScans, EXTENSIONS_DIR, extensionVersion, findExtension, formatDiff, formatDoctor, formatFlow, formatPlugins, formatUpdates, generate, harvestAll, hostVerdict, inspect, install, installedExtensions, listPlugins, readAnchorOverrides, readBundles, removePlugin, restoreAll, riglinePaths, scanOf, UserError, update, updatePlugins, verdict, watch, } from "@rigline/core";
|
|
5
|
+
import { addFromNpm, addPlugin, bundledDir, bundledPluginsDir, CORE_VERSION, check, checkoutPluginsDir, collect, diffScans, EXTENSIONS_DIR, extensionVersion, findExtension, formatDiff, formatDoctor, formatFlow, formatPlugins, formatUpdates, generate, harvestAll, hostVerdict, inspect, install, installedExtensions, listPlugins, readAnchorOverrides, readBundles, removePlugin, restoreAll, riglinePaths, scanOf, setPluginEnabled, UserError, update, updatePlugins, verdict, watch, } from "@rigline/core";
|
|
7
6
|
import { buildPlugin } from "./build.js";
|
|
8
7
|
const USAGE = `rigline ${CORE_VERSION}
|
|
9
8
|
|
|
@@ -56,11 +55,17 @@ const USAGE = `rigline ${CORE_VERSION}
|
|
|
56
55
|
|
|
57
56
|
rigline remove NAME
|
|
58
57
|
Delete a plugin rigline installed, and re-inject. A plugin you did not install this
|
|
59
|
-
way
|
|
58
|
+
way, including one bundled in the engine, is switched off with disable instead.
|
|
59
|
+
|
|
60
|
+
rigline disable NAME
|
|
61
|
+
rigline enable NAME
|
|
62
|
+
Switch a plugin off in ~/.rigline/config.json, or back on, and re-inject. This is how
|
|
63
|
+
you decline one of the plugins bundled in the engine: there is nothing to delete, and
|
|
64
|
+
an engine update would put it back.
|
|
60
65
|
|
|
61
66
|
rigline list
|
|
62
|
-
Every plugin found, in the order they load: where it came from, whether
|
|
63
|
-
switched off, and what its manifest says it can do.
|
|
67
|
+
Every plugin found, in the order they load: its version, where it came from, whether
|
|
68
|
+
it is switched off, and what its manifest says it can do.
|
|
64
69
|
|
|
65
70
|
rigline status
|
|
66
71
|
Per installed version: is each bundle vanilla or patched, judged against its backup.
|
|
@@ -74,17 +79,34 @@ const USAGE = `rigline ${CORE_VERSION}
|
|
|
74
79
|
patched, what the payload holds, which plugins are baked in and what any host patch
|
|
75
80
|
did. For what the panel itself was doing, copy the probe's report from the RIG badge.
|
|
76
81
|
`;
|
|
77
|
-
function
|
|
78
|
-
const
|
|
79
|
-
return
|
|
80
|
-
}
|
|
81
|
-
function repoPluginsDir() {
|
|
82
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
83
|
-
return resolve(here, "..", "..", "..", "plugins");
|
|
82
|
+
function discoveryRoots() {
|
|
83
|
+
const checkout = checkoutPluginsDir();
|
|
84
|
+
return [...(checkout === null ? [] : [checkout]), riglinePaths().plugins, bundledPluginsDir()];
|
|
84
85
|
}
|
|
85
86
|
function pluginOptions() {
|
|
86
87
|
const paths = riglinePaths();
|
|
87
|
-
return {
|
|
88
|
+
return {
|
|
89
|
+
roots: discoveryRoots(),
|
|
90
|
+
last: ["probe"],
|
|
91
|
+
bundledRoot: bundledPluginsDir(),
|
|
92
|
+
configPath: paths.config,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function foreignRoots() {
|
|
96
|
+
const bundledRoot = bundledPluginsDir();
|
|
97
|
+
const checkout = checkoutPluginsDir();
|
|
98
|
+
return {
|
|
99
|
+
otherRoots: [...(checkout === null ? [] : [checkout]), bundledRoot],
|
|
100
|
+
bundledRoot,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function firstPartyPlugins() {
|
|
104
|
+
const root = checkoutPluginsDir();
|
|
105
|
+
if (root === null)
|
|
106
|
+
return [];
|
|
107
|
+
return readdirSync(root, { withFileTypes: true })
|
|
108
|
+
.filter((e) => e.isDirectory() && existsSync(join(root, e.name, "rigline.json")))
|
|
109
|
+
.map((e) => join(root, e.name));
|
|
88
110
|
}
|
|
89
111
|
function reinject(options = {}) {
|
|
90
112
|
const targets = options.exts ?? installedExtensions();
|
|
@@ -96,7 +118,7 @@ function reinject(options = {}) {
|
|
|
96
118
|
}
|
|
97
119
|
const report = update({
|
|
98
120
|
exts: targets,
|
|
99
|
-
payloadDir: options.payloadDir ??
|
|
121
|
+
payloadDir: options.payloadDir ?? bundledDir(),
|
|
100
122
|
plugins: pluginOptions(),
|
|
101
123
|
codegen: true,
|
|
102
124
|
});
|
|
@@ -120,13 +142,16 @@ async function addCommand(args) {
|
|
|
120
142
|
const common = {
|
|
121
143
|
pluginsDir: paths.plugins,
|
|
122
144
|
configPath: paths.config,
|
|
123
|
-
|
|
145
|
+
...foreignRoots(),
|
|
124
146
|
};
|
|
125
147
|
const result = isPathSpec(spec)
|
|
126
148
|
? addPlugin({ from: spec, ...common })
|
|
127
149
|
: await addFromNpm({ spec, ...common, registry: { ignoreReleaseAge: values.now } });
|
|
128
150
|
console.log(`${result.replaced ? "replaced" : "added"} ${result.name} — ${result.dir}`);
|
|
129
151
|
console.log(` from ${result.from}`);
|
|
152
|
+
if (result.overridesBundled) {
|
|
153
|
+
console.log(` it overrides the ${result.name} bundled in the engine, which will not load`);
|
|
154
|
+
}
|
|
130
155
|
if (result.manifest.description)
|
|
131
156
|
console.log(` ${result.manifest.description}`);
|
|
132
157
|
for (const sentence of result.can)
|
|
@@ -157,7 +182,7 @@ async function updateCommand(args) {
|
|
|
157
182
|
const updates = await updatePlugins({
|
|
158
183
|
pluginsDir: paths.plugins,
|
|
159
184
|
configPath: paths.config,
|
|
160
|
-
|
|
185
|
+
...foreignRoots(),
|
|
161
186
|
names: positionals.length > 0 ? positionals : undefined,
|
|
162
187
|
registry: { ignoreReleaseAge: values.now },
|
|
163
188
|
});
|
|
@@ -170,6 +195,19 @@ async function updateCommand(args) {
|
|
|
170
195
|
const code = reinject();
|
|
171
196
|
return updates.some((u) => u.outcome === "failed") ? 1 : code;
|
|
172
197
|
}
|
|
198
|
+
function switchCommand(args, enabled) {
|
|
199
|
+
const verb = enabled ? "enable" : "disable";
|
|
200
|
+
const { positionals } = parseArgs({ args, options: {}, allowPositionals: true });
|
|
201
|
+
if (positionals.length !== 1)
|
|
202
|
+
throw new UserError(`${verb} needs exactly one plugin name`);
|
|
203
|
+
const paths = riglinePaths();
|
|
204
|
+
const result = setPluginEnabled({ name: positionals[0], configPath: paths.config, roots: discoveryRoots() }, enabled);
|
|
205
|
+
console.log(result.changed
|
|
206
|
+
? `${enabled ? "enabled" : "disabled"} ${result.name} in ${result.configPath}`
|
|
207
|
+
: `${result.name} was already ${enabled ? "enabled" : "switched off"} in ${result.configPath}`);
|
|
208
|
+
console.log("");
|
|
209
|
+
return reinject();
|
|
210
|
+
}
|
|
173
211
|
function removeCommand(args) {
|
|
174
212
|
const { positionals } = parseArgs({ args, options: {}, allowPositionals: true });
|
|
175
213
|
if (positionals.length !== 1)
|
|
@@ -179,7 +217,7 @@ function removeCommand(args) {
|
|
|
179
217
|
name: positionals[0],
|
|
180
218
|
pluginsDir: paths.plugins,
|
|
181
219
|
configPath: paths.config,
|
|
182
|
-
|
|
220
|
+
...foreignRoots(),
|
|
183
221
|
});
|
|
184
222
|
console.log(`removed ${result.name} — ${result.dir}`);
|
|
185
223
|
if (!result.hadSource)
|
|
@@ -203,10 +241,12 @@ function installCommand(args) {
|
|
|
203
241
|
}
|
|
204
242
|
function listCommand() {
|
|
205
243
|
const paths = riglinePaths();
|
|
244
|
+
const checkout = checkoutPluginsDir();
|
|
206
245
|
console.log(formatPlugins(listPlugins({
|
|
207
246
|
roots: [
|
|
208
|
-
{ label: "this checkout", path:
|
|
247
|
+
...(checkout === null ? [] : [{ label: "this checkout", path: checkout }]),
|
|
209
248
|
{ label: paths.plugins, path: paths.plugins, managed: true },
|
|
249
|
+
{ label: "bundled", path: bundledPluginsDir(), bundled: true },
|
|
210
250
|
],
|
|
211
251
|
last: ["probe"],
|
|
212
252
|
configPath: paths.config,
|
|
@@ -358,7 +398,7 @@ function watchCommand(args) {
|
|
|
358
398
|
return new Promise((resolveWith) => {
|
|
359
399
|
let code = 0;
|
|
360
400
|
const watcher = watch({
|
|
361
|
-
payloadDir:
|
|
401
|
+
payloadDir: bundledDir(),
|
|
362
402
|
plugins: pluginOptions(),
|
|
363
403
|
codegen: true,
|
|
364
404
|
intervalMs: seconds * 1000,
|
|
@@ -384,11 +424,7 @@ function watchCommand(args) {
|
|
|
384
424
|
}
|
|
385
425
|
async function dev(args) {
|
|
386
426
|
const { positionals } = parseArgs({ args, options: {}, allowPositionals: true });
|
|
387
|
-
const dirs = positionals.length > 0
|
|
388
|
-
? positionals.map((d) => resolve(d))
|
|
389
|
-
: readdirSync(repoPluginsDir(), { withFileTypes: true })
|
|
390
|
-
.filter((e) => e.isDirectory() && existsSync(join(repoPluginsDir(), e.name, "rigline.json")))
|
|
391
|
-
.map((e) => join(repoPluginsDir(), e.name));
|
|
427
|
+
const dirs = positionals.length > 0 ? positionals.map((d) => resolve(d)) : firstPartyPlugins();
|
|
392
428
|
if (dirs.length === 0)
|
|
393
429
|
throw new UserError("no plugin directories to develop");
|
|
394
430
|
const exts = installedExtensions();
|
|
@@ -405,7 +441,7 @@ async function dev(args) {
|
|
|
405
441
|
let hostChanged = false;
|
|
406
442
|
for (const ext of exts) {
|
|
407
443
|
const report = install(ext, {
|
|
408
|
-
payloadDir:
|
|
444
|
+
payloadDir: bundledDir(),
|
|
409
445
|
plugins: pluginOptions(),
|
|
410
446
|
anchors: overrides,
|
|
411
447
|
});
|
|
@@ -477,6 +513,10 @@ async function main(argv) {
|
|
|
477
513
|
return updateCommand(rest);
|
|
478
514
|
case "remove":
|
|
479
515
|
return removeCommand(rest);
|
|
516
|
+
case "disable":
|
|
517
|
+
return switchCommand(rest, false);
|
|
518
|
+
case "enable":
|
|
519
|
+
return switchCommand(rest, true);
|
|
480
520
|
case "list":
|
|
481
521
|
return listCommand();
|
|
482
522
|
case "status":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rigline",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.5",
|
|
4
4
|
"description": "Install, update and develop plugins for the Claude Code VS Code extension",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rigline",
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
"author": "Lionell Pack",
|
|
20
20
|
"type": "module",
|
|
21
21
|
"license": "MIT",
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=22.12.0"
|
|
24
|
+
},
|
|
22
25
|
"files": [
|
|
23
26
|
"dist",
|
|
24
27
|
"!dist/**/*.map"
|
|
@@ -27,7 +30,9 @@
|
|
|
27
30
|
"rigline": "./dist/index.js"
|
|
28
31
|
},
|
|
29
32
|
"dependencies": {
|
|
30
|
-
"@rigline/core": "1.0.0-alpha.
|
|
33
|
+
"@rigline/core": "1.0.0-alpha.5"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
31
36
|
"rolldown": "^1.2.8"
|
|
32
37
|
},
|
|
33
38
|
"scripts": {
|