@juanibiapina/pi-extension-settings 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +27 -6
  2. package/package.json +5 -3
package/README.md CHANGED
@@ -6,6 +6,7 @@ A [pi](https://github.com/badlogic/pi-mono) extension that provides centralized
6
6
 
7
7
  - **`/extension-settings` command** - Interactive UI to configure all registered extension settings
8
8
  - **Helpers for reading/writing** - `getSetting()` and `setSetting()` functions
9
+ - **Ordered multi-select** - Settings where users pick and reorder items from a list
9
10
  - **Persistent storage** - Settings stored in `~/.pi/agent/settings-extensions.json`
10
11
 
11
12
  ## For Users
@@ -33,7 +34,7 @@ If you're developing an extension and want to use the settings system, add this
33
34
  ```json
34
35
  {
35
36
  "dependencies": {
36
- "@juanibiapina/pi-extension-settings": "^0.4.0"
37
+ "@juanibiapina/pi-extension-settings": "^0.5.0"
37
38
  }
38
39
  }
39
40
  ```
@@ -73,6 +74,18 @@ export default function myExtension(pi: ExtensionAPI) {
73
74
  defaultValue: "",
74
75
  // No 'values' = free-form string input
75
76
  },
77
+ {
78
+ id: "enabledModels",
79
+ label: "Enabled Models",
80
+ description: "Pick and reorder your preferred models",
81
+ defaultValue: "",
82
+ // Ordered multi-select: opens a submenu to toggle and reorder items
83
+ options: [
84
+ { id: "model-a", label: "Model A" },
85
+ { id: "model-b", label: "Model B" },
86
+ { id: "model-c", label: "Model C" },
87
+ ],
88
+ },
76
89
  ] satisfies SettingDefinition[]
77
90
  });
78
91
  }
@@ -116,14 +129,22 @@ Type for settings registration (use with `satisfies` for type checking):
116
129
 
117
130
  ```typescript
118
131
  interface SettingDefinition {
119
- id: string; // Unique ID within the extension
120
- label: string; // Display label in UI
121
- description?: string; // Optional help text shown when selected
122
- defaultValue: string; // Default value if not set
123
- values?: string[]; // Values to cycle through (omit for free-form string input)
132
+ id: string; // Unique ID within the extension
133
+ label: string; // Display label in UI
134
+ description?: string; // Optional help text shown when selected
135
+ defaultValue: string; // Default value if not set
136
+ values?: string[]; // Values to cycle through (omit for free-form string input)
137
+ options?: OrderedListOption[]; // Ordered multi-select options (mutually exclusive with values)
138
+ }
139
+
140
+ interface OrderedListOption {
141
+ id: string; // Value stored in the comma-separated setting
142
+ label: string; // Display label in the menu
124
143
  }
125
144
  ```
126
145
 
146
+ When `options` is set, Enter opens a submenu where items can be toggled (Space), reordered (Shift+↑/↓), confirmed (Enter), or cancelled (Esc). The value is stored as comma-separated IDs.
147
+
127
148
  ### Event: `pi-extension-settings:register`
128
149
 
129
150
  Emit this event to register settings for the UI:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juanibiapina/pi-extension-settings",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Pi extension for centralized settings management across extensions",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -25,13 +25,15 @@
25
25
  "utilities"
26
26
  ],
27
27
  "pi": {
28
- "extensions": ["./dist/index.js"]
28
+ "extensions": [
29
+ "./dist/index.js"
30
+ ]
29
31
  },
30
32
  "author": "Juan Ibiapina",
31
33
  "license": "MIT",
32
34
  "repository": {
33
35
  "type": "git",
34
- "url": "git+ssh://git@github.com/juanibiapina/pi-extension-settings.git"
36
+ "url": "https://github.com/juanibiapina/pi-extension-settings"
35
37
  },
36
38
  "engines": {
37
39
  "node": ">=20.0.0"