repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

TOOLING_MIGRATION.md

Raw

Tooling migration plan

Goal: one project-management entry point, reproducible local tooling, strict release validation, no Git-hook dependency, no hidden deps.

This repo is jj-first. Git is only the backing store. Do not rely on Git hooks.

Requirements

Decisions

Use mise as the only project-management tool.

Remove justfile after equivalent mise tasks exist.

Do not add Git hooks. jj does not run them, so they are misleading here.

Use tool-native discovery instead of jj file list | xargs ....

Use:

Tool availability

Checked mise registry:

tool mise registry backend
bun core:bun
biome aqua:biomejs/biome
ruff aqua:astral-sh/ruff
dprint aqua:dprint/dprint
markdownlint-cli2 npm:markdownlint-cli2
yamlfmt aqua:google/yamlfmt

Not in registry:

tool source
mdslw github:razziel89/mdslw

mdslw has GitHub release binaries for Linux, macOS, and Windows.

Current file types

Tracked file type inventory at planning time:

type count action
.md 132 dprint, mdslw, markdownlint-cli2
.ts / .test.ts / .bench.ts 181 biome
.json 38 biome
.py 16 ruff
.mjs 5 biome
.yml 2 yamlfmt
.html 1 biome if stable here
.css 1 biome
.lua 1 skip for now
.jsonl, .txt, .snap, .gif, locks many skip / generated / fixtures

Important JSON files:

Generated/owned files to avoid manual formatting:

Target commands

Canonical commands after migration:

mise run fmt
mise run lint
mise run test
mise run build
mise run ci
mise run publish

Meanings:

Do not create a separate check task. It overlaps with lint and confuses the interface. Use build for extension package validation.

Step 1: clean up temporary hook/just work

If these exist from earlier experiments, remove them:

Command:

git config --unset core.hooksPath || true
rm -rf .githooks

Do not rely on hooks for jj workflows.

Keep justfile only until all mise tasks are working. Delete it at the end.

Step 2: add mise.toml

Create root mise.toml.

Start with pinned-enough tool versions. Use exact versions if available and stable; otherwise use latest during initial migration, then lock later with mise lock.

Suggested initial file:

[tools]
bun = "1.3.14"
biome = "latest"
ruff = "latest"
dprint = "latest"
markdownlint-cli2 = "latest"
yamlfmt = "latest"

[tools."github:razziel89/mdslw"]
version = "0.17.1"
bin = "mdslw"

[tasks.fmt]
description = "Format repo"
run = [
  "biome format --write .",
  "ruff format .",
  "dprint fmt",
  "mdslw .",
  "yamlfmt .",
]

[tasks.lint]
description = "Verify formatting and lint"
run = [
  "biome ci .",
  "ruff format --check .",
  "ruff check .",
  "dprint check",
  "mdslw --mode check .",
  "markdownlint-cli2",
  "yamlfmt -lint .",
]

[tasks.test]
description = "Run tests"
run = "python3 scripts/extensions.py test"

[tasks.build]
description = "Validate/build extension packages"
run = "python3 scripts/extensions.py check"

[tasks.ci]
description = "Release gate"
depends = ["lint", "test", "build"]

[tasks.publish]
description = "Publish after release gate"
depends = ["ci"]
run = "python3 scripts/extensions.py publish"

Notes:

Step 3: add formatter configs

Biome

Add biome.json.

Use Biome for TS/JS/MJS/JSON/CSS and possibly HTML.

Start strict but practical. Example skeleton:

{
  "$schema": "https://biomejs.dev/schemas/latest/schema.json",
  "files": {
    "includes": [
      "**/*.ts",
      "**/*.js",
      "**/*.mjs",
      "**/*.json",
      "**/*.jsonc",
      "**/*.css",
      "**/*.html",
      "!**/node_modules/**",
      "!**/bun.lock",
      "!**/*.snap"
    ]
  },
  "formatter": {
    "enabled": true,
    "indentStyle": "tab"
  },
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true
    }
  }
}

Then run mise run fmt and inspect diffs. Adjust only for real false positives.

Dprint

Add dprint.json.

Use Dprint only for Markdown. Do not let it format TS/JSON if Biome owns them.

Example skeleton:

{
  "includes": ["**/*.md"],
  "excludes": [
    "**/node_modules/**",
    ".demo/**"
  ],
  "plugins": [
    "https://plugins.dprint.dev/markdown/latest.wasm"
  ],
  "markdown": {
    "lineWidth": 80
  }
}

Run:

