Skip to content

Commit 279070f

Browse files
Copilotaooohan
andauthored
fix: add Note field to InstalledPackageItem for PreInstall→PostInstall context passing (#602)
* Initial plan * Add Note field to InstalledPackageItem and pass it from PreInstall to PostInstall Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com>
1 parent 73c5fef commit 279070f

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ coverage.out
1010
**/.available.cache
1111

1212
.vfox/vfox
13+
/vfox

internal/plugin/model.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ type InstalledPackageItem struct {
115115
Path string `json:"path"`
116116
Version string `json:"version"`
117117
Name string `json:"name"`
118+
Note string `json:"note"` // optional, additional note from PreInstall
118119
}
119120

120121
type EnvKeysHookCtx struct {

internal/plugin/model_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,31 @@ func TestPreInstallPackageItem_Checksum(t *testing.T) {
9090
}
9191
})
9292
}
93+
94+
func TestInstalledPackageItem_Note(t *testing.T) {
95+
t.Run("InstalledPackageItem includes Note field", func(t *testing.T) {
96+
item := &InstalledPackageItem{
97+
Name: "test-sdk",
98+
Version: "1.0.0",
99+
Path: "/path/to/sdk",
100+
Note: "This is a test note",
101+
}
102+
103+
if item.Note != "This is a test note" {
104+
t.Errorf("Expected note 'This is a test note', got '%s'", item.Note)
105+
}
106+
})
107+
108+
t.Run("InstalledPackageItem with empty Note", func(t *testing.T) {
109+
item := &InstalledPackageItem{
110+
Name: "test-sdk",
111+
Version: "1.0.0",
112+
Path: "/path/to/sdk",
113+
Note: "",
114+
}
115+
116+
if item.Note != "" {
117+
t.Errorf("Expected empty note, got '%s'", item.Note)
118+
}
119+
})
120+
}

internal/sdk/sdk.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ func (b *impl) Install(version Version) error {
220220
Name: mainSdk.Name,
221221
Version: mainSdk.Version,
222222
Path: path,
223+
Note: mainSdk.Note,
223224
}
224225
if len(installInfo.Addition) > 0 {
225226
pterm.Printf("There are %d additional files that need to be downloaded...\n", len(installInfo.Addition))
@@ -232,6 +233,7 @@ func (b *impl) Install(version Version) error {
232233
Name: oSdk.Name,
233234
Version: oSdk.Version,
234235
Path: path,
236+
Note: oSdk.Note,
235237
}
236238
}
237239
}

0 commit comments

Comments
 (0)