Skip to content

Conversation

@walles
Copy link
Owner

@walles walles commented Sep 7, 2025

No description provided.

@walles walles changed the title johan/web extension Make a web extension as well Sep 7, 2025
@walles walles requested a review from Copilot September 7, 2025 09:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements web extension support for the VS Code Git commit message extension, allowing it to run in both desktop and web environments. The changes introduce dual webpack configurations, refactor Node.js-specific functionality to be conditionally available, and add comprehensive testing infrastructure.

  • Refactored build system to support both Node.js and web worker targets
  • Added conditional execution of Git commands based on runtime environment
  • Implemented cross-platform path utilities and comprehensive testing

Reviewed Changes

Copilot reviewed 11 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
webpack.config.js Creates dual build configurations for desktop and web extension targets
src/utils.ts Adds cross-platform path utilities and conditional Node.js module loading
src/verbosecommits.ts Implements conditional Git command execution for web compatibility
src/getgitbranch.ts Updates Git branch detection to work in both desktop and web contexts
src/quickfix.ts Replaces Node.js path module with cross-platform utility
src/messages.ts Replaces Node.js path module with cross-platform utility
src/diagnostics.ts Replaces Node.js path module with cross-platform utility
src/extension.ts Adds API export for testing purposes
src/test/suite/extensionIntegration.test.ts Adds comprehensive Git branch detection tests
src/test/suite-web/index.ts Implements web extension test harness
package.json Configures dual extension support and web testing infrastructure

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 11 to 14
{
require.resolve('assert')
}

Copy link

Copilot AI Sep 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code block appears to be orphaned and serves no purpose. It should be removed as it's not being used anywhere in the configuration.

Suggested change
{
require.resolve('assert')
}

Copilot uses AI. Check for mistakes.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

src/utils.ts Outdated
* @returns The file name portion of the path.
*/
export function basename(filePath: string): string {
const parts = filePath.split(/[/]+/);
Copy link

Copilot AI Sep 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex /[/]+/ only handles forward slashes but the comment mentions handling both / and \ separators. It should be /[/\\]+/ to properly handle both Unix and Windows path separators.

Copilot uses AI. Check for mistakes.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

src/utils.ts Outdated
* @returns The directory portion of the path.
*/
export function dirname(filePath: string): string {
const parts = filePath.split(/[/]+/);
Copy link

Copilot AI Sep 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex /[/]+/ only handles forward slashes but the comment mentions handling both / and \ separators. It should be /[/\\]+/ to properly handle both Unix and Windows path separators.

Copilot uses AI. Check for mistakes.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

const { stdout } = await utils.execFile!(
"git",
["rev-parse", "--abbrev-ref", "HEAD"],
["branch", "--show-current"],
Copy link

Copilot AI Sep 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change from rev-parse --abbrev-ref HEAD to branch --show-current may cause compatibility issues. The --show-current flag was introduced in Git 2.22.0 (2019), while rev-parse --abbrev-ref HEAD works with much older Git versions. Consider keeping the original command for better backward compatibility.

Suggested change
["branch", "--show-current"],
["rev-parse", "--abbrev-ref", "HEAD"],

Copilot uses AI. Check for mistakes.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing command doesn't work on new repos where there is no HEAD.

@walles walles merged commit 24e2409 into main Sep 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants