worclaude 2.2.4 → 2.2.5
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/upgrade.js +20 -8
package/package.json
CHANGED
package/src/commands/upgrade.js
CHANGED
|
@@ -2,17 +2,13 @@ import path from 'node:path';
|
|
|
2
2
|
import { execSync } from 'node:child_process';
|
|
3
3
|
import inquirer from 'inquirer';
|
|
4
4
|
import ora from 'ora';
|
|
5
|
-
import {
|
|
6
|
-
computeFileHashes,
|
|
7
|
-
requireWorkflowMeta,
|
|
8
|
-
writeWorkflowMeta,
|
|
9
|
-
getPackageVersion,
|
|
10
|
-
} from '../core/config.js';
|
|
5
|
+
import { requireWorkflowMeta, writeWorkflowMeta, getPackageVersion } from '../core/config.js';
|
|
11
6
|
import { createBackup } from '../core/backup.js';
|
|
12
7
|
import { categorizeFiles } from '../core/file-categorizer.js';
|
|
13
8
|
import { buildSettingsJson, mergeSettingsPermissionsAndHooks } from '../core/merger.js';
|
|
14
9
|
import { readTemplate, updateGitignore } from '../core/scaffolder.js';
|
|
15
10
|
import { writeFile, fileExists } from '../utils/file.js';
|
|
11
|
+
import { hashFile } from '../utils/hash.js';
|
|
16
12
|
import { getLatestNpmVersion } from '../utils/npm.js';
|
|
17
13
|
import * as display from '../utils/display.js';
|
|
18
14
|
import { semverLessThan, migrateSkillFormat, patchAgentDescriptions } from '../core/migration.js';
|
|
@@ -240,8 +236,24 @@ export async function upgradeCommand() {
|
|
|
240
236
|
// Ensure sessions directory exists for session persistence
|
|
241
237
|
await writeFile(path.join(projectRoot, '.claude', 'sessions', '.gitkeep'), '');
|
|
242
238
|
|
|
243
|
-
//
|
|
244
|
-
|
|
239
|
+
// Partial hash update — rehash ONLY files we just wrote. User-customized
|
|
240
|
+
// ("modified") files and conflict-sidecar'd files keep their original
|
|
241
|
+
// stored hash so their "install state" baseline is preserved across
|
|
242
|
+
// upgrades. Otherwise the next template change would silently overwrite
|
|
243
|
+
// the customization via the autoUpdate path.
|
|
244
|
+
const fileHashes = { ...meta.fileHashes };
|
|
245
|
+
for (const { key } of categories.autoUpdate) {
|
|
246
|
+
const filePath = path.join(projectRoot, '.claude', ...key.split('/'));
|
|
247
|
+
fileHashes[key] = await hashFile(filePath);
|
|
248
|
+
}
|
|
249
|
+
for (const { key } of categories.newFiles) {
|
|
250
|
+
const filePath = path.join(projectRoot, '.claude', ...key.split('/'));
|
|
251
|
+
fileHashes[key] = await hashFile(filePath);
|
|
252
|
+
}
|
|
253
|
+
for (const { key } of categories.deleted) {
|
|
254
|
+
delete fileHashes[key];
|
|
255
|
+
}
|
|
256
|
+
// modified, conflict, unchanged, userAdded: stored hash deliberately left alone
|
|
245
257
|
|
|
246
258
|
// Ensure .gitignore has worclaude entries
|
|
247
259
|
await updateGitignore(projectRoot);
|