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.
Files changed (169) hide show
  1. package/.baseguardrc.example.json +63 -63
  2. package/.eslintrc.json +24 -24
  3. package/.prettierrc +7 -7
  4. package/CHANGELOG.md +195 -195
  5. package/DEPLOYMENT.md +624 -624
  6. package/DEPLOYMENT_CHECKLIST.md +239 -239
  7. package/DEPLOYMENT_SUMMARY_v1.0.2.md +202 -202
  8. package/QUICK_START.md +134 -134
  9. package/README.md +488 -488
  10. package/RELEASE_NOTES_v1.0.2.md +434 -434
  11. package/bin/base.js +628 -613
  12. package/dist/ai/fix-manager.d.ts.map +1 -1
  13. package/dist/ai/fix-manager.js +1 -1
  14. package/dist/ai/fix-manager.js.map +1 -1
  15. package/dist/ai/gemini-analyzer.d.ts.map +1 -1
  16. package/dist/ai/gemini-analyzer.js +29 -35
  17. package/dist/ai/gemini-analyzer.js.map +1 -1
  18. package/dist/ai/gemini-code-fixer.d.ts.map +1 -1
  19. package/dist/ai/gemini-code-fixer.js +58 -58
  20. package/dist/ai/gemini-code-fixer.js.map +1 -1
  21. package/dist/ai/jules-implementer.d.ts +3 -0
  22. package/dist/ai/jules-implementer.d.ts.map +1 -1
  23. package/dist/ai/jules-implementer.js +63 -32
  24. package/dist/ai/jules-implementer.js.map +1 -1
  25. package/dist/ai/unified-code-fixer.js.map +1 -1
  26. package/dist/commands/check.d.ts.map +1 -1
  27. package/dist/commands/check.js +1 -1
  28. package/dist/commands/check.js.map +1 -1
  29. package/dist/commands/config.js +2 -1
  30. package/dist/commands/config.js.map +1 -1
  31. package/dist/commands/fix.d.ts.map +1 -1
  32. package/dist/commands/fix.js +44 -15
  33. package/dist/commands/fix.js.map +1 -1
  34. package/dist/core/api-key-manager.js +2 -2
  35. package/dist/core/api-key-manager.js.map +1 -1
  36. package/dist/core/baseguard.d.ts +1 -0
  37. package/dist/core/baseguard.d.ts.map +1 -1
  38. package/dist/core/baseguard.js +13 -10
  39. package/dist/core/baseguard.js.map +1 -1
  40. package/dist/core/baseline-checker.d.ts.map +1 -1
  41. package/dist/core/baseline-checker.js +2 -1
  42. package/dist/core/baseline-checker.js.map +1 -1
  43. package/dist/core/configuration-recovery.d.ts.map +1 -1
  44. package/dist/core/configuration-recovery.js +1 -1
  45. package/dist/core/configuration-recovery.js.map +1 -1
  46. package/dist/core/debug-logger.d.ts.map +1 -1
  47. package/dist/core/debug-logger.js +1 -1
  48. package/dist/core/debug-logger.js.map +1 -1
  49. package/dist/core/error-handler.d.ts.map +1 -1
  50. package/dist/core/error-handler.js +2 -1
  51. package/dist/core/error-handler.js.map +1 -1
  52. package/dist/core/gitignore-manager.js +5 -5
  53. package/dist/core/graceful-degradation-manager.d.ts.map +1 -1
  54. package/dist/core/graceful-degradation-manager.js +16 -16
  55. package/dist/core/graceful-degradation-manager.js.map +1 -1
  56. package/dist/core/lazy-loader.d.ts.map +1 -1
  57. package/dist/core/lazy-loader.js +9 -2
  58. package/dist/core/lazy-loader.js.map +1 -1
  59. package/dist/core/memory-manager.d.ts +0 -3
  60. package/dist/core/memory-manager.d.ts.map +1 -1
  61. package/dist/core/memory-manager.js.map +1 -1
  62. package/dist/core/parser-worker.d.ts +2 -0
  63. package/dist/core/parser-worker.d.ts.map +1 -0
  64. package/dist/core/parser-worker.js +19 -0
  65. package/dist/core/parser-worker.js.map +1 -0
  66. package/dist/core/startup-optimizer.d.ts +2 -0
  67. package/dist/core/startup-optimizer.d.ts.map +1 -1
  68. package/dist/core/startup-optimizer.js +19 -12
  69. package/dist/core/startup-optimizer.js.map +1 -1
  70. package/dist/core/system-error-handler.d.ts.map +1 -1
  71. package/dist/core/system-error-handler.js +18 -11
  72. package/dist/core/system-error-handler.js.map +1 -1
  73. package/dist/git/automation-engine.d.ts.map +1 -1
  74. package/dist/git/automation-engine.js +5 -4
  75. package/dist/git/automation-engine.js.map +1 -1
  76. package/dist/git/github-manager.d.ts.map +1 -1
  77. package/dist/git/github-manager.js.map +1 -1
  78. package/dist/git/hook-manager.js +5 -5
  79. package/dist/git/hook-manager.js.map +1 -1
  80. package/dist/parsers/parser-manager.d.ts.map +1 -1
  81. package/dist/parsers/parser-manager.js +1 -1
  82. package/dist/parsers/parser-manager.js.map +1 -1
  83. package/dist/parsers/svelte-parser.js +1 -1
  84. package/dist/parsers/svelte-parser.js.map +1 -1
  85. package/dist/parsers/vanilla-parser.d.ts.map +1 -1
  86. package/dist/parsers/vanilla-parser.js.map +1 -1
  87. package/dist/parsers/vue-parser.d.ts.map +1 -1
  88. package/dist/parsers/vue-parser.js.map +1 -1
  89. package/dist/ui/components.d.ts +1 -1
  90. package/dist/ui/components.d.ts.map +1 -1
  91. package/dist/ui/components.js +11 -11
  92. package/dist/ui/components.js.map +1 -1
  93. package/dist/ui/terminal-header.js +14 -14
  94. package/package.json +105 -105
  95. package/src/ai/__tests__/gemini-analyzer.test.ts +180 -180
  96. package/src/ai/agentkit-orchestrator.ts +533 -533
  97. package/src/ai/fix-manager.ts +362 -362
  98. package/src/ai/gemini-analyzer.ts +665 -671
  99. package/src/ai/gemini-code-fixer.ts +539 -540
  100. package/src/ai/index.ts +3 -3
  101. package/src/ai/jules-implementer.ts +504 -460
  102. package/src/ai/unified-code-fixer.ts +347 -347
  103. package/src/commands/automation.ts +343 -343
  104. package/src/commands/check.ts +298 -299
  105. package/src/commands/config.ts +584 -583
  106. package/src/commands/fix.ts +264 -238
  107. package/src/commands/index.ts +6 -6
  108. package/src/commands/init.ts +155 -155
  109. package/src/commands/status.ts +306 -306
  110. package/src/core/api-key-manager.ts +298 -298
  111. package/src/core/baseguard.ts +757 -756
  112. package/src/core/baseline-checker.ts +564 -563
  113. package/src/core/cache-manager.ts +271 -271
  114. package/src/core/configuration-recovery.ts +672 -673
  115. package/src/core/configuration.ts +595 -595
  116. package/src/core/debug-logger.ts +590 -590
  117. package/src/core/directory-filter.ts +420 -420
  118. package/src/core/error-handler.ts +518 -517
  119. package/src/core/file-processor.ts +337 -337
  120. package/src/core/gitignore-manager.ts +168 -168
  121. package/src/core/graceful-degradation-manager.ts +596 -596
  122. package/src/core/index.ts +16 -16
  123. package/src/core/lazy-loader.ts +317 -307
  124. package/src/core/memory-manager.ts +290 -295
  125. package/src/core/parser-worker.ts +33 -0
  126. package/src/core/startup-optimizer.ts +246 -243
  127. package/src/core/system-error-handler.ts +755 -750
  128. package/src/git/automation-engine.ts +361 -361
  129. package/src/git/github-manager.ts +190 -192
  130. package/src/git/hook-manager.ts +210 -210
  131. package/src/git/index.ts +3 -3
  132. package/src/index.ts +7 -7
  133. package/src/parsers/feature-validator.ts +558 -558
  134. package/src/parsers/index.ts +7 -7
  135. package/src/parsers/parser-manager.ts +418 -419
  136. package/src/parsers/parser.ts +25 -25
  137. package/src/parsers/react-parser-optimized.ts +160 -160
  138. package/src/parsers/react-parser.ts +358 -358
  139. package/src/parsers/svelte-parser.ts +510 -510
  140. package/src/parsers/vanilla-parser.ts +685 -686
  141. package/src/parsers/vue-parser.ts +476 -478
  142. package/src/types/index.ts +95 -95
  143. package/src/ui/components.ts +567 -567
  144. package/src/ui/help.ts +192 -192
  145. package/src/ui/index.ts +3 -3
  146. package/src/ui/prompts.ts +680 -680
  147. package/src/ui/terminal-header.ts +58 -58
  148. package/test-build.js +40 -40
  149. package/test-config-commands.js +55 -55
  150. package/test-header-simple.js +32 -32
  151. package/test-terminal-header.js +11 -11
  152. package/test-ui.js +28 -28
  153. package/tests/e2e/baseguard.e2e.test.ts +515 -515
  154. package/tests/e2e/cross-platform.e2e.test.ts +419 -419
  155. package/tests/e2e/git-integration.e2e.test.ts +486 -486
  156. package/tests/fixtures/react-project/package.json +13 -13
  157. package/tests/fixtures/react-project/src/App.css +75 -75
  158. package/tests/fixtures/react-project/src/App.tsx +76 -76
  159. package/tests/fixtures/svelte-project/package.json +10 -10
  160. package/tests/fixtures/svelte-project/src/App.svelte +368 -368
  161. package/tests/fixtures/vanilla-project/index.html +75 -75
  162. package/tests/fixtures/vanilla-project/script.js +330 -330
  163. package/tests/fixtures/vanilla-project/styles.css +358 -358
  164. package/tests/fixtures/vue-project/package.json +11 -11
  165. package/tests/fixtures/vue-project/src/App.vue +215 -215
  166. package/tsconfig.json +34 -34
  167. package/vitest.config.ts +11 -11
  168. package/dist/terminal-header.d.ts +0 -12
  169. package/dist/terminal-header.js +0 -45