dprint fmt
mdslw .

If Dprint and mdslw fight each other, change Dprint Markdown line wrapping to preserve/disable prose wrapping if supported. mdslw should own sentence-line wrapping.

Ruff

Add pyproject.toml or ruff.toml.

Prefer pyproject.toml if no Python packaging config exists yet.

Example skeleton:

[tool.ruff]
target-version = "py313"
line-length = 100
extend-exclude = [
  ".demo",
]

[tool.ruff.lint]
select = ["E", "F", "I", "UP", "B", "SIM"]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"

Run:

ruff format .
ruff check .

Fix all reported issues. Do not blanket-disable rules unless a rule is truly wrong for this repo.

markdownlint-cli2

Add .markdownlint-cli2.yaml.

Do not disable normal lint rules just because there are many failures. Fix the Markdown.

Only configure ignores for generated/vendor paths.

Example skeleton:

globs:
  - "**/*.md"
ignores:
  - "**/node_modules/**"
  - ".demo/**"

If line length conflicts with semantic line wrapping, first run Dprint + mdslw and fix remaining docs. Avoid disabling MD013 unless there is a clear, repo-wide reason.

yamlfmt

Add .yamlfmt if needed. Keep minimal. Verify syntax from yamlfmt --help.

Target files:

Step 4: update Neovim formatter config

Update dotfiles so editor and repo use same tools.

File:

/home/me/Workspace/dotfiles/neovim/lua/bugabinga/format.lua

Current Markdown chain uses Deno:

markdown = { 'deno_fmt_markdown', 'mdslw', 'injected' }

Change to Dprint:

markdown = { 'dprint', 'mdslw', 'injected' }

Change TS/JS/JSON to Biome:

javascript        = { 'biome' },
javascriptreact   = { 'biome' },
typescript        = { 'biome' },
typescriptreact   = { 'biome' },
json              = { 'biome' },
jsonc             = { 'biome' },

Add Python Ruff if not already configured:

python = { 'ruff_format', 'ruff_fix', 'ruff_organize_imports' }

Use actual Conform formatter names. Verify with Conform docs/current config.

Remove deno_fmt_markdown only if no other filetype uses it.

Step 5: update GitHub workflow

Current workflow installs Bun and Nushell manually, then runs Python scripts.

Replace manual installs with mise.

Target shape:

- name: Install mise
  run: |
    curl https://mise.run | sh
    echo "$HOME/.local/bin" >> "$GITHUB_PATH"

- name: Install tools
  run: mise install

- name: CI
  run: mise run ci

If pi is required in CI, either install Pi explicitly or document that CI only runs extension build/tests that do not need interactive Pi. Do not hide missing Pi behind optional behavior.

Step 6: update publish/release path

Find current publish entry:

python3 scripts/extensions.py publish

Ensure publish task always depends on ci:

[tasks.publish]
depends = ["ci"]
run = "python3 scripts/extensions.py publish"

If there is a separate release prompt/script, route it through mise run publish or mise run ci first.

The invariant: no publish/release command bypasses ci.

Step 7: remove justfile

Once these pass:

mise run fmt
mise run lint
mise run test
mise run build
mise run ci

Delete justfile.

Update docs/prompts mentioning just:

Replace examples:

just demo tldr

with:

mise run demo -- tldr

Add a demo task in mise.toml before updating references:

[tasks.demo]
description = "Record demo GIFs"
run = "python3 scripts/demo.py"

Confirm argument forwarding. If mise run demo -- tldr does not pass args as expected, use a usage block or a file task.

Step 8: fix all formatting/lint failures

Expected first run will be noisy.

Order:

  1. mise run fmt
  2. inspect diff
  3. mise run lint
  4. fix remaining lint failures manually
  5. repeat until clean

Markdownlint previously reported:

36 README files
309 errors
MD013 line-length: 271
MD060 table-column-style: 22
MD032 blanks-around-lists: 16

Do not disable those rules just to pass. Use formatter + manual cleanup.

Step 9: lock deps

After tools install and tasks work:

mise lock

Commit:

Step 10: acceptance checklist

Before final commit:

mise install
mise run fmt
mise run lint
mise run test
mise run build
mise run ci
mise run publish -- --dry-run

If publish has no dry-run flag, do not run real publish. Add a dry-run flag first or document why it is unavailable.

Final repo properties:

Notes for Windows

Avoid these patterns:

jj file list 'glob:**/*.md' | xargs ...
git ls-files -z | xargs -0 ...
find ... -exec ...

