baseguard 1.0.4 → 1.0.6

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.
Files changed (84) hide show
  1. package/dist/ai/gemini-analyzer.d.ts.map +1 -1
  2. package/dist/ai/gemini-analyzer.js +1 -1
  3. package/dist/ai/gemini-analyzer.js.map +1 -1
  4. package/dist/ai/gemini-code-fixer.d.ts.map +1 -1
  5. package/dist/ai/gemini-code-fixer.js +2 -7
  6. package/dist/ai/gemini-code-fixer.js.map +1 -1
  7. package/dist/ai/jules-implementer.d.ts +8 -0
  8. package/dist/ai/jules-implementer.d.ts.map +1 -1
  9. package/dist/ai/jules-implementer.js +115 -17
  10. package/dist/ai/jules-implementer.js.map +1 -1
  11. package/dist/commands/fix.d.ts.map +1 -1
  12. package/dist/commands/fix.js +5 -1
  13. package/dist/commands/fix.js.map +1 -1
  14. package/dist/core/baseline-checker.d.ts.map +1 -1
  15. package/dist/core/baseline-checker.js +6 -4
  16. package/dist/core/baseline-checker.js.map +1 -1
  17. package/package.json +1 -1
  18. package/src/ai/__tests__/gemini-analyzer.test.ts +0 -181
  19. package/src/ai/agentkit-orchestrator.ts +0 -534
  20. package/src/ai/fix-manager.ts +0 -362
  21. package/src/ai/gemini-analyzer.ts +0 -665
  22. package/src/ai/gemini-code-fixer.ts +0 -539
  23. package/src/ai/index.ts +0 -4
  24. package/src/ai/jules-implementer.ts +0 -504
  25. package/src/ai/unified-code-fixer.ts +0 -347
  26. package/src/commands/automation.ts +0 -344
  27. package/src/commands/check.ts +0 -298
  28. package/src/commands/config.ts +0 -584
  29. package/src/commands/fix.ts +0 -264
  30. package/src/commands/index.ts +0 -7
  31. package/src/commands/init.ts +0 -156
  32. package/src/commands/status.ts +0 -307
  33. package/src/core/api-key-manager.ts +0 -298
  34. package/src/core/baseguard.ts +0 -757
  35. package/src/core/baseline-checker.ts +0 -564
  36. package/src/core/cache-manager.ts +0 -272
  37. package/src/core/configuration-recovery.ts +0 -672
  38. package/src/core/configuration.ts +0 -596
  39. package/src/core/debug-logger.ts +0 -590
  40. package/src/core/directory-filter.ts +0 -421
  41. package/src/core/error-handler.ts +0 -518
  42. package/src/core/file-processor.ts +0 -338
  43. package/src/core/gitignore-manager.ts +0 -169
  44. package/src/core/graceful-degradation-manager.ts +0 -596
  45. package/src/core/index.ts +0 -17
  46. package/src/core/lazy-loader.ts +0 -317
  47. package/src/core/logger.ts +0 -0
  48. package/src/core/memory-manager.ts +0 -290
  49. package/src/core/parser-worker.ts +0 -33
  50. package/src/core/startup-optimizer.ts +0 -246
  51. package/src/core/system-error-handler.ts +0 -755
  52. package/src/git/automation-engine.ts +0 -361
  53. package/src/git/github-manager.ts +0 -190
  54. package/src/git/hook-manager.ts +0 -210
  55. package/src/git/index.ts +0 -4
  56. package/src/index.ts +0 -8
  57. package/src/parsers/feature-validator.ts +0 -559
  58. package/src/parsers/index.ts +0 -8
  59. package/src/parsers/parser-manager.ts +0 -418
  60. package/src/parsers/parser.ts +0 -26
  61. package/src/parsers/react-parser-optimized.ts +0 -161
  62. package/src/parsers/react-parser.ts +0 -359
  63. package/src/parsers/svelte-parser.ts +0 -510
  64. package/src/parsers/vanilla-parser.ts +0 -685
  65. package/src/parsers/vue-parser.ts +0 -476
  66. package/src/types/index.ts +0 -96
  67. package/src/ui/components.ts +0 -567
  68. package/src/ui/help.ts +0 -193
  69. package/src/ui/index.ts +0 -4
  70. package/src/ui/prompts.ts +0 -681
  71. package/src/ui/terminal-header.ts +0 -59
  72. package/tests/e2e/baseguard.e2e.test.ts +0 -516
  73. package/tests/e2e/cross-platform.e2e.test.ts +0 -420
  74. package/tests/e2e/git-integration.e2e.test.ts +0 -487
  75. package/tests/fixtures/react-project/package.json +0 -14
  76. package/tests/fixtures/react-project/src/App.css +0 -76
  77. package/tests/fixtures/react-project/src/App.tsx +0 -77
  78. package/tests/fixtures/svelte-project/package.json +0 -11
  79. package/tests/fixtures/svelte-project/src/App.svelte +0 -369
  80. package/tests/fixtures/vanilla-project/index.html +0 -76
  81. package/tests/fixtures/vanilla-project/script.js +0 -331
  82. package/tests/fixtures/vanilla-project/styles.css +0 -359
  83. package/tests/fixtures/vue-project/package.json +0 -12
  84. package/tests/fixtures/vue-project/src/App.vue +0 -216
