@agentic15.com/agentic15-claude-zen 1.0.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 (88) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/LICENSE +201 -0
  3. package/README.md +204 -0
  4. package/bin/create-agentic15-claude-zen.js +201 -0
  5. package/dist/hooks/auto-format.js +2 -0
  6. package/dist/hooks/check-pending-reviews.js +2 -0
  7. package/dist/hooks/complete-task.js +2 -0
  8. package/dist/hooks/detect-pending-reviews.js +2 -0
  9. package/dist/hooks/enforce-hard-requirements.js +2 -0
  10. package/dist/hooks/enforce-migration-workflow.js +2 -0
  11. package/dist/hooks/enforce-plan-template.js +2 -0
  12. package/dist/hooks/enforce-structured-development.js +2 -0
  13. package/dist/hooks/enforce-test-pyramid.js +2 -0
  14. package/dist/hooks/init-task-tracker.js +2 -0
  15. package/dist/hooks/performance-cache.js +2 -0
  16. package/dist/hooks/prevent-read-bypass.js +2 -0
  17. package/dist/hooks/session-start-context.js +2 -0
  18. package/dist/hooks/start-task.js +2 -0
  19. package/dist/hooks/task-status.js +2 -0
  20. package/dist/hooks/validate-component-contract.js +2 -0
  21. package/dist/hooks/validate-database-changes.js +2 -0
  22. package/dist/hooks/validate-e2e-coverage.js +2 -0
  23. package/dist/hooks/validate-git-workflow.js +2 -0
  24. package/dist/hooks/validate-integration-site.js +2 -0
  25. package/dist/hooks/validate-migration-impact.js +2 -0
  26. package/dist/hooks/validate-task-completion.js +2 -0
  27. package/dist/hooks/validate-test-quality.js +2 -0
  28. package/dist/hooks/validate-test-results.js +2 -0
  29. package/dist/hooks/validate-ui-integration.js +2 -0
  30. package/dist/hooks/validate-ui-runtime.js +2 -0
  31. package/dist/hooks/validate-ui-syntax.js +2 -0
  32. package/dist/hooks/validate-ui-visual-native.js +2 -0
  33. package/dist/hooks/validate-ui-visual.js +2 -0
  34. package/dist/hooks/validate-visual-regression.js +2 -0
  35. package/dist/index.js +24 -0
  36. package/dist/index.js.map +7 -0
  37. package/dist/scripts/add-version-headers.js +2 -0
  38. package/dist/scripts/help.js +2 -0
  39. package/dist/scripts/plan-amend.js +2 -0
  40. package/dist/scripts/plan-create.js +2 -0
  41. package/dist/scripts/plan-generate.js +2 -0
  42. package/dist/scripts/plan-help.js +2 -0
  43. package/dist/scripts/plan-init.js +2 -0
  44. package/dist/scripts/plan-manager.js +2 -0
  45. package/dist/scripts/pre-publish-checklist.js +2 -0
  46. package/dist/scripts/production-test.js +2 -0
  47. package/dist/scripts/profile-hooks.js +2 -0
  48. package/dist/scripts/setup-git-hooks.js +2 -0
  49. package/dist/scripts/task-done.js +2 -0
  50. package/dist/scripts/task-merge.js +2 -0
  51. package/dist/scripts/task-next.js +2 -0
  52. package/dist/scripts/task-start.js +2 -0
  53. package/dist/scripts/task-status.js +2 -0
  54. package/dist/scripts/verify-hooks.js +2 -0
  55. package/package.json +61 -0
  56. package/src/core/DependencyInstaller.js +41 -0
  57. package/src/core/GitInitializer.js +45 -0
  58. package/src/core/HookInstaller.js +54 -0
  59. package/src/core/ProjectInitializer.js +105 -0
  60. package/src/core/TemplateManager.js +159 -0
  61. package/src/index.js +56 -0
  62. package/templates/.babelrc +6 -0
  63. package/templates/.claude/CLAUDE.md +408 -0
  64. package/templates/.claude/ONBOARDING.md +723 -0
  65. package/templates/.claude/PLAN-SCHEMA.json +240 -0
  66. package/templates/.claude/POST-INSTALL.md +248 -0
  67. package/templates/.claude/PROJECT-PLAN-TEMPLATE.json +223 -0
  68. package/templates/.claude/hooks/enforce-plan-template.js +106 -0
  69. package/templates/.claude/hooks/session-start-context.js +130 -0
  70. package/templates/.claude/hooks/validate-git-workflow.js +74 -0
  71. package/templates/.claude/settings.json +262 -0
  72. package/templates/.gitignore +14 -0
  73. package/templates/Agent/.gitkeep +3 -0
  74. package/templates/README.md +76 -0
  75. package/templates/__mocks__/fileMock.js +9 -0
  76. package/templates/jest.config.js +48 -0
  77. package/templates/jest.setup.js +13 -0
  78. package/templates/package.json +40 -0
  79. package/templates/scripts/.gitkeep +3 -0
  80. package/templates/test-site/README.md +271 -0
  81. package/templates/test-site/index.html +13 -0
  82. package/templates/test-site/package.json +25 -0
  83. package/templates/test-site/server.js +125 -0
  84. package/templates/test-site/src/App.css +130 -0
  85. package/templates/test-site/src/App.jsx +78 -0
  86. package/templates/test-site/src/index.css +39 -0
  87. package/templates/test-site/src/main.jsx +10 -0
  88. package/templates/test-site/vite.config.js +12 -0
@@ -0,0 +1,223 @@
1
+ {
2
+ "version": "2.0",
3
+ "project": {
4
+ "id": "PROJ-001",
5
+ "name": "E-commerce Platform",
6
+ "description": "Full-featured online store with payment processing",
7
+ "status": "planning",
8
+ "createdAt": "2025-12-18T00:00:00.000Z",
9
+ "createdBy": "human",
10
+ "locked": false,
11
+ "subprojects": [
12
+ {
13
+ "id": "SUB-001",
14
+ "name": "User Management System",
15
+ "description": "Authentication, authorization, and user profiles",
16
+ "status": "pending",
17
+ "dependencies": [],
18
+ "milestones": [
19
+ {
20
+ "id": "MILE-001",
21
+ "name": "Core Authentication",
22
+ "description": "Basic login/logout functionality",
23
+ "status": "pending",
24
+ "dependencies": [],
25
+ "tasks": [
26
+ {
27
+ "id": "TASK-001",
28
+ "title": "Design user database schema",
29
+ "description": "Create ERD for users, roles, sessions",
30
+ "status": "pending",
31
+ "phase": "design",
32
+ "dependencies": [],
33
+ "estimatedHours": 4,
34
+ "completionCriteria": [
35
+ "ERD diagram completed",
36
+ "Schema reviewed by team",
37
+ "Migration scripts ready"
38
+ ],
39
+ "artifacts": {
40
+ "design": ["./Agent/db/schema/users.sql"],
41
+ "code": [],
42
+ "tests": [],
43
+ "documentation": ["./docs/database-design.md"]
44
+ }
45
+ },
46
+ {
47
+ "id": "TASK-002",
48
+ "title": "Implement user registration API",
49
+ "description": "POST /api/auth/register endpoint",
50
+ "status": "pending",
51
+ "phase": "implementation",
52
+ "dependencies": ["TASK-001"],
53
+ "estimatedHours": 6,
54
+ "completionCriteria": [
55
+ "Email validation implemented",
56
+ "Password hashing with bcrypt",
57
+ "Duplicate email check",
58
+ "Returns JWT token"
59
+ ],
60
+ "testCases": [
61
+ "Valid registration succeeds",
62
+ "Invalid email rejected",
63
+ "Weak password rejected",
64
+ "Duplicate email rejected"
65
+ ],
66
+ "artifacts": {
67
+ "design": [],
68
+ "code": [
69
+ "./Agent/src/controllers/authController.js",
70
+ "./Agent/src/services/userService.js"
71
+ ],
72
+ "tests": ["./Agent/tests/auth.test.js"],
73
+ "documentation": []
74
+ }
75
+ },
76
+ {
77
+ "id": "TASK-003",
78
+ "title": "Write unit tests for registration",
79
+ "description": "Test all registration edge cases",
80
+ "status": "pending",
81
+ "phase": "testing",
82
+ "dependencies": ["TASK-002"],
83
+ "estimatedHours": 3,
84
+ "completionCriteria": [
85
+ "100% code coverage for registration",
86
+ "All edge cases tested",
87
+ "Integration tests pass"
88
+ ],
89
+ "artifacts": {
90
+ "code": [],
91
+ "tests": [
92
+ "./Agent/tests/auth.test.js",
93
+ "./Agent/tests/integration/register.test.js"
94
+ ]
95
+ }
96
+ }
97
+ ]
98
+ },
99
+ {
100
+ "id": "MILE-002",
101
+ "name": "User Profile Management",
102
+ "description": "Profile viewing and editing",
103
+ "status": "pending",
104
+ "dependencies": ["MILE-001"],
105
+ "tasks": [
106
+ {
107
+ "id": "TASK-004",
108
+ "title": "Create profile update API",
109
+ "description": "PATCH /api/users/:id endpoint",
110
+ "status": "pending",
111
+ "phase": "implementation",
112
+ "dependencies": ["TASK-003"],
113
+ "estimatedHours": 5,
114
+ "completionCriteria": [
115
+ "Can update name, email, avatar",
116
+ "Email uniqueness validated",
117
+ "Authorization checked"
118
+ ],
119
+ "artifacts": {
120
+ "code": ["./Agent/src/controllers/userController.js"],
121
+ "tests": ["./Agent/tests/userProfile.test.js"]
122
+ }
123
+ }
124
+ ]
125
+ }
126
+ ]
127
+ },
128
+ {
129
+ "id": "SUB-002",
130
+ "name": "Product Catalog System",
131
+ "description": "Product listings, search, and categories",
132
+ "status": "pending",
133
+ "dependencies": [],
134
+ "milestones": [
135
+ {
136
+ "id": "MILE-003",
137
+ "name": "Basic Product CRUD",
138
+ "description": "Create, read, update, delete products",
139
+ "status": "pending",
140
+ "dependencies": [],
141
+ "tasks": [
142
+ {
143
+ "id": "TASK-005",
144
+ "title": "Design product database schema",
145
+ "description": "Tables for products, categories, images",
146
+ "status": "pending",
147
+ "phase": "design",
148
+ "dependencies": [],
149
+ "estimatedHours": 3,
150
+ "completionCriteria": [
151
+ "Schema supports multiple categories",
152
+ "Image URLs stored properly",
153
+ "Price and inventory tracked"
154
+ ],
155
+ "artifacts": {
156
+ "design": ["./Agent/db/schema/products.sql"]
157
+ }
158
+ },
159
+ {
160
+ "id": "TASK-006",
161
+ "title": "Implement product listing API",
162
+ "description": "GET /api/products with pagination",
163
+ "status": "pending",
164
+ "phase": "implementation",
165
+ "dependencies": ["TASK-005"],
166
+ "estimatedHours": 4,
167
+ "completionCriteria": [
168
+ "Pagination works (limit/offset)",
169
+ "Filtering by category",
170
+ "Sorting by price, name, date"
171
+ ],
172
+ "artifacts": {
173
+ "code": ["./Agent/src/controllers/productController.js"],
174
+ "tests": ["./Agent/tests/products.test.js"]
175
+ }
176
+ }
177
+ ]
178
+ }
179
+ ]
180
+ },
181
+ {
182
+ "id": "SUB-003",
183
+ "name": "Shopping Cart & Checkout",
184
+ "description": "Cart management and order processing",
185
+ "status": "pending",
186
+ "dependencies": ["SUB-001", "SUB-002"],
187
+ "milestones": [
188
+ {
189
+ "id": "MILE-004",
190
+ "name": "Shopping Cart",
191
+ "description": "Add/remove/update cart items",
192
+ "status": "pending",
193
+ "dependencies": ["MILE-001", "MILE-003"],
194
+ "tasks": [
195
+ {
196
+ "id": "TASK-007",
197
+ "title": "Implement cart management",
198
+ "description": "Session-based cart for guests, DB for users",
199
+ "status": "pending",
200
+ "phase": "implementation",
201
+ "dependencies": ["TASK-002", "TASK-006"],
202
+ "estimatedHours": 8,
203
+ "completionCriteria": [
204
+ "Add items to cart",
205
+ "Update quantities",
206
+ "Calculate totals",
207
+ "Persist cart for logged-in users"
208
+ ],
209
+ "artifacts": {
210
+ "code": [
211
+ "./Agent/src/services/cartService.js",
212
+ "./Agent/src/controllers/cartController.js"
213
+ ],
214
+ "tests": ["./Agent/tests/cart.test.js"]
215
+ }
216
+ }
217
+ ]
218
+ }
219
+ ]
220
+ }
221
+ ]
222
+ }
223
+ }
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Enforce Plan Template Hook
5
+ *
6
+ * CRITICAL: Blocks custom plan formats - ONLY allow official template
7
+ *
8
+ * When Claude writes PROJECT-PLAN.json, this hook validates:
9
+ * 1. Plan follows PLAN-SCHEMA.json structure
10
+ * 2. Has required fields: planId, projectName, structure, tasks
11
+ * 3. Tasks have proper format: id, title, description, phase, dependencies
12
+ * 4. No custom formats allowed
13
+ */
14
+
15
+ const fs = require('fs');
16
+ const path = require('path');
17
+
18
+ // Read the tool input
19
+ const input = process.argv[2] || '{}';
20
+ const toolData = JSON.parse(input);
21
+
22
+ const filePath = toolData.tool_input?.file_path;
23
+ const content = toolData.tool_input?.content;
24
+ const tool = toolData.tool;
25
+
26
+ // Only check when writing PROJECT-PLAN.json
27
+ if (tool === 'Write' && filePath && filePath.includes('PROJECT-PLAN.json')) {
28
+
29
+ let plan;
30
+ try {
31
+ plan = JSON.parse(content);
32
+ } catch (error) {
33
+ console.error('\nāŒ BLOCKED: PROJECT-PLAN.json must be valid JSON');
34
+ console.error(` Parse error: ${error.message}\n`);
35
+ process.exit(2);
36
+ }
37
+
38
+ const errors = [];
39
+
40
+ // Required top-level fields
41
+ const requiredFields = ['planId', 'projectName', 'description', 'structure', 'tasks'];
42
+ for (const field of requiredFields) {
43
+ if (!plan[field]) {
44
+ errors.push(`Missing required field: ${field}`);
45
+ }
46
+ }
47
+
48
+ // Validate structure field
49
+ if (plan.structure && typeof plan.structure !== 'string') {
50
+ errors.push('Field "structure" must be "flat" or "hierarchical"');
51
+ }
52
+
53
+ // Validate tasks array
54
+ if (plan.tasks && !Array.isArray(plan.tasks)) {
55
+ errors.push('Field "tasks" must be an array');
56
+ }
57
+
58
+ // Validate each task
59
+ if (Array.isArray(plan.tasks)) {
60
+ const taskRequiredFields = ['id', 'title', 'description', 'phase', 'dependencies', 'estimatedHours'];
61
+
62
+ plan.tasks.forEach((task, index) => {
63
+ for (const field of taskRequiredFields) {
64
+ if (task[field] === undefined) {
65
+ errors.push(`Task ${task.id || index}: Missing required field "${field}"`);
66
+ }
67
+ }
68
+
69
+ // Validate task ID format
70
+ if (task.id && !task.id.match(/^TASK-\d{3}$/)) {
71
+ errors.push(`Task ${task.id || index}: Invalid ID format. Must be TASK-XXX (e.g., TASK-001)`);
72
+ }
73
+
74
+ // Validate dependencies is array
75
+ if (task.dependencies && !Array.isArray(task.dependencies)) {
76
+ errors.push(`Task ${task.id || index}: dependencies must be an array`);
77
+ }
78
+
79
+ // Validate phase
80
+ const validPhases = ['design', 'implementation', 'testing', 'deployment'];
81
+ if (task.phase && !validPhases.includes(task.phase)) {
82
+ errors.push(`Task ${task.id || index}: Invalid phase "${task.phase}". Must be one of: ${validPhases.join(', ')}`);
83
+ }
84
+ });
85
+ }
86
+
87
+ // If errors found, block
88
+ if (errors.length > 0) {
89
+ console.error('\nāŒ BLOCKED: PROJECT-PLAN.json does NOT follow template');
90
+ console.error('\n Validation errors:');
91
+ errors.forEach(err => console.error(` • ${err}`));
92
+ console.error('\n āœ… Use the official template:');
93
+ console.error(' 1. Read .claude/PLAN-SCHEMA.json for structure');
94
+ console.error(' 2. Read .claude/PROJECT-PLAN-TEMPLATE.json for format');
95
+ console.error(' 3. Follow the exact structure');
96
+ console.error('\n Required fields:');
97
+ console.error(' - planId, projectName, description, structure, tasks');
98
+ console.error(' - Each task: id (TASK-XXX), title, description, phase, dependencies, estimatedHours\n');
99
+ process.exit(2);
100
+ }
101
+
102
+ // Validation passed
103
+ console.log('āœ… PROJECT-PLAN.json follows official template');
104
+ }
105
+
106
+ process.exit(0);
@@ -0,0 +1,130 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Session Start Context Display Hook
5
+ *
6
+ * CRITICAL: Shows Claude the current context at session start
7
+ * - Active plan name and location
8
+ * - Active task ID and description
9
+ * - Project structure
10
+ * - Workflow reminder
11
+ *
12
+ * This hook FORCES Claude to acknowledge the agentic15-claude-zen workflow
13
+ */
14
+
15
+ const fs = require('fs');
16
+ const path = require('path');
17
+
18
+ function log(message, color = 'reset') {
19
+ const colors = {
20
+ reset: '\x1b[0m',
21
+ green: '\x1b[32m',
22
+ yellow: '\x1b[33m',
23
+ blue: '\x1b[34m',
24
+ cyan: '\x1b[36m',
25
+ red: '\x1b[31m',
26
+ bold: '\x1b[1m'
27
+ };
28
+ console.log(`${colors[color]}${message}${colors.reset}`);
29
+ }
30
+
31
+ // Check if active plan exists
32
+ const activePlanFile = '.claude/ACTIVE-PLAN';
33
+ let activePlan = null;
34
+ let planDir = null;
35
+ let tracker = null;
36
+ let activeTask = null;
37
+
38
+ if (fs.existsSync(activePlanFile)) {
39
+ activePlan = fs.readFileSync(activePlanFile, 'utf8').trim();
40
+ planDir = path.join('.claude/plans', activePlan);
41
+
42
+ const trackerPath = path.join(planDir, 'TASK-TRACKER.json');
43
+ if (fs.existsSync(trackerPath)) {
44
+ tracker = JSON.parse(fs.readFileSync(trackerPath, 'utf8'));
45
+ }
46
+ }
47
+
48
+ console.log('\n' + '═'.repeat(70));
49
+ log('šŸŽÆ GL-LIFE-CLAUDE-ZEN WORKFLOW - SESSION START', 'bold');
50
+ console.log('═'.repeat(70) + '\n');
51
+
52
+ // Display active context
53
+ if (activePlan && tracker) {
54
+ log('āœ… ACTIVE PROJECT CONTEXT:', 'green');
55
+ log(` Project: ${tracker.projectName}`, 'cyan');
56
+ log(` Plan: ${activePlan}`, 'cyan');
57
+ log(` Location: .claude/plans/${activePlan}/`, 'cyan');
58
+
59
+ if (tracker.activeTask) {
60
+ const taskFile = path.join(planDir, 'tasks', `${tracker.activeTask}.json`);
61
+ if (fs.existsSync(taskFile)) {
62
+ const task = JSON.parse(fs.readFileSync(taskFile, 'utf8'));
63
+ log(`\n Active Task: ${tracker.activeTask}`, 'yellow');
64
+ log(` Title: ${task.title}`, 'yellow');
65
+ log(` Status: ${task.status}`, 'yellow');
66
+ log(` Description: ${task.description}`, 'yellow');
67
+ }
68
+ } else {
69
+ log('\n āš ļø No active task - start one:', 'yellow');
70
+ log(' npm run task:next', 'yellow');
71
+ }
72
+
73
+ // Show progress
74
+ const stats = tracker.statistics;
75
+ log(`\n Progress: ${stats.completed}/${stats.totalTasks} tasks complete`, 'cyan');
76
+ log(` In Progress: ${stats.inProgress}`, 'cyan');
77
+ log(` Pending: ${stats.pending}`, 'cyan');
78
+
79
+ } else {
80
+ log('āŒ NO ACTIVE PROJECT PLAN', 'red');
81
+ log('\n You MUST work within the agentic15-claude-zen framework.', 'yellow');
82
+ log(' Create a plan first:', 'yellow');
83
+ log(' 1. npm run plan:generate "Your requirements"', 'yellow');
84
+ log(' 2. Create PROJECT-PLAN.json from requirements', 'yellow');
85
+ log(' 3. npm run plan:init', 'yellow');
86
+ log(' 4. npm run task:next\n', 'yellow');
87
+ }
88
+
89
+ console.log('─'.repeat(70));
90
+ log('šŸ“– MANDATORY WORKFLOW RULES:', 'bold');
91
+ console.log('─'.repeat(70));
92
+ log(' 1. NO work without active plan + task', 'cyan');
93
+ log(' 2. Work ONLY on main branch (no feature branches)', 'cyan');
94
+ log(' 3. Edit ONLY ./Agent/** and ./scripts/** directories', 'cyan');
95
+ log(' 4. Follow 9-step task completion checklist', 'cyan');
96
+ log(' 5. Follow TDD: write tests first, then code', 'cyan');
97
+ log(' 6. Commit with task ID: [TASK-XXX] Description', 'cyan');
98
+ log(' 7. Push regularly: git push origin main', 'cyan');
99
+
100
+ console.log('\n' + '─'.repeat(70));
101
+ log('šŸ“‚ DIRECTORY STRUCTURE:', 'bold');
102
+ console.log('─'.repeat(70));
103
+ log(' ./Agent/ # Your workspace (EDIT HERE)', 'green');
104
+ log(' ./scripts/ # Your scripts (EDIT HERE)', 'green');
105
+ log(' ./.claude/ # Framework files (READ ONLY)', 'yellow');
106
+ log(' ./node_modules/.agentic15-claude-zen/ # Bundled scripts & hooks', 'yellow');
107
+
108
+ console.log('\n' + '─'.repeat(70));
109
+ log('šŸ“‹ AVAILABLE COMMANDS:', 'bold');
110
+ console.log('─'.repeat(70));
111
+ log(' npm run plan:generate <desc> # Generate plan (non-interactive)', 'cyan');
112
+ log(' npm run plan:init # Lock plan', 'cyan');
113
+ log(' npm run task:next # Start next task', 'cyan');
114
+ log(' npm run task:status # View progress', 'cyan');
115
+ log(' npm run task:done TASK-XXX # Complete task', 'cyan');
116
+
117
+ console.log('\n' + '─'.repeat(70));
118
+ log('āš ļø ENFORCEMENT ACTIVE:', 'bold');
119
+ console.log('─'.repeat(70));
120
+ log(' • Hooks BLOCK operations that violate rules', 'red');
121
+ log(' • Permission system DENIES dangerous commands', 'red');
122
+ log(' • All work requires active task (enforced)', 'red');
123
+ log(' • Tests must pass before commit (enforced)', 'red');
124
+ log(' • Direct main branch workflow (enforced)', 'red');
125
+
126
+ console.log('\n' + '═'.repeat(70));
127
+ log('šŸ“– Read .claude/ONBOARDING.md for complete workflow details', 'bold');
128
+ console.log('═'.repeat(70) + '\n');
129
+
130
+ process.exit(0);
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require('child_process');
4
+
5
+ // Read the tool input from stdin
6
+ const input = process.argv[2] || '{}';
7
+ let toolData;
8
+ try {
9
+ toolData = JSON.parse(input);
10
+ } catch (error) {
11
+ // Invalid JSON, exit gracefully
12
+ process.exit(0);
13
+ }
14
+
15
+ const command = toolData.tool_input?.command || '';
16
+
17
+ // Only validate git commands
18
+ if (!command.includes('git')) {
19
+ process.exit(0);
20
+ }
21
+
22
+ // Get current branch
23
+ let currentBranch;
24
+ try {
25
+ currentBranch = execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore'] }).trim();
26
+ } catch (error) {
27
+ // Not in a git repo or git command failed
28
+ process.exit(0);
29
+ }
30
+
31
+ // RULE 1: BLOCK branch creation (direct main workflow only)
32
+ if (command.includes('git checkout -b') || command.includes('git branch ') && !command.includes('git branch --show-current')) {
33
+ console.error('\nāŒ BLOCKED: Branch creation is NOT allowed');
34
+ console.error(' agentic15-claude-zen uses DIRECT MAIN WORKFLOW');
35
+ console.error(' All work happens on main branch');
36
+ console.error(' Command blocked: ' + command);
37
+ console.error('\n āœ… Correct workflow:');
38
+ console.error(' git checkout main');
39
+ console.error(' # work on main');
40
+ console.error(' git commit -m "[TASK-XXX] Description"');
41
+ console.error(' git push origin main\n');
42
+ process.exit(2);
43
+ }
44
+
45
+ // RULE 2: BLOCK merges (no branching = no merging)
46
+ if (command.includes('git merge')) {
47
+ console.error('\nāŒ BLOCKED: Git merge is NOT allowed');
48
+ console.error(' agentic15-claude-zen uses DIRECT MAIN WORKFLOW');
49
+ console.error(' No branching = no merging needed');
50
+ console.error(' All work happens on main branch');
51
+ console.error('\n āœ… Correct workflow:');
52
+ console.error(' Work directly on main');
53
+ console.error(' Commit and push regularly\n');
54
+ process.exit(2);
55
+ }
56
+
57
+ // RULE 3: BLOCK commits to non-main branches
58
+ if (currentBranch !== 'main' && command.includes('git commit')) {
59
+ console.error('\nāŒ BLOCKED: Commits only allowed on main branch');
60
+ console.error(' Current branch: ' + currentBranch);
61
+ console.error(' agentic15-claude-zen requires direct main workflow');
62
+ console.error('\n āœ… Switch to main:');
63
+ console.error(' git checkout main\n');
64
+ process.exit(2);
65
+ }
66
+
67
+ // RULE 4: BLOCK force push
68
+ if (command.includes('git push --force') || command.includes('git push -f')) {
69
+ console.error('\nāŒ BLOCKED: Force push is NOT allowed');
70
+ console.error(' Never rewrite published history\n');
71
+ process.exit(2);
72
+ }
73
+
74
+ process.exit(0);