devflow-kit 0.3.2 → 0.4.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/README.md +47 -13
  3. package/dist/commands/init.d.ts.map +1 -1
  4. package/dist/commands/init.js +72 -31
  5. package/dist/commands/init.js.map +1 -1
  6. package/dist/commands/uninstall.d.ts.map +1 -1
  7. package/dist/commands/uninstall.js +17 -28
  8. package/dist/commands/uninstall.js.map +1 -1
  9. package/package.json +1 -1
  10. package/src/claude/CLAUDE.md +76 -8
  11. package/src/claude/agents/devflow/audit-architecture.md +67 -1
  12. package/src/claude/agents/devflow/audit-complexity.md +67 -1
  13. package/src/claude/agents/devflow/audit-database.md +67 -1
  14. package/src/claude/agents/devflow/audit-dependencies.md +67 -1
  15. package/src/claude/agents/devflow/audit-documentation.md +66 -0
  16. package/src/claude/agents/devflow/audit-performance.md +67 -1
  17. package/src/claude/agents/devflow/audit-security.md +67 -1
  18. package/src/claude/agents/devflow/audit-tests.md +67 -1
  19. package/src/claude/agents/devflow/audit-typescript.md +66 -0
  20. package/src/claude/agents/devflow/debug.md +475 -0
  21. package/src/claude/agents/devflow/project-state.md +419 -0
  22. package/src/claude/agents/devflow/release.md +283 -8
  23. package/src/claude/commands/devflow/code-review.md +51 -12
  24. package/src/claude/commands/devflow/debug.md +29 -201
  25. package/src/claude/commands/devflow/devlog.md +211 -172
  26. package/src/claude/commands/devflow/implement.md +507 -0
  27. package/src/claude/skills/devflow/code-smell/SKILL.md +428 -0
  28. package/src/claude/skills/devflow/debug/SKILL.md +119 -0
  29. package/src/claude/skills/devflow/error-handling/SKILL.md +597 -0
  30. package/src/claude/skills/devflow/input-validation/SKILL.md +514 -0
  31. package/src/claude/skills/devflow/pattern-check/SKILL.md +238 -0
  32. package/src/claude/skills/devflow/research/SKILL.md +135 -0
  33. package/src/claude/skills/devflow/test-design/SKILL.md +384 -0
@@ -760,9 +760,266 @@ fi
760
760
  echo ""
761
761
  ```
762
762
 
763
- ## Step 13: Final Summary
763
+ ## Step 13: Save Release Notes
764
764
 
765
- Provide release summary:
765
+ Save comprehensive release notes to `.docs/releases/`:
766
+
767
+ ```bash
768
+ # Create releases directory if it doesn't exist
769
+ mkdir -p .docs/releases
770
+
771
+ # Get current date
772
+ RELEASE_DATE=$(date +%Y-%m-%d)
773
+
774
+ # Generate release notes file
775
+ RELEASE_NOTES_FILE=".docs/releases/RELEASE_NOTES_v${NEW_VERSION}.md"
776
+
777
+ # Write comprehensive release notes
778
+ cat > "$RELEASE_NOTES_FILE" <<EOF
779
+ # Release ${NEW_VERSION}
780
+
781
+ **Release Date:** ${RELEASE_DATE}
782
+ **Previous Version:** ${CURRENT_VERSION}
783
+ **Project Type:** ${PROJECT_TYPE}
784
+
785
+ ---
786
+
787
+ ## Release Summary
788
+
789
+ - **Version bump:** ${CURRENT_VERSION} → ${NEW_VERSION}
790
+ - **Commits included:** $(git rev-list --count $COMMIT_RANGE 2>/dev/null || echo "N/A")
791
+ - **Release type:** ${BUMP_TYPE}
792
+ - **Tag:** ${TAG_NAME}
793
+
794
+ ---
795
+
796
+ ## Changes
797
+
798
+ $(cat <<'CHANGES_EOF'
799
+ ${CHANGELOG_ENTRY}
800
+ CHANGES_EOF
801
+ )
802
+
803
+ ---
804
+
805
+ ## Commit History
806
+
807
+ \`\`\`
808
+ $(git log --oneline $COMMIT_RANGE 2>/dev/null || echo "No commits to display")
809
+ \`\`\`
810
+
811
+ ---
812
+
813
+ ## Build & Test Results
814
+
815
+ - **Build:** ${BUILD_RESULT:-N/A}
816
+ - **Tests:** ${TEST_RESULT:-N/A}
817
+
818
+ ---
819
+
820
+ ## Distribution
821
+
822
+ EOF
823
+
824
+ # Add registry links based on project type
825
+ if [ -n "$PUBLISH_CMD" ] && [ "$PUBLISH_CMD" != "echo"* ]; then
826
+ echo "**Published to:**" >> "$RELEASE_NOTES_FILE"
827
+ case "$PROJECT_TYPE" in
828
+ nodejs)
829
+ PACKAGE_NAME=$(command -v jq >/dev/null && jq -r '.name' package.json 2>/dev/null || echo "unknown")
830
+ echo "- npm: https://www.npmjs.com/package/${PACKAGE_NAME}/v/${NEW_VERSION}" >> "$RELEASE_NOTES_FILE"
831
+ ;;
832
+ rust)
833
+ CRATE_NAME=$(grep '^name = ' Cargo.toml | head -1 | sed 's/name = "\(.*\)"/\1/')
834
+ echo "- crates.io: https://crates.io/crates/${CRATE_NAME}/${NEW_VERSION}" >> "$RELEASE_NOTES_FILE"
835
+ ;;
836
+ python)
837
+ PACKAGE_NAME=$(grep '^name = ' pyproject.toml | head -1 | sed 's/name = "\(.*\)"/\1/' || echo "unknown")
838
+ echo "- PyPI: https://pypi.org/project/${PACKAGE_NAME}/${NEW_VERSION}/" >> "$RELEASE_NOTES_FILE"
839
+ ;;
840
+ ruby)
841
+ GEM_NAME=$(ls *.gemspec 2>/dev/null | head -1 | sed 's/\.gemspec$//')
842
+ echo "- RubyGems: https://rubygems.org/gems/${GEM_NAME}/versions/${NEW_VERSION}" >> "$RELEASE_NOTES_FILE"
843
+ ;;
844
+ *) echo "- Package registry (check project documentation)" >> "$RELEASE_NOTES_FILE" ;;
845
+ esac
846
+ echo "" >> "$RELEASE_NOTES_FILE"
847
+ fi
848
+
849
+ # Add Git platform links
850
+ if command -v gh >/dev/null && git remote get-url origin 2>/dev/null | grep -q "github.com"; then
851
+ REPO_URL=$(git remote get-url origin | sed 's/\.git$//')
852
+ cat >> "$RELEASE_NOTES_FILE" <<EOF
853
+
854
+ **Git Repository:**
855
+ - Release: ${REPO_URL}/releases/tag/${TAG_NAME}
856
+ - Commits: ${REPO_URL}/compare/${LAST_TAG}...${TAG_NAME}
857
+ - Changelog: ${REPO_URL}/blob/main/${CHANGELOG_FILE}
858
+
859
+ EOF
860
+ fi
861
+
862
+ # Add verification steps
863
+ cat >> "$RELEASE_NOTES_FILE" <<'EOF'
864
+
865
+ ---
866
+
867
+ ## Verification Steps
868
+
869
+ 1. **Registry Check:** Verify package appears in registry (may take a few minutes)
870
+ 2. **Fresh Install:** Test installation in a clean environment
871
+ 3. **Smoke Tests:** Run basic functionality tests
872
+ 4. **Documentation:** Update any version-specific documentation
873
+
874
+ ---
875
+
876
+ *Release notes generated by DevFlow release agent*
877
+ EOF
878
+
879
+ echo ""
880
+ echo "✅ Release notes saved to: $RELEASE_NOTES_FILE"
881
+ echo ""
882
+ ```
883
+
884
+ ## Step 14: Verify Documentation Alignment
885
+
886
+ Check and update documentation files to ensure consistency:
887
+
888
+ ```bash
889
+ echo "📚 Verifying documentation alignment..."
890
+ echo ""
891
+
892
+ DOC_ISSUES=()
893
+
894
+ # Check if ROADMAP.md exists and needs updating
895
+ if [ -f "ROADMAP.md" ]; then
896
+ echo "Checking ROADMAP.md alignment..."
897
+
898
+ # Check if this release includes features that should be marked as completed
899
+ if echo "$CHANGELOG_ENTRY" | grep -qiE "(feat|feature|add|new)"; then
900
+ echo "⚠️ ROADMAP UPDATE NEEDED:"
901
+ echo " This release includes new features."
902
+ echo " Review ROADMAP.md and mark completed items."
903
+ echo " File: ROADMAP.md"
904
+ echo ""
905
+ DOC_ISSUES+=("ROADMAP.md needs review for completed features")
906
+ fi
907
+
908
+ # Check if roadmap references old version
909
+ if grep -q "$CURRENT_VERSION" ROADMAP.md 2>/dev/null; then
910
+ echo "⚠️ ROADMAP VERSION REFERENCE:"
911
+ echo " ROADMAP.md references old version $CURRENT_VERSION"
912
+ echo " Consider updating version references to $NEW_VERSION"
913
+ echo ""
914
+ DOC_ISSUES+=("ROADMAP.md has old version references")
915
+ fi
916
+ fi
917
+
918
+ # Check for README.md files in subpackages (monorepo support)
919
+ echo "Checking README.md files..."
920
+
921
+ # Find all README.md files (excluding node_modules, .git, etc.)
922
+ READMES=$(find . -name "README.md" -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/dist/*" -not -path "*/build/*" 2>/dev/null)
923
+
924
+ if [ $(echo "$READMES" | wc -l) -gt 1 ]; then
925
+ echo "Found multiple README.md files (monorepo detected)"
926
+
927
+ # Check each README for version references
928
+ for readme in $READMES; do
929
+ if grep -q "$CURRENT_VERSION" "$readme" 2>/dev/null; then
930
+ echo "⚠️ VERSION MISMATCH: $readme"
931
+ echo " Contains old version reference: $CURRENT_VERSION"
932
+ echo " Should be updated to: $NEW_VERSION"
933
+ echo ""
934
+ DOC_ISSUES+=("$readme has old version reference")
935
+ fi
936
+ done
937
+
938
+ # Check for installation instructions consistency
939
+ MAIN_README="./README.md"
940
+ if [ -f "$MAIN_README" ]; then
941
+ MAIN_INSTALL=$(grep -A 3 "Installation\|Install\|Getting Started" "$MAIN_README" 2>/dev/null | head -5)
942
+
943
+ for readme in $READMES; do
944
+ if [ "$readme" != "$MAIN_README" ]; then
945
+ SUB_INSTALL=$(grep -A 3 "Installation\|Install\|Getting Started" "$readme" 2>/dev/null | head -5)
946
+
947
+ # Simple check if installation sections differ significantly
948
+ if [ -n "$MAIN_INSTALL" ] && [ -n "$SUB_INSTALL" ]; then
949
+ if ! echo "$SUB_INSTALL" | grep -qF "$(echo "$MAIN_INSTALL" | head -1)"; then
950
+ echo "⚠️ INSTALLATION INCONSISTENCY:"
951
+ echo " $readme has different installation instructions"
952
+ echo " than main README.md"
953
+ echo ""
954
+ DOC_ISSUES+=("$readme installation instructions differ from main README")
955
+ fi
956
+ fi
957
+ fi
958
+ done
959
+ fi
960
+ fi
961
+
962
+ # Verify CHANGELOG.md is up to date
963
+ if [ -f "$CHANGELOG_FILE" ]; then
964
+ if ! grep -q "## \[${NEW_VERSION}\]" "$CHANGELOG_FILE" 2>/dev/null; then
965
+ echo "❌ CHANGELOG MISSING NEW VERSION:"
966
+ echo " $CHANGELOG_FILE does not contain entry for $NEW_VERSION"
967
+ echo " This should have been added in Step 5"
968
+ echo ""
969
+ DOC_ISSUES+=("CHANGELOG missing $NEW_VERSION entry")
970
+ else
971
+ echo "✓ CHANGELOG contains $NEW_VERSION entry"
972
+ fi
973
+
974
+ # Check if changelog has link reference for new version
975
+ if ! grep -q "\[${NEW_VERSION}\].*http" "$CHANGELOG_FILE" 2>/dev/null; then
976
+ echo "⚠️ CHANGELOG LINK MISSING:"
977
+ echo " $CHANGELOG_FILE missing link reference for $NEW_VERSION"
978
+ echo " Add: [${NEW_VERSION}]: https://github.com/.../releases/tag/v${NEW_VERSION}"
979
+ echo ""
980
+ DOC_ISSUES+=("CHANGELOG missing link reference for $NEW_VERSION")
981
+ fi
982
+ fi
983
+
984
+ # Check for docs/ or documentation/ directories
985
+ for docs_dir in "docs" "documentation" ".docs"; do
986
+ if [ -d "$docs_dir" ]; then
987
+ echo "Checking $docs_dir/ for version references..."
988
+
989
+ # Look for markdown files with old version
990
+ OLD_VERSION_DOCS=$(grep -rl "$CURRENT_VERSION" "$docs_dir" 2>/dev/null | grep -E "\.(md|markdown|txt)$" || true)
991
+
992
+ if [ -n "$OLD_VERSION_DOCS" ]; then
993
+ echo "⚠️ DOCUMENTATION VERSION REFERENCES:"
994
+ echo "$OLD_VERSION_DOCS" | while read -r doc_file; do
995
+ echo " - $doc_file"
996
+ done
997
+ echo ""
998
+ DOC_ISSUES+=("Documentation files in $docs_dir/ have old version references")
999
+ fi
1000
+ fi
1001
+ done
1002
+
1003
+ # Summary of documentation issues
1004
+ echo ""
1005
+ if [ ${#DOC_ISSUES[@]} -eq 0 ]; then
1006
+ echo "✅ All documentation checks passed"
1007
+ else
1008
+ echo "⚠️ DOCUMENTATION ISSUES FOUND (${#DOC_ISSUES[@]}):"
1009
+ for issue in "${DOC_ISSUES[@]}"; do
1010
+ echo " - $issue"
1011
+ done
1012
+ echo ""
1013
+ echo "These issues should be addressed before announcing the release."
1014
+ echo "Run a search-and-replace for version references:"
1015
+ echo " find . -type f -name '*.md' -exec sed -i 's/$CURRENT_VERSION/$NEW_VERSION/g' {} +"
1016
+ echo ""
1017
+ fi
1018
+ ```
1019
+
1020
+ ## Step 15: Final Summary
1021
+
1022
+ Display release summary to console:
766
1023
 
