@gotgenes/pi-autoformat 0.1.0 → 4.0.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/.github/workflows/ci.yml +1 -3
- package/.github/workflows/release-please.yml +29 -0
- package/.markdownlint-cli2.yaml +14 -2
- package/.pi/extensions/pi-autoformat/config.json +3 -6
- package/.pi/prompts/README.md +59 -0
- package/.pi/prompts/plan-issue.md +64 -0
- package/.pi/prompts/retro.md +144 -0
- package/.pi/prompts/ship-issue.md +77 -0
- package/.pi/prompts/tdd-plan.md +67 -0
- package/.pi/skills/pi-extension-lifecycle/SKILL.md +256 -0
- package/.release-please-manifest.json +1 -1
- package/AGENTS.md +39 -0
- package/CHANGELOG.md +365 -0
- package/README.md +42 -109
- package/biome.json +1 -1
- package/docs/assets/logo.png +0 -0
- package/docs/assets/logo.svg +533 -0
- package/docs/configuration.md +358 -38
- package/docs/plans/0001-initial-implementation-plan.md +17 -9
- package/docs/plans/0002-richer-tui-formatter-summaries.md +220 -0
- package/docs/plans/0003-additional-pi-mutation-tools.md +273 -0
- package/docs/plans/0004-shell-driven-mutation-coverage.md +296 -0
- package/docs/plans/0010-acceptance-test-coverage.md +240 -0
- package/docs/plans/0012-remove-unused-formatter-extensions-field.md +152 -0
- package/docs/plans/0013-fallback-chain-step-type.md +280 -0
- package/docs/plans/0014-batch-by-default-formatter-dispatch.md +195 -0
- package/docs/plans/0015-builtin-treefmt-and-treefmt-nix-support.md +290 -0
- package/docs/plans/0016-detailed-formatter-output-on-failure.md +245 -0
- package/docs/plans/0022-pi-coding-agent-types.md +201 -0
- package/docs/plans/0027-format-before-agent-exit-follow-up-turn.md +355 -0
- package/docs/plans/0031-turn-end-flush-with-change-detection.md +365 -0
- package/docs/retro/0002-richer-tui-formatter-summaries.md +47 -0
- package/docs/retro/0013-fallback-chain-step-type.md +67 -0
- package/docs/retro/0015-builtin-treefmt-and-treefmt-nix-support.md +56 -0
- package/docs/retro/0016-detailed-formatter-output-on-failure.md +60 -0
- package/docs/retro/0022-pi-coding-agent-types.md +62 -0
- package/docs/testing.md +95 -0
- package/package.json +30 -11
- package/prek.toml +2 -2
- package/schemas/pi-autoformat.schema.json +145 -21
- package/src/builtin-formatters.ts +205 -0
- package/src/command-probe.ts +66 -0
- package/src/config-loader.ts +829 -90
- package/src/custom-mutation-tools.ts +125 -0
- package/src/extension.ts +469 -82
- package/src/format-scope.ts +118 -0
- package/src/formatter-config.ts +73 -36
- package/src/formatter-executor.ts +230 -34
- package/src/formatter-output-report.ts +149 -0
- package/src/formatter-registry.ts +139 -30
- package/src/index.ts +26 -5
- package/src/prompt-autoformatter.ts +148 -23
- package/src/shell-mutation-detector.ts +572 -0
- package/src/touched-files-queue.ts +72 -11
- package/test/acceptance-event-bus.test.ts +138 -0
- package/test/acceptance.test.ts +69 -0
- package/test/builtin-formatters.test.ts +382 -0
- package/test/command-probe.test.ts +79 -0
- package/test/config-loader.test.ts +640 -21
- package/test/custom-mutation-tools.test.ts +190 -0
- package/test/extension.test.ts +1535 -158
- package/test/fallback-acceptance.test.ts +98 -0
- package/test/fixtures/event-bus-emitter.ts +26 -0
- package/test/fixtures/formatter-recorder.mjs +25 -0
- package/test/format-scope.test.ts +139 -0
- package/test/formatter-config.test.ts +56 -5
- package/test/formatter-executor.test.ts +555 -35
- package/test/formatter-output-report.test.ts +178 -0
- package/test/formatter-registry.test.ts +330 -37
- package/test/helpers/rpc.ts +146 -0
- package/test/prompt-autoformatter.test.ts +315 -22
- package/test/schema.test.ts +149 -0
- package/test/shell-mutation-detector.test.ts +221 -0
- package/test/touched-files-queue.test.ts +40 -1
- package/test/types/theme-stub.test-d.ts +42 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [4.0.3](https://github.com/gotgenes/pi-autoformat/compare/v4.0.2...v4.0.3) (2026-05-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* add repository URL for OIDC provenance publishing ([4b5335e](https://github.com/gotgenes/pi-autoformat/commit/4b5335e2a7b39531af811a6756ef5656e64831ef))
|
|
9
|
+
|
|
10
|
+
## [4.0.2](https://github.com/gotgenes/pi-autoformat/compare/v4.0.1...v4.0.2) (2026-05-06)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Miscellaneous Chores
|
|
14
|
+
|
|
15
|
+
* update dependencies ([8e59b6c](https://github.com/gotgenes/pi-autoformat/commit/8e59b6c186411b247b409dc823b21bb22a8e8c69))
|
|
16
|
+
|
|
17
|
+
## [4.0.1](https://github.com/gotgenes/pi-autoformat/compare/v4.0.0...v4.0.1) (2026-05-06)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Documentation
|
|
21
|
+
|
|
22
|
+
* add logo to README ([8044f45](https://github.com/gotgenes/pi-autoformat/commit/8044f45b3a37b8684ea5d187afc67b0eaa27947f))
|
|
23
|
+
|
|
24
|
+
## [4.0.0](https://github.com/gotgenes/pi-autoformat/compare/v3.0.1...v4.0.0) (2026-05-03)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### ⚠ BREAKING CHANGES
|
|
28
|
+
|
|
29
|
+
* The agent_end follow-up turn mechanism has been removed. Formatting notifications are now delivered inline as steering messages between turns.
|
|
30
|
+
* notifyAgent is no longer accepted in the configuration schema. The extension now notifies via steering messages at turn end.
|
|
31
|
+
* notifyAgent config field has been removed. The extension now notifies via steering messages at turn end.
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
* add buildSteeringMessageContent helper ([#31](https://github.com/gotgenes/pi-autoformat/issues/31)) ([e0e7d86](https://github.com/gotgenes/pi-autoformat/commit/e0e7d867adea60727c21da9ebb57d819d8a2c5ba))
|
|
36
|
+
* add pi-extension-lifecycle skill with turn/tool model reference ([#31](https://github.com/gotgenes/pi-autoformat/issues/31)) ([a136bc6](https://github.com/gotgenes/pi-autoformat/commit/a136bc6a17b3cd68b57ef1524cb0773a09343703))
|
|
37
|
+
* detect content changes in flushPrompt ([#31](https://github.com/gotgenes/pi-autoformat/issues/31)) ([65c735d](https://github.com/gotgenes/pi-autoformat/commit/65c735dd86b0553d608f465b20c59e2c337b5a38))
|
|
38
|
+
* flush formatters at turn_end ([#31](https://github.com/gotgenes/pi-autoformat/issues/31)) ([6b27a78](https://github.com/gotgenes/pi-autoformat/commit/6b27a78048eb95d5f1d0e43d0def18961a4568c4))
|
|
39
|
+
* include failure details in steering notification ([#31](https://github.com/gotgenes/pi-autoformat/issues/31)) ([28109a6](https://github.com/gotgenes/pi-autoformat/commit/28109a6e54ee8c5ad6c36664079f7dba59e8a793))
|
|
40
|
+
* remove notifyAgent config field ([#31](https://github.com/gotgenes/pi-autoformat/issues/31)) ([d5b1d0c](https://github.com/gotgenes/pi-autoformat/commit/d5b1d0c1bdfdda5409c8b50d2d8d777c035a7680))
|
|
41
|
+
* remove notifyAgent from schema ([#31](https://github.com/gotgenes/pi-autoformat/issues/31)) ([c936148](https://github.com/gotgenes/pi-autoformat/commit/c93614868fd98a36f40fd6c443db761858162fae))
|
|
42
|
+
* replace agent_end follow-up with turn-end steering ([#31](https://github.com/gotgenes/pi-autoformat/issues/31)) ([8e2e7bb](https://github.com/gotgenes/pi-autoformat/commit/8e2e7bb8a21c8f217b0e8c341032820f968bcf36))
|
|
43
|
+
* send steering notification after turn-end formatting ([#31](https://github.com/gotgenes/pi-autoformat/issues/31)) ([aa18c6d](https://github.com/gotgenes/pi-autoformat/commit/aa18c6db604bc77d7b34a05601965dbd32bad92b))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Bug Fixes
|
|
47
|
+
|
|
48
|
+
* markdownlint table separator spacing in plan and skill ([#31](https://github.com/gotgenes/pi-autoformat/issues/31)) ([84767fa](https://github.com/gotgenes/pi-autoformat/commit/84767fa8c9a8bb630339842cf3f067e8960619f4))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Documentation
|
|
52
|
+
|
|
53
|
+
* add plan for pre-commit flush ([#31](https://github.com/gotgenes/pi-autoformat/issues/31)) ([2ffd469](https://github.com/gotgenes/pi-autoformat/commit/2ffd469c5d3c29bbe550fa4c449dc378c7548636))
|
|
54
|
+
* add table separator spacing rule to AGENTS.md ([b3076e8](https://github.com/gotgenes/pi-autoformat/commit/b3076e8f810d0f2c4f0c77ad519964b62faf3289))
|
|
55
|
+
* document turn-end formatting and steering notifications ([#31](https://github.com/gotgenes/pi-autoformat/issues/31)) ([2fc6bf5](https://github.com/gotgenes/pi-autoformat/commit/2fc6bf533adf4fe333febcef73f2f5e0db032658))
|
|
56
|
+
* plan turn-end flush with change detection ([#31](https://github.com/gotgenes/pi-autoformat/issues/31)) ([a4429a8](https://github.com/gotgenes/pi-autoformat/commit/a4429a8fa3e432e69e093aa030674207ac89d122))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Miscellaneous Chores
|
|
60
|
+
|
|
61
|
+
* remove --fix flags from prek hooks ([a9664a2](https://github.com/gotgenes/pi-autoformat/commit/a9664a285473a7306e28a67f03ff517681a4c8ab))
|
|
62
|
+
|
|
63
|
+
## [3.0.1](https://github.com/gotgenes/pi-autoformat/compare/v3.0.0...v3.0.1) (2026-05-02)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Bug Fixes
|
|
67
|
+
|
|
68
|
+
* remove default formatter chains to prevent unwanted formatting ([48f690e](https://github.com/gotgenes/pi-autoformat/commit/48f690e243fd41e789e8a6281d32067218a6ccb5))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### Documentation
|
|
72
|
+
|
|
73
|
+
* update README and configuration for no default chains ([6e7015b](https://github.com/gotgenes/pi-autoformat/commit/6e7015bf72cbf66b6dde164a7ed5e7d79be7544f))
|
|
74
|
+
|
|
75
|
+
## [3.0.0](https://github.com/gotgenes/pi-autoformat/compare/v2.4.2...v3.0.0) (2026-05-02)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### ⚠ BREAKING CHANGES
|
|
79
|
+
|
|
80
|
+
* Removed formatMode branching from the extension runtime. The tool_result handler no longer conditionally flushes. The agent_end handler always flushes. The session_shutdown handler no longer conditionally flushes. Tests for tool and session mode behaviors have been removed.
|
|
81
|
+
* The formatMode property has been removed from the JSON schema. Existing configs with formatMode will fail schema validation but the config loader still tolerates the key with a deprecation notice.
|
|
82
|
+
* The formatMode config field has been removed. The runtime always uses prompt-end formatting (the previous "prompt" behavior). The config loader tolerates the legacy key, emits a config issue, and discards the value.
|
|
83
|
+
|
|
84
|
+
### Features
|
|
85
|
+
|
|
86
|
+
* add buildNotifyMessageContent helper ([#27](https://github.com/gotgenes/pi-autoformat/issues/27)) ([74d8451](https://github.com/gotgenes/pi-autoformat/commit/74d845101a4ca9ea76b68c2b7db98c2786583737))
|
|
87
|
+
* add notifyAgent config field ([#27](https://github.com/gotgenes/pi-autoformat/issues/27)) ([f660c84](https://github.com/gotgenes/pi-autoformat/commit/f660c841ac54701c18aacae209e0a37b901a5cda))
|
|
88
|
+
* always use prompt-end formatting ([#27](https://github.com/gotgenes/pi-autoformat/issues/27)) ([991d0c8](https://github.com/gotgenes/pi-autoformat/commit/991d0c8de66575d96fdf7e5eca3a5b24e812e2dd))
|
|
89
|
+
* emit config issue for legacy formatMode key ([#27](https://github.com/gotgenes/pi-autoformat/issues/27)) ([98f51e9](https://github.com/gotgenes/pi-autoformat/commit/98f51e9d09c3551013212d3611f0741a66bf400d))
|
|
90
|
+
* include formatter failures in follow-up message ([#27](https://github.com/gotgenes/pi-autoformat/issues/27)) ([fe41c38](https://github.com/gotgenes/pi-autoformat/commit/fe41c38e4ea18c508b23564558cc1ef1c542368b))
|
|
91
|
+
* remove formatMode config field ([#27](https://github.com/gotgenes/pi-autoformat/issues/27)) ([d5b4484](https://github.com/gotgenes/pi-autoformat/commit/d5b4484c59d64f014440f8194795e129f8354f48))
|
|
92
|
+
* remove formatMode from config schema ([#27](https://github.com/gotgenes/pi-autoformat/issues/27)) ([bb970f1](https://github.com/gotgenes/pi-autoformat/commit/bb970f1e7c106c9d4eb5ba3a5b8da3be6488d455))
|
|
93
|
+
* send follow-up turn after formatting ([#27](https://github.com/gotgenes/pi-autoformat/issues/27)) ([ff4b6bd](https://github.com/gotgenes/pi-autoformat/commit/ff4b6bd37d23b5a57ec723fb135cb15e306bf469))
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### Bug Fixes
|
|
97
|
+
|
|
98
|
+
* safety-net flush on session_shutdown and lint fixes ([#27](https://github.com/gotgenes/pi-autoformat/issues/27)) ([3f834f0](https://github.com/gotgenes/pi-autoformat/commit/3f834f0bd676e1da66f60583e3f05130d5a5039f))
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
### Documentation
|
|
102
|
+
|
|
103
|
+
* backport prompt template improvements from pi-permission-system ([59e35f3](https://github.com/gotgenes/pi-autoformat/commit/59e35f3d622dca89093f18eb330857b267cadba6))
|
|
104
|
+
* document notifyAgent and remove formatMode docs ([#27](https://github.com/gotgenes/pi-autoformat/issues/27)) ([d4b8f24](https://github.com/gotgenes/pi-autoformat/commit/d4b8f24c7c4f87f076878afc93d0b4b61117218c))
|
|
105
|
+
* plan format-before-exit follow-up turn ([#27](https://github.com/gotgenes/pi-autoformat/issues/27)) ([85eb70d](https://github.com/gotgenes/pi-autoformat/commit/85eb70ddd6d769437b1b81667a6cb72cb4a5be62))
|
|
106
|
+
* plan format-before-exit follow-up turn ([#27](https://github.com/gotgenes/pi-autoformat/issues/27)) ([626a8fd](https://github.com/gotgenes/pi-autoformat/commit/626a8fd563ce2454fcea28c49d4a880600ec03ab))
|
|
107
|
+
|
|
108
|
+
## [2.4.2](https://github.com/gotgenes/pi-autoformat/compare/v2.4.1...v2.4.2) (2026-05-02)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
### Documentation
|
|
112
|
+
|
|
113
|
+
* drop stale v1 framing from configuration reference ([5e6d765](https://github.com/gotgenes/pi-autoformat/commit/5e6d765ac40a045fc6db18df2796a45f9cdc8c31))
|
|
114
|
+
* slim README and link to configuration reference ([a5bbec0](https://github.com/gotgenes/pi-autoformat/commit/a5bbec041b0be93a54e27cd04759b17a1bdbf724))
|
|
115
|
+
|
|
116
|
+
## [2.4.1](https://github.com/gotgenes/pi-autoformat/compare/v2.4.0...v2.4.1) (2026-05-02)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
### Documentation
|
|
120
|
+
|
|
121
|
+
* **retro:** add retro notes for issue [#15](https://github.com/gotgenes/pi-autoformat/issues/15) ([314f89a](https://github.com/gotgenes/pi-autoformat/commit/314f89a1eaede591426b81d7ae37e187af9f644a))
|
|
122
|
+
|
|
123
|
+
## [2.4.0](https://github.com/gotgenes/pi-autoformat/compare/v2.3.2...v2.4.0) (2026-05-02)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
### Features
|
|
127
|
+
|
|
128
|
+
* accept built-in names in chains validation ([e96d346](https://github.com/gotgenes/pi-autoformat/commit/e96d3461e2c3a27173046e30021ba55bb35a2e25))
|
|
129
|
+
* allow wildcard chain key in schema ([a11d4b3](https://github.com/gotgenes/pi-autoformat/commit/a11d4b3d225c077e6f4dbb209610bf4df3507605))
|
|
130
|
+
* build treefmt and treefmt-nix invocations ([cc1f32a](https://github.com/gotgenes/pi-autoformat/commit/cc1f32a26c5c3b237ad88172993539f67a699ed2))
|
|
131
|
+
* discover treefmt and treefmt-nix config roots ([53141d2](https://github.com/gotgenes/pi-autoformat/commit/53141d22e5b529eb2f62b652fbdafd93ebb56105))
|
|
132
|
+
* dispatch wildcard chain before per-extension chains ([07758b0](https://github.com/gotgenes/pi-autoformat/commit/07758b07fae49a99850184ce892281303b93f537))
|
|
133
|
+
* group files by wildcard chain first ([c15b4d2](https://github.com/gotgenes/pi-autoformat/commit/c15b4d2fff41ef40391cfef33ca0f44667e0c535))
|
|
134
|
+
* parse treefmt skip patterns ([973f7e4](https://github.com/gotgenes/pi-autoformat/commit/973f7e42984f7089a3be26e6ff135f93b65d8558))
|
|
135
|
+
* partition built-in batches by handled set ([08f8016](https://github.com/gotgenes/pi-autoformat/commit/08f8016adfc3f8db6e866cef16e9292f6f5487a7))
|
|
136
|
+
* prefer treefmt-nix over treefmt at same root ([c3625f3](https://github.com/gotgenes/pi-autoformat/commit/c3625f31fa4d4968ce203f95609481abe2db20bd))
|
|
137
|
+
* register treefmt and treefmt-nix as built-in formatters ([7e53dfb](https://github.com/gotgenes/pi-autoformat/commit/7e53dfb495c2faa2f2c63a728973929796c70f0e))
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
### Documentation
|
|
141
|
+
|
|
142
|
+
* document built-in treefmt and treefmt-nix support ([82d3511](https://github.com/gotgenes/pi-autoformat/commit/82d351141c39aa47f96f11059fd67d4589d2ad07))
|
|
143
|
+
* plan built-in treefmt and treefmt-nix support ([#15](https://github.com/gotgenes/pi-autoformat/issues/15)) ([2ce1706](https://github.com/gotgenes/pi-autoformat/commit/2ce17061ea36795ce0192f5302037a3e666b66b4))
|
|
144
|
+
|
|
145
|
+
## [2.3.2](https://github.com/gotgenes/pi-autoformat/compare/v2.3.1...v2.3.2) (2026-05-02)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
### Documentation
|
|
149
|
+
|
|
150
|
+
* document acceptance-test layout and pi binary resolution ([38f95fe](https://github.com/gotgenes/pi-autoformat/commit/38f95fe63d1c633183adf145431ad097ec97a198))
|
|
151
|
+
* plan expanded acceptance test coverage ([#10](https://github.com/gotgenes/pi-autoformat/issues/10)) ([382fbfc](https://github.com/gotgenes/pi-autoformat/commit/382fbfc65d67d8c673f0d1db8a99b20619a18b46))
|
|
152
|
+
* resolve pi from node_modules in acceptance plan ([#10](https://github.com/gotgenes/pi-autoformat/issues/10)) ([e262805](https://github.com/gotgenes/pi-autoformat/commit/e2628057192eae06c44e22808e161b2da579b917))
|
|
153
|
+
* **retro:** add retro notes for issue [#22](https://github.com/gotgenes/pi-autoformat/issues/22) ([b0464d8](https://github.com/gotgenes/pi-autoformat/commit/b0464d8c653e6e697d3c7ba18a3135c1ad44e96f))
|
|
154
|
+
|
|
155
|
+
## [2.3.1](https://github.com/gotgenes/pi-autoformat/compare/v2.3.0...v2.3.1) (2026-05-02)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
### Documentation
|
|
159
|
+
|
|
160
|
+
* plan adopting pi-coding-agent types ([#22](https://github.com/gotgenes/pi-autoformat/issues/22)) ([d06f43c](https://github.com/gotgenes/pi-autoformat/commit/d06f43cb216fb10a8c4ce2252dd55ded65ce5114))
|
|
161
|
+
* **retro:** add retro notes for issue [#2](https://github.com/gotgenes/pi-autoformat/issues/2) ([9e1ebd6](https://github.com/gotgenes/pi-autoformat/commit/9e1ebd680098d5588c382c6d37080defffb5b5b1))
|
|
162
|
+
* **retro:** revert pi-mono pointer in favor of issue [#22](https://github.com/gotgenes/pi-autoformat/issues/22) ([3289595](https://github.com/gotgenes/pi-autoformat/commit/32895952b2a65b14c5c191dc80a2eae2196a77c6))
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
### Miscellaneous Chores
|
|
166
|
+
|
|
167
|
+
* add pi-coding-agent for runtime types ([2d93a5e](https://github.com/gotgenes/pi-autoformat/commit/2d93a5e3cd56dac630f978618ff6c1d1cd3dd031))
|
|
168
|
+
|
|
169
|
+
## [2.3.0](https://github.com/gotgenes/pi-autoformat/compare/v2.2.0...v2.3.0) (2026-05-02)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
### Features
|
|
173
|
+
|
|
174
|
+
* add formatter run output trimming helper ([4263a78](https://github.com/gotgenes/pi-autoformat/commit/4263a7822f969eb0a3633864c99b5573dcc2ea87))
|
|
175
|
+
* add formatterOutput config object with safe defaults ([c0a88e2](https://github.com/gotgenes/pi-autoformat/commit/c0a88e23a8cccc3cba2e70d6b44fafe80ad4facb))
|
|
176
|
+
* surface failed formatter output in reports ([768bf2a](https://github.com/gotgenes/pi-autoformat/commit/768bf2a3d0ac67f9ef4010de3347300be831ea22))
|
|
177
|
+
* surface formatterOutput in the JSON schema ([15cbfef](https://github.com/gotgenes/pi-autoformat/commit/15cbfefcc23c1462a6e62ad094da48c22287270c))
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
### Bug Fixes
|
|
181
|
+
|
|
182
|
+
* preserve theme this binding when coloring the status line ([6a6ec16](https://github.com/gotgenes/pi-autoformat/commit/6a6ec16bbb52b4a14c12a7e86d36d691a3c41eb2))
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
### Documentation
|
|
186
|
+
|
|
187
|
+
* apply autoformat to plan 0016 ([04677ee](https://github.com/gotgenes/pi-autoformat/commit/04677eee19698e0448776157c3ddcc77e2489793))
|
|
188
|
+
* document the formatterOutput failure reporting option ([6cb70c6](https://github.com/gotgenes/pi-autoformat/commit/6cb70c6d1b05914daf4aa46ae043149650ca1bfa))
|
|
189
|
+
* plan optional detailed formatter output on failure ([#2](https://github.com/gotgenes/pi-autoformat/issues/2)) ([a2d466e](https://github.com/gotgenes/pi-autoformat/commit/a2d466ebab41bcfaa4ef25e04794e42fb30b031a))
|
|
190
|
+
* **retro:** add retro notes for issue [#1](https://github.com/gotgenes/pi-autoformat/issues/1) ([031cde3](https://github.com/gotgenes/pi-autoformat/commit/031cde358312e93ee0fd1a75ed8a951539c15a65))
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
### Miscellaneous Chores
|
|
194
|
+
|
|
195
|
+
* update pi-autoformat config ([5759bf6](https://github.com/gotgenes/pi-autoformat/commit/5759bf6ff3c964bbaa9b183f7c1ae68940523c2a))
|
|
196
|
+
|
|
197
|
+
## [2.2.0](https://github.com/gotgenes/pi-autoformat/compare/v2.1.0...v2.2.0) (2026-05-02)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
### Features
|
|
201
|
+
|
|
202
|
+
* add /retro slash command for end-of-flow retrospectives ([09a50ed](https://github.com/gotgenes/pi-autoformat/commit/09a50ed78b18ae48633759f75d423b03df118138))
|
|
203
|
+
* clear autoformat status on session lifecycle boundaries ([4834d45](https://github.com/gotgenes/pi-autoformat/commit/4834d452cb5cfd99f8988b40d9a05dbb8da1e720))
|
|
204
|
+
* keep failure notifications and add persistent failure status ([9ece2b8](https://github.com/gotgenes/pi-autoformat/commit/9ece2b8c64fa9730c91080bd190bdcfcbf87472b))
|
|
205
|
+
* render formatter success summaries in the footer status ([2a37b1b](https://github.com/gotgenes/pi-autoformat/commit/2a37b1bd5fb04c1f3dd2630daa139ca0c87425d2))
|
|
206
|
+
* respect hideSummariesInTui for footer status ([3cf8548](https://github.com/gotgenes/pi-autoformat/commit/3cf8548d7e63d6b0cd78f1e0c5953ec67624df10))
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
### Documentation
|
|
210
|
+
|
|
211
|
+
* add frontmatter convention to plans and retros ([2648129](https://github.com/gotgenes/pi-autoformat/commit/26481296025d41076761437b3e97d50789b2fa3e))
|
|
212
|
+
* describe footer-status formatter summaries ([1df2550](https://github.com/gotgenes/pi-autoformat/commit/1df2550720c368145e3e927f0cecc6782939555f))
|
|
213
|
+
* plan richer TUI formatter summaries via footer status ([#1](https://github.com/gotgenes/pi-autoformat/issues/1)) ([a50fba9](https://github.com/gotgenes/pi-autoformat/commit/a50fba9b707ce6831547411ddf539d872bfcc2a4))
|
|
214
|
+
* **retro:** add retro notes for issue [#13](https://github.com/gotgenes/pi-autoformat/issues/13) ([9591d5a](https://github.com/gotgenes/pi-autoformat/commit/9591d5a6df28262c2e40e1457c76504cc3e7315b))
|
|
215
|
+
|
|
216
|
+
## [2.1.0](https://github.com/gotgenes/pi-autoformat/compare/v2.0.0...v2.1.0) (2026-05-01)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
### Features
|
|
220
|
+
|
|
221
|
+
* add PATH probe with per-flush cache ([aa97aa7](https://github.com/gotgenes/pi-autoformat/commit/aa97aa77a1a6070e13416290a56589fe4057f2d8))
|
|
222
|
+
* allow fallback chain steps in schema ([535190e](https://github.com/gotgenes/pi-autoformat/commit/535190e83681c3be80fafe2947edbca21be27360))
|
|
223
|
+
* dispatch fallback chain steps ([a263778](https://github.com/gotgenes/pi-autoformat/commit/a26377872eca7f0186aafa619a6fe3a6570298cf))
|
|
224
|
+
* resolve fallback chain steps ([6daed75](https://github.com/gotgenes/pi-autoformat/commit/6daed752eaca03c5f10885055c77f027121913a8))
|
|
225
|
+
* share PATH probe cache across flush ([8d0af4d](https://github.com/gotgenes/pi-autoformat/commit/8d0af4da40b16d542a374cad00cafe867d41fb5f))
|
|
226
|
+
* support fallback steps in chain grouping ([f07acc5](https://github.com/gotgenes/pi-autoformat/commit/f07acc5199795fa4f4779292179ca90d0c8da919))
|
|
227
|
+
* surface fallback context in flush reporting ([2159cfb](https://github.com/gotgenes/pi-autoformat/commit/2159cfbd6def3f418d14f244fc6fd8476210de66))
|
|
228
|
+
* surface unknown formatter names in chains as config issues ([f46f7af](https://github.com/gotgenes/pi-autoformat/commit/f46f7afa0c82188b7089841778beffeba225dca6))
|
|
229
|
+
* validate fallback chain steps in config loader ([ec52a14](https://github.com/gotgenes/pi-autoformat/commit/ec52a14574cfc3ef636b008423ad08c3b77cdaf2))
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
### Documentation
|
|
233
|
+
|
|
234
|
+
* document deprecation pattern for removed config fields ([988ae7b](https://github.com/gotgenes/pi-autoformat/commit/988ae7b0daed4f604354b9392bd7a89d0df36cc3))
|
|
235
|
+
* document fallback chain steps and project-config recommendation ([3bbc846](https://github.com/gotgenes/pi-autoformat/commit/3bbc846701a0e0551451e81eae4540cff3b36381))
|
|
236
|
+
* plan fallback chain step type ([#13](https://github.com/gotgenes/pi-autoformat/issues/13)) ([83df5ff](https://github.com/gotgenes/pi-autoformat/commit/83df5ff05587e686f9df41871f60de2057d5f79b))
|
|
237
|
+
* **prompts:** renumber ship-issue steps to 1-based indexing ([3f37ba6](https://github.com/gotgenes/pi-autoformat/commit/3f37ba6613aa67a496115bb366a497df3661b8f3))
|
|
238
|
+
* **prompts:** require clean git pull --ff-only before plan/tdd/ship ([22cfe92](https://github.com/gotgenes/pi-autoformat/commit/22cfe92a2cd6615951fc7ba027363c43a70dc177))
|
|
239
|
+
|
|
240
|
+
## [2.0.0](https://github.com/gotgenes/pi-autoformat/compare/v1.0.0...v2.0.0) (2026-05-01)
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
### ⚠ BREAKING CHANGES
|
|
244
|
+
|
|
245
|
+
* `formatterDefinition.extensions` is no longer declared in schemas/pi-autoformat.schema.json. Editor validators will flag stale `extensions` keys as unknown properties. The runtime loader still tolerates them with a deprecation notice.
|
|
246
|
+
* `FormatterDefinition.extensions` has been removed from the public TypeScript type and from built-in defaults. Code that reads or writes that field must be updated. On-disk configs are tolerated with a deprecation notice.
|
|
247
|
+
|
|
248
|
+
### Features
|
|
249
|
+
|
|
250
|
+
* drop extensions field from FormatterDefinition and loader ([3fd791e](https://github.com/gotgenes/pi-autoformat/commit/3fd791e9de7f44f863986ad55c3db94d964cdda4))
|
|
251
|
+
* drop extensions from pi-autoformat JSON schema ([018c1a7](https://github.com/gotgenes/pi-autoformat/commit/018c1a776dc7fe97b4957b06874ff3391c8b26ef))
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
### Documentation
|
|
255
|
+
|
|
256
|
+
* add issue-driven workflow prompt templates ([14295be](https://github.com/gotgenes/pi-autoformat/commit/14295be83f5953dbbc143d0a12440f759216c5f2))
|
|
257
|
+
* adopt one-sentence-per-line and code-fence language conventions ([544fc68](https://github.com/gotgenes/pi-autoformat/commit/544fc68ead478120948070d904ff9698a5aa1624))
|
|
258
|
+
* plan removing unused formatter extensions field ([#12](https://github.com/gotgenes/pi-autoformat/issues/12)) ([fe0b6bd](https://github.com/gotgenes/pi-autoformat/commit/fe0b6bdfbad38d48c163b4b714e1d48dcc249a29))
|
|
259
|
+
* reflow markdown to one sentence per line ([49bdefb](https://github.com/gotgenes/pi-autoformat/commit/49bdefb6ccd853e2422213854c460d405472fa7e))
|
|
260
|
+
* remove formatter extensions field and note deprecation ([ddc54cd](https://github.com/gotgenes/pi-autoformat/commit/ddc54cddfdbd90b8973b21631ce555a275b895b9))
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
### Miscellaneous Chores
|
|
264
|
+
|
|
265
|
+
* add npm keywords including pi-package for registry ([aee15c0](https://github.com/gotgenes/pi-autoformat/commit/aee15c092e3f399d174241ed55879bcb75818b49))
|
|
266
|
+
|
|
267
|
+
## [1.0.0](https://github.com/gotgenes/pi-autoformat/compare/v0.4.0...v1.0.0) (2026-05-01)
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
### ⚠ BREAKING CHANGES
|
|
271
|
+
|
|
272
|
+
* removes resolveFormatterChainForFile, executeFormatterChain, and FormatterExecutionResult. Default formatter commands no longer include $FILE; the schema rejects $FILE in formatter command arguments.
|
|
273
|
+
* failure summaries are now grouped per batch instead of per file (one line per failed batch listing the files it ran against).
|
|
274
|
+
* PromptAutoformatterResult now exposes groups[] instead of files[]; each group runs its chain once with all files appended.
|
|
275
|
+
* $FILE substitution is no longer supported. File paths are appended to the command automatically by the batch executor.
|
|
276
|
+
|
|
277
|
+
### Features
|
|
278
|
+
|
|
279
|
+
* add resolveChain for name-based formatter resolution ([b67dbc3](https://github.com/gotgenes/pi-autoformat/commit/b67dbc389441930b545275ee67d0f7aca601ca53))
|
|
280
|
+
* batch-dispatch chain steps via executeChainGroup ([83a6627](https://github.com/gotgenes/pi-autoformat/commit/83a6627433586dc46850a6bc81b809c55a4c7fc9))
|
|
281
|
+
* drop $FILE substitution and per-file dispatch path ([d26f825](https://github.com/gotgenes/pi-autoformat/commit/d26f825487e8fa3ced0498e23f64089abc9dee6d))
|
|
282
|
+
* group touched files by chain identity ([6a8832b](https://github.com/gotgenes/pi-autoformat/commit/6a8832b6e1c25518d558da295dba977ce086ae4d))
|
|
283
|
+
* reject $FILE in formatter commands ([3865b34](https://github.com/gotgenes/pi-autoformat/commit/3865b349b9ed9ef1dff1a66a3411511c4d82d4cf))
|
|
284
|
+
* report formatter results per batch ([d16d7b1](https://github.com/gotgenes/pi-autoformat/commit/d16d7b1694f566f2963af6d353b7ad4356305592))
|
|
285
|
+
* switch PromptAutoformatter to group-based batch dispatch ([42845ee](https://github.com/gotgenes/pi-autoformat/commit/42845eef246f7d7db2182c99596dd656e753f6de))
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
### Documentation
|
|
289
|
+
|
|
290
|
+
* document batch-by-default formatter dispatch ([1e363d2](https://github.com/gotgenes/pi-autoformat/commit/1e363d2755f67d766941ea5800196429cf2176dd))
|
|
291
|
+
* plan batch-by-default formatter dispatch ([#14](https://github.com/gotgenes/pi-autoformat/issues/14)) ([ce330cd](https://github.com/gotgenes/pi-autoformat/commit/ce330cd668edb33ffc9541ad1749c0af168498bd))
|
|
292
|
+
|
|
293
|
+
## [0.4.0](https://github.com/gotgenes/pi-autoformat/compare/v0.3.1...v0.4.0) (2026-05-01)
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
### Features
|
|
297
|
+
|
|
298
|
+
* **config:** add customMutationTools and eventBusMutationChannel schema ([f2a3ac4](https://github.com/gotgenes/pi-autoformat/commit/f2a3ac4b5579270a5938401b3e4b8418550fbe0a))
|
|
299
|
+
* extract touched paths from declared custom tool inputs ([665aaed](https://github.com/gotgenes/pi-autoformat/commit/665aaed00d322f40354cb2990e2bcb3ff89ed2c6))
|
|
300
|
+
* subscribe to EventBus channel for peer-emitted touched files ([8986535](https://github.com/gotgenes/pi-autoformat/commit/898653575f5b4a48b506af05b5c17e363c404555))
|
|
301
|
+
* wire customMutationTools into default autoformatter ([638f203](https://github.com/gotgenes/pi-autoformat/commit/638f2031ed556d369d223acdcb27006d8c649fa8))
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
### Documentation
|
|
305
|
+
|
|
306
|
+
* add plan for additional Pi mutation tools ([5c3fb35](https://github.com/gotgenes/pi-autoformat/commit/5c3fb35d30dd8a8a757d69533eb280a8d798ec89))
|
|
307
|
+
* capture design philosophy in AGENTS.md and README design goals ([e318d1b](https://github.com/gotgenes/pi-autoformat/commit/e318d1bd46b536f8b8d9adae435bf05ec864416a))
|
|
308
|
+
* document customMutationTools and eventBusMutationChannel ([5cc7c71](https://github.com/gotgenes/pi-autoformat/commit/5cc7c713a0cbad49a5b1f5ab83afbd272495483f))
|
|
309
|
+
|
|
310
|
+
## [0.3.1](https://github.com/gotgenes/pi-autoformat/compare/v0.3.0...v0.3.1) (2026-04-29)
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
### Bug Fixes
|
|
314
|
+
|
|
315
|
+
* do not bypass realpath escape check via lexical path in scope test ([89bbae5](https://github.com/gotgenes/pi-autoformat/commit/89bbae50597be7cf406ecb262c2bb71a7fe0e604))
|
|
316
|
+
* pass typecheck for AutoformatConfig and TestPi in tests ([f6e57b1](https://github.com/gotgenes/pi-autoformat/commit/f6e57b12fb7f7c070bb186b5c7369d0d6d5e94da))
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
### Documentation
|
|
320
|
+
|
|
321
|
+
* add status badges to README ([358ca02](https://github.com/gotgenes/pi-autoformat/commit/358ca02bfb43e8e64952d10c2d5784562c6e4e1b))
|
|
322
|
+
* bump pnpm badge to >=10 to match packageManager ([175fd83](https://github.com/gotgenes/pi-autoformat/commit/175fd832d066c838a1a8721a8dc888dc0f3e99a3))
|
|
323
|
+
|
|
324
|
+
## [0.3.0](https://github.com/gotgenes/pi-autoformat/compare/v0.2.0...v0.3.0) (2026-04-29)
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
### Features
|
|
328
|
+
|
|
329
|
+
* add format scope filter with repo-root default and cwd fallback ([aa5449b](https://github.com/gotgenes/pi-autoformat/commit/aa5449b99a15ffa480e5fdd0140bedb08566bf31))
|
|
330
|
+
* detect file mutations from shell commands (opt-in) ([3d06d48](https://github.com/gotgenes/pi-autoformat/commit/3d06d48c96038463dfa46c85e1f6007668c5103e))
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
### Documentation
|
|
334
|
+
|
|
335
|
+
* add plan for shell-driven mutation coverage ([3784e7c](https://github.com/gotgenes/pi-autoformat/commit/3784e7cf8bc7c710865a60b99748aff227f686bb))
|
|
336
|
+
|
|
337
|
+
## [0.2.0](https://github.com/gotgenes/pi-autoformat/compare/v0.1.0...v0.2.0) (2026-04-29)
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
### Features
|
|
341
|
+
|
|
342
|
+
* add default formatter config with user overrides ([9d0d458](https://github.com/gotgenes/pi-autoformat/commit/9d0d4587a9ab8f3a4d1f9d717dc08eea69ee673e))
|
|
343
|
+
* add extension-owned config loader ([cca9655](https://github.com/gotgenes/pi-autoformat/commit/cca9655b9748de46952b1f6d3a161c2754128cef))
|
|
344
|
+
* add prompt-end autoformatter orchestration ([4bbacba](https://github.com/gotgenes/pi-autoformat/commit/4bbacbaaca298ab4ad35cd0508be5cd0be31a8b3))
|
|
345
|
+
* add touched-file queue with prompt-flush semantics ([b6cdec0](https://github.com/gotgenes/pi-autoformat/commit/b6cdec0d09a3c88dcf1ee896c9d808b2a2928e67))
|
|
346
|
+
* execute formatter chains sequentially with non-blocking failures ([869a8b9](https://github.com/gotgenes/pi-autoformat/commit/869a8b98442c6466ef36a226a7fa551d2f88098d))
|
|
347
|
+
* polish autoformat reporting ([f480c44](https://github.com/gotgenes/pi-autoformat/commit/f480c441e0cdb1a7f02db657c33f305a78c783bc))
|
|
348
|
+
* require explicit formatter chains ([2eda3a4](https://github.com/gotgenes/pi-autoformat/commit/2eda3a46d87426b1fa0d872ae16e1ae095cc3236))
|
|
349
|
+
* resolve formatter chains from config registry ([b28eeec](https://github.com/gotgenes/pi-autoformat/commit/b28eeec9bde6119df2fcb20479930e7ce976b2a7))
|
|
350
|
+
* wire autoformatting into pi lifecycle ([786f0f5](https://github.com/gotgenes/pi-autoformat/commit/786f0f55f9dc7d3902e559b56c52dfe5c3620147))
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
### Documentation
|
|
354
|
+
|
|
355
|
+
* add configuration schema and package docs ([032f3ad](https://github.com/gotgenes/pi-autoformat/commit/032f3adf4f5bb1d39814831dc72e2406b8e4244d))
|
|
356
|
+
* clarify formatter command resolution ([fb10662](https://github.com/gotgenes/pi-autoformat/commit/fb1066263dee5fbee534de0bf9644b383a3f605b))
|
|
357
|
+
* mark v1 plan complete ([b25e42e](https://github.com/gotgenes/pi-autoformat/commit/b25e42e88b5fce6e4a8f796673b4b002cfce506e))
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
### Miscellaneous Chores
|
|
361
|
+
|
|
362
|
+
* add prek and formatter configuration ([02eb50b](https://github.com/gotgenes/pi-autoformat/commit/02eb50b134a2a2a93f577088e9a5c33a4f86ad75))
|
|
363
|
+
* add project autoformat config ([d09ab48](https://github.com/gotgenes/pi-autoformat/commit/d09ab4866b10006318ba6370429160c6fe6e3c3c))
|
|
364
|
+
* initialize pnpm package metadata ([8644504](https://github.com/gotgenes/pi-autoformat/commit/86445046399a52e161a221f03ce57ad32eba2836))
|
|
365
|
+
* initialize repository plan and agent guidance ([548fa70](https://github.com/gotgenes/pi-autoformat/commit/548fa70aedfdacfce8e1225e682c1f6958b34770))
|
package/README.md
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/assets/logo.png" alt="pi-autoformat logo" width="400">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# pi-autoformat
|
|
2
6
|
|
|
7
|
+
[](https://www.npmjs.com/package/@gotgenes/pi-autoformat) [](https://github.com/gotgenes/pi-autoformat/actions/workflows/ci.yml) [](https://opensource.org/licenses/MIT) [](https://www.typescriptlang.org/) [](https://pnpm.io/) [](https://pi.mariozechner.at/)
|
|
8
|
+
|
|
3
9
|
`pi-autoformat` is a Pi extension package that automatically formats files after the agent edits them.
|
|
4
10
|
|
|
5
|
-
##
|
|
11
|
+
## Why
|
|
6
12
|
|
|
7
13
|
Pi agents often make correct code changes that still fail at commit time because formatting was never run.
|
|
8
14
|
|
|
@@ -20,21 +26,28 @@ This package moves formatting earlier in the workflow so the agent is less likel
|
|
|
20
26
|
|
|
21
27
|
`pi-autoformat` watches files touched by Pi mutation tools and runs configured formatter commands for just those files.
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
Formatting is **opt-in**: no formatters run until you declare `chains` in your project config.
|
|
24
30
|
|
|
25
|
-
|
|
26
|
-
- prefer prompt-end batching over per-edit formatting by default
|
|
27
|
-
- support repository-specific formatter commands
|
|
28
|
-
- support ordered formatter chains for the same extension
|
|
29
|
-
- surface formatter failures without blocking the original edit by default
|
|
30
|
-
- keep reporting concise by default, with interactive summaries and non-interactive logs
|
|
31
|
+
### Timing
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
Touched files are collected during each agent turn and formatted at `turn_end`, before the agent's next LLM call.
|
|
34
|
+
This means files are already formatted before any subsequent `git commit` command, eliminating pre-commit hook failures.
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
When formatting actually changes file content or a formatter fails, the extension sends a steering message that the agent sees at the start of its next turn.
|
|
37
|
+
This lets the agent react — for example, amending a commit or fixing a formatter error — without requiring a separate follow-up turn.
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
A safety-net flush also runs at `agent_end` to catch files added via the EventBus or other non-turn paths.
|
|
40
|
+
|
|
41
|
+
### Design goals
|
|
42
|
+
|
|
43
|
+
- format only files the agent touched
|
|
44
|
+
- flush between turns so commits see formatted files
|
|
45
|
+
- notify the agent inline only when formatting actually changed content or failed
|
|
46
|
+
- support repository-specific formatter commands and ordered chains
|
|
47
|
+
- surface formatter failures without blocking the original edit
|
|
48
|
+
- delegate formatter configuration to the formatters themselves — `pi-autoformat` invokes the tool and lets it find its own project config
|
|
49
|
+
|
|
50
|
+
See [docs/configuration.md](docs/configuration.md) for the full reference.
|
|
38
51
|
|
|
39
52
|
## Installation
|
|
40
53
|
|
|
@@ -50,120 +63,38 @@ pi install npm:@gotgenes/pi-autoformat
|
|
|
50
63
|
pi install /absolute/path/to/pi-autoformat
|
|
51
64
|
```
|
|
52
65
|
|
|
53
|
-
##
|
|
54
|
-
|
|
55
|
-
`pi-autoformat` uses extension-owned config files.
|
|
56
|
-
|
|
57
|
-
Configuration is loaded in this order:
|
|
58
|
-
|
|
59
|
-
1. global: `~/.pi/agent/extensions/pi-autoformat/config.json`
|
|
60
|
-
2. project: `.pi/extensions/pi-autoformat/config.json`
|
|
61
|
-
|
|
62
|
-
Project config overrides global config.
|
|
66
|
+
## Quick start
|
|
63
67
|
|
|
64
|
-
|
|
68
|
+
Create `.pi/extensions/pi-autoformat/config.json` in your project.
|
|
69
|
+
No formatters run until you declare `chains` — this avoids surprises from a default formatter conflicting with your project's chosen tool.
|
|
65
70
|
|
|
66
71
|
```json
|
|
67
72
|
{
|
|
68
73
|
"$schema": "https://raw.githubusercontent.com/gotgenes/pi-autoformat/main/schemas/pi-autoformat.schema.json",
|
|
69
|
-
"formatMode": "prompt",
|
|
70
|
-
"commandTimeoutMs": 10000,
|
|
71
|
-
"hideSummariesInTui": false,
|
|
72
74
|
"formatters": {
|
|
73
|
-
"
|
|
74
|
-
"command": ["prettier", "--write", "$FILE"],
|
|
75
|
-
"extensions": [".js", ".ts", ".tsx", ".json", ".md"]
|
|
76
|
-
},
|
|
77
|
-
"markdownlint-cli2": {
|
|
78
|
-
"command": ["markdownlint-cli2", "--fix", "$FILE"],
|
|
79
|
-
"extensions": [".md"]
|
|
80
|
-
}
|
|
75
|
+
"biome": { "command": ["biome", "check", "--write", "--files-ignore-unknown=true"] }
|
|
81
76
|
},
|
|
82
77
|
"chains": {
|
|
83
|
-
".
|
|
84
|
-
".
|
|
85
|
-
".
|
|
78
|
+
".ts": ["biome"],
|
|
79
|
+
".tsx": ["biome"],
|
|
80
|
+
".json": ["biome"]
|
|
86
81
|
}
|
|
87
82
|
}
|
|
88
83
|
```
|
|
89
84
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
Formatter command resolution in v1 stays intentionally simple:
|
|
93
|
-
|
|
94
|
-
- built-in formatter commands run from the project `cwd`
|
|
95
|
-
- the extension uses the inherited environment and `PATH`
|
|
96
|
-
- if your environment manager already resolves the right tool for that directory, plain commands like `prettier` can work as-is
|
|
97
|
-
- if your repo needs wrappers such as `pnpm exec`, `npx`, `mise x`, or similar, configure those commands explicitly in `formatters`
|
|
98
|
-
|
|
99
|
-
## Reporting behavior
|
|
100
|
-
|
|
101
|
-
By default, `pi-autoformat` reports:
|
|
102
|
-
|
|
103
|
-
- concise success summaries after formatting runs
|
|
104
|
-
- per-file failure summaries when one or more formatter commands fail
|
|
105
|
-
- config validation issues detected while loading global or project config
|
|
106
|
-
|
|
107
|
-
In the interactive TUI, these appear as notifications.
|
|
108
|
-
|
|
109
|
-
Outside the TUI, they are written as prefixed log lines.
|
|
110
|
-
|
|
111
|
-
Set `hideSummariesInTui` to `true` if you want to suppress interactive success summaries while still surfacing failures.
|
|
112
|
-
|
|
113
|
-
## Formatter model
|
|
114
|
-
|
|
115
|
-
Each formatter entry can define:
|
|
116
|
-
|
|
117
|
-
- `command: string[]`
|
|
118
|
-
- `extensions: string[]`
|
|
119
|
-
- `environment?: Record<string, string>`
|
|
120
|
-
- `disabled?: boolean`
|
|
85
|
+
For everything else — formatter chains and fallback groups, wildcard chains, built-in `treefmt` and `treefmt-nix` support, format scope, shell mutation coverage, custom mutation tools, the event-bus channel, turn-end steering notifications, and detailed failure output — see [docs/configuration.md](docs/configuration.md).
|
|
121
86
|
|
|
122
|
-
|
|
87
|
+
## Reporting
|
|
123
88
|
|
|
124
|
-
|
|
89
|
+
By default, `pi-autoformat` reports concise success summaries and per-batch failure summaries.
|
|
125
90
|
|
|
126
|
-
|
|
91
|
+
In the interactive TUI, success renders as a persistent one-line footer status (e.g. `✓ autoformat: 3 files (biome, prettier)`).
|
|
92
|
+
Failures fire a warning notification and leave an error-styled footer status (e.g. `✗ autoformat: 1 batch failed (prettier)`) that persists until the next flush.
|
|
127
93
|
|
|
128
|
-
|
|
94
|
+
Outside the TUI, summaries are written as prefixed log lines on `stdout` / `stderr`.
|
|
129
95
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
## Validation and autocomplete
|
|
134
|
-
|
|
135
|
-
The config file supports JSON Schema-based validation and editor autocomplete.
|
|
136
|
-
|
|
137
|
-
You can use either:
|
|
138
|
-
|
|
139
|
-
- the default-branch URL for the latest schema
|
|
140
|
-
- a pinned release-tag URL for reproducible validation
|
|
141
|
-
|
|
142
|
-
Examples:
|
|
143
|
-
|
|
144
|
-
```json
|
|
145
|
-
{
|
|
146
|
-
"$schema": "https://raw.githubusercontent.com/gotgenes/pi-autoformat/main/schemas/pi-autoformat.schema.json"
|
|
147
|
-
}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
```json
|
|
151
|
-
{
|
|
152
|
-
"$schema": "https://raw.githubusercontent.com/gotgenes/pi-autoformat/v1.0.0/schemas/pi-autoformat.schema.json"
|
|
153
|
-
}
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## Status
|
|
157
|
-
|
|
158
|
-
This project is under active development.
|
|
159
|
-
|
|
160
|
-
The current repository includes the formatter registry, execution pipeline, touched-file queue, config loading and validation, and the Pi extension runtime wiring for prompt-, tool-, and session-mode flushing.
|
|
161
|
-
|
|
162
|
-
Known v1 limitations:
|
|
163
|
-
|
|
164
|
-
- only Pi `write` and `edit` mutations are tracked automatically
|
|
165
|
-
- arbitrary shell-driven file mutations are not detected yet
|
|
166
|
-
- reporting is intentionally concise and does not yet expose full formatter stdout/stderr by default
|
|
96
|
+
Set `hideSummariesInTui` to `true` to suppress the success status line.
|
|
97
|
+
To surface failed-run stderr (or stdout+stderr), see [`formatterOutput`](docs/configuration.md#formatteroutput).
|
|
167
98
|
|
|
168
99
|
## Development
|
|
169
100
|
|
|
@@ -173,6 +104,8 @@ pnpm test
|
|
|
173
104
|
pnpm run lint
|
|
174
105
|
```
|
|
175
106
|
|
|
107
|
+
See [`docs/testing.md`](docs/testing.md) for the layout of unit, acceptance, and (future) LLM-gated test suites, and how the acceptance harness resolves the `pi` binary from `node_modules/.bin/pi`.
|
|
108
|
+
|
|
176
109
|
## License
|
|
177
110
|
|
|
178
111
|
MIT
|
package/biome.json
CHANGED
|
Binary file
|