bms-speckit-plugin 6.0.0 → 6.2.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.
@@ -49,6 +49,8 @@ You are a senior quality control engineer performing a comprehensive audit of a
49
49
 
50
50
  ## Phase A: Code Errors (MUST pass before other phases)
51
51
 
52
+ ### A1. Standard Checks
53
+
52
54
  1. Run the build command (`npm run build`, `tsc`, `python -m py_compile`, etc.)
53
55
  2. Run linter (`eslint .`, `flake8`, `ruff check`, etc.)
54
56
  3. Run the full test suite (`npm test`, `pytest`, etc.)
@@ -59,6 +61,50 @@ You are a senior quality control engineer performing a comprehensive audit of a
59
61
  - Re-run to confirm fix
60
62
  5. Repeat until all three (build + lint + test) pass with zero errors
61
63
 
64
+ ### A2. Runtime Safety Patterns
65
+
66
+ Build and lint miss an entire class of runtime errors — type-correct syntax that crashes when executed. These checks close that gap. **Detect the project language(s) first, then apply the relevant checks.**
67
+
68
+ #### Language Config Strictness
69
+
70
+ Check that the project's type checker / compiler is configured for maximum strictness:
71
+
72
+ - **TypeScript** — `tsconfig.json` should have `"strict": true` (or at minimum: `noImplicitAny`, `strictNullChecks`, `noImplicitReturns`, `noUncheckedIndexedAccess`). Enable and fix resulting errors.
73
+ - **Python** — If using mypy/pyright, check config has `strict = true` or equivalent. If no type checker is configured, flag it.
74
+ - **Go** — Verify `go vet` passes. Check for unchecked errors (`errcheck`).
75
+ - **Rust** — Verify `#![deny(warnings)]` or strict clippy lints are enabled.
76
+ - **Other** — Check for the language's equivalent strict/lint configuration.
77
+
78
+ #### Type Mismatch Patterns
79
+
80
+ Grep source files for patterns where a value of one type is used where another type is expected. These are the most common causes of runtime crashes that pass build/lint:
81
+
82
+ 1. **Iterable/collection confusion** — A function returns one collection type but the caller treats it as another:
83
+ - Spreading non-iterables: `[...obj]` where `obj` is a plain object (JS/TS crashes), `[...fn()]` where `fn` returns a dict/object instead of a list/array
84
+ - Iterating dicts/objects: `for x in fn()` where `fn` returns a dict (Python iterates keys, not values)
85
+ - Calling collection methods on wrong types: `.map()`, `.filter()`, `.reduce()` on non-arrays; `.keys()` on a list instead of a dict
86
+ - **Fix:** Add explicit return type annotations on the function, add runtime type checks at the call site (e.g., `Array.isArray()`, `isinstance()`)
87
+
88
+ 2. **Null/undefined/None access** — Chained property or method access on values from external sources (API responses, DB results, user input, config files) without null guards:
89
+ - JS/TS: `data.result.items.map(...)` where any level could be `undefined`
90
+ - Python: `data["result"]["items"]` where any key could be missing
91
+ - **Fix:** Add optional chaining, default values, or explicit null/key-existence checks
92
+
93
+ 3. **Type assertion/cast bypass** — Code that overrides the type system's safety checks:
94
+ - TS: `as SomeType`, `!` non-null assertion
95
+ - Python: `cast()`, `# type: ignore`
96
+ - Go: unchecked type assertions `val := x.(Type)` without `, ok` pattern
97
+ - **Fix:** Verify each assertion is actually correct. Replace with type guards or proper error handling where possible
98
+
99
+ 4. **Implicit type coercion** — Operations that silently convert types, masking bugs:
100
+ - JS/TS: `==` instead of `===`, string concatenation with numbers (`"count: " + count`)
101
+ - Python: comparing different types without explicit conversion
102
+ - **Fix:** Use strict equality, explicit type conversion
103
+
104
+ 5. **Missing return type annotations on data transformers** — Functions that reshape, map, filter, or aggregate data should always have explicit return types. Without them, the type system infers too broadly and callers may use the result incorrectly.
105
+ - Grep for exported functions and functions whose results are spread or iterated
106
+ - **Fix:** Add explicit return type annotations
107
+
62
108
  ## Phase B: Security Audit
63
109
 
64
110
  1. Run `npm audit` or `pip audit` to check for known vulnerabilities
@@ -67,9 +113,40 @@ You are a senior quality control engineer performing a comprehensive audit of a
67
113
  - Check `.env` files are in `.gitignore`
68
114
  - Check no credentials in committed code
69
115
  3. Check for injection vulnerabilities:
