@vasilvestre/opencode-plain-style 1.1.0 → 1.1.1

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.
@@ -24,13 +24,21 @@ import { fileURLToPath } from 'url';
24
24
 
25
25
  // Read once at load; a missing file throws here so startup fails loud instead
26
26
  // of silently injecting nothing.
27
+ const dir = path.dirname(fileURLToPath(import.meta.url));
27
28
  const rulebook = fs.readFileSync(
28
- path.join(path.dirname(fileURLToPath(import.meta.url)), 'plain-style.md'),
29
+ path.join(dir, 'plain-style.md'),
29
30
  'utf8',
30
31
  );
31
32
 
33
+ // opencode v2 rejects duplicate plugin ids at startup and drops every plugin
34
+ // when two instances collide. The npm install and a local repo copy share one
35
+ // file path shape, so each instance gets a unique id keyed by its own
36
+ // directory.
37
+ const location = dir.replaceAll(/[^\w]/g, '');
38
+ const hash = [...location].reduce((a, c) => (a * 31 + c.charCodeAt(0)) >>> 0, 7).toString(16);
39
+
32
40
  export default {
33
- id: 'vasilvestre.opencode-plain-style',
41
+ id: `vasilvestre.opencode-plain-style-${hash}`,
34
42
  async setup(ctx) {
35
43
  await ctx.session.hook('context', (event) => {
36
44
  event.system.push({ type: 'text', text: rulebook });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vasilvestre/opencode-plain-style",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Plain-language writing rules for opencode agents, injected into every system prompt. Enforces ISO 24495-1 principles on commits, comments, docs, and chat prose.",
5
5
  "keywords": [
6
6
  "opencode-plugin",