driftdetect-core 0.9.39 → 0.9.41
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/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/dist/workspace/backup-manager.d.ts +57 -0
- package/dist/workspace/backup-manager.d.ts.map +1 -0
- package/dist/workspace/backup-manager.js +417 -0
- package/dist/workspace/backup-manager.js.map +1 -0
- package/dist/workspace/context-loader.d.ts +75 -0
- package/dist/workspace/context-loader.d.ts.map +1 -0
- package/dist/workspace/context-loader.js +412 -0
- package/dist/workspace/context-loader.js.map +1 -0
- package/dist/workspace/index.d.ts +25 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +23 -0
- package/dist/workspace/index.js.map +1 -0
- package/dist/workspace/project-switcher.d.ts +133 -0
- package/dist/workspace/project-switcher.d.ts.map +1 -0
- package/dist/workspace/project-switcher.js +319 -0
- package/dist/workspace/project-switcher.js.map +1 -0
- package/dist/workspace/schema-migrator.d.ts +94 -0
- package/dist/workspace/schema-migrator.d.ts.map +1 -0
- package/dist/workspace/schema-migrator.js +324 -0
- package/dist/workspace/schema-migrator.js.map +1 -0
- package/dist/workspace/source-of-truth.d.ts +2 -0
- package/dist/workspace/source-of-truth.d.ts.map +1 -0
- package/dist/workspace/source-of-truth.js +2 -0
- package/dist/workspace/source-of-truth.js.map +1 -0
- package/dist/workspace/types.d.ts +246 -0
- package/dist/workspace/types.d.ts.map +1 -0
- package/dist/workspace/types.js +21 -0
- package/dist/workspace/types.js.map +1 -0
- package/dist/workspace/workspace-manager.d.ts +205 -0
- package/dist/workspace/workspace-manager.d.ts.map +1 -0
- package/dist/workspace/workspace-manager.js +366 -0
- package/dist/workspace/workspace-manager.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Manager
|
|
3
|
+
*
|
|
4
|
+
* Enterprise-grade orchestrator that ties together all workspace
|
|
5
|
+
* management components: backup, context loading, project switching,
|
|
6
|
+
* and schema migration.
|
|
7
|
+
*
|
|
8
|
+
* This is the main entry point for workspace operations.
|
|
9
|
+
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - Unified API for all workspace operations
|
|
12
|
+
* - Automatic backup before destructive operations
|
|
13
|
+
* - Context pre-loading for fast CLI/MCP access
|
|
14
|
+
* - Multi-project management with clear indicators
|
|
15
|
+
* - Schema migration with rollback support
|
|
16
|
+
*
|
|
17
|
+
* @module workspace/workspace-manager
|
|
18
|
+
*/
|
|
19
|
+
import type { WorkspaceContext, WorkspaceManagerConfig, BackupResult, RestoreResult, BackupMetadata, ActiveProjectIndicator, ProjectSwitchRequest, ProjectSwitchResult } from './types.js';
|
|
20
|
+
import { BackupManager } from './backup-manager.js';
|
|
21
|
+
import { ContextLoader } from './context-loader.js';
|
|
22
|
+
import { ProjectSwitcher, type ProjectRegistryLike, type AgentProjectContext } from './project-switcher.js';
|
|
23
|
+
import { SchemaMigrator, type MigrationResult } from './schema-migrator.js';
|
|
24
|
+
/**
|
|
25
|
+
* Workspace initialization options
|
|
26
|
+
*/
|
|
27
|
+
export interface WorkspaceInitOptions {
|
|
28
|
+
/** Project registry instance */
|
|
29
|
+
registry?: ProjectRegistryLike;
|
|
30
|
+
/** Drift version for backups */
|
|
31
|
+
driftVersion?: string;
|
|
32
|
+
/** Skip migration check */
|
|
33
|
+
skipMigration?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Workspace status
|
|
37
|
+
*/
|
|
38
|
+
export interface WorkspaceStatus {
|
|
39
|
+
/** Whether workspace is initialized */
|
|
40
|
+
initialized: boolean;
|
|
41
|
+
/** Active project indicator */
|
|
42
|
+
activeProject: ActiveProjectIndicator | null;
|
|
43
|
+
/** Whether context is loaded */
|
|
44
|
+
contextLoaded: boolean;
|
|
45
|
+
/** Whether migration is needed */
|
|
46
|
+
migrationNeeded: boolean;
|
|
47
|
+
/** Current schema version */
|
|
48
|
+
schemaVersion: string;
|
|
49
|
+
/** Number of available backups */
|
|
50
|
+
backupCount: number;
|
|
51
|
+
/** Last backup date */
|
|
52
|
+
lastBackup?: string | undefined;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Destructive operation confirmation
|
|
56
|
+
*/
|
|
57
|
+
export interface DestructiveOperationRequest {
|
|
58
|
+
/** Operation name */
|
|
59
|
+
operation: string;
|
|
60
|
+
/** Confirmation token (must be "DELETE" for deletion) */
|
|
61
|
+
confirmationToken?: string;
|
|
62
|
+
/** Skip backup */
|
|
63
|
+
skipBackup?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export declare class WorkspaceManager {
|
|
66
|
+
private readonly _rootDir;
|
|
67
|
+
private readonly driftDir;
|
|
68
|
+
private readonly config;
|
|
69
|
+
private readonly backupManager;
|
|
70
|
+
private readonly contextLoader;
|
|
71
|
+
private readonly projectSwitcher;
|
|
72
|
+
private schemaMigrator;
|
|
73
|
+
private driftVersion;
|
|
74
|
+
private _initialized;
|
|
75
|
+
constructor(rootDir: string, config?: Partial<WorkspaceManagerConfig>);
|
|
76
|
+
/**
|
|
77
|
+
* Initialize the workspace manager
|
|
78
|
+
*/
|
|
79
|
+
initialize(options?: WorkspaceInitOptions): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Check if workspace is initialized
|
|
82
|
+
*/
|
|
83
|
+
isInitialized(): Promise<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* Get workspace status
|
|
86
|
+
*/
|
|
87
|
+
getStatus(): Promise<WorkspaceStatus>;
|
|
88
|
+
/**
|
|
89
|
+
* Get workspace context (pre-loaded for fast access)
|
|
90
|
+
*/
|
|
91
|
+
getContext(forceRefresh?: boolean): Promise<WorkspaceContext>;
|
|
92
|
+
/**
|
|
93
|
+
* Get agent-friendly project context
|
|
94
|
+
*/
|
|
95
|
+
getAgentContext(): Promise<AgentProjectContext>;
|
|
96
|
+
/**
|
|
97
|
+
* Invalidate context cache
|
|
98
|
+
*/
|
|
99
|
+
invalidateCache(): void;
|
|
100
|
+
/**
|
|
101
|
+
* Get active project indicator
|
|
102
|
+
*/
|
|
103
|
+
getActiveProject(): Promise<ActiveProjectIndicator | null>;
|
|
104
|
+
/**
|
|
105
|
+
* Switch to a different project
|
|
106
|
+
*/
|
|
107
|
+
switchProject(request: ProjectSwitchRequest): Promise<ProjectSwitchResult>;
|
|
108
|
+
/**
|
|
109
|
+
* Format project indicator for CLI output
|
|
110
|
+
*/
|
|
111
|
+
formatProjectIndicator(): string;
|
|
112
|
+
/**
|
|
113
|
+
* Format project header for CLI output
|
|
114
|
+
*/
|
|
115
|
+
formatProjectHeader(): string;
|
|
116
|
+
/**
|
|
117
|
+
* Create a backup
|
|
118
|
+
*/
|
|
119
|
+
createBackup(reason?: 'user_requested' | 'pre_destructive_operation' | 'scheduled'): Promise<BackupResult>;
|
|
120
|
+
/**
|
|
121
|
+
* Restore from a backup
|
|
122
|
+
*/
|
|
123
|
+
restore(backupId: string): Promise<RestoreResult>;
|
|
124
|
+
/**
|
|
125
|
+
* List available backups
|
|
126
|
+
*/
|
|
127
|
+
listBackups(): Promise<BackupMetadata[]>;
|
|
128
|
+
/**
|
|
129
|
+
* Delete a backup (requires explicit "DELETE" confirmation)
|
|
130
|
+
*/
|
|
131
|
+
deleteBackup(backupId: string, confirmationToken: string): Promise<boolean>;
|
|
132
|
+
/**
|
|
133
|
+
* Check if migration is needed
|
|
134
|
+
*/
|
|
135
|
+
needsMigration(): Promise<boolean>;
|
|
136
|
+
/**
|
|
137
|
+
* Run pending migrations
|
|
138
|
+
*/
|
|
139
|
+
migrate(): Promise<MigrationResult>;
|
|
140
|
+
/**
|
|
141
|
+
* Get current schema version
|
|
142
|
+
*/
|
|
143
|
+
getSchemaVersion(): Promise<string>;
|
|
144
|
+
/**
|
|
145
|
+
* Perform a destructive operation with safety checks
|
|
146
|
+
*/
|
|
147
|
+
performDestructiveOperation(request: DestructiveOperationRequest, operation: () => Promise<void>): Promise<{
|
|
148
|
+
success: boolean;
|
|
149
|
+
backupId?: string | undefined;
|
|
150
|
+
error?: string | undefined;
|
|
151
|
+
}>;
|
|
152
|
+
/**
|
|
153
|
+
* Delete .drift folder (requires explicit "DELETE" confirmation)
|
|
154
|
+
*/
|
|
155
|
+
deleteDriftFolder(confirmationToken: string): Promise<{
|
|
156
|
+
success: boolean;
|
|
157
|
+
backupId?: string | undefined;
|
|
158
|
+
error?: string | undefined;
|
|
159
|
+
}>;
|
|
160
|
+
/**
|
|
161
|
+
* Reset workspace (delete and reinitialize)
|
|
162
|
+
*/
|
|
163
|
+
reset(confirmationToken: string): Promise<{
|
|
164
|
+
success: boolean;
|
|
165
|
+
backupId?: string | undefined;
|
|
166
|
+
error?: string | undefined;
|
|
167
|
+
}>;
|
|
168
|
+
/**
|
|
169
|
+
* Get backup manager instance
|
|
170
|
+
*/
|
|
171
|
+
getBackupManager(): BackupManager;
|
|
172
|
+
/**
|
|
173
|
+
* Get context loader instance
|
|
174
|
+
*/
|
|
175
|
+
getContextLoader(): ContextLoader;
|
|
176
|
+
/**
|
|
177
|
+
* Get project switcher instance
|
|
178
|
+
*/
|
|
179
|
+
getProjectSwitcher(): ProjectSwitcher;
|
|
180
|
+
/**
|
|
181
|
+
* Get schema migrator instance
|
|
182
|
+
*/
|
|
183
|
+
getSchemaMigrator(): SchemaMigrator;
|
|
184
|
+
/**
|
|
185
|
+
* Get root directory
|
|
186
|
+
*/
|
|
187
|
+
getRootDir(): string;
|
|
188
|
+
/**
|
|
189
|
+
* Check if manager is initialized
|
|
190
|
+
*/
|
|
191
|
+
isManagerInitialized(): boolean;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Create a workspace manager instance
|
|
195
|
+
*/
|
|
196
|
+
export declare function createWorkspaceManager(rootDir: string, config?: Partial<WorkspaceManagerConfig>): WorkspaceManager;
|
|
197
|
+
/**
|
|
198
|
+
* Get or create the global workspace manager
|
|
199
|
+
*/
|
|
200
|
+
export declare function getWorkspaceManager(rootDir?: string, options?: WorkspaceInitOptions): Promise<WorkspaceManager>;
|
|
201
|
+
/**
|
|
202
|
+
* Reset the global workspace manager (for testing)
|
|
203
|
+
*/
|
|
204
|
+
export declare function resetGlobalWorkspaceManager(): void;
|
|
205
|
+
//# sourceMappingURL=workspace-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-manager.d.ts","sourceRoot":"","sources":["../../src/workspace/workspace-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,KAAK,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5G,OAAO,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAM5E;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,gCAAgC;IAChC,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,gCAAgC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2BAA2B;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,uCAAuC;IACvC,WAAW,EAAE,OAAO,CAAC;IACrB,+BAA+B;IAC/B,aAAa,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC7C,gCAAgC;IAChC,aAAa,EAAE,OAAO,CAAC;IACvB,kCAAkC;IAClC,eAAe,EAAE,OAAO,CAAC;IACz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AAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;IA4BhI;;OAEG;IACH,gBAAgB,IAAI,aAAa;IAIjC;;OAEG;IACH,gBAAgB,IAAI,aAAa;IAIjC;;OAEG;IACH,kBAAkB,IAAI,eAAe;IAIrC;;OAEG;IACH,iBAAiB,IAAI,cAAc;IAInC;;OAEG;IACH,UAAU,IAAI,MAAM;IAIpB;;OAEG;IACH,oBAAoB,IAAI,OAAO;CAGhC;AAMD;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,GACvC,gBAAgB,CAElB;AAQD;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,gBAAgB,CAAC,CAW3B;AAED;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,IAAI,CAElD"}
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Manager
|
|
3
|
+
*
|
|
4
|
+
* Enterprise-grade orchestrator that ties together all workspace
|
|
5
|
+
* management components: backup, context loading, project switching,
|
|
6
|
+
* and schema migration.
|
|
7
|
+
*
|
|
8
|
+
* This is the main entry point for workspace operations.
|
|
9
|
+
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - Unified API for all workspace operations
|
|
12
|
+
* - Automatic backup before destructive operations
|
|
13
|
+
* - Context pre-loading for fast CLI/MCP access
|
|
14
|
+
* - Multi-project management with clear indicators
|
|
15
|
+
* - Schema migration with rollback support
|
|
16
|
+
*
|
|
17
|
+
* @module workspace/workspace-manager
|
|
18
|
+
*/
|
|
19
|
+
import * as fs from 'node:fs/promises';
|
|
20
|
+
import * as path from 'node:path';
|
|
21
|
+
import { DEFAULT_WORKSPACE_CONFIG } from './types.js';
|
|
22
|
+
import { BackupManager } from './backup-manager.js';
|
|
23
|
+
import { ContextLoader } from './context-loader.js';
|
|
24
|
+
import { ProjectSwitcher } from './project-switcher.js';
|
|
25
|
+
import { SchemaMigrator } from './schema-migrator.js';
|
|
26
|
+
// ============================================================================
|
|
27
|
+
// Workspace Manager Class
|
|
28
|
+
// ============================================================================
|
|
29
|
+
export class WorkspaceManager {
|
|
30
|
+
_rootDir;
|
|
31
|
+
driftDir;
|
|
32
|
+
config;
|
|
33
|
+
backupManager;
|
|
34
|
+
contextLoader;
|
|
35
|
+
projectSwitcher;
|
|
36
|
+
schemaMigrator;
|
|
37
|
+
driftVersion = 'unknown';
|
|
38
|
+
_initialized = false;
|
|
39
|
+
constructor(rootDir, config = {}) {
|
|
40
|
+
this._rootDir = rootDir;
|
|
41
|
+
this.driftDir = path.join(rootDir, '.drift');
|
|
42
|
+
this.config = { ...DEFAULT_WORKSPACE_CONFIG, ...config };
|
|
43
|
+
// Initialize components
|
|
44
|
+
this.backupManager = new BackupManager(rootDir, this.config);
|
|
45
|
+
this.contextLoader = new ContextLoader(rootDir, this.config);
|
|
46
|
+
this.projectSwitcher = new ProjectSwitcher(this.config);
|
|
47
|
+
this.schemaMigrator = new SchemaMigrator(rootDir, this.backupManager);
|
|
48
|
+
}
|
|
49
|
+
// ==========================================================================
|
|
50
|
+
// Initialization
|
|
51
|
+
// ==========================================================================
|
|
52
|
+
/**
|
|
53
|
+
* Initialize the workspace manager
|
|
54
|
+
*/
|
|
55
|
+
async initialize(options = {}) {
|
|
56
|
+
if (options.driftVersion) {
|
|
57
|
+
this.driftVersion = options.driftVersion;
|
|
58
|
+
}
|
|
59
|
+
if (options.registry) {
|
|
60
|
+
this.projectSwitcher.setRegistry(options.registry);
|
|
61
|
+
}
|
|
62
|
+
// Check for migration
|
|
63
|
+
if (!options.skipMigration) {
|
|
64
|
+
const needsMigration = await this.schemaMigrator.needsMigration();
|
|
65
|
+
if (needsMigration) {
|
|
66
|
+
// Auto-migrate with backup
|
|
67
|
+
await this.schemaMigrator.migrate(this.driftVersion);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
this._initialized = true;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Check if workspace is initialized
|
|
74
|
+
*/
|
|
75
|
+
async isInitialized() {
|
|
76
|
+
return this.contextLoader.isInitialized();
|
|
77
|
+
}
|
|
78
|
+
// ==========================================================================
|
|
79
|
+
// Status & Context
|
|
80
|
+
// ==========================================================================
|
|
81
|
+
/**
|
|
82
|
+
* Get workspace status
|
|
83
|
+
*/
|
|
84
|
+
async getStatus() {
|
|
85
|
+
const initialized = await this.isInitialized();
|
|
86
|
+
const activeProject = await this.projectSwitcher.getActiveIndicator();
|
|
87
|
+
const backups = await this.backupManager.listBackups();
|
|
88
|
+
const migrationNeeded = initialized ? await this.schemaMigrator.needsMigration() : false;
|
|
89
|
+
const schemaVersion = initialized ? await this.schemaMigrator.getCurrentVersion() : '0.0.0';
|
|
90
|
+
let contextLoaded = false;
|
|
91
|
+
if (initialized) {
|
|
92
|
+
try {
|
|
93
|
+
await this.contextLoader.loadContext();
|
|
94
|
+
contextLoaded = true;
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
// Context not loaded
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
initialized,
|
|
102
|
+
activeProject,
|
|
103
|
+
contextLoaded,
|
|
104
|
+
migrationNeeded,
|
|
105
|
+
schemaVersion,
|
|
106
|
+
backupCount: backups.length,
|
|
107
|
+
lastBackup: backups[0]?.createdAt,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Get workspace context (pre-loaded for fast access)
|
|
112
|
+
*/
|
|
113
|
+
async getContext(forceRefresh = false) {
|
|
114
|
+
return this.contextLoader.loadContext(forceRefresh);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Get agent-friendly project context
|
|
118
|
+
*/
|
|
119
|
+
async getAgentContext() {
|
|
120
|
+
return this.projectSwitcher.getAgentContext();
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Invalidate context cache
|
|
124
|
+
*/
|
|
125
|
+
invalidateCache() {
|
|
126
|
+
this.contextLoader.invalidateCache();
|
|
127
|
+
this.projectSwitcher.clearCache();
|
|
128
|
+
}
|
|
129
|
+
// ==========================================================================
|
|
130
|
+
// Project Management
|
|
131
|
+
// ==========================================================================
|
|
132
|
+
/**
|
|
133
|
+
* Get active project indicator
|
|
134
|
+
*/
|
|
135
|
+
async getActiveProject() {
|
|
136
|
+
return this.projectSwitcher.getActiveIndicator();
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Switch to a different project
|
|
140
|
+
*/
|
|
141
|
+
async switchProject(request) {
|
|
142
|
+
const result = await this.projectSwitcher.switchProject(request);
|
|
143
|
+
if (result.success) {
|
|
144
|
+
// Invalidate cache for new project
|
|
145
|
+
this.invalidateCache();
|
|
146
|
+
}
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Format project indicator for CLI output
|
|
151
|
+
*/
|
|
152
|
+
formatProjectIndicator() {
|
|
153
|
+
const indicator = this.projectSwitcher['currentIndicator'];
|
|
154
|
+
if (!indicator) {
|
|
155
|
+
return '';
|
|
156
|
+
}
|
|
157
|
+
return this.projectSwitcher.formatIndicator(indicator);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Format project header for CLI output
|
|
161
|
+
*/
|
|
162
|
+
formatProjectHeader() {
|
|
163
|
+
const indicator = this.projectSwitcher['currentIndicator'];
|
|
164
|
+
if (!indicator) {
|
|
165
|
+
return '';
|
|
166
|
+
}
|
|
167
|
+
return this.projectSwitcher.formatHeader(indicator);
|
|
168
|
+
}
|
|
169
|
+
// ==========================================================================
|
|
170
|
+
// Backup & Restore
|
|
171
|
+
// ==========================================================================
|
|
172
|
+
/**
|
|
173
|
+
* Create a backup
|
|
174
|
+
*/
|
|
175
|
+
async createBackup(reason = 'user_requested') {
|
|
176
|
+
return this.backupManager.createBackup(reason, this.driftVersion);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Restore from a backup
|
|
180
|
+
*/
|
|
181
|
+
async restore(backupId) {
|
|
182
|
+
const result = await this.backupManager.restore(backupId);
|
|
183
|
+
if (result.success) {
|
|
184
|
+
// Invalidate cache after restore
|
|
185
|
+
this.invalidateCache();
|
|
186
|
+
}
|
|
187
|
+
return result;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* List available backups
|
|
191
|
+
*/
|
|
192
|
+
async listBackups() {
|
|
193
|
+
return this.backupManager.listBackups();
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Delete a backup (requires explicit "DELETE" confirmation)
|
|
197
|
+
*/
|
|
198
|
+
async deleteBackup(backupId, confirmationToken) {
|
|
199
|
+
return this.backupManager.deleteBackup(backupId, confirmationToken);
|
|
200
|
+
}
|
|
201
|
+
// ==========================================================================
|
|
202
|
+
// Schema Migration
|
|
203
|
+
// ==========================================================================
|
|
204
|
+
/**
|
|
205
|
+
* Check if migration is needed
|
|
206
|
+
*/
|
|
207
|
+
async needsMigration() {
|
|
208
|
+
return this.schemaMigrator.needsMigration();
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Run pending migrations
|
|
212
|
+
*/
|
|
213
|
+
async migrate() {
|
|
214
|
+
return this.schemaMigrator.migrate(this.driftVersion);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Get current schema version
|
|
218
|
+
*/
|
|
219
|
+
async getSchemaVersion() {
|
|
220
|
+
return this.schemaMigrator.getCurrentVersion();
|
|
221
|
+
}
|
|
222
|
+
// ==========================================================================
|
|
223
|
+
// Destructive Operations
|
|
224
|
+
// ==========================================================================
|
|
225
|
+
/**
|
|
226
|
+
* Perform a destructive operation with safety checks
|
|
227
|
+
*/
|
|
228
|
+
async performDestructiveOperation(request, operation) {
|
|
229
|
+
// Check if backup is needed
|
|
230
|
+
const shouldBackup = !request.skipBackup &&
|
|
231
|
+
await this.backupManager.shouldBackup(request.operation);
|
|
232
|
+
let backupId;
|
|
233
|
+
// Create backup if needed
|
|
234
|
+
if (shouldBackup) {
|
|
235
|
+
const backupResult = await this.backupManager.createBackup('pre_destructive_operation', this.driftVersion);
|
|
236
|
+
if (!backupResult.success) {
|
|
237
|
+
return {
|
|
238
|
+
success: false,
|
|
239
|
+
error: `Failed to create backup: ${backupResult.error}`,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
backupId = backupResult.backupId;
|
|
243
|
+
}
|
|
244
|
+
// Perform operation
|
|
245
|
+
try {
|
|
246
|
+
await operation();
|
|
247
|
+
// Invalidate cache after destructive operation
|
|
248
|
+
this.invalidateCache();
|
|
249
|
+
return { success: true, backupId };
|
|
250
|
+
}
|
|
251
|
+
catch (error) {
|
|
252
|
+
return {
|
|
253
|
+
success: false,
|
|
254
|
+
backupId,
|
|
255
|
+
error: error.message,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Delete .drift folder (requires explicit "DELETE" confirmation)
|
|
261
|
+
*/
|
|
262
|
+
async deleteDriftFolder(confirmationToken) {
|
|
263
|
+
if (confirmationToken !== 'DELETE') {
|
|
264
|
+
return {
|
|
265
|
+
success: false,
|
|
266
|
+
error: 'Deletion requires explicit confirmation token "DELETE"',
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
return this.performDestructiveOperation({ operation: 'delete', confirmationToken }, async () => {
|
|
270
|
+
await fs.rm(this.driftDir, { recursive: true, force: true });
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Reset workspace (delete and reinitialize)
|
|
275
|
+
*/
|
|
276
|
+
async reset(confirmationToken) {
|
|
277
|
+
if (confirmationToken !== 'DELETE') {
|
|
278
|
+
return {
|
|
279
|
+
success: false,
|
|
280
|
+
error: 'Reset requires explicit confirmation token "DELETE"',
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
return this.performDestructiveOperation({ operation: 'reset', confirmationToken }, async () => {
|
|
284
|
+
// Delete everything except backups
|
|
285
|
+
const entries = await fs.readdir(this.driftDir, { withFileTypes: true });
|
|
286
|
+
for (const entry of entries) {
|
|
287
|
+
if (entry.name === '.drift-backups')
|
|
288
|
+
continue;
|
|
289
|
+
const fullPath = path.join(this.driftDir, entry.name);
|
|
290
|
+
await fs.rm(fullPath, { recursive: true, force: true });
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
// ==========================================================================
|
|
295
|
+
// Getters for Components
|
|
296
|
+
// ==========================================================================
|
|
297
|
+
/**
|
|
298
|
+
* Get backup manager instance
|
|
299
|
+
*/
|
|
300
|
+
getBackupManager() {
|
|
301
|
+
return this.backupManager;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Get context loader instance
|
|
305
|
+
*/
|
|
306
|
+
getContextLoader() {
|
|
307
|
+
return this.contextLoader;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Get project switcher instance
|
|
311
|
+
*/
|
|
312
|
+
getProjectSwitcher() {
|
|
313
|
+
return this.projectSwitcher;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Get schema migrator instance
|
|
317
|
+
*/
|
|
318
|
+
getSchemaMigrator() {
|
|
319
|
+
return this.schemaMigrator;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Get root directory
|
|
323
|
+
*/
|
|
324
|
+
getRootDir() {
|
|
325
|
+
return this._rootDir;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Check if manager is initialized
|
|
329
|
+
*/
|
|
330
|
+
isManagerInitialized() {
|
|
331
|
+
return this._initialized;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
// ============================================================================
|
|
335
|
+
// Factory Functions
|
|
336
|
+
// ============================================================================
|
|
337
|
+
/**
|
|
338
|
+
* Create a workspace manager instance
|
|
339
|
+
*/
|
|
340
|
+
export function createWorkspaceManager(rootDir, config) {
|
|
341
|
+
return new WorkspaceManager(rootDir, config);
|
|
342
|
+
}
|
|
343
|
+
// ============================================================================
|
|
344
|
+
// Singleton Instance
|
|
345
|
+
// ============================================================================
|
|
346
|
+
let globalWorkspaceManager = null;
|
|
347
|
+
/**
|
|
348
|
+
* Get or create the global workspace manager
|
|
349
|
+
*/
|
|
350
|
+
export async function getWorkspaceManager(rootDir, options) {
|
|
351
|
+
if (!globalWorkspaceManager && rootDir) {
|
|
352
|
+
globalWorkspaceManager = new WorkspaceManager(rootDir);
|
|
353
|
+
await globalWorkspaceManager.initialize(options);
|
|
354
|
+
}
|
|
355
|
+
if (!globalWorkspaceManager) {
|
|
356
|
+
throw new Error('Workspace manager not initialized. Provide rootDir on first call.');
|
|
357
|
+
}
|
|
358
|
+
return globalWorkspaceManager;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Reset the global workspace manager (for testing)
|
|
362
|
+
*/
|
|
363
|
+
export function resetGlobalWorkspaceManager() {
|
|
364
|
+
globalWorkspaceManager = null;
|
|
365
|
+
}
|
|
366
|
+
//# sourceMappingURL=workspace-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-manager.js","sourceRoot":"","sources":["../../src/workspace/workspace-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAYlC,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO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GED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "driftdetect-core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.41",
|
|
4
4
|
"description": "Core engine for Drift - multi-language pattern detection, call graph analysis, and security boundary tracking. Supports TypeScript, Python, C#, Java, PHP.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|