Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ jobs:
# bundler or compiler), which still cuts a release when bumped.
# jq -S normalises key order; on any error (e.g. package.json absent
# on one side) treat it as shipping.
INERT_DEVDEPS='["markdownlint-cli2"]'
INERT_DEVDEPS='["@biomejs/biome","markdownlint-cli2"]'
pkg_shipping_changed() {
local before after
# Single quotes are deliberate: $inert/$k are jq variables, not
Expand Down
11 changes: 9 additions & 2 deletions .markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
// markdownlint-cli2 config — full enforcement, no rule exclusions.
// Full rule list: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
"config": {
"MD013": { "line_length": 120 }
"default": true,
// MD013: line length — ENFORCED at 100 everywhere (matches biome lineWidth)
"MD013": { "line_length": 100 }
// MD024: duplicate headings — ENFORCED (changelogs/reference docs must vary)
// MD041: first line must be top-level heading — ENFORCED
// MD060: table column style — ENFORCED
},
"ignores": ["node_modules"]
"globs": ["**/*.md", "!node_modules/**", "!dist/**", "!.git/**"]
}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ form before the model ever sees it. This plugin wires the two together.
- OpenCode **v2** (`opencode --version` reports 2.x).
- `rtk` >= 0.23.0 on `PATH` — see [rtk-ai/rtk](https://github.com/rtk-ai/rtk):
`brew install rtk`
- Node >= 22 to run the dev tooling (`markdownlint-cli2` needs it); `.nvmrc`
pins 24, matching CI. The plugin itself runs on Node 18+.

## Install

Expand Down Expand Up @@ -86,7 +88,7 @@ The plugin registers one OpenCode v2 shell hook:
```js
ctx.shell.hook("create.before", (event) => {
// event.command is the command about to run; mutate it to rewrite
})
});
```

For each shell command it runs `rtk rewrite <command>` and replaces the command
Expand Down
32 changes: 32 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"$schema": "https://biomejs.dev/schemas/2.6.4/schema.json",
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 100,
"lineEnding": "lf"
},
"linter": {
"enabled": true,
"rules": {
"preset": "recommended"
}
},
"assist": {
"actions": {
"source": {
"organizeImports": "on"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "double",
"semicolons": "always"
}
},
"files": {
"includes": ["**", "!node_modules", "!dist", "!.git", "!coverage"]
}
}
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function rewriteCommand(binary, command, timeoutMs) {
(_err, stdout) => {
const out = String(stdout ?? "").trim();
done(out && out !== command ? out : null);
}
},
);
} catch {
return done(null);
Expand Down
200 changes: 200 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@
"access": "public"
},
"scripts": {
"lint": "markdownlint-cli2 \"**/*.md\"",
"lint": "biome check . && markdownlint-cli2 \"**/*.md\" \"#node_modules/**\" \"#dist/**\" \"#.git/**\"",
"lint:fix": "biome check --write . && markdownlint-cli2 --fix \"**/*.md\" \"#node_modules/**\" \"#dist/**\" \"#.git/**\"",
"test": "node --check index.js && node --test test/*.test.mjs",
"check": "npm run lint && npm test"
},
"devDependencies": {
"@biomejs/biome": "^2.6.4",
"markdownlint-cli2": "^0.24.0"
},
"overrides": {
Expand Down
4 changes: 2 additions & 2 deletions test/rewrite.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
// without rtk installed. The critical regression: `rtk rewrite` exits 3 with
// the rewrite on stdout — the plugin must key on stdout, not exit status.

import { test } from "node:test";
import assert from "node:assert/strict";
import { mkdtemp, writeFile, chmod } from "node:fs/promises";
import { chmod, mkdtemp, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { test } from "node:test";

import plugin from "../index.js";

Expand Down
Loading