claude-mpm 3.7.1__py3-none-any.whl → 3.7.8__py3-none-any.whl

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 (52) hide show
  1. claude_mpm/VERSION +1 -1
  2. claude_mpm/agents/INSTRUCTIONS.md +18 -0
  3. claude_mpm/agents/frontmatter_validator.py +116 -17
  4. claude_mpm/agents/schema/agent_schema.json +1 -1
  5. claude_mpm/{dashboard → agents}/templates/.claude-mpm/memories/engineer_agent.md +1 -1
  6. claude_mpm/{dashboard/templates/.claude-mpm/memories/version_control_agent.md → agents/templates/.claude-mpm/memories/qa_agent.md} +2 -2
  7. claude_mpm/agents/templates/.claude-mpm/memories/research_agent.md +39 -0
  8. claude_mpm/agents/templates/code_analyzer.json +34 -12
  9. claude_mpm/agents/templates/data_engineer.json +5 -8
  10. claude_mpm/agents/templates/documentation.json +2 -2
  11. claude_mpm/agents/templates/engineer.json +6 -6
  12. claude_mpm/agents/templates/ops.json +3 -8
  13. claude_mpm/agents/templates/qa.json +2 -3
  14. claude_mpm/agents/templates/research.json +12 -9
  15. claude_mpm/agents/templates/security.json +4 -7
  16. claude_mpm/agents/templates/ticketing.json +161 -0
  17. claude_mpm/agents/templates/version_control.json +3 -3
  18. claude_mpm/agents/templates/web_qa.json +214 -0
  19. claude_mpm/agents/templates/web_ui.json +176 -0
  20. claude_mpm/cli/commands/agents.py +118 -1
  21. claude_mpm/cli/parser.py +11 -0
  22. claude_mpm/cli/ticket_cli.py +31 -0
  23. claude_mpm/core/framework_loader.py +102 -49
  24. claude_mpm/dashboard/static/js/components/file-tool-tracker.js +46 -2
  25. claude_mpm/dashboard/templates/index.html +5 -5
  26. claude_mpm/services/agents/deployment/agent_deployment.py +9 -1
  27. claude_mpm/services/agents/deployment/async_agent_deployment.py +174 -13
  28. claude_mpm/services/agents/management/agent_capabilities_generator.py +21 -11
  29. claude_mpm/services/ticket_manager.py +207 -44
  30. claude_mpm/utils/agent_dependency_loader.py +66 -15
  31. claude_mpm/utils/robust_installer.py +587 -0
  32. {claude_mpm-3.7.1.dist-info → claude_mpm-3.7.8.dist-info}/METADATA +17 -21
  33. {claude_mpm-3.7.1.dist-info → claude_mpm-3.7.8.dist-info}/RECORD +37 -46
  34. claude_mpm/.claude-mpm/logs/hooks_20250728.log +0 -10
  35. claude_mpm/agents/agent-template.yaml +0 -83
  36. claude_mpm/agents/templates/test_integration.json +0 -113
  37. claude_mpm/cli/README.md +0 -108
  38. claude_mpm/cli_module/refactoring_guide.md +0 -253
  39. claude_mpm/config/async_logging_config.yaml +0 -145
  40. claude_mpm/core/.claude-mpm/logs/hooks_20250730.log +0 -34
  41. claude_mpm/dashboard/.claude-mpm/memories/README.md +0 -36
  42. claude_mpm/dashboard/README.md +0 -121
  43. claude_mpm/dashboard/static/js/dashboard.js.backup +0 -1973
  44. claude_mpm/dashboard/templates/.claude-mpm/memories/README.md +0 -36
  45. claude_mpm/hooks/README.md +0 -96
  46. claude_mpm/schemas/agent_schema.json +0 -435
  47. claude_mpm/services/framework_claude_md_generator/README.md +0 -92
  48. claude_mpm/services/version_control/VERSION +0 -1
  49. {claude_mpm-3.7.1.dist-info → claude_mpm-3.7.8.dist-info}/WHEEL +0 -0
  50. {claude_mpm-3.7.1.dist-info → claude_mpm-3.7.8.dist-info}/entry_points.txt +0 -0
  51. {claude_mpm-3.7.1.dist-info → claude_mpm-3.7.8.dist-info}/licenses/LICENSE +0 -0
  52. {claude_mpm-3.7.1.dist-info → claude_mpm-3.7.8.dist-info}/top_level.txt +0 -0
