valent-pipeline 0.2.12 → 0.2.14
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/package.json +1 -1
- package/src/commands/init.js +26 -14
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -29,9 +29,9 @@ export async function init(options = {}) {
|
|
|
29
29
|
|
|
30
30
|
console.log('\nInitializing valent-pipeline...\n');
|
|
31
31
|
|
|
32
|
-
// 0.
|
|
33
|
-
if (!existsSync(join(projectRoot, '.git'))) {
|
|
34
|
-
console.log('
|
|
32
|
+
// 0. Initialize git repo if needed
|
|
33
|
+
if (!existsSync(join(projectRoot, '.git')) && (options.yes || config.init_git)) {
|
|
34
|
+
console.log(' Initializing git repository...');
|
|
35
35
|
const { execSync } = await import('child_process');
|
|
36
36
|
execSync('git init', { cwd: projectRoot, stdio: 'pipe' });
|
|
37
37
|
console.log(' Initialized git repository');
|
|
@@ -123,22 +123,23 @@ export async function init(options = {}) {
|
|
|
123
123
|
} catch (err) {
|
|
124
124
|
console.warn(` Warning: Failed to install ${mcpPackage}. Run "npm install -g ${mcpPackage}" manually.`);
|
|
125
125
|
}
|
|
126
|
-
// Register in .
|
|
127
|
-
const
|
|
128
|
-
let
|
|
129
|
-
if (fileExists(
|
|
126
|
+
// Register in .mcp.json (project-scope MCP config)
|
|
127
|
+
const mcpJsonPath = join(projectRoot, '.mcp.json');
|
|
128
|
+
let mcpConfig = {};
|
|
129
|
+
if (fileExists(mcpJsonPath)) {
|
|
130
130
|
try {
|
|
131
|
-
|
|
131
|
+
mcpConfig = JSON.parse(readFileSync(mcpJsonPath, 'utf-8'));
|
|
132
132
|
} catch { /* start fresh if parse fails */ }
|
|
133
133
|
}
|
|
134
|
-
if (!
|
|
135
|
-
if (!
|
|
136
|
-
|
|
134
|
+
if (!mcpConfig.mcpServers) mcpConfig.mcpServers = {};
|
|
135
|
+
if (!mcpConfig.mcpServers[mcpName]) {
|
|
136
|
+
mcpConfig.mcpServers[mcpName] = {
|
|
137
|
+
type: 'stdio',
|
|
137
138
|
command: 'npx',
|
|
138
|
-
args: [mcpPackage]
|
|
139
|
+
args: ['-y', mcpPackage]
|
|
139
140
|
};
|
|
140
|
-
writeFileSafe(
|
|
141
|
-
console.log(` Registered ${mcpName} in .
|
|
141
|
+
writeFileSafe(mcpJsonPath, JSON.stringify(mcpConfig, null, 2) + '\n');
|
|
142
|
+
console.log(` Registered ${mcpName} in .mcp.json`);
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
145
|
|
|
@@ -178,6 +179,17 @@ async function runWizard() {
|
|
|
178
179
|
|
|
179
180
|
console.log('\n valent-pipeline init\n');
|
|
180
181
|
|
|
182
|
+
// Git repo check
|
|
183
|
+
if (!existsSync(join(process.cwd(), '.git'))) {
|
|
184
|
+
const { initGit } = await inquirer.prompt([{
|
|
185
|
+
type: 'confirm',
|
|
186
|
+
name: 'initGit',
|
|
187
|
+
message: 'No git repository detected. Initialize one?',
|
|
188
|
+
default: true,
|
|
189
|
+
}]);
|
|
190
|
+
config.init_git = initGit;
|
|
191
|
+
}
|
|
192
|
+
|
|
181
193
|
// Project type
|
|
182
194
|
const { projectType } = await inquirer.prompt([{
|
|
183
195
|
type: 'list',
|