@wrongstack/core 0.6.4 → 0.6.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.
Files changed (63) hide show
  1. package/dist/{agent-bridge-eb7qnNrd.d.ts → agent-bridge-BBXK_ppx.d.ts} +1 -1
  2. package/dist/agent-subagent-runner-DsSm9lKN.d.ts +174 -0
  3. package/dist/{compactor-RIPuTtWK.d.ts → compactor-C8NhpSt5.d.ts} +1 -1
  4. package/dist/{config-BGGuP_Ar.d.ts → config-DfC6g6KV.d.ts} +1 -1
  5. package/dist/{context-CDRyrkKQ.d.ts → context-DN5v-uQX.d.ts} +11 -0
  6. package/dist/coordination/index.d.ts +10 -9
  7. package/dist/coordination/index.js +113 -20
  8. package/dist/coordination/index.js.map +1 -1
  9. package/dist/defaults/index.d.ts +21 -20
  10. package/dist/defaults/index.js +1329 -925
  11. package/dist/defaults/index.js.map +1 -1
  12. package/dist/{events-BHuIHekD.d.ts → events-CJqwQl8G.d.ts} +17 -1
  13. package/dist/execution/index.d.ts +82 -13
  14. package/dist/execution/index.js +1366 -74
  15. package/dist/execution/index.js.map +1 -1
  16. package/dist/extension/index.d.ts +6 -6
  17. package/dist/{goal-store-DVCfj7Ff.d.ts → goal-store-_Er467ya.d.ts} +2 -2
  18. package/dist/{index-CPcDqvZh.d.ts → index-CXnWsGBp.d.ts} +11 -175
  19. package/dist/{index-BOn9NK7D.d.ts → index-DcnXDPdY.d.ts} +6 -6
  20. package/dist/index.d.ts +28 -27
  21. package/dist/index.js +1068 -664
  22. package/dist/index.js.map +1 -1
  23. package/dist/infrastructure/index.d.ts +6 -6
  24. package/dist/kernel/index.d.ts +9 -9
  25. package/dist/kernel/index.js.map +1 -1
  26. package/dist/{mcp-servers-DBdh3cee.d.ts → mcp-servers-CevFHHM1.d.ts} +3 -3
  27. package/dist/models/index.d.ts +2 -2
  28. package/dist/models/index.js +5 -16
  29. package/dist/models/index.js.map +1 -1
  30. package/dist/{multi-agent-CxSb-9dQ.d.ts → multi-agent-D5IbASk_.d.ts} +16 -4
  31. package/dist/observability/index.d.ts +2 -2
  32. package/dist/{path-resolver-CMGNadvq.d.ts → path-resolver-CBx_q1HA.d.ts} +2 -2
  33. package/dist/{plan-templates-BJflQY2i.d.ts → plan-templates-BEOllUJV.d.ts} +5 -4
  34. package/dist/{provider-runner-BFgNXpaP.d.ts → provider-runner-Byh5TcJs.d.ts} +3 -3
  35. package/dist/{retry-policy-LKS8MHsB.d.ts → retry-policy-BZSIMxrJ.d.ts} +1 -1
  36. package/dist/sdd/index.d.ts +3 -3
  37. package/dist/{secret-scrubber-CfMdAJ_l.d.ts → secret-scrubber-CT7wefiO.d.ts} +1 -1
  38. package/dist/{secret-scrubber-BzQR5BiL.d.ts → secret-scrubber-I0QHY_ob.d.ts} +1 -1
  39. package/dist/security/index.d.ts +3 -3
  40. package/dist/{selector-C7HqnZJU.d.ts → selector-DDb_mq9X.d.ts} +1 -1
  41. package/dist/{session-reader-CzfRA6Vk.d.ts → session-reader-B9nVkziM.d.ts} +1 -1
  42. package/dist/storage/index.d.ts +6 -6
  43. package/dist/storage/index.js +27 -2
  44. package/dist/storage/index.js.map +1 -1
  45. package/dist/{system-prompt-Dl2QY1_B.d.ts → system-prompt-gL06H9P4.d.ts} +1 -1
  46. package/dist/{tool-executor-FoxBjULX.d.ts → tool-executor-BF7QfYVE.d.ts} +4 -4
  47. package/dist/types/index.d.ts +15 -15
  48. package/dist/types/index.js +5 -16
  49. package/dist/types/index.js.map +1 -1
  50. package/dist/utils/index.d.ts +1 -1
  51. package/package.json +1 -1
  52. package/skills/audit-log/SKILL.md +57 -28
  53. package/skills/bug-hunter/SKILL.md +85 -61
  54. package/skills/git-flow/SKILL.md +73 -18
  55. package/skills/multi-agent/SKILL.md +69 -40
  56. package/skills/node-modern/SKILL.md +111 -19
  57. package/skills/prompt-engineering/SKILL.md +97 -16
  58. package/skills/react-modern/SKILL.md +104 -18
  59. package/skills/refactor-planner/SKILL.md +73 -43
  60. package/skills/sdd/SKILL.md +54 -112
  61. package/skills/security-scanner/SKILL.md +95 -93
  62. package/skills/skill-creator/SKILL.md +58 -25
  63. package/skills/typescript-strict/SKILL.md +107 -15
@@ -1,20 +1,26 @@
1
1
  ---
2
2
  name: typescript-strict
3
3
  description: |
4
- Use this skill when writing or reviewing TypeScript code with strict mode.
5
- Covers strict null checks, exhaustive switch, branded types, discriminated
6
- unions, and noUncheckedIndexedAccess pitfalls.
7
- version: 1.0.0
4
+ Use this skill when writing or reviewing TypeScript code with strict mode
5
+ in WrongStack. Triggers: user mentions "TypeScript", "strict", "type error",
6
+ "type safety", "narrowing", "branded type", "discriminated union", "noUncheckedIndexedAccess".
7
+ version: 1.1.0
8
8
  ---