767
1024
  ```bash
768
1025
  echo "========================================="
@@ -773,15 +1030,22 @@ echo "📊 RELEASE SUMMARY:"
773
1030
  echo "- Old version: $CURRENT_VERSION"
774
1031
  echo "- New version: $NEW_VERSION"
775
1032
  echo "- Project type: $PROJECT_TYPE"
776
- echo "- Commits included: $(git rev-list --count $COMMIT_RANGE)"
1033
+ echo "- Commits included: $(git rev-list --count $COMMIT_RANGE 2>/dev/null || echo "N/A")"
777
1034
  echo "- Tag: $TAG_NAME"
1035
+ echo "- Release notes: .docs/releases/RELEASE_NOTES_v${NEW_VERSION}.md"
778
1036
  echo ""
779
1037
 
780
1038
  if [ -n "$PUBLISH_CMD" ] && [ "$PUBLISH_CMD" != "echo"* ]; then
781
1039
  echo "📦 PUBLISHED TO:"
782
1040
  case "$PROJECT_TYPE" in
783
- nodejs) echo "- npm: https://www.npmjs.com/package/<package-name>" ;;
784
- rust) echo "- crates.io: https://crates.io/crates/<crate-name>" ;;
1041
+ nodejs)
1042
+ PACKAGE_NAME=$(command -v jq >/dev/null && jq -r '.name' package.json 2>/dev/null || echo "package")
1043
+ echo "- npm: https://www.npmjs.com/package/${PACKAGE_NAME}"
1044
+ ;;
1045
+ rust)
1046
+ CRATE_NAME=$(grep '^name = ' Cargo.toml | head -1 | sed 's/name = "\(.*\)"/\1/')
1047
+ echo "- crates.io: https://crates.io/crates/${CRATE_NAME}"
1048
+ ;;
785
1049
  python) echo "- PyPI: https://pypi.org/project/<package-name>" ;;
786
1050
  ruby) echo "- RubyGems: https://rubygems.org/gems/<gem-name>" ;;
787
1051
  php) echo "- Packagist: https://packagist.org/packages/<vendor>/<package>" ;;
@@ -790,20 +1054,27 @@ if [ -n "$PUBLISH_CMD" ] && [ "$PUBLISH_CMD" != "echo"* ]; then
790
1054
  echo ""
791
1055
  fi
792
1056
 
793
- if command -v gh >/dev/null && git remote get-url origin | grep -q "github.com"; then
1057
+ if command -v gh >/dev/null && git remote get-url origin 2>/dev/null | grep -q "github.com"; then
794
1058
  REPO_URL=$(git remote get-url origin | sed 's/\.git$//')
795
1059
  echo "🔗 LINKS:"
796
1060
  echo "- Release: $REPO_URL/releases/tag/$TAG_NAME"
797
1061
  echo "- Commits: $REPO_URL/compare/$LAST_TAG...$TAG_NAME"
798
1062
  echo "- Changelog: $REPO_URL/blob/main/$CHANGELOG_FILE"
1063
+ echo "- Release Notes: $REPO_URL/blob/main/.docs/releases/RELEASE_NOTES_v${NEW_VERSION}.md"
799
1064
  fi
800
1065
 
801
1066
  echo ""
802
1067
  echo "✅ NEXT STEPS:"
803
1068
  echo "1. Verify package appears in registry (may take a few minutes)"
804
1069
  echo "2. Test installation in a fresh environment"
805
- echo "3. Announce release to users/team"
806
- echo "4. Update documentation if needed"
1070
+ if [ ${#DOC_ISSUES[@]} -gt 0 ]; then
1071
+ echo "3. ⚠️ Address documentation issues (${#DOC_ISSUES[@]} found)"
1072
+ echo "4. Announce release to users/team"
1073
+ echo "5. Review release notes: .docs/releases/RELEASE_NOTES_v${NEW_VERSION}.md"
1074
+ else
1075
+ echo "3. Announce release to users/team"
1076
+ echo "4. Review release notes: .docs/releases/RELEASE_NOTES_v${NEW_VERSION}.md"
1077
+ fi
807
1078
  echo ""
808
1079
  ```
