@champpaba/claude-agent-kit 1.4.1 → 1.4.2

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/bin/cli.js CHANGED
@@ -1,59 +1,59 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Claude Agent Kit - CLI Entry Point
5
- *
6
- * This is the main CLI file that handles all commands:
7
- * - cak init → Initialize template in current project
8
- * - cak update → Update template to latest version
9
- * - cak --version → Show version
10
- * - cak --help → Show help
11
- */
12
-
13
- const { program } = require('commander');
14
- const chalk = require('chalk');
15
- const pkg = require('../package.json');
16
-
17
- // Import command handlers
18
- const initCommand = require('../lib/init');
19
- const updateCommand = require('../lib/update');
20
-
21
- // Configure CLI
22
- program
23
- .name('cak')
24
- .description(chalk.cyan('🤖 Claude Agent Kit - Universal Multi-Agent Template'))
25
- .version(pkg.version, '-v, --version', 'Show version number');
26
-
27
- // Command: cak init
28
- program
29
- .command('init')
30
- .description('Initialize Claude Agent Kit template in current project')
31
- .action(async (options) => {
32
- try {
33
- await initCommand(options);
34
- } catch (error) {
35
- console.error(chalk.red('❌ Error:'), error.message);
36
- process.exit(1);
37
- }
38
- });
39
-
40
- // Command: cak update
41
- program
42
- .command('update')
43
- .description('Update template files to latest version')
44
- .action(async (options) => {
45
- try {
46
- await updateCommand(options);
47
- } catch (error) {
48
- console.error(chalk.red('❌ Error:'), error.message);
49
- process.exit(1);
50
- }
51
- });
52
-
53
- // Show help if no command provided
54
- if (!process.argv.slice(2).length) {
55
- program.outputHelp();
56
- }
57
-
58
- // Parse command line arguments
59
- program.parse(process.argv);
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Claude Agent Kit - CLI Entry Point
5
+ *
6
+ * This is the main CLI file that handles all commands:
7
+ * - cak init → Initialize template in current project
8
+ * - cak update → Update template to latest version
9
+ * - cak --version → Show version
10
+ * - cak --help → Show help
11
+ */
12
+
13
+ const { program } = require('commander');
14
+ const chalk = require('chalk');
15
+ const pkg = require('../package.json');
16
+
17
+ // Import command handlers
18
+ const initCommand = require('../lib/init');
19
+ const updateCommand = require('../lib/update');
20
+
21
+ // Configure CLI
22
+ program
23
+ .name('cak')
24
+ .description(chalk.cyan('🤖 Claude Agent Kit - Universal Multi-Agent Template'))
25
+ .version(pkg.version, '-v, --version', 'Show version number');
26
+
27
+ // Command: cak init
28
+ program
29
+ .command('init')
30
+ .description('Initialize Claude Agent Kit template in current project')
31
+ .action(async (options) => {
32
+ try {
33
+ await initCommand(options);
34
+ } catch (error) {
35
+ console.error(chalk.red('❌ Error:'), error.message);
36
+ process.exit(1);
37
+ }
38
+ });
39
+
40
+ // Command: cak update
41
+ program
42
+ .command('update')
43
+ .description('Update template files to latest version')
44
+ .action(async (options) => {
45
+ try {
46
+ await updateCommand(options);
47
+ } catch (error) {
48
+ console.error(chalk.red('❌ Error:'), error.message);
49
+ process.exit(1);
50
+ }
51
+ });
52
+
53
+ // Show help if no command provided
54
+ if (!process.argv.slice(2).length) {
55
+ program.outputHelp();
56
+ }
57
+
58
+ // Parse command line arguments
59
+ program.parse(process.argv);
package/lib/helpers.js CHANGED
@@ -28,16 +28,52 @@ async function promptUser(question) {
28
28
  }
29
29
 
30
30
  /**
31
- * Merge template files into target directory
32
- * - Overwrites files with same name
31
+ * Merge template files into target directory with smart comparison
32
+ * - Only overwrites if content actually differs
33
33
  * - Keeps existing files that don't exist in template
34
+ * - Skips identical files (prevents Git showing unnecessary changes)
34
35
  * @param {string} templatePath - Source template directory
35
36
  * @param {string} targetPath - Target directory
36
37
  */