9
9
 
10
- # TypeScript strict mode
10
+ # TypeScript Strict Mode — WrongStack
11
11
 
12
- ## Core rules
12
+ ## Non-negotiable rules
13
13
 
14
- - `strict: true` is non-negotiable. So is `noUncheckedIndexedAccess: true`.
15
- - Never silence type errors with `as any`. Use `as unknown as T` only at trust boundaries with a comment explaining why.
16
- - Prefer discriminated unions over enums.
17
- - Use `readonly` aggressively on properties and arrays.
14
+ ```json
15
+ {
16
+ "strict": true,
17
+ "noUncheckedIndexedAccess": true,
18
+ "noImplicitReturns": true,
19
+ "exactOptionalPropertyTypes": true
20
+ }
21
+ ```
22
+
23
+ Never silence errors with `as any`. Use `as unknown as T` only at trust boundaries with a comment.
18
24
 
19
25
  ## Common patterns
20
26
 
@@ -28,6 +34,7 @@ function assertNever(x: never): never {
28
34
  switch (block.type) {
29
35
  case 'text': return renderText(block);
30
36
  case 'tool_use': return renderToolUse(block);
37
+ case 'error': return renderError(block);
31
38
  default: return assertNever(block);
32
39
  }
33
40
  ```
@@ -36,15 +43,100 @@ switch (block.type) {
36
43
 
37
44
  ```ts
38
45
  type UserId = string & { readonly __brand: 'UserId' };
39
- const toUserId = (s: string): UserId => s as UserId;
46
+ type SessionId = string & { readonly __brand: 'SessionId' };
47
+
48
+ function toUserId(s: string): UserId {
49
+ return s as UserId;
50
+ }
51
+
52
+ // now TypeScript won't let you accidentally pass SessionId where UserId is expected
53
+ ```
54
+
55
+ ### Discriminated unions
56
+
57
+ ```ts
58
+ type Result =
59
+ | { status: 'success'; data: User }
60
+ | { status: 'error'; error: Error }
61
+ | { status: 'loading' };
62
+
63
+ // ✅ TypeScript knows which fields exist in each branch
64
+ function handle(result: Result) {
65
+ if (result.status === 'success') {
66
+ console.log(result.data.name); // data exists here
67
+ } else if (result.status === 'error') {
68
+ console.log(result.error.message); // error exists here
69
+ }
70
+ }
40
71
  ```
41
72
 
42
73
  ### noUncheckedIndexedAccess
43
74
 
44
- After enabling this, `arr[i]` is `T | undefined`. Don't disable it — handle the undefined explicitly.
75
+ After enabling `noUncheckedIndexedAccess: true`, array/object access returns `T | undefined`:
76
+
77
+ ```ts
78
+ const items = ['a', 'b', 'c'];
79
+ const first: string | undefined = items[0]; // ✅ correct
80
+ const last = items[items.length - 1]; // string | undefined
81
+
82
+ // ✅ Always handle the undefined case
83
+ if (items[0] !== undefined) {
84
+ console.log(items[0].toUpperCase());
85
+ }
86
+
87
+ // ✅ Or use a guard helper
88
+ const first = items.at(0);
89
+ if (first) console.log(first.toUpperCase());
90
+ ```
45
91
 
46
92
  ## Anti-patterns
47
93
 
48
- - `!` non-null assertion in production code (use a narrow check)
49
- - Returning `Promise<any>` from a public API
50
- - `Function` or `Object` types always be specific
94
+ | Anti-pattern | Why bad | Fix |
95
+ |---|---|---|
96
+ | `!` non-null assertion | Silences the type checker | Use a narrow check |
97
+ | `Promise<any>` return type | Loses type safety | Use `Promise<unknown>` or generic |
98
+ | `Function` or `Object` types | Too broad | Be specific |
99
+ | `as any` for shortcuts | Defeats type safety | `as unknown as T` at boundaries |
100
+ | Optional chaining chain | `a?.b?.c?.d` when `a` might be undefined | Verify with if/guard first |
101
+ | Missing return types on exports | Hides errors | Always annotate public APIs |
102
+
103
+ ## Useful utility types
104
+
105
+ ```ts
106
+ // Make properties optional
107
+ type Partial<T> = { [P in keyof T]?: T[P] };
108
+
109
+ // Make properties required
110
+ type Required<T> = { [P in keyof T]-?: T[P] };
111
+
112
+ // Pick specific properties
113
+ type UserPreview = Pick<User, 'id' | 'name'>;
114
+
115
+ // Omit specific properties
116
+ type UserWithoutPassword = Omit<User, 'password'>;
117
+
118
+ // Readonly arrays
119
+ function processItems(items: readonly string[]): void { ... }
120
+ ```
121
+
122
+ ## Strict null checking
123
+
124
+ ```ts
125
+ // ✅ Good — explicit handling
126
+ const name: string | null = getName();
127
+ if (name !== null) {
128
+ console.log(name.toUpperCase());
129
+ }
130
+
131
+ // ✅ Optional chaining + nullish coalescing
132
+ const len: number = str?.length ?? 0;
133
+
134
+ // ❌ Bad — assumes not null
135
+ console.log(name!.toUpperCase());
136
+ ```
137
+
138
+ ## Skills in scope
139
+
140
+ - `node-modern` — for TypeScript + ESM patterns
141
+ - `react-modern` — for React + TypeScript patterns
142
+ - `bug-hunter` — for type-related bugs like unsafe casts