worclaude 1.3.2 → 1.3.4
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 +6 -1
- package/src/commands/upgrade.js +4 -1
- package/src/core/scaffolder.js +20 -0
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import inquirer from 'inquirer';
|
|
3
3
|
import ora from 'ora';
|
|
4
|
-
import { scaffoldFile } from '../core/scaffolder.js';
|
|
4
|
+
import { scaffoldFile, updateGitignore } from '../core/scaffolder.js';
|
|
5
5
|
import {
|
|
6
6
|
createWorkflowMeta,
|
|
7
7
|
getPackageVersion,
|
|
@@ -447,6 +447,9 @@ async function scaffoldFresh(projectRoot, selections, variables, settingsStr, ve
|
|
|
447
447
|
await scaffoldFile('mcp-json.json', '.mcp.json', {}, projectRoot);
|
|
448
448
|
spinner.text = 'Created .mcp.json';
|
|
449
449
|
|
|
450
|
+
await updateGitignore(projectRoot);
|
|
451
|
+
spinner.text = 'Updated .gitignore';
|
|
452
|
+
|
|
450
453
|
const progressPath = path.join(projectRoot, 'docs', 'spec', 'PROGRESS.md');
|
|
451
454
|
const specPath = path.join(projectRoot, 'docs', 'spec', 'SPEC.md');
|
|
452
455
|
const skipped = { progressMd: false, specMd: false };
|
|
@@ -499,6 +502,7 @@ function displayFreshSuccess(selections, skipped) {
|
|
|
499
502
|
display.success(`.claude/commands/${display.dimColor(` ${COMMAND_FILES.length} commands`)}`);
|
|
500
503
|
display.success(`.claude/skills/${display.dimColor(` ${totalSkills} skills`)}`);
|
|
501
504
|
display.success('.mcp.json');
|
|
505
|
+
display.success('.gitignore');
|
|
502
506
|
if (skipped.progressMd) {
|
|
503
507
|
display.dim(' docs/spec/PROGRESS.md — already exists, skipped');
|
|
504
508
|
} else if (skipped.specMd) {
|
|
@@ -719,6 +723,7 @@ export async function initCommand() {
|
|
|
719
723
|
const report = await performMerge(projectRoot, existingScan, selections, variables, {
|
|
720
724
|
spinner,
|
|
721
725
|
});
|
|
726
|
+
await updateGitignore(projectRoot);
|
|
722
727
|
await computeAndWriteWorkflowMeta(projectRoot, selections, version);
|
|
723
728
|
spinner.succeed('Workflow merged successfully!');
|
|
724
729
|
displayMergeReport(report, backupPath);
|
package/src/commands/upgrade.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { createBackup } from '../core/backup.js';
|
|
12
12
|
import { categorizeFiles } from '../core/file-categorizer.js';
|
|
13
13
|
import { buildSettingsJson, mergeSettingsPermissionsAndHooks } from '../core/merger.js';
|
|
14
|
-
import { readTemplate } from '../core/scaffolder.js';
|
|
14
|
+
import { readTemplate, updateGitignore } from '../core/scaffolder.js';
|
|
15
15
|
import { hashFile } from '../utils/hash.js';
|
|
16
16
|
import { writeFile, fileExists, listFilesRecursive } from '../utils/file.js';
|
|
17
17
|
import { getLatestNpmVersion } from '../utils/npm.js';
|
|
@@ -222,6 +222,9 @@ export async function upgradeCommand() {
|
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
// Ensure .gitignore has worclaude entries
|
|
226
|
+
await updateGitignore(projectRoot);
|
|
227
|
+
|
|
225
228
|
// Update meta
|
|
226
229
|
meta.version = currentVersion;
|
|
227
230
|
meta.lastUpdated = new Date().toISOString();
|
package/src/core/scaffolder.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import fs from 'fs-extra';
|
|
3
4
|
import { readFile, writeFile } from '../utils/file.js';
|
|
4
5
|
|
|
5
6
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -43,6 +44,25 @@ export async function scaffoldDirectory(templateDir, destDir, variables, project
|
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
export async function updateGitignore(projectDir) {
|
|
48
|
+
const gitignorePath = path.join(projectDir, '.gitignore');
|
|
49
|
+
const entries = ['.claude/', '.claude-backup-*/'];
|
|
50
|
+
const header = '# Worclaude (generated workflow files)';
|
|
51
|
+
|
|
52
|
+
let content = '';
|
|
53
|
+
if (await fs.pathExists(gitignorePath)) {
|
|
54
|
+
content = await fs.readFile(gitignorePath, 'utf8');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const missing = entries.filter((entry) => !content.includes(entry));
|
|
58
|
+
if (missing.length === 0) return false;
|
|
59
|
+
|
|
60
|
+
const needsNewline = content.length > 0 && !content.endsWith('\n');
|
|
61
|
+
const addition = (needsNewline ? '\n' : '') + '\n' + header + '\n' + missing.join('\n') + '\n';
|
|
62
|
+
await fs.appendFile(gitignorePath, addition);
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
|
|
46
66
|
export function mergeSettings(base, ...stacks) {
|
|
47
67
|
const merged = JSON.parse(JSON.stringify(base));
|
|
48
68
|
const baseAllow = merged.permissions?.allow || [];
|