@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.
@@ -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(' - test-site/ (your test site)\n');
77
- console.log('šŸ’¾ Backup location: .claude.backup/\n');
78
- console.log('═'.repeat(70) + '\n');
79
- } catch (error) {
80
- console.log('\nāŒ Upgrade failed:', error.message);
81
- console.log(' Your original files are backed up in .claude.backup/');
82
- console.log(' To restore: rm -rf .claude && mv .claude.backup .claude\n');
83
- process.exit(1);
84
- }
85
- }
86
-
87
- static getCurrentVersion() {
88
- const versionFile = join('.claude', '.framework-version');
89
- if (existsSync(versionFile)) {
90
- return readFileSync(versionFile, 'utf-8').trim();
91
- }
92
- return null;
93
- }
94
-
95
- static getPackageVersion() {
96
- const packageJsonPath = join(__dirname, '..', '..', 'package.json');
97
- const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
98
- return packageJson.version;
99
- }
100
-
101
- static createBackup() {
102
- const backupDir = '.claude.backup';
103
-
104
- // Remove old backup if exists
105
- if (existsSync(backupDir)) {
106
- this.removeDirectory(backupDir);
107
- }
108
-
109
- // Copy entire .claude directory
110
- this.copyDirectory('.claude', backupDir);
111
- console.log(' āœ“ Backup created at .claude.backup/\n');
112
- }
113
-
114
- static updateFrameworkFiles() {
115
- const templatesDir = join(__dirname, '..', '..', 'templates', '.claude');
116
-
117
- // Files to update (framework files only)
118
- const filesToUpdate = [
119
- 'hooks/complete-task.js',
120
- 'hooks/enforce-plan-template.js',
121
- 'hooks/post-merge.js',
122
- 'hooks/session-start-context.js',
123
- 'hooks/start-task.js',
124
- 'hooks/validate-git-workflow.js',
125
- 'PLAN-SCHEMA.json',
126
- 'PROJECT-PLAN-TEMPLATE.json',
127
- 'POST-INSTALL.md',
128
- 'settings.json'
129
- ];
130
-
131
- // Ensure hooks directory exists
132
- const hooksDir = join('.claude', 'hooks');
133
- if (!existsSync(hooksDir)) {
134
- mkdirSync(hooksDir, { recursive: true });
135
- }
136
-
137
- // Copy framework files
138
- filesToUpdate.forEach(file => {
139
- const sourcePath = join(templatesDir, file);
140
- const destPath = join('.claude', file);
141
-
142
- if (existsSync(sourcePath)) {
143
- copyFileSync(sourcePath, destPath);
144
- console.log(` āœ“ Updated ${file}`);
145
- }
146
- });
147
- }
148
-
149
- static updateVersionFile(version) {
150
- const versionFile = join('.claude', '.framework-version');
151
- writeFileSync(versionFile, version);
152
- }
153
-
154
- static copyDirectory(src, dest) {
155
- if (!existsSync(dest)) {
156
- mkdirSync(dest, { recursive: true });
157
- }
158
-
159
- const entries = readdirSync(src, { withFileTypes: true });
160
-
161
- for (const entry of entries) {
162
- const srcPath = join(src, entry.name);
163
- const destPath = join(dest, entry.name);
164
-
165
- if (entry.isDirectory()) {
166
- this.copyDirectory(srcPath, destPath);
167
- } else {
168
- copyFileSync(srcPath, destPath);
169
- }
170
- }
171
- }
172
-
173
- static removeDirectory(dir) {
174
- if (existsSync(dir)) {
175
- const entries = readdirSync(dir, { withFileTypes: true });
176
-
177
- for (const entry of entries) {
178
- const fullPath = join(dir, entry.name);
179
- if (entry.isDirectory()) {
180
- this.removeDirectory(fullPath);
181
- } else {
182
- unlinkSync(fullPath);
183
- }
184
- }
185
-
186
- rmdirSync(dir);
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');