809
1080
 
@@ -858,5 +1129,9 @@ Before declaring release complete:
858
1129
  - [ ] Tag created and pushed
859
1130
  - [ ] Package published (if applicable)
860
1131
  - [ ] Platform release created (if applicable)
1132
+ - [ ] Release notes saved to `.docs/releases/RELEASE_NOTES_v<version>.md`
1133
+ - [ ] Documentation alignment verified (ROADMAP, READMEs, docs/)
1134
+ - [ ] Version references updated across all documentation
1135
+ - [ ] No installation instruction inconsistencies in subpackages
861
1136
 
862
1137
  This ensures every release is professional, consistent, and safe across any programming language or ecosystem.
@@ -70,24 +70,46 @@ else
70
70
  INCLUDE_DB_AUDIT=false
71
71
  fi
72
72
  echo ""
73
+
74
+ # Set up audit directory structure
75
+ TIMESTAMP=$(date +%Y-%m-%d_%H%M)
76
+ AUDIT_BASE_DIR=".docs/audits/${CURRENT_BRANCH}"
77
+ mkdir -p "$AUDIT_BASE_DIR"
78
+
79
+ echo "📁 Audit reports will be saved to: $AUDIT_BASE_DIR"
80
+ echo ""
73
81
  ```
74
82
 
75
83
  ### Step 3: Launch Specialized Sub-Agents in Parallel
76
84
 
77
- Launch these sub-agents in parallel based on change detection:
85
+ Launch these sub-agents in parallel based on change detection.
86
+
87
+ **IMPORTANT**: Pass the following variables to each sub-agent:
88
+ - `CURRENT_BRANCH`: The branch being reviewed
89
+ - `AUDIT_BASE_DIR`: Base directory for audit reports (`.docs/audits/${CURRENT_BRANCH}`)
90
+ - `TIMESTAMP`: Current timestamp for report filenames
91
+
92
+ Each sub-agent should save its report to:
93
+ ```
94
+ ${AUDIT_BASE_DIR}/<audit-type>-report.${TIMESTAMP}.md
95
+ ```
96
+
97
+ **Example paths**:
98
+ - `.docs/audits/feature-auth/security-report.2025-10-18_1430.md`
99
+ - `.docs/audits/feature-auth/performance-report.2025-10-18_1430.md`
78
100
 
79
101
  **Core Audits (Always Run)**:
80
- 1. audit-security sub-agent
81
- 2. audit-performance sub-agent
82
- 3. audit-architecture sub-agent
83
- 4. audit-tests sub-agent
84
- 5. audit-complexity sub-agent
85
- 6. audit-dependencies sub-agent
86
- 7. audit-documentation sub-agent
102
+ 1. audit-security sub-agent → `${AUDIT_BASE_DIR}/security-report.${TIMESTAMP}.md`
103
+ 2. audit-performance sub-agent → `${AUDIT_BASE_DIR}/performance-report.${TIMESTAMP}.md`
104
+ 3. audit-architecture sub-agent → `${AUDIT_BASE_DIR}/architecture-report.${TIMESTAMP}.md`
105
+ 4. audit-tests sub-agent → `${AUDIT_BASE_DIR}/tests-report.${TIMESTAMP}.md`
106
+ 5. audit-complexity sub-agent → `${AUDIT_BASE_DIR}/complexity-report.${TIMESTAMP}.md`
107
+ 6. audit-dependencies sub-agent → `${AUDIT_BASE_DIR}/dependencies-report.${TIMESTAMP}.md`
108
+ 7. audit-documentation sub-agent → `${AUDIT_BASE_DIR}/documentation-report.${TIMESTAMP}.md`
87
109
 
88
110
  **Conditional Audits** (automatically detect and skip if not applicable):
89
- 8. audit-typescript sub-agent (only if .ts/.tsx files changed or tsconfig.json exists)
90
- 9. audit-database sub-agent (only if database changes detected)
111
+ 8. audit-typescript sub-agent `${AUDIT_BASE_DIR}/typescript-report.${TIMESTAMP}.md`
112
+ 9. audit-database sub-agent `${AUDIT_BASE_DIR}/database-report.${TIMESTAMP}.md`
91
113
 
92
114
  ### Step 4: Synthesize Comprehensive Review
93
115
 
@@ -100,7 +122,13 @@ After all sub-agents complete their analysis:
100
122
 
101
123
  ### Step 5: Save Comprehensive Review Document
102
124
 
103
- Create a detailed review document at `.docs/reviews/branch-{BRANCH_NAME}-{YYYY-MM-DD_HHMM}.md`:
125
+ Create a detailed review document at `${AUDIT_BASE_DIR}/comprehensive-review.${TIMESTAMP}.md`:
126
+
127
+ ```bash
128
+ REVIEW_FILE="${AUDIT_BASE_DIR}/comprehensive-review.${TIMESTAMP}.md"
129
+ ```
130
+
131
+ **File structure**:
104
132
 
105
133
  ```markdown
