Skip to content

Commit 766ef5c

Browse files
committed
fix(docs): SDK key files list; README saveData uses GetConfig and Marshal
1 parent 7f3b545 commit 766ef5c

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

PLUGIN_ECOSYSTEM.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ The plugin ecosystem consists of several interconnected components:
3232
**Purpose**: Provides the core interface and types for plugin development.
3333

3434
**Key Files**:
35-
- `plugin.go` - Core Plugin interface and supporting types
36-
- `BasePlugin` - Default implementation for common functionality
35+
- `plugin.go` - Core `Plugin` interface, `BasePlugin`, and supporting types
3736
- `stdio.go` - Shared stdin/stdout JSON loop (`RunStdio`, `RunIO`) and `HandlePluginRequest` for init/message/command/shutdown
3837

3938
**Features**:

plugin/README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,19 @@ type Config struct {
288288
Plugins can store data in their data directory:
289289

290290
```go
291+
import (
292+
"encoding/json"
293+
"os"
294+
"path/filepath"
295+
)
296+
291297
func (p *MyPlugin) saveData(data interface{}) error {
292-
dataFile := filepath.Join(p.config.DataDir, "data.json")
293-
return os.WriteFile(dataFile, data, 0644)
298+
dataFile := filepath.Join(p.GetConfig().DataDir, "data.json")
299+
b, err := json.Marshal(data)
300+
if err != nil {
301+
return err
302+
}
303+
return os.WriteFile(dataFile, b, 0644)
294304
}
295305
```
296306

0 commit comments

Comments
 (0)