70
- - SQL injection: look for string concatenation in queries
71
- - XSS: look for unescaped user input in HTML/JSX
72
- - Command injection: look for unvalidated input in shell commands
116
+
117
+ **SQL Injection enforce parameterized queries:**
118
+ All SQL queries that include dynamic values MUST use parameterized queries (placeholders), never string concatenation or interpolation. Grep for these dangerous patterns and fix every match:
119
+
120
+ - **String concatenation in SQL:**
121
+ - JS/TS: `"SELECT..." + variable`, template literals with variables in SQL strings
122
+ - Python: `"SELECT..." + variable`, `"SELECT...%s" % variable`, f-strings in SQL, `.format()` in SQL
123
+ - Go: `fmt.Sprintf("SELECT...%s", variable)`
124
+ - Java: `"SELECT..." + variable`
125
+ - PHP: `"SELECT...$variable"`, `"SELECT..." . $variable`
126
+
127
+ - **Safe parameterized alternatives (what to replace with):**
128
+ - JS/TS (mysql2/pg): `db.query("SELECT * FROM t WHERE id = ?", [userId])`
129
+ - Python (DB-API): `cursor.execute("SELECT * FROM t WHERE id = %s", (userId,))`
130
+ - Python (SQLAlchemy): `session.execute(text("...WHERE id = :id"), {"id": userId})`
131
+ - Go: `db.Query("SELECT * FROM t WHERE id = $1", userId)`
132
+ - Java (JDBC): `PreparedStatement` with `?` placeholders
133
+ - PHP (PDO): `$stmt = $pdo->prepare("SELECT * FROM t WHERE id = ?");`
134
+
135
+ - **ORM/query builder misuse** — Even with ORMs, raw query methods can be vulnerable:
136
+ - Sequelize: `sequelize.query("SELECT..." + input)` — must use `replacements` or `bind`
137
+ - Prisma: `prisma.$queryRawUnsafe(...)` — flag all usages, prefer `$queryRaw` with tagged template
138
+ - TypeORM: `.query("SELECT..." + input)` — must use parameterized version
139
+ - Django: raw SQL with string concat — must use params tuple
140
+ - SQLAlchemy: raw SQL with string concat — must use `text()` with bind params
141
+
142
+ - **Exceptions (do NOT flag these):**
143
+ - Static SQL with no dynamic values: `"SELECT * FROM users WHERE active = 1"`
144
+ - Parameterized queries using placeholders: `?`, `$1`, `%s`, `:name`
145
+ - Table/column names from internal constants (not user input) — but add a comment explaining why it's safe
146
+
147
+ **XSS:** look for unescaped user input rendered as raw HTML — unsafe inner HTML setters, raw output directives in template engines, disabled auto-escaping
148
+
149
+ **Command injection:** look for shell invocations that pass unsanitized user input as arguments. Prefer array-based APIs over shell string execution.
73
150
  4. Check authentication & authorization:
74
151
  - API endpoints have proper auth guards
75
152
  - Session handling is secure
@@ -162,10 +239,14 @@ After completing all phases, provide a summary report:
162
239
  - [ ] Build: PASS/FAIL (X errors fixed)
163
240
  - [ ] Lint: PASS/FAIL (X errors fixed)
164
241
  - [ ] Tests: PASS/FAIL (X failures fixed)
242
+ - [ ] Language config strictness: PASS/SKIP (X issues fixed)
243
+ - [ ] Runtime safety patterns: PASS (X type mismatches fixed)
165
244
 
166
245
  ### Security
167
246
  - [ ] No hardcoded secrets
168
- - [ ] No injection vulnerabilities
247
+ - [ ] SQL: all queries use parameterized placeholders (no string concat/interpolation)
248
+ - [ ] XSS: no raw HTML rendering of user input
249
+ - [ ] Command injection: no unsanitized input in shell calls
169
250
  - [ ] Dependencies have no known CVEs
170
251
  - [ ] Auth properly implemented
171
252
 
@@ -288,6 +288,16 @@ chain_sequence:
288
288
  For EACH task, execute this rolling QC cycle:
289
289
 
290
290
  1. IMPLEMENT — write code following TDD (tests first, then implementation)
291
+ RUNTIME SAFETY RULES (prevent errors that build/lint miss):
292
+ - Always add explicit return type annotations on data transformation
293
+ functions. Never rely on type inference for functions whose return
294
+ values are spread, iterated, or passed to collection methods
295
+ - Never spread or iterate a function return value without verifying
296
+ it returns the expected collection type (array not object, list not dict)
297
+ - Use strict equality, add null/undefined/None guards for external
298
+ data (API responses, DB results, config, user input)
299
+ - Write unit tests that execute data transformation functions and
300
+ verify the output type and shape
291
301
  2. INLINE QC — immediately after implementation, run:
292
302
  a. Build/compile — fix any type or build errors
293
303
  b. Lint — fix all lint errors and warnings
