repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

build: rework markdown formatting pipeline

661ef856b29fa10ba6e8ae0095f0745a203dd15b

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

- move dprint out of npm scripts, run as mise step before mdslw
- add bin mapping for mdslw in mise.toml (was mdslw_x86_64-unknown)
- simplify scripts/mdslw.py (remove stale SKIP_FILES)
- fix ruff lint errors in scripts/extensions.py (unused import/variable)
- update markdownlint ignores for test prompts and corrupted files
- add root AGENTS.md with build system docs
- update extensions/AGENTS.md (split from original)

Changed files (6)

.markdownlint-cli2.yaml

Modified
6 6 - "skills/*/references/**"
7 7 - "skills/presenterm/templates/**"
8 8 - "skills/pi/LICENSE.md"
9 + - ".pi/prompts/test-*.md"
10 + - "prompts/brain.md"
11 + - "prompts/brutal.md"
12 + - "skills/brutal/SKILL.md"
9 13 config:
10 14 MD013:
11 15 line_length: 80

AGENTS.md

Added
new file mode 100644
1 +# Pi Extensions Workspace
3 +Monorepo for Pi extensions.
4 +Extensions live in `extensions/*`.
6 +## Build System
8 +`mise` is the singular interface.
9 +`mise.toml` is the source of truth.
11 +### Tasks
13 +| Task | Command | Description |
14 +| ------------ | -------------------------------- | ------------------------------------ |
15 +| List | `mise run list` | List extensions |
16 +| Format | `mise run fmt` | Format repo |
17 +| Lint | `mise run lint` | Verify formatting and lint |
18 +| Test | `mise run test` | Run tests |
19 +| Check | `mise run check` | Static extension checks |
20 +| CI | `mise run ci` | Release gate (lint + test + check) |
21 +| Changelog | `mise run changelog -- {name}` | Generate changelog for extension |
22 +| README | `mise run readme -- {name}` | Generate/update README for extension |
23 +| Demo | `mise run demo -- {name}` | Record demo GIFs |
24 +| Publish | `mise run publish -- {name}` | Publish after release gate |
25 +| Goal pexpect | `mise run goal-pexpect [--idea]` | Run goal pexpect test |
27 +### Invariant
29 +`mise run ci` must pass before pushing.
30 +No exceptions.
32 +### Escalation
34 +If the build system itself (`mise.toml`, scripts, or tooling) blocks progress,
35 +escalate to a human.
36 +Do not work around `mise` or add ad-hoc scripts.
38 +## Troubleshooting
40 +If `mise run` tasks fail with command-not-found errors, run `mise doctor`.
41 +Common causes:
42 +mise not activated, shims missing, tool binary name mismatch.

mise.toml

Modified
6 6 markdownlint-cli2 = "0.22.1"
7 7 yamlfmt = "0.21.0"
8 8 "aqua:nushell/nushell" = "0.112.2"
9 -"github:razziel89/mdslw" = "0.17.1"
9 +"github:razziel89/mdslw" = { version = "0.17.1", bin = "mdslw" }
11 11 [tasks.default]
12 12 description = "List tasks"
15 15 [tasks.fmt]
16 16 description = "Format repo"
17 -run = ["npm run fmt", "python3 scripts/mdslw.py"]
17 +run = [
18 + "npm run fmt",
19 + "dprint fmt",
20 + "python3 scripts/mdslw.py",
19 23 [tasks.lint]
20 24 description = "Verify formatting and lint"
21 -run = ["npm run lint", "python3 scripts/mdslw.py --mode check", "python3 scripts/check_skills.py"]
25 +run = [
26 + "npm run lint",
27 + "python3 scripts/mdslw.py --mode check",
28 + "python3 scripts/check_skills.py",
23 31 [tasks.test]
24 32 description = "Run tests"

package.json

Modified
7 7 "extensions/*"
9 9 "scripts": {
10 - "fmt": "biome check --write . && ruff format . && dprint fmt && yamlfmt .",
11 - "lint": "biome ci . && ruff format --check . && ruff check . && dprint check && markdownlint-cli2 && yamlfmt -lint .",
10 + "fmt": "biome check --write . && ruff format . && yamlfmt .",
11 + "lint": "biome ci . && ruff format --check . && ruff check . && markdownlint-cli2 && yamlfmt -lint .",
12 12 "test": "vitest run",
13 13 "test:watch": "vitest",
14 14 "typecheck": "tsc --noEmit",

scripts/extensions.py

Modified
8 8 import json
9 9 import os
10 10 import re
11 -import shutil
12 11 import subprocess
13 12 import sys
14 13 import tempfile
226 225 deps = pkg.get("dependencies", {}) or {}
227 226 peers = pkg.get("peerDependencies", {}) or {}
228 227 dev = pkg.get("devDependencies", {}) or {}
229 - scripts = pkg.get("scripts", {}) or {}
231 228 if dev.get(HARNESS) is None:
232 229 err(errors, ext, f"missing devDependency {HARNESS}")
233 230 # test:harness script is optional; vitest discovers tests by convention
247 244 packages = {
248 245 pkg_name(s)
249 246 for s in specs
250 - if not (
251 - s.startswith(".") or s.startswith("/") or s.startswith("node:")
247 + if not (s.startswith(".") or s.startswith("/") or s.startswith("node:"))
255 250 for spec in specs:
857 852 return 0
863 855 def cmd_test(selected: list[str]) -> int:
864 856 dirs = ext_dirs(selected)
865 857 args = [str(d.relative_to(ROOT)) for d in dirs] if dirs else []
939 931 commit_release(
941 933 + demo_paths
942 - + [ROOT / "README.md", ROOT / "CHANGELOG.md", ROOT / "package.json", ROOT / "package-lock.json"]
934 + + [
935 + ROOT / "README.md",
936 + ROOT / "CHANGELOG.md",
937 + ROOT / "package.json",
938 + ROOT / "package-lock.json",
944 941 tag = create_tag()
945 942 if no_push:

scripts/mdslw.py

Modified
10 10 ROOT = Path(__file__).resolve().parents[1]
11 11 SKIP_DIRS = {".git", ".jj", ".demo", "node_modules", "__pycache__"}
12 -SKIP_FILES = {
13 - Path("extensions/TODO.md"),
14 - Path("skills/pi/LICENSE.md"),
15 -}
12 +SKIP_FILES: set[Path] = set()
18 15 def markdown_files() -> list[str]: