@mortz.prk/opencode-auto-mode 0.1.1 → 0.1.3

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
@@ -145,22 +145,17 @@ Keep ordinary OpenCode permission rules requiring approval for sensitive actions
145
145
 
146
146
  ## Publishing releases
147
147
 
148
- The package is public on npm. GitHub releases trigger `.github/workflows/publish.yml`, which uses npm trusted publishing through GitHub Actions OIDC. No npm token is needed in repository secrets.
148
+ Open **Actions → Release npm package → Run workflow**, select `main`, choose `patch`, `minor`, or `major` (default: `patch`), and run it. This manual workflow runs tests, lint, and typecheck, increments `package.json`, checks the package, commits and tags the version, publishes to npm, and creates an immutable GitHub release with generated notes.
149
149
 
150
- For the first publication, enable two-factor authentication on the `mortz.prk` npm account. Merge the migration at version `0.1.1` to `main`, check out that commit, and run the project checks before publishing:
150
+ The same release can be started with one command:
151
151
 
152
152
  ```sh
153
- bun install --frozen-lockfile --ignore-scripts
154
- bun test
155
- bun run typecheck
156
- npm pack --dry-run
157
- npm login --registry=https://registry.npmjs.org
158
- npm publish --access public --ignore-scripts --registry=https://registry.npmjs.org
153
+ gh workflow run publish.yml --repo mortezaPRK/opencode-auto-mode --ref main -f bump=patch
159
154
  ```
160
155
 
161
- After the package exists, configure its [npm trusted publisher](https://docs.npmjs.com/trusted-publishers/) with GitHub owner `mortezaPRK`, repository `opencode-auto-mode`, and workflow filename `publish.yml`. Leave the environment field empty and explicitly allow direct `npm publish`.
156
+ Publishing uses the existing [npm trusted publisher](https://docs.npmjs.com/trusted-publishers/) for GitHub owner `mortezaPRK`, repository `opencode-auto-mode`, and workflow filename `publish.yml`. No npm token or additional personal access token is needed in repository secrets.
162
157
 
163
- For the first automated publication, bump the manifest to `0.1.2`, refresh the lockfile, merge to `main`, and publish GitHub release `v0.1.2` within two days of creating the trusted publisher. For later releases, update the version, merge to `main`, and publish a GitHub release with the matching `v<version>` tag. The workflow requires the tag's version to match `package.json` and its commit to be on `main`; it runs tests and a typecheck before publishing.
158
+ GitHub release immutability is enabled in the repository settings. Releases and tags do not trigger publication; only running this workflow does.
164
159
 
165
160
  ## Credit
166
161
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mortz.prk/opencode-auto-mode",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Configurable automatic permission review for OpenCode v2.",
5
5
  "author": {
6
6
  "name": "Andrew Mellen",
@@ -16,7 +16,9 @@
16
16
  },
17
17
  "type": "module",
18
18
  "license": "MIT",
19
- "files": ["src"],
19
+ "files": [
20
+ "src"
21
+ ],
20
22
  "exports": {
21
23
  ".": {
22
24
  "import": "./src/index.ts",
@@ -28,6 +30,7 @@
28
30
  }
29
31
  },
30
32
  "scripts": {
33
+ "lint": "eslint . --max-warnings=0",
31
34
  "typecheck": "tsc --noEmit",
32
35
  "test": "bun test",
33
36
  "test:integration": "bun run integration/opencode.ts"
@@ -44,13 +47,17 @@
44
47
  "solid-js": ">=1.9.0"
45
48
  },
46
49
  "devDependencies": {
50
+ "@eslint/js": "^10.0.1",
47
51
  "@opencode/theme": "^2.0.14",
48
- "@opentui/core": "0.5.10",
52
+ "@opentui/core": "0.5.17",
49
53
  "@opentui/keymap": "^0.5.10",
50
- "@opentui/solid": "0.5.10",
51
- "@types/node": "^24.0.0",
54
+ "@opentui/solid": "0.5.17",
55
+ "@types/node": "^26.6.4",
52
56
  "@types/shell-quote": "1.7.5",
53
- "solid-js": "1.9.14",
54
- "typescript": "^5.8.2"
57
+ "@typescript/native": "npm:typescript@^7.0.2",
58
+ "eslint": "^10.12.0",
59
+ "solid-js": "1.9.17",
60
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
61
+ "typescript-eslint": "^8.71.1"
55
62
  }
56
63
  }
package/src/logger.ts CHANGED
@@ -15,7 +15,9 @@ export function createLogger(filename: string): Logger {
15
15
  const size = fs.fstatSync(fd).size;
16
16
  if (size > 1_048_576) fs.ftruncateSync(fd, 0);
17
17
  fs.writeSync(fd, `[${stamp()}] ${line.slice(0, 1024).replace(/[\r\n]/g, " ")}\n`);
18
- } catch {} finally { if (fd !== undefined) fs.closeSync(fd); }
18
+ } catch {
19
+ // Logging is best effort and must not interrupt permission review.
20
+ } finally { if (fd !== undefined) fs.closeSync(fd); }
19
21
  };
20
22
  return {
21
23
  log: append,
package/src/shell.ts CHANGED
@@ -10,7 +10,7 @@ const WRAPPERS = new Set(["env", "command", "builtin", "exec", "eval", "source",
10
10
  const BALANCED_QUOTES = /^(?:[^'"\\]|\\[^\r\n]|'[^']*'|"(?:[^"\\]|\\[^\r\n])*")*$/;
11
11
 
12
12
  export function shellWords(command: string): string[] | undefined {
13
- if (!command || command.length > 4096 || /[$`~\r\n\0{}\[\]]/.test(command) ||
13
+ if (!command || command.length > 4096 || /[$`~\r\n\0{}[\]]/.test(command) ||
14
14
  /[^\S \t]/.test(command) || !BALANCED_QUOTES.test(command)) return undefined;
15
15
  try {
16
16
  const words = parse(command);
package/src/state.ts CHANGED
@@ -55,5 +55,6 @@ export function recordDecision(record: DecisionRecord): void {
55
55
  fs.ftruncateSync(fd, 0);
56
56
  fs.writeSync(fd, data, 0);
57
57
  } catch {
58
+ // Badge state is best effort and must not interrupt permission review.
58
59
  } finally { if (fd !== undefined) fs.closeSync(fd); }
59
60
  }
package/src/tui.tsx CHANGED
@@ -10,8 +10,6 @@ const MAX_RESOURCE = 48;
10
10
  const POLL_MS = 1_000;
11
11
  const STALE_MS = 90_000;
12
12
 
13
- type Reply = "once" | "reject";
14
-
15
13
  type Pending = {
16
14
  requestID: string;
17
15
  sessionID: string;
@@ -99,7 +97,7 @@ function Badge(props: {
99
97
  export default Plugin.define({
100
98
  id: "opencode-auto-mode",
101
99
  setup: async (ctx) => {
102
- const options = ctx.options as Record<string, any>;
100
+ const options = ctx.options as Record<string, unknown>;
103
101
  const keybinds = (options.keybinds ?? {}) as Record<string, unknown>;
104
102
  const allowKey = str(keybinds.allow, "ctrl+alt+a");
105
103
  const denyKey = str(keybinds.deny, "ctrl+alt+d");
@@ -319,4 +317,4 @@ export default Plugin.define({
319
317
  disposeBadge();
320
318
  };
321
319
  },
322
- });
320
+ });