@laitszkin/apollo-toolkit 3.1.4 → 3.1.5

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 CHANGED
@@ -7,6 +7,11 @@ All notable changes to this repository are documented in this file.
7
7
  ### Changed
8
8
  - None yet.
9
9
 
10
+ ## [v3.1.5] - 2026-04-23
11
+
12
+ ### Changed
13
+ - Strengthen `iterative-code-quality` so large coupled or apparently core files trigger staged unlock work instead of passive stopping, and require a full-codebase stage-gate decision after every iteration to determine whether additional rounds are still needed.
14
+
10
15
  ## [v3.1.4] - 2026-04-23
11
16
 
12
17
  ### Changed
@@ -14,6 +14,8 @@ Improve an existing repository through repeated, evidence-backed full-iteration
14
14
  - Uses those tests and other guardrails to justify more aggressive refactors, instead of leaving known issues in place for subjective confidence reasons.
15
15
  - Re-scans the full repository after every iteration and picks the next highest-confidence, highest-leverage directions.
16
16
  - Uses small safe refactors to prepare the ground for larger later refactors, progressing gradually from outside to inside.
17
+ - Treats large coupled or apparently core files as staged unlock problems, not as automatic stop signals.
18
+ - Runs a stage-gate full-codebase decision after every iteration to decide whether more rounds are still required.
17
19
  - Repeats the pass cycle while any known in-scope actionable quality issue remains, and forbids a completion report until the latest scan is clear or remaining items are explicitly deferred with a valid reason.
18
20
  - Targets as many inherited repository quality problems as can be solved safely, and expects the guarded test surface to remain green after the refactor.
19
21
  - Synchronizes project docs and `AGENTS.md` through `align-project-documents` and `maintain-project-constraints` after implementation.
@@ -41,6 +41,7 @@ Load references only when they match the active pass:
41
41
  - `references/repository-scan.md`: scope mapping, generated-file exclusions, and quality backlog selection.
42
42
  - `references/naming-and-simplification.md`: variable renames, function simplification, reusable extraction, and behavior-preservation checks.
43
43
  - `references/module-boundaries.md`: single-responsibility split heuristics and safe module extraction rules.
44
+ - `references/coupled-core-file-strategy.md`: staged unlock strategy for large, coupled, or apparently core files that should not become stop signals.
44
45
  - `references/logging-alignment.md`: stale log detection, missing log criteria, and behavior-neutral observability updates.
45
46
  - `references/testing-strategy.md`: risk-based unit, property, integration, and E2E coverage selection.
46
47
  - `references/iteration-gates.md`: multi-pass quality gates, stopping criteria, and validation cadence.
@@ -74,6 +75,7 @@ Direction-selection rules:
74
75
  - Prefer smaller, higher-confidence refactors that unlock or de-risk larger later refactors.
75
76
  - Prefer outside-in progress: stabilize boundaries, callers, naming, logs, and tests around a subsystem before attempting deeper internal rewrites.
76
77
  - Re-evaluate the whole backlog after every landed iteration; the next best direction may change because the previous cleanup improved the local safety or clarity.
78
+ - When a file appears too coupled, too central, or too risky for a direct rewrite, treat that as a prompt to switch into staged unlock work rather than a reason to stop. Load `references/coupled-core-file-strategy.md` and choose the next smallest refactor that reduces future risk.
77
79
 
78
80
  For each iteration:
79
81
 
@@ -111,6 +113,14 @@ For each iteration:
111
113
  - When module boundaries are currently poor but can be protected by focused tests or other guardrails, choose the cleaner split instead of preserving a mixed-responsibility file out of caution alone.
112
114
  - Use `references/module-boundaries.md` for extraction rules and anti-patterns.
113
115
 
116
+ ### 5.1) Handle large coupled or apparently core files through unlock work
117
+
118
+ - Do not treat a large coupled file, a central orchestrator, or a historically fragile module as an automatic stop condition.
119
+ - First ask: what is the next smallest refactor that lowers the risk of changing this area later without changing business behavior now?
120
+ - Prefer unlock steps such as characterization tests, naming cleanup, type extraction, pure-function extraction, side-effect boundary isolation, read/write path separation, dependency seam introduction, and caller grouping.
121
+ - Only stop when no such unlock step can be identified under current guardrails. If an unlock step exists, do it before reconsidering the larger refactor.
122
+ - Use `references/coupled-core-file-strategy.md` whenever the current obstacle is "too coupled", "too central", or "too risky to touch directly".
123
+
114
124
  ### 6) Repair logging and observability drift
