litopencode 0.0.4 → 0.0.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 CHANGED
@@ -34,7 +34,7 @@
34
34
 
35
35
  npx litopencode install
36
36
 
37
- The installer delegates the default install path to OpenCode's own plugin installer. Published installs register a version-pinned entry such as <code>litopencode@0.0.4</code>; local checkout installs register the local package path for development. Then restart OpenCode. The agent switcher should show <code>lit-plan</code> and <code>lit-loop</code>.
37
+ The installer delegates the default install path to OpenCode's own plugin installer. Published installs register a version-pinned entry such as <code>litopencode@0.0.5</code>; local checkout installs register the local package path for development. Then restart OpenCode. The agent switcher should show <code>lit-plan</code> and <code>lit-loop</code>.
38
38
 
39
39
  For a preview without writing OpenCode config:
40
40
 
@@ -28,6 +28,14 @@ function pluginSpec(metadata) {
28
28
  function isLitOpenCodeEntry(value) {
29
29
  return typeof value === "string" && (value === pluginName || value.startsWith(pluginName + "@"));
30
30
  }
31
+ async function isLitOpenCodePathEntry(value) {
32
+ if (typeof value !== "string" || isLitOpenCodeEntry(value))
33
+ return false;
34
+ if (!(path.isAbsolute(value) || value.startsWith(".")))
35
+ return false;
36
+ const metadata = await readJsonObjectIfPresent(path.join(value, "package.json"));
37
+ return metadata?.name === pluginName;
38
+ }
31
39
  function defaultOpenCodeRoot() {
32
40
  const configHome = process.env.XDG_CONFIG_HOME;
33
41
  if (configHome && configHome.length > 0)
@@ -121,11 +129,15 @@ async function removeStaleOpenCodeEntries(root, target) {
121
129
  const pluginValue = config?.plugin;
122
130
  if (!Array.isArray(pluginValue))
123
131
  continue;
124
- const nextPlugin = pluginValue.filter((entry) => {
125
- if (entry === target.value)
126
- return true;
127
- return !isLitOpenCodeEntry(entry);
128
- });
132
+ const nextPlugin = [];
133
+ for (const entry of pluginValue) {
134
+ if (entry === target.value) {
135
+ nextPlugin.push(entry);
136
+ }
137
+ else if (!isLitOpenCodeEntry(entry) && !(await isLitOpenCodePathEntry(entry))) {
138
+ nextPlugin.push(entry);
139
+ }
140
+ }
129
141
  if (nextPlugin.length === pluginValue.length)
130
142
  continue;
131
143
  await fs.writeFile(configFile, JSON.stringify({ ...config, plugin: nextPlugin }, null, 2) + "\n");
package/docs/migration.md CHANGED
@@ -13,7 +13,7 @@ This guide describes the supported migration shape for moving an OpenCode workfl
13
13
  - Use the `LITOPENCODE_` prefix for LitOpenCode-owned environment variables.
14
14
  - Keep default OpenCode plugin configuration in OpenCode's managed `opencode.jsonc`; custom-root LitOpenCode previews use `opencode.json`.
15
15
  - Keep LitOpenCode runtime config in `.litopencode/config.json` when project-local config is needed.
16
- - Use `npx litopencode install` to delegate default setup to `opencode plugin <target> --global --force`; published installs use `litopencode@0.0.4`, while local checkout installs use the package path.
16
+ - Use `npx litopencode install` to delegate default setup to `opencode plugin <target> --global --force`; published installs use `litopencode@0.0.5`, while local checkout installs use the package path.
17
17
  - Use `litopencode doctor --root <workspace>` to inspect package metadata, config source, runtime paths, and ledger location without writing files.
18
18
  - Use `litopencode install --dry-run --root <workspace>` to preview the `opencode.json` plugin mutation without writing files.
19
19
 
@@ -41,7 +41,7 @@ After the source gates pass, verify the packed artifact in a temporary directory
41
41
  ```sh
42
42
  tmp="$(mktemp -d)"
43
43
  npm pack --pack-destination "$tmp"
44
- tar -xzf "$tmp"/litopencode-0.0.4.tgz -C "$tmp"
44
+ tar -xzf "$tmp"/litopencode-0.0.5.tgz -C "$tmp"
45
45
  node --input-type=module -e "import('$tmp/package/dist/index.js').then((m) => console.log(m.default?.id ?? m.pluginId))"
46
46
  (
47
47
  cd "$tmp/package"
@@ -73,7 +73,7 @@ mkdir "$tmp/consumer"
73
73
  (
74
74
  cd "$tmp/consumer"
75
75
  npm init -y
76
- npm install "$tmp"/litopencode-0.0.4.tgz
76
+ npm install "$tmp"/litopencode-0.0.5.tgz
77
77
  npm ls litopencode --all
78
78
  node --input-type=module -e "import('litopencode').then((m) => console.log(m.default.id))"
79
79
  node_modules/.bin/litopencode --help
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "litopencode",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "LitOpenCode OpenCode plugin bootstrap package.",
5
5
  "type": "module",
6
6
  "bin": {