@codemieai/code 0.0.33 → 0.0.34

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 (180) hide show
  1. package/README.md +73 -7
  2. package/bin/codemie-opencode.js +11 -0
  3. package/dist/agents/codemie-code/agent.d.ts +17 -1
  4. package/dist/agents/codemie-code/agent.d.ts.map +1 -1
  5. package/dist/agents/codemie-code/agent.js +62 -3
  6. package/dist/agents/codemie-code/agent.js.map +1 -1
  7. package/dist/agents/codemie-code/index.d.ts +1 -0
  8. package/dist/agents/codemie-code/index.d.ts.map +1 -1
  9. package/dist/agents/codemie-code/index.js +28 -2
  10. package/dist/agents/codemie-code/index.js.map +1 -1
  11. package/dist/agents/codemie-code/prompts.d.ts +12 -3
  12. package/dist/agents/codemie-code/prompts.d.ts.map +1 -1
  13. package/dist/agents/codemie-code/prompts.js +25 -5
  14. package/dist/agents/codemie-code/prompts.js.map +1 -1
  15. package/dist/agents/codemie-code/types.d.ts +3 -0
  16. package/dist/agents/codemie-code/types.d.ts.map +1 -1
  17. package/dist/agents/codemie-code/types.js.map +1 -1
  18. package/dist/agents/core/AgentCLI.d.ts.map +1 -1
  19. package/dist/agents/core/AgentCLI.js +3 -1
  20. package/dist/agents/core/AgentCLI.js.map +1 -1
  21. package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
  22. package/dist/agents/core/BaseAgentAdapter.js +33 -0
  23. package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
  24. package/dist/agents/core/session/BaseSessionAdapter.d.ts +25 -0
  25. package/dist/agents/core/session/BaseSessionAdapter.d.ts.map +1 -1
  26. package/dist/agents/core/session/discovery-types.d.ts +53 -0
  27. package/dist/agents/core/session/discovery-types.d.ts.map +1 -0
  28. package/dist/agents/core/session/discovery-types.js +8 -0
  29. package/dist/agents/core/session/discovery-types.js.map +1 -0
  30. package/dist/agents/core/types.d.ts +45 -0
  31. package/dist/agents/core/types.d.ts.map +1 -1
  32. package/dist/agents/plugins/claude/claude.plugin.d.ts +44 -1
  33. package/dist/agents/plugins/claude/claude.plugin.d.ts.map +1 -1
  34. package/dist/agents/plugins/claude/claude.plugin.js +214 -0
  35. package/dist/agents/plugins/claude/claude.plugin.js.map +1 -1
  36. package/dist/agents/plugins/claude/plugin/README.md +40 -2
  37. package/dist/agents/plugins/claude/plugin/claude-templates/README.md +5 -5
  38. package/dist/agents/plugins/claude/plugin/claude-templates/templates/CLAUDE.md.template +177 -436
  39. package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/code-review-agent-template.md.template +49 -82
  40. package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/refactor-cleaner-agent.md.template +337 -0
  41. package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/solution-architect-agent.md.template +129 -419
  42. package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/unit-tester-agent.md.template +146 -693
  43. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/api/api-patterns.md.template +110 -138
  44. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/architecture/architecture.md.template +197 -0
  45. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/data/database-patterns.md.template +171 -91
  46. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/development/development-practices.md.template +219 -131
  47. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/security/security-practices.md.template +223 -98
  48. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/standards/code-quality.md.template +131 -95
  49. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/testing/testing-patterns.md.template +247 -75
  50. package/dist/agents/plugins/claude/plugin/commands/README.md +133 -0
  51. package/dist/agents/plugins/claude/plugin/commands/codemie-init.md +336 -544
  52. package/dist/agents/plugins/claude/plugin/commands/codemie-subagents.md +232 -503
  53. package/dist/agents/plugins/claude/plugin/commands/memory-add.md +311 -30
  54. package/dist/agents/plugins/claude/plugin/commands/memory-refresh.md +218 -39
  55. package/dist/agents/plugins/gemini/gemini.plugin.d.ts.map +1 -1
  56. package/dist/agents/plugins/gemini/gemini.plugin.js +0 -3
  57. package/dist/agents/plugins/gemini/gemini.plugin.js.map +1 -1
  58. package/dist/agents/plugins/opencode/index.d.ts +8 -0
  59. package/dist/agents/plugins/opencode/index.d.ts.map +1 -0
  60. package/dist/agents/plugins/opencode/index.js +12 -0
  61. package/dist/agents/plugins/opencode/index.js.map +1 -0
  62. package/dist/agents/plugins/opencode/opencode-message-types.d.ts +207 -0
  63. package/dist/agents/plugins/opencode/opencode-message-types.d.ts.map +1 -0
  64. package/dist/agents/plugins/opencode/opencode-message-types.js +59 -0
  65. package/dist/agents/plugins/opencode/opencode-message-types.js.map +1 -0
  66. package/dist/agents/plugins/opencode/opencode-model-configs.d.ts +65 -0
  67. package/dist/agents/plugins/opencode/opencode-model-configs.d.ts.map +1 -0
  68. package/dist/agents/plugins/opencode/opencode-model-configs.js +184 -0
  69. package/dist/agents/plugins/opencode/opencode-model-configs.js.map +1 -0
  70. package/dist/agents/plugins/opencode/opencode.paths.d.ts +62 -0
  71. package/dist/agents/plugins/opencode/opencode.paths.d.ts.map +1 -0
  72. package/dist/agents/plugins/opencode/opencode.paths.js +148 -0
  73. package/dist/agents/plugins/opencode/opencode.paths.js.map +1 -0
  74. package/dist/agents/plugins/opencode/opencode.plugin.d.ts +35 -0
  75. package/dist/agents/plugins/opencode/opencode.plugin.d.ts.map +1 -0
  76. package/dist/agents/plugins/opencode/opencode.plugin.js +338 -0
  77. package/dist/agents/plugins/opencode/opencode.plugin.js.map +1 -0
  78. package/dist/agents/plugins/opencode/opencode.session.d.ts +77 -0
  79. package/dist/agents/plugins/opencode/opencode.session.d.ts.map +1 -0
  80. package/dist/agents/plugins/opencode/opencode.session.js +424 -0
  81. package/dist/agents/plugins/opencode/opencode.session.js.map +1 -0
  82. package/dist/agents/plugins/opencode/opencode.storage-utils.d.ts +25 -0
  83. package/dist/agents/plugins/opencode/opencode.storage-utils.d.ts.map +1 -0
  84. package/dist/agents/plugins/opencode/opencode.storage-utils.js +96 -0
  85. package/dist/agents/plugins/opencode/opencode.storage-utils.js.map +1 -0
  86. package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.d.ts +30 -0
  87. package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.d.ts.map +1 -0
  88. package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.js +116 -0
  89. package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.js.map +1 -0
  90. package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.d.ts +102 -0
  91. package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.d.ts.map +1 -0
  92. package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.js +584 -0
  93. package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.js.map +1 -0
  94. package/dist/agents/registry.d.ts.map +1 -1
  95. package/dist/agents/registry.js +2 -0
  96. package/dist/agents/registry.js.map +1 -1
  97. package/dist/cli/commands/doctor/checks/AgentsCheck.d.ts +5 -0
  98. package/dist/cli/commands/doctor/checks/AgentsCheck.d.ts.map +1 -1
  99. package/dist/cli/commands/doctor/checks/AgentsCheck.js +29 -0
  100. package/dist/cli/commands/doctor/checks/AgentsCheck.js.map +1 -1
  101. package/dist/cli/commands/install.d.ts.map +1 -1
  102. package/dist/cli/commands/install.js +86 -7
  103. package/dist/cli/commands/install.js.map +1 -1
  104. package/dist/cli/commands/opencode-metrics.d.ts +13 -0
  105. package/dist/cli/commands/opencode-metrics.d.ts.map +1 -0
  106. package/dist/cli/commands/opencode-metrics.js +200 -0
  107. package/dist/cli/commands/opencode-metrics.js.map +1 -0
  108. package/dist/cli/commands/setup.d.ts.map +1 -1
  109. package/dist/cli/commands/setup.js +113 -0
  110. package/dist/cli/commands/setup.js.map +1 -1
  111. package/dist/cli/commands/skill.d.ts +6 -0
  112. package/dist/cli/commands/skill.d.ts.map +1 -0
  113. package/dist/cli/commands/skill.js +196 -0
  114. package/dist/cli/commands/skill.js.map +1 -0
  115. package/dist/cli/commands/update.d.ts.map +1 -1
  116. package/dist/cli/commands/update.js +34 -6
  117. package/dist/cli/commands/update.js.map +1 -1
  118. package/dist/cli/index.js +4 -0
  119. package/dist/cli/index.js.map +1 -1
  120. package/dist/migrations/003-remove-hooks-node.migration.d.ts +22 -0
  121. package/dist/migrations/003-remove-hooks-node.migration.d.ts.map +1 -0
  122. package/dist/migrations/003-remove-hooks-node.migration.js +103 -0
  123. package/dist/migrations/003-remove-hooks-node.migration.js.map +1 -0
  124. package/dist/migrations/index.d.ts +1 -0
  125. package/dist/migrations/index.d.ts.map +1 -1
  126. package/dist/migrations/index.js +1 -1
  127. package/dist/migrations/index.js.map +1 -1
  128. package/dist/providers/plugins/sso/sso.http-client.js +2 -2
  129. package/dist/providers/plugins/sso/sso.http-client.js.map +1 -1
  130. package/dist/providers/plugins/sso/sso.setup-steps.d.ts.map +1 -1
  131. package/dist/providers/plugins/sso/sso.setup-steps.js +14 -10
  132. package/dist/providers/plugins/sso/sso.setup-steps.js.map +1 -1
  133. package/dist/skills/core/SkillDiscovery.d.ts +83 -0
  134. package/dist/skills/core/SkillDiscovery.d.ts.map +1 -0
  135. package/dist/skills/core/SkillDiscovery.js +237 -0
  136. package/dist/skills/core/SkillDiscovery.js.map +1 -0
  137. package/dist/skills/core/SkillManager.d.ts +86 -0
  138. package/dist/skills/core/SkillManager.d.ts.map +1 -0
  139. package/dist/skills/core/SkillManager.js +155 -0
  140. package/dist/skills/core/SkillManager.js.map +1 -0
  141. package/dist/skills/core/types.d.ts +120 -0
  142. package/dist/skills/core/types.d.ts.map +1 -0
  143. package/dist/skills/core/types.js +20 -0
  144. package/dist/skills/core/types.js.map +1 -0
  145. package/dist/skills/index.d.ts +12 -0
  146. package/dist/skills/index.d.ts.map +1 -0
  147. package/dist/skills/index.js +12 -0
  148. package/dist/skills/index.js.map +1 -0
  149. package/dist/skills/utils/content-loader.d.ts +25 -0
  150. package/dist/skills/utils/content-loader.d.ts.map +1 -0
  151. package/dist/skills/utils/content-loader.js +161 -0
  152. package/dist/skills/utils/content-loader.js.map +1 -0
  153. package/dist/skills/utils/frontmatter.d.ts +60 -0
  154. package/dist/skills/utils/frontmatter.d.ts.map +1 -0
  155. package/dist/skills/utils/frontmatter.js +114 -0
  156. package/dist/skills/utils/frontmatter.js.map +1 -0
  157. package/dist/skills/utils/pattern-matcher.d.ts +60 -0
  158. package/dist/skills/utils/pattern-matcher.d.ts.map +1 -0
  159. package/dist/skills/utils/pattern-matcher.js +97 -0
  160. package/dist/skills/utils/pattern-matcher.js.map +1 -0
  161. package/dist/utils/installation-detector.d.ts +22 -0
  162. package/dist/utils/installation-detector.d.ts.map +1 -0
  163. package/dist/utils/installation-detector.js +49 -0
  164. package/dist/utils/installation-detector.js.map +1 -0
  165. package/dist/utils/native-installer.d.ts +49 -0
  166. package/dist/utils/native-installer.d.ts.map +1 -0
  167. package/dist/utils/native-installer.js +194 -0
  168. package/dist/utils/native-installer.js.map +1 -0
  169. package/dist/utils/version-utils.d.ts +50 -0
  170. package/dist/utils/version-utils.d.ts.map +1 -0
  171. package/dist/utils/version-utils.js +92 -0
  172. package/dist/utils/version-utils.js.map +1 -0
  173. package/package.json +5 -2
  174. package/scripts/copy-mr-skill-to-global.ts +252 -0
  175. package/scripts/demo-hooks.sh +125 -0
  176. package/scripts/test-hooks.sh +196 -0
  177. package/dist/agents/plugins/claude/plugin/claude-templates/templates/INDEX.md +0 -205
  178. package/dist/agents/plugins/claude/plugin/claude-templates/templates/TEMPLATE_SIZES.md +0 -74
  179. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/architecture/layered-architecture.md.template +0 -143
  180. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/architecture/project-structure.md.template +0 -127
