@agentic15.com/agentic15-claude-zen 4.0.3 → 4.0.4
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.
- package/package.json +1 -1
- package/src/cli/CommitCommand.js +316 -316
- package/src/cli/UpgradeCommand.js +191 -192
- package/templates/.claude/hooks/session-start-context.js +131 -128
- package/templates/.claude/settings.json +1 -81
- package/templates/.claude/hooks/post-merge.js +0 -163
- package/templates/.claude/hooks/validate-git-workflow.js +0 -74
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"ask": [
|
|
19
19
|
"Edit(./package.json)",
|
|
20
20
|
"Edit(./tsconfig.json)",
|
|
21
|
-
"Edit(./jest.config.*)",
|
|
22
21
|
"Write(./config/**)"
|
|
23
22
|
],
|
|
24
23
|
"deny": [
|
|
@@ -59,7 +58,6 @@
|
|
|
59
58
|
"Bash(node ./Agent/db/**)",
|
|
60
59
|
"Bash(bash ./scripts/**)",
|
|
61
60
|
"Bash(sh ./scripts/**)",
|
|
62
|
-
"Bash(git checkout -b:*)",
|
|
63
61
|
"WebFetch",
|
|
64
62
|
"WebSearch"
|
|
65
63
|
]
|
|
@@ -84,64 +82,6 @@
|
|
|
84
82
|
"repo": null,
|
|
85
83
|
"comment": "GitHub Issues integration. Configure in .claude/settings.local.json or via environment variables (GITHUB_TOKEN, GITHUB_OWNER, GITHUB_REPO). Owner/repo auto-detected from git remote if not set."
|
|
86
84
|
},
|
|
87
|
-
"testing": {
|
|
88
|
-
"ui": {
|
|
89
|
-
"strictMode": true,
|
|
90
|
-
"requireTestFile": true,
|
|
91
|
-
"requireImport": true,
|
|
92
|
-
"requireRender": true,
|
|
93
|
-
"requireProps": true,
|
|
94
|
-
"requireEventTests": true,
|
|
95
|
-
"requireApiMocking": true,
|
|
96
|
-
"requireStateTests": true,
|
|
97
|
-
"requireFormTests": true,
|
|
98
|
-
"requireConditionalTests": true,
|
|
99
|
-
"requireIntegrationSite": true,
|
|
100
|
-
"integrationSiteDir": "test-site",
|
|
101
|
-
"conditionalThreshold": 3,
|
|
102
|
-
"requireVisualCheck": true,
|
|
103
|
-
"requireContract": false,
|
|
104
|
-
"comment": "⚠️ ALL UI testing requirements are HARD REQUIREMENTS (cannot be disabled). Commits will be blocked if any requirement is violated."
|
|
105
|
-
},
|
|
106
|
-
"visual": {
|
|
107
|
-
"enabled": true,
|
|
108
|
-
"strictMode": false,
|
|
109
|
-
"autoApprove": false,
|
|
110
|
-
"requireBaseline": true,
|
|
111
|
-
"pixelMatchThreshold": 0.1,
|
|
112
|
-
"diffThreshold": 1.0,
|
|
113
|
-
"browsers": ["chromium"],
|
|
114
|
-
"viewports": [
|
|
115
|
-
{
|
|
116
|
-
"name": "desktop",
|
|
117
|
-
"width": 1920,
|
|
118
|
-
"height": 1080,
|
|
119
|
-
"deviceScaleFactor": 1
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
"name": "tablet",
|
|
123
|
-
"width": 768,
|
|
124
|
-
"height": 1024,
|
|
125
|
-
"deviceScaleFactor": 2
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
"name": "mobile",
|
|
129
|
-
"width": 375,
|
|
130
|
-
"height": 667,
|
|
131
|
-
"deviceScaleFactor": 2
|
|
132
|
-
}
|
|
133
|
-
],
|
|
134
|
-
"excludePatterns": [
|
|
135
|
-
"**/node_modules/**",
|
|
136
|
-
"**/dist/**",
|
|
137
|
-
"**/build/**"
|
|
138
|
-
],
|
|
139
|
-
"baselineDir": ".claude/visual-baselines",
|
|
140
|
-
"diffDir": ".claude/visual-diffs",
|
|
141
|
-
"tempDir": ".claude/visual-temp",
|
|
142
|
-
"comment": "Visual regression testing configuration. Triggers on UI component changes (.tsx, .jsx, .vue, .svelte). Set enabled:false to disable."
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
85
|
"hooks": {
|
|
146
86
|
"SessionStart": [
|
|
147
87
|
{
|
|
@@ -165,33 +105,13 @@
|
|
|
165
105
|
]
|
|
166
106
|
},
|
|
167
107
|
{
|
|
168
|
-
"matcher": "
|
|
108
|
+
"matcher": "Write(./.claude/PROJECT-PLAN.json)",
|
|
169
109
|
"hooks": [
|
|
170
110
|
{
|
|
171
111
|
"type": "command",
|
|
172
112
|
"command": "node .claude/hooks/enforce-plan-template.js"
|
|
173
113
|
}
|
|
174
114
|
]
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
"matcher": "Bash",
|
|
178
|
-
"hooks": [
|
|
179
|
-
{
|
|
180
|
-
"type": "command",
|
|
181
|
-
"command": "node .claude/hooks/validate-git-workflow.js"
|
|
182
|
-
}
|
|
183
|
-
]
|
|
184
|
-
}
|
|
185
|
-
],
|
|
186
|
-
"PostToolUse": [
|
|
187
|
-
{
|
|
188
|
-
"matcher": "Bash(git:*)",
|
|
189
|
-
"hooks": [
|
|
190
|
-
{
|
|
191
|
-
"type": "command",
|
|
192
|
-
"command": "node .claude/hooks/post-merge.js"
|
|
193
|
-
}
|
|
194
|
-
]
|
|
195
115
|
}
|
|
196
116
|
]
|
|
197
117
|
}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Copyright 2024-2025 agentic15.com
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Post-Merge Hook - Close GitHub issues when merged to main
|
|
21
|
-
*
|
|
22
|
-
* This git hook runs after: git merge, git pull
|
|
23
|
-
* Detects: Task IDs in commit messages
|
|
24
|
-
* Action: Close associated GitHub issues
|
|
25
|
-
*
|
|
26
|
-
* IMPORTANT: This is a traditional git hook that must be installed in .git/hooks/
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
import fs from 'fs';
|
|
30
|
-
import path from 'path';
|
|
31
|
-
import { execSync } from 'child_process';
|
|
32
|
-
|
|
33
|
-
// Import GitHub integration classes
|
|
34
|
-
let GitHubClient, GitHubConfig;
|
|
35
|
-
try {
|
|
36
|
-
const { GitHubClient: GHClient } = await import('@agentic15.com/agentic15-claude-zen/src/core/GitHubClient.js');
|
|
37
|
-
const { GitHubConfig: GHConfig } = await import('@agentic15.com/agentic15-claude-zen/src/core/GitHubConfig.js');
|
|
38
|
-
|
|
39
|
-
GitHubClient = GHClient;
|
|
40
|
-
GitHubConfig = GHConfig;
|
|
41
|
-
} catch (error) {
|
|
42
|
-
// GitHub integration not available yet (framework not installed or old version)
|
|
43
|
-
// Hook will exit silently
|
|
44
|
-
process.exit(0);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Main execution
|
|
49
|
-
*/
|
|
50
|
-
async function main() {
|
|
51
|
-
const projectRoot = process.cwd();
|
|
52
|
-
|
|
53
|
-
// Check if we're on main branch
|
|
54
|
-
try {
|
|
55
|
-
const currentBranch = execSync('git rev-parse --abbrev-ref HEAD', {
|
|
56
|
-
encoding: 'utf8'
|
|
57
|
-
}).trim();
|
|
58
|
-
|
|
59
|
-
if (currentBranch !== 'main' && currentBranch !== 'master') {
|
|
60
|
-
// Not on main, skip
|
|
61
|
-
process.exit(0);
|
|
62
|
-
}
|
|
63
|
-
} catch (error) {
|
|
64
|
-
// Could not detect current branch, skip
|
|
65
|
-
process.exit(0);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Load GitHub config
|
|
69
|
-
const githubConfig = new GitHubConfig(projectRoot);
|
|
70
|
-
|
|
71
|
-
if (!githubConfig.isAutoCloseEnabled()) {
|
|
72
|
-
// Auto-close not enabled, skip
|
|
73
|
-
process.exit(0);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Get commits from the merge
|
|
77
|
-
let mergeCommits;
|
|
78
|
-
try {
|
|
79
|
-
mergeCommits = execSync('git log ORIG_HEAD..HEAD --oneline', {
|
|
80
|
-
encoding: 'utf8'
|
|
81
|
-
}).trim();
|
|
82
|
-
|
|
83
|
-
if (!mergeCommits) {
|
|
84
|
-
// No commits in merge, skip
|
|
85
|
-
process.exit(0);
|
|
86
|
-
}
|
|
87
|
-
} catch (error) {
|
|
88
|
-
// Could not get merge commits, skip
|
|
89
|
-
process.exit(0);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Extract task IDs from commit messages
|
|
93
|
-
// Matches: [TASK-001], TASK-001, [task-001], task-001
|
|
94
|
-
const taskIds = new Set();
|
|
95
|
-
const taskIdRegex = /\[?(TASK-\d+)\]?/gi;
|
|
96
|
-
|
|
97
|
-
for (const match of mergeCommits.matchAll(taskIdRegex)) {
|
|
98
|
-
taskIds.add(match[1].toUpperCase());
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (taskIds.size === 0) {
|
|
102
|
-
// No task IDs found in merge commits
|
|
103
|
-
process.exit(0);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Load active plan to get task-to-issue mappings
|
|
107
|
-
const activePlanPath = path.join(projectRoot, '.claude', 'ACTIVE-PLAN');
|
|
108
|
-
if (!fs.existsSync(activePlanPath)) {
|
|
109
|
-
// No active plan, skip
|
|
110
|
-
process.exit(0);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const activePlan = fs.readFileSync(activePlanPath, 'utf8').trim();
|
|
114
|
-
const planDir = path.join(projectRoot, '.claude', 'plans', activePlan);
|
|
115
|
-
|
|
116
|
-
// Initialize GitHub client
|
|
117
|
-
const { owner, repo } = githubConfig.getRepoInfo();
|
|
118
|
-
const githubClient = new GitHubClient(
|
|
119
|
-
githubConfig.getToken(),
|
|
120
|
-
owner,
|
|
121
|
-
repo
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
if (!githubClient.isConfigured()) {
|
|
125
|
-
// GitHub not configured, skip
|
|
126
|
-
process.exit(0);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Close issues for each task
|
|
130
|
-
let closedCount = 0;
|
|
131
|
-
for (const taskId of taskIds) {
|
|
132
|
-
const taskFile = path.join(planDir, 'tasks', `${taskId}.json`);
|
|
133
|
-
|
|
134
|
-
if (!fs.existsSync(taskFile)) {
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
const taskData = JSON.parse(fs.readFileSync(taskFile, 'utf8'));
|
|
139
|
-
|
|
140
|
-
// Only close issue if task is completed and has associated GitHub issue
|
|
141
|
-
if (taskData.githubIssue && taskData.status === 'completed') {
|
|
142
|
-
const comment = `Merged to main branch! 🎉\n\nTask ${taskId} has been successfully integrated.`;
|
|
143
|
-
const success = await githubClient.closeIssue(taskData.githubIssue, comment);
|
|
144
|
-
|
|
145
|
-
if (success) {
|
|
146
|
-
console.log(`✓ Closed GitHub issue #${taskData.githubIssue} for ${taskId}`);
|
|
147
|
-
closedCount++;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (closedCount > 0) {
|
|
153
|
-
console.log(`\n✅ Closed ${closedCount} GitHub issue${closedCount > 1 ? 's' : ''} after merge to main`);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
process.exit(0);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
main().catch(error => {
|
|
160
|
-
// Don't block the merge on errors
|
|
161
|
-
console.warn('⚠ Post-merge hook encountered an error:', error.message);
|
|
162
|
-
process.exit(0);
|
|
163
|
-
});
|
|
@@ -1,74 +0,0 @@
|
|
|
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);
|