claudeguide-engineer 1.15.1 ā 1.16.0
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/index.js +87 -51
- package/package.json +7 -1
package/index.js
CHANGED
|
@@ -3,63 +3,75 @@
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const { execSync } = require('child_process');
|
|
6
|
+
const os = require('os');
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
const
|
|
8
|
+
// Professional CLI dependencies
|
|
9
|
+
const chalk = require('chalk');
|
|
10
|
+
const ora = require('ora');
|
|
11
|
+
const inquirer = require('inquirer');
|
|
12
|
+
const { program } = require('commander');
|
|
9
13
|
|
|
10
|
-
//
|
|
14
|
+
// Configuration
|
|
11
15
|
const PRIVATE_REPO_URL = "https://github.com/nstung463/claude-guide.git";
|
|
16
|
+
const CONFIG_FILE = path.join(os.homedir(), '.claudeguide-config.json');
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Load or save GitHub Token
|
|
20
|
+
*/
|
|
21
|
+
function getSavedToken() {
|
|
22
|
+
if (fs.existsSync(CONFIG_FILE)) {
|
|
23
|
+
try {
|
|
24
|
+
const config = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
25
|
+
return config.GITHUB_TOKEN;
|
|
26
|
+
} catch (e) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
24
31
|
}
|
|
25
32
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
console.log(`claudeguide-engineer CLI v${pkg.version}`);
|
|
29
|
-
process.exit(0);
|
|
33
|
+
function saveToken(token) {
|
|
34
|
+
fs.writeFileSync(CONFIG_FILE, JSON.stringify({ GITHUB_TOKEN: token }, null, 2));
|
|
30
35
|
}
|
|
31
36
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
console.log('
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Main Initialization Logic
|
|
39
|
+
*/
|
|
40
|
+
async function initializeKit(options) {
|
|
41
|
+
console.log(chalk.cyan.bold('\nš ClaudeGuide Engineer Kit Initializer\n'));
|
|
42
|
+
|
|
43
|
+
let token = process.env.GITHUB_TOKEN || getSavedToken();
|
|
44
|
+
|
|
45
|
+
// Prompt for token if missing
|
|
46
|
+
if (!token) {
|
|
47
|
+
console.log(chalk.yellow('š” No GitHub Token found. You need a Personal Access Token (PAT) with "repo" scope.'));
|
|
48
|
+
const answers = await inquirer.prompt([
|
|
49
|
+
{
|
|
50
|
+
type: 'password',
|
|
51
|
+
name: 'token',
|
|
52
|
+
message: 'Enter your GitHub Personal Access Token:',
|
|
53
|
+
validate: (input) => input.length > 0 || 'Token is required'
|
|
54
|
+
}
|
|
55
|
+
]);
|
|
56
|
+
token = answers.token;
|
|
57
|
+
saveToken(token);
|
|
58
|
+
console.log(chalk.green('ā
Token saved to ' + CONFIG_FILE + '\n'));
|
|
48
59
|
}
|
|
49
60
|
|
|
61
|
+
const spinner = ora('Checking access to Private Kit...').start();
|
|
50
62
|
const targetDir = process.cwd();
|
|
51
63
|
const tempDir = path.join(targetDir, '.cg-temp-' + Date.now());
|
|
52
64
|
|
|
53
65
|
try {
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
const authRepoUrl = PRIVATE_REPO_URL.replace("https://", `https://${GITHUB_TOKEN}@`);
|
|
66
|
+
// Authenticate and Clone
|
|
67
|
+
const authRepoUrl = PRIVATE_REPO_URL.replace("https://", `https://${token}@`);
|
|
57
68
|
|
|
69
|
+
spinner.text = 'Authenticating and downloading from GitHub...';
|
|
58
70
|
execSync(`git clone --depth 1 ${authRepoUrl} "${tempDir}"`, { stdio: 'ignore' });
|
|
59
71
|
|
|
60
|
-
|
|
72
|
+
spinner.succeed(chalk.green('Access Granted! Repository downloaded.'));
|
|
73
|
+
spinner.start('Initializing files in ' + targetDir + '...');
|
|
61
74
|
|
|
62
|
-
// List of files and directories to copy from the private repo
|
|
63
75
|
const filesToCopy = [
|
|
64
76
|
".claude",
|
|
65
77
|
".opencode",
|
|
@@ -83,31 +95,55 @@ if (command === 'init' || command === 'new' || command === 'update') {
|
|
|
83
95
|
} else {
|
|
84
96
|
fs.copyFileSync(src, dest);
|
|
85
97
|
}
|
|
86
|
-
console.log(` ā Added: ${file}`);
|
|
87
98
|
}
|
|
88
99
|
});
|
|
89
100
|
|
|
90
|
-
|
|
101
|
+
spinner.succeed(chalk.green('Files initialized successfully.'));
|
|
102
|
+
|
|
103
|
+
// Clean up
|
|
91
104
|
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
92
105
|
|
|
93
|
-
console.log('\nāØ
|
|
94
|
-
console.log('\nNext steps:');
|
|
95
|
-
console.log('1. Run
|
|
96
|
-
console.log('2. Type
|
|
106
|
+
console.log(chalk.blue.bold('\n⨠All set! ClaudeGuide is ready.'));
|
|
107
|
+
console.log(chalk.white('\nNext steps:'));
|
|
108
|
+
console.log(chalk.gray(' 1. ') + chalk.white('Run ') + chalk.cyan('npm install'));
|
|
109
|
+
console.log(chalk.gray(' 2. ') + chalk.white('Type ') + chalk.cyan('claude') + chalk.white(' to start building.\n'));
|
|
97
110
|
|
|
98
111
|
} catch (err) {
|
|
99
|
-
|
|
100
|
-
console.error('
|
|
112
|
+
spinner.fail(chalk.red('Access Denied or Connection Error.'));
|
|
113
|
+
console.error(chalk.red('\nError Details: ') + chalk.white(err.message));
|
|
114
|
+
console.log(chalk.yellow('\nTips:'));
|
|
115
|
+
console.log(' - Ensure your PAT has "repo" scope.');
|
|
116
|
+
console.log(' - Ensure you are a contributor to ' + PRIVATE_REPO_URL);
|
|
117
|
+
console.log(' - To reset your token, delete ' + CONFIG_FILE);
|
|
118
|
+
|
|
101
119
|
if (fs.existsSync(tempDir)) fs.rmSync(tempDir, { recursive: true, force: true });
|
|
102
120
|
process.exit(1);
|
|
103
121
|
}
|
|
104
|
-
} else {
|
|
105
|
-
console.log(`Unknown command: ${command}`);
|
|
106
|
-
console.log('Type "cg --help" for available commands.');
|
|
107
122
|
}
|
|
108
123
|
|
|
109
124
|
/**
|
|
110
|
-
*
|
|
125
|
+
* CLI Configuration
|
|
126
|
+
*/
|
|
127
|
+
program
|
|
128
|
+
.name('cg')
|
|
129
|
+
.description('CLI tool for ClaudeGuide AI Agent Framework')
|
|
130
|
+
.version(require('./package.json').version, '-v, --version');
|
|
131
|
+
|
|
132
|
+
program
|
|
133
|
+
.command('init')
|
|
134
|
+
.alias('new')
|
|
135
|
+
.description('Initialize a new project with the Engineer Kit')
|
|
136
|
+
.action(initializeKit);
|
|
137
|
+
|
|
138
|
+
program
|
|
139
|
+
.command('update')
|
|
140
|
+
.description('Update the framework files from the private repository')
|
|
141
|
+
.action(initializeKit);
|
|
142
|
+
|
|
143
|
+
program.parse(process.argv);
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Helper: Recursive Copy
|
|
111
147
|
*/
|
|
112
148
|
function copyRecursiveSync(src, dest) {
|
|
113
149
|
if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claudeguide-engineer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "A comprehensive boilerplate template for building professional software projects with CLI Coding Agents (Claude Code and Open Code).",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -35,6 +35,12 @@
|
|
|
35
35
|
"LICENSE",
|
|
36
36
|
".claude/metadata.json"
|
|
37
37
|
],
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"chalk": "^4.1.2",
|
|
40
|
+
"ora": "^5.4.1",
|
|
41
|
+
"inquirer": "^8.2.4",
|
|
42
|
+
"commander": "^9.4.1"
|
|
43
|
+
},
|
|
38
44
|
"devDependencies": {
|
|
39
45
|
"@commitlint/cli": "^18.4.3",
|
|
40
46
|
"@commitlint/config-conventional": "^18.4.3",
|