@@ -296,6 +306,9 @@ chain_sequence:
296
306
  XSS, unvalidated input in the code you just wrote
297
307
  e. UX check — if UI code was changed, verify error messages are
298
308
  actionable, loading states exist, and user feedback is present
309
+ f. Runtime safety scan — grep for spread/iteration on non-collection
310
+ types, missing return type annotations on data transformation
311
+ functions, loose equality operators. Fix any found.
299
312
  3. FIX — fix every issue found in step 2, then re-run checks
300
313
  4. COMMIT — only commit when build + lint + tests all pass with zero errors
301
314
  5. NEXT TASK — proceed to the next task
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bms-speckit-plugin",
3
- "version": "6.0.0",
3
+ "version": "6.2.0",
4
4
  "description": "Chain-orchestrated development pipeline: /bms-speckit takes requirements and runs brainstorm → constitution → specify → plan → tasks → analyze → implement → verify with per-step error handling",
5
5
  "files": [
6
6
  ".claude-plugin/",
@@ -178,14 +178,18 @@ After the subagent completes, update tasks 1-8 as completed using TaskUpdate, th
178
178
  - **Max iterations:** 10
179
179
  - **Pattern:** Rolling Review — each task gets its own QC cycle before moving to the next
180
180
  - **Per-task cycle:**
181
- 1. **IMPLEMENT** — write code following TDD (tests first, then implementation)
181
+ 1. **IMPLEMENT** — write code following TDD (tests first, then implementation). **Runtime safety rules:**
182
+ - Always add explicit return type annotations on data transformation functions — never rely on type inference for functions whose return values are spread, iterated, or passed to collection methods
183
+ - Never spread or iterate a function's return value without verifying it returns the expected collection type (e.g., array not object, list not dict)
184
+ - Use strict equality, add null/undefined/None guards for external data (API responses, DB results, config, user input)
185
+ - Add unit tests that actually execute data transformation functions and verify the output type and shape
182
186
  2. **INLINE QC** — immediately run: build, lint, ALL tests, security quick scan, UX check
183
187
  3. **FIX** — fix every issue found, re-run checks
184
188
  4. **COMMIT** — only commit when build + lint + tests pass with zero errors
185
189
  5. **NEXT** — move to next task
186
190
  - **Action:** Run:
187
191
 
188
- `/ralph-loop:ralph-loop "systematically execute speckit.implement via the Skill tool to complete every task defined in {TASKS_PATH} with strict adherence to specification requirements. IMPORTANT: apply rolling QC after EACH task — after implementing a task run build and fix build errors, run linter and fix lint errors, run ALL tests (not just new ones) and fix failures, check for hardcoded secrets and injection vulnerabilities in code you just wrote, verify UI code has actionable error messages and loading states only commit when build plus lint plus tests all pass with zero errors then proceed to next task. Report progress to the user after each task: output [Task N/total] DONE — task_name. Do NOT batch QC at the end. Maintain atomic commits after each successful task with clear traceability, avoid requesting confirmation and proceed autonomously, once all tasks are implemented invoke speckit.analyze via the Skill tool to perform a full validation pass, automatically apply all recommended improvements or corrections, re-run all tests to confirm stability and zero regression, and only output <promise>FINISHED</promise> after every task is fully completed, validated, and aligned with production-grade quality standards" --completion-promise "FINISHED" --max-iterations 10`
192
+ `/ralph-loop:ralph-loop "systematically execute speckit.implement via the Skill tool to complete every task defined in {TASKS_PATH} with strict adherence to specification requirements. IMPORTANT: apply rolling QC after EACH task — after implementing a task run build and fix build errors, run linter and fix lint errors, run ALL tests (not just new ones) and fix failures, check for hardcoded secrets and injection vulnerabilities in code you just wrote, verify UI code has actionable error messages and loading states. RUNTIME SAFETY: always add explicit return type annotations on data transformation functions, never spread or iterate a function return value without verifying it returns the expected collection type, use strict equality and null guards for external data, write tests that execute data transformers and verify output type and shape. Only commit when build plus lint plus tests all pass with zero errors then proceed to next task. Report progress to the user after each task: output [Task N/total] DONE — task_name. Do NOT batch QC at the end. Maintain atomic commits after each successful task with clear traceability, avoid requesting confirmation and proceed autonomously, once all tasks are implemented invoke speckit.analyze via the Skill tool to perform a full validation pass, automatically apply all recommended improvements or corrections, re-run all tests to confirm stability and zero regression, and only output <promise>FINISHED</promise> after every task is fully completed, validated, and aligned with production-grade quality standards" --completion-promise "FINISHED" --max-iterations 10`
189
193
 
190
194
  - **Done:** Update task 10 as completed. Output `[Step 10/12] DONE — all tasks implemented and verified`
191
195