Prefer:

dprint fmt
mdslw .
biome ci .
ruff check .
markdownlint-cli2

If a tool cannot discover files correctly, add a tiny cross-platform script in Python or TypeScript and call that from mise. Do not build large shell pipelines.

Markdown source
File outline
# Tooling migration plan

Goal:
one project-management entry point, reproducible local tooling, strict release
validation, no Git-hook dependency, no hidden deps.

This repo is jj-first.
Git is only the backing store.
Do not rely on Git hooks.

## Requirements

- One canonical command interface.
- Easy setup for new contributors.
- Formatting + linting for important file types:
  - Markdown
  - TypeScript / JavaScript / JSON
  - Python
  - YAML if kept in repo workflows
  - CSS / HTML if kept in browser demo code
- Release/publish gate:
  - formatted
  - zero lint errors
  - zero warnings where tools support warning/error distinction
  - tests pass
  - extension static/build checks pass
- Keep editor formatting and repo formatting in sync.
- Avoid shell pipelines that break on Windows.
- Do not disable markdown lint rules just to pass.
  Fix docs instead.

## Decisions

Use `mise` as the only project-management tool.

Remove `justfile` after equivalent `mise` tasks exist.

Do not add Git hooks.
jj does not run them, so they are misleading here.

Use tool-native discovery instead of `jj file list | xargs ...`.

Use:

- `biome` for TypeScript, JavaScript, JSON, CSS, maybe HTML
- `ruff` for Python format + lint
- `dprint` as Markdown structural formatter
- `mdslw` for Markdown sentence line wrapping
- `markdownlint-cli2` for Markdown lint
- `yamlfmt` for YAML if `.github/*.yml` remains tracked

## Tool availability

Checked `mise registry`:

| tool                | mise registry backend   |
| ------------------- | ----------------------- |
| `bun`               | `core:bun`              |
| `biome`             | `aqua:biomejs/biome`    |
| `ruff`              | `aqua:astral-sh/ruff`   |
| `dprint`            | `aqua:dprint/dprint`    |
| `markdownlint-cli2` | `npm:markdownlint-cli2` |
| `yamlfmt`           | `aqua:google/yamlfmt`   |

Not in registry:

| tool    | source                   |
| ------- | ------------------------ |
| `mdslw` | `github:razziel89/mdslw` |

`mdslw` has GitHub release binaries for Linux, macOS, and Windows.

## Current file types

Tracked file type inventory at planning time:

| type                                     | count | action                                 |
| ---------------------------------------- | ----: | -------------------------------------- |
| `.md`                                    |   132 | `dprint`, `mdslw`, `markdownlint-cli2` |
| `.ts` / `.test.ts` / `.bench.ts`         |   181 | `biome`                                |
| `.json`                                  |    38 | `biome`                                |
| `.py`                                    |    16 | `ruff`                                 |
| `.mjs`                                   |     5 | `biome`                                |
| `.yml`                                   |     2 | `yamlfmt`                              |
| `.html`                                  |     1 | `biome` if stable here                 |
| `.css`                                   |     1 | `biome`                                |
| `.lua`                                   |     1 | skip for now                           |
| `.jsonl`, `.txt`, `.snap`, `.gif`, locks |  many | skip / generated / fixtures            |

Important JSON files:

- root `package.json`
- every `extensions/*/package.json`
- `skills/ascii-boxes/package.json`
- `skills/pi/evals/evals.json`
- `themes/terminal.json`

Generated/owned files to avoid manual formatting:

- `extensions/*/bun.lock`
- `skills/ascii-boxes/deno.lock`
- `*.gif`
- snapshot files
- benchmark `.txt`

## Target commands

Canonical commands after migration:

```bash
mise run fmt
mise run lint
mise run test
mise run build
mise run ci
mise run publish
```

Meanings:

- `fmt`:
  mutate files into canonical formatting
- `lint`:
  non-mutating gate; formatting already correct + lint diagnostics clean
- `test`:
  run extension tests
- `build`:
  run extension static/build checks
- `ci`:
  release gate = lint + test + build
- `publish`:
  runs `ci`, then publishes/releases

Do not create a separate `check` task.
It overlaps with `lint` and confuses the interface.
Use `build` for extension package validation.

## Step 1: clean up temporary hook/just work

If these exist from earlier experiments, remove them:

- `.githooks/pre-commit`
- `.githooks/`
- Git config `core.hooksPath=.githooks`

Command:

```bash
git config --unset core.hooksPath || true
rm -rf .githooks
```