@@ -1,210 +0,0 @@
1
- import { execSync } from 'child_process';
2
- import { existsSync, mkdirSync, writeFileSync, unlinkSync, readFileSync } from 'fs';
3
- import { join } from 'path';
4
- import chalk from 'chalk';
5
-
6
- /**
7
- * Git hook installation and management using husky
8
- */
9
- export class GitHookManager {
10
- private huskyDir = '.husky';
11
-
12
- /**
13
- * Install git hooks for BaseGuard automation
14
- */
15
- async installHooks(trigger: 'pre-commit' | 'pre-push'): Promise<void> {
16
- try {
17
- // Ensure we're in a git repository
18
- await this.ensureGitRepository();
19
-
20
- // Ensure husky is installed and configured
21
- await this.ensureHuskyInstalled();
22
-
23
- // Create the hook script
24
- await this.createHookScript(trigger);
25
-
26
- console.log(chalk.green(`✅ ${trigger} hook installed successfully`));
27
- } catch (error) {
28
- throw new Error(`Failed to install ${trigger} hook: ${error instanceof Error ? error.message : 'Unknown error'}`);
29
- }
30
- }
31
-
32
- /**
33
- * Uninstall git hooks
34
- */
35
- async uninstallHooks(): Promise<void> {
36
- try {
37
- const hooks = ['pre-commit', 'pre-push'];
38
-
39
- for (const hook of hooks) {
40
- const hookPath = join(this.huskyDir, hook);
41
- if (existsSync(hookPath)) {
42
- unlinkSync(hookPath);
43
- console.log(chalk.yellow(`🗑️ Removed ${hook} hook`));
44
- }
45
- }
46
-
47
- // If no hooks remain, we could optionally remove husky entirely
48
- // but we'll leave it in case user has other hooks
49
- console.log(chalk.green('✅ BaseGuard hooks uninstalled'));
50
- } catch (error) {
51
- throw new Error(`Failed to uninstall hooks: ${error instanceof Error ? error.message : 'Unknown error'}`);
52
- }
53
- }
54
-
55
- /**
56
- * Check if hooks are installed
57
- */
58
- async areHooksInstalled(): Promise<boolean> {
59
- const preCommitPath = join(this.huskyDir, 'pre-commit');
60
- const prePushPath = join(this.huskyDir, 'pre-push');
61
-
62
- // Check if either hook exists and contains BaseGuard automation
63
- const checkHook = (path: string): boolean => {
64
- if (!existsSync(path)) return false;
65
-
66
- try {
67
- const content = readFileSync(path, 'utf-8');
68
- return content.includes('base automation run');
69
- } catch {
70
- return false;
71
- }
72
- };
73
-
74
- return checkHook(preCommitPath) || checkHook(prePushPath);
75
- }
76
-
77
- /**
78
- * Get currently installed hook types
79
- */
80
- async getInstalledHooks(): Promise<('pre-commit' | 'pre-push')[]> {
81
- const hooks: ('pre-commit' | 'pre-push')[] = [];
82
-
83
- const checkHook = (hookType: 'pre-commit' | 'pre-push'): boolean => {
84
- const hookPath = join(this.huskyDir, hookType);
85
- if (!existsSync(hookPath)) return false;
86
-
87
- try {
88
- const content = readFileSync(hookPath, 'utf-8');
89
- return content.includes('base automation run');
90
- } catch {
91
- return false;
92
- }
93
- };
94
-
95
- if (checkHook('pre-commit')) hooks.push('pre-commit');
96
- if (checkHook('pre-push')) hooks.push('pre-push');
97
-
98
- return hooks;
99
- }
100
-
101
- /**
102
- * Update existing hook configuration
103
- */
104
- async updateHookConfiguration(oldTrigger: 'pre-commit' | 'pre-push', newTrigger: 'pre-commit' | 'pre-push'): Promise<void> {
105
- try {
106
- // Remove old hook if different
107
- if (oldTrigger !== newTrigger) {
108
- const oldHookPath = join(this.huskyDir, oldTrigger);
109
- if (existsSync(oldHookPath)) {
110
- unlinkSync(oldHookPath);
111
- }
112
- }
113
-
114
- // Install new hook
115
- await this.createHookScript(newTrigger);
116
-
117
- console.log(chalk.green(`✅ Hook configuration updated to ${newTrigger}`));
118
- } catch (error) {
119
- throw new Error(`Failed to update hook configuration: ${error instanceof Error ? error.message : 'Unknown error'}`);
120
- }
121
- }
122
-
123
- /**
124
- * Ensure we're in a git repository
125
- */
126
- private async ensureGitRepository(): Promise<void> {
127
- try {
128
- execSync('git rev-parse --git-dir', { stdio: 'ignore' });
129
- } catch {
130
- throw new Error('Not in a git repository. Please run this command from within a git repository.');
131
- }
132
- }
133
-
134
- /**
135
- * Ensure husky is installed and configured
136
- */
137
- private async ensureHuskyInstalled(): Promise<void> {
138
- try {
139
- // Check if husky is already initialized
140
- if (!existsSync(this.huskyDir)) {
141
- console.log(chalk.blue('🔧 Initializing husky...'));
142
-
143
- // Initialize husky
144
- execSync('npx husky install', { stdio: 'inherit' });
145
-
146
- // Add husky install to package.json prepare script if not already there
147
- await this.addPrepareScript();
148
- }
149
- } catch (error) {
150
- throw new Error(`Failed to initialize husky: ${error instanceof Error ? error.message : 'Unknown error'}`);
151
- }
152
- }
153
-
154
- /**
155
- * Add prepare script to package.json for husky
156
- */
157
- private async addPrepareScript(): Promise<void> {
158
- try {
159
- const packageJsonPath = 'package.json';
160
- if (!existsSync(packageJsonPath)) return;
161
-
162
- const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
163
-
164
- // Add prepare script if it doesn't exist or doesn't include husky
165
- if (!packageJson.scripts) {
166
- packageJson.scripts = {};
167
- }
168
-
169
- if (!packageJson.scripts.prepare || !packageJson.scripts.prepare.includes('husky install')) {
170
- packageJson.scripts.prepare = 'husky install';
171
- writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
172
- console.log(chalk.blue('📝 Added husky install to package.json prepare script'));
173
- }
174
- } catch (error) {
175
- console.warn(chalk.yellow(`⚠️ Could not update package.json: ${error instanceof Error ? error.message : 'Unknown error'}`));
176
- }
177
- }
178
-
179
- /**
180
- * Create hook script content
181
- */
182
- private async createHookScript(trigger: string): Promise<void> {
183
- const hookPath = join(this.huskyDir, trigger);
184
-
185
- // Create .husky directory if it doesn't exist
186
- if (!existsSync(this.huskyDir)) {
187
- mkdirSync(this.huskyDir, { recursive: true });
188
- }
189
-
190
- const hookContent = `#!/usr/bin/env sh
191
- . "$(dirname -- "$0")/_/husky.sh"
192
-
193
- # BaseGuard automation
194
- base automation run --trigger ${trigger}
195
- `;
196
-
197
- writeFileSync(hookPath, hookContent);
198
-
199
- // Make the hook executable (Unix systems)
200
- if (process.platform !== 'win32') {
201
- try {
202
- execSync(`chmod +x "${hookPath}"`);
203
- } catch (error) {
204
- console.warn(chalk.yellow(`⚠️ Could not make hook executable: ${error instanceof Error ? error.message : 'Unknown error'}`));
205
- }
206
- }
207
-
208
- console.log(chalk.blue(`📝 Created ${trigger} hook script`));
209
- }
210
- }
package/src/git/index.ts DELETED
@@ -1,4 +0,0 @@
1
- // Git integration exports
2
- export * from './hook-manager.js';
3
- export * from './automation-engine.js';
4
- export * from './github-manager.js';
package/src/index.ts DELETED
@@ -1,8 +0,0 @@
1
- // Main BaseGuard exports
2
- export * from './core/index.js';
3
- export * from './parsers/index.js';
4
- export * from './ai/index.js';
5
- export * from './git/index.js';
6
- export * from './commands/index.js';
7
- export * from './ui/index.js';
8
- export * from './types/index.js';