diff --git a/cli/src/stores/inventory-store.ts b/cli/src/stores/inventory-store.ts index 447c6e32..bb3af84a 100644 --- a/cli/src/stores/inventory-store.ts +++ b/cli/src/stores/inventory-store.ts @@ -74,8 +74,8 @@ export class InventoryStore { const lockData = JSON.stringify({ pid: process.pid, timestamp: Date.now() }) await writeFile(lockPath, lockData) return lockHandle - } catch (err: any) { - if (err.code !== 'EEXIST') throw err + } catch (err) { + if (err instanceof Error && 'code' in err && err.code !== 'EEXIST') throw err // Lock exists, check if it's stale (older than 30 seconds) // 30s threshold chosen to balance between: diff --git a/cli/test/unit/stores/inventory-store.test.ts b/cli/test/unit/stores/inventory-store.test.ts index 02c3f33d..9a4ca3e5 100644 --- a/cli/test/unit/stores/inventory-store.test.ts +++ b/cli/test/unit/stores/inventory-store.test.ts @@ -62,7 +62,7 @@ describe('InventoryStore', () => { const inventory = await store.read() expect(inventory.items).toHaveLength(1) - expect(inventory.items[0].slug).toBe('test-skill') + expect(inventory.items[0]?.slug).toBe('test-skill') }) test('removeTarget returns false when item not found', async () => {