106
134
  # Branch Review - {BRANCH_NAME}
@@ -333,7 +361,18 @@ Give the developer a clear, actionable summary:
333
361
  - {Easy fix 1} ({estimated time})
334
362
  - {Easy fix 2} ({estimated time})
335
363
 
336
- 📄 Full review: .docs/reviews/branch-{branch}-{timestamp}.md
364
+ 📄 Full review: ${AUDIT_BASE_DIR}/comprehensive-review.${TIMESTAMP}.md
365
+
366
+ 📁 Individual audit reports:
367
+ ${AUDIT_BASE_DIR}/security-report.${TIMESTAMP}.md
368
+ ${AUDIT_BASE_DIR}/performance-report.${TIMESTAMP}.md
369
+ ${AUDIT_BASE_DIR}/architecture-report.${TIMESTAMP}.md
370
+ ${AUDIT_BASE_DIR}/tests-report.${TIMESTAMP}.md
371
+ ${AUDIT_BASE_DIR}/complexity-report.${TIMESTAMP}.md
372
+ ${AUDIT_BASE_DIR}/dependencies-report.${TIMESTAMP}.md
373
+ ${AUDIT_BASE_DIR}/documentation-report.${TIMESTAMP}.md
374
+ (+ typescript-report.${TIMESTAMP}.md if applicable)
375
+ (+ database-report.${TIMESTAMP}.md if applicable)
337
376
 
