@juicesharp/rpiv-config 2.5.2 → 2.6.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.
- package/CHANGELOG.md +8 -0
- package/README.md +3 -3
- package/config.ts +10 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [2.6.1] - 2026-08-17
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
- `GuidanceFields` (interface, `GuidanceFieldsSchema`, `validateGuidanceFields`) now supports an optional `description` field — kept when it is a non-empty string, dropped otherwise. Consumers that read `validateGuidanceFields` output and ignore the field are unaffected; consumers that compose `GuidanceFieldsSchema` into a `Value.Check`-validated config now reject a *wrong-typed* `description` (previously tolerated as an unknown key), so such consumers should degrade per field rather than per file.
|
|
6
|
+
|
|
7
|
+
## [2.6.0] - 2026-08-15
|
|
8
|
+
|
|
1
9
|
## [2.5.2] - 2026-08-14
|
|
2
10
|
|
|
3
11
|
## [2.5.1] - 2026-08-14
|
package/README.md
CHANGED
|
@@ -39,9 +39,9 @@ Eleven exports, all stateless — no singletons, no caches, no import-time side
|
|
|
39
39
|
| `loadJsonConfigWithLegacyFallback(name, file?)` | Reads the XDG path; only when that file is absent does it read the pre-XDG `~/.config/<name>/<file>`. Corruption is surfaced, never masked by the legacy file. |
|
|
40
40
|
| `saveJsonConfig(path, data)` | `mkdir -p`, writes pretty JSON with a trailing newline, then chmods `0600` (best effort). Returns `true`/`false` instead of throwing — guard your "Saved" message on it. |
|
|
41
41
|
| `validateConfig(schema, value)` | Strips unknown keys, layers schema defaults underneath, and returns `{}` on any failure. |
|
|
42
|
-
| `validateGuidanceFields(fields)` | Keeps `promptSnippet` only if
|
|
43
|
-
| `GuidanceFieldsSchema` | TypeBox object for the
|
|
44
|
-
| `GuidanceFields` | Type for the same shape: `{ promptSnippet?: string; promptGuidelines?: string[] }`. |
|
|
42
|
+
| `validateGuidanceFields(fields)` | Keeps `promptSnippet` and `description` only if each is a non-empty string, and `promptGuidelines` only if it is a non-empty array of non-empty strings. Everything else is dropped. |
|
|
43
|
+
| `GuidanceFieldsSchema` | TypeBox object for the three guidance fields, with `additionalProperties: true` so consumers can nest it in a larger config schema. |
|
|
44
|
+
| `GuidanceFields` | Type for the same shape: `{ promptSnippet?: string; promptGuidelines?: string[]; description?: string }`. |
|
|
45
45
|
| `parseModelKey(key)` | Splits `provider/modelId`, also accepting the legacy `provider:modelId`; slash wins when both are present. Returns `undefined` if there is no separator at index ≥ 1. |
|
|
46
46
|
| `modelKey({ provider, id })` | Emits the canonical `provider/id`. Paired with `parseModelKey`, persisted colon-form keys migrate on the next save. |
|
|
47
47
|
| `readEnvVar(key, fallback?)` | Returns the trimmed variable, or `fallback` when it is unset or empty after trimming. |
|
package/config.ts
CHANGED
|
@@ -181,19 +181,22 @@ export function saveJsonConfig(path: string, data: unknown): boolean {
|
|
|
181
181
|
export interface GuidanceFields {
|
|
182
182
|
promptSnippet?: string;
|
|
183
183
|
promptGuidelines?: string[];
|
|
184
|
+
description?: string;
|
|
184
185
|
}
|
|
185
186
|
|
|
186
187
|
// TypeBox form of GuidanceFields. Mirrors the interface 1:1 — same fields,
|
|
187
188
|
// same optionality. `additionalProperties: true` lets consumers compose
|
|
188
189
|
// wrappers that may carry sibling-specific keys without those leaking back
|
|
189
|
-
// into rpiv-config. The runtime invariants (
|
|
190
|
-
// array
|
|
191
|
-
// the schema is a structural
|
|
192
|
-
// guidance into a larger
|
|
190
|
+
// into rpiv-config. The runtime invariants (string fields must be non-empty,
|
|
191
|
+
// the array field must be non-empty and contain only non-empty strings) are
|
|
192
|
+
// still enforced by `validateGuidanceFields`; the schema is a structural
|
|
193
|
+
// type-narrowing aid for callers that bake guidance into a larger
|
|
194
|
+
// TypeBox-validated config object.
|
|
193
195
|
export const GuidanceFieldsSchema = Type.Object(
|
|
194
196
|
{
|
|
195
197
|
promptSnippet: Type.Optional(Type.String()),
|
|
196
198
|
promptGuidelines: Type.Optional(Type.Array(Type.String())),
|
|
199
|
+
description: Type.Optional(Type.String()),
|
|
197
200
|
},
|
|
198
201
|
{ additionalProperties: true },
|
|
199
202
|
);
|
|
@@ -219,6 +222,9 @@ export function validateGuidanceFields(fields: unknown): GuidanceFields {
|
|
|
219
222
|
) {
|
|
220
223
|
result.promptGuidelines = g.promptGuidelines;
|
|
221
224
|
}
|
|
225
|
+
if (typeof g.description === "string" && g.description.length > 0) {
|
|
226
|
+
result.description = g.description;
|
|
227
|
+
}
|
|
222
228
|
return result;
|
|
223
229
|
}
|
|
224
230
|
|