baseguard 1.0.2 → 1.0.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/.baseguardrc.example.json +63 -63
- package/.eslintrc.json +24 -24
- package/.prettierrc +7 -7
- package/CHANGELOG.md +195 -195
- package/DEPLOYMENT.md +624 -624
- package/DEPLOYMENT_CHECKLIST.md +239 -239
- package/DEPLOYMENT_SUMMARY_v1.0.2.md +202 -202
- package/QUICK_START.md +134 -134
- package/README.md +488 -488
- package/RELEASE_NOTES_v1.0.2.md +434 -434
- package/bin/base.js +628 -613
- package/dist/ai/fix-manager.d.ts.map +1 -1
- package/dist/ai/fix-manager.js +1 -1
- package/dist/ai/fix-manager.js.map +1 -1
- package/dist/ai/gemini-analyzer.d.ts.map +1 -1
- package/dist/ai/gemini-analyzer.js +29 -35
- package/dist/ai/gemini-analyzer.js.map +1 -1
- package/dist/ai/gemini-code-fixer.d.ts.map +1 -1
- package/dist/ai/gemini-code-fixer.js +58 -58
- package/dist/ai/gemini-code-fixer.js.map +1 -1
- package/dist/ai/jules-implementer.d.ts +3 -0
- package/dist/ai/jules-implementer.d.ts.map +1 -1
- package/dist/ai/jules-implementer.js +63 -32
- package/dist/ai/jules-implementer.js.map +1 -1
- package/dist/ai/unified-code-fixer.js.map +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +1 -1
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/config.js +2 -1
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/fix.d.ts.map +1 -1
- package/dist/commands/fix.js +44 -15
- package/dist/commands/fix.js.map +1 -1
- package/dist/core/api-key-manager.js +2 -2
- package/dist/core/api-key-manager.js.map +1 -1
- package/dist/core/baseguard.d.ts +1 -0
- package/dist/core/baseguard.d.ts.map +1 -1
- package/dist/core/baseguard.js +13 -10
- package/dist/core/baseguard.js.map +1 -1
- package/dist/core/baseline-checker.d.ts.map +1 -1
- package/dist/core/baseline-checker.js +2 -1
- package/dist/core/baseline-checker.js.map +1 -1
- package/dist/core/configuration-recovery.d.ts.map +1 -1
- package/dist/core/configuration-recovery.js +1 -1
- package/dist/core/configuration-recovery.js.map +1 -1
- package/dist/core/debug-logger.d.ts.map +1 -1
- package/dist/core/debug-logger.js +1 -1
- package/dist/core/debug-logger.js.map +1 -1
- package/dist/core/error-handler.d.ts.map +1 -1
- package/dist/core/error-handler.js +2 -1
- package/dist/core/error-handler.js.map +1 -1
- package/dist/core/gitignore-manager.js +5 -5
- package/dist/core/graceful-degradation-manager.d.ts.map +1 -1
- package/dist/core/graceful-degradation-manager.js +16 -16
- package/dist/core/graceful-degradation-manager.js.map +1 -1
- package/dist/core/lazy-loader.d.ts.map +1 -1
- package/dist/core/lazy-loader.js +9 -2
- package/dist/core/lazy-loader.js.map +1 -1
- package/dist/core/memory-manager.d.ts +0 -3
- package/dist/core/memory-manager.d.ts.map +1 -1
- package/dist/core/memory-manager.js.map +1 -1
- package/dist/core/parser-worker.d.ts +2 -0
- package/dist/core/parser-worker.d.ts.map +1 -0
- package/dist/core/parser-worker.js +19 -0
- package/dist/core/parser-worker.js.map +1 -0
- package/dist/core/startup-optimizer.d.ts +2 -0
- package/dist/core/startup-optimizer.d.ts.map +1 -1
- package/dist/core/startup-optimizer.js +19 -12
- package/dist/core/startup-optimizer.js.map +1 -1
- package/dist/core/system-error-handler.d.ts.map +1 -1
- package/dist/core/system-error-handler.js +18 -11
- package/dist/core/system-error-handler.js.map +1 -1
- package/dist/git/automation-engine.d.ts.map +1 -1
- package/dist/git/automation-engine.js +5 -4
- package/dist/git/automation-engine.js.map +1 -1
- package/dist/git/github-manager.d.ts.map +1 -1
- package/dist/git/github-manager.js.map +1 -1
- package/dist/git/hook-manager.js +5 -5
- package/dist/git/hook-manager.js.map +1 -1
- package/dist/parsers/parser-manager.d.ts.map +1 -1
- package/dist/parsers/parser-manager.js +1 -1
- package/dist/parsers/parser-manager.js.map +1 -1
- package/dist/parsers/svelte-parser.js +1 -1
- package/dist/parsers/svelte-parser.js.map +1 -1
- package/dist/parsers/vanilla-parser.d.ts.map +1 -1
- package/dist/parsers/vanilla-parser.js.map +1 -1
- package/dist/parsers/vue-parser.d.ts.map +1 -1
- package/dist/parsers/vue-parser.js.map +1 -1
- package/dist/ui/components.d.ts +1 -1
- package/dist/ui/components.d.ts.map +1 -1
- package/dist/ui/components.js +11 -11
- package/dist/ui/components.js.map +1 -1
- package/dist/ui/terminal-header.js +14 -14
- package/package.json +105 -105
- package/src/ai/__tests__/gemini-analyzer.test.ts +180 -180
- package/src/ai/agentkit-orchestrator.ts +533 -533
- package/src/ai/fix-manager.ts +362 -362
- package/src/ai/gemini-analyzer.ts +665 -671
- package/src/ai/gemini-code-fixer.ts +539 -540
- package/src/ai/index.ts +3 -3
- package/src/ai/jules-implementer.ts +504 -460
- package/src/ai/unified-code-fixer.ts +347 -347
- package/src/commands/automation.ts +343 -343
- package/src/commands/check.ts +298 -299
- package/src/commands/config.ts +584 -583
- package/src/commands/fix.ts +264 -238
- package/src/commands/index.ts +6 -6
- package/src/commands/init.ts +155 -155
- package/src/commands/status.ts +306 -306
- package/src/core/api-key-manager.ts +298 -298
- package/src/core/baseguard.ts +757 -756
- package/src/core/baseline-checker.ts +564 -563
- package/src/core/cache-manager.ts +271 -271
- package/src/core/configuration-recovery.ts +672 -673
- package/src/core/configuration.ts +595 -595
- package/src/core/debug-logger.ts +590 -590
- package/src/core/directory-filter.ts +420 -420
- package/src/core/error-handler.ts +518 -517
- package/src/core/file-processor.ts +337 -337
- package/src/core/gitignore-manager.ts +168 -168
- package/src/core/graceful-degradation-manager.ts +596 -596
- package/src/core/index.ts +16 -16
- package/src/core/lazy-loader.ts +317 -307
- package/src/core/memory-manager.ts +290 -295
- package/src/core/parser-worker.ts +33 -0
- package/src/core/startup-optimizer.ts +246 -243
- package/src/core/system-error-handler.ts +755 -750
- package/src/git/automation-engine.ts +361 -361
- package/src/git/github-manager.ts +190 -192
- package/src/git/hook-manager.ts +210 -210
- package/src/git/index.ts +3 -3
- package/src/index.ts +7 -7
- package/src/parsers/feature-validator.ts +558 -558
- package/src/parsers/index.ts +7 -7
- package/src/parsers/parser-manager.ts +418 -419
- package/src/parsers/parser.ts +25 -25
- package/src/parsers/react-parser-optimized.ts +160 -160
- package/src/parsers/react-parser.ts +358 -358
- package/src/parsers/svelte-parser.ts +510 -510
- package/src/parsers/vanilla-parser.ts +685 -686
- package/src/parsers/vue-parser.ts +476 -478
- package/src/types/index.ts +95 -95
- package/src/ui/components.ts +567 -567
- package/src/ui/help.ts +192 -192
- package/src/ui/index.ts +3 -3
- package/src/ui/prompts.ts +680 -680
- package/src/ui/terminal-header.ts +58 -58
- package/test-build.js +40 -40
- package/test-config-commands.js +55 -55
- package/test-header-simple.js +32 -32
- package/test-terminal-header.js +11 -11
- package/test-ui.js +28 -28
- package/tests/e2e/baseguard.e2e.test.ts +515 -515
- package/tests/e2e/cross-platform.e2e.test.ts +419 -419
- package/tests/e2e/git-integration.e2e.test.ts +486 -486
- package/tests/fixtures/react-project/package.json +13 -13
- package/tests/fixtures/react-project/src/App.css +75 -75
- package/tests/fixtures/react-project/src/App.tsx +76 -76
- package/tests/fixtures/svelte-project/package.json +10 -10
- package/tests/fixtures/svelte-project/src/App.svelte +368 -368
- package/tests/fixtures/vanilla-project/index.html +75 -75
- package/tests/fixtures/vanilla-project/script.js +330 -330
- package/tests/fixtures/vanilla-project/styles.css +358 -358
- package/tests/fixtures/vue-project/package.json +11 -11
- package/tests/fixtures/vue-project/src/App.vue +215 -215
- package/tsconfig.json +34 -34
- package/vitest.config.ts +11 -11
- package/dist/terminal-header.d.ts +0 -12
- package/dist/terminal-header.js +0 -45
|
@@ -1,169 +1,169 @@
|
|
|
1
|
-
import { readFile, writeFile, access } from 'fs/promises';
|
|
2
|
-
import { constants } from 'fs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Manages .gitignore file to ensure sensitive configuration is not committed
|
|
6
|
-
*/
|
|
7
|
-
export class GitignoreManager {
|
|
8
|
-
private static readonly GITIGNORE_FILE = '.gitignore';
|
|
9
|
-
private static readonly CONFIG_FILE = '.baseguardrc.json';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Ensure .baseguardrc.json is in .gitignore for security
|
|
13
|
-
*/
|
|
14
|
-
static async ensureConfigIgnored(): Promise<boolean> {
|
|
15
|
-
try {
|
|
16
|
-
// Check if .gitignore exists
|
|
17
|
-
const gitignoreExists = await this.fileExists(this.GITIGNORE_FILE);
|
|
18
|
-
|
|
19
|
-
if (!gitignoreExists) {
|
|
20
|
-
// Create .gitignore with BaseGuard config
|
|
21
|
-
await this.createGitignore();
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Read existing .gitignore
|
|
26
|
-
const content = await readFile(this.GITIGNORE_FILE, 'utf-8');
|
|
27
|
-
|
|
28
|
-
// Check if our config file is already ignored
|
|
29
|
-
if (this.isConfigIgnored(content)) {
|
|
30
|
-
return false; // Already ignored, no changes made
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Add our config to .gitignore
|
|
34
|
-
await this.addConfigToGitignore(content);
|
|
35
|
-
return true; // Changes made
|
|
36
|
-
|
|
37
|
-
} catch (error) {
|
|
38
|
-
console.warn(`Warning: Could not update .gitignore: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Check if a file exists
|
|
45
|
-
*/
|
|
46
|
-
private static async fileExists(filePath: string): Promise<boolean> {
|
|
47
|
-
try {
|
|
48
|
-
await access(filePath, constants.F_OK);
|
|
49
|
-
return true;
|
|
50
|
-
} catch {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Create new .gitignore with BaseGuard configuration
|
|
57
|
-
*/
|
|
58
|
-
private static async createGitignore(): Promise<void> {
|
|
59
|
-
const content = `# BaseGuard configuration (contains API keys)
|
|
60
|
-
${this.CONFIG_FILE}
|
|
61
|
-
`;
|
|
62
|
-
await writeFile(this.GITIGNORE_FILE, content, 'utf-8');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Check if config file is already ignored
|
|
67
|
-
*/
|
|
68
|
-
private static isConfigIgnored(gitignoreContent: string): boolean {
|
|
69
|
-
const lines = gitignoreContent.split('\n').map(line => line.trim());
|
|
70
|
-
|
|
71
|
-
// Check for exact match or pattern that would match our config
|
|
72
|
-
return lines.some(line => {
|
|
73
|
-
if (line === this.CONFIG_FILE) return true;
|
|
74
|
-
if (line === '*.json' && this.CONFIG_FILE.endsWith('.json')) return true;
|
|
75
|
-
if (line === '.baseguardrc*') return true;
|
|
76
|
-
|
|
77
|
-
// Check for glob patterns that might match
|
|
78
|
-
if (line.includes('*') && this.matchesPattern(this.CONFIG_FILE, line)) {
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return false;
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Add config file to existing .gitignore
|
|
88
|
-
*/
|
|
89
|
-
private static async addConfigToGitignore(existingContent: string): Promise<void> {
|
|
90
|
-
let content = existingContent;
|
|
91
|
-
|
|
92
|
-
// Ensure content ends with newline
|
|
93
|
-
if (!content.endsWith('\n')) {
|
|
94
|
-
content += '\n';
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// Add BaseGuard section
|
|
98
|
-
content += `
|
|
99
|
-
# BaseGuard configuration (contains API keys)
|
|
100
|
-
${this.CONFIG_FILE}
|
|
101
|
-
`;
|
|
102
|
-
|
|
103
|
-
await writeFile(this.GITIGNORE_FILE, content, 'utf-8');
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Simple glob pattern matching
|
|
108
|
-
*/
|
|
109
|
-
private static matchesPattern(filename: string, pattern: string): boolean {
|
|
110
|
-
// Convert glob pattern to regex
|
|
111
|
-
const regexPattern = pattern
|
|
112
|
-
.replace(/\./g, '\\.')
|
|
113
|
-
.replace(/\*/g, '.*')
|
|
114
|
-
.replace(/\?/g, '.');
|
|
115
|
-
|
|
116
|
-
const regex = new RegExp(`^${regexPattern}$`);
|
|
117
|
-
return regex.test(filename);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Check if config file is properly ignored
|
|
122
|
-
*/
|
|
123
|
-
static async isConfigSecure(): Promise<{
|
|
124
|
-
gitignoreExists: boolean;
|
|
125
|
-
configIgnored: boolean;
|
|
126
|
-
recommendations: string[];
|
|
127
|
-
}> {
|
|
128
|
-
const recommendations: string[] = [];
|
|
129
|
-
|
|
130
|
-
const gitignoreExists = await this.fileExists(this.GITIGNORE_FILE);
|
|
131
|
-
let configIgnored = false;
|
|
132
|
-
|
|
133
|
-
if (!gitignoreExists) {
|
|
134
|
-
recommendations.push('Create .gitignore file to protect sensitive configuration');
|
|
135
|
-
} else {
|
|
136
|
-
try {
|
|
137
|
-
const content = await readFile(this.GITIGNORE_FILE, 'utf-8');
|
|
138
|
-
configIgnored = this.isConfigIgnored(content);
|
|
139
|
-
|
|
140
|
-
if (!configIgnored) {
|
|
141
|
-
recommendations.push(`Add "${this.CONFIG_FILE}" to .gitignore to prevent committing API keys`);
|
|
142
|
-
}
|
|
143
|
-
} catch (error) {
|
|
144
|
-
recommendations.push('Check .gitignore file permissions and readability');
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Check if config file exists and might be tracked
|
|
149
|
-
const configExists = await this.fileExists(this.CONFIG_FILE);
|
|
150
|
-
if (configExists && !configIgnored) {
|
|
151
|
-
recommendations.push('Remove .baseguardrc.json from git tracking if already committed');
|
|
152
|
-
recommendations.push('Run: git rm --cached .baseguardrc.json');
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return {
|
|
156
|
-
gitignoreExists,
|
|
157
|
-
configIgnored,
|
|
158
|
-
recommendations
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Get security recommendations for the user
|
|
164
|
-
*/
|
|
165
|
-
static async getSecurityRecommendations(): Promise<string[]> {
|
|
166
|
-
const status = await this.isConfigSecure();
|
|
167
|
-
return status.recommendations;
|
|
168
|
-
}
|
|
1
|
+
import { readFile, writeFile, access } from 'fs/promises';
|
|
2
|
+
import { constants } from 'fs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Manages .gitignore file to ensure sensitive configuration is not committed
|
|
6
|
+
*/
|
|
7
|
+
export class GitignoreManager {
|
|
8
|
+
private static readonly GITIGNORE_FILE = '.gitignore';
|
|
9
|
+
private static readonly CONFIG_FILE = '.baseguardrc.json';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Ensure .baseguardrc.json is in .gitignore for security
|
|
13
|
+
*/
|
|
14
|
+
static async ensureConfigIgnored(): Promise<boolean> {
|
|
15
|
+
try {
|
|
16
|
+
// Check if .gitignore exists
|
|
17
|
+
const gitignoreExists = await this.fileExists(this.GITIGNORE_FILE);
|
|
18
|
+
|
|
19
|
+
if (!gitignoreExists) {
|
|
20
|
+
// Create .gitignore with BaseGuard config
|
|
21
|
+
await this.createGitignore();
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Read existing .gitignore
|
|
26
|
+
const content = await readFile(this.GITIGNORE_FILE, 'utf-8');
|
|
27
|
+
|
|
28
|
+
// Check if our config file is already ignored
|
|
29
|
+
if (this.isConfigIgnored(content)) {
|
|
30
|
+
return false; // Already ignored, no changes made
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Add our config to .gitignore
|
|
34
|
+
await this.addConfigToGitignore(content);
|
|
35
|
+
return true; // Changes made
|
|
36
|
+
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.warn(`Warning: Could not update .gitignore: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Check if a file exists
|
|
45
|
+
*/
|
|
46
|
+
private static async fileExists(filePath: string): Promise<boolean> {
|
|
47
|
+
try {
|
|
48
|
+
await access(filePath, constants.F_OK);
|
|
49
|
+
return true;
|
|
50
|
+
} catch {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Create new .gitignore with BaseGuard configuration
|
|
57
|
+
*/
|
|
58
|
+
private static async createGitignore(): Promise<void> {
|
|
59
|
+
const content = `# BaseGuard configuration (contains API keys)
|
|
60
|
+
${this.CONFIG_FILE}
|
|
61
|
+
`;
|
|
62
|
+
await writeFile(this.GITIGNORE_FILE, content, 'utf-8');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Check if config file is already ignored
|
|
67
|
+
*/
|
|
68
|
+
private static isConfigIgnored(gitignoreContent: string): boolean {
|
|
69
|
+
const lines = gitignoreContent.split('\n').map(line => line.trim());
|
|
70
|
+
|
|
71
|
+
// Check for exact match or pattern that would match our config
|
|
72
|
+
return lines.some(line => {
|
|
73
|
+
if (line === this.CONFIG_FILE) return true;
|
|
74
|
+
if (line === '*.json' && this.CONFIG_FILE.endsWith('.json')) return true;
|
|
75
|
+
if (line === '.baseguardrc*') return true;
|
|
76
|
+
|
|
77
|
+
// Check for glob patterns that might match
|
|
78
|
+
if (line.includes('*') && this.matchesPattern(this.CONFIG_FILE, line)) {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return false;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Add config file to existing .gitignore
|
|
88
|
+
*/
|
|
89
|
+
private static async addConfigToGitignore(existingContent: string): Promise<void> {
|
|
90
|
+
let content = existingContent;
|
|
91
|
+
|
|
92
|
+
// Ensure content ends with newline
|
|
93
|
+
if (!content.endsWith('\n')) {
|
|
94
|
+
content += '\n';
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Add BaseGuard section
|
|
98
|
+
content += `
|
|
99
|
+
# BaseGuard configuration (contains API keys)
|
|
100
|
+
${this.CONFIG_FILE}
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
await writeFile(this.GITIGNORE_FILE, content, 'utf-8');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Simple glob pattern matching
|
|
108
|
+
*/
|
|
109
|
+
private static matchesPattern(filename: string, pattern: string): boolean {
|
|
110
|
+
// Convert glob pattern to regex
|
|
111
|
+
const regexPattern = pattern
|
|
112
|
+
.replace(/\./g, '\\.')
|
|
113
|
+
.replace(/\*/g, '.*')
|
|
114
|
+
.replace(/\?/g, '.');
|
|
115
|
+
|
|
116
|
+
const regex = new RegExp(`^${regexPattern}$`);
|
|
117
|
+
return regex.test(filename);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Check if config file is properly ignored
|
|
122
|
+
*/
|
|
123
|
+
static async isConfigSecure(): Promise<{
|
|
124
|
+
gitignoreExists: boolean;
|
|
125
|
+
configIgnored: boolean;
|
|
126
|
+
recommendations: string[];
|
|
127
|
+
}> {
|
|
128
|
+
const recommendations: string[] = [];
|
|
129
|
+
|
|
130
|
+
const gitignoreExists = await this.fileExists(this.GITIGNORE_FILE);
|
|
131
|
+
let configIgnored = false;
|
|
132
|
+
|
|
133
|
+
if (!gitignoreExists) {
|
|
134
|
+
recommendations.push('Create .gitignore file to protect sensitive configuration');
|
|
135
|
+
} else {
|
|
136
|
+
try {
|
|
137
|
+
const content = await readFile(this.GITIGNORE_FILE, 'utf-8');
|
|
138
|
+
configIgnored = this.isConfigIgnored(content);
|
|
139
|
+
|
|
140
|
+
if (!configIgnored) {
|
|
141
|
+
recommendations.push(`Add "${this.CONFIG_FILE}" to .gitignore to prevent committing API keys`);
|
|
142
|
+
}
|
|
143
|
+
} catch (error) {
|
|
144
|
+
recommendations.push('Check .gitignore file permissions and readability');
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Check if config file exists and might be tracked
|
|
149
|
+
const configExists = await this.fileExists(this.CONFIG_FILE);
|
|
150
|
+
if (configExists && !configIgnored) {
|
|
151
|
+
recommendations.push('Remove .baseguardrc.json from git tracking if already committed');
|
|
152
|
+
recommendations.push('Run: git rm --cached .baseguardrc.json');
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return {
|
|
156
|
+
gitignoreExists,
|
|
157
|
+
configIgnored,
|
|
158
|
+
recommendations
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Get security recommendations for the user
|
|
164
|
+
*/
|
|
165
|
+
static async getSecurityRecommendations(): Promise<string[]> {
|
|
166
|
+
const status = await this.isConfigSecure();
|
|
167
|
+
return status.recommendations;
|
|
168
|
+
}
|
|
169
169
|
}
|