@@ -1,36 +0,0 @@
1
- # Agent Memory System
2
-
3
- ## Purpose
4
- Each agent maintains project-specific knowledge in these files. Agents read their memory file before tasks and update it when they learn something new.
5
-
6
- ## Manual Editing
7
- Feel free to edit these files to:
8
- - Add project-specific guidelines
9
- - Remove outdated information
10
- - Reorganize for better clarity
11
- - Add domain-specific knowledge
12
-
13
- ## Memory Limits
14
- - Max file size: 8KB (~2000 tokens)
15
- - Max sections: 10
16
- - Max items per section: 15
17
- - Files auto-truncate when limits exceeded
18
-
19
- ## File Format
20
- Standard markdown with structured sections. Agents expect:
21
- - Project Architecture
22
- - Implementation Guidelines
23
- - Common Mistakes to Avoid
24
- - Current Technical Context
25
-
26
- ## How It Works
27
- 1. Agents read their memory file before starting tasks
28
- 2. Agents add learnings during or after task completion
29
- 3. Files automatically enforce size limits
30
- 4. Developers can manually edit for accuracy
31
-
32
- ## Memory File Lifecycle
33
- - Created automatically when agent first runs
34
- - Updated through hook system after delegations
35
- - Manually editable by developers
36
- - Version controlled with project
@@ -1,96 +0,0 @@
1
- # Claude Code Hooks System
2
-
3
- This directory contains the Claude Code hook integration for claude-mpm.
4
-
5
- ## Overview
6
-
7
- The hook system allows claude-mpm to intercept and handle commands typed in Claude Code, particularly the `/mpm` commands.
8
-
9
- ## Structure
10
-
11
- ```
12
- hooks/
13
- └── claude_hooks/ # Claude Code hook implementation
14
- ├── hook_handler.py # Main Python handler that processes events
15
- └── hook_wrapper.sh # Shell wrapper script (this is what gets installed in ~/.claude/settings.json)
16
- ```
17
-
18
- ## Claude Code Hooks
19
-
20
- The Claude Code hooks are the primary integration point between claude-mpm and Claude Code. They allow:
21
-
22
- - Intercepting `/mpm` commands before they reach the LLM
23
- - Providing custom responses and actions
24
- - Blocking LLM processing when appropriate
25
-
26
- ### Installation
27
-
28
- To install the Claude Code hooks:
29
-
30
- ```bash
31
- python scripts/install_hooks.py
32
- ```
33
-
34
- This will:
35
- 1. Create/update `~/.claude/settings.json` with hook configuration
36
- 2. Point to the `hook_wrapper.sh` script
37
- 3. Copy any custom commands to `~/.claude/commands/`
38
-
39
- ### How It Works
40
-
41
- 1. When you type in Claude Code, it triggers hook events
42
- 2. Claude Code calls `hook_wrapper.sh` (the path in `~/.claude/settings.json`)
43
- 3. The wrapper script:
44
- - Detects if it's running from a local dev environment, npm, or PyPI installation
45
- - Activates the appropriate Python environment
46
- - Runs `hook_handler.py` with the event data
47
- 4. The handler processes various event types:
48
- - **UserPromptSubmit**: Checks if the prompt starts with `/mpm` and handles commands
49
- - **PreToolUse**: Logs tool usage before execution
50
- - **PostToolUse**: Logs tool results after execution
51
- - **Stop**: Logs when a session or task stops
52
- - **SubagentStop**: Logs when a subagent completes with agent type and ID
53
- 5. For `/mpm` commands, it returns exit code 2 to block LLM processing
54
- 6. All events are logged to project-specific log files in `.claude-mpm/logs/`
55
-
56
- ### Available Commands
57
-
58
- - `/mpm` - Show help and available commands
59
- - `/mpm status` - Show claude-mpm status and environment
60
- - `/mpm help` - Show detailed help
61
-
62
- ### Debugging
63
-
64
- To enable debug logging for hooks:
65
-
66
- ```bash
67
- export CLAUDE_MPM_LOG_LEVEL=DEBUG
68
- ```
69
-
70
- Then run Claude Code from that terminal. Hook events will be logged to `~/.claude-mpm/logs/`.
71
-
72
- ## Legacy Hook System (Removed)
73
-
74
- The `builtin/` directory that contained the old internal hook system has been removed. All hook functionality is now handled through the Claude Code hooks system.
75
-
76
- ## Development
77
-
78
- To add new `/mpm` commands:
79
-
80
- 1. Edit `hook_handler.py` to handle the new command
81
- 2. Update the help text in the `handle_mpm_help()` function
82
- 3. Test by running Claude Code with the new command
83
-
84
- ## Exit Codes
85
-
86
- The hook system uses specific exit codes:
87
-
88
- - `0` - Success, continue normal processing
89
- - `2` - Block LLM processing (command was handled)
90
- - Other - Error occurred
91
-
92
- ## Environment Variables
93
-
94
- - `CLAUDE_MPM_LOG_LEVEL` - Set to DEBUG for detailed logging
95
- - `HOOK_EVENT_TYPE` - Set by Claude Code (UserPromptSubmit, PreToolUse, PostToolUse)
96
- - `HOOK_DATA` - JSON data from Claude Code with event details
@@ -1,435 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "version": "1.2.0",
4
- "title": "Claude MPM Agent Schema",
5
- "description": "Schema definition for Claude MPM agent templates. This schema enforces the structure and validation rules for all agent configurations in the Claude MPM system.",
6
- "type": "object",
7
- "required": [
8
- "schema_version",
9
- "agent_id",
10
- "agent_version",
11
- "agent_type",
12
- "metadata",
13
- "capabilities",
14
- "instructions"
15
- ],
16
- "properties": {
17
- "schema_version": {
18
- "type": "string",
19
- "pattern": "^\\d+\\.\\d+\\.\\d+$",
20
- "description": "Schema version for the agent template format. This ensures compatibility between the agent template and the schema validator. Must be updated when breaking changes are made to the schema.",
21
- "examples": ["1.0.0", "1.2.0"]
22
- },
23
- "agent_id": {
24
- "type": "string",
25
- "pattern": "^[a-z][a-z0-9_]*$",
26
- "description": "Unique agent identifier used for agent discovery and loading. This ID must be unique across all agents in the system and follows snake_case naming convention.",
27
- "examples": ["research_agent", "engineer_agent", "qa_agent", "security_agent"]
28
- },
29
- "agent_version": {
30
- "type": "string",
31
- "pattern": "^\\d+\\.\\d+\\.\\d+$",
32
- "description": "Semantic version of the agent template itself (not the schema). Increment major for breaking changes, minor for new features, patch for bug fixes.",
33
- "examples": ["1.0.0", "2.1.3"]
34
- },
35
- "agent_type": {
36
- "type": "string",
37
- "description": "Type of agent that determines its primary function and default capabilities. This categorization helps in agent discovery and capability matching.",
38
- "enum": [
39
- "base",
40
- "engineer",
41
- "qa",
42
- "documentation",
43
- "research",
44
- "security",
45
- "ops",
46
- "data_engineer",
47
- "version_control"
48
- ]
49
- },
50
- "metadata": {
51
- "type": "object",
52
- "required": [
53
- "name",
54
- "description",
55
- "tags"
56
- ],
57
- "properties": {
58
- "name": {
59
- "type": "string",
60
- "minLength": 3,
61
- "maxLength": 50,
62
- "description": "Human-readable agent name displayed in UI and logs. Should be concise but descriptive."
63
- },
64
- "description": {
65
- "type": "string",
66
- "minLength": 10,
67
- "maxLength": 200,
68
- "description": "Brief description of agent purpose and capabilities. Used in agent selection and documentation."
69
- },
70
- "category": {
71
- "type": "string",
72
- "enum": ["engineering", "research", "quality", "operations", "specialized"],
73
- "description": "Agent category for organization"
74
- },
75
- "tags": {
76
- "type": "array",
77
- "items": {
78
- "type": "string",
79
- "pattern": "^[a-z][a-z0-9-]*$"
80
- },
81
- "minItems": 1,
82
- "maxItems": 10,
83
- "uniqueItems": true,
84
- "description": "Tags for agent discovery and categorization. Used by the agent registry for searching and filtering."
85
- },
86
- "author": {
87
- "type": "string",
88
- "description": "Agent template author"
89
- },
90
- "created_at": {
91
- "type": "string",
92
- "format": "date-time",
93
- "description": "Creation timestamp"
94
- },
95
- "updated_at": {
96
- "type": "string",
97
- "format": "date-time",
98
- "description": "Last update timestamp"
99
- },
100
- "color": {
101
- "type": "string",
102
- "enum": ["red", "blue", "green", "yellow", "purple", "orange", "pink", "cyan"],
103
- "description": "Agent color for visual identification in Claude Code interface. Helps distinguish agents at a glance."
104
- }
105
- }
106
- },
107
- "dependencies": {
108
- "type": "object",
109
- "description": "External dependencies required for this agent to function properly",
110
- "properties": {
111
- "python": {
112
- "type": "array",
113
- "items": {
114
- "type": "string"
115
- },
116
- "description": "Python packages required (pip installable) with optional version specifiers",
117
- "examples": [["tree-sitter>=0.21.0", "pandas>=2.0.0"]]
118
- },
119
- "system": {
120
- "type": "array",
121
- "items": {
122
- "type": "string"
123
- },
124
- "description": "System-level dependencies (e.g., commands that should be available in PATH)",
125
- "examples": [["ripgrep", "git", "docker"]]
126
- },
127
- "optional": {
128
- "type": "boolean",
129
- "default": false,
130
- "description": "Whether these dependencies are optional (agent can function without them)"
131
- }
132
- }
133
- },
134
- "capabilities": {
135
- "type": "object",
136
- "required": [
137
- "model",
138
- "tools",
139
- "resource_tier"
140
- ],
141
- "properties": {
142
- "model": {
143
- "type": "string",
144
- "enum": [
145
- "opus",
146
- "sonnet",
147
- "haiku"
148
- ],
149
- "description": "Claude model tier to use for this agent. Choose based on task complexity and performance requirements: opus (most capable), sonnet (balanced), haiku (fastest)."
150
- },
151
- "tools": {
152
- "type": "array",
153
- "items": {
154
- "type": "string",
155
- "enum": [
156
- "Read",
157
- "Write",
158
- "Edit",
159
- "MultiEdit",
160
- "Grep",
161
- "Glob",
162
- "LS",
163
- "Bash",
164
- "WebSearch",
165
- "WebFetch",
166
- "NotebookRead",
167
- "NotebookEdit",
168
- "TodoWrite",
169
- "ExitPlanMode",
170
- "git",
171
- "docker",
172
- "kubectl",
173
- "terraform",
174
- "aws",
175
- "gcloud",
176
- "azure"
177
- ]
178
- },
179
- "uniqueItems": true,
180
- "description": "Available tools for the agent. Tools determine what operations the agent can perform."
181
- },
182
- "resource_tier": {
183
- "type": "string",
184
- "enum": [
185
- "basic",
186
- "standard",
187
- "intensive",
188
- "lightweight"
189
- ],
190
- "description": "Resource allocation tier that determines memory, CPU, and timeout limits. See definitions section for specific limits."
191
- },
192
- "max_tokens": {
193
- "type": "integer",
194
- "minimum": 1000,
195
- "maximum": 200000,
196
- "default": 8192,
197
- "description": "Maximum tokens for response generation. Higher values allow longer responses but increase cost and latency."
198
- },
199
- "temperature": {
200
- "type": "number",
201
- "minimum": 0,
202
- "maximum": 1,
203
- "default": 0.7,
204
- "description": "Model temperature setting controlling response randomness. Lower values for consistency, higher for creativity."
205
- },
206
- "timeout": {
207
- "type": "integer",
208
- "minimum": 30,
209
- "maximum": 3600,
210
- "default": 300,
211
- "description": "Operation timeout in seconds. Should align with resource_tier settings."
212
- },
213
- "memory_limit": {
214
- "type": "integer",
215
- "minimum": 512,
216
- "maximum": 8192,
217
- "description": "Memory limit in MB (for resource tier)"
218
- },
219
- "cpu_limit": {
220
- "type": "integer",
221
- "minimum": 10,
222
- "maximum": 100,
223
- "description": "CPU limit percentage (for resource tier)"
224
- },
225
- "network_access": {
226
- "type": "boolean",
227
- "default": false,
228
- "description": "Whether agent needs network access"
229
- },
230
- "file_access": {
231
- "type": "object",
232
- "properties": {
233
- "read_paths": {
234
- "type": "array",
235
- "items": {"type": "string"},
236
- "description": "Allowed read paths"
237
- },
238
- "write_paths": {
239
- "type": "array",
240
- "items": {"type": "string"},
241
- "description": "Allowed write paths"
242
- }
243
- }
244
- },
245
- "allowed_tools": {
246
- "type": "array",
247
- "items": {"type": "string"},
248
- "description": "Glob patterns for allowed file paths. Restricts which files the agent can access (e.g., 'tests/**' for test files only)."
249
- },
250
- "disallowed_tools": {
251
- "type": "array",
252
- "items": {"type": "string"},
253
- "description": "Tool names to explicitly disallow, overriding the tools array. Use for security restrictions (e.g., 'Bash' to prevent shell access)."
254
- }
255
- }
256
- },
257
- "instructions": {
258
- "type": "string",
259
- "minLength": 100,
260
- "maxLength": 8000,
261
- "description": "Agent system instructions that define behavior, approach, and constraints. This becomes the agent's system prompt."
262
- },
263
- "knowledge": {
264
- "type": "object",
265
- "description": "Agent-specific knowledge and context",
266
- "properties": {
267
- "domain_expertise": {
268
- "type": "array",
269
- "items": {"type": "string"},
270
- "description": "Areas of expertise"
271
- },
272
- "best_practices": {
273
- "type": "array",
274
- "items": {"type": "string"},
275
- "description": "Best practices the agent follows"
276
- },
277
- "constraints": {
278
- "type": "array",
279
- "items": {"type": "string"},
280
- "description": "Operating constraints"
281
- },
282
- "examples": {
283
- "type": "array",
284
- "items": {
285
- "type": "object",
286
- "properties": {
287
- "scenario": {"type": "string"},
288
- "approach": {"type": "string"}
289
- }
290
- },
291
- "description": "Example scenarios and approaches"
292
- }
293
- }
294
- },
295
- "interactions": {
296
- "type": "object",
297
- "description": "Agent interaction patterns",
298
- "properties": {
299
- "input_format": {
300
- "type": "object",
301
- "properties": {
302
- "required_fields": {
303
- "type": "array",
304
- "items": {"type": "string"}
305
- },
306
- "optional_fields": {
307
- "type": "array",
308
- "items": {"type": "string"}
309
- }
310
- }
311
- },
312
- "output_format": {
313
- "type": "object",
314
- "properties": {
315
- "structure": {
316
- "type": "string",
317
- "enum": ["markdown", "json", "structured", "free-form"]
318
- },
319
- "includes": {
320
- "type": "array",
321
- "items": {"type": "string"}
322
- }
323
- }
324
- },
325
- "handoff_agents": {
326
- "type": "array",
327
- "items": {"type": "string"},
328
- "description": "Agents this agent can hand off to"
329
- },
330
- "triggers": {
331
- "type": "array",
332
- "items": {
333
- "type": "object",
334
- "properties": {
335
- "condition": {"type": "string"},
336
- "action": {"type": "string"}
337
- }
338
- },
339
- "description": "Conditions that trigger specific actions"
340
- }
341
- }
342
- },
343
- "testing": {
344
- "type": "object",
345
- "description": "Testing configuration for the agent",
346
- "properties": {
347
- "test_cases": {
348
- "type": "array",
349
- "items": {
350
- "type": "object",
351
- "required": ["input", "expected_behavior"],
352
- "properties": {
353
- "name": {"type": "string"},
354
- "input": {"type": "string"},
355
- "expected_behavior": {"type": "string"},
356
- "validation_criteria": {
357
- "type": "array",
358
- "items": {"type": "string"}
359
- }
360
- }
361
- }
362
- },
363
- "performance_benchmarks": {
364
- "type": "object",
365
- "properties": {
366
- "response_time": {"type": "integer"},
367
- "token_usage": {"type": "integer"},
368
- "success_rate": {"type": "number"}
369
- }
370
- }
371
- }
372
- },
373
- "hooks": {
374
- "type": "object",
375
- "description": "Hook configurations for extensibility",
376
- "properties": {
377
- "pre_execution": {
378
- "type": "array",
379
- "items": {
380
- "type": "object",
381
- "properties": {
382
- "name": {"type": "string"},
383
- "enabled": {"type": "boolean"}
384
- }
385
- }
386
- },
387
- "post_execution": {
388
- "type": "array",
389
- "items": {
390
- "type": "object",
391
- "properties": {
392
- "name": {"type": "string"},
393
- "enabled": {"type": "boolean"}
394
- }
395
- }
396
- }
397
- }
398
- }
399
- },
400
- "additionalProperties": false,
401
- "definitions": {
402
- "model_mappings": {
403
- "description": "Mappings for model normalization from full names to tiers",
404
- "mappings": {
405
- "claude-3-5-sonnet-20241022": "sonnet",
406
- "claude-3-5-sonnet-20240620": "sonnet",
407
- "claude-sonnet-4-20250514": "sonnet",
408
- "claude-4-sonnet-20250514": "sonnet",
409
- "claude-3-sonnet-20240229": "sonnet",
410
- "claude-3-opus-20240229": "opus",
411
- "claude-opus-4-20250514": "opus",
412
- "claude-4-opus-20250514": "opus",
413
- "claude-3-haiku-20240307": "haiku",
414
- "claude-3-5-haiku-20241022": "haiku"
415
- }
416
- },
417
- "resource_tier_limits": {
418
- "intensive": {
419
- "memory_limit": {"min": 4096, "max": 8192},
420
- "cpu_limit": {"min": 60, "max": 100},
421
- "timeout": {"min": 600, "max": 3600}
422
- },
423
- "standard": {
424
- "memory_limit": {"min": 2048, "max": 4096},
425
- "cpu_limit": {"min": 30, "max": 60},
426
- "timeout": {"min": 300, "max": 1200}
427
- },
428
- "lightweight": {
429
- "memory_limit": {"min": 512, "max": 2048},
430
- "cpu_limit": {"min": 10, "max": 30},
431
- "timeout": {"min": 30, "max": 600}
432
- }
433
- }
434
- }
435
- }
@@ -1,92 +0,0 @@
1
- # Framework CLAUDE.md Generator
2
-
3
- This directory contains the refactored framework CLAUDE.md generator service, originally a single 1,267-line file.
4
-
5
- ## Structure
6
-
7
- ### Core Modules
8
-
9
- - **`__init__.py`** (~250 lines) - Main facade class that coordinates all functionality
10
- - **`version_manager.py`** (~100 lines) - Handles version parsing, incrementing, and comparison
11
- - **`content_assembler.py`** (~120 lines) - Assembles sections and applies template variables
12
- - **`content_validator.py`** (~80 lines) - Validates generated content structure and completeness
13
- - **`deployment_manager.py`** (~80 lines) - Handles deployment to parent directories
14
- - **`section_manager.py`** (~60 lines) - Manages section registration, ordering, and updates
15
-
16
- ### Section Generators
17
-
18
- The `section_generators/` subdirectory contains individual generators for each section:
19
-
20
- - **`__init__.py`** - Base classes and registry
21
- - **`header.py`** - Header with version metadata
22
- - **`role_designation.py`** - AI Assistant role designation
23
- - **`agents.py`** (~570 lines) - Comprehensive agents documentation (largest section)
24
- - **`todo_task_tools.py`** - Todo and Task Tools integration
25
- - **`claude_pm_init.py`** - Claude-PM initialization procedures
26
- - **`orchestration_principles.py`** - Core orchestration principles
27
- - **`subprocess_validation.py`** - Subprocess validation protocol
28
- - **`delegation_constraints.py`** - Critical delegation constraints
29
- - **`environment_config.py`** - Environment configuration
30
- - **`troubleshooting.py`** - Troubleshooting guide
31
- - **`core_responsibilities.py`** - Core responsibilities list
32
- - **`footer.py`** - Footer with metadata
33
-
34
- ## Usage
35
-
36
- The API remains unchanged from the original implementation:
37
-
38
- ```python
39
- from claude_pm.services.framework_claude_md_generator import FrameworkClaudeMdGenerator
40
-
41
- # Create generator instance
42
- generator = FrameworkClaudeMdGenerator()
43
-
44
- # Generate content
45
- content = generator.generate(
46
- current_content=existing_content, # Optional: for version auto-increment
47
- template_variables={'PLATFORM': 'darwin', 'PYTHON_CMD': 'python3'}
48
- )
49
-
50
- # Deploy to parent directory
51
- success, message = generator.deploy_to_parent(Path('/parent/dir'))
52
-
53
- # Update a section
54
- generator.update_section('agents', 'Custom agents content')
55
-
56
- # Add custom section
57
- generator.add_custom_section('custom', 'Custom content', after='agents')
58
- ```
59
-
60
- ## Design Benefits
61
-
62
- 1. **Modularity**: Each concern is separated into its own module
63
- 2. **Maintainability**: Smaller, focused modules are easier to understand and modify
64
- 3. **Testability**: Individual components can be tested in isolation
65
- 4. **Extensibility**: New section generators can be added easily
66
- 5. **Performance**: Section generators are loaded on demand
67
- 6. **Backward Compatibility**: Original API preserved through facade pattern
68
-
69
- ## Section Generator Pattern
70
-
71
- To add a new section generator:
72
-
73
- 1. Create a new file in `section_generators/`
74
- 2. Inherit from `BaseSectionGenerator`
75
- 3. Implement the `generate()` method
76
- 4. Register in `section_generators/__init__.py`
77
-
78
- Example:
79
- ```python
80
- from . import BaseSectionGenerator
81
-
82
- class CustomSectionGenerator(BaseSectionGenerator):
83
- def generate(self, data: Dict[str, Any]) -> str:
84
- return "## Custom Section\n\nContent here..."
85
- ```
86
-
87
- ## Refactoring Summary
88
-
89
- - **Original**: 1,267 lines in a single file
90
- - **Refactored**: ~250 lines in main module + well-organized submodules
91
- - **Total line reduction**: Main module reduced by 80%
92
- - **Improved organization**: 13 focused modules instead of 1 large file
@@ -1 +0,0 @@
1
- 0.9.0