@champpaba/claude-agent-kit 1.1.1 → 1.4.1

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.
Files changed (36) hide show
  1. package/.claude/CLAUDE.md +52 -444
  2. package/.claude/agents/01-integration.md +47 -193
  3. package/.claude/agents/02-uxui-frontend.md +151 -188
  4. package/.claude/agents/03-test-debug.md +43 -186
  5. package/.claude/agents/04-frontend.md +50 -478
  6. package/.claude/agents/05-backend.md +49 -499
  7. package/.claude/agents/06-database.md +36 -188
  8. package/.claude/commands/cdev.md +86 -1
  9. package/.claude/commands/csetup.md +319 -6
  10. package/.claude/commands/designsetup.md +360 -29
  11. package/.claude/commands/pageplan.md +409 -19
  12. package/.claude/contexts/design/box-thinking.md +358 -0
  13. package/.claude/contexts/patterns/animation-patterns.md +768 -0
  14. package/.claude/contexts/patterns/performance-optimization.md +421 -0
  15. package/.claude/contexts/patterns/ui-component-consistency.md +49 -2
  16. package/.claude/lib/README.md +46 -4
  17. package/.claude/lib/agent-executor.md +69 -10
  18. package/.claude/lib/context-loading-protocol.md +462 -0
  19. package/.claude/lib/detailed-guides/agent-system.md +237 -0
  20. package/.claude/lib/detailed-guides/best-practices-system.md +150 -0
  21. package/.claude/lib/detailed-guides/context-optimization.md +118 -0
  22. package/.claude/lib/detailed-guides/design-system.md +98 -0
  23. package/.claude/lib/detailed-guides/page-planning.md +147 -0
  24. package/.claude/lib/detailed-guides/taskmaster-analysis.md +263 -0
  25. package/.claude/lib/document-loader.md +353 -0
  26. package/.claude/lib/handoff-protocol.md +665 -0
  27. package/.claude/lib/task-analyzer.md +694 -0
  28. package/.claude/lib/tdd-workflow.md +891 -0
  29. package/.claude/templates/design-context-template.md +220 -0
  30. package/.claude/templates/page-plan-example.md +131 -0
  31. package/README.md +290 -0
  32. package/bin/cli.js +0 -2
  33. package/lib/helpers.js +108 -0
  34. package/lib/init.js +18 -13
  35. package/lib/update.js +48 -31
  36. package/package.json +1 -1
