@pragma-sh/opencode-plugin 1.0.0 → 1.0.2
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/pragma-plugin.mjs +3 -3
- package/package.json +1 -1
- package/scripts/install.mjs +16 -2
package/dist/pragma-plugin.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// ../plugin/dist/shared/chunk-
|
|
2
|
-
var PLUGIN_API_VERSION = "1.0.
|
|
1
|
+
// ../plugin/dist/shared/chunk-e222xk1w.js
|
|
2
|
+
var PLUGIN_API_VERSION = "1.0.1";
|
|
3
3
|
|
|
4
|
-
// ../plugin/dist/shared/chunk-
|
|
4
|
+
// ../plugin/dist/shared/chunk-6qx2xj9p.js
|
|
5
5
|
function defineAgent(input) {
|
|
6
6
|
return input;
|
|
7
7
|
}
|
package/package.json
CHANGED
package/scripts/install.mjs
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
// Pin the exact release being installed. OpenCode caches a bare package name
|
|
7
|
+
// once and never re-resolves it, so an unpinned entry keeps loading whichever
|
|
8
|
+
// version it first fetched after every Pragma upgrade.
|
|
9
|
+
const packageJson = JSON.parse(
|
|
10
|
+
await readFile(join(dirname(fileURLToPath(import.meta.url)), "..", "package.json"), "utf8"),
|
|
11
|
+
);
|
|
12
|
+
const specifier = `${packageJson.name}@${packageJson.version}`;
|
|
4
13
|
|
|
5
14
|
const configPath =
|
|
6
15
|
process.env.OPENCODE_CONFIG ?? join(homedir(), ".config", "opencode", "opencode.json");
|
|
@@ -15,8 +24,13 @@ try {
|
|
|
15
24
|
);
|
|
16
25
|
}
|
|
17
26
|
}
|
|
18
|
-
const
|
|
19
|
-
|
|
27
|
+
const isOurs = (entry) => entry === packageJson.name || entry.startsWith(`${packageJson.name}@`);
|
|
28
|
+
const plugins = [
|
|
29
|
+
...(Array.isArray(config.plugin) ? config.plugin : []).filter(
|
|
30
|
+
(entry) => typeof entry !== "string" || !isOurs(entry),
|
|
31
|
+
),
|
|
32
|
+
specifier,
|
|
33
|
+
];
|
|
20
34
|
await mkdir(dirname(configPath), { recursive: true });
|
|
21
35
|
await writeFile(configPath, `${JSON.stringify({ ...config, plugin: plugins }, null, 2)}\n`, {
|
|
22
36
|
mode: 0o600,
|