mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
some more fixes for VSC (#2021)
# Pull Request Checklist ## Description - [ ] **Description of PR**: Clear and concise description of what this PR accomplishes - [ ] **Breaking Changes**: Document any breaking changes (if applicable) - [ ] **Related Issues**: Link to any related issues or tickets ## Testing - [ ] **Test cases Attached**: All relevant test cases have been added/updated - [ ] **Manual Testing**: Manual testing completed for the changes ## Monitoring & Debugging - [ ] **Logging in place**: Appropriate logging has been added for debugging user issues - [ ] **Sentry will be able to catch errors**: Error handling ensures Sentry can capture and report errors - [ ] **Avoid Dev based/Prisma logging**: No development-only or Prisma-specific logging in production code ## Configuration - [ ] **Env variables newly added**: Any new environment variables are documented in .env.example file or mentioned in description --- ## Additional Notes <!-- Add any additional context, screenshots, or notes for reviewers here -->
This commit is contained in:
parent
d3aef406d2
commit
5caf1ccfe3
3 changed files with 52 additions and 26 deletions
|
|
@ -230,6 +230,9 @@ h1 {
|
|||
font-weight: 500;
|
||||
color: var(--vscode-foreground);
|
||||
line-height: 24px;
|
||||
max-width: 100%;
|
||||
overflow-wrap: break-word;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.step.idle .step-title {
|
||||
|
|
@ -294,6 +297,13 @@ h1 {
|
|||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.shell-command {
|
||||
overflow-wrap: break-word;
|
||||
word-break: break-all;
|
||||
white-space: pre-wrap;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.dollarSign::before {
|
||||
content: "$";
|
||||
margin-right: 1rem;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
border-radius: 8px;
|
||||
font-family: var(--vscode-font-family);
|
||||
color: var(--vscode-foreground);
|
||||
overflow: hidden;
|
||||
overflow-y: auto;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
height: 100%;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.title {
|
||||
|
|
@ -46,10 +46,12 @@
|
|||
|
||||
.contextItem {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
font-size: 12px;
|
||||
color: var(--vscode-descriptionForeground);
|
||||
word-break: break-all;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.contextItem code {
|
||||
|
|
@ -59,6 +61,8 @@
|
|||
font-family: var(--vscode-editor-font-family);
|
||||
font-size: 11px;
|
||||
color: var(--vscode-textPreformat-foreground);
|
||||
word-break: break-all;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.helpText {
|
||||
|
|
@ -74,6 +78,8 @@
|
|||
border-radius: 3px;
|
||||
font-family: var(--vscode-editor-font-family);
|
||||
font-size: 10px;
|
||||
word-break: break-all;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.actionHelp {
|
||||
|
|
|
|||
|
|
@ -90,36 +90,46 @@ export class CheckEnvironmentStep extends BaseStep {
|
|||
const cwd = workspaceFolder.uri.fsPath;
|
||||
|
||||
try {
|
||||
// Check if we're inside a Git repository first
|
||||
await execPromise("git rev-parse --is-inside-work-tree", { cwd });
|
||||
// Combine all three git checks into a single command
|
||||
// This reduces overhead from spawning multiple processes
|
||||
const { stdout } = await execPromise(
|
||||
"git rev-parse --is-inside-work-tree --is-bare-repository HEAD",
|
||||
{ cwd },
|
||||
);
|
||||
|
||||
const lines = stdout.trim().split("\n");
|
||||
|
||||
// lines[0] = "true" (is-inside-work-tree)
|
||||
// lines[1] = "true" or "false" (is-bare-repository)
|
||||
// lines[2] = commit hash
|
||||
|
||||
if (lines.length < 2) {
|
||||
return new Error(GIT_ERRORS.NO_REPO);
|
||||
}
|
||||
|
||||
const isBare = lines[1] === "true";
|
||||
if (isBare) {
|
||||
return new Error(GIT_ERRORS.BARE_REPO);
|
||||
}
|
||||
|
||||
// Check if HEAD exists (lines[2] should be a commit hash)
|
||||
if (lines.length < 3 || !lines[2]) {
|
||||
return new Error(GIT_ERRORS.NO_INIT_COMMIT);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
} catch (error) {
|
||||
this.logger.error(
|
||||
"Error checking for git repository",
|
||||
error instanceof Error ? error : undefined,
|
||||
);
|
||||
// Check error message to determine specific git error
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
if (message.includes("unknown revision") || message.includes("bad revision")) {
|
||||
return new Error(GIT_ERRORS.NO_INIT_COMMIT);
|
||||
}
|
||||
return new Error(GIT_ERRORS.NO_REPO);
|
||||
}
|
||||
|
||||
// Run both checks concurrently
|
||||
const [bareResult, headResult] = await Promise.all([
|
||||
execPromise("git rev-parse --is-bare-repository", { cwd })
|
||||
.then((r) => r.stdout.trim())
|
||||
.catch(() => undefined),
|
||||
|
||||
execPromise("git rev-parse HEAD", { cwd })
|
||||
.then(() => true)
|
||||
.catch(() => false),
|
||||
]);
|
||||
|
||||
if (bareResult === "true") {
|
||||
return new Error(GIT_ERRORS.BARE_REPO);
|
||||
}
|
||||
|
||||
if (!headResult) {
|
||||
return new Error(GIT_ERRORS.NO_INIT_COMMIT);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
private validatePythonEnvironment = async (): Promise<{
|
||||
|
|
|
|||
Loading…
Reference in a new issue