338
377
  🔄 NEXT STEPS:
339
378
  1. Address blocking issues above
@@ -1,228 +1,56 @@
1
1
  ---
2
- allowed-tools: Bash, Read, Write, Edit, Grep, Glob, TodoWrite
2
+ allowed-tools: Task
3
3
  description: Systematic debugging workflow with issue tracking - use '/debug [issue description]'
4
4
  ---
5
5
 
6
6
  ## Your task
7
7
 
8
- Guide a systematic debugging session for the issue: `$ARGUMENTS`
8
+ Launch the `debug` sub-agent to conduct systematic debugging for: `$ARGUMENTS`
9
9
 
10
- If no arguments provided, prompt for issue description. Otherwise, use the provided description as the problem to debug.
10
+ If no arguments provided, prompt the user for the issue description.
11
11
 
12
- ### Step 1: Capture the Problem
12
+ ### Debugging Process
13
13
 
14
- ```bash
15
- # Create debug session tracking
16
- DEBUG_SESSION="debug-$(date +%Y%m%d-%H%M%S)"
17
- mkdir -p .docs/debug
14
+ The debug agent will:
18
15
 
19
- # Use provided arguments or default
20
- ISSUE_DESC="${ARGUMENTS:-No issue description provided}"
16
+ 1. **Capture the Problem** - Create debug session tracking with unique session ID
17
+ 2. **Document the Issue** - Create comprehensive debug log in `.docs/debug/`
18
+ 3. **Smart Investigation** - Detect issue type (error/performance/test/build) and adapt strategy
19
+ 4. **Generate Hypotheses** - Create targeted, testable hypotheses based on issue type
20
+ 5. **Systematic Testing** - Test each hypothesis methodically and document findings
21
+ 6. **Root Cause Analysis** - Identify precise root cause with file and line references
22
+ 7. **Implement Fix** - Design, implement, and verify the solution
23
+ 8. **Prevention Strategy** - Document how to prevent similar issues
24
+ 9. **Update Knowledge Base** - Add to searchable `.docs/debug/KNOWLEDGE_BASE.md`
21
25
 
22
- echo "=== DEBUG SESSION STARTED ==="
23
- echo "Session ID: $DEBUG_SESSION"
24
- echo "Issue: $ISSUE_DESC"
25
- echo "Branch: $(git branch --show-current)"
26
- echo "Time: $(date)"
27
- echo ""
28
- ```
29
-
30
- ### Step 2: Document the Issue
26
+ ### Next: Synthesize Results
31
27
 