115
125
 
116
126
  - Compare log messages, event names, structured fields, metrics, and trace names against the current code ownership model.
@@ -133,6 +143,7 @@ For each iteration:
133
143
 
134
144
  - After each iteration, run the narrowest relevant tests first, then broaden validation until the changed scope and final repository state are adequately guarded.
135
145
  - Re-scan the full codebase, not only the touched area, because the best next direction may have shifted after the last cleanup.
146
+ - Perform an explicit stage-gate decision after that full-codebase scan: decide whether all known in-scope issues are now resolved, whether remaining issues are only legitimately deferred categories, or whether another iteration is required right now.
136
147
  - Re-rank the backlog after every iteration and choose the next highest-confidence, highest-leverage direction set.
137
148
  - Use small external or boundary-level cleanups to make later deeper refactors safer; treat that groundwork as progress toward a thorough long-horizon refactor, not as a distraction from it.
138
149
  - Repeat the full iteration whenever any known in-scope actionable gap remains and can be fixed safely without changing business behavior or macro architecture.
@@ -163,7 +174,7 @@ Only write this report after the latest scan confirms there are no known actiona
163
174
 
164
175
  Return:
165
176
 
166
- 1. Iterations completed and which execution directions were selected in each one.
177
+ 1. Iterations completed, which execution directions were selected in each one, and the stage-gate decision after each full-codebase re-scan.
167
178
  2. Key files changed and the quality issue each change resolved.
168
179
  3. Business behavior preservation evidence.
169
180
  4. Tests added or updated, including property/integration/E2E `N/A` reasons where relevant.
@@ -1,4 +1,4 @@
1
1
  interface:
2
2
  display_name: "Iterative Code Quality"
3
3
  short_description: "Refactor names, functions, modules, logs, and tests in repeated behavior-safe passes"
4
- default_prompt: "Use $iterative-code-quality to keep scanning the full repository, treat naming, simplification, reusable extraction, module-boundary cleanup, logging alignment, and testing as selectable execution directions rather than a fixed sequence, and choose the highest-confidence, highest-leverage directions available at each moment; use small safe refactors to prepare the ground for larger later refactors, progress gradually from outside to inside, use tests or other reliable guardrails to justify aggressive cleanup without breaking intended behavior or the system's top-level runtime architecture, and do not write a completion report while any known in-scope actionable issue remains; only finish after the latest full-codebase scan is clear or remaining items are explicitly classified as blocked, unsafe, low-value, speculative, or approval-dependent, and the guarded test surface is green; then run $align-project-documents and $maintain-project-constraints to synchronize docs and AGENTS.md."
4
+ default_prompt: "Use $iterative-code-quality to keep scanning the full repository, treat naming, simplification, reusable extraction, module-boundary cleanup, logging alignment, and testing as selectable execution directions rather than a fixed sequence, and choose the highest-confidence, highest-leverage directions available at each moment; use small safe refactors to prepare the ground for larger later refactors, progress gradually from outside to inside, and when a file feels too coupled or too central switch into staged unlock work instead of stopping; use tests or other reliable guardrails to justify aggressive cleanup without breaking intended behavior or the system's top-level runtime architecture, run a full-codebase stage-gate after each iteration to decide whether another round is required, and do not write a completion report while any known in-scope actionable issue remains; only finish after the latest full-codebase scan is clear or remaining items are explicitly classified as blocked, unsafe, low-value, speculative, or approval-dependent, and the guarded test surface is green; then run $align-project-documents and $maintain-project-constraints to synchronize docs and AGENTS.md."
@@ -0,0 +1,69 @@
1
+ # Staged Strategy For Large Coupled Or Apparently Core Files
2
+
3
+ ## Purpose
4
+
5
+ Teach the agent how to keep making progress when a file feels too central, too coupled, or too risky to refactor directly.
6
+
7
+ The correct response is usually not "stop". The correct response is "find the next unlock step".
8
+
9
+ ## Core rule
10
+
11
+ A large coupled file is a **decomposition signal**, not a **completion blocker**.
12
+
13
+ If a safe, behavior-preserving unlock step exists under current guardrails, take that step now instead of deferring the whole area.
14
+
15
+ ## First questions to ask
16
+
17
+ When a file feels untouchable, ask:
18
+
19
+ - Which parts are pure logic and which parts are side effects?
20
+ - Which names or local concepts are blocking understanding?
21
+ - Which behavior can be locked down with characterization tests?
22
+ - Which dependency seams can be introduced without changing behavior?
23
+ - Which caller groups or workflow slices can be isolated first?
24
+ - Which refactor would most reduce the cost of the next refactor?
25
+
26
+ ## Typical unlock sequence
27
+
28
+ Pick one or more of these, in the order justified by current evidence:
29
+
30
+ 1. Add characterization or regression tests around current behavior.
31
+ 2. Rename confusing variables, flags, intermediate states, and helper names.
32
+ 3. Extract constants, schemas, types, and small pure transformations.
33
+ 4. Separate read path from write path, or decision logic from side effects.
34
+ 5. Isolate external calls, persistence, and logging behind clearer seams.
35
+ 6. Group callers by responsibility and split one slice at a time.
36
+ 7. Move one coherent responsibility into a new internal module.
37
+ 8. Re-scan and decide whether a deeper split is now safer.
38
+
39
+ ## What not to do
40
+
41
+ Avoid these anti-patterns:
42
+
43
+ - declaring the area blocked just because it is important,
44
+ - attempting a full rewrite before guardrails exist,
45
+ - preserving obvious local design debt only because the file is central,
46
+ - escalating ordinary internal decomposition into a fake macro-architecture concern,
47
+ - mixing unlock work with unrelated style churn.
48
+
49
+ ## Choosing the next step
50
+
51
+ Prefer the next step that maximizes:
52
+
53
+ 1. confidence under existing tests or quickly addable tests,
54
+ 2. leverage for future deeper cleanup,
55
+ 3. reduction in coupling or cognitive load,
56
+ 4. low risk to current business behavior.
57
+
58
+ If two steps are both safe, choose the one that makes the next iteration easier.
59
+
60
+ ## Completion rule for coupled files
61
+
62
+ Do not ask "Can I solve the whole file now?"
63
+
64
+ Ask:
65
+
66
+ - "Can I make this file meaningfully easier to change in the next iteration?"
67
+ - "Can I reduce coupling, clarify ownership, or improve guardrails right now?"
68
+
69
+ If the answer is yes, continue iterating.
@@ -52,6 +52,18 @@ Then choose the next execution directions with these priorities:
52
52
  2. strongest leverage for later deeper cleanup,
