@geminixiang/pi-simplify 0.0.10 → 0.0.11
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 +6 -0
- package/package.json +1 -1
- package/prompt.ts +22 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.0.11] - 2026-06-03
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Add thin-wrapper review heuristics so `/simplify` flags rename-only wrappers, pass-through factories, single-call-site helpers, duplicated write APIs, and test-only exports only when they create real maintenance cost.
|
|
14
|
+
|
|
9
15
|
## [0.0.10] - 2026-05-30
|
|
10
16
|
|
|
11
17
|
### Changed
|
package/package.json
CHANGED
package/prompt.ts
CHANGED
|
@@ -25,8 +25,15 @@ Before flagging, **search the codebase** (utility directories, shared modules, f
|
|
|
25
25
|
#### B3. Commented-out Code (Review)
|
|
26
26
|
- Old logic left in comments, disabled features, uncustomized templates
|
|
27
27
|
|
|
28
|
-
#### B4. Over-engineering (Confirm)
|
|
28
|
+
#### B4. Over-engineering / Thin Wrappers (Confirm)
|
|
29
29
|
- Abstractions created "for future use" but unused, single-call-site helpers that should be inlined, useless indirection
|
|
30
|
+
- Thin wrappers that only rename another function or constructor without adding validation, policy, error handling, logging, or a stable public boundary
|
|
31
|
+
- Platform-specific wrapper modules that merely re-export generic session/config helpers under different names
|
|
32
|
+
- Method wrappers on classes that only delegate to a free function already available to callers
|
|
33
|
+
- Test-only exported helpers that can use the real internal/public helper directly instead
|
|
34
|
+
- Small formatting/command helpers whose name repeats a one-line call and have only one call site
|
|
35
|
+
|
|
36
|
+
**Thin-wrapper discipline:** prefer deleting the wrapper and calling the underlying primitive directly when the wrapper has no independent semantic responsibility. Keep the wrapper if it protects a public API, documents a domain boundary, centralizes cross-cutting behavior, or isolates an unstable dependency.
|
|
30
37
|
|
|
31
38
|
#### B5. Hacky Patterns (Confirm)
|
|
32
39
|
- **Redundant state**: state that duplicates other state, cached values that could be derived, observers that could be direct calls
|
|
@@ -57,6 +64,20 @@ Before flagging, **search the codebase** (utility directories, shared modules, f
|
|
|
57
64
|
- Assign **category** (reuse / quality / efficiency) and **risk**
|
|
58
65
|
- State the concrete fix (which existing utility to call, which lines to delete, how to parallelize, etc.)
|
|
59
66
|
|
|
67
|
+
## Thin Wrapper Review Heuristics
|
|
68
|
+
|
|
69
|
+
When hunting simplification opportunities, explicitly scan for these patterns:
|
|
70
|
+
|
|
71
|
+
- **Rename-only wrapper:** \`foo()\` only calls \`bar()\` with the same inputs. Inline \`bar()\` unless \`foo\` is a real public/domain concept.
|
|
72
|
+
- **Constructor/factory wrapper:** \`createX(args)\` only returns \`new X(args)\`. Inline construction unless the factory selects implementations or enforces policy.
|
|
73
|
+
- **Scope-specific alias:** \`SlackThing\`/\`ConversationThing\` only wraps a generic helper. Delete it if the generic name is already clear at call sites.
|
|
74
|
+
- **Single-call-site helper:** a helper with one caller and no meaningful name compression. Inline it, especially for one-line formatting, parsing, or path helpers.
|
|
75
|
+
- **Duplicated write APIs:** several \`saveFooConfig\` functions patch different fields in the same file. Consolidate into one \`updateSettings(patch)\`-style API.
|
|
76
|
+
- **Test-only export:** exported solely so tests can call a thin wrapper. Test the underlying public helper or observable behavior instead.
|
|
77
|
+
- **Pass-through class method:** a class method only delegates to a module-level function and is not required by an interface. Remove the method or call the function directly.
|
|
78
|
+
|
|
79
|
+
Do **not** flag wrappers whose consequence is only "one extra line". Flag them when they create a real maintenance cost: multiple ways to do the same operation, unclear source of truth, misleading domain boundaries, duplicated tests for delegated behavior, or user/developer uncertainty about which API is authoritative.
|
|
80
|
+
|
|
60
81
|
## Risk Levels
|
|
61
82
|
|
|
62
83
|
- **safe**: Definitely apply (dead code, debug remnants)
|