32
- Create debug log at `.docs/debug/{DEBUG_SESSION}.md`:
28
+ After the sub-agent completes, present a concise summary to the user:
33
29
 
34
30
  ```markdown
35
- # Debug Session - {DEBUG_SESSION}
36
-
37
- ## Problem Statement
38
- **Issue**: $ARGUMENTS
39
- **Reported**: {timestamp}
40
- **Branch**: {current_branch}
41
-
42
- ## Expected vs Actual Behavior
43
- **Expected**: {What should happen - analyze from issue description}
44
- **Actual**: {What's happening instead}
45
-
46
- ## Error Details
47
- ```
48
- {If error message in $ARGUMENTS, extract and display}
49
- ```
50
-
51
- ## Initial Assessment
52
- {Quick analysis of the issue based on the description}
53
- ```
31
+ 🔍 DEBUG SESSION COMPLETE: $ARGUMENTS
54
32
 
55
- ### Step 3: Smart Investigation Based on Issue Type
56
-
57
- Analyze `$ARGUMENTS` to determine investigation strategy:
58
-
59
- ```bash
60
- # Parse issue type from arguments
61
- ISSUE_LOWER=$(echo "$ARGUMENTS" | tr '[:upper:]' '[:lower:]')
62
-
63
- # Determine investigation type
64
- if echo "$ISSUE_LOWER" | grep -q "error\|exception\|crash\|fail"; then
65
- echo "🔍 ERROR INVESTIGATION MODE"
66
- # Search for error patterns in logs
67
- find . -name "*.log" -type f -exec grep -l "ERROR\|EXCEPTION\|FAIL" {} \; 2>/dev/null | head -5
68
-
69
- # Check recent error outputs
70
- grep -r "ERROR\|Exception\|Failed" --include="*.log" --include="*.txt" . 2>/dev/null | tail -10
71
-
72
- elif echo "$ISSUE_LOWER" | grep -q "slow\|performance\|timeout\|lag"; then
73
- echo "⚡ PERFORMANCE INVESTIGATION MODE"
74
- # Look for performance bottlenecks
75
- echo "Checking for large files that might cause issues:"
76
- find . -type f -size +10M 2>/dev/null | head -5
77
-
78
- echo "Recent changes to critical paths:"
79
- git diff HEAD~5 --name-only | grep -E "\.(js|ts|py|go|rs)$" | head -10
80
-
81
- elif echo "$ISSUE_LOWER" | grep -q "test\|spec\|unit\|integration"; then
82
- echo "🧪 TEST FAILURE INVESTIGATION MODE"
83
- # Focus on test files and recent test changes
84
- echo "Recent test file changes:"
85
- git diff HEAD~5 --name-only | grep -E "(test|spec)\." | head -10
86
-
87
- # Run tests if possible
88
- npm test 2>&1 | tail -20 || echo "Test command not available"
89
-
90
- elif echo "$ISSUE_LOWER" | grep -q "build\|compile\|webpack\|bundle"; then
91
- echo "🔨 BUILD ISSUE INVESTIGATION MODE"
92
- # Check build configurations and recent changes
93
- echo "Build configuration files:"
94
- ls -la | grep -E "(webpack|rollup|vite|tsconfig|babel|eslint)"
95
-
96
- echo "Recent config changes:"
97
- git diff HEAD~5 --name-only | grep -E "\.(json|config\.|rc)" | head -10
98
-
99
- else
100
- echo "🔍 GENERAL INVESTIGATION MODE"
101
- # General investigation for unspecified issues
102
- echo "Recent changes that might be related:"
103
- git log --oneline -10
104
- echo ""
105
- echo "Modified files (uncommitted):"
106
- git status --short
107
- fi
108
- ```
109
-
110
- ### Step 4: Generate Targeted Hypotheses
33
+ ## 🎯 ROOT CAUSE
34
+ {Precise description with file:line}
111
35
 
