@wrongstack/core 0.6.3 → 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.
- package/dist/{agent-bridge-eb7qnNrd.d.ts → agent-bridge-BBXK_ppx.d.ts} +1 -1
- package/dist/agent-subagent-runner-DsSm9lKN.d.ts +174 -0
- package/dist/{compactor-RIPuTtWK.d.ts → compactor-C8NhpSt5.d.ts} +1 -1
- package/dist/{config-BGGuP_Ar.d.ts → config-DfC6g6KV.d.ts} +1 -1
- package/dist/{context-CDRyrkKQ.d.ts → context-DN5v-uQX.d.ts} +11 -0
- package/dist/coordination/index.d.ts +10 -9
- package/dist/coordination/index.js +113 -20
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +21 -20
- package/dist/defaults/index.js +1329 -925
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-BHuIHekD.d.ts → events-CJqwQl8G.d.ts} +17 -1
- package/dist/execution/index.d.ts +82 -13
- package/dist/execution/index.js +1366 -74
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +6 -6
- package/dist/{goal-store-DVCfj7Ff.d.ts → goal-store-_Er467ya.d.ts} +2 -2
- package/dist/{index-CPcDqvZh.d.ts → index-CXnWsGBp.d.ts} +11 -175
- package/dist/{index-BOn9NK7D.d.ts → index-DcnXDPdY.d.ts} +6 -6
- package/dist/index.d.ts +28 -27
- package/dist/index.js +1068 -664
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +6 -6
- package/dist/kernel/index.d.ts +9 -9
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-DBdh3cee.d.ts → mcp-servers-CevFHHM1.d.ts} +3 -3
- package/dist/models/index.d.ts +2 -2
- package/dist/models/index.js +5 -16
- package/dist/models/index.js.map +1 -1
- package/dist/{multi-agent-CxSb-9dQ.d.ts → multi-agent-D5IbASk_.d.ts} +16 -4
- package/dist/observability/index.d.ts +2 -2
- package/dist/{path-resolver-CMGNadvq.d.ts → path-resolver-CBx_q1HA.d.ts} +2 -2
- package/dist/{plan-templates-BJflQY2i.d.ts → plan-templates-BEOllUJV.d.ts} +5 -4
- package/dist/{provider-runner-BFgNXpaP.d.ts → provider-runner-Byh5TcJs.d.ts} +3 -3
- package/dist/{retry-policy-LKS8MHsB.d.ts → retry-policy-BZSIMxrJ.d.ts} +1 -1
- package/dist/sdd/index.d.ts +3 -3
- package/dist/{secret-scrubber-CfMdAJ_l.d.ts → secret-scrubber-CT7wefiO.d.ts} +1 -1
- package/dist/{secret-scrubber-BzQR5BiL.d.ts → secret-scrubber-I0QHY_ob.d.ts} +1 -1
- package/dist/security/index.d.ts +3 -3
- package/dist/{selector-C7HqnZJU.d.ts → selector-DDb_mq9X.d.ts} +1 -1
- package/dist/{session-reader-CzfRA6Vk.d.ts → session-reader-B9nVkziM.d.ts} +1 -1
- package/dist/storage/index.d.ts +6 -6
- package/dist/storage/index.js +27 -2
- package/dist/storage/index.js.map +1 -1
- package/dist/{system-prompt-Dl2QY1_B.d.ts → system-prompt-gL06H9P4.d.ts} +1 -1
- package/dist/{tool-executor-FoxBjULX.d.ts → tool-executor-BF7QfYVE.d.ts} +4 -4
- package/dist/types/index.d.ts +15 -15
- package/dist/types/index.js +5 -16
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
- package/skills/audit-log/SKILL.md +57 -28
- package/skills/bug-hunter/SKILL.md +85 -61
- package/skills/git-flow/SKILL.md +73 -18
- package/skills/multi-agent/SKILL.md +69 -40
- package/skills/node-modern/SKILL.md +111 -19
- package/skills/prompt-engineering/SKILL.md +97 -16
- package/skills/react-modern/SKILL.md +104 -18
- package/skills/refactor-planner/SKILL.md +73 -43
- package/skills/sdd/SKILL.md +54 -112
- package/skills/security-scanner/SKILL.md +95 -93
- package/skills/skill-creator/SKILL.md +58 -25
- 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
|
-
|
|
6
|
-
|
|
7
|
-
version: 1.
|
|
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
|
|
10
|
+
# TypeScript Strict Mode — WrongStack
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Non-negotiable rules
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
-
|
|
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
|