@event4u/agent-config 14.6.0 → 14.8.0

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.
Files changed (258) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +255 -145
  3. package/README.md +1 -1
  4. package/dist/agent-src/commands/analyze/inbox.md +264 -10
  5. package/dist/agent-src/commands/analyze.md +1 -1
  6. package/dist/agent-src/commands/evals/git-pr-merge.json +13 -0
  7. package/dist/agent-src/commands/evals/roadmap.json +17 -1
  8. package/dist/agent-src/commands/pr/create.md +14 -2
  9. package/dist/agent-src/commands/pr/merge.md +379 -0
  10. package/dist/agent-src/commands/roadmap/process-full.md +272 -32
  11. package/dist/agent-src/commands/roadmap.md +1 -1
  12. package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +46 -36
  13. package/dist/agent-src/contexts/execution/autonomy-mechanics.md +37 -2
  14. package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +95 -2
  15. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +289 -106
  16. package/dist/agent-src/rules/artifact-drafting-protocol.md +5 -1
  17. package/dist/agent-src/rules/context-hygiene.md +2 -0
  18. package/dist/agent-src/rules/decision-revisit-gate.md +67 -32
  19. package/dist/agent-src/rules/fix-what-you-see.md +108 -0
  20. package/dist/agent-src/rules/no-roadmap-references.md +0 -5
  21. package/dist/agent-src/rules/recurring-criticism.md +110 -0
  22. package/dist/agent-src/rules/roadmap-progress-sync.md +20 -1
  23. package/dist/agent-src/rules/rule-type-governance.md +0 -2
  24. package/dist/agent-src/rules/self-repair-loop.md +17 -0
  25. package/dist/agent-src/rules/skill-quality.md +0 -2
  26. package/dist/agent-src/rules/source-confidentiality.md +37 -7
  27. package/dist/agent-src/scripts/archival_sweep.ts +117 -0
  28. package/dist/agent-src/scripts/archive_completed_roadmaps.ts +26 -7
  29. package/dist/agent-src/scripts/dashboard_mode.ts +212 -0
  30. package/dist/agent-src/scripts/gate_budget.ts +282 -0
  31. package/dist/agent-src/scripts/gate_execute.ts +72 -31
  32. package/dist/agent-src/scripts/roadmap_gates.ts +74 -3
  33. package/dist/agent-src/scripts/update_roadmap_progress.ts +296 -53
  34. package/dist/agent-src/skills/adr-create/SKILL.md +124 -5
  35. package/dist/agent-src/skills/ai-council/SKILL.md +48 -807
  36. package/dist/agent-src/skills/ai-council/references/advanced-modes.md +320 -0
  37. package/dist/agent-src/skills/ai-council/references/cost-and-redaction.md +99 -0
  38. package/dist/agent-src/skills/ai-council/references/execution-modes.md +162 -0
  39. package/dist/agent-src/skills/ai-council/references/output-and-synthesis.md +125 -0
  40. package/dist/agent-src/skills/ai-council/references/procedure.md +143 -0
  41. package/dist/agent-src/skills/decision-record/SKILL.md +61 -3
  42. package/dist/agent-src/skills/decision-review/SKILL.md +65 -0
  43. package/dist/agent-src/skills/merge-conflicts/SKILL.md +26 -0
  44. package/dist/agent-src/skills/quality-tools/SKILL.md +34 -326
  45. package/dist/agent-src/skills/quality-tools/references/js-ts-tools.md +113 -0
  46. package/dist/agent-src/skills/quality-tools/references/php-tools.md +222 -0
  47. package/dist/agent-src/skills/roadmap-management/SKILL.md +15 -409
  48. package/dist/agent-src/skills/roadmap-management/references/archival.md +226 -0
  49. package/dist/agent-src/skills/roadmap-management/references/authoring.md +107 -0
  50. package/dist/agent-src/skills/roadmap-management/references/dashboard.md +47 -0
  51. package/dist/agent-src/skills/roadmap-management/references/lifecycle.md +58 -0
  52. package/dist/agent-src/skills/security/SKILL.md +8 -0
  53. package/dist/agent-src/skills/security-audit/SKILL.md +12 -1
  54. package/dist/agent-src/skills/skill-writing/SKILL.md +34 -570
  55. package/dist/agent-src/skills/skill-writing/references/procedure.md +275 -0
  56. package/dist/agent-src/skills/skill-writing/references/read-only-scripts.md +18 -0
  57. package/dist/agent-src/skills/skill-writing/references/section-patterns.md +298 -0
  58. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  59. package/dist/agent-src/templates/roadmaps.md +65 -4
  60. package/dist/agent-src/templates/scripts/telemetry/flush_sender.mjs +163 -0
  61. package/dist/agent-src/templates/scripts/telemetry/remote.ts +160 -7
  62. package/dist/agent-src/templates/scripts/telemetry/transport.ts +169 -0
  63. package/dist/cli/registry.js +2 -1
  64. package/dist/cli/registry.js.map +1 -1
  65. package/dist/cli-delegate/chunk-2GNWGMAL.js +172 -0
  66. package/dist/cli-delegate/{chunk-P6LQDIWK.js → chunk-7PRE6ZV2.js} +338 -0
  67. package/dist/cli-delegate/{chunk-BKO2AZ7Z.js → chunk-B2ERU2VA.js} +1 -1
  68. package/dist/cli-delegate/chunk-E4XIZDIB.js +402 -0
  69. package/dist/cli-delegate/{chunk-3UCJWMMP.js → chunk-EEJUMCDZ.js} +16 -16
  70. package/dist/cli-delegate/{chunk-NXFWFAYV.js → chunk-G23AT6GD.js} +1 -0
  71. package/dist/cli-delegate/{chunk-XURJ4AQC.js → chunk-H4VIVD4C.js} +385 -284
  72. package/dist/cli-delegate/chunk-I3EIN2YG.js +36 -0
  73. package/dist/cli-delegate/{chunk-RLN73PR5.js → chunk-LPPWO5CE.js} +12 -8
  74. package/dist/cli-delegate/chunk-MWRD5YOH.js +100 -0
  75. package/dist/cli-delegate/{chunk-UEZ7D35A.js → chunk-N7CDDGI3.js} +4 -23
  76. package/dist/cli-delegate/{chunk-63WSP6YZ.js → chunk-PMEKGDED.js} +74 -167
  77. package/dist/cli-delegate/{chunk-GRRPEPRN.js → chunk-T7L2QK3K.js} +24 -5
  78. package/dist/cli-delegate/{chunk-EVTY7ISR.js → chunk-YM4GZDJG.js} +9 -1
  79. package/dist/cli-delegate/cmd_adr_effective.js +1162 -0
  80. package/dist/cli-delegate/cmd_conformance.js +466 -716
  81. package/dist/cli-delegate/cmd_converge.js +3 -3
  82. package/dist/cli-delegate/cmd_doctor.js +10 -10
  83. package/dist/cli-delegate/cmd_explain.js +1 -1
  84. package/dist/cli-delegate/cmd_export.js +10 -9
  85. package/dist/cli-delegate/cmd_handoff.js +10 -9
  86. package/dist/cli-delegate/cmd_memory_get.js +2 -1
  87. package/dist/cli-delegate/cmd_migrate.js +2 -2
  88. package/dist/cli-delegate/cmd_packs_active.js +1 -1
  89. package/dist/cli-delegate/cmd_preflight.js +5 -5
  90. package/dist/cli-delegate/cmd_prune.js +11 -10
  91. package/dist/cli-delegate/cmd_route_audit.js +6 -5
  92. package/dist/cli-delegate/cmd_route_explain.js +3 -3
  93. package/dist/cli-delegate/cmd_session_recycle.js +840 -30
  94. package/dist/cli-delegate/cmd_settings_get.js +3 -3
  95. package/dist/cli-delegate/cmd_settings_migrate.js +10 -9
  96. package/dist/cli-delegate/cmd_settings_set.js +1 -1
  97. package/dist/cli-delegate/cmd_sync.js +11 -10
  98. package/dist/cli-delegate/cmd_uninstall.js +13 -11
  99. package/dist/cli-delegate/cmd_update.js +4 -4
  100. package/dist/cli-delegate/cmd_upgrade.js +4 -4
  101. package/dist/cli-delegate/cmd_validate.js +11 -10
  102. package/dist/cli-delegate/cmd_versions.js +3 -3
  103. package/dist/discovery/deprecation-report.md +1 -1
  104. package/dist/discovery/discovery-manifest.json +111 -37
  105. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  106. package/dist/discovery/discovery-manifest.summary.md +5 -5
  107. package/dist/discovery/dormancy-report.md +1 -1
  108. package/dist/discovery/orphan-report.md +1 -1
  109. package/dist/discovery/packs.json +15 -12
  110. package/dist/discovery/trust-report.md +3 -3
  111. package/dist/discovery/workspaces.json +11 -8
  112. package/dist/hooks/dispatch.js +3165 -2192
  113. package/dist/install/claudePathsPlan.js +187 -0
  114. package/dist/install/claudePathsPlan.js.map +1 -0
  115. package/dist/install/globalRuleLayers.js +169 -0
  116. package/dist/install/globalRuleLayers.js.map +1 -0
  117. package/dist/install/hostLayerFingerprint.js +136 -0
  118. package/dist/install/hostLayerFingerprint.js.map +1 -0
  119. package/dist/install/install.mjs +553 -425
  120. package/dist/install/partitionEligibility.js +432 -0
  121. package/dist/install/partitionEligibility.js.map +1 -0
  122. package/dist/install/ruleLayerPartition.js +157 -0
  123. package/dist/install/ruleLayerPartition.js.map +1 -0
  124. package/dist/mcp/registry-manifest.json +3 -3
  125. package/dist/mcp/server.json +2 -2
  126. package/dist/mcp/server.mjs +1863 -1234
  127. package/dist/router.json +1 -1
  128. package/dist/scripts/_lib/agent_src.js +41 -0
  129. package/dist/scripts/_lib/agent_src.js.map +1 -1
  130. package/dist/scripts/_lib/install_layout.js +83 -0
  131. package/dist/scripts/_lib/install_layout.js.map +1 -0
  132. package/dist/scripts/_lib/installed_lock.js +444 -0
  133. package/dist/scripts/_lib/installed_lock.js.map +1 -0
  134. package/dist/scripts/_lib/prune_empty_dirs.js +85 -0
  135. package/dist/scripts/_lib/prune_empty_dirs.js.map +1 -0
  136. package/dist/scripts/condense.js +63 -251
  137. package/dist/scripts/condense.js.map +1 -1
  138. package/dist/server/schemas/settings.js +4 -0
  139. package/dist/server/schemas/settings.js.map +1 -1
  140. package/docs/contracts/settings-classes.md +12 -6
  141. package/docs/guidelines/agent-infra/agent-interaction-and-decision-quality.md +8 -3
  142. package/docs/guidelines/agent-infra/artifact-drafting-protocol-mechanics.md +45 -1
  143. package/docs/guidelines/agent-infra/context-hygiene-mechanics.md +26 -0
  144. package/docs/guidelines/agent-infra/false-green.md +47 -1
  145. package/docs/guidelines/agent-infra/memory-access.md +17 -0
  146. package/docs/guidelines/agent-infra/recurring-criticism-mechanics.md +96 -0
  147. package/package.json +1 -1
  148. package/src/agent-src/scripts/archival_sweep.ts +117 -0
  149. package/src/agent-src/scripts/archive_completed_roadmaps.ts +26 -7
  150. package/src/agent-src/scripts/dashboard_mode.ts +212 -0
  151. package/src/agent-src/scripts/gate_budget.ts +282 -0
  152. package/src/agent-src/scripts/gate_execute.ts +72 -31
  153. package/src/agent-src/scripts/roadmap_gates.ts +74 -3
  154. package/src/agent-src/scripts/update_roadmap_progress.ts +296 -53
  155. package/src/agent-src/templates/scripts/telemetry/flush_sender.mjs +163 -0
  156. package/src/agent-src/templates/scripts/telemetry/remote.ts +160 -7
  157. package/src/agent-src/templates/scripts/telemetry/transport.ts +169 -0
  158. package/src/config/agent-settings.template.yml +27 -2
  159. package/src/config/ci-local-parity.yml +39 -0
  160. package/src/config/estate-count-budget.json +612 -3
  161. package/src/config/evaluator-budgets.json +3 -3
  162. package/src/config/gate-coverage.yml +220 -12
  163. package/src/config/gate-violation-baselines.json +73 -63
  164. package/src/config/gitignore-block.txt +15 -2
  165. package/src/config/hook-latency-budget.json +5 -0
  166. package/src/config/rule-activation-census.json +14 -6
  167. package/src/config/rule-stub-ceilings.json +34 -7
  168. package/src/install/claudePathsPlan.ts +196 -0
  169. package/src/install/globalRuleLayers.ts +197 -0
  170. package/src/install/hostLayerFingerprint.ts +145 -0
  171. package/src/install/partitionEligibility.ts +502 -0
  172. package/src/install/ruleLayerPartition.ts +212 -0
  173. package/src/scripts/_cli/cmd_adr_effective.ts +484 -0
  174. package/src/scripts/_cli/cmd_session_recycle.ts +9 -1
  175. package/src/scripts/_dispatch.bash +17 -1
  176. package/src/scripts/_lib/ac_heading.ts +30 -0
  177. package/src/scripts/_lib/adr_frontmatter.test.ts +365 -0
  178. package/src/scripts/_lib/adr_frontmatter.ts +459 -0
  179. package/src/scripts/_lib/agent_src.ts +42 -0
  180. package/src/scripts/_lib/bench_ab_pinned_repo.ts +162 -0
  181. package/src/scripts/_lib/bench_ab_workspace.ts +10 -1
  182. package/src/scripts/_lib/envelope_grounding.ts +49 -9
  183. package/src/scripts/_lib/installed_lock.ts +50 -5
  184. package/src/scripts/_lib/layer_overlap_notice.ts +11 -2
  185. package/src/scripts/_lib/md_section.ts +129 -0
  186. package/src/scripts/_lib/prune_empty_dirs.ts +80 -0
  187. package/src/scripts/_lib/scope_guard.sh +26 -3
  188. package/src/scripts/_lib/self_repair.ts +19 -0
  189. package/src/scripts/_lib/self_repair_class_b.ts +171 -0
  190. package/src/scripts/adr/evidence_census.ts +899 -0
  191. package/src/scripts/adr/regenerate_index.ts +12 -32
  192. package/src/scripts/adr_cite_check.ts +540 -39
  193. package/src/scripts/ai_council/cli_help.ts +55 -0
  194. package/src/scripts/audit_adr_coverage.ts +103 -17
  195. package/src/scripts/before_complete_hook.ts +153 -28
  196. package/src/scripts/bench_ab_v2_complexity.ts +27 -7
  197. package/src/scripts/bench_hook_latency.ts +204 -0
  198. package/src/scripts/build_archive_index.ts +34 -0
  199. package/src/scripts/check_adr_frontmatter.ts +574 -39
  200. package/src/scripts/check_hook_bundle_content.ts +219 -0
  201. package/src/scripts/check_new_adr_evidence.ts +529 -0
  202. package/src/scripts/check_references.ts +78 -0
  203. package/src/scripts/check_release_published.ts +32 -11
  204. package/src/scripts/check_rule_layer_partition.ts +531 -0
  205. package/src/scripts/check_single_delivery.ts +194 -17
  206. package/src/scripts/check_standing_rule_delivery.ts +8 -2
  207. package/src/scripts/ci_settle.ts +170 -0
  208. package/src/scripts/condense.ts +79 -259
  209. package/src/scripts/council_cli.ts +3 -3
  210. package/src/scripts/dispatch_r2_reviewer.ts +6 -14
  211. package/src/scripts/external_sources_denylist.json +4 -1
  212. package/src/scripts/hook_manifest.json +1 -1
  213. package/src/scripts/hook_manifest.yaml +77 -14
  214. package/src/scripts/hooks/block_no_verify.ts +61 -10
  215. package/src/scripts/hooks/block_unauthorized_git.ts +21 -1
  216. package/src/scripts/hooks/concern_registry.ts +4 -0
  217. package/src/scripts/hooks/dispatch_hook.ts +154 -187
  218. package/src/scripts/hooks/dispatch_issues.ts +38 -19
  219. package/src/scripts/hooks/fallback_yaml.ts +66 -0
  220. package/src/scripts/hooks/host_semantics.ts +21 -0
  221. package/src/scripts/hooks/injection_budget.ts +13 -3
  222. package/src/scripts/hooks/py_json_dumps.ts +103 -0
  223. package/src/scripts/hooks/rtk_wrap_hook.ts +8 -3
  224. package/src/scripts/hooks/run_continuation_hook.ts +8 -5
  225. package/src/scripts/hooks/ship_diff_volume_hook.ts +81 -15
  226. package/src/scripts/hooks/source_first_gate_hook.ts +464 -0
  227. package/src/scripts/hooks/state_io.ts +870 -21
  228. package/src/scripts/hooks/stdin_failure_policy.ts +96 -0
  229. package/src/scripts/hooks/subagent_ledger_hook.ts +44 -15
  230. package/src/scripts/hooks/telemetry_flush_hook.ts +139 -0
  231. package/src/scripts/hooks/telemetry_self_repair.ts +128 -0
  232. package/src/scripts/hooks/telemetry_usage_hook.ts +22 -4
  233. package/src/scripts/hooks/turn_end_gate_hook.ts +81 -15
  234. package/src/scripts/injection_scan_hook.ts +137 -5
  235. package/src/scripts/install.ts +16 -11
  236. package/src/scripts/language_mirror_hook.ts +561 -25
  237. package/src/scripts/lint_framework_leakage_allowlist.json +2 -2
  238. package/src/scripts/lint_hook_manifest.ts +49 -0
  239. package/src/scripts/lint_plan_risk_register.ts +4 -3
  240. package/src/scripts/lint_provenance_vocabulary.ts +472 -4
  241. package/src/scripts/lint_skill_router_head.ts +4 -4
  242. package/src/scripts/mcp_server/tools.ts +2 -2
  243. package/src/scripts/new_roadmap.ts +136 -0
  244. package/src/scripts/pack_mcp_content.ts +20 -5
  245. package/src/scripts/release.ts +37 -38
  246. package/src/scripts/report_layer_overlap.ts +6 -0
  247. package/src/scripts/routing_doctor.ts +5 -1
  248. package/src/scripts/self_repair_hook.ts +37 -5
  249. package/src/scripts/session_register_hook.ts +11 -0
  250. package/src/scripts/skill_usage_collect.ts +11 -1
  251. package/src/scripts/skill_usage_report.ts +278 -8
  252. package/src/scripts/sync_pr_branch.ts +170 -20
  253. package/src/server/schemas/settings.ts +8 -0
  254. package/dist/cli-delegate/chunk-EJITJBJX.js +0 -172
  255. package/dist/cli-delegate/chunk-PZWRPRWP.js +0 -38
  256. package/dist/cli-delegate/{chunk-PPQO4NGR.js → chunk-6RJA2F5A.js} +3 -3
  257. package/dist/cli-delegate/{chunk-RYNADUFG.js → chunk-LWTYTX6F.js} +0 -0
  258. package/dist/cli-delegate/{chunk-FBKL6JWT.js → chunk-MMSGVZKV.js} +3 -3
@@ -23,6 +23,20 @@ Use this skill whenever running or configuring code quality tools:
23
23
  - **PHP**: PHPStan (static analysis), Rector (automated refactoring), ECS (coding standards)
24
24
  - **JS/TS**: Biome (linting + formatting), TypeScript compiler (type checking), Jest/Vitest (tests)
25
25
 
26
+ ## Modes
27
+
28
+ This skill is a router head. The cross-mode material — execution policy,
29
+ language detection, environment, output, gotchas — lives below. The per-tool
30
+ procedure bodies live in `references/`; load exactly the mode the detected
31
+ stack calls for.
32
+
33
+ | Detected stack | Mode body | Covers |
34
+ |---|---|---|
35
+ | PHP (`.php` changed) | [`references/php-tools.md`](references/php-tools.md) | Tool detection, PHPStan / ECS / Rector commands and flags, combined pipeline, config files, baseline policy, PHPStan error handling, testing framework, git-aware execution |
36
+ | JS/TS (`.js` / `.ts` / `.tsx` changed) | [`references/js-ts-tools.md`](references/js-ts-tools.md) | Detection, Biome, TypeScript type checking, Jest / Vitest, the JS/TS workflow sequence |
37
+
38
+ Both stacks changed → load both mode bodies and run both pipelines.
39
+
26
40
  ## Execution policy — on demand only, never proactive
