@northbridge-security/secureai 0.1.13

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 (50) hide show
  1. package/.claude/README.md +122 -0
  2. package/.claude/commands/architect/clean.md +978 -0
  3. package/.claude/commands/architect/kiss.md +762 -0
  4. package/.claude/commands/architect/review.md +704 -0
  5. package/.claude/commands/catchup.md +90 -0
  6. package/.claude/commands/code.md +115 -0
  7. package/.claude/commands/commit.md +1218 -0
  8. package/.claude/commands/cover.md +1298 -0
  9. package/.claude/commands/fmea.md +275 -0
  10. package/.claude/commands/kaizen.md +312 -0
  11. package/.claude/commands/pr.md +503 -0
  12. package/.claude/commands/todo.md +99 -0
  13. package/.claude/commands/worktree.md +738 -0
  14. package/.claude/commands/wrapup.md +103 -0
  15. package/LICENSE +183 -0
  16. package/README.md +108 -0
  17. package/dist/cli.js +75634 -0
  18. package/docs/agents/devops-reviewer.md +889 -0
  19. package/docs/agents/kiss-simplifier.md +1088 -0
  20. package/docs/agents/typescript.md +8 -0
  21. package/docs/guides/README.md +109 -0
  22. package/docs/guides/agents.clean.arch.md +244 -0
  23. package/docs/guides/agents.clean.arch.ts.md +1314 -0
  24. package/docs/guides/agents.gotask.md +1037 -0
  25. package/docs/guides/agents.markdown.md +1209 -0
  26. package/docs/guides/agents.onepassword.md +285 -0
  27. package/docs/guides/agents.sonar.md +857 -0
  28. package/docs/guides/agents.tdd.md +838 -0
  29. package/docs/guides/agents.tdd.ts.md +1062 -0
  30. package/docs/guides/agents.typesript.md +1389 -0
  31. package/docs/guides/github-mcp.md +1075 -0
  32. package/package.json +130 -0
  33. package/packages/secureai-cli/src/cli.ts +21 -0
  34. package/tasks/README.md +880 -0
  35. package/tasks/aws.yml +64 -0
  36. package/tasks/bash.yml +118 -0
  37. package/tasks/bun.yml +738 -0
  38. package/tasks/claude.yml +183 -0
  39. package/tasks/docker.yml +420 -0
  40. package/tasks/docs.yml +127 -0
  41. package/tasks/git.yml +1336 -0
  42. package/tasks/gotask.yml +132 -0
  43. package/tasks/json.yml +77 -0
  44. package/tasks/markdown.yml +95 -0
  45. package/tasks/onepassword.yml +350 -0
  46. package/tasks/security.yml +102 -0
  47. package/tasks/sonar.yml +437 -0
  48. package/tasks/template.yml +74 -0
  49. package/tasks/vscode.yml +103 -0
  50. package/tasks/yaml.yml +121 -0