112
- Based on the issue type detected, use TodoWrite to create specific debugging tasks:
36
+ ## SOLUTION APPLIED
37
+ {Description of fix}
113
38
 
114
- ```markdown
115
- ## Debugging Tasks for: $ARGUMENTS
39
+ ## 📝 VERIFICATION
40
+ {Test results showing fix works}
116
41
 
117
- Based on the issue description, here are targeted hypotheses to investigate:
118
-
119
- - [ ] Check if issue is reproducible consistently
120
- - [ ] Verify issue occurs in clean environment
121
- - [ ] {Specific hypothesis based on issue type}
122
- - [ ] {Another specific hypothesis}
123
- - [ ] Review recent changes in related files
124
- ```
125
-
126
- ### Step 5: Interactive Debugging Process
127
-
128
- Guide through systematic testing of each hypothesis:
129
-
130
- ```bash
131
- echo "=== HYPOTHESIS TESTING ==="
132
- echo "Testing each hypothesis systematically..."
133
-
134
- # For each hypothesis, provide specific commands and checks
135
- # based on the issue type identified from $ARGUMENTS
136
- ```
137
-
138
- ### Step 6: Track Solution
139
-
140
- Once issue is identified and fixed:
141
-
142
- ```markdown
143
- ## Solution Found
144
-
145
- ### Root Cause
146
- {Identified from investigation}
147
-
148
- ### Fix Applied
149
- ```{language}
150
- {Code changes made}
151
- ```
152
-
153
- ### Verification
154
- - [ ] Issue no longer reproduces with: $ARGUMENTS
155
- - [ ] Related tests pass
156
- - [ ] No new issues introduced
157
-
158
- ### Prevention
42
+ ## 🛡️ PREVENTION
159
43
  {How to prevent similar issues}
160
44
 
161
- ### Time Analysis
162
- - Detection to Fix: {time}
163
- - Debugging approach: {what worked}
164
- ```
165
-
166
- ### Step 7: Create Fix Commit
167
-
168
- ```bash
169
- # If files were modified during debugging
170
- if [ -n "$(git status --porcelain)" ]; then
171
- echo "=== CREATING FIX COMMIT ==="
172
- echo "Files modified during debugging:"
173
- git status --short
174
-
175
- # Suggested commit message based on the issue
176
- echo ""
177
- echo "Suggested commit message:"
178
- echo "fix: $ARGUMENTS"
179
- echo ""
180
- echo "Debug session: $DEBUG_SESSION"
181
- echo "Root cause: {identified cause}"
182
- echo "Solution: {applied fix}"
183
- fi
184
- ```
185
-
186
- ### Step 8: Learning Documentation
187
-
188
- Append to `.docs/debug/KNOWLEDGE_BASE.md`:
189
-
190
- ```markdown
191
- ## Issue: $ARGUMENTS
192
- **Date**: {date}
193
- **Category**: {error/performance/test/build/other}
194
- **Solution**: {brief solution}
195
- **Key Learning**: {what to remember}
196
- **Keywords**: {searchable terms}
197
- ---
198
- ```
199
-
200
- This creates a searchable knowledge base of debugging sessions for future reference.
201
-
202
- ### Final Output
203
-
204
- ```markdown
205
- ## 🔍 Debug Session Complete
206
-
207
- **Issue**: $ARGUMENTS
208
- **Session**: $DEBUG_SESSION
209
- **Status**: {Resolved/Partially Resolved/Needs More Investigation}
210
-
211
- ### Summary
212
- {Brief summary of what was found and fixed}
213
-
214
- ### Files Changed
215
- {List of modified files if any}
216
-
217
- ### Next Steps
218
- {Any follow-up actions needed}
45
+ ## 📄 DOCUMENTATION
46
+ - Debug log: `.docs/debug/{SESSION_ID}.md`
47
+ - Knowledge base: `.docs/debug/KNOWLEDGE_BASE.md`
219
48
 
220
- 📄 Full debug log: .docs/debug/$DEBUG_SESSION.md
221
- 📚 Knowledge base updated: .docs/debug/KNOWLEDGE_BASE.md
49
+ 📄 Full debugging details available from sub-agent output above
222
50
  ```
223
51
 
224
52
  💡 **Usage Examples**:
225
53
  - `/debug "TypeError: Cannot read property 'name' of undefined"`
226
54
  - `/debug tests failing after npm update`
227
55
  - `/debug app crashes on startup`
228
- - `/debug slow performance in search feature`
56
+ - `/debug slow performance in search feature`