37
38
  async function mergeTemplateFiles(templatePath, targetPath) {
39
+ const crypto = require('crypto');
40
+
41
+ // Helper: Calculate file hash
42
+ function getFileHash(filePath) {
43
+ try {
44
+ const content = fs.readFileSync(filePath);
45
+ return crypto.createHash('md5').update(content).digest('hex');
46
+ } catch (error) {
47
+ return null;
48
+ }
49
+ }
50
+
51
+ // Custom filter function
52
+ const filter = (src, dest) => {
53
+ const srcStat = fs.statSync(src);
54
+
55
+ // Always copy directories
56
+ if (srcStat.isDirectory()) {
57
+ return true;
58
+ }
59
+
60
+ // If destination doesn't exist, copy it
61
+ if (!fs.existsSync(dest)) {
62
+ return true;
63
+ }
64
+
65
+ // Compare file hashes (content-based comparison)
66
+ const srcHash = getFileHash(src);
67
+ const destHash = getFileHash(dest);
68
+
69
+ // Only copy if content differs
70
+ return srcHash !== destHash;
71
+ };
72
+
38
73
  await fs.copy(templatePath, targetPath, {
39
74
  overwrite: true,
40
- errorOnExist: false
75
+ errorOnExist: false,
76
+ filter: filter
41
77
  });
42
78
  }
43
79
 