53
53
  3. lowest business-risk path toward broader system improvement.
54
54
 
55
+ ## Stage-gate after each iteration
56
+
57
+ After every validated iteration, run a deliberate full-codebase decision pass:
58
+
59
+ 1. Re-scan the repository and refresh the known quality backlog.
60
+ 2. Ask whether any known in-scope actionable issue still remains.
61
+ 3. If yes, decide whether it should be addressed in the very next iteration or whether first-step unlock work is needed.
62
+ 4. If the obstacle is a large, coupled, or central file, do not stop there; switch to staged unlock work and continue.
63
+ 5. Only declare the repository iteration-complete when the re-scan shows no remaining actionable in-scope issue except items that are explicitly deferred under the allowed stop categories.
64
+
65
+ This stage-gate is mandatory. A validated local change does not by itself mean the repository is done.
66
+
55
67
  ## Continue when
56
68
 
57
69
  Repeat the cycle when:
@@ -87,6 +99,7 @@ The final report should make the stopping point auditable:
87
99
 
88
100
  - passes completed,
89
101
  - execution directions selected per iteration,
102
+ - stage-gate verdict after each full-codebase re-scan,
90
103
  - validation commands and outcomes,
91
104
  - confirmation that the guarded test surface is green after the refactor,
92
105
  - tests added by risk category,
@@ -41,6 +41,8 @@ The following do **not** count as macro-architecture changes by themselves:
41
41
 
42
42
  Treat those changes as ordinary refactoring work unless they also alter the top-level system model above.
43
43
 
44
+ Large coupled or central files should therefore be treated as decomposition problems, not as automatic macro-architecture blockers. If the top-level system model remains intact, prefer staged internal cleanup over stopping.
45
+
44
46
  ## Safe split patterns
45
47
 
46
48
  - Move pure domain logic into a domain-owned helper module.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laitszkin/apollo-toolkit",
3
- "version": "3.1.4",
3
+ "version": "3.1.5",
4
4
  "description": "Apollo Toolkit npm installer for managed skill copying across Codex, OpenClaw, and Trae.",
5
5
  "license": "MIT",
6
6
  "author": "LaiTszKin",