@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,1037 @@
1
+ # GoTask Usage Guide for AI Agents
2
+
3
+ ## Purpose
4
+
5
+ This guide provides AI agents with best practices for working with GoTask (Task) task automation in operator repositories. Use this when creating, modifying, or executing tasks defined in Taskfile.yml.
6
+
7
+ ## Target Audience
8
+
9
+ AI agents (Claude Code, Cursor, Copilot, etc.) working with projects that use GoTask for task automation and build orchestration.
10
+
11
+ ## Core Principles
12
+
13
+ ### 1. Task Discovery First
14
+
15
+ Always check existing tasks before creating new ones:
16
+
17
+ ````bash
18
+ # List all available tasks
19
+ task --list
20
+
21
+ # View tasks in specific namespace
22
+ task gotask
23
+ task yaml
24
+ task claude
25
+ ```text
26
+
27
+ ### 2. Use Existing Utilities
28
+
29
+ The `task gotask` namespace provides utilities for task development:
30
+
31
+ **Task Development:**
32
+
33
+ - `task gotask:new:task` - Create new task interactively
34
+ - `task gotask:new:script` - Create TypeScript task script
35
+ - `task gotask:validate` - Validate Taskfile syntax
36
+ - `task gotask:format` - Format default task output
37
+
38
+ **Templates:**
39
+
40
+ - `task gotask:template:basic` - Basic task template
41
+ - `task gotask:template:build` - Build task template
42
+ - `task gotask:template:test` - Test task template
43
+
44
+ **Documentation:**
45
+
46
+ - `task gotask:docs:generate` - Generate documentation
47
+ - `task gotask:docs:view` - View best practices
48
+ - `task gotask:docs:edit` - Edit best practices
49
+
50
+ ### 3. Prefer Scripts Over Inline Commands
51
+
52
+ **❌ Bad - Complex bash in taskfile:**
53
+
54
+ ```yaml
55
+ tasks:
56
+ lint:
57
+ cmds:
58
+ - |
59
+ if command -v prettier &> /dev/null; then
60
+ FILES=$(find . -name "*.yml" -not -path "*/node_modules/*")
61
+ for file in $FILES; do
62
+ prettier --check "$file" || exit 1
63
+ done
64
+ else
65
+ echo "prettier not found"
66
+ exit 1
67
+ fi
68
+ ```text
69
+
70
+ **✅ Good - Delegate to TypeScript:**
71
+
72
+ ```yaml
73
+ tasks:
74
+ lint:
75
+ desc: 'Lint YAML files'
76
+ cmds:
77
+ - bun run ./src/tasks/yaml/lint.ts
78
+ env:
79
+ FILES: '{{.FILES | default "*.yml"}}'
80
+ ```text
81
+
82
+ ## Parameter Syntax Standards
83
+
84
+ ### Preferred: Shell-Style Parameters
85
+
86
+ **Long format (recommended):**
87
+
88
+ ```bash
89
+ task yaml:lint --files="*.yml"
90
+ task yaml:lint --linter=prettier
91
+ task build --target=production
92
+ ```text
93
+
94
+ **Short format (for aliases):**
95
+
96
+ ```bash
97
+ task yaml:lint -f="*.yml"
98
+ task yaml:lint -l=prettier
99
+ task build -t=production
100
+ ```text
101
+
102
+ **Positional (single parameter):**
103
+
104
+ ```bash
105
+ task yaml:lint -- *.yml
106
+ task test -- unit
107
+ ```text
108
+
109
+ ### Legacy: Environment Variable Style
110
+
111
+ **⚠️ Backward compatible but not preferred:**
112
+
113
+ ```bash
114
+ # Still works but avoid in new code
115
+ task yaml:lint FILES="*.yml"
116
+ task build TARGET=production
117
+ ```text
118
+
119
+ ### Implementation in Taskfile
120
+
121
+ Define parameters using GoTask variables:
122
+
123
+ ```yaml
124
+ tasks:
125
+ lint:
126
+ desc: 'Lint files with optional pattern'
127
+ vars:
128
+ PATTERN: '{{.files | default "*.yml"}}' # Map --files flag
129
+ LINTER: '{{.linter | default "auto"}}' # Map --linter flag
130
+ cmds:
131
+ - bun run ./scripts/lint.ts
132
+ env:
133
+ FILES: '{{.PATTERN}}'
134
+ LINTER: '{{.LINTER}}'
135
+ ```text
136
+
137
+ Usage:
138
+
139
+ ```bash
140
+ # Shell-style (preferred)
141
+ task lint --files="src/**/*.yml" --linter=prettier
142
+
143
+ # Legacy (supported)
144
+ task lint FILES="src/**/*.yml" LINTER=prettier
145
+ ```text
146
+
147
+ ## Task Structure Best Practices
148
+
149
+ ### 1. Namespace Organization
150
+
151
+ ```yaml
152
+ # Main Taskfile.yml
153
+ version: '3'
154
+
155
+ includes:
156
+ yaml:
157
+ taskfile: ./tasks/yaml.yml
158
+ dir: .
159
+
160
+ claude:
161
+ taskfile: ./tasks/claude.yml
162
+ dir: .
163
+
164
+ gotask:
165
+ taskfile: ./tasks/gotask.yml
166
+ dir: .
167
+ ```text
168
+
169
+ ### 2. Task Definition Pattern
170
+
171
+ ```yaml
172
+ version: '3'
173
+
174
+ vars:
175
+ DEFAULT_PATTERN: "*.yml,*.yaml"
176
+
177
+ tasks:
178
+ default:
179
+ desc: 'Show available tasks'
180
+ aliases: [help, h]
181
+ silent: true
182
+ cmds:
183
+ - |
184
+ echo "Task Category Name"
185
+ echo "Command Alias Description"
186
+ echo "─────────────────────────────────────────────"
187
+ echo "task category:action a Description"
188
+
189
+ action:
190
+ desc: 'Task description'
191
+ aliases: [a]
192
+ silent: true
193
+ vars:
194
+ PARAM: '{{.param | default .DEFAULT_PATTERN}}'
195
+ cmds:
196
+ - bun run ./src/tasks/category/action.ts
197
+ env:
198
+ PARAMETER_NAME: '{{.PARAM}}'
199
+ ```text
200
+
201
+ ### 3. Default Task Help
202
+
203
+ Every task file should have a `default` task showing available commands:
204
+
205
+ ```yaml
206
+ tasks:
207
+ default:
208
+ desc: 'Show available YAML tasks'
209
+ aliases: [help, h]
210
+ silent: true
211
+ cmds:
212
+ - |
213
+ # Use color codes for better readability
214
+ GREEN='\033[0;32m'
215
+ YELLOW='\033[0;33m'
216
+ BOLD='\033[1m'
217
+ NC='\033[0m'
218
+
219
+ echo -e "${BOLD}Category Name${NC}"
220
+ echo ""
221
+ echo -e "Command Alias Description"
222
+ echo "─────────────────────────────────────────────"
223
+ echo -e "${GREEN}task cat:action${NC} ${YELLOW}a${NC} Do something"
224
+ ```text
225
+
226
+ ## Table Formatting with Colors
227
+
228
+ ### The Challenge
229
+
230
+ Creating aligned tables with ANSI color codes is challenging because:
231
+
232
+ 1. **`printf` with width specifiers** counts escape sequences as part of string length
233
+ 2. **`column -t`** doesn't understand ANSI codes and escapes them
234
+ 3. Manual spacing with `echo -e` is fragile and breaks easily
235
+
236
+ ### Recommended Solution: Manual Spacing with `echo -e`
237
+
238
+ Use `echo -e` with careful manual spacing. This is the **only reliable method** that preserves colors.
239
+
240
+ **Example:**
241
+
242
+ ```yaml
243
+ tasks:
244
+ default:
245
+ desc: 'Show available tasks'
246
+ silent: true
247
+ cmds:
248
+ - |
249
+ GREEN='\033[0;32m'
250
+ YELLOW='\033[0;33m'
251
+ BLUE='\033[0;34m'
252
+ BOLD='\033[1m'
253
+ NC='\033[0m'
254
+
255
+ echo -e "${BOLD}Project Name${NC}"
256
+ echo ""
257
+ echo "Command Alias Description Examples"
258
+ echo "───────────────────────────────────────────────────────────────────────────────────────────────────"
259
+ echo -e "${BOLD}Core Tasks:${NC}"
260
+ echo -e " ${GREEN}task build${NC} ${YELLOW}b${NC} Build the project"
261
+ echo -e " ${GREEN}task test${NC} ${YELLOW}t${NC} Run tests"
262
+ echo -e " ${GREEN}task lint${NC} ${YELLOW}l${NC} Run linter FILES=\"...\""
263
+ ```text
264
+
265
+ ### Column Spacing Guidelines
266
+
267
+ **Standard column widths:**
268
+
269
+ - **Command**: ~35 characters (including indentation)
270
+ - **Alias**: ~10 characters
271
+ - **Description**: ~40 characters
272
+ - **Examples**: Flexible (remaining space)
273
+
274
+ **Tips:**
275
+
276
+ 1. **Use a monospaced font** when editing to visually align columns
277
+ 2. **Count visible characters only** (ignore ANSI escape codes mentally)
278
+ 3. **Test with `task`** - run the task to see actual output
279
+ 4. **Remove empty examples** - Don't use `--` or placeholders for commands without examples
280
+ 5. **Abbreviate long examples** - Use `"..."` for path patterns instead of full paths
281
+
282
+ **Example spacing breakdown:**
283
+
284
+ ```bash
285
+ # Each section is aligned by counting visible characters
286
+ # Command (35 chars) Alias(10) Description (40 chars) Examples
287
+ echo -e " ${GREEN}task build${NC} ${YELLOW}b${NC} Build the project"
288
+ # ^^indentation
289
+ # ^^^^ ^^^^^ = task build (10 chars)
290
+ # ^^^^^^^^^^^^^^^ = spaces to reach column 2 (35 - 10 - 2 indent = 23 spaces)
291
+ # ^ = b (1 char)
292
+ # ^^^^^^^^^ = spaces to reach column 3 (10 - 1 = 9 spaces)
293
+ # ^^^^^^^^^^^^^^^^^^^ = description text
294
+ ```text
295
+
296
+ ### What NOT to Do
297
+
298
+ **❌ Using `column -t` with colors:**
299
+
300
+ ```yaml
301
+ # This BREAKS colors - escape codes are treated as text
302
+ {
303
+ printf "%s|%s|%s\n" "${GREEN}task build${NC}" "${YELLOW}b${NC}" "Build"
304
+ } | column -t -s '|'
305
+ # Output: \033[0;32mtask build\033[0m \033[0;33mb\033[0m Build
306
+ ```text
307
+
308
+ **❌ Using `printf` with width specifiers:**
309
+
310
+ ```yaml
311
+ # This BREAKS alignment - counts escape codes in width
312
+ printf " %-35s %-10s %s\n" "${GREEN}task build${NC}" "${YELLOW}b${NC}" "Build"
313
+ # The color codes add ~20 characters, making alignment wrong
314
+ ```text
315
+
316
+ **✅ Correct approach:**
317
+
318
+ ```yaml
319
+ # Manual spacing with echo -e
320
+ echo -e " ${GREEN}task build${NC} ${YELLOW}b${NC} Build the project"
321
+ ```text
322
+
323
+ ### Testing Your Table
324
+
325
+ Always test by running the task:
326
+
327
+ ```bash
328
+ task category:help
329
+ # or
330
+ task category
331
+ ```text
332
+
333
+ Look for:
334
+
335
+ - Misaligned columns
336
+ - Color codes appearing as text (escape sequences visible)
337
+ - Inconsistent spacing between rows
338
+
339
+ ## Creating New Tasks
340
+
341
+ ### Option 1: Use Interactive Creator
342
+
343
+ ```bash
344
+ # Let the utility guide you
345
+ task gotask:new:task
346
+
347
+ # Creates task with proper structure
348
+ # Prompts for: name, description, aliases, commands
349
+ ```text
350
+
351
+ ### Option 2: Use Templates
352
+
353
+ ```bash
354
+ # Generate template and modify
355
+ task gotask:template:basic > tasks/new-category.yml
356
+
357
+ # Edit the generated template
358
+ # Include in main Taskfile.yml
359
+ ```text
360
+
361
+ ### Option 3: Manual Creation
362
+
363
+ Follow this checklist:
364
+
365
+ 1. **Create task file** - `tasks/category.yml`
366
+ 2. **Define structure** - version, vars, tasks
367
+ 3. **Add default task** - Help output with color codes
368
+ 4. **Define actions** - With descriptions and aliases
369
+ 5. **Delegate to scripts** - TypeScript in `src/tasks/category/`
370
+ 6. **Include in main** - Add to `Taskfile.yml` includes
371
+ 7. **Validate syntax** - `task gotask:validate`
372
+ 8. **Update docs** - Add section to `tasks/README.md`
373
+
374
+ ## TypeScript Task Scripts
375
+
376
+ ### Directory Structure
377
+
378
+ ```text
379
+ src/tasks/category/
380
+ ├── types.ts # Type definitions
381
+ ├── utils.ts # Helper functions
382
+ ├── action1.ts # Executable script
383
+ ├── action2.ts # Executable script
384
+ └── action3.ts # Executable script
385
+
386
+ tests/tasks/category/
387
+ ├── utils.test.ts # Unit tests
388
+ ├── action1.test.ts # Unit tests
389
+ └── integration.test.ts
390
+ ```text
391
+
392
+ ### Script Template
393
+
394
+ ```typescript
395
+ #!/usr/bin/env bun
396
+
397
+ /**
398
+ * Copyright (c) 2024-2025 Company Name
399
+ * All rights reserved.
400
+ */
401
+
402
+ import { execSync } from 'node:child_process';
403
+ import type { ResultType } from './types';
404
+ import { helperFunction } from './utils';
405
+
406
+ /**
407
+ * Main script function
408
+ */
409
+ function main(): void {
410
+ console.log('🔧 Starting action...\n');
411
+
412
+ // Get parameters from environment
413
+ const param = process.env.PARAM || 'default';
414
+
415
+ try {
416
+ // Implementation
417
+ const result = helperFunction(param);
418
+
419
+ console.log('✅ Action complete');
420
+ process.exit(0);
421
+ } catch (error) {
422
+ console.error('❌ Action failed:', error);
423
+ process.exit(1);
424
+ }
425
+ }
426
+
427
+ // Run if executed directly
428
+ if (import.meta.main) {
429
+ main();
430
+ }
431
+
432
+ export { main };
433
+ ```text
434
+
435
+ ## Clean Output Standards
436
+
437
+ ### Principle: Only Print What Changes
438
+
439
+ Tasks should follow a minimal output philosophy - only show information when something changes or when reporting final results. Avoid verbose progress messages, status updates, or unnecessary confirmations.
440
+
441
+ **Key rules:**
442
+
443
+ 1. **Silent on success** - If everything works as expected, don't print status messages
444
+ 2. **Show final result** - Print one line showing what happened and the outcome
445
+ 3. **Error to stderr** - All error messages go to stderr with `>&2`
446
+ 4. **Use color codes** - Green checkmark for success, red X for errors, yellow for warnings
447
+ 5. **Include URLs** - Make output actionable by including clickable links
448
+
449
+ ### Output Format Pattern
450
+
451
+ **Success format:**
452
+
453
+ ```bash
454
+ echo -e "${GREEN}✓${NC} Action: result/URL"
455
+ ```
456
+
457
+ **Error format:**
458
+
459
+ ```bash
460
+ echo -e "${RED}❌ Error description${NC}" >&2
461
+ exit 1
462
+ ```
463
+
464
+ **Warning format:**
465
+
466
+ ```bash
467
+ echo -e "${YELLOW}⚠${NC} Warning: fallback action"
468
+ ```
469
+
470
+ ### Examples
471
+
472
+ **❌ Bad - Verbose output:**
473
+
474
+ ```yaml
475
+ tasks:
476
+ pr:create:
477
+ cmds:
478
+ - |
479
+ echo "Starting PR creation process..."
480
+ echo "Getting current branch..."
481
+ BRANCH=$(git branch --show-current)
482
+ echo "Current branch: $BRANCH"
483
+
484
+ echo "Checking for existing PR..."
485
+ PR=$(gh pr list --head "$BRANCH" --json number -q '.[0].number')
486
+
487
+ if [ -n "$PR" ]; then
488
+ echo "Found existing PR #$PR"
489
+ echo "Updating PR title and body..."
490
+ gh pr edit "$PR" --title "$TITLE" --body "$BODY"
491
+ echo "PR updated successfully!"
492
+ echo "PR URL: https://github.com/owner/repo/pull/$PR"
493
+ fi
494
+ ```
495
+
496
+ Output:
497
+ ```
498
+ Starting PR creation process...
499
+ Getting current branch...
500
+ Current branch: feat/new-feature
501
+ Checking for existing PR...
502
+ Found existing PR #123
503
+ Updating PR title and body...
504
+ https://github.com/owner/repo/pull/123
505
+ PR updated successfully!
506
+ PR URL: https://github.com/owner/repo/pull/123
507
+ ```
508
+
509
+ **✅ Good - Clean output:**
510
+
511
+ ```yaml
512
+ tasks:
513
+ pr:create:
514
+ cmds:
515
+ - |
516
+ GREEN='\033[0;32m'
517
+ NC='\033[0m'
518
+
519
+ BRANCH=$(git branch --show-current)
520
+ PR=$(gh pr list --head "$BRANCH" --json number -q '.[0].number')
521
+
522
+ if [ -n "$PR" ]; then
523
+ gh pr edit "$PR" --title "$TITLE" --body "$BODY" &>/dev/null
524
+ PR_URL=$(gh pr view "$PR" --json url -q '.url')
525
+ echo -e "${GREEN}✓${NC} Updated: $PR_URL"
526
+ fi
527
+ ```
528
+
529
+ Output:
530
+ ```
531
+ ✓ Updated: https://github.com/owner/repo/pull/123
532
+ ```
533
+
534
+ ### Multi-Step Tasks
535
+
536
+ For tasks with multiple steps, show one status line per significant change:
537
+
538
+ **Example: PR creation with push**
539
+
540
+ ```yaml
541
+ tasks:
542
+ pr:create:
543
+ cmds:
544
+ - |
545
+ GREEN='\033[0;32m'
546
+ YELLOW='\033[0;33m'
547
+ NC='\033[0m'
548
+
549
+ # Extract title
550
+ TITLE=$(head -n1 .pr.local.md)
551
+ echo -e "${GREEN}✓${NC} Title: $TITLE"
552
+
553
+ # Push branch
554
+ if git push -u origin "$BRANCH" &>/dev/null; then
555
+ echo -e "${GREEN}✓${NC} Branch pushed to origin/$BRANCH"
556
+ else
557
+ echo -e "${YELLOW}⚠${NC} Git push failed (will use gh CLI)"
558
+ fi
559
+
560
+ # Create or update PR
561
+ if [ -n "$EXISTING_PR" ]; then
562
+ gh pr edit "$EXISTING_PR" --title "$TITLE" --body "$BODY" &>/dev/null
563
+ echo -e "${GREEN}✓${NC} Updated: $PR_URL"
564
+ else
565
+ PR_URL=$(gh pr create --title "$TITLE" --body "$BODY" --draft)
566
+ echo -e "${GREEN}✓${NC} Created: $PR_URL"
567
+ fi
568
+ ```
569
+
570
+ Output:
571
+ ```
572
+ ✓ Title: feat(cli): add new command
573
+ ✓ Branch pushed to origin/feat/new-command
574
+ ✓ Created: https://github.com/owner/repo/pull/124
575
+ ```
576
+
577
+ ### Suppressing Command Output
578
+
579
+ Use output redirection to hide verbose command output:
580
+
581
+ **Redirect stderr only:**
582
+
583
+ ```bash
584
+ git push -u origin "$BRANCH" 2>/dev/null
585
+ ```
586
+
587
+ **Redirect both stdout and stderr:**
588
+
589
+ ```bash
590
+ git push -u origin "$BRANCH" &>/dev/null
591
+ gh pr edit "$PR" --title "$TITLE" &>/dev/null
592
+ ```
593
+
594
+ **Capture output for conditional display:**
595
+
596
+ ```bash
597
+ OUTPUT=$(command 2>&1)
598
+ if [ $? -ne 0 ]; then
599
+ echo "$OUTPUT" >&2
600
+ exit 1
601
+ fi
602
+ ```
603
+
604
+ ### Color Code Standards
605
+
606
+ Define color codes at the start of each task:
607
+
608
+ ```bash
609
+ GREEN='\033[0;32m'
610
+ YELLOW='\033[0;33m'
611
+ RED='\033[0;31m'
612
+ CYAN='\033[0;36m'
613
+ BOLD='\033[1m'
614
+ NC='\033[0m' # No Color
615
+ ```
616
+
617
+ **Usage:**
618
+
619
+ - `GREEN` - Success messages, checkmarks
620
+ - `RED` - Errors, failures
621
+ - `YELLOW` - Warnings, fallback actions
622
+ - `CYAN` - Informational (use sparingly)
623
+ - `BOLD` - Headers (help menus only)
624
+
625
+ ### Error Messages
626
+
627
+ Error messages should be:
628
+
629
+ 1. **Specific** - Say exactly what went wrong
630
+ 2. **Actionable** - Suggest how to fix it
631
+ 3. **Concise** - One or two lines maximum
632
+
633
+ **Example:**
634
+
635
+ ```bash
636
+ if [ -z "$GITHUB_TOKEN" ]; then
637
+ echo -e "${RED}❌ GitHub token not found${NC}" >&2
638
+ echo "Set GITHUB_TOKEN in .env" >&2
639
+ exit 1
640
+ fi
641
+ ```
642
+
643
+ ### Summary Output
644
+
645
+ For tasks that retrieve or process data, show a single summary line:
646
+
647
+ **❌ Bad:**
648
+
649
+ ```bash
650
+ echo "Comments retrieved successfully!"
651
+ echo ""
652
+ echo "Summary:"
653
+ echo " General comments: 5"
654
+ echo " Code review comments: 12"
655
+ echo " Reviews: 3"
656
+ echo " Total: 20"
657
+ echo ""
658
+ echo "Log saved to: /path/to/log.txt"
659
+ echo ""
660
+ echo "View with: cat /path/to/log.txt"
661
+ ```
662
+
663
+ **✅ Good:**
664
+
665
+ ```bash
666
+ echo -e "${GREEN}✓${NC} Retrieved 20 comments for PR #123 → /path/to/log.txt"
667
+ ```
668
+
669
+ ## Common Patterns
670
+
671
+ ### 1. File Pattern Discovery
672
+
673
+ ```typescript
674
+ // src/tasks/category/utils.ts
675
+ export function discoverFiles(patterns: string[]): string[] {
676
+ const files = new Set<string>();
677
+
678
+ for (const pattern of patterns) {
679
+ if (pattern.includes('**')) {
680
+ // Recursive glob
681
+ const found = findFilesRecursive(baseDir, filename);
682
+ found.forEach(f => files.add(f));
683
+ } else {
684
+ // Simple pattern via shell
685
+ const matched = execSync('ls ' + pattern, {
686
+ encoding: 'utf-8',
687
+ shell: '/bin/bash'
688
+ }).trim().split('\n');
689
+ matched.forEach(f => files.add(f));
690
+ }
691
+ }
692
+
693
+ return Array.from(files).sort();
694
+ }
695
+ ```text
696
+
697
+ ### 2. Tool Detection
698
+
699
+ ```typescript
700
+ // src/tasks/category/utils.ts
701
+ export function commandExists(command: string): boolean {
702
+ try {
703
+ execSync('command -v ' + command, { stdio: 'pipe' });
704
+ return true;
705
+ } catch {
706
+ return false;
707
+ }
708
+ }
709
+
710
+ export function detectTools() {
711
+ return {
712
+ tool1: commandExists('tool1'),
713
+ tool2: commandExists('tool2'),
714
+ npm: commandExists('npm'),
715
+ };
716
+ }
717
+ ```text
718
+
719
+ ### 3. Environment Variable Handling
720
+
721
+ ```typescript
722
+ // Get from environment with defaults
723
+ const pattern = process.env.FILES || '*.yml,*.yaml';
724
+ const linter = process.env.LINTER || 'auto';
725
+
726
+ // Parse patterns
727
+ const patterns = pattern.split(',').map(p => p.trim());
728
+ ```text
729
+
730
+ ### 4. Exit Codes
731
+
732
+ ```typescript
733
+ // Success
734
+ process.exit(0);
735
+
736
+ // Failure
737
+ process.exit(1);
738
+
739
+ // Usage error
740
+ process.exit(2);
741
+ ```text
742
+
743
+ ### 5. Quiet Output on Success
744
+
745
+ **Best Practice**: Tasks should be quiet when no issues are found and provide a `VERBOSE` flag for detailed output.
746
+
747
+ ```typescript
748
+ // src/tasks/category/action.ts
749
+ function main(): void {
750
+ const verbose = process.env.VERBOSE === 'true' || process.env.VERBOSE === '1';
751
+
752
+ if (verbose) {
753
+ console.log('🔧 Starting action...\n');
754
+ }
755
+
756
+ // Perform checks
757
+ const result = performAction();
758
+
759
+ // Only output when there are issues OR in verbose mode
760
+ if (!result.success) {
761
+ console.log('❌ Action failed:\n');
762
+ result.errors.forEach(err => console.log(' ' + err));
763
+ process.exit(1);
764
+ } else {
765
+ if (verbose) {
766
+ console.log('✅ Action completed successfully');
767
+ }
768
+ process.exit(0);
769
+ }
770
+ }
771
+ ```text
772
+
773
+ **Taskfile Configuration**:
774
+
775
+ ```yaml
776
+ tasks:
777
+ action:
778
+ desc: 'Perform action (quiet on success, use VERBOSE=1 for details)'
779
+ vars:
780
+ VERBOSE_FLAG: '{{.VERBOSE | default ""}}'
781
+ cmds:
782
+ - bun run ./src/tasks/category/action.ts
783
+ env:
784
+ VERBOSE: '{{.VERBOSE_FLAG}}'
785
+ ```text
786
+
787
+ **Usage**:
788
+
789
+ ```bash
790
+ task category:action # Quiet on success
791
+ VERBOSE=1 task category:action # Show all output
792
+ ```text
793
+
794
+ **Why**: This pattern reduces noise in CI/CD pipelines and local development while still allowing detailed output when needed for debugging.
795
+
796
+ ## Validation and Testing
797
+
798
+ ### Before Committing
799
+
800
+ ```bash
801
+ # Validate Taskfile syntax
802
+ task gotask:validate
803
+
804
+ # Run affected tests
805
+ bun test tests/tasks/category/
806
+
807
+ # Check task works
808
+ task category:action -- test-value
809
+ ```text
810
+
811
+ ### Test Structure
812
+
813
+ ```typescript
814
+ import { describe, expect, it, mock } from 'bun:test';
815
+ import { helperFunction } from '../../../src/tasks/category/utils';
816
+
817
+ describe('category utils', () => {
818
+ it('should process input correctly', () => {
819
+ const result = helperFunction('input');
820
+ expect(result).toBeDefined();
821
+ });
822
+ });
823
+ ```text
824
+
825
+ ## Documentation Requirements
826
+
827
+ ### 1. Task File Comments
828
+
829
+ ```yaml
830
+ # YAML Linting & Validation Tasks
831
+ # Provides YAML validation, linting, and auto-fixing for all YAML files.
832
+
833
+ version: '3'
834
+ ```text
835
+
836
+ ### 2. README.md Section
837
+
838
+ Add to `tasks/README.md`:
839
+
840
+ ```markdown
841
+ ### Category Name ([category.yml](category.yml))
842
+
843
+ Brief description of what this task category provides.
844
+
845
+ **Commands:**
846
+
847
+ | Task | Alias | Description |
848
+ | ----------------------- | ----- | ------------------------ |
849
+ | `task cat:action` | `a` | Do something |
850
+ | `task cat:other` | `o` | Do something else |
851
+
852
+ **Usage:**
853
+
854
+ \`\`\`bash
855
+ # Example command
856
+ task cat:action --param="value"
857
+
858
+ # With short alias
859
+ task cat:action -p="value"
860
+ \`\`\`
861
+ ```text
862
+
863
+ ### 3. JSDoc Comments
864
+
865
+ ```typescript
866
+ /**
867
+ * Process files matching pattern
868
+ *
869
+ * @param pattern - Glob pattern to match
870
+ * @param options - Processing options
871
+ * @returns Array of processed file paths
872
+ *
873
+ * @example
874
+ * ```typescript
875
+ * const files = processFiles('*.yml', { exclude: ['node_modules'] });
876
+ * ```
877
+ */
878
+ export function processFiles(
879
+ pattern: string,
880
+ options: ProcessOptions
881
+ ): string[] {
882
+ // Implementation
883
+ }
884
+ ```text
885
+
886
+ ## Troubleshooting
887
+
888
+ ### Task Not Found
889
+
890
+ ```bash
891
+ # Check if task exists
892
+ task --list | grep task-name
893
+
894
+ # Verify include in main Taskfile
895
+ grep "includes:" Taskfile.yml
896
+
897
+ # Check task file exists
898
+ ls tasks/category.yml
899
+ ```text
900
+
901
+ ### Script Not Executing
902
+
903
+ ```bash
904
+ # Check permissions
905
+ ls -la src/tasks/category/script.ts
906
+
907
+ # Make executable
908
+ chmod +x src/tasks/category/script.ts
909
+
910
+ # Run directly to see errors
911
+ bun run src/tasks/category/script.ts
912
+ ```text
913
+
914
+ ### Parameter Not Working
915
+
916
+ ```bash
917
+ # Check variable mapping in task
918
+ cat tasks/category.yml | grep -A5 "vars:"
919
+
920
+ # Try with quotes
921
+ task category:action --param="value with spaces"
922
+
923
+ # Check environment in script
924
+ bun run -e 'console.log(process.env)' src/tasks/category/script.ts
925
+ ```text
926
+
927
+ ## When to Use GoTask
928
+
929
+ ### ✅ Good Use Cases
930
+
931
+ - Build automation
932
+ - Development workflows
933
+ - CI/CD orchestration
934
+ - Linting and validation
935
+ - Testing pipelines
936
+ - Code generation
937
+ - Setup and initialization
938
+ - Multi-step processes
939
+
940
+ ### ❌ Not Recommended
941
+
942
+ - Runtime application logic
943
+ - Web servers (use proper frameworks)
944
+ - Database migrations (use dedicated tools)
945
+ - Complex business logic (use application code)
946
+
947
+ ## Integration with Other Tools
948
+
949
+ ### Git Hooks
950
+
951
+ ```yaml
952
+ tasks:
953
+ pre-commit:
954
+ desc: 'Run pre-commit checks'
955
+ cmds:
956
+ - task lint
957
+ - task typecheck
958
+ - task test
959
+ ```text
960
+
961
+ ### CI/CD
962
+
963
+ ```yaml
964
+ tasks:
965
+ ci:
966
+ desc: 'Run CI checks'
967
+ cmds:
968
+ - task lint
969
+ - task typecheck
970
+ - task test
971
+ - task build
972
+ - task semgrep
973
+ ```text
974
+
975
+ ### IDE Integration
976
+
977
+ Most IDEs can run GoTask tasks:
978
+
979
+ - VSCode: Install "Task" extension
980
+ - Cursor: Built-in terminal support
981
+ - IntelliJ: Configure as External Tool
982
+
983
+ ## Quick Reference
984
+
985
+ ### Essential Commands
986
+
987
+ ```bash
988
+ # List all tasks
989
+ task --list
990
+
991
+ # Run task
992
+ task category:action
993
+
994
+ # With parameters (preferred)
995
+ task category:action --param="value"
996
+
997
+ # Legacy style (supported)
998
+ task category:action PARAM="value"
999
+
1000
+ # View task help
1001
+ task category
1002
+
1003
+ # Validate taskfiles
1004
+ task gotask:validate
1005
+
1006
+ # Create new task
1007
+ task gotask:new:task
1008
+ ```text
1009
+
1010
+ ### File Locations
1011
+
1012
+ ```text
1013
+ Taskfile.yml # Main task runner
1014
+ tasks/ # Task definitions
1015
+ category.yml # Category-specific tasks
1016
+ README.md # Task documentation
1017
+ src/tasks/ # TypeScript implementations
1018
+ category/ # Category scripts
1019
+ types.ts
1020
+ utils.ts
1021
+ action.ts
1022
+ tests/tasks/ # Unit tests
1023
+ category/
1024
+ utils.test.ts
1025
+ ```text
1026
+
1027
+ ## Related Documentation
1028
+
1029
+ - [tasks/README.md](../../tasks/README.md) - Complete task library reference
1030
+ - [docs/guides/agents.markdown.md](./agents.markdown.md) - Markdown formatting standards
1031
+ - [CLAUDE.md](../../CLAUDE.md) - Project instructions for Claude Code
1032
+ - [GoTask Documentation](https://taskfile.dev) - Official GoTask docs
1033
+
1034
+ ---
1035
+
1036
+ **For AI Agents:** Use this guide when working with GoTask tasks. Always check existing tasks before creating new ones, delegate complex logic to TypeScript, and follow the parameter syntax standards. Use `task gotask` utilities to streamline task development.
1037
+ ````