@commandgarden/cli 2.7.0 → 2.8.0

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.
@@ -10,8 +10,8 @@
10
10
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
11
11
  <link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet" />
12
12
  <title>commandGarden</title>
13
- <script type="module" crossorigin src="/assets/index-Bzw5cF_s.js"></script>
14
- <link rel="stylesheet" crossorigin href="/assets/index-DrFywqdr.css">
13
+ <script type="module" crossorigin src="/assets/index-tU8HCc9V.js"></script>
14
+ <link rel="stylesheet" crossorigin href="/assets/index-DbqYLIqy.css">
15
15
  </head>
16
16
  <body>
17
17
  <div id="root"></div>
@@ -9,6 +9,7 @@ import { timetrackingCacheRoutes } from './timetracking-cache.js';
9
9
  import { journalRoutes } from './journal.js';
10
10
  import { securityNewsCacheRoutes } from './security-news-cache.js';
11
11
  import { trustedPeersCacheRoutes } from './trusted-peers-cache.js';
12
+ import { roomAvailabilityCacheRoutes } from './room-availability-cache.js';
12
13
  import { skillsRoutes } from './skills.js';
13
14
  export function registerRoutes(app, daemon, store) {
14
15
  statusRoutes(app, daemon);
@@ -22,5 +23,6 @@ export function registerRoutes(app, daemon, store) {
22
23
  journalRoutes(app, daemon, store);
23
24
  securityNewsCacheRoutes(app, store);
24
25
  trustedPeersCacheRoutes(app, store);
26
+ roomAvailabilityCacheRoutes(app, store);
25
27
  skillsRoutes(app);
26
28
  }
@@ -0,0 +1,3 @@
1
+ import type { FastifyInstance } from 'fastify';
2
+ import type { AppStore } from '../store.js';
3
+ export declare function roomAvailabilityCacheRoutes(app: FastifyInstance, store: AppStore): void;
@@ -0,0 +1,20 @@
1
+ export function roomAvailabilityCacheRoutes(app, store) {
2
+ app.get('/api/room-availability/cache', async (req) => {
3
+ const { date } = req.query;
4
+ if (!date)
5
+ return { ok: true, data: null, fetchedAt: null };
6
+ const cached = store.getCachedRoomAvailability(date);
7
+ if (!cached)
8
+ return { ok: true, data: null, fetchedAt: null };
9
+ return { ok: true, data: cached.data, fetchedAt: cached.fetchedAt };
10
+ });
11
+ app.post('/api/room-availability/cache', async (req, reply) => {
12
+ const { date, data } = req.body;
13
+ if (!date || !Array.isArray(data)) {
14
+ reply.code(400);
15
+ return { ok: false, error: 'Missing date or data array' };
16
+ }
17
+ store.cacheRoomAvailability(date, data);
18
+ return { ok: true };
19
+ });
20
+ }
@@ -53,5 +53,10 @@ export declare class AppStore {
53
53
  data: Record<string, unknown>[];
54
54
  fetchedAt: string;
55
55
  } | null;
56
+ cacheRoomAvailability(date: string, data: Record<string, unknown>[]): void;
57
+ getCachedRoomAvailability(date: string): {
58
+ data: Record<string, unknown>[];
59
+ fetchedAt: string;
60
+ } | null;
56
61
  close(): void;
57
62
  }
@@ -106,6 +106,11 @@ export class AppStore {
106
106
  id INTEGER PRIMARY KEY CHECK (id = 1),
107
107
  data TEXT NOT NULL,
108
108
  fetched_at TEXT NOT NULL
109
+ )`);
110
+ this.db.run(`CREATE TABLE IF NOT EXISTS room_availability_cache (
111
+ date TEXT PRIMARY KEY,
112
+ data TEXT NOT NULL,
113
+ fetched_at TEXT NOT NULL
109
114
  )`);
110
115
  }
111
116
  getPreference(key) {
@@ -233,6 +238,20 @@ export class AppStore {
233
238
  fetchedAt: rows[0].fetched_at,
234
239
  };
235
240
  }
241
+ cacheRoomAvailability(date, data) {
242
+ const now = new Date().toISOString();
243
+ this.db.run('INSERT OR REPLACE INTO room_availability_cache (date, data, fetched_at) VALUES (?, ?, ?)', [date, JSON.stringify(data), now]);
244
+ this.persist();
245
+ }
246
+ getCachedRoomAvailability(date) {
247
+ const rows = this.query('SELECT data, fetched_at FROM room_availability_cache WHERE date = ?', [date]);
248
+ if (rows.length === 0)
249
+ return null;
250
+ return {
251
+ data: JSON.parse(rows[0].data),
252
+ fetchedAt: rows[0].fetched_at,
253
+ };
254
+ }
236
255
  close() {
237
256
  this.db.close();
238
257
  }
@@ -4,6 +4,12 @@
4
4
  "version": "0.1.0",
5
5
  "description": "Enterprise browser automation — secure, auditable CLI commands for websites",
6
6
  "minimum_chrome_version": "116",
7
+ "icons": {
8
+ "16": "icons/icon-16.png",
9
+ "32": "icons/icon-32.png",
10
+ "48": "icons/icon-48.png",
11
+ "128": "icons/icon-128.png"
12
+ },
7
13
  "permissions": ["alarms", "cookies", "debugger", "idle", "tabs", "scripting", "webRequest", "storage"],
8
14
  "host_permissions": ["<all_urls>"],
9
15
  "background": {
@@ -11,6 +17,10 @@
11
17
  "type": "module"
12
18
  },
13
19
  "action": {
14
- "default_popup": "popup.html"
20
+ "default_popup": "popup.html",
21
+ "default_icon": {
22
+ "16": "icons/icon-16.png",
23
+ "32": "icons/icon-32.png"
24
+ }
15
25
  }
16
26
  }
@@ -19,6 +19,7 @@
19
19
  "@types/node": "^22.0.0",
20
20
  "esbuild": "^0.25.0",
21
21
  "jsdom": "^25.0.0",
22
+ "sharp": "^0.35.3",
22
23
  "typescript": "^5.4.0",
23
24
  "vitest": "^2.0.0"
24
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commandgarden/cli",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "description": "Enterprise browser automation CLI",
5
5
  "type": "module",
6
6
  "license": "MIT",