rigline 1.0.0-alpha.10 → 1.0.0-alpha.12

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 CHANGED
@@ -44,7 +44,10 @@ from a VSIX that ships inside the engine. Nothing is downloaded, and the compani
44
44
  engine does. It injects as it goes, so it is a step *instead of* `install` rather than after it.
45
45
 
46
46
  From then on it watches for the extension update and re-injects behind it, so there is nothing to
47
- remember after one.
47
+ remember after one. It goes into every VS Code profile that has Claude Code, and into any profile
48
+ that gets Claude Code later; the `companion` settings in
49
+ [`~/.rigline/config.yaml`](https://github.com/Rigline/Rigline/blob/main/docs/config.md) keep it out
50
+ of the profiles you name.
48
51
 
49
52
  **Decline it and lose nothing.** `install` remains complete on its own, and is the right answer if
50
53
  you would rather not add an extension, cannot install one, or simply prefer running the thing
@@ -64,6 +67,7 @@ your injection alone, and `rigline restore` is what undoes the injection itself.
64
67
  rigline enable N switch it back on, and re-inject
65
68
  rigline update move the engine and every npm plugin to what its tag resolves to
66
69
  rigline list every plugin, in load order: version, origin, source, switch, what it can do
70
+ rigline layout where each plugin's elements are; place, order or reset them, and re-inject
67
71
 
68
72
  rigline build build a plugin to one browser ES module
69
73
  rigline dev rebuild and re-inject as you edit
package/dist/engine.js CHANGED
@@ -88,7 +88,10 @@ export function engineInstallArgv(options) {
88
88
  ...options.specs,
89
89
  ];
90
90
  }
91
- const nodeSpawn = (command, args, options) => spawn(command, [...args], { stdio: [...options.stdio] });
91
+ const nodeSpawn = (command, args, options) => spawn(command, [...args], {
92
+ stdio: [...options.stdio],
93
+ ...(options.env === undefined ? {} : { env: options.env }),
94
+ });
92
95
  export async function ensureEngine(options = {}) {
93
96
  const prefix = engineDir(options.home ?? riglineHome());
94
97
  const version = options.version ?? wrapperVersion();
@@ -138,15 +141,17 @@ function engineAt(state, options) {
138
141
  return {
139
142
  version: state.version,
140
143
  entry: state.entry,
141
- run: (argv) => new Promise((done, fail) => {
144
+ run: (argv, env) => new Promise((done, fail) => {
142
145
  const child = spawnImpl(node, [state.entry, ...argv], {
143
146
  stdio: ["inherit", "inherit", "inherit"],
147
+ ...(env === undefined ? {} : { env: { ...process.env, ...env } }),
144
148
  });
145
149
  child.on("error", fail);
146
150
  child.on("close", (code) => done(code ?? 1));
147
151
  }),
148
- json: async (argv) => {
149
- const run = await capture(node, [state.entry, ...argv], spawnImpl, "inherit");
152
+ json: async (argv, options) => {
153
+ const stderr = options?.quiet ? "ignore" : "inherit";
154
+ const run = await capture(node, [state.entry, ...argv], spawnImpl, stderr);
150
155
  if (run.code !== 0) {
151
156
  throw new UserError(`the engine exited ${run.code} for \`${argv.join(" ")}\``);
152
157
  }
@@ -198,6 +203,7 @@ export async function updateEngine(options = {}) {
198
203
  return {
199
204
  outcome: "failed",
200
205
  ...(installed === null ? {} : { from: installed }),
206
+ to: resolved.version,
201
207
  reason: problem,
202
208
  };
203
209
  }
package/dist/index.js CHANGED
@@ -33,6 +33,7 @@ async function listed(engine) {
33
33
  throw new UserError("the engine's plugin list was not a list");
34
34
  return answer;
35
35
  }
36
+ const DEFER_INJECT = "RIGLINE_DEFER_INJECT";
36
37
  async function updateCommand(args) {
37
38
  const { values, positionals } = parseArgs({
38
39
  args,
@@ -45,18 +46,31 @@ async function updateCommand(args) {
45
46
  const engine = await ensureEngine({ registry });
46
47
  const updates = await updatePlugins({
47
48
  listed: await listed(engine),
48
- engine: engine.run,
49
+ engine: (argv) => engine.run(argv, { [DEFER_INJECT]: "1" }),
49
50
  ...(positionals.length > 0 ? { names: positionals } : {}),
50
51
  registry,
51
52
  });
53
+ console.log(formatUpdates(updates));
54
+ await addCompanions(engine);
55
+ const moved = engineUpdate.outcome === "moved" ||
56
+ engineUpdate.outcome === "installed" ||
57
+ updates.some((u) => u.outcome === "updated");
52
58
  let injected = 0;
53
- if (engineUpdate.outcome === "moved" || engineUpdate.outcome === "installed") {
59
+ if (moved) {
60
+ console.log("");
54
61
  injected = await engine.run(["install"]);
55
62
  }
56
- console.log(formatUpdates(updates));
57
63
  const failed = updates.some((u) => u.outcome === "failed") || engineUpdate.outcome === "failed";
58
64
  return failed || injected !== 0 ? 1 : 0;
59
65
  }
66
+ async function addCompanions(engine) {
67
+ const answer = (await engine.json(["companion-profiles"], { quiet: true }).catch(() => null));
68
+ if (answer?.v !== 1 || !Array.isArray(answer.lines))
69
+ return;
70
+ for (const line of answer.lines)
71
+ if (typeof line === "string")
72
+ console.log(line);
73
+ }
60
74
  function versionCommand() {
61
75
  const prefix = engineDir();
62
76
  const state = readEngineState(prefix);
package/dist/lock.js CHANGED
@@ -1,4 +1,4 @@
1
- import { closeSync, mkdirSync, openSync, readFileSync, rmSync, writeFileSync } from "node:fs";
1
+ import { closeSync, mkdirSync, openSync, readFileSync, rmSync, statSync, writeFileSync, } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { UserError } from "./errors.js";
4
4
  const STALE_MS = 60_000;
@@ -31,12 +31,18 @@ function readHolder(path) {
31
31
  return null;
32
32
  }
33
33
  }
34
- export function isStale(holder, now, staleMs, isAlive) {
35
- if (holder === null)
36
- return true;
37
- const since = Date.parse(holder.since);
34
+ function writtenAt(path) {
35
+ try {
36
+ return statSync(path).mtimeMs;
37
+ }
38
+ catch {
39
+ return Number.NaN;
40
+ }
41
+ }
42
+ export function isStale(holder, fileTime, now, staleMs, isAlive) {
43
+ const since = holder === null ? fileTime : Date.parse(holder.since);
38
44
  const old = Number.isNaN(since) || now - since >= staleMs;
39
- return old && !isAlive(holder.pid);
45
+ return old && (holder === null || !isAlive(holder.pid));
40
46
  }
41
47
  export class HomeLockedError extends UserError {
42
48
  holder;
@@ -69,7 +75,7 @@ export async function withHomeLock(options, work) {
69
75
  if (error.code !== "EEXIST")
70
76
  throw error;
71
77
  const held = readHolder(path);
72
- if (isStale(held, now(), staleMs, isAlive)) {
78
+ if (isStale(held, writtenAt(path), now(), staleMs, isAlive)) {
73
79
  rmSync(path, { force: true });
74
80
  continue;
75
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rigline",
3
- "version": "1.0.0-alpha.10",
3
+ "version": "1.0.0-alpha.12",
4
4
  "description": "Install, update and develop plugins for the Claude Code VS Code extension",
5
5
  "keywords": [
6
6
  "rigline",