@@ -1,192 +1,190 @@
1
- import { execSync } from 'child_process';
2
- import { existsSync } from 'fs';
3
- import { join } from 'path';
4
- import chalk from 'chalk';
5
-
6
-
7
- /**
8
- * GitHub repository manager for Jules integration
9
- * Note: GitHub app installation should be done on the Jules dashboard, not here
10
- */
11
- export class GitHubManager {
12
- private repoOwner: string | null = null;
13
- private repoName: string | null = null;
14
- private sourceIdentifier: string | null = null;
15
-
16
- /**
17
- * Check if current directory is a git repository
18
- */
19
- isGitRepository(): boolean {
20
- try {
21
- execSync('git rev-parse --git-dir', { stdio: 'ignore' });
22
- return true;
23
- } catch {
24
- return false;
25
- }
26
- }
27
-
28
- /**
29
- * Detect repository owner and name from git remote
30
- */
31
- async detectRepositoryInfo(): Promise<void> {
32
- try {
33
- const remoteUrl = execSync('git config --get remote.origin.url', { encoding: 'utf8' }).trim();
34
-
35
- // Parse GitHub URL (supports both HTTPS and SSH)
36
- const match = remoteUrl.match(/github\.com[:/]([^/]+)\/([^/.]+)/);
37
-
38
- if (match) {
39
- this.repoOwner = match[1] || null;
40
- this.repoName = match[2] || null;
41
-
42
- console.log(chalk.blue(`📁 Detected repository: ${this.repoOwner}/${this.repoName}`));
43
- } else {
44
- throw new Error('Could not detect GitHub repository from remote URL');
45
- }
46
- } catch (error) {
47
- throw new Error(`Failed to detect repository info: ${error instanceof Error ? error.message : 'Unknown error'}`);
48
- }
49
- }
50
-
51
-
52
-
53
- /**
54
- * Get source identifier for Jules API
55
- */
56
- async getSourceIdentifier(): Promise<string> {
57
- if (!this.repoOwner || !this.repoName) {
58
- await this.detectRepositoryInfo();
59
- }
60
-
61
- if (!this.repoOwner || !this.repoName) {
62
- throw new Error('Repository information not available');
63
- }
64
-
65
- // Generate source identifier in the format expected by Jules
66
- this.sourceIdentifier = `sources/github/${this.repoOwner}/${this.repoName}`;
67
-
68
- return this.sourceIdentifier;
69
- }
70
-
71
- /**
72
- * Verify GitHub authentication and permissions
73
- */
74
- async verifyGitHubConnection(): Promise<boolean> {
75
- try {
76
- if (!this.repoOwner || !this.repoName) {
77
- await this.detectRepositoryInfo();
78
- }
79
-
80
- // Check if we can access the repository
81
- const response = await fetch(`https://api.github.com/repos/${this.repoOwner}/${this.repoName}`);
82
-
83
- if (response.ok) {
84
- console.log(chalk.green('✅ GitHub repository access verified'));
85
- return true;
86
- } else {
87
- console.log(chalk.yellow('⚠️ GitHub repository access verification failed'));
88
- return false;
89
- }
90
- } catch (error) {
91
- console.log(chalk.red(`❌ GitHub connection error: ${error instanceof Error ? error.message : 'Unknown error'}`));
92
- return false;
93
- }
94
- }
95
-
96
- /**
97
- * Get current repository source identifier
98
- */
99
- async getCurrentSourceIdentifier(): Promise<string> {
100
- if (this.sourceIdentifier) {
101
- return this.sourceIdentifier;
102
- }
103
-
104
- await this.detectRepositoryInfo();
105
- return this.getSourceIdentifier();
106
- }
107
-
108
- /**
109
- * Check if we can detect repository information (GitHub integration is handled on Jules dashboard)
110
- */
111
- async isJulesIntegrationSetup(): Promise<boolean> {
112
- try {
113
- if (!this.isGitRepository()) {
114
- return false;
115
- }
116
-
117
- await this.detectRepositoryInfo();
118
- return this.repoOwner !== null && this.repoName !== null;
119
- } catch {
120
- return false;
121
- }
122
- }
123
-
124
- /**
125
- * Get repository information
126
- */
127
- getRepositoryInfo(): { owner: string | null; name: string | null } {
128
- return {
129
- owner: this.repoOwner,
130
- name: this.repoName
131
- };
132
- }
133
-
134
- /**
135
- * Check if repository has required permissions for Jules
136
- */
137
- async checkRepositoryPermissions(): Promise<{ hasAccess: boolean; permissions: string[] }> {
138
- try {
139
- if (!this.repoOwner || !this.repoName) {
140
- await this.detectRepositoryInfo();
141
- }
142
-
143
- // In a real implementation, this would check specific permissions
144
- // For now, we'll assume basic access if we can read the repo
145
- const hasAccess = await this.verifyGitHubConnection();
146
-
147
- const permissions = hasAccess ? [
148
- 'read',
149
- 'write',
150
- 'pull_requests'
151
- ] : [];
152
-
153
- return { hasAccess, permissions };
154
- } catch {
155
- return { hasAccess: false, permissions: [] };
156
- }
157
- }
158
-
159
- /**
160
- * Get current branch name
161
- */
162
- getCurrentBranch(): string {
163
- try {
164
- return execSync('git branch --show-current', { encoding: 'utf8' }).trim();
165
- } catch {
166
- return 'main'; // fallback
167
- }
168
- }
169
-
170
- /**
171
- * Check if there are uncommitted changes
172
- */
173
- hasUncommittedChanges(): boolean {
174
- try {
175
- const status = execSync('git status --porcelain', { encoding: 'utf8' });
176
- return status.trim().length > 0;
177
- } catch {
178
- return false;
179
- }
180
- }
181
-
182
- /**
183
- * Get repository URL for display
184
- */
185
- getRepositoryUrl(): string | null {
186
- if (!this.repoOwner || !this.repoName) {
187
- return null;
188
- }
189
-
190
- return `https://github.com/${this.repoOwner}/${this.repoName}`;
191
- }
192
- }
1
+ import { execSync } from 'child_process';
2
+ import chalk from 'chalk';
3
+
4
+
5
+ /**
6
+ * GitHub repository manager for Jules integration
7
+ * Note: GitHub app installation should be done on the Jules dashboard, not here
8
+ */
9
+ export class GitHubManager {
10
+ private repoOwner: string | null = null;
11
+ private repoName: string | null = null;
12
+ private sourceIdentifier: string | null = null;
13
+
14
+ /**
15
+ * Check if current directory is a git repository
16
+ */
17
+ isGitRepository(): boolean {
18
+ try {
19
+ execSync('git rev-parse --git-dir', { stdio: 'ignore' });
20
+ return true;
21
+ } catch {
22
+ return false;
23
+ }
24
+ }
25
+
26
+ /**
27
+ * Detect repository owner and name from git remote
28
+ */
29
+ async detectRepositoryInfo(): Promise<void> {
30
+ try {
31
+ const remoteUrl = execSync('git config --get remote.origin.url', { encoding: 'utf8' }).trim();
32
+
33
+ // Parse GitHub URL (supports both HTTPS and SSH)
34
+ const match = remoteUrl.match(/github\.com[:/]([^/]+)\/([^/.]+)/);
35
+
36
+ if (match) {
37
+ this.repoOwner = match[1] || null;
38
+ this.repoName = match[2] || null;
39
+
40
+ console.log(chalk.blue(`📁 Detected repository: ${this.repoOwner}/${this.repoName}`));
41
+ } else {
42
+ throw new Error('Could not detect GitHub repository from remote URL');
43
+ }
44
+ } catch (error) {
45
+ throw new Error(`Failed to detect repository info: ${error instanceof Error ? error.message : 'Unknown error'}`);
46
+ }
47
+ }
48
+
49
+
50
+
51
+ /**
52
+ * Get source identifier for Jules API
53
+ */
54
+ async getSourceIdentifier(): Promise<string> {
55
+ if (!this.repoOwner || !this.repoName) {
56
+ await this.detectRepositoryInfo();
57
+ }
58
+
59
+ if (!this.repoOwner || !this.repoName) {
60
+ throw new Error('Repository information not available');
61
+ }
62
+
63
+ // Generate source identifier in the format expected by Jules
64
+ this.sourceIdentifier = `sources/github/${this.repoOwner}/${this.repoName}`;
65
+
66
+ return this.sourceIdentifier;
67
+ }
68
+
69
+ /**
70
+ * Verify GitHub authentication and permissions
71
+ */
72
+ async verifyGitHubConnection(): Promise<boolean> {
73
+ try {
74
+ if (!this.repoOwner || !this.repoName) {
75
+ await this.detectRepositoryInfo();
76
+ }
77
+
78
+ // Check if we can access the repository
79
+ const response = await fetch(`https://api.github.com/repos/${this.repoOwner}/${this.repoName}`);
80
+
81
+ if (response.ok) {
82
+ console.log(chalk.green('✅ GitHub repository access verified'));
83
+ return true;
84
+ } else {
85
+ console.log(chalk.yellow('⚠️ GitHub repository access verification failed'));
86
+ return false;
87
+ }
88
+ } catch (error) {
89
+ console.log(chalk.red(`❌ GitHub connection error: ${error instanceof Error ? error.message : 'Unknown error'}`));
90
+ return false;
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Get current repository source identifier
96
+ */
97
+ async getCurrentSourceIdentifier(): Promise<string> {
98
+ if (this.sourceIdentifier) {
99
+ return this.sourceIdentifier;
100
+ }
101
+
102
+ await this.detectRepositoryInfo();
103
+ return this.getSourceIdentifier();
104
+ }
105
+
106
+ /**
107
+ * Check if we can detect repository information (GitHub integration is handled on Jules dashboard)
108
+ */
109
+ async isJulesIntegrationSetup(): Promise<boolean> {
110
+ try {
111
+ if (!this.isGitRepository()) {
112
+ return false;
113
+ }
114
+
115
+ await this.detectRepositoryInfo();
116
+ return this.repoOwner !== null && this.repoName !== null;
117
+ } catch {
118
+ return false;
119
+ }
120
+ }
121
+
122
+ /**
123
+ * Get repository information
124
+ */
125
+ getRepositoryInfo(): { owner: string | null; name: string | null } {
126
+ return {
127
+ owner: this.repoOwner,
128
+ name: this.repoName
129
+ };
130
+ }
131
+
132
+ /**
133
+ * Check if repository has required permissions for Jules
134
+ */
135
+ async checkRepositoryPermissions(): Promise<{ hasAccess: boolean; permissions: string[] }> {
136
+ try {
137
+ if (!this.repoOwner || !this.repoName) {
138
+ await this.detectRepositoryInfo();
139
+ }
140
+
141
+ // In a real implementation, this would check specific permissions
142
+ // For now, we'll assume basic access if we can read the repo
143
+ const hasAccess = await this.verifyGitHubConnection();
144
+
145
+ const permissions = hasAccess ? [
146
+ 'read',
147
+ 'write',
148
+ 'pull_requests'
149
+ ] : [];
150
+
151
+ return { hasAccess, permissions };
152
+ } catch {
153
+ return { hasAccess: false, permissions: [] };
154
+ }
155
+ }
156
+
157
+ /**
158
+ * Get current branch name
159
+ */
160
+ getCurrentBranch(): string {
161
+ try {
162
+ return execSync('git branch --show-current', { encoding: 'utf8' }).trim();
163
+ } catch {
164
+ return 'main'; // fallback
165
+ }
166
+ }
167
+
168
+ /**
169
+ * Check if there are uncommitted changes
170
+ */
171
+ hasUncommittedChanges(): boolean {
172
+ try {
173
+ const status = execSync('git status --porcelain', { encoding: 'utf8' });
174
+ return status.trim().length > 0;
175
+ } catch {
176
+ return false;
177
+ }
178
+ }
179
+
180
+ /**
181
+ * Get repository URL for display
182
+ */
183
+ getRepositoryUrl(): string | null {
184
+ if (!this.repoOwner || !this.repoName) {
185
+ return null;
186
+ }
187
+
188
+ return `https://github.com/${this.repoOwner}/${this.repoName}`;
189
+ }
190
+ }