@meltstudio/meltctl 4.6.0 → 4.6.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.
- package/dist/commands/init.js +23 -1
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -167,7 +167,7 @@ export async function initCommand(options) {
|
|
|
167
167
|
const claudeSettings = templates['claude-settings.json'];
|
|
168
168
|
if (claudeSettings) {
|
|
169
169
|
await fs.ensureDir(path.join(cwd, '.claude'));
|
|
170
|
-
await
|
|
170
|
+
await mergeClaudeSettings(cwd, claudeSettings);
|
|
171
171
|
createdFiles.push('.claude/settings.json');
|
|
172
172
|
}
|
|
173
173
|
for (const name of workflows) {
|
|
@@ -246,6 +246,28 @@ async function mergeMcpConfig(cwd, templateContent) {
|
|
|
246
246
|
await fs.writeFile(mcpPath, templateContent, 'utf-8');
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
+
async function mergeClaudeSettings(cwd, templateContent) {
|
|
250
|
+
const settingsPath = path.join(cwd, '.claude/settings.json');
|
|
251
|
+
const templateConfig = JSON.parse(templateContent);
|
|
252
|
+
if (await fs.pathExists(settingsPath)) {
|
|
253
|
+
const existingContent = await fs.readFile(settingsPath, 'utf-8');
|
|
254
|
+
const existingConfig = JSON.parse(existingContent);
|
|
255
|
+
// Merge permissions: combine allow/deny lists, deduplicate
|
|
256
|
+
const existingAllow = existingConfig.permissions?.allow ?? [];
|
|
257
|
+
const existingDeny = existingConfig.permissions?.deny ?? [];
|
|
258
|
+
const templateAllow = templateConfig.permissions?.allow ?? [];
|
|
259
|
+
const templateDeny = templateConfig.permissions?.deny ?? [];
|
|
260
|
+
existingConfig.permissions = {
|
|
261
|
+
...existingConfig.permissions,
|
|
262
|
+
allow: [...new Set([...existingAllow, ...templateAllow])],
|
|
263
|
+
deny: [...new Set([...existingDeny, ...templateDeny])],
|
|
264
|
+
};
|
|
265
|
+
await fs.writeFile(settingsPath, JSON.stringify(existingConfig, null, 2) + '\n', 'utf-8');
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
await fs.writeFile(settingsPath, templateContent, 'utf-8');
|
|
269
|
+
}
|
|
270
|
+
}
|
|
249
271
|
async function updateGitignore(cwd) {
|
|
250
272
|
const gitignorePath = path.join(cwd, '.gitignore');
|
|
251
273
|
let content = '';
|
package/package.json
CHANGED