-
Notifications
You must be signed in to change notification settings - Fork 172
fix(extension): inline agent content instead of path stubs in packaged plugins #907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -460,23 +460,23 @@ function Test-SymlinkCapability { | |
| function New-PluginLink { | ||
| <# | ||
| .SYNOPSIS | ||
| Links a source path into a plugin destination via symlink or text stub. | ||
| Links a source path into a plugin destination via symlink or inlined content. | ||
|
|
||
| .DESCRIPTION | ||
| When SymlinkCapable is set, creates a relative symbolic link from | ||
| DestinationPath to SourcePath. Otherwise writes a text stub file | ||
| containing the relative path, matching the format git produces when | ||
| core.symlinks is false. Text stubs keep git status clean on Windows | ||
| without Developer Mode or elevated privileges. | ||
| DestinationPath to SourcePath. Otherwise copies the actual file content | ||
| to the destination. This ensures agent files have valid YAML frontmatter | ||
| in the installed plugin rather than path references that Copilot CLI | ||
| cannot parse. | ||
|
|
||
| .PARAMETER SourcePath | ||
| Absolute path to the real file or directory. | ||
|
|
||
| .PARAMETER DestinationPath | ||
| Absolute path where the link or text stub will be created. | ||
| Absolute path where the link or copied content will be created. | ||
|
|
||
| .PARAMETER SymlinkCapable | ||
| When set, create a symbolic link; otherwise write a text stub. | ||
| When set, create a symbolic link; otherwise copy the file content. | ||
| #> | ||
| [CmdletBinding()] | ||
| param( | ||
|
|
@@ -501,7 +501,9 @@ function New-PluginLink { | |
| New-Item -ItemType SymbolicLink -Path $DestinationPath -Value $relativePath -Force | Out-Null | ||
| } | ||
| else { | ||
| [System.IO.File]::WriteAllText($DestinationPath, $relativePath) | ||
| # Copy the actual file content instead of writing a path reference | ||
| # This ensures agent files have valid YAML frontmatter in installed plugins | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Code Quality — Low: Dead code —
|
||
| Copy-Item -Path $SourcePath -Destination $DestinationPath -Force | ||
| } | ||
|
Comment on lines
+505
to
507
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggestion: Add directory detection: if (Test-Path -Path $SourcePath -PathType Container) {
Copy-Item -Path $SourcePath -Destination $DestinationPath -Recurse -Force
}
else {
Copy-Item -Path $SourcePath -Destination $DestinationPath -Force
}Or keep directory sources on the symlink-only path and limit
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔍 Functional Correctness — Medium: Existing test will fail The test Suggestion: Update the test to validate the new copy behavior: It 'Copies file content when SymlinkCapable is false' {
$src = Join-Path $script:linkRoot 'src-stub.txt'
Set-Content -Path $src -Value 'content' -NoNewline
$dest = Join-Path $script:linkRoot 'dest-stub.txt'
New-PluginLink -SourcePath $src -DestinationPath $dest
Test-Path $dest | Should -BeTrue
$destContent = [System.IO.File]::ReadAllText($dest)
$destContent | Should -Be 'content'
} |
||
| } | ||
|
|
||
|
Comment on lines
+505
to
509
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The caller in Since copied files should be committed as regular files (not mode 120000 symlinks), this function likely needs to be removed entirely, along with its call site and the comment-based help that still references "text stubs containing relative paths." If git index mode repair is still needed for some other reason, the detection logic needs reworking. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Documentation — Low:
Generate-Plugins.ps1comments reference obsolete text-stub behaviorThe comment at line 296 in
Generate-Plugins.ps1reads "Fix git index modes for text stubs on non-symlink systems" and the conditional block invokesRepair-PluginSymlinkIndex. Both reference the old text-stub pattern that this PR eliminates. Should be updated or removed consistent with the resolution forRepair-PluginSymlinkIndex.