@agentic15.com/agentic15-claude-zen 4.0.2 ā 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 -331
- package/src/cli/UpgradeCommand.js +191 -189
- package/src/core/TemplateManager.js +0 -8
- package/templates/.claude/hooks/session-start-context.js +131 -128
- package/templates/.claude/settings.json +1 -81
- package/templates/package.json +1 -16
- package/templates/.babelrc +0 -6
- package/templates/.claude/hooks/post-merge.js +0 -163
- package/templates/.claude/hooks/validate-git-workflow.js +0 -74
- package/templates/__mocks__/fileMock.js +0 -9
- package/templates/jest.config.js +0 -48
- package/templates/jest.setup.js +0 -13
|
@@ -1,189 +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(' -
|
|
77
|
-
console.log('
|
|
78
|
-
console.log('
|
|
79
|
-
|
|
80
|
-
console.log('
|
|
81
|
-
console.log('
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
'hooks/
|
|
123
|
-
'hooks/
|
|
124
|
-
'hooks/
|
|
125
|
-
'
|
|
126
|
-
'
|
|
127
|
-
'
|
|
128
|
-
'
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
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
|
+
}
|
|
@@ -66,14 +66,6 @@ export class TemplateManager {
|
|
|
66
66
|
// Copy scripts directory
|
|
67
67
|
this.copyDirectory('scripts', targetDir);
|
|
68
68
|
|
|
69
|
-
// Copy Jest configuration files
|
|
70
|
-
this.copySingleFile('jest.config.js', targetDir);
|
|
71
|
-
this.copySingleFile('jest.setup.js', targetDir);
|
|
72
|
-
this.copySingleFile('.babelrc', targetDir);
|
|
73
|
-
|
|
74
|
-
// Copy __mocks__ directory
|
|
75
|
-
this.copyDirectory('__mocks__', targetDir);
|
|
76
|
-
|
|
77
69
|
console.log('ā
Framework structure created');
|
|
78
70
|
console.log('ā
Templates copied');
|
|
79
71
|
console.log('ā
Configuration files generated');
|