@git.zone/cli 1.16.6 → 1.16.8
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_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.gitzoneconfig.js +1 -1
- package/dist_ts/gitzone.cli.js +1 -1
- package/dist_ts/gitzone.logging.js +1 -1
- package/dist_ts/mod_commit/index.js +3 -2
- package/dist_ts/mod_deprecate/index.js +1 -1
- package/dist_ts/mod_format/classes.baseformatter.d.ts +0 -2
- package/dist_ts/mod_format/classes.baseformatter.js +3 -22
- package/dist_ts/mod_format/classes.changecache.js +14 -29
- package/dist_ts/mod_format/classes.dependency-analyzer.js +24 -18
- package/dist_ts/mod_format/classes.diffreporter.js +4 -4
- package/dist_ts/mod_format/classes.formatcontext.d.ts +0 -13
- package/dist_ts/mod_format/classes.formatcontext.js +1 -41
- package/dist_ts/mod_format/classes.formatplanner.js +25 -45
- package/dist_ts/mod_format/classes.formatstats.js +22 -20
- package/dist_ts/mod_format/classes.rollbackmanager.d.ts +1 -0
- package/dist_ts/mod_format/classes.rollbackmanager.js +79 -16
- package/dist_ts/mod_format/format.cleanup.js +7 -2
- package/dist_ts/mod_format/format.copy.d.ts +1 -1
- package/dist_ts/mod_format/format.copy.js +3 -3
- package/dist_ts/mod_format/format.gitignore.js +1 -1
- package/dist_ts/mod_format/format.license.js +1 -1
- package/dist_ts/mod_format/format.npmextra.js +1 -1
- package/dist_ts/mod_format/format.packagejson.js +5 -3
- package/dist_ts/mod_format/format.prettier.js +7 -2
- package/dist_ts/mod_format/format.readme.js +1 -1
- package/dist_ts/mod_format/format.templates.js +1 -1
- package/dist_ts/mod_format/format.tsconfig.js +4 -2
- package/dist_ts/mod_format/formatters/cleanup.formatter.js +8 -3
- package/dist_ts/mod_format/formatters/legacy.formatter.js +6 -4
- package/dist_ts/mod_format/formatters/prettier.formatter.js +9 -16
- package/dist_ts/mod_format/formatters/readme.formatter.js +6 -4
- package/dist_ts/mod_format/index.js +13 -71
- package/dist_ts/mod_meta/meta.classes.meta.js +1 -1
- package/dist_ts/mod_standard/index.js +1 -1
- package/dist_ts/mod_start/index.js +1 -1
- package/dist_ts/mod_template/index.js +1 -1
- package/package.json +1 -1
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.gitzoneconfig.ts +3 -1
- package/ts/gitzone.cli.ts +5 -5
- package/ts/gitzone.logging.ts +2 -1
- package/ts/mod_commit/index.ts +36 -11
- package/ts/mod_deprecate/index.ts +4 -1
- package/ts/mod_format/classes.baseformatter.ts +15 -38
- package/ts/mod_format/classes.changecache.ts +74 -80
- package/ts/mod_format/classes.dependency-analyzer.ts +46 -36
- package/ts/mod_format/classes.diffreporter.ts +44 -28
- package/ts/mod_format/classes.formatcontext.ts +3 -54
- package/ts/mod_format/classes.formatplanner.ts +56 -70
- package/ts/mod_format/classes.formatstats.ts +69 -49
- package/ts/mod_format/classes.rollbackmanager.ts +170 -70
- package/ts/mod_format/format.cleanup.ts +9 -2
- package/ts/mod_format/format.copy.ts +17 -14
- package/ts/mod_format/format.gitignore.ts +2 -1
- package/ts/mod_format/format.license.ts +3 -1
- package/ts/mod_format/format.npmextra.ts +9 -2
- package/ts/mod_format/format.packagejson.ts +47 -12
- package/ts/mod_format/format.prettier.ts +10 -2
- package/ts/mod_format/format.readme.ts +2 -1
- package/ts/mod_format/format.templates.ts +15 -7
- package/ts/mod_format/format.tsconfig.ts +6 -2
- package/ts/mod_format/formatters/cleanup.formatter.ts +13 -8
- package/ts/mod_format/formatters/copy.formatter.ts +1 -1
- package/ts/mod_format/formatters/gitignore.formatter.ts +1 -1
- package/ts/mod_format/formatters/legacy.formatter.ts +19 -12
- package/ts/mod_format/formatters/license.formatter.ts +1 -1
- package/ts/mod_format/formatters/npmextra.formatter.ts +1 -1
- package/ts/mod_format/formatters/packagejson.formatter.ts +1 -1
- package/ts/mod_format/formatters/prettier.formatter.ts +50 -47
- package/ts/mod_format/formatters/readme.formatter.ts +11 -9
- package/ts/mod_format/formatters/templates.formatter.ts +1 -1
- package/ts/mod_format/formatters/tsconfig.formatter.ts +1 -1
- package/ts/mod_format/index.ts +54 -113
- package/ts/mod_format/interfaces.format.ts +3 -3
- package/ts/mod_meta/meta.classes.meta.ts +57 -19
- package/ts/mod_standard/index.ts +3 -1
- package/ts/mod_start/index.ts +3 -1
- package/ts/mod_template/index.ts +5 -2
|
@@ -7,21 +7,16 @@ export class PrettierFormatter extends BaseFormatter {
|
|
|
7
7
|
get name(): string {
|
|
8
8
|
return 'prettier';
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
async analyze(): Promise<IPlannedChange[]> {
|
|
12
12
|
const changes: IPlannedChange[] = [];
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
// Define directories to format (TypeScript directories by default)
|
|
15
|
-
const includeDirs = [
|
|
16
|
-
|
|
17
|
-
'ts_*',
|
|
18
|
-
'test',
|
|
19
|
-
'tests'
|
|
20
|
-
];
|
|
21
|
-
|
|
15
|
+
const includeDirs = ['ts', 'ts_*', 'test', 'tests'];
|
|
16
|
+
|
|
22
17
|
// File extensions to format
|
|
23
18
|
const extensions = '{ts,tsx,js,jsx,json,md,css,scss,html,xml,yaml,yml}';
|
|
24
|
-
|
|
19
|
+
|
|
25
20
|
// Also format root-level config files
|
|
26
21
|
const rootConfigFiles = [
|
|
27
22
|
'package.json',
|
|
@@ -36,33 +31,36 @@ export class PrettierFormatter extends BaseFormatter {
|
|
|
36
31
|
'CHANGELOG.md',
|
|
37
32
|
'license',
|
|
38
33
|
'LICENSE',
|
|
39
|
-
'*.md'
|
|
34
|
+
'*.md',
|
|
40
35
|
];
|
|
41
|
-
|
|
36
|
+
|
|
42
37
|
// Collect all files to format
|
|
43
38
|
const allFiles: string[] = [];
|
|
44
|
-
|
|
39
|
+
|
|
45
40
|
// Add files from TypeScript directories
|
|
46
41
|
for (const dir of includeDirs) {
|
|
47
42
|
const globPattern = `${dir}/**/*.${extensions}`;
|
|
48
|
-
const dirFiles = await plugins.smartfile.fs.listFileTree(
|
|
43
|
+
const dirFiles = await plugins.smartfile.fs.listFileTree(
|
|
44
|
+
'.',
|
|
45
|
+
globPattern,
|
|
46
|
+
);
|
|
49
47
|
allFiles.push(...dirFiles);
|
|
50
48
|
}
|
|
51
|
-
|
|
49
|
+
|
|
52
50
|
// Add root config files
|
|
53
51
|
for (const pattern of rootConfigFiles) {
|
|
54
52
|
const rootFiles = await plugins.smartfile.fs.listFileTree('.', pattern);
|
|
55
53
|
// Only include files at root level (no slashes in path)
|
|
56
|
-
const rootLevelFiles = rootFiles.filter(f => !f.includes('/'));
|
|
54
|
+
const rootLevelFiles = rootFiles.filter((f) => !f.includes('/'));
|
|
57
55
|
allFiles.push(...rootLevelFiles);
|
|
58
56
|
}
|
|
59
|
-
|
|
57
|
+
|
|
60
58
|
// Remove duplicates
|
|
61
59
|
const uniqueFiles = [...new Set(allFiles)];
|
|
62
|
-
|
|
60
|
+
|
|
63
61
|
// Get all files that match the pattern
|
|
64
62
|
const files = uniqueFiles;
|
|
65
|
-
|
|
63
|
+
|
|
66
64
|
// Ensure we only process actual files (not directories)
|
|
67
65
|
const validFiles: string[] = [];
|
|
68
66
|
for (const file of files) {
|
|
@@ -76,48 +74,52 @@ export class PrettierFormatter extends BaseFormatter {
|
|
|
76
74
|
logVerbose(`Skipping ${file} - cannot access: ${error.message}`);
|
|
77
75
|
}
|
|
78
76
|
}
|
|
79
|
-
|
|
77
|
+
|
|
80
78
|
// Check which files need formatting
|
|
81
79
|
for (const file of validFiles) {
|
|
82
80
|
// Skip files that haven't changed
|
|
83
|
-
if (!await this.shouldProcessFile(file)) {
|
|
81
|
+
if (!(await this.shouldProcessFile(file))) {
|
|
84
82
|
logVerbose(`Skipping ${file} - no changes detected`);
|
|
85
83
|
continue;
|
|
86
84
|
}
|
|
87
|
-
|
|
85
|
+
|
|
88
86
|
changes.push({
|
|
89
87
|
type: 'modify',
|
|
90
88
|
path: file,
|
|
91
89
|
module: this.name,
|
|
92
|
-
description: 'Format with Prettier'
|
|
90
|
+
description: 'Format with Prettier',
|
|
93
91
|
});
|
|
94
92
|
}
|
|
95
|
-
|
|
93
|
+
|
|
96
94
|
logger.log('info', `Found ${changes.length} files to format with Prettier`);
|
|
97
95
|
return changes;
|
|
98
96
|
}
|
|
99
|
-
|
|
97
|
+
|
|
100
98
|
async execute(changes: IPlannedChange[]): Promise<void> {
|
|
101
99
|
const startTime = this.stats.moduleStartTime(this.name);
|
|
102
100
|
this.stats.startModule(this.name);
|
|
103
|
-
|
|
101
|
+
|
|
104
102
|
try {
|
|
105
103
|
await this.preExecute();
|
|
106
|
-
|
|
104
|
+
|
|
107
105
|
// Batch process files
|
|
108
106
|
const batchSize = 10; // Process 10 files at a time
|
|
109
107
|
const batches: IPlannedChange[][] = [];
|
|
110
|
-
|
|
108
|
+
|
|
111
109
|
for (let i = 0; i < changes.length; i += batchSize) {
|
|
112
110
|
batches.push(changes.slice(i, i + batchSize));
|
|
113
111
|
}
|
|
114
|
-
|
|
115
|
-
logVerbose(
|
|
116
|
-
|
|
112
|
+
|
|
113
|
+
logVerbose(
|
|
114
|
+
`Processing ${changes.length} files in ${batches.length} batches`,
|
|
115
|
+
);
|
|
116
|
+
|
|
117
117
|
for (let i = 0; i < batches.length; i++) {
|
|
118
118
|
const batch = batches[i];
|
|
119
|
-
logVerbose(
|
|
120
|
-
|
|
119
|
+
logVerbose(
|
|
120
|
+
`Processing batch ${i + 1}/${batches.length} (${batch.length} files)`,
|
|
121
|
+
);
|
|
122
|
+
|
|
121
123
|
// Process batch in parallel
|
|
122
124
|
const promises = batch.map(async (change) => {
|
|
123
125
|
try {
|
|
@@ -125,44 +127,45 @@ export class PrettierFormatter extends BaseFormatter {
|
|
|
125
127
|
this.stats.recordFileOperation(this.name, change.type, true);
|
|
126
128
|
} catch (error) {
|
|
127
129
|
this.stats.recordFileOperation(this.name, change.type, false);
|
|
128
|
-
logger.log(
|
|
130
|
+
logger.log(
|
|
131
|
+
'error',
|
|
132
|
+
`Failed to format ${change.path}: ${error.message}`,
|
|
133
|
+
);
|
|
129
134
|
// Don't throw - continue with other files
|
|
130
135
|
}
|
|
131
136
|
});
|
|
132
|
-
|
|
137
|
+
|
|
133
138
|
await Promise.all(promises);
|
|
134
139
|
}
|
|
135
|
-
|
|
140
|
+
|
|
136
141
|
await this.postExecute();
|
|
137
142
|
} catch (error) {
|
|
138
|
-
|
|
143
|
+
// Rollback removed - no longer tracking operations
|
|
139
144
|
throw error;
|
|
140
145
|
} finally {
|
|
141
146
|
this.stats.endModule(this.name, startTime);
|
|
142
147
|
}
|
|
143
148
|
}
|
|
144
|
-
|
|
149
|
+
|
|
145
150
|
async applyChange(change: IPlannedChange): Promise<void> {
|
|
146
151
|
if (change.type !== 'modify') return;
|
|
147
|
-
|
|
152
|
+
|
|
148
153
|
try {
|
|
149
154
|
// Read current content
|
|
150
155
|
const content = plugins.smartfile.fs.toStringSync(change.path);
|
|
151
|
-
|
|
156
|
+
|
|
152
157
|
// Format with prettier
|
|
153
158
|
const prettier = await import('prettier');
|
|
154
159
|
const formatted = await prettier.format(content, {
|
|
155
160
|
filepath: change.path,
|
|
156
|
-
...(await this.getPrettierConfig())
|
|
161
|
+
...(await this.getPrettierConfig()),
|
|
157
162
|
});
|
|
158
|
-
|
|
163
|
+
|
|
159
164
|
// Only write if content actually changed
|
|
160
165
|
if (formatted !== content) {
|
|
161
166
|
await this.modifyFile(change.path, formatted);
|
|
162
167
|
logVerbose(`Formatted ${change.path}`);
|
|
163
168
|
} else {
|
|
164
|
-
// Still update cache even if content didn't change
|
|
165
|
-
await this.cache.updateFileCache(change.path);
|
|
166
169
|
logVerbose(`No formatting changes for ${change.path}`);
|
|
167
170
|
}
|
|
168
171
|
} catch (error) {
|
|
@@ -170,7 +173,7 @@ export class PrettierFormatter extends BaseFormatter {
|
|
|
170
173
|
throw error;
|
|
171
174
|
}
|
|
172
175
|
}
|
|
173
|
-
|
|
176
|
+
|
|
174
177
|
private async getPrettierConfig(): Promise<any> {
|
|
175
178
|
// Try to load prettier config from the project
|
|
176
179
|
const prettierConfig = new plugins.npmextra.Npmextra();
|
|
@@ -181,7 +184,7 @@ export class PrettierFormatter extends BaseFormatter {
|
|
|
181
184
|
printWidth: 80,
|
|
182
185
|
tabWidth: 2,
|
|
183
186
|
semi: true,
|
|
184
|
-
arrowParens: 'always'
|
|
187
|
+
arrowParens: 'always',
|
|
185
188
|
});
|
|
186
189
|
}
|
|
187
|
-
}
|
|
190
|
+
}
|
|
@@ -6,17 +6,19 @@ export class ReadmeFormatter extends BaseFormatter {
|
|
|
6
6
|
get name(): string {
|
|
7
7
|
return 'readme';
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
async analyze(): Promise<IPlannedChange[]> {
|
|
11
|
-
return [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
return [
|
|
12
|
+
{
|
|
13
|
+
type: 'modify',
|
|
14
|
+
path: 'readme.md',
|
|
15
|
+
module: this.name,
|
|
16
|
+
description: 'Ensure readme files exist',
|
|
17
|
+
},
|
|
18
|
+
];
|
|
17
19
|
}
|
|
18
|
-
|
|
20
|
+
|
|
19
21
|
async applyChange(change: IPlannedChange): Promise<void> {
|
|
20
22
|
await formatReadme.run();
|
|
21
23
|
}
|
|
22
|
-
}
|
|
24
|
+
}
|
package/ts/mod_format/index.ts
CHANGED
|
@@ -16,27 +16,29 @@ import { PrettierFormatter } from './formatters/prettier.formatter.js';
|
|
|
16
16
|
import { ReadmeFormatter } from './formatters/readme.formatter.js';
|
|
17
17
|
import { CopyFormatter } from './formatters/copy.formatter.js';
|
|
18
18
|
|
|
19
|
-
export let run = async (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
export let run = async (
|
|
20
|
+
options: {
|
|
21
|
+
dryRun?: boolean;
|
|
22
|
+
yes?: boolean;
|
|
23
|
+
planOnly?: boolean;
|
|
24
|
+
savePlan?: string;
|
|
25
|
+
fromPlan?: string;
|
|
26
|
+
detailed?: boolean;
|
|
27
|
+
interactive?: boolean;
|
|
28
|
+
parallel?: boolean;
|
|
29
|
+
verbose?: boolean;
|
|
30
|
+
} = {},
|
|
31
|
+
): Promise<any> => {
|
|
30
32
|
// Set verbose mode if requested
|
|
31
33
|
if (options.verbose) {
|
|
32
34
|
setVerboseMode(true);
|
|
33
35
|
}
|
|
34
|
-
|
|
36
|
+
|
|
35
37
|
const project = await Project.fromCwd();
|
|
36
38
|
const context = new FormatContext();
|
|
37
|
-
|
|
39
|
+
// Cache system removed - no longer needed
|
|
38
40
|
const planner = new FormatPlanner();
|
|
39
|
-
|
|
41
|
+
|
|
40
42
|
// Get configuration from npmextra
|
|
41
43
|
const npmextraConfig = new plugins.npmextra.Npmextra();
|
|
42
44
|
const formatConfig = npmextraConfig.dataFor<any>('gitzone.format', {
|
|
@@ -49,30 +51,27 @@ export let run = async (options: {
|
|
|
49
51
|
autoRollbackOnError: true,
|
|
50
52
|
backupRetentionDays: 7,
|
|
51
53
|
maxBackupSize: '100MB',
|
|
52
|
-
excludePatterns: ['node_modules/**', '.git/**']
|
|
54
|
+
excludePatterns: ['node_modules/**', '.git/**'],
|
|
53
55
|
},
|
|
54
56
|
modules: {
|
|
55
57
|
skip: [],
|
|
56
58
|
only: [],
|
|
57
|
-
order: []
|
|
59
|
+
order: [],
|
|
58
60
|
},
|
|
59
61
|
parallel: true,
|
|
60
62
|
cache: {
|
|
61
63
|
enabled: true,
|
|
62
|
-
clean: true
|
|
63
|
-
}
|
|
64
|
+
clean: true, // Clean invalid entries from cache
|
|
65
|
+
},
|
|
64
66
|
});
|
|
65
|
-
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
await context.getChangeCache().clean();
|
|
69
|
-
}
|
|
70
|
-
|
|
67
|
+
|
|
68
|
+
// Cache cleaning removed - no longer using cache system
|
|
69
|
+
|
|
71
70
|
// Override config with command options
|
|
72
71
|
const interactive = options.interactive ?? formatConfig.interactive;
|
|
73
72
|
const autoApprove = options.yes ?? formatConfig.autoApprove;
|
|
74
73
|
const parallel = options.parallel ?? formatConfig.parallel;
|
|
75
|
-
|
|
74
|
+
|
|
76
75
|
try {
|
|
77
76
|
// Initialize formatters
|
|
78
77
|
const formatters = [
|
|
@@ -87,9 +86,9 @@ export let run = async (options: {
|
|
|
87
86
|
new ReadmeFormatter(context, project),
|
|
88
87
|
new CopyFormatter(context, project),
|
|
89
88
|
];
|
|
90
|
-
|
|
89
|
+
|
|
91
90
|
// Filter formatters based on configuration
|
|
92
|
-
const activeFormatters = formatters.filter(formatter => {
|
|
91
|
+
const activeFormatters = formatters.filter((formatter) => {
|
|
93
92
|
if (formatConfig.modules.only.length > 0) {
|
|
94
93
|
return formatConfig.modules.only.includes(formatter.name);
|
|
95
94
|
}
|
|
@@ -98,33 +97,36 @@ export let run = async (options: {
|
|
|
98
97
|
}
|
|
99
98
|
return true;
|
|
100
99
|
});
|
|
101
|
-
|
|
100
|
+
|
|
102
101
|
// Plan phase
|
|
103
102
|
logger.log('info', 'Analyzing project for format operations...');
|
|
104
103
|
let plan = options.fromPlan
|
|
105
104
|
? JSON.parse(await plugins.smartfile.fs.toStringSync(options.fromPlan))
|
|
106
105
|
: await planner.planFormat(activeFormatters);
|
|
107
|
-
|
|
106
|
+
|
|
108
107
|
// Display plan
|
|
109
108
|
await planner.displayPlan(plan, options.detailed);
|
|
110
|
-
|
|
109
|
+
|
|
111
110
|
// Save plan if requested
|
|
112
111
|
if (options.savePlan) {
|
|
113
|
-
await plugins.smartfile.memory.toFs(
|
|
112
|
+
await plugins.smartfile.memory.toFs(
|
|
113
|
+
JSON.stringify(plan, null, 2),
|
|
114
|
+
options.savePlan,
|
|
115
|
+
);
|
|
114
116
|
logger.log('info', `Plan saved to ${options.savePlan}`);
|
|
115
117
|
}
|
|
116
|
-
|
|
118
|
+
|
|
117
119
|
// Exit if plan-only mode
|
|
118
120
|
if (options.planOnly) {
|
|
119
121
|
return;
|
|
120
122
|
}
|
|
121
|
-
|
|
123
|
+
|
|
122
124
|
// Dry-run mode
|
|
123
125
|
if (options.dryRun) {
|
|
124
126
|
logger.log('info', 'Dry-run mode - no changes will be made');
|
|
125
127
|
return;
|
|
126
128
|
}
|
|
127
|
-
|
|
129
|
+
|
|
128
130
|
// Interactive confirmation
|
|
129
131
|
if (interactive && !autoApprove) {
|
|
130
132
|
const interactInstance = new plugins.smartinteract.SmartInteract();
|
|
@@ -132,117 +134,56 @@ export let run = async (options: {
|
|
|
132
134
|
type: 'confirm',
|
|
133
135
|
name: 'proceed',
|
|
134
136
|
message: 'Proceed with formatting?',
|
|
135
|
-
default: true
|
|
137
|
+
default: true,
|
|
136
138
|
});
|
|
137
|
-
|
|
139
|
+
|
|
138
140
|
if (!(response as any).value) {
|
|
139
141
|
logger.log('info', 'Format operation cancelled by user');
|
|
140
142
|
return;
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
|
-
|
|
145
|
+
|
|
144
146
|
// Execute phase
|
|
145
|
-
logger.log(
|
|
147
|
+
logger.log(
|
|
148
|
+
'info',
|
|
149
|
+
`Executing format operations${parallel ? ' in parallel' : ' sequentially'}...`,
|
|
150
|
+
);
|
|
146
151
|
await planner.executePlan(plan, activeFormatters, context, parallel);
|
|
147
|
-
|
|
152
|
+
|
|
148
153
|
// Finish statistics tracking
|
|
149
154
|
context.getFormatStats().finish();
|
|
150
|
-
|
|
155
|
+
|
|
151
156
|
// Display statistics
|
|
152
157
|
const showStats = npmextraConfig.dataFor('gitzone.format.showStats', true);
|
|
153
158
|
if (showStats) {
|
|
154
159
|
context.getFormatStats().displayStats();
|
|
155
160
|
}
|
|
156
|
-
|
|
161
|
+
|
|
157
162
|
// Save stats if requested
|
|
158
163
|
if (options.detailed) {
|
|
159
164
|
const statsPath = `.nogit/format-stats-${Date.now()}.json`;
|
|
160
165
|
await context.getFormatStats().saveReport(statsPath);
|
|
161
166
|
}
|
|
162
|
-
|
|
167
|
+
|
|
163
168
|
logger.log('success', 'Format operations completed successfully!');
|
|
164
|
-
|
|
165
169
|
} catch (error) {
|
|
166
170
|
logger.log('error', `Format operation failed: ${error.message}`);
|
|
167
|
-
|
|
168
|
-
//
|
|
169
|
-
|
|
170
|
-
logger.log('info', 'Attempting automatic rollback...');
|
|
171
|
-
try {
|
|
172
|
-
await context.rollbackOperation();
|
|
173
|
-
logger.log('success', 'Rollback completed successfully');
|
|
174
|
-
} catch (rollbackError) {
|
|
175
|
-
logger.log('error', `Rollback failed: ${rollbackError.message}`);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
171
|
+
|
|
172
|
+
// Rollback system has been removed for stability
|
|
173
|
+
|
|
179
174
|
throw error;
|
|
180
175
|
}
|
|
181
176
|
};
|
|
182
177
|
|
|
183
178
|
// Export CLI command handlers
|
|
184
179
|
export const handleRollback = async (operationId?: string): Promise<void> => {
|
|
185
|
-
|
|
186
|
-
const rollbackManager = context.getRollbackManager();
|
|
187
|
-
|
|
188
|
-
if (!operationId) {
|
|
189
|
-
// Rollback to last operation
|
|
190
|
-
const backups = await rollbackManager.listBackups();
|
|
191
|
-
const lastOperation = backups
|
|
192
|
-
.filter(op => op.status !== 'rolled-back')
|
|
193
|
-
.sort((a, b) => b.timestamp - a.timestamp)[0];
|
|
194
|
-
|
|
195
|
-
if (!lastOperation) {
|
|
196
|
-
logger.log('warn', 'No operations available for rollback');
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
operationId = lastOperation.id;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
try {
|
|
204
|
-
await rollbackManager.rollback(operationId);
|
|
205
|
-
logger.log('success', `Successfully rolled back operation ${operationId}`);
|
|
206
|
-
} catch (error) {
|
|
207
|
-
logger.log('error', `Rollback failed: ${error.message}`);
|
|
208
|
-
throw error;
|
|
209
|
-
}
|
|
180
|
+
logger.log('info', 'Rollback system has been disabled for stability');
|
|
210
181
|
};
|
|
211
182
|
|
|
212
183
|
export const handleListBackups = async (): Promise<void> => {
|
|
213
|
-
|
|
214
|
-
const rollbackManager = context.getRollbackManager();
|
|
215
|
-
const backups = await rollbackManager.listBackups();
|
|
216
|
-
|
|
217
|
-
if (backups.length === 0) {
|
|
218
|
-
logger.log('info', 'No backup operations found');
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
console.log('\nAvailable backups:');
|
|
223
|
-
console.log('━'.repeat(50));
|
|
224
|
-
|
|
225
|
-
for (const backup of backups) {
|
|
226
|
-
const date = new Date(backup.timestamp).toLocaleString();
|
|
227
|
-
const status = backup.status;
|
|
228
|
-
const filesCount = backup.files.length;
|
|
229
|
-
|
|
230
|
-
console.log(`ID: ${backup.id}`);
|
|
231
|
-
console.log(`Date: ${date}`);
|
|
232
|
-
console.log(`Status: ${status}`);
|
|
233
|
-
console.log(`Files: ${filesCount}`);
|
|
234
|
-
console.log('─'.repeat(50));
|
|
235
|
-
}
|
|
184
|
+
logger.log('info', 'Backup system has been disabled for stability');
|
|
236
185
|
};
|
|
237
186
|
|
|
238
187
|
export const handleCleanBackups = async (): Promise<void> => {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
// Get retention days from config
|
|
243
|
-
const npmextraConfig = new plugins.npmextra.Npmextra();
|
|
244
|
-
const retentionDays = npmextraConfig.dataFor<any>('gitzone.format.rollback.backupRetentionDays', 7);
|
|
245
|
-
|
|
246
|
-
await rollbackManager.cleanOldBackups(retentionDays);
|
|
247
|
-
logger.log('success', `Cleaned backups older than ${retentionDays} days`);
|
|
248
|
-
};
|
|
188
|
+
logger.log('info', 'Backup cleaning has been disabled - backup system removed');
|
|
189
|
+
};
|
|
@@ -9,7 +9,7 @@ export type IFormatOperation = {
|
|
|
9
9
|
}>;
|
|
10
10
|
status: 'pending' | 'in-progress' | 'completed' | 'failed' | 'rolled-back';
|
|
11
11
|
error?: Error;
|
|
12
|
-
}
|
|
12
|
+
};
|
|
13
13
|
|
|
14
14
|
export type IFormatPlan = {
|
|
15
15
|
summary: {
|
|
@@ -32,7 +32,7 @@ export type IFormatPlan = {
|
|
|
32
32
|
message: string;
|
|
33
33
|
module: string;
|
|
34
34
|
}>;
|
|
35
|
-
}
|
|
35
|
+
};
|
|
36
36
|
|
|
37
37
|
export type IPlannedChange = {
|
|
38
38
|
type: 'create' | 'modify' | 'delete';
|
|
@@ -42,4 +42,4 @@ export type IPlannedChange = {
|
|
|
42
42
|
content?: string; // For create/modify operations
|
|
43
43
|
diff?: string;
|
|
44
44
|
size?: number;
|
|
45
|
-
}
|
|
45
|
+
};
|