package/lib/init.js CHANGED
@@ -1,57 +1,57 @@
1
- /**
2
- * Init Command - Initialize Claude Agent Kit template
3
- *
4
- * This function merges the .claude/ template folder into the current project.
5
- * - Overwrites files with same name
6
- * - Keeps existing files that don't exist in template
7
- */
8
-
9
- const fs = require('fs-extra');
10
- const path = require('path');
11
- const chalk = require('chalk');
12
- const { promptUser, mergeTemplateFiles } = require('./helpers');
13
-
14
- module.exports = async function init(options = {}) {
15
- // Paths
16
- const templatePath = path.join(__dirname, '../.claude');
17
- const targetPath = path.join(process.cwd(), '.claude');
18
-
19
- console.log(chalk.cyan('\n🤖 Claude Agent Kit - Initializing...\n'));
20
-
21
- // Check if template exists
22
- if (!fs.existsSync(templatePath)) {
23
- throw new Error('Template folder not found. Please reinstall the package.');
24
- }
25
-
26
- // Check if .claude/ already exists
27
- if (fs.existsSync(targetPath)) {
28
- console.log(chalk.yellow('⚠️ .claude/ already exists in this project.'));
29
- console.log(chalk.gray(' Existing files will be preserved, template files will be merged.\n'));
30
-
31
- const shouldContinue = await promptUser(
32
- chalk.cyan('❓ Merge with template files? (y/N): ')
33
- );
34
-
35
- if (!shouldContinue) {
36
- console.log(chalk.gray('\n❌ Initialization cancelled.\n'));
37
- return;
38
- }
39
-
40
- console.log(chalk.gray('\n📦 Merging template files...\n'));
41
- }
42
-
43
- // Merge template files
44
- try {
45
- await mergeTemplateFiles(templatePath, targetPath);
46
-
47
- console.log(chalk.green('✅ Successfully initialized Claude Agent Kit!\n'));
48
- console.log(chalk.white('📁 Files merged to: ') + chalk.cyan(targetPath));
49
- console.log(chalk.white('\n📚 Next steps:\n'));
50
- console.log(chalk.gray(' 1. Review the .claude/ folder'));
51
- console.log(chalk.gray(' 2. Run: ') + chalk.cyan('/psetup') + chalk.gray(' (one-time project setup)'));
52
- console.log(chalk.gray(' 3. Start using agents with Claude Code\n'));
53
-
54
- } catch (error) {
55
- throw new Error(`Failed to merge template: ${error.message}`);
56
- }
57
- };
1
+ /**
2
+ * Init Command - Initialize Claude Agent Kit template
3
+ *
4
+ * This function merges the .claude/ template folder into the current project.
5
+ * - Overwrites files with same name
6
+ * - Keeps existing files that don't exist in template
7
+ */
8
+
9
+ const fs = require('fs-extra');
10
+ const path = require('path');
11
+ const chalk = require('chalk');
12
+ const { promptUser, mergeTemplateFiles } = require('./helpers');
13
+
14
+ module.exports = async function init(options = {}) {
15
+ // Paths
16
+ const templatePath = path.join(__dirname, '../.claude');
17
+ const targetPath = path.join(process.cwd(), '.claude');
18
+
19
+ console.log(chalk.cyan('\n🤖 Claude Agent Kit - Initializing...\n'));
20
+
21
+ // Check if template exists
22
+ if (!fs.existsSync(templatePath)) {
23
+ throw new Error('Template folder not found. Please reinstall the package.');
24
+ }
25
+
26
+ // Check if .claude/ already exists
27
+ if (fs.existsSync(targetPath)) {
28
+ console.log(chalk.yellow('⚠️ .claude/ already exists in this project.'));
29
+ console.log(chalk.gray(' Existing files will be preserved, template files will be merged.\n'));
30
+
31
+ const shouldContinue = await promptUser(
32
+ chalk.cyan('❓ Merge with template files? (y/N): ')
33
+ );
34
+
35
+ if (!shouldContinue) {
36
+ console.log(chalk.gray('\n❌ Initialization cancelled.\n'));
37
+ return;
38
+ }
39
+
40
+ console.log(chalk.gray('\n📦 Merging template files...\n'));
41
+ }
42
+
43
+ // Merge template files
44
+ try {
45
+ await mergeTemplateFiles(templatePath, targetPath);
46
+
47
+ console.log(chalk.green('✅ Successfully initialized Claude Agent Kit!\n'));
48
+ console.log(chalk.white('📁 Files merged to: ') + chalk.cyan(targetPath));
49
+ console.log(chalk.white('\n📚 Next steps:\n'));
50
+ console.log(chalk.gray(' 1. Review the .claude/ folder'));
51
+ console.log(chalk.gray(' 2. Run: ') + chalk.cyan('/psetup') + chalk.gray(' (one-time project setup)'));
52
+ console.log(chalk.gray(' 3. Start using agents with Claude Code\n'));
53
+
54
+ } catch (error) {
55
+ throw new Error(`Failed to merge template: ${error.message}`);
56
+ }
57
+ };
package/lib/update.js CHANGED
@@ -1,90 +1,90 @@
1
- /**
2
- * Update Command - Update Claude Agent Kit template to latest version
3
- *
4
- * This function:
5
- * 1. Checks for new version in npm registry
6
- * 2. Optionally updates the global package
7
- * 3. Merges latest template files into .claude/
8
- */
9
-
10
- const fs = require('fs-extra');
11
- const path = require('path');
12
- const chalk = require('chalk');
13
- const pkg = require('../package.json');
14
- const {
15
- promptUser,
16
- mergeTemplateFiles,
17
- getLatestVersion,
18
- getCurrentVersion,
19
- installGlobalPackage
20
- } = require('./helpers');
21
-
22
- module.exports = async function update(options = {}) {
23
- const packageName = pkg.name;
24
-
25
- // Paths
26
- const templatePath = path.join(__dirname, '../.claude');
27
- const targetPath = path.join(process.cwd(), '.claude');
28
-
29
- console.log(chalk.cyan('\n🤖 Claude Agent Kit - Updating...\n'));
30
-
31
- // Check if .claude/ exists
32
- if (!fs.existsSync(targetPath)) {
33
- console.log(chalk.yellow('⚠️ .claude/ not found in this project.'));
34
- console.log(chalk.gray(' Run init first:\n'));
35
- console.log(chalk.cyan(' cak init\n'));
36
- return;
37
- }
38
-
39
- // STEP 1: Check version
40
- console.log(chalk.gray('🔍 Checking for updates...\n'));
41
-
42
- const currentVersion = getCurrentVersion(packageName) || pkg.version;
43
- const latestVersion = await getLatestVersion(packageName);
44
-
45
- if (!latestVersion) {
46
- console.log(chalk.yellow('⚠️ Unable to check npm registry. Continuing with local version.\n'));
47
- } else if (currentVersion === latestVersion) {
48
- console.log(chalk.green(`✅ Already on latest version (${latestVersion})\n`));
49
- } else {
50
- console.log(chalk.cyan(`📦 New version available: ${chalk.bold(latestVersion)} (current: ${currentVersion})\n`));
51
-
52
- const shouldUpdatePackage = await promptUser(
53
- chalk.cyan('❓ Update package globally first? (y/N): ')
54
- );
55
-
56
- // STEP 2: Update package globally
57
- if (shouldUpdatePackage) {
58
- const success = await installGlobalPackage(packageName, latestVersion);
59
-
60
- if (!success) {
61
- console.log(chalk.yellow('⚠️ Package update failed. Continuing with current version.\n'));
62
- }
63
- } else {
64
- console.log(chalk.gray('\n⏭️ Skipping package update. Using current version.\n'));
65
- }
66
- }
67
-
68
- // Check if template exists
69
- if (!fs.existsSync(templatePath)) {
70
- throw new Error('Template folder not found. Please reinstall the package.');
71
- }
72
-
73
- // STEP 3: Update files (merge mode)
74
- console.log(chalk.gray('📦 Merging template files...\n'));
75
-
76
- try {
77
- await mergeTemplateFiles(templatePath, targetPath);
78
-
79
- console.log(chalk.green('✅ Successfully updated Claude Agent Kit!\n'));
80
- console.log(chalk.white('📁 Updated files in: ') + chalk.cyan(targetPath));
81
- console.log(chalk.gray(' (Existing files preserved, template files merged)\n'));
82
-
83
- console.log(chalk.white('📚 What\'s new:\n'));
84
- console.log(chalk.gray(' Check CHANGELOG.md for latest changes'));
85
- console.log(chalk.gray(' Or visit: ') + chalk.cyan('https://github.com/ChampPABA/claude-multi-agent-template\n'));
86
-
87
- } catch (error) {
88
- throw new Error(`Failed to update template: ${error.message}`);
89
- }
90
- };
1
+ /**
2
+ * Update Command - Update Claude Agent Kit template to latest version
3
+ *
4
+ * This function:
5
+ * 1. Checks for new version in npm registry
6
+ * 2. Optionally updates the global package
7
+ * 3. Merges latest template files into .claude/
8
+ */
9
+
10
+ const fs = require('fs-extra');
11
+ const path = require('path');
12
+ const chalk = require('chalk');
13
+ const pkg = require('../package.json');
14
+ const {
15
+ promptUser,
16
+ mergeTemplateFiles,
17
+ getLatestVersion,
18
+ getCurrentVersion,
19
+ installGlobalPackage
20
+ } = require('./helpers');
21
+
22
+ module.exports = async function update(options = {}) {
23
+ const packageName = pkg.name;
24
+
25
+ // Paths
26
+ const templatePath = path.join(__dirname, '../.claude');
27
+ const targetPath = path.join(process.cwd(), '.claude');
28
+
29
+ console.log(chalk.cyan('\n🤖 Claude Agent Kit - Updating...\n'));
30
+
31
+ // Check if .claude/ exists
32
+ if (!fs.existsSync(targetPath)) {
33
+ console.log(chalk.yellow('⚠️ .claude/ not found in this project.'));
34
+ console.log(chalk.gray(' Run init first:\n'));
35
+ console.log(chalk.cyan(' cak init\n'));
36
+ return;
37
+ }
38
+
39
+ // STEP 1: Check version
40
+ console.log(chalk.gray('🔍 Checking for updates...\n'));
41
+
42
+ const currentVersion = getCurrentVersion(packageName) || pkg.version;
43
+ const latestVersion = await getLatestVersion(packageName);
44
+
45
+ if (!latestVersion) {
46
+ console.log(chalk.yellow('⚠️ Unable to check npm registry. Continuing with local version.\n'));
47
+ } else if (currentVersion === latestVersion) {
48
+ console.log(chalk.green(`✅ Already on latest version (${latestVersion})\n`));
49
+ } else {
50
+ console.log(chalk.cyan(`📦 New version available: ${chalk.bold(latestVersion)} (current: ${currentVersion})\n`));
51
+
52
+ const shouldUpdatePackage = await promptUser(
53
+ chalk.cyan('❓ Update package globally first? (y/N): ')
54
+ );
55
+
56
+ // STEP 2: Update package globally
57
+ if (shouldUpdatePackage) {
58
+ const success = await installGlobalPackage(packageName, latestVersion);
59
+
60
+ if (!success) {
61
+ console.log(chalk.yellow('⚠️ Package update failed. Continuing with current version.\n'));
62
+ }
63
+ } else {
64
+ console.log(chalk.gray('\n⏭️ Skipping package update. Using current version.\n'));
65
+ }
66
+ }
67
+
68
+ // Check if template exists
69
+ if (!fs.existsSync(templatePath)) {
70
+ throw new Error('Template folder not found. Please reinstall the package.');
71
+ }
72
+
73
+ // STEP 3: Update files (merge mode)
74
+ console.log(chalk.gray('📦 Merging template files...\n'));
75
+
76
+ try {
77
+ await mergeTemplateFiles(templatePath, targetPath);
78
+
79
+ console.log(chalk.green('✅ Successfully updated Claude Agent Kit!\n'));
80
+ console.log(chalk.white('📁 Updated files in: ') + chalk.cyan(targetPath));
81
+ console.log(chalk.gray(' (Existing files preserved, template files merged)\n'));
82
+
83
+ console.log(chalk.white('📚 What\'s new:\n'));
84
+ console.log(chalk.gray(' Check CHANGELOG.md for latest changes'));
85
+ console.log(chalk.gray(' Or visit: ') + chalk.cyan('https://github.com/ChampPABA/claude-multi-agent-template\n'));
86
+
87
+ } catch (error) {
88
+ throw new Error(`Failed to update template: ${error.message}`);
89
+ }
90
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@champpaba/claude-agent-kit",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "Universal multi-agent template for Claude Code - AI-assisted development with specialized agents",
5
5
  "main": "bin/cli.js",
6
6
  "bin": {