Do not rely on hooks for jj workflows.

Keep `justfile` only until all `mise` tasks are working.
Delete it at the end.

## Step 2: add `mise.toml`

Create root `mise.toml`.

Start with pinned-enough tool versions.
Use exact versions if available and stable; otherwise use `latest` during
initial migration, then lock later with `mise lock`.

Suggested initial file:

```toml
[tools]
bun = "1.3.14"
biome = "latest"
ruff = "latest"
dprint = "latest"
markdownlint-cli2 = "latest"
yamlfmt = "latest"

[tools."github:razziel89/mdslw"]
version = "0.17.1"
bin = "mdslw"

[tasks.fmt]
description = "Format repo"
run = [
  "biome format --write .",
  "ruff format .",
  "dprint fmt",
  "mdslw .",
  "yamlfmt .",
]

[tasks.lint]
description = "Verify formatting and lint"
run = [
  "biome ci .",
  "ruff format --check .",
  "ruff check .",
  "dprint check",
  "mdslw --mode check .",
  "markdownlint-cli2",
  "yamlfmt -lint .",
]

[tasks.test]
description = "Run tests"
run = "python3 scripts/extensions.py test"

[tasks.build]
description = "Validate/build extension packages"
run = "python3 scripts/extensions.py check"

[tasks.ci]
description = "Release gate"
depends = ["lint", "test", "build"]

[tasks.publish]
description = "Publish after release gate"
depends = ["ci"]
run = "python3 scripts/extensions.py publish"
```

Notes:

- Verify `yamlfmt -lint .` syntax locally.
  If different, fix task.
- Verify `github:razziel89/mdslw` asset autodetection.
  If mise cannot infer the binary correctly, add platform-specific
  `asset_pattern` entries.
- If Biome HTML formatting is unstable for `extensions/diff-review/browser`,
  exclude HTML initially and document why.

## Step 3: add formatter configs

### Biome

Add `biome.json`.

Use Biome for TS/JS/MJS/JSON/CSS and possibly HTML.

Start strict but practical.
Example skeleton:

```json
{
  "$schema": "https://biomejs.dev/schemas/latest/schema.json",
  "files": {
    "includes": [
      "**/*.ts",
      "**/*.js",
      "**/*.mjs",
      "**/*.json",
      "**/*.jsonc",
      "**/*.css",
      "**/*.html",
      "!**/node_modules/**",
      "!**/bun.lock",
      "!**/*.snap"
    ]
  },
  "formatter": {
    "enabled": true,
    "indentStyle": "tab"
  },
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true
    }
  }
}
```

Then run `mise run fmt` and inspect diffs.
Adjust only for real false positives.

### Dprint

Add `dprint.json`.

Use Dprint only for Markdown.
Do not let it format TS/JSON if Biome owns them.

Example skeleton:

```json
{
  "includes": ["**/*.md"],
  "excludes": [
    "**/node_modules/**",
    ".demo/**"
  ],
  "plugins": [
    "https://plugins.dprint.dev/markdown/latest.wasm"
  ],
  "markdown": {
    "lineWidth": 80
  }
}
```

Run:

```bash
dprint fmt
mdslw .
```

If Dprint and `mdslw` fight each other, change Dprint Markdown line wrapping to
preserve/disable prose wrapping if supported.
`mdslw` should own sentence-line wrapping.

### Ruff

Add `pyproject.toml` or `ruff.toml`.

Prefer `pyproject.toml` if no Python packaging config exists yet.

Example skeleton:

```toml
[tool.ruff]
target-version = "py313"
line-length = 100
extend-exclude = [
  ".demo",
]

[tool.ruff.lint]
select = ["E", "F", "I", "UP", "B", "SIM"]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
```

Run:

```bash
ruff format .
ruff check .
```

Fix all reported issues.
Do not blanket-disable rules unless a rule is truly wrong for this repo.

### markdownlint-cli2

Add `.markdownlint-cli2.yaml`.

Do not disable normal lint rules just because there are many failures.
Fix the Markdown.

Only configure ignores for generated/vendor paths.

Example skeleton:

```yaml
globs:
  - "**/*.md"
ignores:
  - "**/node_modules/**"
  - ".demo/**"
```

If line length conflicts with semantic line wrapping, first run Dprint + mdslw
and fix remaining docs.
Avoid disabling `MD013` unless there is a clear, repo-wide reason.

### yamlfmt

Add `.yamlfmt` if needed.
Keep minimal.
Verify syntax from `yamlfmt --help`.

