@andares/pi-toolkits 0.4.2 → 0.4.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andares/pi-toolkits",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Integrated toolkit extension for pi — ask mode (read-only Q&A), model favorites, prompt stash, third-party code review, and a dedicated compaction model",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -23,7 +23,15 @@ import {
23
23
  ModelSelectorComponent,
24
24
  type Theme,
25
25
  } from "@earendil-works/pi-coding-agent";
26
- import { afterAll, beforeEach, beforeAll, describe, expect, it } from "vitest";
26
+ import {
27
+ afterAll,
28
+ beforeEach,
29
+ beforeAll,
30
+ describe,
31
+ expect,
32
+ it,
33
+ vi,
34
+ } from "vitest";
27
35
  import {
28
36
  FavoritesStore,
29
37
  getFavoritesStore,
@@ -102,14 +110,17 @@ describe("FavoritesStore", () => {
102
110
  it("falls back to empty + defaults on a corrupted file", () => {
103
111
  const file = freshStoreFile();
104
112
  // Intentionally write invalid JSON — the READ side must tolerate it.
113
+ writeFileSync(file, "{ not json", "utf8");
114
+ // Suppress the designed degradation log; the spy asserts it fired.
115
+ const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
105
116
  try {
106
- writeFileSync(file, "{ not json", "utf8");
107
- } catch {
108
- // A failed write still leaves the store to hit the read-error path.
117
+ const store = new FavoritesStore(file);
118
+ expect(store.count()).toBe(0);
119
+ expect(store.getConfig().cycleOnlyFavorites).toBe(true);
120
+ expect(warn).toHaveBeenCalled();
121
+ } finally {
122
+ warn.mockRestore();
109
123
  }
110
- const store = new FavoritesStore(file);
111
- expect(store.count()).toBe(0);
112
- expect(store.getConfig().cycleOnlyFavorites).toBe(true);
113
124
  });
114
125
 
115
126
  it("loads cycleOnlyFavorites config from disk", () => {
@@ -204,13 +204,15 @@ describe("ReviewStore", () => {
204
204
 
205
205
  it("falls back to unset on a corrupted file", () => {
206
206
  const file = freshStoreFile();
207
+ writeFileSync(file, "{ not json", "utf8");
208
+ // Suppress the designed degradation log; the spy asserts it fired.
209
+ const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
207
210
  try {
208
- writeFileSync(file, "{ not json", "utf8");
209
- } catch {
210
- // A failed write still leaves the store to hit the read-error path.
211
+ expect(new ReviewStore(file).getModel()).toBeUndefined();
212
+ expect(warn).toHaveBeenCalled();
213
+ } finally {
214
+ warn.mockRestore();
211
215
  }
212
- const store = new ReviewStore(file);
213
- expect(store.getModel()).toBeUndefined();
214
216
  });
215
217
 
216
218
  it("ignores a stored value without a slash", () => {