package/lib/helpers.js ADDED
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Helpers - Shared utility functions for CLI commands
3
+ */
4
+
5
+ const fs = require('fs-extra');
6
+ const path = require('path');
7
+ const readline = require('readline');
8
+ const { execSync } = require('child_process');
9
+ const chalk = require('chalk');
10
+
11
+ /**
12
+ * Prompt user for yes/no question
13
+ * @param {string} question - Question to ask
14
+ * @returns {Promise<boolean>} - True if user answered yes
15
+ */
16
+ async function promptUser(question) {
17
+ const rl = readline.createInterface({
18
+ input: process.stdin,
19
+ output: process.stdout
20
+ });
21
+
22
+ return new Promise((resolve) => {
23
+ rl.question(question, (answer) => {
24
+ rl.close();
25
+ resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
26
+ });
27
+ });
28
+ }
29
+
30
+ /**
31
+ * Merge template files into target directory
32
+ * - Overwrites files with same name
33
+ * - Keeps existing files that don't exist in template
34
+ * @param {string} templatePath - Source template directory
35
+ * @param {string} targetPath - Target directory
36
+ */
37
+ async function mergeTemplateFiles(templatePath, targetPath) {
38
+ await fs.copy(templatePath, targetPath, {
39
+ overwrite: true,
40
+ errorOnExist: false
41
+ });
42
+ }
43
+
44
+ /**
45
+ * Get latest version from npm registry
46
+ * @param {string} packageName - Package name
47
+ * @returns {Promise<string|null>} - Latest version or null if failed
48
+ */
49
+ async function getLatestVersion(packageName) {
50
+ try {
51
+ const result = execSync(`npm view ${packageName} version`, {
52
+ encoding: 'utf-8',
53
+ stdio: ['pipe', 'pipe', 'pipe']
54
+ });
55
+ return result.trim();
56
+ } catch (error) {
57
+ return null;
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Get currently installed global package version
63
+ * @param {string} packageName - Package name
64
+ * @returns {string|null} - Current version or null if not installed
65
+ */
66
+ function getCurrentVersion(packageName) {
67
+ try {
68
+ const result = execSync(`npm list -g ${packageName} --depth=0`, {
69
+ encoding: 'utf-8',
70
+ stdio: ['pipe', 'pipe', 'pipe']
71
+ });
72
+ const match = result.match(new RegExp(`${packageName}@([\\d.]+)`));
73
+ return match ? match[1] : null;
74
+ } catch (error) {
75
+ return null;
76
+ }
77
+ }
78
+
79
+ /**
80
+ * Install package globally
81
+ * @param {string} packageName - Package name
82
+ * @param {string} version - Version to install (default: latest)
83
+ * @returns {Promise<boolean>} - True if successful
84
+ */
85
+ async function installGlobalPackage(packageName, version = 'latest') {
86
+ try {
87
+ console.log(chalk.gray(`\nšŸ“¦ Installing ${packageName}@${version} globally...\n`));
88
+
89
+ execSync(`npm install -g ${packageName}@${version}`, {
90
+ encoding: 'utf-8',
91
+ stdio: 'inherit'
92
+ });
93
+
94
+ console.log(chalk.green(`\nāœ… Package installed successfully!\n`));
95
+ return true;
96
+ } catch (error) {
97
+ console.error(chalk.red(`\nāŒ Failed to install package: ${error.message}\n`));
98
+ return false;
99
+ }
100
+ }
101
+
102
+ module.exports = {
103
+ promptUser,
104
+ mergeTemplateFiles,
105
+ getLatestVersion,
106
+ getCurrentVersion,
107
+ installGlobalPackage
108
+ };
package/lib/init.js CHANGED
@@ -1,16 +1,17 @@
1
1
  /**
2
2
  * Init Command - Initialize Claude Agent Kit template
3
3
  *
4
- * This function copies the .claude/ template folder to the current project.
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
5
7
  */
6
8
 
7
9
  const fs = require('fs-extra');
8
10
  const path = require('path');
9
11
  const chalk = require('chalk');
12
+ const { promptUser, mergeTemplateFiles } = require('./helpers');
10
13
 
11
14
  module.exports = async function init(options = {}) {
12
- const { force } = options;
13
-
14
15
  // Paths
15
16
  const templatePath = path.join(__dirname, '../.claude');
16
17
  const targetPath = path.join(process.cwd(), '.claude');
@@ -24,29 +25,33 @@ module.exports = async function init(options = {}) {
24
25
 
25
26
  // Check if .claude/ already exists
26
27
  if (fs.existsSync(targetPath)) {
27
- if (!force) {
28
- console.log(chalk.yellow('āš ļø .claude/ already exists in this project.'));
29
- console.log(chalk.gray(' Use --force to overwrite:\n'));
30
- console.log(chalk.cyan(' cak init --force\n'));
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'));
31
37
  return;
32
38
  }
33
39
 
34
- console.log(chalk.yellow('āš ļø Overwriting existing .claude/ folder...\n'));
35
- await fs.remove(targetPath);
40
+ console.log(chalk.gray('\nšŸ“¦ Merging template files...\n'));
36
41
  }
37
42
 
38
- // Copy template
43
+ // Merge template files
39
44
  try {
40
- await fs.copy(templatePath, targetPath);
45
+ await mergeTemplateFiles(templatePath, targetPath);
41
46
 
42
47
  console.log(chalk.green('āœ… Successfully initialized Claude Agent Kit!\n'));
43
- console.log(chalk.white('šŸ“ Files copied to: ') + chalk.cyan(targetPath));
48
+ console.log(chalk.white('šŸ“ Files merged to: ') + chalk.cyan(targetPath));
44
49
  console.log(chalk.white('\nšŸ“š Next steps:\n'));
45
50
  console.log(chalk.gray(' 1. Review the .claude/ folder'));
46
51
  console.log(chalk.gray(' 2. Run: ') + chalk.cyan('/psetup') + chalk.gray(' (one-time project setup)'));
47
52
  console.log(chalk.gray(' 3. Start using agents with Claude Code\n'));
48
53
 
49
54
  } catch (error) {
50
- throw new Error(`Failed to copy template: ${error.message}`);
55
+ throw new Error(`Failed to merge template: ${error.message}`);
51
56
  }
52
57
  };
package/lib/update.js CHANGED
@@ -1,20 +1,30 @@
1
1
  /**
2
2
  * Update Command - Update Claude Agent Kit template to latest version
3
3
  *
4
- * This function updates the .claude/ folder with the latest template files.
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/
5
8
  */
6
9
 
7
10
  const fs = require('fs-extra');
8
11
  const path = require('path');
9
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');
10
21
 
11
22
  module.exports = async function update(options = {}) {
12
- const { backup } = options;
23
+ const packageName = pkg.name;
13
24
 
14
25
  // Paths
15
26
  const templatePath = path.join(__dirname, '../.claude');
16
27
  const targetPath = path.join(process.cwd(), '.claude');
17
- const backupPath = path.join(process.cwd(), '.claude.backup');
18
28
 
19
29
  console.log(chalk.cyan('\nšŸ¤– Claude Agent Kit - Updating...\n'));
20
30
 
@@ -26,46 +36,53 @@ module.exports = async function update(options = {}) {
26
36
  return;
27
37
  }
28
38
 
29
- // Check if template exists
30
- if (!fs.existsSync(templatePath)) {
31
- throw new Error('Template folder not found. Please reinstall the package.');
32
- }
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
+ );
33
55
 
34
- // Create backup if requested
35
- if (backup) {
36
- console.log(chalk.gray('šŸ“¦ Creating backup...\n'));
56
+ // STEP 2: Update package globally
57
+ if (shouldUpdatePackage) {
58
+ const success = await installGlobalPackage(packageName, latestVersion);
37
59
 
38
- // Remove old backup if exists
39
- if (fs.existsSync(backupPath)) {
40
- await fs.remove(backupPath);
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'));
41
65
  }
66
+ }
42
67
 
43
- // Copy current .claude/ to backup
44
- await fs.copy(targetPath, backupPath);
45
- console.log(chalk.green('āœ… Backup created: ') + chalk.cyan('.claude.backup\n'));
68
+ // Check if template exists
69
+ if (!fs.existsSync(templatePath)) {
70
+ throw new Error('Template folder not found. Please reinstall the package.');
46
71
  }
47
72
 
48
- // Update template
73
+ // STEP 3: Update files (merge mode)
74
+ console.log(chalk.gray('šŸ“¦ Merging template files...\n'));
75
+
49
76
  try {
50
- // Strategy: Overwrite all files from template
51
- // User customizations in domain/ should be preserved if they don't conflict
52
- await fs.copy(templatePath, targetPath, {
53
- overwrite: true,
54
- errorOnExist: false
55
- });
77
+ await mergeTemplateFiles(templatePath, targetPath);
56
78
 
57
79
  console.log(chalk.green('āœ… Successfully updated Claude Agent Kit!\n'));
58
80
  console.log(chalk.white('šŸ“ Updated files in: ') + chalk.cyan(targetPath));
81
+ console.log(chalk.gray(' (Existing files preserved, template files merged)\n'));
59
82
 
60
- if (backup) {
61
- console.log(chalk.white('\nšŸ’¾ Backup available at: ') + chalk.cyan(backupPath));
62
- console.log(chalk.gray(' You can restore it if needed:\n'));
63
- console.log(chalk.cyan(' rm -rf .claude && mv .claude.backup .claude\n'));
64
- }
65
-
66
- console.log(chalk.white('\nšŸ“š What\'s new:\n'));
83
+ console.log(chalk.white('šŸ“š What\'s new:\n'));
67
84
  console.log(chalk.gray(' Check CHANGELOG.md for latest changes'));
68
- console.log(chalk.gray(' Or visit: ') + chalk.cyan('https://github.com/your-username/claude-agent-kit\n'));
85
+ console.log(chalk.gray(' Or visit: ') + chalk.cyan('https://github.com/ChampPABA/claude-multi-agent-template\n'));
69
86
 
70
87
  } catch (error) {
71
88
  throw new Error(`Failed to update template: ${error.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@champpaba/claude-agent-kit",
3
- "version": "1.1.1",
3
+ "version": "1.4.1",
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": {