@xesrevinu/opencode-jj-enforcer 0.1.0
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/LICENSE +21 -0
- package/README.md +66 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +207 -0
- package/dist/index.js.map +1 -0
- package/package.json +77 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# @xesrevinu/opencode-jj-enforcer
|
|
2
|
+
|
|
3
|
+
OpenCode plugin that blocks `git` usage inside Jujutsu workspaces and forces agents onto `jj`.
|
|
4
|
+
|
|
5
|
+
## Highlights
|
|
6
|
+
|
|
7
|
+
- inspects `bash` tool calls before execution instead of relying on post-hoc review
|
|
8
|
+
- detects `.jj` roots from the workspace, `git -C`, and `cd ... && git ...` command patterns
|
|
9
|
+
- blocks wrapper forms such as `rtk git ...` so rewrite plugins cannot bypass the policy
|
|
10
|
+
- stays repository local with no external service or daemon requirements
|
|
11
|
+
- ships as a small npm package that can also be copied directly into `.opencode/plugin`
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
Use the published package from `opencode.jsonc`:
|
|
16
|
+
|
|
17
|
+
```jsonc
|
|
18
|
+
{
|
|
19
|
+
"plugin": ["@xesrevinu/opencode-jj-enforcer@latest"],
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Restart OpenCode after updating the plugin list.
|
|
24
|
+
|
|
25
|
+
If you want to iterate from a checkout instead of npm:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
mkdir -p .opencode/plugin
|
|
29
|
+
cp plugin/jj-enforcer.ts .opencode/plugin/jj-enforcer.ts
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
The plugin checks the current workspace plus directories referenced inside the shell command. If any of them belong to a Jujutsu repository, the command is rejected and the agent is told to use `jj`.
|
|
35
|
+
|
|
36
|
+
Examples that are blocked inside a `.jj` workspace:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
git status
|
|
40
|
+
git -C ../repo log
|
|
41
|
+
cd ../repo && git diff
|
|
42
|
+
rtk git log
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Development
|
|
46
|
+
|
|
47
|
+
The repository uses Bun for dependency management and local commands.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
bun install
|
|
51
|
+
bun run check
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Release
|
|
55
|
+
|
|
56
|
+
This package uses Changesets plus the shared GitHub Actions release workflow.
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
bun run changeset
|
|
60
|
+
bun run version-packages
|
|
61
|
+
bun run release
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
|
|
66
|
+
MIT
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { existsSync, statSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
//#region plugin/jj-enforcer.ts
|
|
5
|
+
const SHELL_BOUNDARIES = new Set([
|
|
6
|
+
";",
|
|
7
|
+
"|",
|
|
8
|
+
"&",
|
|
9
|
+
"(",
|
|
10
|
+
")"
|
|
11
|
+
]);
|
|
12
|
+
const COMMAND_PREFIXES = new Set([
|
|
13
|
+
"builtin",
|
|
14
|
+
"command",
|
|
15
|
+
"noglob",
|
|
16
|
+
"nohup",
|
|
17
|
+
"sudo",
|
|
18
|
+
"time"
|
|
19
|
+
]);
|
|
20
|
+
function tokenizeShell(command) {
|
|
21
|
+
const tokens = [];
|
|
22
|
+
let current = "";
|
|
23
|
+
let quote = null;
|
|
24
|
+
let escaped = false;
|
|
25
|
+
const pushCurrent = () => {
|
|
26
|
+
if (!current) return;
|
|
27
|
+
tokens.push(current);
|
|
28
|
+
current = "";
|
|
29
|
+
};
|
|
30
|
+
for (let index = 0; index < command.length; index++) {
|
|
31
|
+
const char = command[index];
|
|
32
|
+
if (!char) continue;
|
|
33
|
+
if (escaped) {
|
|
34
|
+
current += char;
|
|
35
|
+
escaped = false;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (quote === "'") {
|
|
39
|
+
if (char === "'") quote = null;
|
|
40
|
+
else current += char;
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (quote === "\"") {
|
|
44
|
+
if (char === "\"") quote = null;
|
|
45
|
+
else if (char === "\\") escaped = true;
|
|
46
|
+
else current += char;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (char === "'" || char === "\"") {
|
|
50
|
+
quote = char;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (char === "\\") {
|
|
54
|
+
escaped = true;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (/\s/.test(char)) {
|
|
58
|
+
pushCurrent();
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (SHELL_BOUNDARIES.has(char)) {
|
|
62
|
+
pushCurrent();
|
|
63
|
+
tokens.push(char);
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
current += char;
|
|
67
|
+
}
|
|
68
|
+
pushCurrent();
|
|
69
|
+
return tokens;
|
|
70
|
+
}
|
|
71
|
+
function splitShellSegments(tokens) {
|
|
72
|
+
const segments = [];
|
|
73
|
+
let current = [];
|
|
74
|
+
for (const token of tokens) {
|
|
75
|
+
if (SHELL_BOUNDARIES.has(token)) {
|
|
76
|
+
if (current.length > 0) {
|
|
77
|
+
segments.push(current);
|
|
78
|
+
current = [];
|
|
79
|
+
}
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
current.push(token);
|
|
83
|
+
}
|
|
84
|
+
if (current.length > 0) segments.push(current);
|
|
85
|
+
return segments;
|
|
86
|
+
}
|
|
87
|
+
function isEnvAssignment(token) {
|
|
88
|
+
return /^[A-Za-z_][A-Za-z0-9_]*=/.test(token);
|
|
89
|
+
}
|
|
90
|
+
function normalizeCommandTokens(segment) {
|
|
91
|
+
let index = 0;
|
|
92
|
+
while (index < segment.length) {
|
|
93
|
+
const token = segment[index];
|
|
94
|
+
if (!token) break;
|
|
95
|
+
if (token === "env") {
|
|
96
|
+
index += 1;
|
|
97
|
+
while (index < segment.length && isEnvAssignment(segment[index] ?? "")) index += 1;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (isEnvAssignment(token) || COMMAND_PREFIXES.has(token)) {
|
|
101
|
+
index += 1;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
return segment.slice(index);
|
|
107
|
+
}
|
|
108
|
+
function expandHome(token) {
|
|
109
|
+
const home = process.env["HOME"];
|
|
110
|
+
if (!home) return token;
|
|
111
|
+
if (token === "~") return home;
|
|
112
|
+
if (token.startsWith("~/")) return path.join(home, token.slice(2));
|
|
113
|
+
return token;
|
|
114
|
+
}
|
|
115
|
+
function resolveDirectory(baseDir, token) {
|
|
116
|
+
return path.resolve(baseDir, expandHome(token));
|
|
117
|
+
}
|
|
118
|
+
function getSearchStart(candidate) {
|
|
119
|
+
try {
|
|
120
|
+
return statSync(candidate).isDirectory() ? candidate : path.dirname(candidate);
|
|
121
|
+
} catch {
|
|
122
|
+
return candidate;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function findJjRoot(candidate, cache) {
|
|
126
|
+
let current = path.resolve(getSearchStart(candidate));
|
|
127
|
+
const visited = [];
|
|
128
|
+
while (true) {
|
|
129
|
+
const cached = cache.get(current);
|
|
130
|
+
if (cached !== void 0) {
|
|
131
|
+
for (const dir of visited) cache.set(dir, cached);
|
|
132
|
+
return cached;
|
|
133
|
+
}
|
|
134
|
+
visited.push(current);
|
|
135
|
+
const jjDir = path.join(current, ".jj");
|
|
136
|
+
if (existsSync(jjDir) && statSync(jjDir).isDirectory()) {
|
|
137
|
+
for (const dir of visited) cache.set(dir, current);
|
|
138
|
+
return current;
|
|
139
|
+
}
|
|
140
|
+
const parent = path.dirname(current);
|
|
141
|
+
if (parent === current) {
|
|
142
|
+
for (const dir of visited) cache.set(dir, null);
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
current = parent;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function extractCommandContext(command, baseDir) {
|
|
149
|
+
const directories = new Set([path.resolve(baseDir)]);
|
|
150
|
+
let usesGit = false;
|
|
151
|
+
for (const segment of splitShellSegments(tokenizeShell(command))) {
|
|
152
|
+
const normalized = normalizeCommandTokens(segment);
|
|
153
|
+
let executable = normalized[0];
|
|
154
|
+
let args = normalized.slice(1);
|
|
155
|
+
if (!executable) continue;
|
|
156
|
+
if (executable === "rtk" && args[0] === "git") {
|
|
157
|
+
executable = "git";
|
|
158
|
+
args = args.slice(1);
|
|
159
|
+
}
|
|
160
|
+
if (executable === "cd") {
|
|
161
|
+
const target = args[0];
|
|
162
|
+
if (target && target !== "-") directories.add(resolveDirectory(baseDir, target));
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (executable !== "git") continue;
|
|
166
|
+
usesGit = true;
|
|
167
|
+
for (let index = 0; index < args.length; index++) {
|
|
168
|
+
const token = args[index];
|
|
169
|
+
if (!token) continue;
|
|
170
|
+
if (token === "--") break;
|
|
171
|
+
if (token === "-C") {
|
|
172
|
+
const target = args[index + 1];
|
|
173
|
+
if (target) directories.add(resolveDirectory(baseDir, target));
|
|
174
|
+
index += 1;
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (token.startsWith("-C=")) directories.add(resolveDirectory(baseDir, token.slice(3)));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
directories,
|
|
182
|
+
usesGit
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
const JjEnforcerPlugin = async ({ directory, worktree }) => {
|
|
186
|
+
const jjRoots = /* @__PURE__ */ new Map();
|
|
187
|
+
return { "tool.execute.before": async (input, output) => {
|
|
188
|
+
if (input.tool !== "bash") return;
|
|
189
|
+
const args = output.args && typeof output.args === "object" ? output.args : void 0;
|
|
190
|
+
const command = typeof args?.["command"] === "string" ? args["command"] : "";
|
|
191
|
+
if (!command) return;
|
|
192
|
+
const { directories, usesGit } = extractCommandContext(command, typeof args?.["workdir"] === "string" && args["workdir"] ? path.resolve(args["workdir"]) : path.resolve(directory));
|
|
193
|
+
if (!usesGit) return;
|
|
194
|
+
directories.add(path.resolve(directory));
|
|
195
|
+
directories.add(path.resolve(worktree));
|
|
196
|
+
for (const candidate of directories) {
|
|
197
|
+
const jjRoot = findJjRoot(candidate, jjRoots);
|
|
198
|
+
if (!jjRoot) continue;
|
|
199
|
+
throw new Error(`Detected a Jujutsu repository at ${jjRoot}. Use jj instead of git in this workspace.`);
|
|
200
|
+
}
|
|
201
|
+
} };
|
|
202
|
+
};
|
|
203
|
+
var jj_enforcer_default = JjEnforcerPlugin;
|
|
204
|
+
|
|
205
|
+
//#endregion
|
|
206
|
+
export { JjEnforcerPlugin, jj_enforcer_default as default };
|
|
207
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["tokens: string[]","quote: \"'\" | '\"' | null","segments: string[][]","current: string[]","visited: string[]","JjEnforcerPlugin: Plugin"],"sources":["../plugin/jj-enforcer.ts"],"sourcesContent":["import { existsSync, statSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type { Plugin } from \"@opencode-ai/plugin\";\n\nconst SHELL_BOUNDARIES = new Set([\";\", \"|\", \"&\", \"(\", \")\"]);\nconst COMMAND_PREFIXES = new Set([\"builtin\", \"command\", \"noglob\", \"nohup\", \"sudo\", \"time\"]);\n\nfunction tokenizeShell(command: string): string[] {\n const tokens: string[] = [];\n let current = \"\";\n let quote: \"'\" | '\"' | null = null;\n let escaped = false;\n\n const pushCurrent = () => {\n if (!current) return;\n tokens.push(current);\n current = \"\";\n };\n\n for (let index = 0; index < command.length; index++) {\n const char = command[index];\n if (!char) continue;\n\n if (escaped) {\n current += char;\n escaped = false;\n continue;\n }\n\n if (quote === \"'\") {\n if (char === \"'\") quote = null;\n else current += char;\n continue;\n }\n\n if (quote === '\"') {\n if (char === '\"') {\n quote = null;\n } else if (char === \"\\\\\") {\n escaped = true;\n } else {\n current += char;\n }\n continue;\n }\n\n if (char === \"'\" || char === '\"') {\n quote = char;\n continue;\n }\n\n if (char === \"\\\\\") {\n escaped = true;\n continue;\n }\n\n if (/\\s/.test(char)) {\n pushCurrent();\n continue;\n }\n\n if (SHELL_BOUNDARIES.has(char)) {\n pushCurrent();\n tokens.push(char);\n continue;\n }\n\n current += char;\n }\n\n pushCurrent();\n return tokens;\n}\n\nfunction splitShellSegments(tokens: string[]): string[][] {\n const segments: string[][] = [];\n let current: string[] = [];\n\n for (const token of tokens) {\n if (SHELL_BOUNDARIES.has(token)) {\n if (current.length > 0) {\n segments.push(current);\n current = [];\n }\n continue;\n }\n current.push(token);\n }\n\n if (current.length > 0) segments.push(current);\n return segments;\n}\n\nfunction isEnvAssignment(token: string): boolean {\n return /^[A-Za-z_][A-Za-z0-9_]*=/.test(token);\n}\n\nfunction normalizeCommandTokens(segment: string[]): string[] {\n let index = 0;\n\n while (index < segment.length) {\n const token = segment[index];\n if (!token) break;\n\n if (token === \"env\") {\n index += 1;\n while (index < segment.length && isEnvAssignment(segment[index] ?? \"\")) index += 1;\n continue;\n }\n\n if (isEnvAssignment(token) || COMMAND_PREFIXES.has(token)) {\n index += 1;\n continue;\n }\n\n break;\n }\n\n return segment.slice(index);\n}\n\nfunction expandHome(token: string): string {\n const home = process.env[\"HOME\"];\n if (!home) return token;\n if (token === \"~\") return home;\n if (token.startsWith(\"~/\")) return path.join(home, token.slice(2));\n return token;\n}\n\nfunction resolveDirectory(baseDir: string, token: string): string {\n return path.resolve(baseDir, expandHome(token));\n}\n\nfunction getSearchStart(candidate: string): string {\n try {\n return statSync(candidate).isDirectory() ? candidate : path.dirname(candidate);\n } catch {\n return candidate;\n }\n}\n\nfunction findJjRoot(candidate: string, cache: Map<string, string | null>): string | null {\n let current = path.resolve(getSearchStart(candidate));\n const visited: string[] = [];\n\n while (true) {\n const cached = cache.get(current);\n if (cached !== undefined) {\n for (const dir of visited) cache.set(dir, cached);\n return cached;\n }\n\n visited.push(current);\n\n const jjDir = path.join(current, \".jj\");\n if (existsSync(jjDir) && statSync(jjDir).isDirectory()) {\n for (const dir of visited) cache.set(dir, current);\n return current;\n }\n\n const parent = path.dirname(current);\n if (parent === current) {\n for (const dir of visited) cache.set(dir, null);\n return null;\n }\n\n current = parent;\n }\n}\n\nfunction extractCommandContext(command: string, baseDir: string) {\n const directories = new Set<string>([path.resolve(baseDir)]);\n let usesGit = false;\n\n for (const segment of splitShellSegments(tokenizeShell(command))) {\n const normalized = normalizeCommandTokens(segment);\n let executable = normalized[0];\n let args = normalized.slice(1);\n if (!executable) continue;\n\n if (executable === \"rtk\" && args[0] === \"git\") {\n executable = \"git\";\n args = args.slice(1);\n }\n\n if (executable === \"cd\") {\n const target = args[0];\n if (target && target !== \"-\") {\n directories.add(resolveDirectory(baseDir, target));\n }\n continue;\n }\n\n if (executable !== \"git\") continue;\n usesGit = true;\n\n for (let index = 0; index < args.length; index++) {\n const token = args[index];\n if (!token) continue;\n\n if (token === \"--\") break;\n\n if (token === \"-C\") {\n const target = args[index + 1];\n if (target) directories.add(resolveDirectory(baseDir, target));\n index += 1;\n continue;\n }\n\n if (token.startsWith(\"-C=\")) {\n directories.add(resolveDirectory(baseDir, token.slice(3)));\n }\n }\n }\n\n return { directories, usesGit };\n}\n\nexport const JjEnforcerPlugin: Plugin = async ({ directory, worktree }) => {\n const jjRoots = new Map<string, string | null>();\n\n return {\n \"tool.execute.before\": async (input, output) => {\n if (input.tool !== \"bash\") return;\n\n const args =\n output.args && typeof output.args === \"object\"\n ? (output.args as Record<string, unknown>)\n : undefined;\n const command = typeof args?.[\"command\"] === \"string\" ? args[\"command\"] : \"\";\n if (!command) return;\n\n const baseDir =\n typeof args?.[\"workdir\"] === \"string\" && args[\"workdir\"]\n ? path.resolve(args[\"workdir\"])\n : path.resolve(directory);\n const { directories, usesGit } = extractCommandContext(command, baseDir);\n if (!usesGit) return;\n\n directories.add(path.resolve(directory));\n directories.add(path.resolve(worktree));\n\n for (const candidate of directories) {\n const jjRoot = findJjRoot(candidate, jjRoots);\n if (!jjRoot) continue;\n\n throw new Error(\n `Detected a Jujutsu repository at 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,SAAS,MAAM,MAAM,EAAE,CAAC,CAAC;;;AAKhE,QAAO;EAAE;EAAa;EAAS;;AAGjC,MAAaC,mBAA2B,OAAO,EAAE,WAAW,eAAe;CACzE,MAAM,0BAAU,IAAI,KAA4B;AAEhD,QAAO,EACL,uBAAuB,OAAO,OAAO,WAAW;AAC9C,MAAI,MAAM,SAAS,OAAQ;EAE3B,MAAM,OACJ,OAAO,QAAQ,OAAO,OAAO,SAAS,WACjC,OAAO,OACR;EACN,MAAM,UAAU,OAAO,OAAO,eAAe,WAAW,KAAK,aAAa;AAC1E,MAAI,CAAC,QAAS;EAMd,MAAM,EAAE,aAAa,YAAY,sBAAsB,SAHrD,OAAO,OAAO,eAAe,YAAY,KAAK,aAC1C,KAAK,QAAQ,KAAK,WAAW,GAC7B,KAAK,QAAQ,UAAU,CAC2C;AACxE,MAAI,CAAC,QAAS;AAEd,cAAY,IAAI,KAAK,QAAQ,UAAU,CAAC;AACxC,cAAY,IAAI,KAAK,QAAQ,SAAS,CAAC;AAEvC,OAAK,MAAM,aAAa,aAAa;GACnC,MAAM,SAAS,WAAW,WAAW,QAAQ;AAC7C,OAAI,CAAC,OAAQ;AAEb,SAAM,IAAI,MACR,oCAAoC,OAAO,4CAC5C;;IAGN;;AAGH,0BAAe"}
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xesrevinu/opencode-jj-enforcer",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "OpenCode plugin that enforces jj over git when a workspace contains a .jj repository.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"git",
|
|
7
|
+
"jj",
|
|
8
|
+
"jujutsu",
|
|
9
|
+
"opencode",
|
|
10
|
+
"opencode-plugin",
|
|
11
|
+
"policy"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/xesrevinu/opencode-jj-enforcer#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/xesrevinu/opencode-jj-enforcer/issues"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/xesrevinu/opencode-jj-enforcer.git"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"main": "./dist/index.js",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"import": "./dist/index.js",
|
|
35
|
+
"default": "./dist/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public",
|
|
40
|
+
"provenance": true
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"prepare": "lefthook install",
|
|
44
|
+
"build": "tsdown",
|
|
45
|
+
"dev": "tsdown --watch",
|
|
46
|
+
"lint": "oxlint .",
|
|
47
|
+
"format": "oxfmt .",
|
|
48
|
+
"format:check": "oxfmt --check .",
|
|
49
|
+
"typecheck": "tsc --noEmit",
|
|
50
|
+
"test": "bun test",
|
|
51
|
+
"check": "bun run lint && bun run format:check && bun run typecheck && bun run test && bun run build",
|
|
52
|
+
"changeset": "changeset",
|
|
53
|
+
"version-packages": "changeset version",
|
|
54
|
+
"release": "changeset publish --provenance",
|
|
55
|
+
"prepack": "bun run build"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@opencode-ai/plugin": "^1.2.15"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@changesets/cli": "^2.29.7",
|
|
62
|
+
"@types/bun": "^1.3.10",
|
|
63
|
+
"@types/node": "^24.5.2",
|
|
64
|
+
"lefthook": "^1.11.13",
|
|
65
|
+
"oxfmt": "^0.38.0",
|
|
66
|
+
"oxlint": "^1.53.0",
|
|
67
|
+
"tsdown": "^0.15.5",
|
|
68
|
+
"typescript": "^5.9.3"
|
|
69
|
+
},
|
|
70
|
+
"peerDependencies": {
|
|
71
|
+
"@opencode-ai/plugin": ">=1.2.0"
|
|
72
|
+
},
|
|
73
|
+
"engines": {
|
|
74
|
+
"bun": ">=1.3.10",
|
|
75
|
+
"node": ">=24"
|
|
76
|
+
}
|
|
77
|
+
}
|