@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
|
@@ -1,192 +1,191 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2024-2025 agentic15.com
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { existsSync, mkdirSync, copyFileSync, readdirSync, statSync, readFileSync, writeFileSync, unlinkSync, rmdirSync } from 'fs';
|
|
18
|
-
import { join, dirname } from 'path';
|
|
19
|
-
import { fileURLToPath } from 'url';
|
|
20
|
-
|
|
21
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
22
|
-
const __dirname = dirname(__filename);
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* UpgradeCommand - Updates framework files in existing projects
|
|
26
|
-
*
|
|
27
|
-
* Upgrades .claude/ framework files while preserving:
|
|
28
|
-
* - User code (Agent/src, Agent/tests)
|
|
29
|
-
* - Active plans (.claude/plans, .claude/ACTIVE-PLAN)
|
|
30
|
-
* - Local settings (.claude/settings.local.json)
|
|
31
|
-
*/
|
|
32
|
-
export class UpgradeCommand {
|
|
33
|
-
static execute() {
|
|
34
|
-
console.log('\n' + 'ā'.repeat(70));
|
|
35
|
-
console.log('š Agentic15 Claude Zen - Framework Upgrade');
|
|
36
|
-
console.log('ā'.repeat(70) + '\n');
|
|
37
|
-
|
|
38
|
-
// Verify we're in a project directory
|
|
39
|
-
if (!existsSync('.claude')) {
|
|
40
|
-
console.log('ā Not in an Agentic15 project directory');
|
|
41
|
-
console.log(' Run this command from your project root (where .claude/ exists)\n');
|
|
42
|
-
process.exit(1);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Get current and package versions
|
|
46
|
-
const currentVersion = this.getCurrentVersion();
|
|
47
|
-
const packageVersion = this.getPackageVersion();
|
|
48
|
-
|
|
49
|
-
console.log(`š¦ Current framework version: ${currentVersion || 'unknown'}`);
|
|
50
|
-
console.log(`š¦ Package version: ${packageVersion}\n`);
|
|
51
|
-
|
|
52
|
-
// Backup current .claude directory
|
|
53
|
-
console.log('š Creating backup...');
|
|
54
|
-
this.createBackup();
|
|
55
|
-
|
|
56
|
-
try {
|
|
57
|
-
// Update framework files
|
|
58
|
-
console.log('š Updating framework files...\n');
|
|
59
|
-
this.updateFrameworkFiles();
|
|
60
|
-
|
|
61
|
-
// Update version file
|
|
62
|
-
this.updateVersionFile(packageVersion);
|
|
63
|
-
|
|
64
|
-
console.log('\nā
Upgrade completed successfully!\n');
|
|
65
|
-
console.log('š What was updated:');
|
|
66
|
-
console.log(' - .claude/hooks/ (git hooks)');
|
|
67
|
-
console.log(' - .claude/settings.json (framework settings)');
|
|
68
|
-
console.log(' - .claude/PLAN-SCHEMA.json (plan structure)');
|
|
69
|
-
console.log(' - .claude/PROJECT-PLAN-TEMPLATE.json (plan template)');
|
|
70
|
-
console.log(' - .claude/POST-INSTALL.md (documentation)\n');
|
|
71
|
-
console.log('š What was preserved:');
|
|
72
|
-
console.log(' - .claude/plans/ (your project plans)');
|
|
73
|
-
console.log(' - .claude/ACTIVE-PLAN (current plan)');
|
|
74
|
-
console.log(' - .claude/settings.local.json (local settings)');
|
|
75
|
-
console.log(' - Agent/ (your source code)');
|
|
76
|
-
console.log(' - scripts/ (your scripts)');
|
|
77
|
-
console.log(' - test-site/ (your test site)');
|
|
78
|
-
console.log(' - package.json (your project config)');
|
|
79
|
-
console.log(' - README.md (your documentation)\n');
|
|
80
|
-
console.log('š¾ Backup location: .claude.backup/\n');
|
|
81
|
-
console.log('ā'.repeat(70) + '\n');
|
|
82
|
-
} catch (error) {
|
|
83
|
-
console.log('\nā Upgrade failed:', error.message);
|
|
84
|
-
console.log(' Your original files are backed up in .claude.backup/');
|
|
85
|
-
console.log(' To restore: rm -rf .claude && mv .claude.backup .claude\n');
|
|
86
|
-
process.exit(1);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
static getCurrentVersion() {
|
|
91
|
-
const versionFile = join('.claude', '.framework-version');
|
|
92
|
-
if (existsSync(versionFile)) {
|
|
93
|
-
return readFileSync(versionFile, 'utf-8').trim();
|
|
94
|
-
}
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
static getPackageVersion() {
|
|
99
|
-
const packageJsonPath = join(__dirname, '..', '..', 'package.json');
|
|
100
|
-
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
101
|
-
return packageJson.version;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
static createBackup() {
|
|
105
|
-
const backupDir = '.claude.backup';
|
|
106
|
-
|
|
107
|
-
// Remove old backup if exists
|
|
108
|
-
if (existsSync(backupDir)) {
|
|
109
|
-
this.removeDirectory(backupDir);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Copy entire .claude directory
|
|
113
|
-
this.copyDirectory('.claude', backupDir);
|
|
114
|
-
console.log(' ā Backup created at .claude.backup/\n');
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
static updateFrameworkFiles() {
|
|
118
|
-
const templatesDir = join(__dirname, '..', '..', 'templates', '.claude');
|
|
119
|
-
|
|
120
|
-
// Files to update (framework files only)
|
|
121
|
-
const filesToUpdate = [
|
|
122
|
-
'hooks/complete-task.js',
|
|
123
|
-
'hooks/enforce-plan-template.js',
|
|
124
|
-
'hooks/
|
|
125
|
-
'hooks/session-start-context.js',
|
|
126
|
-
'hooks/start-task.js',
|
|
127
|
-
'
|
|
128
|
-
'PLAN-
|
|
129
|
-
'
|
|
130
|
-
'
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2024-2025 agentic15.com
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { existsSync, mkdirSync, copyFileSync, readdirSync, statSync, readFileSync, writeFileSync, unlinkSync, rmdirSync } from 'fs';
|
|
18
|
+
import { join, dirname } from 'path';
|
|
19
|
+
import { fileURLToPath } from 'url';
|
|
20
|
+
|
|
21
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
22
|
+
const __dirname = dirname(__filename);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* UpgradeCommand - Updates framework files in existing projects
|
|
26
|
+
*
|
|
27
|
+
* Upgrades .claude/ framework files while preserving:
|
|
28
|
+
* - User code (Agent/src, Agent/tests)
|
|
29
|
+
* - Active plans (.claude/plans, .claude/ACTIVE-PLAN)
|
|
30
|
+
* - Local settings (.claude/settings.local.json)
|
|
31
|
+
*/
|
|
32
|
+
export class UpgradeCommand {
|
|
33
|
+
static execute() {
|
|
34
|
+
console.log('\n' + 'ā'.repeat(70));
|
|
35
|
+
console.log('š Agentic15 Claude Zen - Framework Upgrade');
|
|
36
|
+
console.log('ā'.repeat(70) + '\n');
|
|
37
|
+
|
|
38
|
+
// Verify we're in a project directory
|
|
39
|
+
if (!existsSync('.claude')) {
|
|
40
|
+
console.log('ā Not in an Agentic15 project directory');
|
|
41
|
+
console.log(' Run this command from your project root (where .claude/ exists)\n');
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Get current and package versions
|
|
46
|
+
const currentVersion = this.getCurrentVersion();
|
|
47
|
+
const packageVersion = this.getPackageVersion();
|
|
48
|
+
|
|
49
|
+
console.log(`š¦ Current framework version: ${currentVersion || 'unknown'}`);
|
|
50
|
+
console.log(`š¦ Package version: ${packageVersion}\n`);
|
|
51
|
+
|
|
52
|
+
// Backup current .claude directory
|
|
53
|
+
console.log('š Creating backup...');
|
|
54
|
+
this.createBackup();
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
// Update framework files
|
|
58
|
+
console.log('š Updating framework files...\n');
|
|
59
|
+
this.updateFrameworkFiles();
|
|
60
|
+
|
|
61
|
+
// Update version file
|
|
62
|
+
this.updateVersionFile(packageVersion);
|
|
63
|
+
|
|
64
|
+
console.log('\nā
Upgrade completed successfully!\n');
|
|
65
|
+
console.log('š What was updated:');
|
|
66
|
+
console.log(' - .claude/hooks/ (git hooks)');
|
|
67
|
+
console.log(' - .claude/settings.json (framework settings)');
|
|
68
|
+
console.log(' - .claude/PLAN-SCHEMA.json (plan structure)');
|
|
69
|
+
console.log(' - .claude/PROJECT-PLAN-TEMPLATE.json (plan template)');
|
|
70
|
+
console.log(' - .claude/POST-INSTALL.md (documentation)\n');
|
|
71
|
+
console.log('š What was preserved:');
|
|
72
|
+
console.log(' - .claude/plans/ (your project plans)');
|
|
73
|
+
console.log(' - .claude/ACTIVE-PLAN (current plan)');
|
|
74
|
+
console.log(' - .claude/settings.local.json (local settings)');
|
|
75
|
+
console.log(' - Agent/ (your source code)');
|
|
76
|
+
console.log(' - scripts/ (your scripts)');
|
|
77
|
+
console.log(' - test-site/ (your test site)');
|
|
78
|
+
console.log(' - package.json (your project config)');
|
|
79
|
+
console.log(' - README.md (your documentation)\n');
|
|
80
|
+
console.log('š¾ Backup location: .claude.backup/\n');
|
|
81
|
+
console.log('ā'.repeat(70) + '\n');
|
|
82
|
+
} catch (error) {
|
|
83
|
+
console.log('\nā Upgrade failed:', error.message);
|
|
84
|
+
console.log(' Your original files are backed up in .claude.backup/');
|
|
85
|
+
console.log(' To restore: rm -rf .claude && mv .claude.backup .claude\n');
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
static getCurrentVersion() {
|
|
91
|
+
const versionFile = join('.claude', '.framework-version');
|
|
92
|
+
if (existsSync(versionFile)) {
|
|
93
|
+
return readFileSync(versionFile, 'utf-8').trim();
|
|
94
|
+
}
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
static getPackageVersion() {
|
|
99
|
+
const packageJsonPath = join(__dirname, '..', '..', 'package.json');
|
|
100
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
101
|
+
return packageJson.version;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
static createBackup() {
|
|
105
|
+
const backupDir = '.claude.backup';
|
|
106
|
+
|
|
107
|
+
// Remove old backup if exists
|
|
108
|
+
if (existsSync(backupDir)) {
|
|
109
|
+
this.removeDirectory(backupDir);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Copy entire .claude directory
|
|
113
|
+
this.copyDirectory('.claude', backupDir);
|
|
114
|
+
console.log(' ā Backup created at .claude.backup/\n');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static updateFrameworkFiles() {
|
|
118
|
+
const templatesDir = join(__dirname, '..', '..', 'templates', '.claude');
|
|
119
|
+
|
|
120
|
+
// Files to update (framework files only)
|
|
121
|
+
const filesToUpdate = [
|
|
122
|
+
'hooks/complete-task.js',
|
|
123
|
+
'hooks/enforce-plan-template.js',
|
|
124
|
+
'hooks/require-active-task.js',
|
|
125
|
+
'hooks/session-start-context.js',
|
|
126
|
+
'hooks/start-task.js',
|
|
127
|
+
'PLAN-SCHEMA.json',
|
|
128
|
+
'PROJECT-PLAN-TEMPLATE.json',
|
|
129
|
+
'POST-INSTALL.md',
|
|
130
|
+
'settings.json'
|
|
131
|
+
];
|
|
132
|
+
|
|
133
|
+
// Ensure hooks directory exists
|
|
134
|
+
const hooksDir = join('.claude', 'hooks');
|
|
135
|
+
if (!existsSync(hooksDir)) {
|
|
136
|
+
mkdirSync(hooksDir, { recursive: true });
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Copy framework files
|
|
140
|
+
filesToUpdate.forEach(file => {
|
|
141
|
+
const sourcePath = join(templatesDir, file);
|
|
142
|
+
const destPath = join('.claude', file);
|
|
143
|
+
|
|
144
|
+
if (existsSync(sourcePath)) {
|
|
145
|
+
copyFileSync(sourcePath, destPath);
|
|
146
|
+
console.log(` ā Updated ${file}`);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
static updateVersionFile(version) {
|
|
152
|
+
const versionFile = join('.claude', '.framework-version');
|
|
153
|
+
writeFileSync(versionFile, version);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
static copyDirectory(src, dest) {
|
|
157
|
+
if (!existsSync(dest)) {
|
|
158
|
+
mkdirSync(dest, { recursive: true });
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const entries = readdirSync(src, { withFileTypes: true });
|
|
162
|
+
|
|
163
|
+
for (const entry of entries) {
|
|
164
|
+
const srcPath = join(src, entry.name);
|
|
165
|
+
const destPath = join(dest, entry.name);
|
|
166
|
+
|
|
167
|
+
if (entry.isDirectory()) {
|
|
168
|
+
this.copyDirectory(srcPath, destPath);
|
|
169
|
+
} else {
|
|
170
|
+
copyFileSync(srcPath, destPath);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
static removeDirectory(dir) {
|
|
176
|
+
if (existsSync(dir)) {
|
|
177
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
178
|
+
|
|
179
|
+
for (const entry of entries) {
|
|
180
|
+
const fullPath = join(dir, entry.name);
|
|
181
|
+
if (entry.isDirectory()) {
|
|
182
|
+
this.removeDirectory(fullPath);
|
|
183
|
+
} else {
|
|
184
|
+
unlinkSync(fullPath);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
rmdirSync(dir);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
@@ -1,128 +1,131 @@
|
|
|
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('šÆ
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
log(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
log(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
log('
|
|
84
|
-
log('
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
log('
|
|
91
|
-
log('
|
|
92
|
-
log('
|
|
93
|
-
log('
|
|
94
|
-
log('
|
|
95
|
-
log('
|
|
96
|
-
log('
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
console.log('ā'.repeat(70));
|
|
101
|
-
log('
|
|
102
|
-
log('
|
|
103
|
-
log('
|
|
104
|
-
log(' ./
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
log('
|
|
108
|
-
|
|
109
|
-
log('
|
|
110
|
-
log(' npx agentic15
|
|
111
|
-
log(' npx agentic15
|
|
112
|
-
log(' npx agentic15
|
|
113
|
-
log(' npx agentic15
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
log('
|
|
117
|
-
|
|
118
|
-
log('
|
|
119
|
-
log('
|
|
120
|
-
log('
|
|
121
|
-
log(' ā¢
|
|
122
|
-
log(' ā¢
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
log('
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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('šÆ AGENTIC15-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
|
+
// Find task with in_progress status
|
|
60
|
+
const inProgressTask = tracker.taskFiles.find(t => t.status === 'in_progress');
|
|
61
|
+
|
|
62
|
+
if (inProgressTask) {
|
|
63
|
+
const taskFile = path.join(planDir, 'tasks', `${inProgressTask.id}.json`);
|
|
64
|
+
if (fs.existsSync(taskFile)) {
|
|
65
|
+
const task = JSON.parse(fs.readFileSync(taskFile, 'utf8'));
|
|
66
|
+
log(`\n š TASK IN PROGRESS: ${inProgressTask.id}`, 'yellow');
|
|
67
|
+
log(` Title: ${task.title}`, 'yellow');
|
|
68
|
+
log(` Description: ${task.description}`, 'yellow');
|
|
69
|
+
log(`\n ā ļø COMPLETE THIS TASK FIRST: npx agentic15 commit`, 'red');
|
|
70
|
+
}
|
|
71
|
+
} else {
|
|
72
|
+
log('\n ā No task in progress - start next:', 'yellow');
|
|
73
|
+
log(' npx agentic15 task next', 'yellow');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Show progress
|
|
77
|
+
const stats = tracker.statistics;
|
|
78
|
+
log(`\n Progress: ${stats.completed}/${stats.totalTasks} tasks complete`, 'cyan');
|
|
79
|
+
log(` In Progress: ${stats.inProgress}`, 'cyan');
|
|
80
|
+
log(` Pending: ${stats.pending}`, 'cyan');
|
|
81
|
+
|
|
82
|
+
} else {
|
|
83
|
+
log('ā NO ACTIVE PROJECT PLAN', 'red');
|
|
84
|
+
log('\n You MUST work within the agentic15-claude-zen framework.', 'yellow');
|
|
85
|
+
log(' Initialize the plan and start execution:', 'yellow');
|
|
86
|
+
log(' npx agentic15 plan', 'yellow');
|
|
87
|
+
log(' npx agentic15 task next\n', 'yellow');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
console.log('ā'.repeat(70));
|
|
91
|
+
log('š MANDATORY WORKFLOW RULES - NO EXCEPTIONS:', 'bold');
|
|
92
|
+
console.log('ā'.repeat(70));
|
|
93
|
+
log(' 1. NO work without active plan + task', 'cyan');
|
|
94
|
+
log(' 2. ONE task at a time - complete before starting next', 'cyan');
|
|
95
|
+
log(' 3. Edit ONLY ./Agent/** and ./scripts/** directories', 'cyan');
|
|
96
|
+
log(' 4. Commit workflow: stage ā commit ā push ā PR', 'cyan');
|
|
97
|
+
log(' 5. Use feature branches (feature/task-xxx)', 'cyan');
|
|
98
|
+
log(' 6. Testing is optional - structure, not enforcement', '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
|
+
|
|
107
|
+
console.log('\n' + 'ā'.repeat(70));
|
|
108
|
+
log('š AVAILABLE COMMANDS:', 'bold');
|
|
109
|
+
console.log('ā'.repeat(70));
|
|
110
|
+
log(' npx agentic15 plan # Generate and lock plan', 'cyan');
|
|
111
|
+
log(' npx agentic15 task start TASK-XXX # Start specific task', 'cyan');
|
|
112
|
+
log(' npx agentic15 task next # Start next pending task', 'cyan');
|
|
113
|
+
log(' npx agentic15 task status # View progress', 'cyan');
|
|
114
|
+
log(' npx agentic15 commit # Commit, push, create PR', 'cyan');
|
|
115
|
+
log(' npx agentic15 visual-test <url> # Capture UI screenshots', 'cyan');
|
|
116
|
+
log(' npx agentic15 upgrade # Update framework files', 'cyan');
|
|
117
|
+
|
|
118
|
+
console.log('\n' + 'ā'.repeat(70));
|
|
119
|
+
log('ā ļø CRITICAL: NEVER OFFER TO SKIP WORKFLOW STEPS', 'bold');
|
|
120
|
+
console.log('ā'.repeat(70));
|
|
121
|
+
log(' ⢠If task is in_progress, complete it first (agentic15 commit)', 'red');
|
|
122
|
+
log(' ⢠NEVER ask "continue with next task or commit first?"', 'red');
|
|
123
|
+
log(' ⢠NEVER offer options that violate one-task-at-a-time rule', 'red');
|
|
124
|
+
log(' ⢠Framework enforces workflow - follow it, do not bypass it', 'red');
|
|
125
|
+
log(' ⢠Settings should lead to ONE conclusion, not options', 'red');
|
|
126
|
+
|
|
127
|
+
console.log('\n' + 'ā'.repeat(70));
|
|
128
|
+
log('š Read .claude/POST-INSTALL.md for complete workflow details', 'bold');
|
|
129
|
+
console.log('ā'.repeat(70) + '\n');
|
|
130
|
+
|
|
131
|
+
process.exit(0);
|