Fix missing dependencies, CLI exit behavior, and security issues#10
Merged
Fix missing dependencies, CLI exit behavior, and security issues#10
Conversation
Merged
Co-authored-by: jaseel0 <225665919+jaseel0@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add AI integration for commit message generation
Fix missing dependencies, CLI exit behavior, and security issues
Mar 3, 2026
naheel0
approved these changes
Mar 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resolves TypeScript compilation failures caused by missing npm dependencies, and addresses several security and correctness issues found in code review: unsafe process termination, early AI service instantiation, insecure config file permissions, raw secret injection into AI prompts, non-atomic file writes, and credential leakage in logs.
Dependency fixes
@google/generative-ai,zod,@octokit/rest,pinotopackage.json— these were imported but not declared, causingtsc --noEmitto fail withTS2307/TS7006errors.pr-command.tsreturn→process.exit(1)so CLI callers receive a non-zero exit code.handleSelect: replacedprocess.exit(0)withrenderInstance.unmount()+await renderInstance.waitUntilExit()for clean Ink teardown instead of forceful termination.index.tsnew AIService(configService)from module-level into theai-commitaction handler — prevents startup crash when config file is absent.AIService.tselsebranch ininitClient()throwingError: Unsupported AI provider: ${provider}— fails fast at construction rather than silently leavingthis.modelasnull.ConfigService.tswriteFileSyncnow uses{ mode: 0o600 }— config file containing API keys/tokens is no longer world-readable.ConflictResolver.tssanitizeContent()extracts only<<<<<<<…>>>>>>>conflict hunks and redacts private-key blocks, API-key patterns, standalone base64 blobs, and hex hashes before sending content to the external AI model.O_TRUNCopen with write-to-temp (O_CREAT|O_EXCL|O_NOFOLLOW, PID + 8 random hex bytes suffix) → fsync → close →rename(). Temp file is unlinked on any error path.GitHubService.tssanitizeUrl()that strips userinfo from both HTTPS and SSH-style git remote URLs; used in alllogger.errorcalls to prevent credential leakage in logs.Related Issue
Closes #
Type of Change
Checklist
How Has This Been Tested?
npm run lint(tsc --noEmit) passes with exit code 0. CodeQL static analysis found 0 alerts.Screenshots (if applicable)
N/A
Additional Notes
The base64 redaction pattern uses negative lookahead/lookbehind word boundaries (
(?<![A-Za-z0-9])…(?![A-Za-z0-9])) to reduce false positives on legitimate long identifiers. Some content may still be redacted conservatively — this is intentional for the security boundary.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.