arkgate 3.6.1 → 3.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/CHANGELOG.md +46 -0
- package/README.md +4 -4
- package/bin/ark-check.mjs +3 -3
- package/bin/ark-layer-match.mjs +2 -1
- package/bin/lib/analysis-engine.mjs +6 -6
- package/bin/lib/architecture-scan.mjs +66 -13
- package/bin/lib/design-smells.mjs +67 -14
- package/bin/lib/doctor-advisories.mjs +20 -5
- package/bin/lib/doctor-plan.mjs +5 -7
- package/bin/lib/html-report-advisories.mjs +59 -0
- package/bin/lib/parse-health.mjs +74 -0
- package/bin/lib/reshape-decisions.mjs +284 -0
- package/bin/lib/ts-resolve.mjs +3 -2
- package/dist/eslint/index.cjs +2 -2
- package/dist/eslint/index.js +2 -2
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/docs/agent-guide.md +33 -2
- package/docs/ai-gates.md +3 -2
- package/docs/configuration.md +6 -0
- package/docs/package-surface.md +6 -5
- package/docs/typescript-support.md +9 -0
- package/package.json +2 -1
- package/server.json +2 -2
- package/templates/skills/ark-autopilot.md +12 -0
- package/templates/skills/ark-explore.md +8 -1
- package/templates/skills/ark-fix.md +11 -1
- package/templates/skills/ark-loop.md +14 -1
|
@@ -123,6 +123,7 @@ Useful split: **core product tree** | **field path** (`examples/`, starters) | *
|
|
|
123
123
|
6. **§G spaghetti / design-depth** when signals fire (or always on brownfield).
|
|
124
124
|
7. Ranked rows that **change a decision**; each bet has a **success signal** (not a file count).
|
|
125
125
|
8. Hard lines: never weaken the contract; never invent mechanical-safe kinds; never claim ENFORCE from type-only cleanup while false-green doctor ids are active.
|
|
126
|
+
9. **Parse honesty:** if `doctor.parseHealth.affectedFiles > 0`, open and name those paths; never describe them as clean or successfully inspected. The advisory does not change the gate verdict.
|
|
126
127
|
|
|
127
128
|
## Reconnaissance pass (do all that apply)
|
|
128
129
|
|
|
@@ -150,6 +151,12 @@ Useful split: **core product tree** | **field path** (`examples/`, starters) | *
|
|
|
150
151
|
|
|
151
152
|
Mark the **golden** pattern to copy. Do not only list layer file counts.
|
|
152
153
|
|
|
154
|
+
When `doctor.physicalCohesion` includes `reshapeDecisions`, treat current rejected/deferred
|
|
155
|
+
targets as explicit adopter decisions, not residual to re-fight. Keep their mirror facts in the
|
|
156
|
+
map. When the user accepts, defers, or rejects a live `reshapePilot.nextPilot`, record the card's
|
|
157
|
+
exact `decisionTarget` with a reason (and optional `reviewBy`) in
|
|
158
|
+
`.ark/reshape-decisions.json`. Never infer or suppress from free-form golden-pattern prose.
|
|
159
|
+
|
|
153
160
|
### C. Coupling & debt (measure, don’t guess)
|
|
154
161
|
Prefer evidence over aesthetics:
|
|
155
162
|
- **Fan-in / importers** of hot modules (who imports the suspect file?).
|
|
@@ -215,7 +222,7 @@ ENFORCE without Shape progress is **`ENFORCE · design-weak`** — say that out
|
|
|
215
222
|
| Smell id (label) | How you detect it in source |
|
|
216
223
|
|------------------|-----------------------------|
|
|
217
224
|
| `io-under-application` | I/O clients under Application; empty Domain/Persistence (also doctor when present) |
|
|
218
|
-
| `handler-in-persistence` | HTTP
|
|
225
|
+
| `handler-in-persistence` | Static framework HTTP imports, `defineRoute` calls, or route bodies under Persistence-role repo/db globs (first 800 sorted candidates; no advisory is not whole-tree proof above that bound) |
|
|
219
226
|
| `god-module` | High fan-in + wide export surface + mixed concerns |
|
|
220
227
|
| `domain-logic-in-ui` | `can*` / `calculate*` / policy constants in hooks/pages |
|
|
221
228
|
| `mixed-pattern-cluster` | Same feature area uses ≥2 incompatible layouts |
|
|
@@ -105,12 +105,22 @@ If the “fix” is really a missing business intent or Domain home for a rule:
|
|
|
105
105
|
- Prefer mechanical-safe kinds when the plan tags them; otherwise design judgment carefully.
|
|
106
106
|
- Code only — no DB migrations unless user asked.
|
|
107
107
|
|
|
108
|
+
## Mechanical-edit hygiene (Y04 — outcome gate)
|
|
109
|
+
|
|
110
|
+
- Header injection must **merge into the existing doc comment**; the kept result has one `/**`, not stacked headers.
|
|
111
|
+
- Route completion or movement must **preserve the original typed `defineRoute<…>(opts, handler)` call**; reconstruct that call instead of extracting untyped opts/handler constants that drop generics or contextual typing.
|
|
112
|
+
- A convention-only `*-data.ts` stub is not a fix: move the real code or **leave the placeholder file uncreated**; never write `import "server-only"; export {}` as an empty naming token.
|
|
113
|
+
- Keep the edit only when the **previously clean file stays typecheck-clean**. Otherwise roll it back and treat the change as judgment.
|
|
114
|
+
|
|
108
115
|
## Reshape findings (X04 — never mechanical)
|
|
109
116
|
|
|
110
117
|
If `doctor.physicalCohesion` fires while you fix: do **not** fold reshape moves into your fix
|
|
111
118
|
batch. Physical moves run only through `/ark-loop`'s one-pilot loop; merge decisions only as
|
|
112
119
|
`/ark-architect` merge cards. A cohesion finding is context for your fix, never a license to
|
|
113
|
-
reorganize.
|
|
120
|
+
reorganize. Respect `physicalCohesion.reshapeDecisions`: never revive a current rejected/deferred
|
|
121
|
+
target from the still-visible facts. If the user makes a verdict while reviewing the finding,
|
|
122
|
+
record its exact `decisionTarget` + reason in `.ark/reshape-decisions.json`; never infer one from
|
|
123
|
+
golden-pattern prose.
|
|
114
124
|
|
|
115
125
|
## Done
|
|
116
126
|
|
|
@@ -82,12 +82,21 @@ feature dirs, plan clusters), you **may** dispatch **subagents**:
|
|
|
82
82
|
|
|
83
83
|
Never auto: free value uses of imports, multi-import files, dynamic import/require, forbidden globals, cycles, port-proof inject, multi-file adapter scaffolding without proof.
|
|
84
84
|
|
|
85
|
+
## Mechanical-edit hygiene (Y04 — outcome gate)
|
|
86
|
+
|
|
87
|
+
- Header injection must **merge into the existing doc comment**; the kept result has one `/**`, not stacked headers.
|
|
88
|
+
- Route completion or movement must **preserve the original typed `defineRoute<…>(opts, handler)` call**; reconstruct that call instead of extracting untyped opts/handler constants that drop generics or contextual typing.
|
|
89
|
+
- A convention-only `*-data.ts` stub is not a fix: move the real code or **leave the placeholder file uncreated**; never write `import "server-only"; export {}` as an empty naming token.
|
|
90
|
+
- Keep the edit only when the **previously clean file stays typecheck-clean**. Otherwise roll it back and treat the change as judgment.
|
|
91
|
+
|
|
85
92
|
## Reshape pilots (X04 — physical cohesion, advisory)
|
|
86
93
|
|
|
87
94
|
When `ark-check --doctor --json` carries `doctor.physicalCohesion.reshapePilot.nextPilot`,
|
|
88
95
|
you may run **that one pilot** — never more:
|
|
89
96
|
|
|
90
|
-
1. Read
|
|
97
|
+
1. Read `physicalCohesion.reshapeDecisions` first. A current rejected/deferred target has no live
|
|
98
|
+
card: respect the explicit record and do not reconstruct it from raw facts. Read a live card's
|
|
99
|
+
`pilotTarget`, `decisionTarget`, `moveSample`/`movesTotal`, `successSignal`, `killSwitch`, `doNot[]`.
|
|
91
100
|
2. Moves are **proposed only** — enumerate the full move set for the pilot anchor, express it as
|
|
92
101
|
an architecture change map, and validate through the atomic preflight (`ark_prepare_change` /
|
|
93
102
|
the write gate) **before** any file moves. A move the preflight rejects is a finding, not a
|
|
@@ -97,6 +106,10 @@ you may run **that one pilot** — never more:
|
|
|
97
106
|
4. After the move set: full gate re-run + re-doctor. Success = the concept's cluster count drops
|
|
98
107
|
and the verdict stays green; otherwise use the kill switch (revert the move set, nothing else).
|
|
99
108
|
5. Re-doctor decides whether a next card exists. One pilot per loop iteration, always.
|
|
109
|
+
6. If the user accepts, defers, or rejects the target, persist that explicit verdict in
|
|
110
|
+
`.ark/reshape-decisions.json` using the card's exact `decisionTarget`, a reason, and optional
|
|
111
|
+
`reviewBy`. `accepted` keeps this execution path; `deferred`/`rejected` stop repeat pressure.
|
|
112
|
+
Never infer a decision from `.ark/golden-pattern.json` prose.
|
|
100
113
|
|
|
101
114
|
## Steps
|
|
102
115
|
|