@event4u/agent-config 14.5.0 → 14.7.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.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +384 -3
- package/README.md +1 -1
- package/dist/agent-src/commands/analyze/decision.md +7 -0
- package/dist/agent-src/commands/analyze/inbox.md +264 -10
- package/dist/agent-src/commands/analyze.md +1 -1
- package/dist/agent-src/commands/optimize/project.md +10 -0
- package/dist/agent-src/commands/roadmap/process-full.md +132 -4
- package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +31 -0
- package/dist/agent-src/contexts/execution/roadmap-process-loop.md +161 -1
- package/dist/agent-src/rules/context-hygiene.md +2 -0
- package/dist/agent-src/rules/decision-revisit-gate.md +111 -7
- package/dist/agent-src/rules/fix-what-you-see.md +108 -0
- package/dist/agent-src/rules/no-roadmap-references.md +0 -5
- package/dist/agent-src/rules/recurring-criticism.md +110 -0
- package/dist/agent-src/rules/roadmap-progress-sync.md +1 -1
- package/dist/agent-src/rules/rule-type-governance.md +0 -2
- package/dist/agent-src/rules/self-repair-loop.md +17 -0
- package/dist/agent-src/rules/skill-quality.md +0 -2
- package/dist/agent-src/rules/source-confidentiality.md +37 -7
- package/dist/agent-src/scripts/archival_sweep.ts +117 -0
- package/dist/agent-src/scripts/archive_completed_roadmaps.ts +19 -3
- package/dist/agent-src/scripts/gate_budget.ts +282 -0
- package/dist/agent-src/scripts/gate_execute.ts +72 -31
- package/dist/agent-src/scripts/roadmap_gates.ts +74 -3
- package/dist/agent-src/scripts/update_roadmap_progress.ts +251 -7
- package/dist/agent-src/skills/adr-create/SKILL.md +25 -3
- package/dist/agent-src/skills/ai-council/SKILL.md +48 -807
- package/dist/agent-src/skills/ai-council/references/advanced-modes.md +320 -0
- package/dist/agent-src/skills/ai-council/references/cost-and-redaction.md +99 -0
- package/dist/agent-src/skills/ai-council/references/execution-modes.md +162 -0
- package/dist/agent-src/skills/ai-council/references/output-and-synthesis.md +125 -0
- package/dist/agent-src/skills/ai-council/references/procedure.md +143 -0
- package/dist/agent-src/skills/decision-review/SKILL.md +18 -0
- package/dist/agent-src/skills/quality-tools/SKILL.md +34 -326
- package/dist/agent-src/skills/quality-tools/references/js-ts-tools.md +113 -0
- package/dist/agent-src/skills/quality-tools/references/php-tools.md +222 -0
- package/dist/agent-src/skills/roadmap-management/SKILL.md +15 -409
- package/dist/agent-src/skills/roadmap-management/references/archival.md +226 -0
- package/dist/agent-src/skills/roadmap-management/references/authoring.md +107 -0
- package/dist/agent-src/skills/roadmap-management/references/dashboard.md +47 -0
- package/dist/agent-src/skills/roadmap-management/references/lifecycle.md +58 -0
- package/dist/agent-src/skills/skill-writing/SKILL.md +34 -570
- package/dist/agent-src/skills/skill-writing/references/procedure.md +275 -0
- package/dist/agent-src/skills/skill-writing/references/read-only-scripts.md +18 -0
- package/dist/agent-src/skills/skill-writing/references/section-patterns.md +298 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +45 -2
- package/dist/agent-src/templates/scripts/telemetry/flush_sender.mjs +163 -0
- package/dist/agent-src/templates/scripts/telemetry/remote.ts +160 -7
- package/dist/agent-src/templates/scripts/telemetry/transport.ts +169 -0
- package/dist/cli/registry.js +1 -1
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/chunk-2GNWGMAL.js +172 -0
- package/dist/cli-delegate/{chunk-RLN73PR5.js → chunk-4VR4ORQ6.js} +10 -7
- package/dist/cli-delegate/chunk-6EOCNQAM.js +402 -0
- package/dist/cli-delegate/{chunk-XURJ4AQC.js → chunk-74E3TKWV.js} +381 -280
- package/dist/cli-delegate/{chunk-3UCJWMMP.js → chunk-7F3VYSM2.js} +4 -4
- package/dist/cli-delegate/{chunk-BKO2AZ7Z.js → chunk-B2ERU2VA.js} +1 -1
- package/dist/cli-delegate/{chunk-NXFWFAYV.js → chunk-G23AT6GD.js} +1 -0
- package/dist/cli-delegate/{chunk-63WSP6YZ.js → chunk-GJ5BVHXM.js} +72 -165
- package/dist/cli-delegate/{chunk-ZPSXJTLI.js → chunk-JZ4NR2TW.js} +353 -1
- package/dist/cli-delegate/chunk-MWRD5YOH.js +100 -0
- package/dist/cli-delegate/{chunk-GRRPEPRN.js → chunk-T7L2QK3K.js} +24 -5
- package/dist/cli-delegate/{chunk-EVTY7ISR.js → chunk-YM4GZDJG.js} +9 -1
- package/dist/cli-delegate/cmd_conformance.js +459 -709
- package/dist/cli-delegate/cmd_doctor.js +6 -6
- package/dist/cli-delegate/cmd_explain.js +1 -1
- package/dist/cli-delegate/cmd_export.js +7 -6
- package/dist/cli-delegate/cmd_handoff.js +6 -6
- package/dist/cli-delegate/cmd_packs_active.js +1 -1
- package/dist/cli-delegate/cmd_preflight.js +2 -2
- package/dist/cli-delegate/cmd_prune.js +7 -6
- package/dist/cli-delegate/cmd_session_recycle.js +840 -30
- package/dist/cli-delegate/cmd_settings_migrate.js +7 -6
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +7 -6
- package/dist/cli-delegate/cmd_uninstall.js +9 -7
- package/dist/cli-delegate/cmd_update.js +1 -1
- package/dist/cli-delegate/cmd_upgrade.js +1 -1
- package/dist/cli-delegate/cmd_validate.js +7 -6
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +72 -29
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +4 -4
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +10 -8
- package/dist/discovery/trust-report.md +3 -3
- package/dist/discovery/workspaces.json +8 -6
- package/dist/hooks/dispatch.js +3127 -2022
- package/dist/install/claudePathsPlan.js +187 -0
- package/dist/install/claudePathsPlan.js.map +1 -0
- package/dist/install/hostLayerFingerprint.js +136 -0
- package/dist/install/hostLayerFingerprint.js.map +1 -0
- package/dist/install/install.mjs +553 -425
- package/dist/install/partitionEligibility.js +276 -0
- package/dist/install/partitionEligibility.js.map +1 -0
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +1744 -1191
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/agent_src.js +41 -0
- package/dist/scripts/_lib/agent_src.js.map +1 -1
- package/dist/scripts/_lib/install_layout.js +83 -0
- package/dist/scripts/_lib/install_layout.js.map +1 -0
- package/dist/scripts/_lib/installed_lock.js +444 -0
- package/dist/scripts/_lib/installed_lock.js.map +1 -0
- package/dist/scripts/condense.js +13 -164
- package/dist/scripts/condense.js.map +1 -1
- package/dist/server/schemas/settings.js +4 -0
- package/dist/server/schemas/settings.js.map +1 -1
- package/docs/contracts/settings-classes.md +12 -6
- package/docs/guidelines/agent-infra/agent-interaction-and-decision-quality.md +8 -3
- package/docs/guidelines/agent-infra/context-hygiene-mechanics.md +26 -0
- package/docs/guidelines/agent-infra/engineering-memory-data-format.md +49 -0
- package/docs/guidelines/agent-infra/memory-access.md +17 -0
- package/docs/guidelines/agent-infra/recurring-criticism-mechanics.md +96 -0
- package/package.json +1 -1
- package/src/agent-src/scripts/archival_sweep.ts +117 -0
- package/src/agent-src/scripts/archive_completed_roadmaps.ts +19 -3
- package/src/agent-src/scripts/gate_budget.ts +282 -0
- package/src/agent-src/scripts/gate_execute.ts +72 -31
- package/src/agent-src/scripts/roadmap_gates.ts +74 -3
- package/src/agent-src/scripts/update_roadmap_progress.ts +251 -7
- package/src/agent-src/templates/scripts/telemetry/flush_sender.mjs +163 -0
- package/src/agent-src/templates/scripts/telemetry/remote.ts +160 -7
- package/src/agent-src/templates/scripts/telemetry/transport.ts +169 -0
- package/src/config/agent-settings.template.yml +27 -2
- package/src/config/ci-local-parity.yml +18 -0
- package/src/config/estate-count-budget.json +367 -3
- package/src/config/gate-violation-baselines.json +41 -41
- package/src/config/pack-size-budget.json +3 -2
- package/src/config/rule-activation-census.json +14 -6
- package/src/config/rule-stub-ceilings.json +19 -6
- package/src/install/claudePathsPlan.ts +196 -0
- package/src/install/hostLayerFingerprint.ts +145 -0
- package/src/install/partitionEligibility.ts +325 -0
- package/src/scripts/_cli/cmd_session_recycle.ts +9 -1
- package/src/scripts/_dispatch.bash +6 -1
- package/src/scripts/_lib/ac_heading.ts +30 -0
- package/src/scripts/_lib/agent_src.ts +42 -0
- package/src/scripts/_lib/bench_ab_pinned_repo.ts +162 -0
- package/src/scripts/_lib/bench_ab_workspace.ts +10 -1
- package/src/scripts/_lib/envelope_grounding.ts +38 -8
- package/src/scripts/_lib/installed_lock.ts +50 -5
- package/src/scripts/_lib/layer_overlap_notice.ts +85 -0
- package/src/scripts/_lib/md_section.ts +129 -0
- package/src/scripts/_lib/scope_guard.sh +86 -4
- package/src/scripts/_lib/self_repair.ts +19 -0
- package/src/scripts/_lib/self_repair_class_b.ts +171 -0
- package/src/scripts/_lib/subagent_capsule.ts +81 -1
- package/src/scripts/adr/regenerate_index.ts +13 -2
- package/src/scripts/adr_cite_check.ts +424 -0
- package/src/scripts/ai_council/cli_help.ts +55 -0
- package/src/scripts/before_complete_hook.ts +153 -28
- package/src/scripts/bench_ab_v2_complexity.ts +27 -7
- package/src/scripts/check_adr_frontmatter.ts +187 -1
- package/src/scripts/check_references.ts +60 -0
- package/src/scripts/check_release_published.ts +32 -11
- package/src/scripts/check_single_delivery.ts +517 -0
- package/src/scripts/ci_settle.ts +170 -0
- package/src/scripts/condense.ts +20 -170
- package/src/scripts/council_cli.ts +3 -3
- package/src/scripts/dispatch_r2_reviewer.ts +6 -14
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +77 -14
- package/src/scripts/hooks/block_no_verify.ts +61 -10
- package/src/scripts/hooks/block_unauthorized_git.ts +1 -1
- package/src/scripts/hooks/concern_registry.ts +4 -0
- package/src/scripts/hooks/rtk_wrap_hook.ts +8 -3
- package/src/scripts/hooks/run_continuation_hook.ts +887 -68
- package/src/scripts/hooks/ship_diff_volume_hook.ts +81 -15
- package/src/scripts/hooks/source_first_gate_hook.ts +464 -0
- package/src/scripts/hooks/state_io.ts +782 -20
- package/src/scripts/hooks/subagent_ledger_hook.ts +44 -15
- package/src/scripts/hooks/telemetry_flush_hook.ts +139 -0
- package/src/scripts/hooks/telemetry_self_repair.ts +128 -0
- package/src/scripts/hooks/telemetry_usage_hook.ts +22 -4
- package/src/scripts/hooks/turn_end_gate_hook.ts +81 -15
- package/src/scripts/install.sh +12 -2
- package/src/scripts/install.ts +16 -11
- package/src/scripts/language_mirror_hook.ts +561 -25
- package/src/scripts/lint_framework_leakage_allowlist.json +2 -2
- package/src/scripts/lint_plan_risk_register.ts +4 -3
- package/src/scripts/lint_skill_router_head.ts +4 -4
- package/src/scripts/mcp_server/tools.ts +2 -2
- package/src/scripts/memory_consolidation.ts +189 -0
- package/src/scripts/memory_eviction.ts +384 -0
- package/src/scripts/new_roadmap.ts +136 -0
- package/src/scripts/pack_mcp_content.ts +20 -5
- package/src/scripts/release.ts +37 -38
- package/src/scripts/report_layer_overlap.ts +78 -0
- package/src/scripts/report_memory_pointers.ts +622 -0
- package/src/scripts/self_repair_hook.ts +37 -5
- package/src/scripts/session_register_hook.ts +115 -15
- package/src/scripts/skill_usage_collect.ts +11 -1
- package/src/scripts/skill_usage_report.ts +278 -8
- package/src/scripts/sync_pr_branch.ts +7 -0
- package/src/server/schemas/settings.ts +8 -0
- package/dist/cli-delegate/chunk-EJITJBJX.js +0 -172
- package/dist/cli-delegate/chunk-PZWRPRWP.js +0 -38
- /package/dist/cli-delegate/{chunk-RYNADUFG.js → chunk-LWTYTX6F.js} +0 -0
|
@@ -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).
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# quality-tools — PHP 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
|
+
# PHP Quality Tools
|
|
8
|
+
|
|
9
|
+
## Tool Detection
|
|
10
|
+
|
|
11
|
+
Check `composer.json` to determine which tools are available and how to run them.
|
|
12
|
+
Use the **first matching** command style:
|
|
13
|
+
|
|
14
|
+
| `composer.json` contains | Command style | Example |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| A project-specific quality wrapper (exposes `quality:*` commands) | `php artisan quality:*` or `composer quality:*` | `php artisan quality:phpstan` |
|
|
17
|
+
| `phpstan/phpstan` or `larastan/larastan` | `vendor/bin/phpstan` | `vendor/bin/phpstan analyse` |
|
|
18
|
+
| `rector/rector` | `vendor/bin/rector` | `vendor/bin/rector process` |
|
|
19
|
+
| `symplify/easy-coding-standard` | `vendor/bin/ecs` | `vendor/bin/ecs check --fix` |
|
|
20
|
+
|
|
21
|
+
**Priority:** If a project ships a `quality:*` wrapper (Artisan or Composer script), always prefer it —
|
|
22
|
+
wrappers typically add git-aware execution, caching, automatic baseline regeneration, and memory
|
|
23
|
+
management on top of the native tools.
|
|
24
|
+
|
|
25
|
+
If none of the above is installed → skip quality checks, inform the user.
|
|
26
|
+
|
|
27
|
+
All commands run **inside the Docker container** if Docker is used (`docker compose exec` or `make console`).
|
|
28
|
+
|
|
29
|
+
## Commands
|
|
30
|
+
|
|
31
|
+
### PHPStan — Static Analysis
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Native:
|
|
35
|
+
vendor/bin/phpstan analyse # Analyse all configured paths
|
|
36
|
+
vendor/bin/phpstan analyse --memory-limit=512M # With memory limit
|
|
37
|
+
vendor/bin/phpstan analyse --error-format=github # CI-friendly format
|
|
38
|
+
|
|
39
|
+
# With a project-specific quality wrapper:
|
|
40
|
+
php artisan quality:phpstan # Laravel
|
|
41
|
+
composer quality:phpstan # Composer
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Native flags:**
|
|
45
|
+
|
|
46
|
+
| Flag | Description |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `--memory-limit=SIZE` | Set memory limit (e.g. `512M`, `1G`) |
|
|
49
|
+
| `--debug` | Activate debug mode |
|
|
50
|
+
| `--error-format=FORMAT` | Output format: `table` (default), `github`, `gitlab` |
|
|
51
|
+
| `--pro` | Toggle PHPStan Pro |
|
|
52
|
+
|
|
53
|
+
**Wrapper-only flags** (typical of a `quality:*` wrapper — verify in the project):
|
|
54
|
+
|
|
55
|
+
| Flag | Description |
|
|
56
|
+
|---|---|
|
|
57
|
+
| `--baseline` | Generate/update phpstan baseline file |
|
|
58
|
+
| `--ignore-git` | Skip Git check, analyse all files |
|
|
59
|
+
| `--xdebug` | Activate Xdebug mode |
|
|
60
|
+
|
|
61
|
+
### ECS — Easy Coding Standard
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Native:
|
|
65
|
+
vendor/bin/ecs check # Dry-run
|
|
66
|
+
vendor/bin/ecs check --fix # Auto-fix
|
|
67
|
+
|
|
68
|
+
# With a project-specific quality wrapper:
|
|
69
|
+
php artisan quality:ecs --fix # Laravel
|
|
70
|
+
composer quality:ecs -- --fix # Composer
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Native flags:**
|
|
74
|
+
|
|
75
|
+
| Flag | Description |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `--fix` | Fix errors automatically |
|
|
78
|
+
| `--clear-cache` | Clear the ECS cache |
|
|
79
|
+
|
|
80
|
+
**Wrapper-only flags** (typical of a `quality:*` wrapper — verify in the project):
|
|
81
|
+
|
|
82
|
+
| Flag | Description |
|
|
83
|
+
|---|---|
|
|
84
|
+
| `--ignore-git` | Skip Git check, check all files |
|
|
85
|
+
| `--paths-to-scan[=PATHS]` | Custom paths, e.g. `--paths-to-scan='["./core"]'` |
|
|
86
|
+
| `--source-branch[=BRANCH]` | Source branch (default: HEAD) |
|
|
87
|
+
| `--target-branch[=BRANCH]` | Target branch to compare against |
|
|
88
|
+
|
|
89
|
+
### Rector — Automated Refactoring
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Native:
|
|
93
|
+
vendor/bin/rector process # Auto-fix
|
|
94
|
+
vendor/bin/rector process --dry-run # Preview changes
|
|
95
|
+
|
|
96
|
+
# With a project-specific quality wrapper:
|
|
97
|
+
php artisan quality:rector --fix # Laravel
|
|
98
|
+
composer quality:rector -- --fix # Composer
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Native flags:**
|
|
102
|
+
|
|
103
|
+
| Flag | Description |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `--dry-run` | Preview changes without applying |
|
|
106
|
+
| `--clear-cache` | Clear the Rector cache |
|
|
107
|
+
|
|
108
|
+
**Wrapper-only flags** (typical of a `quality:*` wrapper — verify in the project):
|
|
109
|
+
|
|
110
|
+
| Flag | Description |
|
|
111
|
+
|---|---|
|
|
112
|
+
| `--ignore-git` | Skip Git check, check all files |
|
|
113
|
+
| `--paths-to-scan[=PATHS]` | Custom paths |
|
|
114
|
+
| `--source-branch[=BRANCH]` | Source branch (default: HEAD) |
|
|
115
|
+
| `--target-branch[=BRANCH]` | Target branch to compare against |
|
|
116
|
+
|
|
117
|
+
### Combined Commands
|
|
118
|
+
|
|
119
|
+
There is no native single command for running all three tools. Run them in sequence:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Full pipeline (native):
|
|
123
|
+
vendor/bin/rector process && vendor/bin/ecs check --fix && vendor/bin/phpstan analyse
|
|
124
|
+
|
|
125
|
+
# With a project-specific quality wrapper (if it ships these combined commands):
|
|
126
|
+
php artisan quality:refactor --fix # Rector + ECS
|
|
127
|
+
php artisan quality:finalize # Rector + ECS + PHPStan (full pipeline)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Procedure: Run quality checks
|
|
131
|
+
|
|
132
|
+
1. Run PHPStan — fix all errors
|
|
133
|
+
2. Run Rector + ECS with auto-fix — fix style + refactoring
|
|
134
|
+
3. Run PHPStan again — verify step 2 didn't introduce new issues
|
|
135
|
+
|
|
136
|
+
If step 3 finds errors → fix and repeat from step 2.
|
|
137
|
+
|
|
138
|
+
Detect commands from project (see Tool Detection above).
|
|
139
|
+
|
|
140
|
+
## Configuration
|
|
141
|
+
|
|
142
|
+
Config files are typically in the **project root**. Do NOT modify without explicit user permission.
|
|
143
|
+
|
|
144
|
+
Detect config location:
|
|
145
|
+
- Check project root first: `phpstan.neon`, `ecs.php`, `rector.php`
|
|
146
|
+
- Some projects use `phpstan.neon.dist` instead of `phpstan.neon`
|
|
147
|
+
|
|
148
|
+
### Standard config files
|
|
149
|
+
|
|
150
|
+
| File | Tool | Purpose |
|
|
151
|
+
|---|---|---|
|
|
152
|
+
| `phpstan.neon` | PHPStan | Level, paths, extensions, `ignoreErrors`, disallowed calls |
|
|
153
|
+
| `phpstan-baseline.neon` | PHPStan | Baseline for existing errors (auto-managed, do NOT edit) |
|
|
154
|
+
| `ecs.php` | ECS | Code style: rule sets, configured rules, skip list |
|
|
155
|
+
| `rector.php` | Rector | Refactoring: rule sets, PHP version sets, skip list |
|
|
156
|
+
|
|
157
|
+
### Understanding the project's config
|
|
158
|
+
|
|
159
|
+
Read the actual config files to understand what rules are active:
|
|
160
|
+
|
|
161
|
+
- **phpstan.neon**: Check `level`, `paths`, `ignoreErrors`, `includes` (baselines, extensions)
|
|
162
|
+
- **ecs.php**: Check which rule sets are active (PSR-12, PHP-CS-Fixer sets), skip list
|
|
163
|
+
- **rector.php**: Check PHP version sets, active rule sets, skip list
|
|
164
|
+
|
|
165
|
+
Common patterns across projects:
|
|
166
|
+
- PHPStan at high levels (8-9) with `disallowedFunctionCalls` banning `var_dump()`, `dd()`
|
|
167
|
+
- ECS with PSR-12 base, trailing commas, Yoda style
|
|
168
|
+
- Rector with PHP version migration sets and naming conventions
|
|
169
|
+
|
|
170
|
+
## Baseline policy
|
|
171
|
+
|
|
172
|
+
- **NEVER** edit `phpstan-baseline.neon` by hand.
|
|
173
|
+
- **NEVER** add errors, update counts, or regenerate manually.
|
|
174
|
+
- If the project ships a quality wrapper (exposing `quality:*` commands), it may regenerate the baseline automatically.
|
|
175
|
+
|
|
176
|
+
## PHPStan error handling
|
|
177
|
+
|
|
178
|
+
Priority order for dealing with PHPStan errors:
|
|
179
|
+
|
|
180
|
+
1. **Fix the code** — always the first choice. Fix the actual type issue.
|
|
181
|
+
2. **Add type hints / PHPDoc** — if the code is correct but PHPStan can't infer the type.
|
|
182
|
+
3. **Inline ignore (last resort)** — only for confirmed false positives:
|
|
183
|
+
```php
|
|
184
|
+
// @phpstan-ignore-next-line — false positive: reason here
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### When `phpstan.neon` changes ARE allowed
|
|
188
|
+
|
|
189
|
+
Adding `ignoreErrors` entries to `phpstan.neon` is allowed when:
|
|
190
|
+
|
|
191
|
+
- The error is a **structural limitation** of the toolchain (e.g., Pest tests bind `$this` at runtime, PHPStan can't resolve `artisan()`,
|
|
192
|
+
`get()`, etc. on `PHPUnit\Framework\TestCase`)
|
|
193
|
+
- The pattern applies **broadly** to a category of files (e.g., all test files), not just one specific line
|
|
194
|
+
- The fix would require abandoning the project's conventions (e.g., rewriting Pest tests as PHPUnit classes)
|
|
195
|
+
|
|
196
|
+
**If unsure whether a `phpstan.neon` change is appropriate → ask the user before making the change.**
|
|
197
|
+
|
|
198
|
+
### NEVER do these
|
|
199
|
+
|
|
200
|
+
- Add entries to baseline files (`phpstan-baseline.neon`)
|
|
201
|
+
- Add `ignoreErrors` for individual files or specific code issues that should be fixed
|
|
202
|
+
- Use `@phpstan-ignore-next-line` without a reason comment
|
|
203
|
+
|
|
204
|
+
See also: `php-coding` rule → PHPStan section.
|
|
205
|
+
|
|
206
|
+
## Testing framework
|
|
207
|
+
|
|
208
|
+
- **Always write tests in Pest**, not PHPUnit class syntax — unless the user explicitly asks for PHPUnit.
|
|
209
|
+
- Pest tests in `tests/Unit/` automatically use `UnitTestCase` as the base class (configured in `tests/Pest.php`).
|
|
210
|
+
- PHPStan cannot fully resolve Pest's runtime bindings — this is handled via `ignoreErrors` patterns in `phpstan.neon`.
|
|
211
|
+
|
|
212
|
+
## Git-aware execution
|
|
213
|
+
|
|
214
|
+
By default, all tools only check files changed since the last commit.
|
|
215
|
+
|
|
216
|
+
| Flag | Effect |
|
|
217
|
+
|------------------------------|-----------------------------------------------|
|
|
218
|
+
| (default) | Only changed files (fast, for iterative work) |
|
|
219
|
+
| `--ignore-git` | All files (cache still applies) |
|
|
220
|
+
| `--clear-cache` | Changed files, but ignore cache |
|
|
221
|
+
| `--ignore-git --clear-cache` | Complete fresh run of all files |
|
|
222
|
+
|