27
41
 
28
42
  ```
@@ -59,6 +73,26 @@ git diff --name-only origin/main..HEAD | grep -E '\.(js|ts|tsx)$' # → JS/TS t
59
73
 
60
74
  If both PHP and JS/TS files changed → run **both** pipelines.
61
75
 
76
+ ## Procedure
77
+
78
+ 1. Confirm a run is justified — see Execution policy above. No trigger, no run.
79
+ 2. Detect the stack from the changed files — see Language detection above.
80
+ 2b. **Inspect the project's own quality config before running anything.** Read
81
+ the config files the detected stack actually ships (`phpstan.neon`,
82
+ `ecs.php`, `rector.php`, `biome.json`, `tsconfig.json`, the `scripts` block
83
+ of `package.json`) and the task/make wrapper if one exists. Never assume a
84
+ default ruleset, a default baseline, or a default command — the mode body
85
+ names where to look per stack. Running a tool against assumed config
86
+ produces findings the project never asked for.
87
+ 3. Load the matching mode body from the table in Modes and follow its
88
+ procedure. PHP → [`references/php-tools.md`](references/php-tools.md)
89
+ § Procedure: Run quality checks. JS/TS →
90
+ [`references/js-ts-tools.md`](references/js-ts-tools.md)
91
+ § JS/TS Quality Workflow.
92
+ 4. Both stacks changed → run both mode procedures; neither result excuses the
93
+ other.
94
+ 5. Report per Output format below.
95
+
62
96
  ## Related rules and guidelines
63
97
 
64
98
  - `verify-before-complete` rule — no pass claims without fresh output; suppressed runs are surfaced as "delegated to remote CI", never claimed
@@ -71,332 +105,6 @@ If both PHP and JS/TS files changed → run **both** pipelines.
71
105
 
72
106
  ---
73
107
 
74
- # PHP Quality Tools
75
-
76
- ## Tool Detection
77
-
78
- Check `composer.json` to determine which tools are available and how to run them.
79
- Use the **first matching** command style:
80
-
81
- | `composer.json` contains | Command style | Example |
82
- |---|---|---|
83
- | A project-specific quality wrapper (exposes `quality:*` commands) | `php artisan quality:*` or `composer quality:*` | `php artisan quality:phpstan` |
84
- | `phpstan/phpstan` or `larastan/larastan` | `vendor/bin/phpstan` | `vendor/bin/phpstan analyse` |
85
- | `rector/rector` | `vendor/bin/rector` | `vendor/bin/rector process` |
86
- | `symplify/easy-coding-standard` | `vendor/bin/ecs` | `vendor/bin/ecs check --fix` |
87
-
88
- **Priority:** If a project ships a `quality:*` wrapper (Artisan or Composer script), always prefer it —
89
- wrappers typically add git-aware execution, caching, automatic baseline regeneration, and memory
90
- management on top of the native tools.
91
-
92
- If none of the above is installed → skip quality checks, inform the user.
93
-
94
- All commands run **inside the Docker container** if Docker is used (`docker compose exec` or `make console`).
95
-
96
- ## Commands
97
-
98
- ### PHPStan — Static Analysis
99
-
100
- ```bash
101
- # Native:
102
- vendor/bin/phpstan analyse # Analyse all configured paths
103
- vendor/bin/phpstan analyse --memory-limit=512M # With memory limit
104
- vendor/bin/phpstan analyse --error-format=github # CI-friendly format
105
-
106
- # With a project-specific quality wrapper:
107
- php artisan quality:phpstan # Laravel
108
- composer quality:phpstan # Composer
109
- ```
110
-
111
- **Native flags:**
112
-
113
- | Flag | Description |
114
- |---|---|
115
- | `--memory-limit=SIZE` | Set memory limit (e.g. `512M`, `1G`) |
116
- | `--debug` | Activate debug mode |
117
- | `--error-format=FORMAT` | Output format: `table` (default), `github`, `gitlab` |
118
- | `--pro` | Toggle PHPStan Pro |
119
-
120
- **Wrapper-only flags** (typical of a `quality:*` wrapper — verify in the project):
121
-
122
- | Flag | Description |
123
- |---|---|
124
- | `--baseline` | Generate/update phpstan baseline file |
125
- | `--ignore-git` | Skip Git check, analyse all files |
126
- | `--xdebug` | Activate Xdebug mode |
127
-
128
- ### ECS — Easy Coding Standard
129
-
130
- ```bash
131
- # Native:
132
- vendor/bin/ecs check # Dry-run
133
- vendor/bin/ecs check --fix # Auto-fix
134
-
135
- # With a project-specific quality wrapper:
136
- php artisan quality:ecs --fix # Laravel
137
- composer quality:ecs -- --fix # Composer
138
- ```
139
-
140
- **Native flags:**
141
-
142
- | Flag | Description |
143
- |---|---|
144
- | `--fix` | Fix errors automatically |
145
- | `--clear-cache` | Clear the ECS cache |
146
-
147
- **Wrapper-only flags** (typical of a `quality:*` wrapper — verify in the project):
148
-
149
- | Flag | Description |
150
- |---|---|
151
- | `--ignore-git` | Skip Git check, check all files |
152
- | `--paths-to-scan[=PATHS]` | Custom paths, e.g. `--paths-to-scan='["./core"]'` |
153
- | `--source-branch[=BRANCH]` | Source branch (default: HEAD) |
154
- | `--target-branch[=BRANCH]` | Target branch to compare against |
155
-
156
- ### Rector — Automated Refactoring
157
-
158
- ```bash
159
- # Native:
160
- vendor/bin/rector process # Auto-fix
161
- vendor/bin/rector process --dry-run # Preview changes
162
-
163
- # With a project-specific quality wrapper:
164
- php artisan quality:rector --fix # Laravel
165
- composer quality:rector -- --fix # Composer
166
- ```
167
-
168
- **Native flags:**
169
-
170
- | Flag | Description |
171
- |---|---|
172
- | `--dry-run` | Preview changes without applying |
173
- | `--clear-cache` | Clear the Rector cache |
174
-
175
- **Wrapper-only flags** (typical of a `quality:*` wrapper — verify in the project):
176
-
177
- | Flag | Description |
178
- |---|---|
179
- | `--ignore-git` | Skip Git check, check all files |
180
- | `--paths-to-scan[=PATHS]` | Custom paths |
181
- | `--source-branch[=BRANCH]` | Source branch (default: HEAD) |
182
- | `--target-branch[=BRANCH]` | Target branch to compare against |
183
-
184
- ### Combined Commands
185
-
186
- There is no native single command for running all three tools. Run them in sequence:
187
-
188
- ```bash
189
- # Full pipeline (native):
190
- vendor/bin/rector process && vendor/bin/ecs check --fix && vendor/bin/phpstan analyse
191
-
192
- # With a project-specific quality wrapper (if it ships these combined commands):
193
- php artisan quality:refactor --fix # Rector + ECS
194
- php artisan quality:finalize # Rector + ECS + PHPStan (full pipeline)
195
- ```
196
-
197
- ## Procedure: Run quality checks
198
-
199
- 1. Run PHPStan — fix all errors
200
- 2. Run Rector + ECS with auto-fix — fix style + refactoring
201
- 3. Run PHPStan again — verify step 2 didn't introduce new issues
202
-
203
- If step 3 finds errors → fix and repeat from step 2.
204
-
205
- Detect commands from project (see Tool Detection above).
206
-
207
- ## Configuration
208
-
209
- Config files are typically in the **project root**. Do NOT modify without explicit user permission.
210
-
211
- Detect config location:
212
- - Check project root first: `phpstan.neon`, `ecs.php`, `rector.php`
213
- - Some projects use `phpstan.neon.dist` instead of `phpstan.neon`
214
-
215
- ### Standard config files
216
-
217
- | File | Tool | Purpose |
218
- |---|---|---|
219
- | `phpstan.neon` | PHPStan | Level, paths, extensions, `ignoreErrors`, disallowed calls |
220
- | `phpstan-baseline.neon` | PHPStan | Baseline for existing errors (auto-managed, do NOT edit) |
221
- | `ecs.php` | ECS | Code style: rule sets, configured rules, skip list |
222
- | `rector.php` | Rector | Refactoring: rule sets, PHP version sets, skip list |
223
-
224
- ### Understanding the project's config
225
-
226
- Read the actual config files to understand what rules are active:
227
-
228
- - **phpstan.neon**: Check `level`, `paths`, `ignoreErrors`, `includes` (baselines, extensions)
229
- - **ecs.php**: Check which rule sets are active (PSR-12, PHP-CS-Fixer sets), skip list
230
- - **rector.php**: Check PHP version sets, active rule sets, skip list
231
-
232
- Common patterns across projects:
233
- - PHPStan at high levels (8-9) with `disallowedFunctionCalls` banning `var_dump()`, `dd()`
234
- - ECS with PSR-12 base, trailing commas, Yoda style
235
- - Rector with PHP version migration sets and naming conventions
236
-
237
- ## Baseline policy
238
-
239
- - **NEVER** edit `phpstan-baseline.neon` by hand.
240
- - **NEVER** add errors, update counts, or regenerate manually.
241
- - If the project ships a quality wrapper (exposing `quality:*` commands), it may regenerate the baseline automatically.
242
-
243
- ## PHPStan error handling
244
-
245
- Priority order for dealing with PHPStan errors:
246
-
247
- 1. **Fix the code** — always the first choice. Fix the actual type issue.
248
- 2. **Add type hints / PHPDoc** — if the code is correct but PHPStan can't infer the type.
249
- 3. **Inline ignore (last resort)** — only for confirmed false positives:
250
- ```php
251
- // @phpstan-ignore-next-line — false positive: reason here
252
- ```
253
-
254
- ### When `phpstan.neon` changes ARE allowed
255
-
256
- Adding `ignoreErrors` entries to `phpstan.neon` is allowed when:
257
-
258
- - The error is a **structural limitation** of the toolchain (e.g., Pest tests bind `$this` at runtime, PHPStan can't resolve `artisan()`,
259
- `get()`, etc. on `PHPUnit\Framework\TestCase`)
260
- - The pattern applies **broadly** to a category of files (e.g., all test files), not just one specific line
261
- - The fix would require abandoning the project's conventions (e.g., rewriting Pest tests as PHPUnit classes)
262
-
263
- **If unsure whether a `phpstan.neon` change is appropriate → ask the user before making the change.**
264
-
265
- ### NEVER do these
266
-
267
- - Add entries to baseline files (`phpstan-baseline.neon`)
268
- - Add `ignoreErrors` for individual files or specific code issues that should be fixed
269
- - Use `@phpstan-ignore-next-line` without a reason comment
270
-
271
- See also: `php-coding` rule → PHPStan section.
272
-
273
- ## Testing framework
274
-
275
- - **Always write tests in Pest**, not PHPUnit class syntax — unless the user explicitly asks for PHPUnit.
276
- - Pest tests in `tests/Unit/` automatically use `UnitTestCase` as the base class (configured in `tests/Pest.php`).
277
- - PHPStan cannot fully resolve Pest's runtime bindings — this is handled via `ignoreErrors` patterns in `phpstan.neon`.
278
-
279
- ## Git-aware execution
280
-
281
- By default, all tools only check files changed since the last commit.
282
-
283
- | Flag | Effect |
284
- |------------------------------|-----------------------------------------------|
285
- | (default) | Only changed files (fast, for iterative work) |
286
- | `--ignore-git` | All files (cache still applies) |
287
- | `--clear-cache` | Changed files, but ignore cache |
288
- | `--ignore-git --clear-cache` | Complete fresh run of all files |
289
-
290
- ---
291
-
292
- # JS/TS Quality Tools
293
-
294
- ## Detection
295
-
296
- Check `package.json` for available tools:
297
-
298
- | Indicator | Tool |
299
- |---------------------------------------|---------------------------------------------------------------|
300
- | `@biomejs/biome` in devDependencies | **Biome** — linting + formatting |
301
- | `typescript` in devDependencies | **TypeScript** — type checking |
302
- | `jest` or `vitest` in devDependencies | **Test runner** |
303
- | `eslint` in devDependencies | **ESLint** — legacy linting (check if Biome replaces it) |
304
- | `prettier` in devDependencies | **Prettier** — legacy formatting (check if Biome replaces it) |
305
-
306
- ## Biome — Linting + Formatting
307
-
308
- Biome replaces ESLint + Prettier in one tool.
309
-
310
- ### Config
311
-
312
- - Config file: `biome.json` or `biome.jsonc`
313
- - Includes formatter settings (indent style, line width, trailing commas)
314
- - Includes linter rules (recommended + custom overrides)
315
- - Includes import sorting (via `assist.actions.source.organizeImports`)
316
-
317
- ### Commands
318
-
319
- ```bash
320
- # Check (dry-run) — shows errors without fixing
321
- npx biome check .
322
-
323
- # Fix — auto-fix all fixable issues (formatting + linting + imports)
324
- npx biome check --write .
325
-
326
- # Format only
327
- npx biome format --write .
328
-
329
- # Lint only
330
- npx biome lint .
331
- ```
332
-
333
- ### Via npm scripts (preferred)
334
-
335
- Check `package.json` scripts — projects typically define:
336
-
337
- ```bash
338
- npm run biome # Check (dry-run)
339
- npm run biome:fix # Auto-fix
340
- ```
341
-
342
- Always prefer npm scripts over raw `npx` commands when they exist.
343
-
344
- ## TypeScript — Type Checking
345
-
346
- ### Commands
347
-
348
- ```bash
349
- # Type check without emitting files
350
- npx tsc --noEmit
351
-
352
- # Via npm script (preferred)
353
- npm run tscheck
354
- ```
355
-
356
- ### Config
357
-
358
- - Config file: `tsconfig.json` (may have `tsconfig.app.json`, `tsconfig.node.json` for different targets)
359
- - `strict: true` should be enabled in all projects
360
- - Check `compilerOptions.paths` for import aliases
361
-
362
- ## Jest / Vitest — Testing
363
-
364
- ### Commands
365
-
366
- ```bash
367
- # Run all tests
368
- npm test
369
-
370
- # Run specific test file
371
- npx jest path/to/test.spec.ts
372
-
373
- # Run with coverage
374
- npx jest --coverage
375
-
376
- # Watch mode
377
- npx jest --watch
378
- ```
379
-
380
- ## JS/TS Quality Workflow
381
-
382
- After JS/TS code changes, run this sequence:
383
-
384
- ```
385
- 1. npx biome check --write . → Auto-fix formatting + linting
386
- 2. npx tsc --noEmit → Verify type safety
387
- 3. npm test → Run test suite
388
- ```
389
-
390
- Or via npm scripts:
391
-
392
- ```
393
- 1. npm run biome:fix → Auto-fix
394
- 2. npm run tscheck → Type check
395
- 3. npm test → Tests
396
- ```
397
-
398
- If step 2 finds type errors → fix them in code, then re-run step 1 (Biome may reformat).
399
-
400
108
  ## Execution environment
401
109
 
402
110
  ### PHP tools
@@ -0,0 +1,113 @@
1
+ # quality-tools — JS/TS quality tools
2
+
3
+ > Mode body of the [`quality-tools`](../SKILL.md) skill (router-head
4
+ > retrofit, 2026-08-20). Content moved VERBATIM from SKILL.md — load this
5
+ > file when the mode table in SKILL.md routes here.
6
+
7
+ # JS/TS Quality Tools
8
+
9
+ ## Detection
10
+
11
+ Check `package.json` for available tools:
12
+
13
+ | Indicator | Tool |
14
+ |---------------------------------------|---------------------------------------------------------------|
15
+ | `@biomejs/biome` in devDependencies | **Biome** — linting + formatting |
16
+ | `typescript` in devDependencies | **TypeScript** — type checking |
17
+ | `jest` or `vitest` in devDependencies | **Test runner** |
18
+ | `eslint` in devDependencies | **ESLint** — legacy linting (check if Biome replaces it) |
19
+ | `prettier` in devDependencies | **Prettier** — legacy formatting (check if Biome replaces it) |
20
+
21
+ ## Biome — Linting + Formatting
22
+
23
+ Biome replaces ESLint + Prettier in one tool.
24
+
25
+ ### Config
26
+
27
+ - Config file: `biome.json` or `biome.jsonc`
28
+ - Includes formatter settings (indent style, line width, trailing commas)
29
+ - Includes linter rules (recommended + custom overrides)
30
+ - Includes import sorting (via `assist.actions.source.organizeImports`)
31
+
32
+ ### Commands
33
+
34
+ ```bash
35
+ # Check (dry-run) — shows errors without fixing
36
+ npx biome check .
37
+
38
+ # Fix — auto-fix all fixable issues (formatting + linting + imports)
39
+ npx biome check --write .
40
+
41
+ # Format only
42
+ npx biome format --write .
43
+
44
+ # Lint only
45
+ npx biome lint .
46
+ ```
47
+
48
+ ### Via npm scripts (preferred)
49
+
50
+ Check `package.json` scripts — projects typically define:
51
+
52
+ ```bash
53
+ npm run biome # Check (dry-run)
54
+ npm run biome:fix # Auto-fix
55
+ ```
56
+
57
+ Always prefer npm scripts over raw `npx` commands when they exist.
58
+
59
+ ## TypeScript — Type Checking
60
+
61
+ ### Commands
62
+
63
+ ```bash
64
+ # Type check without emitting files
65
+ npx tsc --noEmit
66
+
67
+ # Via npm script (preferred)
68
+ npm run tscheck
69
+ ```
70
+
71
+ ### Config
72
+
73
+ - Config file: `tsconfig.json` (may have `tsconfig.app.json`, `tsconfig.node.json` for different targets)
74
+ - `strict: true` should be enabled in all projects
75
+ - Check `compilerOptions.paths` for import aliases
76
+
77
+ ## Jest / Vitest — Testing
78
+
79
+ ### Commands
80
+
81
+ ```bash
82
+ # Run all tests
83
+ npm test
84
+
85
+ # Run specific test file
86
+ npx jest path/to/test.spec.ts
87
+
88
+ # Run with coverage
89
+ npx jest --coverage
90
+
91
+ # Watch mode
92
+ npx jest --watch
93
+ ```
94
+
95
+ ## JS/TS Quality Workflow
96
+
97
+ After JS/TS code changes, run this sequence:
98
+
99
+ ```
100
+ 1. npx biome check --write . → Auto-fix formatting + linting
101
+ 2. npx tsc --noEmit → Verify type safety
102
+ 3. npm test → Run test suite
103
+ ```
104
+
105
+ Or via npm scripts:
106
+
107
+ ```
108
+ 1. npm run biome:fix → Auto-fix
109
+ 2. npm run tscheck → Type check
110
+ 3. npm test → Tests
111
+ ```
112
+
113
+ If step 2 finds type errors → fix them in code, then re-run step 1 (Biome may reformat).