@@ -0,0 +1,503 @@
1
+ ---
2
+ description: End-to-end PR workflow from validation through creation, CI monitoring, and review triage
3
+ argument-hint: [--draft] [--base=branch] [--skip-deploy] [--skip-tests] [--skip-ci]
4
+ allowed-tools: Bash, Read, Edit, Write, Glob, Grep, Task, mcp__github__*, AskUserQuestion
5
+ ---
6
+
7
+ # PR Workflow: $ARGUMENTS
8
+
9
+ End-to-end workflow from code changes to PR creation, CI monitoring, and review triage.
10
+
11
+ ## Arguments
12
+
13
+ Parse from `$ARGUMENTS`:
14
+
15
+ - `--draft`: Create PR as draft (default for new PRs)
16
+ - `--base=BRANCH`: Target branch (auto-detected from branch naming)
17
+ - `--skip-deploy`: Skip deploy phase
18
+ - `--skip-tests`: Skip test phase (use rarely)
19
+ - `--skip-ci`: Skip CI monitoring phase (create PR and exit)
20
+
21
+ **Default**: Create draft PR, run all phases, auto-detect base branch.
22
+
23
+ ---
24
+
25
+ ## Phase 1: Validate
26
+
27
+ Run quality checks and ensure code is ready for PR.
28
+
29
+ ### 1.1 Run Tests
30
+
31
+ ```bash
32
+ # Detect available test tasks
33
+ if task --list 2>/dev/null | grep -q "^qa:"; then
34
+ task qa
35
+ elif task --list 2>/dev/null | grep -q "^test:"; then
36
+ task test
37
+ else
38
+ # Direct commands
39
+ bun run lint && bun run typecheck && bun test
40
+ fi
41
+ ```
42
+
43
+ **If tests fail:**
44
+
45
+ - Analyze error output
46
+ - Apply fixes automatically
47
+ - Re-run tests
48
+ - Iterate until all pass
49
+
50
+ ### 1.2 Run Deploy (if applicable)
51
+
52
+ ```bash
53
+ # Check if deploy task exists
54
+ if task --list 2>/dev/null | grep -q "^deploy"; then
55
+ task deploy
56
+ fi
57
+ ```
58
+
59
+ **If deploy fails:**
60
+
61
+ - Analyze deployment errors
62
+ - Fix infrastructure or configuration
63
+ - Re-deploy
64
+ - Iterate until successful
65
+
66
+ **Skip with `--skip-deploy` flag.**
67
+
68
+ ---
69
+
70
+ ## Phase 2: Create or Update PR
71
+
72
+ ### 2.1 Detect Repository Context
73
+
74
+ ```bash
75
+ # Get current branch
76
+ BRANCH=$(git branch --show-current)
77
+
78
+ # Get remote info
79
+ REMOTE_URL=$(git remote get-url origin)
80
+ # Parse: github.com/owner/repo
81
+ OWNER=$(echo "$REMOTE_URL" | sed -E 's|.*github\.com[:/]([^/]+)/.*|\1|')
82
+ REPO=$(echo "$REMOTE_URL" | sed -E 's|.*github\.com[:/][^/]+/([^.]+).*|\1|')
83
+
84
+ # Detect base branch from naming convention
85
+ if [[ "$BRANCH" =~ ^(fix|hotfix)/ ]]; then
86
+ BASE_BRANCH="main"
87
+ elif [[ "$BRANCH" =~ ^(feat|feature)/ ]]; then
88
+ BASE_BRANCH="development" # or "main" if no development branch
89
+ else
90
+ BASE_BRANCH="main"
91
+ fi
92
+
93
+ # Override with --base flag if provided
94
+ ```
95
+
96
+ ### 2.2 Check for Existing PR
97
+
98
+ Use GitHub MCP to check for existing PR:
99
+
100
+ ```javascript
101
+ const result = await mcp__github__list_pull_requests({
102
+ owner: OWNER,
103
+ repo: REPO,
104
+ head: `${OWNER}:${BRANCH}`,
105
+ state: "open",
106
+ });
107
+ ```
108
+
109
+ **If PR exists:**
110
+
111
+ - Display PR number and URL
112
+ - Set UPDATE_MODE=true
113
+ - Will update existing PR
114
+
115
+ ### 2.3 Gather Context
116
+
117
+ **Analyze commits:**
118
+
119
+ ```bash
120
+ git log --oneline $(git merge-base HEAD $BASE_BRANCH)..HEAD
121
+ git diff --stat $(git merge-base HEAD $BASE_BRANCH)..HEAD
122
+ ```
123
+
124
+ **Find PRD files (if referenced):**
125
+
126
+ ```bash
127
+ # Check docs/requirements/ for PRD matching branch/ticket
128
+ ls docs/requirements/*.md 2>/dev/null
129
+
130
+ # Extract ticket ID from branch name
131
+ TICKET_ID=$(echo "$BRANCH" | grep -oE '[A-Z]+-[0-9]+' | head -1)
132
+ ```
133
+
134
+ **Read PR template:**
135
+
136
+ ```bash
137
+ if [ -f .github/PULL_REQUEST_TEMPLATE.md ]; then
138
+ TEMPLATE=".github/PULL_REQUEST_TEMPLATE.md"
139
+ elif [ -f .github/pull_request_template.md ]; then
140
+ TEMPLATE=".github/pull_request_template.md"
141
+ fi
142
+ ```
143
+
144
+ ### 2.4 Generate PR Content
145
+
146
+ Write to `.tmp/pr.md`:
147
+
148
+ **Title format:** `[TICKET-ID] Brief description` or just `Brief description`
149
+
150
+ **Writing style rules (mandatory):**
151
+
152
+ - No emojis anywhere in the PR title or body
153
+ - Use a professional, direct tone
154
+ - Use clear, concise language — avoid business jargon and overly complex sentences
155
+ - Assume the reader has little prior knowledge of the change
156
+ - Assume other maintainers may not use English as their first language
157
+ - Avoid adjectives that add no information: "robust", "comprehensive", "seamless", "extensive"
158
+ - Use active voice and specific, quantified facts where possible
159
+
160
+ **Body structure:**
161
+
162
+ - Follow the repository PR template strictly if one is found
163
+ - If no template exists, use this minimal format:
164
+
165
+ ```markdown
166
+ ## Summary
167
+
168
+ **Why:** [Problem or motivation from commits/PRD]
169
+
170
+ **What:** [Changes implemented]
171
+
172
+ ## Changes
173
+
174
+ - Change 1
175
+ - Change 2
176
+
177
+ ## Testing
178
+
179
+ - Unit tests: [status]
180
+ - Manual testing: [what was verified]
181
+ ```
182
+
183
+ **For trivial changes** (docs only, formatting, typos):
184
+
185
+ - Use minimal description
186
+ - Skip testing section
187
+
188
+ ### 2.5 Detect PR Creation Method
189
+
190
+ Determine whether to use GoTask or GitHub MCP for PR creation.
191
+
192
+ **Detection logic:**
193
+
194
+ ```bash
195
+ # Step 1: Check if GoTask is installed and `task git` runs
196
+ TASK_GIT_OUTPUT=$(task git 2>&1)
197
+ TASK_GIT_EXIT=$?
198
+
199
+ # Step 2: If GoTask works, check if git:pr:create is available
200
+ if [ $TASK_GIT_EXIT -eq 0 ] && echo "$TASK_GIT_OUTPUT" | grep -q "git:pr:create"; then
201
+ USE_GOTASK=true
202
+ else
203
+ USE_GOTASK=false
204
+ fi
205
+ ```
206
+
207
+ **If `USE_GOTASK=true`:** ALWAYS use GoTask for PR creation and updates. Do not fall back to MCP.
208
+
209
+ **If `USE_GOTASK=false`:** Use GitHub MCP tools.
210
+
211
+ ### 2.6 Create or Update PR
212
+
213
+ **GoTask method (when `USE_GOTASK=true`):**
214
+
215
+ ```bash
216
+ if [ "$UPDATE_MODE" = "true" ]; then
217
+ task git:pr:update PR="$PR_NUMBER" FILE=".tmp/pr.md"
218
+ else
219
+ task git:pr:create FILE=".tmp/pr.md" DRAFT=true
220
+ fi
221
+ ```
222
+
223
+ **GitHub MCP method (when `USE_GOTASK=false`):**
224
+
225
+ ```javascript
226
+ if (UPDATE_MODE) {
227
+ await mcp__github__update_pull_request({
228
+ owner: OWNER,
229
+ repo: REPO,
230
+ pullNumber: PR_NUMBER,
231
+ title: PR_TITLE,
232
+ body: PR_BODY,
233
+ });
234
+ } else {
235
+ await mcp__github__create_pull_request({
236
+ owner: OWNER,
237
+ repo: REPO,
238
+ title: PR_TITLE,
239
+ body: PR_BODY,
240
+ head: BRANCH,
241
+ base: BASE_BRANCH,
242
+ draft: true,
243
+ });
244
+ }
245
+ ```
246
+
247
+ **Output:**
248
+
249
+ ```text
250
+ PR #123: [TICKET-ID] Description
251
+ https://github.com/owner/repo/pull/123
252
+
253
+ Status: Draft
254
+ Base: development
255
+ ```
256
+
257
+ **If `--skip-ci` flag, exit here.**
258
+
259
+ ---
260
+
261
+ ## Phase 3: CI Monitoring
262
+
263
+ ### 3.1 Monitor Check Status
264
+
265
+ Poll every 30 seconds:
266
+
267
+ ```javascript
268
+ const status = await mcp__github__pull_request_read({
269
+ owner: OWNER,
270
+ repo: REPO,
271
+ pullNumber: PR_NUMBER,
272
+ method: "get_status",
273
+ });
274
+
275
+ // Report progress
276
+ console.log(`Checks: ${status.state}`);
277
+ for (const check of status.statuses) {
278
+ const icon = check.state === "success" ? "✓" : check.state === "pending" ? "⏳" : "✗";
279
+ console.log(` ${icon} ${check.context}`);
280
+ }
281
+ ```
282
+
283
+ Continue polling until all checks complete (success or failure).
284
+
285
+ ### 3.2 Handle CI Failures
286
+
287
+ **If checks fail:**
288
+
289
+ 1. Download logs:
290
+
291
+ ```bash
292
+ task git:runs:log STATE=all
293
+ # Logs saved to .tmp/ or .logs/
294
+ ```
295
+
296
+ 2. Analyze failure:
297
+ - Read log files
298
+ - Identify root cause
299
+ - Apply fixes automatically
300
+
301
+ 3. Commit fixes:
302
+
303
+ ```bash
304
+ git add -A
305
+ git commit -m "fix(ci): [description of fix]"
306
+ ```
307
+
308
+ 4. **Ask user to push:**
309
+
310
+ ```text
311
+ CI fixes committed. Please push to trigger new checks:
312
+
313
+ git push
314
+
315
+ Reply when pushed, or I'll continue monitoring.
316
+ ```
317
+
318
+ 5. Return to monitoring (step 3.1)
319
+
320
+ ### 3.3 Mark PR Ready
321
+
322
+ Once all CI checks pass:
323
+
324
+ ```javascript
325
+ // If PR was created as draft, mark ready
326
+ await mcp__github__update_pull_request({
327
+ owner: OWNER,
328
+ repo: REPO,
329
+ pullNumber: PR_NUMBER,
330
+ draft: false,
331
+ });
332
+ ```
333
+
334
+ ```text
335
+ All CI checks passed. PR marked as ready for review.
336
+ ```
337
+
338
+ ---
339
+
340
+ ## Phase 4: Review Triage
341
+
342
+ ### 4.1 Wait for Reviews
343
+
344
+ Monitor for automated reviews (CodeRabbit, SonarCloud, etc.) by polling GitHub MCP for review status, or wait for user notification that reviews are ready.
345
+
346
+ ### 4.2 Fetch Comments
347
+
348
+ ```bash
349
+ task git:pr:comments
350
+ # Output saved to .logs/github/comments/YYYYMMDD-HHMMSS.log
351
+ ```
352
+
353
+ Or via GitHub MCP:
354
+
355
+ ```javascript
356
+ const comments = await mcp__github__pull_request_read({
357
+ owner: OWNER,
358
+ repo: REPO,
359
+ pullNumber: PR_NUMBER,
360
+ method: "get_review_comments",
361
+ });
362
+ ```
363
+
364
+ ### 4.3 Triage and Fix
365
+
366
+ For each comment:
367
+
368
+ | Type | Action |
369
+ | ----------------------- | ----------------------------------- |
370
+ | **Actionable fix** | Apply automatically |
371
+ | **Security issue** | Fix immediately, prioritize |
372
+ | **Needs clarification** | **Ask user for decision** |
373
+ | **Nitpick/optional** | Apply if beneficial, otherwise skip |
374
+ | **Question** | Respond in PR comment |
375
+
376
+ **Apply fixes:**
377
+
378
+ - Make code changes
379
+ - Commit all fixes together:
380
+
381
+ ```bash
382
+ git add -A
383
+ git commit -m "fix: address review feedback
384
+
385
+ - Fixed issue 1
386
+ - Fixed issue 2"
387
+ ```
388
+
389
+ **Ask user to push:**
390
+
391
+ ```text
392
+ Review fixes committed. Please push:
393
+
394
+ git push
395
+
396
+ Addressed:
397
+ - [x] Security: Shell injection in utils.ts
398
+ - [x] Bug: Null check missing in parser.ts
399
+ - [ ] Skipped: Rename variable suggestion (cosmetic)
400
+
401
+ Reply when pushed.
402
+ ```
403
+
404
+ ### 4.4 Complete Workflow
405
+
406
+ Once all comments addressed and CI passes:
407
+
408
+ ```text
409
+ PR #123 is ready for human review.
410
+
411
+ Summary:
412
+ - CI: All checks passing
413
+ - CodeRabbit: All comments addressed
414
+ - Status: Ready for review
415
+
416
+ Next steps:
417
+ - Assign reviewers in GitHub
418
+ - Or run `/pr` again if more changes needed
419
+ ```
420
+
421
+ ---
422
+
423
+ ## Human Checkpoints
424
+
425
+ The workflow runs autonomously except:
426
+
427
+ 1. **Pushing to GitHub** - Always ask user to run `git push`
428
+ 2. **Triage decisions** - When review comments need human judgment
429
+ 3. **Final notification** - When PR is ready for reviewer assignment
430
+
431
+ ---
432
+
433
+ ## Taskfile Dependencies
434
+
435
+ This command expects these tasks (create stubs if missing):
436
+
437
+ | Task | Purpose | Required |
438
+ | ------------------------------ | ---------------- | ---------------------------------------------- |
439
+ | `task test` or `task qa` | Run tests | Yes |
440
+ | `task lint` | Run linting | Optional |
441
+ | `task deploy` | Deploy to stage | Optional |
442
+ | `task git` | List git tasks | Used for detection (see 2.5) |
443
+ | `task git:pr:create FILE=path` | Create PR | If detected, always used instead of MCP |
444
+ | `task git:pr:update` | Update PR | If detected, always used instead of MCP |
445
+ | `task git:pr:comments` | Fetch comments | Optional (MCP fallback) |
446
+ | `task git:runs:log` | Download CI logs | Optional |
447
+
448
+ ---
449
+
450
+ ## Error Recovery
451
+
452
+ | Error | Recovery |
453
+ | ----------------------- | ----------------------------------------- |
454
+ | Tests fail | Analyze, fix, retry |
455
+ | Deploy fails | Analyze infrastructure errors, fix, retry |
456
+ | GoTask not available | Use GitHub MCP (detected in step 2.5) |
457
+ | PR creation fails | Report error and ask user for guidance |
458
+ | CI fails | Download logs, fix, ask user to push |
459
+ | Review comments unclear | Ask user for decision |
460
+
461
+ ---
462
+
463
+ ## Examples
464
+
465
+ ### Basic usage
466
+
467
+ ```bash
468
+ /pr
469
+ ```
470
+
471
+ Runs full workflow: test → deploy → create draft PR → monitor CI → triage reviews.
472
+
473
+ ### Skip deploy
474
+
475
+ ```bash
476
+ /pr --skip-deploy
477
+ ```
478
+
479
+ For repos without deployment or when deploying separately.
480
+
481
+ ### Create and exit
482
+
483
+ ```bash
484
+ /pr --skip-ci
485
+ ```
486
+
487
+ Just create/update PR without monitoring CI.
488
+
489
+ ### Target specific branch
490
+
491
+ ```bash
492
+ /pr --base=main
493
+ ```
494
+
495
+ Override auto-detected base branch.
496
+
497
+ ### Non-draft PR
498
+
499
+ ```bash
500
+ /pr --no-draft
501
+ ```
502
+
503
+ Create PR as ready for review immediately (skip draft state).
@@ -0,0 +1,99 @@
1
+ # Todo: Manage Project Todos
2
+
3
+ List or add todos in `docs/TODO.md`. This file is gitignored - personal task tracking that doesn't clutter the repo.
4
+
5
+ ## File Location
6
+
7
+ - **Path**: `docs/TODO.md`
8
+ - **Git status**: Ignored (add to `.gitignore` if not present)
9
+ - **Scope**: Personal/local - not shared with team
10
+
11
+ ## Tasks
12
+
13
+ ### Prerequisites
14
+
15
+ - If `docs/TODO.md` doesn't exist: Create it with template:
16
+ ```markdown
17
+ # Project TODOs
18
+
19
+ Personal task tracking. This file is gitignored.
20
+
21
+ ## In Progress
22
+
23
+ | Task | Priority | Notes |
24
+ |------|----------|-------|
25
+
26
+ ## Backlog
27
+
28
+ | Task | Priority | Notes |
29
+ |------|----------|-------|
30
+
31
+ ## Done
32
+
33
+ | Task | Completed | Notes |
34
+ |------|-----------|-------|
35
+ ```
36
+
37
+ - If `docs/TODO.md` not in `.gitignore`: Add `docs/TODO.md` to `.gitignore`
38
+
39
+ ### Without arguments: List todos
40
+
41
+ 1. Read `docs/TODO.md`
42
+ 2. Display "In Progress" and "Backlog" tables
43
+ 3. Show count: "X in progress, Y in backlog"
44
+
45
+ ### With arguments: Add todo
46
+
47
+ 1. Read `docs/TODO.md`
48
+ 2. **Check for duplicates**: If similar task exists, ask whether to update or add new
49
+ 3. Assess complexity:
50
+
51
+ **Simple** (bug fix, config change, small task):
52
+ - Add to Backlog table
53
+ - Example: `| Fix typo in README | Low | Header spelling |`
54
+
55
+ **Complex** (feature, multi-session, needs design):
56
+ - Create ADR in `docs/ADR.md` with problem and proposed solution
57
+ - Add to Backlog with ADR reference
58
+ - Example: `| Add OAuth2 auth | High | See ADR-003 |`
59
+
60
+ 4. Confirm what was added
61
+
62
+ ### Mark as in progress: `/todo start <task>`
63
+
64
+ 1. Move task from Backlog to In Progress
65
+ 2. Add timestamp to Notes
66
+
67
+ ### Mark as done: `/todo done <task>`
68
+
69
+ 1. Move task from In Progress to Done
70
+ 2. Add completion date
71
+
72
+ ## Priority Guidelines
73
+
74
+ | Priority | When |
75
+ |----------|------|
76
+ | High | Blocking other work, urgent |
77
+ | Medium | Next planned work |
78
+ | Low | Nice to have, future idea |
79
+
80
+ ## Examples
81
+
82
+ ```
83
+ /todo
84
+ → In Progress: 2 tasks, Backlog: 5 tasks
85
+ [lists tables]
86
+
87
+ /todo Fix login timeout bug
88
+ → Added to Backlog: "Fix login timeout bug | Medium | |"
89
+
90
+ /todo Add caching layer
91
+ → Complex task - created ADR-004 in docs/ADR.md
92
+ → Added to Backlog: "Add caching layer | High | See ADR-004 |"
93
+
94
+ /todo start Fix login timeout bug
95
+ → Moved to In Progress
96
+
97
+ /todo done Fix login timeout bug
98
+ → Moved to Done (2024-02-03)
99
+ ```