claude-code-templates 1.20.1 → 1.20.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/create-claude-config.js +25 -14
- package/package.json +1 -1
- package/src/index.js +63 -1
|
@@ -23,21 +23,23 @@ function colorizeTitle(text) {
|
|
|
23
23
|
.join('');
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
console.
|
|
28
|
-
console.log('
|
|
29
|
-
console.log('
|
|
30
|
-
console.log('
|
|
31
|
-
console.log('
|
|
32
|
-
console.log('
|
|
33
|
-
console.log(
|
|
26
|
+
function showBanner() {
|
|
27
|
+
console.clear();
|
|
28
|
+
console.log(chalk.hex('#F97316')('════════════════════════════════════════════════════════════════'));
|
|
29
|
+
console.log('\n');
|
|
30
|
+
console.log(' 🔮 ' + colorizeTitle(title));
|
|
31
|
+
console.log('\n');
|
|
32
|
+
console.log(' ' + chalk.hex('#FDBA74')(subtitle));
|
|
33
|
+
console.log('\n');
|
|
34
|
+
console.log(chalk.hex('#F97316')('════════════════════════════════════════════════════════════════\n'));
|
|
34
35
|
|
|
35
|
-
console.log(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
);
|
|
36
|
+
console.log(
|
|
37
|
+
chalk.hex('#D97706')('🚀 Setup Claude Code for any project language 🚀') +
|
|
38
|
+
chalk.gray(`\n v${pkg.version}\n\n`) +
|
|
39
|
+
chalk.blue('🌐 Templates: ') + chalk.underline('https://aitmpl.com') + '\n' +
|
|
40
|
+
chalk.blue('📖 Documentation: ') + chalk.underline('https://docs.aitmpl.com') + '\n'
|
|
41
|
+
);
|
|
42
|
+
}
|
|
41
43
|
|
|
42
44
|
program
|
|
43
45
|
.name('create-claude-config')
|
|
@@ -72,6 +74,15 @@ program
|
|
|
72
74
|
.option('--update-agent <agent>', 'update a global agent to the latest version')
|
|
73
75
|
.action(async (options) => {
|
|
74
76
|
try {
|
|
77
|
+
// Only show banner for non-agent-list commands
|
|
78
|
+
const isQuietCommand = options.listAgents ||
|
|
79
|
+
options.removeAgent ||
|
|
80
|
+
options.updateAgent;
|
|
81
|
+
|
|
82
|
+
if (!isQuietCommand) {
|
|
83
|
+
showBanner();
|
|
84
|
+
}
|
|
85
|
+
|
|
75
86
|
await createClaudeConfig(options);
|
|
76
87
|
} catch (error) {
|
|
77
88
|
console.error(chalk.red('Error:'), error.message);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-templates",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.2",
|
|
4
4
|
"description": "CLI tool to setup Claude Code configurations with framework-specific commands, automation hooks and MCP Servers for your projects",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
package/src/index.js
CHANGED
|
@@ -607,6 +607,7 @@ async function installIndividualSetting(settingName, targetDir, options) {
|
|
|
607
607
|
if (response.status === 404) {
|
|
608
608
|
console.log(chalk.red(`❌ Setting "${settingName}" not found`));
|
|
609
609
|
console.log(chalk.yellow('Available settings: enable-telemetry, disable-telemetry, allow-npm-commands, deny-sensitive-files, use-sonnet, use-haiku, retention-7-days, retention-90-days'));
|
|
610
|
+
console.log(chalk.yellow('Available statuslines: statusline/context-monitor'));
|
|
610
611
|
return;
|
|
611
612
|
}
|
|
612
613
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
@@ -615,9 +616,39 @@ async function installIndividualSetting(settingName, targetDir, options) {
|
|
|
615
616
|
const settingConfigText = await response.text();
|
|
616
617
|
const settingConfig = JSON.parse(settingConfigText);
|
|
617
618
|
|
|
618
|
-
//
|
|
619
|
+
// Check if there are additional files to download (e.g., Python scripts)
|
|
620
|
+
const additionalFiles = {};
|
|
621
|
+
|
|
622
|
+
// For statusline settings, check if there's a corresponding Python file
|
|
623
|
+
if (settingName.includes('statusline/')) {
|
|
624
|
+
const pythonFileName = settingName.split('/')[1] + '.py';
|
|
625
|
+
const pythonUrl = githubUrl.replace('.json', '.py');
|
|
626
|
+
|
|
627
|
+
try {
|
|
628
|
+
console.log(chalk.gray(`📥 Downloading Python script: ${pythonFileName}...`));
|
|
629
|
+
const pythonResponse = await fetch(pythonUrl);
|
|
630
|
+
if (pythonResponse.ok) {
|
|
631
|
+
const pythonContent = await pythonResponse.text();
|
|
632
|
+
additionalFiles['.claude/scripts/' + pythonFileName] = {
|
|
633
|
+
content: pythonContent,
|
|
634
|
+
executable: true
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
} catch (error) {
|
|
638
|
+
console.log(chalk.yellow(`⚠️ Could not download Python script: ${error.message}`));
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// Extract and handle additional files before removing them from config
|
|
643
|
+
const configFiles = settingConfig.files || {};
|
|
644
|
+
|
|
645
|
+
// Merge downloaded files with config files
|
|
646
|
+
Object.assign(additionalFiles, configFiles);
|
|
647
|
+
|
|
648
|
+
// Remove description and files fields before merging
|
|
619
649
|
if (settingConfig && typeof settingConfig === 'object') {
|
|
620
650
|
delete settingConfig.description;
|
|
651
|
+
delete settingConfig.files;
|
|
621
652
|
}
|
|
622
653
|
|
|
623
654
|
// Use shared locations if provided (batch mode), otherwise ask user
|
|
@@ -817,6 +848,37 @@ async function installIndividualSetting(settingName, targetDir, options) {
|
|
|
817
848
|
// Write the merged configuration
|
|
818
849
|
await fs.writeJson(actualTargetFile, mergedConfig, { spaces: 2 });
|
|
819
850
|
|
|
851
|
+
// Install additional files if any exist
|
|
852
|
+
if (Object.keys(additionalFiles).length > 0) {
|
|
853
|
+
console.log(chalk.blue(`📄 Installing ${Object.keys(additionalFiles).length} additional file(s)...`));
|
|
854
|
+
|
|
855
|
+
for (const [filePath, fileConfig] of Object.entries(additionalFiles)) {
|
|
856
|
+
try {
|
|
857
|
+
// Resolve tilde (~) to home directory
|
|
858
|
+
const resolvedFilePath = filePath.startsWith('~')
|
|
859
|
+
? path.join(require('os').homedir(), filePath.slice(1))
|
|
860
|
+
: path.resolve(currentTargetDir, filePath);
|
|
861
|
+
|
|
862
|
+
// Ensure directory exists
|
|
863
|
+
await fs.ensureDir(path.dirname(resolvedFilePath));
|
|
864
|
+
|
|
865
|
+
// Write file content
|
|
866
|
+
await fs.writeFile(resolvedFilePath, fileConfig.content, 'utf8');
|
|
867
|
+
|
|
868
|
+
// Make file executable if specified
|
|
869
|
+
if (fileConfig.executable) {
|
|
870
|
+
await fs.chmod(resolvedFilePath, 0o755);
|
|
871
|
+
console.log(chalk.gray(`🔧 Made executable: ${resolvedFilePath}`));
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
console.log(chalk.green(`✅ File installed: ${resolvedFilePath}`));
|
|
875
|
+
|
|
876
|
+
} catch (fileError) {
|
|
877
|
+
console.log(chalk.red(`❌ Failed to install file ${filePath}: ${fileError.message}`));
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
|
|
820
882
|
if (!options.silent) {
|
|
821
883
|
console.log(chalk.green(`✅ Setting "${settingName}" installed successfully in ${installLocation}!`));
|
|
822
884
|
console.log(chalk.cyan(`📁 Configuration merged into: ${actualTargetFile}`));
|