Target files:

- `.github/dependabot.yml`
- `.github/workflows/check.yml`

## Step 4: update Neovim formatter config

Update dotfiles so editor and repo use same tools.

File:

```text
/home/me/Workspace/dotfiles/neovim/lua/bugabinga/format.lua
```

Current Markdown chain uses Deno:

```lua
markdown = { 'deno_fmt_markdown', 'mdslw', 'injected' }
```

Change to Dprint:

```lua
markdown = { 'dprint', 'mdslw', 'injected' }
```

Change TS/JS/JSON to Biome:

```lua
javascript        = { 'biome' },
javascriptreact   = { 'biome' },
typescript        = { 'biome' },
typescriptreact   = { 'biome' },
json              = { 'biome' },
jsonc             = { 'biome' },
```

Add Python Ruff if not already configured:

```lua
python = { 'ruff_format', 'ruff_fix', 'ruff_organize_imports' }
```

Use actual Conform formatter names.
Verify with Conform docs/current config.

Remove `deno_fmt_markdown` only if no other filetype uses it.

## Step 5: update GitHub workflow

Current workflow installs Bun and Nushell manually, then runs Python scripts.

Replace manual installs with mise.

Target shape:

```yaml
- name: Install mise
  run: |
    curl https://mise.run | sh
    echo "$HOME/.local/bin" >> "$GITHUB_PATH"

- name: Install tools
  run: mise install

- name: CI
  run: mise run ci
```

If `pi` is required in CI, either install Pi explicitly or document that CI only
runs extension build/tests that do not need interactive Pi.
Do not hide missing Pi behind optional behavior.

## Step 6: update publish/release path

Find current publish entry:

```bash
python3 scripts/extensions.py publish
```

Ensure publish task always depends on `ci`:

```toml
[tasks.publish]
depends = ["ci"]
run = "python3 scripts/extensions.py publish"
```

If there is a separate release prompt/script, route it through `mise run
publish` or `mise run ci` first.

The invariant:
no publish/release command bypasses `ci`.

## Step 7: remove `justfile`

Once these pass:

```bash
mise run fmt
mise run lint
mise run test
mise run build
mise run ci
```

Delete `justfile`.

Update docs/prompts mentioning `just`:

- `README.md`
- `.pi/prompts/drive-demo.md`
- release docs/prompts
- any agent instructions that say `just demo`, `just check`, `just test`

Replace examples:

```text
just demo tldr
```

with:

```text
mise run demo -- tldr
```

Add a `demo` task in `mise.toml` before updating references:

```toml
[tasks.demo]
description = "Record demo GIFs"
run = "python3 scripts/demo.py"
```

Confirm argument forwarding.
If `mise run demo -- tldr` does not pass args as expected, use a `usage` block
or a file task.

## Step 8: fix all formatting/lint failures

Expected first run will be noisy.

Order:

1. `mise run fmt`
2. inspect diff
3. `mise run lint`
4. fix remaining lint failures manually
5. repeat until clean

Markdownlint previously reported:

```text
36 README files
309 errors
MD013 line-length: 271
MD060 table-column-style: 22
MD032 blanks-around-lists: 16
```

Do not disable those rules just to pass.
Use formatter + manual cleanup.

## Step 9: lock deps

After tools install and tasks work:

```bash
mise lock
```

Commit:

- `mise.toml`
- `mise.lock`
- tool config files
- docs updates
- formatted files

## Step 10: acceptance checklist

Before final commit:

```bash
mise install
mise run fmt
mise run lint
mise run test
mise run build
mise run ci
mise run publish -- --dry-run
```

If publish has no dry-run flag, do not run real publish.
Add a dry-run flag first or document why it is unavailable.

Final repo properties:

- no `justfile`
- no `.githooks`
- no Git hook setup docs
- `mise.toml` is the one command surface
- `mise.lock` exists if lockfile is chosen
- Neovim formatter config matches repo tasks
- CI uses `mise run ci`
- publish/release path depends on `ci`
- Markdown lints are fixed, not disabled

## Notes for Windows

Avoid these patterns:

```bash
jj file list 'glob:**/*.md' | xargs ...
git ls-files -z | xargs -0 ...
find ... -exec ...
```

Prefer:

```bash
dprint fmt
mdslw .
biome ci .
ruff check .
markdownlint-cli2
```

If a tool cannot discover files correctly, add a tiny cross-platform script in
Python or TypeScript and call that from mise.
Do not build large shell pipelines.