k0ntext 3.3.1 → 3.6.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/README.md +225 -26
- package/dist/agents/cleanup-agent.d.ts.map +1 -1
- package/dist/agents/cleanup-agent.js +18 -6
- package/dist/agents/cleanup-agent.js.map +1 -1
- package/dist/agents/drift-agent.d.ts +7 -0
- package/dist/agents/drift-agent.d.ts.map +1 -1
- package/dist/agents/drift-agent.js +29 -8
- package/dist/agents/drift-agent.js.map +1 -1
- package/dist/cli/commands/cleanup.d.ts.map +1 -1
- package/dist/cli/commands/cleanup.js +8 -1
- package/dist/cli/commands/cleanup.js.map +1 -1
- package/dist/cli/commands/drift-detect.d.ts.map +1 -1
- package/dist/cli/commands/drift-detect.js +21 -1
- package/dist/cli/commands/drift-detect.js.map +1 -1
- package/dist/cli/commands/embeddings-refresh.d.ts +11 -0
- package/dist/cli/commands/embeddings-refresh.d.ts.map +1 -0
- package/dist/cli/commands/embeddings-refresh.js +114 -0
- package/dist/cli/commands/embeddings-refresh.js.map +1 -0
- package/dist/cli/commands/migrate.d.ts +11 -0
- package/dist/cli/commands/migrate.d.ts.map +1 -0
- package/dist/cli/commands/migrate.js +195 -0
- package/dist/cli/commands/migrate.js.map +1 -0
- package/dist/cli/commands/restore.d.ts +12 -0
- package/dist/cli/commands/restore.d.ts.map +1 -0
- package/dist/cli/commands/restore.js +261 -0
- package/dist/cli/commands/restore.js.map +1 -0
- package/dist/cli/commands/sync-templates.d.ts +15 -0
- package/dist/cli/commands/sync-templates.d.ts.map +1 -0
- package/dist/cli/commands/sync-templates.js +181 -0
- package/dist/cli/commands/sync-templates.js.map +1 -0
- package/dist/cli/commands/version-check.d.ts +12 -0
- package/dist/cli/commands/version-check.d.ts.map +1 -0
- package/dist/cli/commands/version-check.js +133 -0
- package/dist/cli/commands/version-check.js.map +1 -0
- package/dist/cli/generate.d.ts +5 -0
- package/dist/cli/generate.d.ts.map +1 -1
- package/dist/cli/generate.js +80 -16
- package/dist/cli/generate.js.map +1 -1
- package/dist/cli/index.js +215 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/repl/index.d.ts +1 -0
- package/dist/cli/repl/index.d.ts.map +1 -1
- package/dist/cli/repl/index.js +18 -6
- package/dist/cli/repl/index.js.map +1 -1
- package/dist/cli/utils/backup-manager.d.ts +94 -0
- package/dist/cli/utils/backup-manager.d.ts.map +1 -0
- package/dist/cli/utils/backup-manager.js +230 -0
- package/dist/cli/utils/backup-manager.js.map +1 -0
- package/dist/cli/utils/db-backup-manager.d.ts +55 -0
- package/dist/cli/utils/db-backup-manager.d.ts.map +1 -0
- package/dist/cli/utils/db-backup-manager.js +115 -0
- package/dist/cli/utils/db-backup-manager.js.map +1 -0
- package/dist/cli/utils/file-detector.d.ts +87 -0
- package/dist/cli/utils/file-detector.d.ts.map +1 -0
- package/dist/cli/utils/file-detector.js +131 -0
- package/dist/cli/utils/file-detector.js.map +1 -0
- package/dist/cli/utils/index.d.ts +9 -0
- package/dist/cli/utils/index.d.ts.map +1 -0
- package/dist/cli/utils/index.js +9 -0
- package/dist/cli/utils/index.js.map +1 -0
- package/dist/cli/utils/modification-prompt.d.ts +41 -0
- package/dist/cli/utils/modification-prompt.d.ts.map +1 -0
- package/dist/cli/utils/modification-prompt.js +84 -0
- package/dist/cli/utils/modification-prompt.js.map +1 -0
- package/dist/cli/version/checker.d.ts +47 -0
- package/dist/cli/version/checker.d.ts.map +1 -0
- package/dist/cli/version/checker.js +143 -0
- package/dist/cli/version/checker.js.map +1 -0
- package/dist/cli/version/comparator.d.ts +46 -0
- package/dist/cli/version/comparator.d.ts.map +1 -0
- package/dist/cli/version/comparator.js +99 -0
- package/dist/cli/version/comparator.js.map +1 -0
- package/dist/cli/version/index.d.ts +11 -0
- package/dist/cli/version/index.d.ts.map +1 -0
- package/dist/cli/version/index.js +11 -0
- package/dist/cli/version/index.js.map +1 -0
- package/dist/cli/version/parser.d.ts +38 -0
- package/dist/cli/version/parser.d.ts.map +1 -0
- package/dist/cli/version/parser.js +90 -0
- package/dist/cli/version/parser.js.map +1 -0
- package/dist/cli/version/prompt.d.ts +40 -0
- package/dist/cli/version/prompt.d.ts.map +1 -0
- package/dist/cli/version/prompt.js +162 -0
- package/dist/cli/version/prompt.js.map +1 -0
- package/dist/cli/version/types.d.ts +89 -0
- package/dist/cli/version/types.d.ts.map +1 -0
- package/dist/cli/version/types.js +7 -0
- package/dist/cli/version/types.js.map +1 -0
- package/dist/db/client.d.ts +79 -4
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +207 -12
- package/dist/db/client.js.map +1 -1
- package/dist/db/migrations/files/0014_add_schema_migrations_table.d.ts +14 -0
- package/dist/db/migrations/files/0014_add_schema_migrations_table.d.ts.map +1 -0
- package/dist/db/migrations/files/0014_add_schema_migrations_table.js +25 -0
- package/dist/db/migrations/files/0014_add_schema_migrations_table.js.map +1 -0
- package/dist/db/migrations/index.d.ts +9 -0
- package/dist/db/migrations/index.d.ts.map +1 -0
- package/dist/db/migrations/index.js +9 -0
- package/dist/db/migrations/index.js.map +1 -0
- package/dist/db/migrations/loader.d.ts +27 -0
- package/dist/db/migrations/loader.d.ts.map +1 -0
- package/dist/db/migrations/loader.js +106 -0
- package/dist/db/migrations/loader.js.map +1 -0
- package/dist/db/migrations/runner.d.ts +56 -0
- package/dist/db/migrations/runner.d.ts.map +1 -0
- package/dist/db/migrations/runner.js +266 -0
- package/dist/db/migrations/runner.js.map +1 -0
- package/dist/db/migrations/types.d.ts +71 -0
- package/dist/db/migrations/types.d.ts.map +1 -0
- package/dist/db/migrations/types.js +7 -0
- package/dist/db/migrations/types.js.map +1 -0
- package/dist/db/schema.d.ts +41 -2
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +77 -2
- package/dist/db/schema.js.map +1 -1
- package/dist/mcp.js +2 -2
- package/dist/mcp.js.map +1 -1
- package/dist/template-engine/data-transformer.d.ts +17 -0
- package/dist/template-engine/data-transformer.d.ts.map +1 -0
- package/dist/template-engine/data-transformer.js +343 -0
- package/dist/template-engine/data-transformer.js.map +1 -0
- package/dist/template-engine/engine.d.ts +74 -0
- package/dist/template-engine/engine.d.ts.map +1 -0
- package/dist/template-engine/engine.js +183 -0
- package/dist/template-engine/engine.js.map +1 -0
- package/dist/template-engine/helpers.d.ts +81 -0
- package/dist/template-engine/helpers.d.ts.map +1 -0
- package/dist/template-engine/helpers.js +153 -0
- package/dist/template-engine/helpers.js.map +1 -0
- package/dist/template-engine/index.d.ts +10 -0
- package/dist/template-engine/index.d.ts.map +1 -0
- package/dist/template-engine/index.js +10 -0
- package/dist/template-engine/index.js.map +1 -0
- package/dist/template-engine/types.d.ts +147 -0
- package/dist/template-engine/types.d.ts.map +1 -0
- package/dist/template-engine/types.js +7 -0
- package/dist/template-engine/types.js.map +1 -0
- package/dist/template-sync/comparator.d.ts +138 -0
- package/dist/template-sync/comparator.d.ts.map +1 -0
- package/dist/template-sync/comparator.js +353 -0
- package/dist/template-sync/comparator.js.map +1 -0
- package/dist/template-sync/conflict-resolver.d.ts +112 -0
- package/dist/template-sync/conflict-resolver.d.ts.map +1 -0
- package/dist/template-sync/conflict-resolver.js +328 -0
- package/dist/template-sync/conflict-resolver.js.map +1 -0
- package/dist/template-sync/engine.d.ts +93 -0
- package/dist/template-sync/engine.d.ts.map +1 -0
- package/dist/template-sync/engine.js +350 -0
- package/dist/template-sync/engine.js.map +1 -0
- package/dist/template-sync/hasher.d.ts +67 -0
- package/dist/template-sync/hasher.d.ts.map +1 -0
- package/dist/template-sync/hasher.js +94 -0
- package/dist/template-sync/hasher.js.map +1 -0
- package/dist/template-sync/index.d.ts +20 -0
- package/dist/template-sync/index.d.ts.map +1 -0
- package/dist/template-sync/index.js +14 -0
- package/dist/template-sync/index.js.map +1 -0
- package/dist/template-sync/manifest.d.ts +131 -0
- package/dist/template-sync/manifest.d.ts.map +1 -0
- package/dist/template-sync/manifest.js +309 -0
- package/dist/template-sync/manifest.js.map +1 -0
- package/dist/template-sync/merger.d.ts +125 -0
- package/dist/template-sync/merger.d.ts.map +1 -0
- package/dist/template-sync/merger.js +371 -0
- package/dist/template-sync/merger.js.map +1 -0
- package/dist/template-sync/scanner.d.ts +106 -0
- package/dist/template-sync/scanner.d.ts.map +1 -0
- package/dist/template-sync/scanner.js +196 -0
- package/dist/template-sync/scanner.js.map +1 -0
- package/dist/template-sync/types.d.ts +199 -0
- package/dist/template-sync/types.d.ts.map +1 -0
- package/dist/template-sync/types.js +30 -0
- package/dist/template-sync/types.js.map +1 -0
- package/package.json +2 -1
- package/src/agents/cleanup-agent.ts +21 -6
- package/src/agents/drift-agent.ts +31 -8
- package/src/cli/commands/cleanup.ts +9 -1
- package/src/cli/commands/drift-detect.ts +24 -1
- package/src/cli/commands/embeddings-refresh.ts +135 -0
- package/src/cli/commands/migrate.ts +231 -0
- package/src/cli/commands/restore.ts +318 -0
- package/src/cli/commands/sync-templates.ts +210 -0
- package/src/cli/commands/version-check.ts +158 -0
- package/src/cli/generate.ts +99 -17
- package/src/cli/index.ts +246 -1
- package/src/cli/repl/index.ts +16 -6
- package/src/cli/utils/backup-manager.ts +275 -0
- package/src/cli/utils/db-backup-manager.ts +146 -0
- package/src/cli/utils/file-detector.ts +181 -0
- package/src/cli/utils/index.ts +9 -0
- package/src/cli/utils/modification-prompt.ts +112 -0
- package/src/cli/version/checker.ts +172 -0
- package/src/cli/version/comparator.ts +106 -0
- package/src/cli/version/index.ts +11 -0
- package/src/cli/version/parser.ts +101 -0
- package/src/cli/version/prompt.ts +208 -0
- package/src/cli/version/types.ts +95 -0
- package/src/db/client.ts +285 -18
- package/src/db/migrations/files/0014_add_schema_migrations_table.sql +19 -0
- package/src/db/migrations/files/0014_add_schema_migrations_table.ts +30 -0
- package/src/db/migrations/index.ts +9 -0
- package/src/db/migrations/loader.ts +129 -0
- package/src/db/migrations/runner.ts +316 -0
- package/src/db/migrations/types.ts +71 -0
- package/src/db/schema.ts +109 -2
- package/src/mcp.ts +2 -2
- package/src/template-engine/data-transformer.ts +367 -0
- package/src/template-engine/engine.ts +213 -0
- package/src/template-engine/helpers.ts +163 -0
- package/src/template-engine/index.ts +10 -0
- package/src/template-engine/types.ts +158 -0
- package/src/template-sync/comparator.ts +452 -0
- package/src/template-sync/conflict-resolver.ts +401 -0
- package/src/template-sync/engine.ts +417 -0
- package/src/template-sync/hasher.ts +104 -0
- package/src/template-sync/index.ts +60 -0
- package/src/template-sync/manifest.ts +358 -0
- package/src/template-sync/merger.ts +454 -0
- package/src/template-sync/scanner.ts +254 -0
- package/src/template-sync/types.ts +247 -0
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Sync Engine
|
|
3
|
+
*
|
|
4
|
+
* Main orchestrator for template synchronization.
|
|
5
|
+
* Coordinates comparison, merging, conflict resolution, and manifest updates.
|
|
6
|
+
*/
|
|
7
|
+
import ora from 'ora';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
import { promises as fs, readFileSync } from 'fs';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
import { BackupManager } from '../cli/utils/backup-manager.js';
|
|
13
|
+
import { TemplateComparator } from './comparator.js';
|
|
14
|
+
import { TemplateMerger } from './merger.js';
|
|
15
|
+
import { ConflictResolver } from './conflict-resolver.js';
|
|
16
|
+
import { TemplateManifestManager } from './manifest.js';
|
|
17
|
+
import { TemplateHasher } from './hasher.js';
|
|
18
|
+
// ES module __dirname equivalent
|
|
19
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
20
|
+
const __dirname = path.dirname(__filename);
|
|
21
|
+
/**
|
|
22
|
+
* Main template sync orchestrator
|
|
23
|
+
*/
|
|
24
|
+
export class TemplateSyncEngine {
|
|
25
|
+
db;
|
|
26
|
+
projectRoot;
|
|
27
|
+
templateRoot;
|
|
28
|
+
manifestManager;
|
|
29
|
+
backupManager;
|
|
30
|
+
packageVersion;
|
|
31
|
+
constructor(db, projectRoot = process.cwd(), templateRoot = path.resolve(__dirname, '../../templates/base')) {
|
|
32
|
+
this.db = db;
|
|
33
|
+
this.projectRoot = projectRoot;
|
|
34
|
+
this.templateRoot = templateRoot;
|
|
35
|
+
this.manifestManager = new TemplateManifestManager(db, projectRoot);
|
|
36
|
+
this.backupManager = new BackupManager(db, projectRoot);
|
|
37
|
+
this.packageVersion = this.getPackageVersion();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Execute full sync operation
|
|
41
|
+
*
|
|
42
|
+
* @param options - Sync options
|
|
43
|
+
* @returns Sync result
|
|
44
|
+
*/
|
|
45
|
+
async sync(options = {}) {
|
|
46
|
+
const startTime = Date.now();
|
|
47
|
+
const spinner = ora('Preparing template sync...').start();
|
|
48
|
+
try {
|
|
49
|
+
// Step 1: Compare templates
|
|
50
|
+
spinner.text = 'Comparing templates...';
|
|
51
|
+
const comparator = new TemplateComparator(this.db, this.projectRoot, this.templateRoot, options.verbose);
|
|
52
|
+
const comparisonResult = await comparator.compare({
|
|
53
|
+
subdirectories: options.subdirectories,
|
|
54
|
+
checkUserModifications: true,
|
|
55
|
+
verbose: options.verbose
|
|
56
|
+
});
|
|
57
|
+
const comparisons = comparisonResult.comparisons;
|
|
58
|
+
if (options.dryRun) {
|
|
59
|
+
spinner.stop();
|
|
60
|
+
this.showDryRunResults(comparisons, options.verbose);
|
|
61
|
+
return {
|
|
62
|
+
total: comparisons.length,
|
|
63
|
+
updated: 0,
|
|
64
|
+
skipped: comparisons.map(c => c.path),
|
|
65
|
+
created: 0,
|
|
66
|
+
conflicts: comparisons.filter(c => c.state === 'conflict'),
|
|
67
|
+
userOnly: [],
|
|
68
|
+
durationMs: Date.now() - startTime,
|
|
69
|
+
dryRun: true
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
// Step 2: Separate into categories
|
|
73
|
+
const safeUpdates = TemplateComparator.getSafeUpdates(comparisons);
|
|
74
|
+
const conflicts = TemplateComparator.getConflicts(comparisons);
|
|
75
|
+
const userOnly = comparisons.filter(c => c.state === 'user-only');
|
|
76
|
+
// Step 3: Auto-merge safe updates
|
|
77
|
+
spinner.text = `Auto-merging ${safeUpdates.length} safe update(s)...`;
|
|
78
|
+
const merger = new TemplateMerger(this.projectRoot, this.templateRoot, {
|
|
79
|
+
createBackups: true,
|
|
80
|
+
generateDiffs: options.verbose
|
|
81
|
+
});
|
|
82
|
+
const mergeResults = await merger.mergeFiles(safeUpdates);
|
|
83
|
+
const stats = TemplateMerger.getStatistics(mergeResults);
|
|
84
|
+
// Step 4: Handle conflicts
|
|
85
|
+
let conflictResolutions = new Map();
|
|
86
|
+
let resolvedConflicts = [];
|
|
87
|
+
if (conflicts.length > 0 && !options.force) {
|
|
88
|
+
spinner.stop();
|
|
89
|
+
const resolver = new ConflictResolver(this.projectRoot, this.templateRoot);
|
|
90
|
+
const resolutions = await resolver.resolveConflicts(conflicts);
|
|
91
|
+
for (const resolution of resolutions) {
|
|
92
|
+
if (resolution.choice === 'overwrite' || resolution.choice === 'keep-local') {
|
|
93
|
+
conflictResolutions.set(resolution.path, resolution.choice);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Apply overwrite resolutions
|
|
97
|
+
if (conflictResolutions.size > 0) {
|
|
98
|
+
spinner.start('Applying conflict resolutions...');
|
|
99
|
+
const applied = await resolver.applyResolutions(resolutions.map(r => ({ path: r.path, choice: r.choice })), conflicts);
|
|
100
|
+
resolvedConflicts = Array.from(conflictResolutions.keys())
|
|
101
|
+
.map(path => conflicts.find(c => c.path === path))
|
|
102
|
+
.filter(Boolean);
|
|
103
|
+
spinner.succeed(`Applied ${applied.applied} resolution(s)`);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
spinner.start('Continuing sync...');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else if (conflicts.length > 0 && options.force) {
|
|
110
|
+
// Force: overwrite all conflicts
|
|
111
|
+
spinner.stop();
|
|
112
|
+
const resolver = new ConflictResolver(this.projectRoot, this.templateRoot);
|
|
113
|
+
// Mark all conflicts for overwrite
|
|
114
|
+
const resolutions = conflicts.map(conflict => ({
|
|
115
|
+
path: conflict.path,
|
|
116
|
+
choice: 'overwrite'
|
|
117
|
+
}));
|
|
118
|
+
// Also update the conflictResolutions map for proper return value
|
|
119
|
+
for (const conflict of conflicts) {
|
|
120
|
+
conflictResolutions.set(conflict.path, 'overwrite');
|
|
121
|
+
}
|
|
122
|
+
// Apply the overwrites
|
|
123
|
+
spinner.start('Applying forced overwrites...');
|
|
124
|
+
const applied = await resolver.applyResolutions(resolutions, conflicts);
|
|
125
|
+
resolvedConflicts = conflicts;
|
|
126
|
+
spinner.succeed(`Applied ${applied.applied} forced overwrite(s)`);
|
|
127
|
+
spinner.start('Continuing sync...');
|
|
128
|
+
}
|
|
129
|
+
// Step 5: Archive removed files if enabled
|
|
130
|
+
let archived = [];
|
|
131
|
+
if (options.archiveRemoved && userOnly.length > 0) {
|
|
132
|
+
spinner.text = 'Archiving removed files...';
|
|
133
|
+
archived = await this.archiveRemovedFiles(userOnly.map(f => f.path));
|
|
134
|
+
}
|
|
135
|
+
// Step 6: Update manifest
|
|
136
|
+
spinner.text = 'Updating manifest...';
|
|
137
|
+
await this.updateManifest(comparisons);
|
|
138
|
+
// Step 7: Update user-modified flags in database
|
|
139
|
+
await this.updateUserModifiedFlags(comparisons);
|
|
140
|
+
const skipped = [
|
|
141
|
+
...comparisons.filter(c => c.state === 'identical').map(c => c.path),
|
|
142
|
+
...Array.from(conflictResolutions.entries())
|
|
143
|
+
.filter(([_, choice]) => choice === 'keep-local')
|
|
144
|
+
.map(([path, _]) => path)
|
|
145
|
+
];
|
|
146
|
+
spinner.succeed(chalk.green('Template sync complete'));
|
|
147
|
+
return {
|
|
148
|
+
total: comparisons.length,
|
|
149
|
+
updated: stats.successful,
|
|
150
|
+
skipped,
|
|
151
|
+
created: stats.byMethod['auto-create'],
|
|
152
|
+
conflicts: comparisons.filter(c => c.state === 'conflict' && !conflictResolutions.has(c.path)),
|
|
153
|
+
userOnly: userOnly.map(f => f.path),
|
|
154
|
+
durationMs: Date.now() - startTime
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
spinner.fail(chalk.red('Template sync failed'));
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Update manifest after sync
|
|
164
|
+
*
|
|
165
|
+
* @param comparisons - File comparisons
|
|
166
|
+
*/
|
|
167
|
+
async updateManifest(comparisons) {
|
|
168
|
+
// Get or create manifest
|
|
169
|
+
let manifest = await this.manifestManager.loadReconciledManifest();
|
|
170
|
+
if (!manifest) {
|
|
171
|
+
manifest = this.manifestManager.createEmptyManifest(this.packageVersion, this.packageVersion);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
// Update versions
|
|
175
|
+
manifest.k0ntextVersion = this.packageVersion;
|
|
176
|
+
manifest.templateVersion = this.packageVersion;
|
|
177
|
+
}
|
|
178
|
+
const templateBasePath = this.templateRoot;
|
|
179
|
+
// Update file entries
|
|
180
|
+
for (const comparison of comparisons) {
|
|
181
|
+
if (comparison.state === 'user-only' || comparison.state === 'deleted') {
|
|
182
|
+
// Skip user-only files or deleted files
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
const templatePath = path.join(templateBasePath, comparison.path);
|
|
186
|
+
const hash = await TemplateHasher.hashFileSafe(templatePath);
|
|
187
|
+
// Get existing entry to preserve userModified flag
|
|
188
|
+
const existingEntry = manifest.files[comparison.path];
|
|
189
|
+
const userModified = existingEntry?.userModified ?? comparison.userModified;
|
|
190
|
+
manifest.files[comparison.path] = {
|
|
191
|
+
hash,
|
|
192
|
+
templateVersion: this.packageVersion,
|
|
193
|
+
userModified,
|
|
194
|
+
lastSyncedAt: new Date().toISOString(),
|
|
195
|
+
originalHash: userModified ? existingEntry?.originalHash : undefined
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
await this.manifestManager.syncManifest(manifest, 'db');
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Update user-modified flags in database
|
|
202
|
+
*
|
|
203
|
+
* @param comparisons - File comparisons
|
|
204
|
+
*/
|
|
205
|
+
async updateUserModifiedFlags(comparisons) {
|
|
206
|
+
for (const comparison of comparisons) {
|
|
207
|
+
if (comparison.userModified && comparison.state === 'conflict') {
|
|
208
|
+
await this.manifestManager.markUserModified(comparison.path, comparison.originalHash);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Archive removed files
|
|
214
|
+
*
|
|
215
|
+
* @param filePaths - Relative paths to files
|
|
216
|
+
* @returns Array of archived file paths
|
|
217
|
+
*/
|
|
218
|
+
async archiveRemovedFiles(filePaths) {
|
|
219
|
+
const archiveDir = path.join(this.projectRoot, '.k0ntext', 'archive');
|
|
220
|
+
await fs.mkdir(archiveDir, { recursive: true });
|
|
221
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
222
|
+
const archived = [];
|
|
223
|
+
for (const relativePath of filePaths) {
|
|
224
|
+
const localPath = path.join(this.projectRoot, '.claude', relativePath);
|
|
225
|
+
try {
|
|
226
|
+
const archivePath = path.join(archiveDir, `${relativePath}.${timestamp}.archived`);
|
|
227
|
+
await fs.mkdir(path.dirname(archivePath), { recursive: true });
|
|
228
|
+
await fs.copyFile(localPath, archivePath);
|
|
229
|
+
await fs.unlink(localPath);
|
|
230
|
+
archived.push(relativePath);
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
// File might not exist, skip
|
|
234
|
+
if (error.code !== 'ENOENT') {
|
|
235
|
+
console.warn(`Warning: Could not archive ${relativePath}: ${error}`);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return archived;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Check if sync is needed
|
|
243
|
+
*
|
|
244
|
+
* @returns true if templates need updating
|
|
245
|
+
*/
|
|
246
|
+
async needsSync() {
|
|
247
|
+
// First check if package version has changed
|
|
248
|
+
const versionChanged = await this.manifestManager.needsUpdate(this.packageVersion);
|
|
249
|
+
if (versionChanged) {
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
// Even if version hasn't changed, check for user modifications or conflicts
|
|
253
|
+
// This ensures we detect files modified after initial sync
|
|
254
|
+
try {
|
|
255
|
+
const comparator = new TemplateComparator(this.db, this.projectRoot, this.templateRoot, false);
|
|
256
|
+
const comparisonResult = await comparator.compare({
|
|
257
|
+
checkUserModifications: true
|
|
258
|
+
});
|
|
259
|
+
// Check if there are any actionable files (conflicts, safe updates, or new files)
|
|
260
|
+
const actionableFiles = TemplateComparator.getActionableComparisons(comparisonResult.comparisons);
|
|
261
|
+
const conflicts = TemplateComparator.getConflicts(comparisonResult.comparisons);
|
|
262
|
+
// Need sync if there are conflicts (user-modified files) or other actionable items
|
|
263
|
+
return actionableFiles.length > 0 || conflicts.length > 0;
|
|
264
|
+
}
|
|
265
|
+
catch {
|
|
266
|
+
// If comparison fails, assume sync is needed to be safe
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Get current manifest
|
|
272
|
+
*
|
|
273
|
+
* @returns Current manifest or null
|
|
274
|
+
*/
|
|
275
|
+
async getManifest() {
|
|
276
|
+
return await this.manifestManager.loadReconciledManifest();
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Get template version from package
|
|
280
|
+
*
|
|
281
|
+
* @returns Package version string
|
|
282
|
+
*/
|
|
283
|
+
getPackageVersion() {
|
|
284
|
+
try {
|
|
285
|
+
const packageJsonPath = path.join(__dirname, '../../package.json');
|
|
286
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
287
|
+
return packageJson.version || '0.0.0';
|
|
288
|
+
}
|
|
289
|
+
catch {
|
|
290
|
+
return '0.0.0';
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Get template root path
|
|
295
|
+
*/
|
|
296
|
+
getTemplateRoot() {
|
|
297
|
+
return this.templateRoot;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Get project root path
|
|
301
|
+
*/
|
|
302
|
+
getProjectRoot() {
|
|
303
|
+
return this.projectRoot;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Show dry run results
|
|
307
|
+
*
|
|
308
|
+
* @param comparisons - File comparisons
|
|
309
|
+
* @param verbose - Whether to show verbose output
|
|
310
|
+
*/
|
|
311
|
+
showDryRunResults(comparisons, verbose = false) {
|
|
312
|
+
const resolver = new ConflictResolver(this.projectRoot, this.templateRoot);
|
|
313
|
+
resolver.showDryRunResults(comparisons);
|
|
314
|
+
if (verbose) {
|
|
315
|
+
console.log(chalk.bold('\nVerbose Details:\n'));
|
|
316
|
+
for (const comparison of comparisons) {
|
|
317
|
+
console.log(chalk.cyan(`${comparison.path}`));
|
|
318
|
+
console.log(chalk.dim(` State: ${comparison.state}`));
|
|
319
|
+
console.log(chalk.dim(` Template hash: ${comparison.templateHash}`));
|
|
320
|
+
console.log(chalk.dim(` Local hash: ${comparison.localHash}`));
|
|
321
|
+
if (comparison.userModified) {
|
|
322
|
+
console.log(chalk.yellow(` User modified: Yes`));
|
|
323
|
+
}
|
|
324
|
+
if (comparison.originalHash) {
|
|
325
|
+
console.log(chalk.dim(` Original hash: ${comparison.originalHash}`));
|
|
326
|
+
}
|
|
327
|
+
console.log('');
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Get sync status summary
|
|
333
|
+
*
|
|
334
|
+
* @returns Status summary
|
|
335
|
+
*/
|
|
336
|
+
async getStatusSummary() {
|
|
337
|
+
const manifest = await this.manifestManager.loadReconciledManifest();
|
|
338
|
+
const manifestExists = await this.manifestManager.manifestExists();
|
|
339
|
+
const userModifiedFiles = await this.manifestManager.getUserModifiedFiles();
|
|
340
|
+
const needsUpdate = await this.manifestManager.needsUpdate(this.packageVersion);
|
|
341
|
+
return {
|
|
342
|
+
manifestExists,
|
|
343
|
+
templateVersion: manifest?.templateVersion ?? null,
|
|
344
|
+
currentVersion: this.packageVersion,
|
|
345
|
+
needsUpdate,
|
|
346
|
+
userModifiedFiles
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/template-sync/engine.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,GAAY,MAAM,KAAK,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,iCAAiC;AACjC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAMnB;IACA;IACA;IAPF,eAAe,CAA0B;IACzC,aAAa,CAAgB;IACpB,cAAc,CAAS;IAExC,YACU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AW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAEhF,OAAO;YACL,cAAc;YACd,eAAe,EAAE,QAAQ,EAAE,eAAe,IAAI,IAAI;YAClD,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,WAAW;YACX,iBAAiB;SAClB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Hasher
|
|
3
|
+
*
|
|
4
|
+
* Hash generation utilities for template files.
|
|
5
|
+
* Uses SHA-256 with 16-character slice for consistency with DatabaseClient.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Template hasher - generates content hashes
|
|
9
|
+
*
|
|
10
|
+
* Uses the same hashing algorithm as DatabaseClient.hashContent() for consistency:
|
|
11
|
+
* - SHA-256 hash
|
|
12
|
+
* - Sliced to 16 characters
|
|
13
|
+
*/
|
|
14
|
+
export declare class TemplateHasher {
|
|
15
|
+
/**
|
|
16
|
+
* Hash file content using SHA256 (16 char slice for consistency)
|
|
17
|
+
*
|
|
18
|
+
* @param content - File content to hash
|
|
19
|
+
* @returns 16-character hash string
|
|
20
|
+
*/
|
|
21
|
+
static hashContent(content: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Hash a file by reading its content
|
|
24
|
+
*
|
|
25
|
+
* @param filePath - Absolute path to the file
|
|
26
|
+
* @returns 16-character hash string
|
|
27
|
+
* @throws Error if file cannot be read
|
|
28
|
+
*/
|
|
29
|
+
static hashFile(filePath: string): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Hash a file by path with error handling
|
|
32
|
+
*
|
|
33
|
+
* @param filePath - Absolute path to the file
|
|
34
|
+
* @returns 16-character hash string, or empty string if file doesn't exist
|
|
35
|
+
*/
|
|
36
|
+
static hashFileSafe(filePath: string): Promise<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Compare two hashes for equality
|
|
39
|
+
*
|
|
40
|
+
* @param hash1 - First hash
|
|
41
|
+
* @param hash2 - Second hash
|
|
42
|
+
* @returns true if hashes are identical
|
|
43
|
+
*/
|
|
44
|
+
static compare(hash1: string, hash2: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Check if a hash is valid (non-empty, 16 characters, hexadecimal)
|
|
47
|
+
*
|
|
48
|
+
* @param hash - Hash string to validate
|
|
49
|
+
* @returns true if hash is valid
|
|
50
|
+
*/
|
|
51
|
+
static isValidHash(hash: string): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Hash multiple files in parallel
|
|
54
|
+
*
|
|
55
|
+
* @param filePaths - Array of absolute file paths
|
|
56
|
+
* @returns Map of file path to hash
|
|
57
|
+
*/
|
|
58
|
+
static hashFiles(filePaths: string[]): Promise<Map<string, string>>;
|
|
59
|
+
/**
|
|
60
|
+
* Generate a hash from a buffer
|
|
61
|
+
*
|
|
62
|
+
* @param buffer - Buffer to hash
|
|
63
|
+
* @returns 16-character hash string
|
|
64
|
+
*/
|
|
65
|
+
static hashBuffer(buffer: Buffer): string;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=hasher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasher.d.ts","sourceRoot":"","sources":["../../src/template-sync/hasher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;;;GAMG;AACH,qBAAa,cAAc;IACzB;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAI3C;;;;;;OAMG;WACU,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAKxD;;;;;OAKG;WACU,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ5D;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAIrD;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIzC;;;;;OAKG;WACU,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAazE;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;CAG1C"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Hasher
|
|
3
|
+
*
|
|
4
|
+
* Hash generation utilities for template files.
|
|
5
|
+
* Uses SHA-256 with 16-character slice for consistency with DatabaseClient.
|
|
6
|
+
*/
|
|
7
|
+
import { createHash } from 'crypto';
|
|
8
|
+
import { promises as fs } from 'fs';
|
|
9
|
+
/**
|
|
10
|
+
* Template hasher - generates content hashes
|
|
11
|
+
*
|
|
12
|
+
* Uses the same hashing algorithm as DatabaseClient.hashContent() for consistency:
|
|
13
|
+
* - SHA-256 hash
|
|
14
|
+
* - Sliced to 16 characters
|
|
15
|
+
*/
|
|
16
|
+
export class TemplateHasher {
|
|
17
|
+
/**
|
|
18
|
+
* Hash file content using SHA256 (16 char slice for consistency)
|
|
19
|
+
*
|
|
20
|
+
* @param content - File content to hash
|
|
21
|
+
* @returns 16-character hash string
|
|
22
|
+
*/
|
|
23
|
+
static hashContent(content) {
|
|
24
|
+
return createHash('sha256').update(content, 'utf8').digest('hex').slice(0, 16);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Hash a file by reading its content
|
|
28
|
+
*
|
|
29
|
+
* @param filePath - Absolute path to the file
|
|
30
|
+
* @returns 16-character hash string
|
|
31
|
+
* @throws Error if file cannot be read
|
|
32
|
+
*/
|
|
33
|
+
static async hashFile(filePath) {
|
|
34
|
+
const content = await fs.readFile(filePath, 'utf8');
|
|
35
|
+
return this.hashContent(content);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Hash a file by path with error handling
|
|
39
|
+
*
|
|
40
|
+
* @param filePath - Absolute path to the file
|
|
41
|
+
* @returns 16-character hash string, or empty string if file doesn't exist
|
|
42
|
+
*/
|
|
43
|
+
static async hashFileSafe(filePath) {
|
|
44
|
+
try {
|
|
45
|
+
return await this.hashFile(filePath);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return '';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Compare two hashes for equality
|
|
53
|
+
*
|
|
54
|
+
* @param hash1 - First hash
|
|
55
|
+
* @param hash2 - Second hash
|
|
56
|
+
* @returns true if hashes are identical
|
|
57
|
+
*/
|
|
58
|
+
static compare(hash1, hash2) {
|
|
59
|
+
return hash1 === hash2;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Check if a hash is valid (non-empty, 16 characters, hexadecimal)
|
|
63
|
+
*
|
|
64
|
+
* @param hash - Hash string to validate
|
|
65
|
+
* @returns true if hash is valid
|
|
66
|
+
*/
|
|
67
|
+
static isValidHash(hash) {
|
|
68
|
+
return /^[a-f0-9]{16}$/.test(hash);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Hash multiple files in parallel
|
|
72
|
+
*
|
|
73
|
+
* @param filePaths - Array of absolute file paths
|
|
74
|
+
* @returns Map of file path to hash
|
|
75
|
+
*/
|
|
76
|
+
static async hashFiles(filePaths) {
|
|
77
|
+
const results = new Map();
|
|
78
|
+
await Promise.all(filePaths.map(async (filePath) => {
|
|
79
|
+
const hash = await this.hashFileSafe(filePath);
|
|
80
|
+
results.set(filePath, hash);
|
|
81
|
+
}));
|
|
82
|
+
return results;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Generate a hash from a buffer
|
|
86
|
+
*
|
|
87
|
+
* @param buffer - Buffer to hash
|
|
88
|
+
* @returns 16-character hash string
|
|
89
|
+
*/
|
|
90
|
+
static hashBuffer(buffer) {
|
|
91
|
+
return createHash('sha256').update(buffer).digest('hex').slice(0, 16);
|
|
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;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,SAAmB;QACxC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;QAE1C,MAAM,OAAO,CAAC,GAAG,CACf,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;YAC/B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;YAC/C,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC9B,CAAC,CAAC,CACH,CAAC;QAEF,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,MAAc;QAC9B,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACxE,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Sync Module
|
|
3
|
+
*
|
|
4
|
+
* Exports all components for template synchronization.
|
|
5
|
+
*/
|
|
6
|
+
export { TemplateSyncEngine } from './engine.js';
|
|
7
|
+
export { TemplateScanner } from './scanner.js';
|
|
8
|
+
export { TemplateHasher } from './hasher.js';
|
|
9
|
+
export { TemplateComparator } from './comparator.js';
|
|
10
|
+
export { TemplateMerger } from './merger.js';
|
|
11
|
+
export { ConflictResolver } from './conflict-resolver.js';
|
|
12
|
+
export { TemplateManifestManager } from './manifest.js';
|
|
13
|
+
export type { TemplateFile, TemplateManifest, TemplateFileEntry, FileComparison, FileState, SyncResult, SyncOptions, TemplateSubdir, ExcludedSubdir, TemplateSource, MergeResult, MergeMethod, ResolutionChoice, ResolutionResult, ArchiveResult, TemplateFileRecord, TemplateManifestRecord } from './types.js';
|
|
14
|
+
export { TEMPLATE_SUBDIRS, EXCLUDED_SUBDIRS, DEFAULT_SYNC_OPTIONS } from './types.js';
|
|
15
|
+
export type { ScanResult } from './scanner.js';
|
|
16
|
+
export type { BatchStrategy } from './conflict-resolver.js';
|
|
17
|
+
export type { ComparisonOptions, ComparisonResult } from './comparator.js';
|
|
18
|
+
export type { MergerOptions } from './merger.js';
|
|
19
|
+
export type { ResolutionOptions } from './conflict-resolver.js';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/template-sync/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,UAAU,EACV,WAAW,EACX,cAAc,EACd,cAAc,EACd,cAAc,EACd,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,UAAU,EACX,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,aAAa,EACd,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,aAAa,EACd,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,iBAAiB,EAClB,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Sync Module
|
|
3
|
+
*
|
|
4
|
+
* Exports all components for template synchronization.
|
|
5
|
+
*/
|
|
6
|
+
export { TemplateSyncEngine } from './engine.js';
|
|
7
|
+
export { TemplateScanner } from './scanner.js';
|
|
8
|
+
export { TemplateHasher } from './hasher.js';
|
|
9
|
+
export { TemplateComparator } from './comparator.js';
|
|
10
|
+
export { TemplateMerger } from './merger.js';
|
|
11
|
+
export { ConflictResolver } from './conflict-resolver.js';
|
|
12
|
+
export { TemplateManifestManager } from './manifest.js';
|
|
13
|
+
export { TEMPLATE_SUBDIRS, EXCLUDED_SUBDIRS, DEFAULT_SYNC_OPTIONS } from './types.js';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/template-sync/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAsBxD,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,YAAY,CAAC"}
|