@@ -0,0 +1,196 @@
1
+ #!/bin/bash
2
+ # Quick Hooks System Test Script
3
+ # Tests the hooks implementation with example scenarios
4
+
5
+ set -e
6
+
7
+ HOOKS_DIR="$HOME/.codemie/test-hooks"
8
+ LOG_FILE="$HOME/.codemie/hook-test.log"
9
+ TEST_CONFIG="$HOME/.codemie/test-hooks-config.json"
10
+
11
+ echo "🧪 CodeMie Hooks System Test"
12
+ echo "=============================="
13
+ echo ""
14
+
15
+ # Colors for output
16
+ GREEN='\033[0;32m'
17
+ RED='\033[0;31m'
18
+ YELLOW='\033[1;33m'
19
+ NC='\033[0m' # No Color
20
+
21
+ # Check if jq is installed
22
+ if ! command -v jq &> /dev/null; then
23
+ echo -e "${RED}✗ Error: jq is required but not installed${NC}"
24
+ echo "Install with: brew install jq (macOS) or apt-get install jq (Linux)"
25
+ exit 1
26
+ fi
27
+
28
+ # Create test hooks directory
29
+ echo "📁 Setting up test environment..."
30
+ mkdir -p "$HOOKS_DIR"
31
+
32
+ # Create PreToolUse hook (blocks rm -rf)
33
+ cat > "$HOOKS_DIR/pre-tool-hook.sh" << 'EOF'
34
+ #!/bin/bash
35
+ TOOL_NAME=$(echo "$CODEMIE_HOOK_INPUT" | jq -r '.tool_name')
36
+ echo "[PreToolUse] Tool: $TOOL_NAME" >> ~/.codemie/hook-test.log
37
+
38
+ if [[ "$TOOL_NAME" == "Bash" ]]; then
39
+ COMMAND=$(echo "$CODEMIE_HOOK_INPUT" | jq -r '.tool_input.command')
40
+ if [[ "$COMMAND" =~ "rm -rf" ]]; then
41
+ echo '{"decision": "block", "reason": "Dangerous command blocked: rm -rf"}'
42
+ exit 0
43
+ fi
44
+ fi
45
+
46
+ echo '{"decision": "allow"}'
47
+ exit 0
48
+ EOF
49
+
50
+ # Create PostToolUse hook (logs all usage)
51
+ cat > "$HOOKS_DIR/post-tool-hook.sh" << 'EOF'
52
+ #!/bin/bash
53
+ TOOL_NAME=$(echo "$CODEMIE_HOOK_INPUT" | jq -r '.tool_name')
54
+ TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
55
+ echo "[$TIMESTAMP] Tool: $TOOL_NAME" >> ~/.codemie/tool-usage.log
56
+ echo '{"decision": "allow"}'
57
+ exit 0
58
+ EOF
59
+
60
+ # Create UserPromptSubmit hook (adds context)
61
+ cat > "$HOOKS_DIR/prompt-hook.sh" << 'EOF'
62
+ #!/bin/bash
63
+ echo "{
64
+ \"decision\": \"allow\",
65
+ \"additionalContext\": \"Test context: Working in $(pwd)\"
66
+ }"
67
+ exit 0
68
+ EOF
69
+
70
+ # Make scripts executable
71
+ chmod +x "$HOOKS_DIR"/*.sh
72
+
73
+ echo -e "${GREEN}✓ Test hooks created${NC}"
74
+ echo ""
75
+
76
+ # Run tests
77
+ echo "🧪 Running Hook Tests..."
78
+ echo "----------------------"
79
+
80
+ # Clear logs
81
+ rm -f "$LOG_FILE" "$HOME/.codemie/tool-usage.log"
82
+
83
+ # Test 1: PreToolUse allows safe commands
84
+ echo -n "Test 1: PreToolUse allows safe commands... "
85
+ export CODEMIE_HOOK_INPUT='{"hook_event_name":"PreToolUse","tool_name":"Bash","tool_input":{"command":"ls -la"},"session_id":"test","cwd":"'$(pwd)'"}'
86
+ RESULT=$("$HOOKS_DIR/pre-tool-hook.sh")
87
+ EXIT_CODE=$?
88
+
89
+ if [[ $EXIT_CODE -eq 0 ]] && echo "$RESULT" | jq -e '.decision == "allow"' > /dev/null 2>&1; then
90
+ echo -e "${GREEN}✓ PASS${NC}"
91
+ else
92
+ echo -e "${RED}✗ FAIL${NC}"
93
+ echo " Expected: allow, Got: $RESULT"
94
+ fi
95
+
96
+ # Test 2: PreToolUse blocks dangerous commands
97
+ echo -n "Test 2: PreToolUse blocks dangerous commands... "
98
+ export CODEMIE_HOOK_INPUT='{"hook_event_name":"PreToolUse","tool_name":"Bash","tool_input":{"command":"rm -rf /test"},"session_id":"test","cwd":"'$(pwd)'"}'
99
+ RESULT=$("$HOOKS_DIR/pre-tool-hook.sh")
100
+ EXIT_CODE=$?
101
+
102
+ if [[ $EXIT_CODE -eq 0 ]] && echo "$RESULT" | jq -e '.decision == "block"' > /dev/null 2>&1; then
103
+ echo -e "${GREEN}✓ PASS${NC}"
104
+ else
105
+ echo -e "${RED}✗ FAIL${NC}"
106
+ echo " Expected: block, Got: $RESULT"
107
+ fi
108
+
109
+ # Test 3: PreToolUse blocks specific tool
110
+ echo -n "Test 3: PreToolUse logs to file... "
111
+ if [ -f "$LOG_FILE" ] && grep -q "PreToolUse" "$LOG_FILE"; then
112
+ echo -e "${GREEN}✓ PASS${NC}"
113
+ else
114
+ echo -e "${RED}✗ FAIL${NC}"
115
+ echo " Expected log file with PreToolUse entries"
116
+ fi
117
+
118
+ # Test 4: PostToolUse creates logs
119
+ echo -n "Test 4: PostToolUse creates usage logs... "
120
+ export CODEMIE_HOOK_INPUT='{"hook_event_name":"PostToolUse","tool_name":"Read","session_id":"test","cwd":"'$(pwd)'"}'
121
+ RESULT=$("$HOOKS_DIR/post-tool-hook.sh")
122
+
123
+ if [ -f "$HOME/.codemie/tool-usage.log" ] && grep -q "Tool: Read" "$HOME/.codemie/tool-usage.log"; then
124
+ echo -e "${GREEN}✓ PASS${NC}"
125
+ else
126
+ echo -e "${RED}✗ FAIL${NC}"
127
+ echo " Expected usage log with Read entry"
128
+ fi
129
+
130
+ # Test 5: UserPromptSubmit adds context
131
+ echo -n "Test 5: UserPromptSubmit adds context... "
132
+ export CODEMIE_HOOK_INPUT='{"hook_event_name":"UserPromptSubmit","prompt":"test prompt","session_id":"test","cwd":"'$(pwd)'"}'
133
+ RESULT=$("$HOOKS_DIR/prompt-hook.sh")
134
+
135
+ if echo "$RESULT" | jq -e '.additionalContext != null' > /dev/null 2>&1; then
136
+ echo -e "${GREEN}✓ PASS${NC}"
137
+ else
138
+ echo -e "${RED}✗ FAIL${NC}"
139
+ echo " Expected additionalContext in result"
140
+ fi
141
+
142
+ # Test 6: Hook JSON output is valid
143
+ echo -n "Test 6: Hook output is valid JSON... "
144
+ export CODEMIE_HOOK_INPUT='{"hook_event_name":"PreToolUse","tool_name":"Test","session_id":"test","cwd":"'$(pwd)'"}'
145
+ RESULT=$("$HOOKS_DIR/pre-tool-hook.sh")
146
+
147
+ if echo "$RESULT" | jq '.' > /dev/null 2>&1; then
148
+ echo -e "${GREEN}✓ PASS${NC}"
149
+ else
150
+ echo -e "${RED}✗ FAIL${NC}"
151
+ echo " Hook output is not valid JSON: $RESULT"
152
+ fi
153
+
154
+ # Test 7: Hook execution time
155
+ echo -n "Test 7: Hook performance (< 100ms)... "
156
+ export CODEMIE_HOOK_INPUT='{"hook_event_name":"PreToolUse","tool_name":"Test","session_id":"test","cwd":"'$(pwd)'"}'
157
+ START=$(date +%s%N)
158
+ "$HOOKS_DIR/pre-tool-hook.sh" > /dev/null
159
+ END=$(date +%s%N)
160
+ DURATION=$(( ($END - $START) / 1000000 )) # Convert to milliseconds
161
+
162
+ if [ $DURATION -lt 100 ]; then
163
+ echo -e "${GREEN}✓ PASS${NC} (${DURATION}ms)"
164
+ else
165
+ echo -e "${YELLOW}⚠ SLOW${NC} (${DURATION}ms)"
166
+ fi
167
+
168
+ echo ""
169
+ echo "📊 Test Summary"
170
+ echo "----------------------"
171
+ echo "Test hooks created at: $HOOKS_DIR"
172
+ echo "Logs created at:"
173
+ echo " - $LOG_FILE"
174
+ echo " - $HOME/.codemie/tool-usage.log"
175
+ echo ""
176
+ echo -e "${YELLOW}Next Steps:${NC}"
177
+ echo "1. Review test hooks: ls -la $HOOKS_DIR"
178
+ echo "2. Check logs: cat $LOG_FILE"
179
+ echo "3. View full testing guide: docs/HOOKS_TESTING.md"
180
+ echo "4. Configure hooks in your profile: ~/.codemie/codemie-cli.config.json"
181
+ echo ""
182
+ echo "Example configuration:"
183
+ echo ' "hooks": {'
184
+ echo ' "PreToolUse": ['
185
+ echo ' {'
186
+ echo ' "matcher": "Bash",'
187
+ echo ' "hooks": [{'
188
+ echo ' "type": "command",'
189
+ echo " \"command\": \"$HOOKS_DIR/pre-tool-hook.sh\","
190
+ echo ' "timeout": 5000'
191
+ echo ' }]'
192
+ echo ' }'
193
+ echo ' ]'
194
+ echo ' }'
195
+ echo ""
196
+ echo -e "${GREEN}✓ All basic tests passed!${NC}"
@@ -1,205 +0,0 @@
1
- # Template Index
2
-
3
- ## Overview
4
-
5
- Concise templates for generating Claude Code documentation. Each template is **150-250 lines max**, focusing on contracts and best practices.
6
-
7
- ---
8
-
9
- ## Main Template
10
-
11
- ### CLAUDE.md.template
12
- **Lines**: ~300
13
- **Purpose**: Main AI-optimized execution guide
14
- **Use**: Every project (required)
15
-
16
- ---
17
-
18
- ## Guide Templates (10 Total)
19
-
20
- ### Required (P0) - For All Projects
21
-
22
- #### development/development-practices.md.template
23
- **Lines**: ~180
24
- **Covers**: Error handling, logging, configuration, setup
25
- **Use**: All projects
26
- **Combines**: Error patterns + logging + config + setup in one file
27
-
28
- #### security/security-practices.md.template
29
- **Lines**: ~160
30
- **Covers**: Auth, authorization, validation, secrets, SQL injection, XSS
31
- **Use**: All projects
32
-
33
- #### testing/testing-patterns.md.template
34
- **Lines**: ~125
35
- **Covers**: Unit tests, integration tests, fixtures, mocking
36
- **Use**: All projects
37
-
38
- #### standards/code-quality.md.template
39
- **Lines**: ~135
40
- **Covers**: Linting, formatting, type safety, naming
41
- **Use**: All projects
42
-
43
- #### standards/git-workflow.md.template
44
- **Lines**: ~160
45
- **Covers**: Branching, commits, PRs, code review
46
- **Use**: All projects
47
-
48
- ---
49
-
50
- ### Recommended (P1) - Based on Project Type
51
-
52
- #### api/api-patterns.md.template
53
- **Lines**: ~190
54
- **Covers**: CRUD, validation, auth, pagination, errors, rate limiting
55
- **Use**: Projects with REST/GraphQL APIs
56
-
57
- #### architecture/layered-architecture.md.template
58
- **Lines**: ~125
59
- **Covers**: Layer responsibilities, communication, error flow, testing
60
- **Use**: Projects with layered architecture
61
-
62
- #### architecture/project-structure.md.template
63
- **Lines**: ~110
64
- **Covers**: Directory layout, module organization, navigation
65
- **Use**: For better code navigation (optional)
66
-
67
- #### data/database-patterns.md.template
68
- **Lines**: ~160
69
- **Covers**: Models, CRUD, transactions, migrations, N+1 prevention
70
- **Use**: Projects using databases
71
-
72
- #### integration/external-integrations.md.template
73
- **Lines**: ~145
74
- **Covers**: API clients, auth, retries, rate limiting, error handling
75
- **Use**: Projects with external API integrations
76
-
77
- ---
78
-
79
- ## Template Size Guide
80
-
81
- **Target**: 150-250 lines per template
82
- **Philosophy**: Concise, focused, efficient
83
- **Content**: Best practices and contracts, minimal code examples
84
-
85
- ### Size Breakdown
86
-
87
- | Template | Lines | Type |
88
- |----------|-------|------|
89
- | CLAUDE.md | ~300 | Main |
90
- | development-practices | ~180 | Required |
91
- | security-practices | ~160 | Required |
92
- | testing-patterns | ~125 | Required |
93
- | code-quality | ~135 | Required |
94
- | git-workflow | ~160 | Required |
95
- | api-patterns | ~190 | Optional |
96
- | layered-architecture | ~125 | Optional |
97
- | project-structure | ~110 | Optional |
98
- | database-patterns | ~160 | Optional |
99
- | external-integrations | ~145 | Optional |
100
-
101
- **Total**: ~1,790 lines for all templates
102
- **Generated docs**: 200-400 lines per guide (target)
103
-
104
- ---
105
-
106
- ## Template Selection
107
-
108
- ### Decision Matrix
109
-
110
- | Found in Project | Required Template | Optional Template |
111
- |------------------|------------------|-------------------|
112
- | **Always** | development-practices, security-practices, testing-patterns, code-quality, git-workflow | - |
113
- | REST/GraphQL endpoints | - | api-patterns |
114
- | Layered architecture | - | layered-architecture, project-structure |
115
- | Database/ORM | - | database-patterns |
116
- | External APIs | - | external-integrations |
117
-
118
- ### Quick Selection
119
-
120
- **Minimal (5 guides)**:
121
- - development-practices
122
- - security-practices
123
- - testing-patterns
124
- - code-quality
125
- - git-workflow
126
-
127
- **Standard Web App (8 guides)**:
128
- - All minimal +
129
- - api-patterns
130
- - layered-architecture
131
- - database-patterns
132
-
133
- **Full Stack (10 guides)**:
134
- - All standard +
135
- - project-structure
136
- - external-integrations
137
-
138
- ---
139
-
140
- ## Placeholders
141
-
142
- ### Global (All Templates)
143
-
144
- - `[PROJECT_NAME]` - Project name
145
- - `[LANGUAGE]` - Programming language
146
- - `[FRAMEWORK]` - Main framework
147
- - `[file:lines]` - Source file reference
148
- - `[code_example]` - Brief code snippet
149
- - `# FILL IN` - Project-specific section
150
-
151
- ### Template-Specific
152
-
153
- - `[DATABASE]` / `[ORM]` - Database patterns
154
- - `[TEST_FRAMEWORK]` - Testing patterns
155
- - `[LINTER]` / `[FORMATTER]` - Code quality
156
- - `[AUTH_METHOD]` - Security/API patterns
157
-
158
- ---
159
-
160
- ## Usage
161
-
162
- ### For Claude Code Generation
163
-
164
- 1. Analyze project (tech stack, patterns)
165
- 2. Select templates (P0 + relevant P1)
166
- 3. For each template:
167
- - Search codebase for patterns
168
- - Extract concise examples (< 20 lines)
169
- - Replace placeholders
170
- - Fill sections
171
- 4. Generate CLAUDE.md last
172
- 5. **Validate**: Each guide 200-400 lines max
173
-
174
- ### For Manual Use
175
-
176
- 1. Copy template
177
- 2. Replace `[PLACEHOLDERS]`
178
- 3. Fill `# FILL IN` sections
179
- 4. Add brief code examples
180
- 5. Keep concise (200-400 lines)
181
-
182
- ---
183
-
184
- ## Version History
185
-
186
- ### v2.0 (2026-01-14)
187
- - **Major revision**: Condensed all templates
188
- - Combined development folder into single file
189
- - Moved security to separate folder
190
- - Reduced from 14 to 10 templates
191
- - Target: 150-250 lines per template
192
- - Focus: Contracts and best practices, not extensive examples
193
-
194
- ### v1.0 (2026-01-14)
195
- - Initial release (deprecated)
196
-
197
- ---
198
-
199
- ## References
200
-
201
- - **Generation Command**: `../codemie-init-skill.md`
202
- - **README**: `../README.md`
203
- - **Source**: CodeMie project patterns
204
-
205
- ---
@@ -1,74 +0,0 @@
1
- # Template Size Report
2
-
3
- **Generated**: 2026-01-14
4
- **Version**: 2.0
5
-
6
- ## Summary
7
-
8
- - **Total Templates**: 10 guide templates
9
- - **Size Range**: 109-192 lines
10
- - **Average**: 148 lines
11
- - **Target Met**: ✅ All templates within 150-250 line goal (minor variance acceptable)
12
-
13
- ## Detailed Breakdown
14
-
15
- | Template | Lines | Type | Status |
16
- |----------|-------|------|--------|
17
- | **api-patterns** | 189 | Optional | ✅ |
18
- | **layered-architecture** | 125 | Optional | ✅ |
19
- | **project-structure** | 109 | Optional | ✅ |
20
- | **database-patterns** | 158 | Optional | ✅ |
21
- | **development-practices** | 192 | **Required** | ✅ |
22
- | **external-integrations** | 142 | Optional | ✅ |
23
- | **security-practices** | 152 | **Required** | ✅ |
24
- | **code-quality** | 132 | **Required** | ✅ |
25
- | **git-workflow** | 159 | **Required** | ✅ |
26
- | **testing-patterns** | 125 | **Required** | ✅ |
27
-
28
- ## By Category
29
-
30
- ### Required Templates (P0)
31
- - development-practices: 192 lines
32
- - security-practices: 152 lines
33
- - testing-patterns: 125 lines
34
- - code-quality: 132 lines
35
- - git-workflow: 159 lines
36
- **Total**: 760 lines
37
-
38
- ### Optional Templates (P1)
39
- - api-patterns: 189 lines
40
- - layered-architecture: 125 lines
41
- - project-structure: 109 lines
42
- - database-patterns: 158 lines
43
- - external-integrations: 142 lines
44
- **Total**: 723 lines
45
-
46
- ## Expected Generated Sizes
47
-
48
- When filled with project-specific content:
49
-
50
- **Per Guide**: 200-400 lines (1.5-2x template size)
51
- - Template placeholders → Real code examples
52
- - `# FILL IN` sections → Project-specific content
53
- - Generic patterns → Actual file:line references
54
-
55
- **Minimal Project** (5 required guides):
56
- - Generated: ~1,200-2,000 lines total
57
-
58
- **Standard Project** (8 guides):
59
- - Generated: ~1,900-3,200 lines total
60
-
61
- **Full Project** (10 guides):
62
- - Generated: ~2,400-4,000 lines total
63
-
64
- ## Size Philosophy
65
-
66
- **Concise but Complete**:
67
- - Focus on contracts and patterns
68
- - Brief code examples (< 20 lines)
69
- - Essential best practices only
70
- - No redundant explanations
71
- - Highly scannable tables
72
-
73
- **Target Achieved**: ✅
74
- All templates meet the "concise, focused, efficient" goal.
@@ -1,143 +0,0 @@
1
- # Layered Architecture
2
-
3
- ## Quick Summary
4
-
5
- [PROJECT_NAME] implements [N]-tier architecture: [Layer1] → [Layer2] → [Layer3].
6
-
7
- **Category**: Architecture
8
- **Complexity**: Medium
9
- **Prerequisites**: [LANGUAGE], [FRAMEWORK]
10
-
11
- ---
12
-
13
- ## 🚨 SIZE LIMIT WARNING
14
-
15
- **This generated guide MUST be 200-400 lines maximum.**
16
-
17
- **When filling this template**:
18
- - ✅ Code examples: 5-15 lines (NEVER > 20)
19
- - ✅ ONE example per pattern
20
- - ✅ Use file:line references, not full code
21
- - ✅ Use tables for multiple patterns
22
- - ❌ NO multiple examples for same pattern
23
- - ❌ NO verbose explanations
24
- - ❌ NO copying entire functions
25
-
26
- **Validate line count after generation**: `wc -l [this-file]`
27
- **If > 400 lines**: Condense immediately before continuing!
28
-
29
- ---
30
-
31
- ## Architecture Overview
32
-
33
- ```
34
- ┌─────────────────────────────────┐
35
- │ [Layer 1] ([path/]) │ ← HTTP interface
36
- │ Request/Response handling │
37
- └────────────┬────────────────────┘
38
- ↓ calls
39
- ┌─────────────────────────────────┐
40
- │ [Layer 2] ([path/]) │ ← Business logic
41
- │ Orchestration │
42
- └────────────┬────────────────────┘
43
- ↓ calls
44
- ┌─────────────────────────────────┐
45
- │ [Layer 3] ([path/]) │ ← Data access
46
- │ Persistence │
47
- └────────────┬────────────────────┘
48
-
49
- [Database]
50
- ```
51
-
52
- ---
53
-
54
- ## Layer Responsibilities
55
-
56
- ### [Layer 1] - [Name]
57
-
58
- **Purpose**: [Brief description]
59
-
60
- ```[language]
61
- # Source: [file:lines]
62
- [layer1_example]
63
- ```
64
-
65
- **Does**: Validation, routing, response formatting
66
- **Doesn't**: Business logic, database access
67
-
68
- ---
69
-
70
- ### [Layer 2] - [Name]
71
-
72
- **Purpose**: [Brief description]
73
-
74
- ```[language]
75
- # Source: [file:lines]
76
- [layer2_example]
77
- ```
78
-
79
- **Does**: Business logic, orchestration
80
- **Doesn't**: HTTP handling, direct DB access
81
-
82
- ---
83
-
84
- ### [Layer 3] - [Name]
85
-
86
- **Purpose**: [Brief description]
87
-
88
- ```[language]
89
- # Source: [file:lines]
90
- [layer3_example]
91
- ```
92
-
93
- **Does**: Database queries, data access
94
- **Doesn't**: Business logic, HTTP handling
95
-
96
- ---
97
-
98
- ## Communication Rules
99
-
100
- | ✅ Allowed | ❌ Not Allowed |
101
- |-----------|---------------|
102
- | Layer1 → Layer2 → Layer3 | Skip layers |
103
- | Pass data via models/DTOs | Share state |
104
- | Async/await throughout | Blocking calls |
105
-
106
- ---
107
-
108
- ## Error Flow
109
-
110
- ```
111
- [Layer3 Error]
112
- ↓ raise
113
- [Layer2 Transform]
114
- ↓ raise
115
- [Layer1 HTTP Response]
116
- ```
117
-
118
- **Example**:
119
- ```[language]
120
- # Source: [file:lines]
121
- [error_flow_example]
122
- ```
123
-
124
- ---
125
-
126
- ## Testing Strategy
127
-
128
- | Layer | Test Type | Mock |
129
- |-------|-----------|------|
130
- | [Layer1] | Unit | Layer2 |
131
- | [Layer2] | Unit | Layer3 |
132
- | [Layer3] | Unit | Database |
133
- | All | Integration | Nothing |
134
-
135
- ---
136
-
137
- ## References
138
-
139
- - **[Layer1]**: `[path/]`
140
- - **[Layer2]**: `[path/]`
141
- - **[Layer3]**: `[path/]`
142
-
143
- ---