@weavetab/plugin-github 1.1.0 → 1.2.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.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  > and inspect active tabs directly — **without burning browser turns or API quota**.
6
6
 
7
7
  [![Trust: Official](https://img.shields.io/badge/trust-official-1e3a8a.svg?style=flat-square)](https://weavetab.dev)
8
- [![Engine: Weavetab ^2.5.2](https://img.shields.io/badge/engine-weavetab_%5E2.5.2-black.svg?style=flat-square)](https://weavetab.dev)
8
+ [![Engine: Weavetab >=2.6.0](https://img.shields.io/badge/engine-weavetab_%3E%3D2.6.0-black.svg?style=flat-square)](https://weavetab.dev)
9
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](LICENSE)
10
10
 
11
11
  ---
package/dist/analyze.js CHANGED
@@ -92,6 +92,6 @@ export async function githubAnalyze(ctx, repoSlug) {
92
92
  readme_snippet,
93
93
  analyzed_at: Date.now(),
94
94
  };
95
- await saveRepoCache(cacheData, ctx.store);
95
+ await saveRepoCache(cacheData, ctx.store, ctx.cacheTtlMs);
96
96
  return cacheData;
97
97
  }
package/dist/cache.d.ts CHANGED
@@ -6,4 +6,4 @@ import type { GithubRepoCache } from "./types.js";
6
6
  */
7
7
  export declare function loadRepoCache(owner: string, repo: string, store: PluginStorage | undefined | null, ttlMs: number): Promise<GithubRepoCache | null>;
8
8
  /** Persist an analysis result into the plugin's isolated storage. */
9
- export declare function saveRepoCache(data: GithubRepoCache, store: PluginStorage | undefined | null): Promise<void>;
9
+ export declare function saveRepoCache(data: GithubRepoCache, store: PluginStorage | undefined | null, ttlMs?: number): Promise<void>;
package/dist/cache.js CHANGED
@@ -10,9 +10,17 @@ function cacheFile(owner, repo) {
10
10
  * Returns null when absent, malformed, or older than `ttlMs`.
11
11
  */
12
12
  export async function loadRepoCache(owner, repo, store, ttlMs) {
13
- if (!store || typeof store.getJSON !== "function")
13
+ if (!store)
14
14
  return null;
15
- const data = await store.getJSON(cacheFile(owner, repo));
15
+ const key = cacheFile(owner, repo);
16
+ if (typeof store.getWithExpiry === "function") {
17
+ const cached = (await store.getWithExpiry(key));
18
+ if (cached)
19
+ return cached;
20
+ }
21
+ if (typeof store.getJSON !== "function")
22
+ return null;
23
+ const data = await store.getJSON(key);
16
24
  if (!data || typeof data.analyzed_at !== "number")
17
25
  return null;
18
26
  if (Date.now() - data.analyzed_at > ttlMs)
@@ -20,8 +28,15 @@ export async function loadRepoCache(owner, repo, store, ttlMs) {
20
28
  return data;
21
29
  }
22
30
  /** Persist an analysis result into the plugin's isolated storage. */
23
- export async function saveRepoCache(data, store) {
24
- if (!store || typeof store.setJSON !== "function")
31
+ export async function saveRepoCache(data, store, ttlMs) {
32
+ if (!store)
33
+ return;
34
+ const key = cacheFile(data.owner, data.repo);
35
+ if (ttlMs && typeof store.setWithExpiry === "function") {
36
+ await store.setWithExpiry(key, data, ttlMs);
25
37
  return;
26
- await store.setJSON(cacheFile(data.owner, data.repo), data);
38
+ }
39
+ if (typeof store.setJSON === "function") {
40
+ await store.setJSON(key, data);
41
+ }
27
42
  }
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ function buildRunContext(ctx, session) {
31
31
  }
32
32
  export const githubPlugin = definePlugin({
33
33
  name: "@weavetab/plugin-github",
34
- version: "1.1.0",
34
+ version: "1.2.0",
35
35
  description: "Official Weavetab GitHub plugin — modular repository analysis, raw source reads, issues, pull requests, raw diffs, and active-tab DOM inspection.",
36
36
  defaultConfig: {
37
37
  cacheTtlMs: DEFAULT_CACHE_TTL_MS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weavetab/plugin-github",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Official Weavetab GitHub plugin - modular repository analysis, raw source reads, issues, pull requests, raw diffs, and active-tab DOM inspection without burning browser turns or API quota.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -20,11 +20,12 @@
20
20
  "scripts": {
21
21
  "build": "tsc",
22
22
  "dev": "tsc --watch",
23
+ "preflight": "weavetab preflight",
23
24
  "test": "node --test test/*.test.mjs",
24
25
  "prepublishOnly": "npm run build"
25
26
  },
26
27
  "dependencies": {
27
- "@weavetab/sdk": "^2.5.2"
28
+ "@weavetab/sdk": "^2.6.0"
28
29
  },
29
30
  "devDependencies": {
30
31
  "@types/node": "^20.19.0",
package/weavetab.json CHANGED
@@ -2,11 +2,11 @@
2
2
  "$schema": "https://weavetab.dev/schema/plugin.json",
3
3
  "name": "@weavetab/plugin-github",
4
4
  "displayName": "GitHub",
5
- "version": "1.1.0",
5
+ "version": "1.2.0",
6
6
  "description": "Official Weavetab GitHub plugin. Modular tools to analyze repositories, read raw source files, search issues, inspect pull requests, fetch raw diffs, and inspect active tabs directly without burning browser turns or API quota.",
7
7
  "entry": "dist/index.js",
8
8
  "engines": {
9
- "weavetab": "^2.5.2",
9
+ "weavetab": ">=2.6.0",
10
10
  "node": ">=18.0.0"
11
11
  },
12
12
  "environments": [