skillwatch 0.1.7 → 0.1.9

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/dist/checker.js CHANGED
@@ -79,15 +79,13 @@ const fetchGitHubJson = async (url, token) => {
79
79
  return null;
80
80
  }
81
81
  };
82
+ const fetchTreeForBranch = async (ownerRepo, branch, token) => await fetchGitHubJson(`https://api.github.com/repos/${ownerRepo}/git/trees/${branch}?recursive=1`, token);
82
83
  const fetchRepoTree = async (ownerRepo, token) => {
83
- const branches = [
84
- (await fetchGitHubJson(`https://api.github.com/repos/${ownerRepo}`, token))?.default_branch,
85
- "main",
86
- "master"
87
- ].filter(Boolean);
88
- const uniqueBranches = [...new Set(branches)];
89
- for (const branch of uniqueBranches) {
90
- const treeData = await fetchGitHubJson(`https://api.github.com/repos/${ownerRepo}/git/trees/${branch}?recursive=1`, token);
84
+ const mainTree = await fetchTreeForBranch(ownerRepo, "main", token);
85
+ if (mainTree) return mainTree;
86
+ const fallbacks = [(await fetchGitHubJson(`https://api.github.com/repos/${ownerRepo}`, token))?.default_branch, "master"].filter((b) => typeof b === "string" && b !== "main");
87
+ for (const branch of fallbacks) {
88
+ const treeData = await fetchTreeForBranch(ownerRepo, branch, token);
91
89
  if (treeData) return treeData;
92
90
  }
93
91
  return null;
@@ -149,17 +147,25 @@ const findUpdates = async () => {
149
147
  const token = getGitHubToken();
150
148
  const updates = [];
151
149
  const errors = [];
152
- const treeCache = /* @__PURE__ */ new Map();
150
+ const repoIds = [...new Set(trackedSkills.map((s) => s.repoId))];
151
+ const treeEntries = await Promise.all(repoIds.map(async (repoId) => {
152
+ return [repoId, await fetchRepoTree(repoId, token)];
153
+ }));
154
+ const treeCache = new Map(treeEntries);
153
155
  for (const tracked of trackedSkills) {
154
- let treeData = treeCache.get(tracked.repoId);
155
- if (treeData === void 0) {
156
- treeData = await fetchRepoTree(tracked.repoId, token);
157
- treeCache.set(tracked.repoId, treeData);
156
+ const treeData = treeCache.get(tracked.repoId) ?? null;
157
+ if (!treeData) {
158
+ errors.push({
159
+ reason: "Could not fetch repo tree",
160
+ repoId: tracked.repoId,
161
+ skillName: tracked.skillName
162
+ });
163
+ continue;
158
164
  }
159
- const remoteHash = treeData ? findFolderHashInTree(treeData, tracked.skillPath) : null;
165
+ const remoteHash = findFolderHashInTree(treeData, tracked.skillPath);
160
166
  if (!remoteHash) {
161
167
  errors.push({
162
- reason: "Could not fetch remote folder hash",
168
+ reason: "Skill folder not found in repo tree",
163
169
  repoId: tracked.repoId,
164
170
  skillName: tracked.skillName
165
171
  });
package/dist/cli.js CHANGED
@@ -9,7 +9,7 @@ import { fileURLToPath } from "node:url";
9
9
  //#region src/cli.ts
10
10
  var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
11
11
  const PACKAGE_NAME = "skillwatch";
12
- const PACKAGE_VERSION = "0.1.7";
12
+ const PACKAGE_VERSION = "0.1.9";
13
13
  const ENTRYPOINT_PATH = fileURLToPath(import.meta.url);
14
14
  const PACKAGE_DIR = dirname(ENTRYPOINT_PATH);
15
15
  const CHECKER_SOURCE_PATH = join(PACKAGE_DIR, "checker.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillwatch",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Daily macOS notifications when installed GitHub-backed skills have updates.",
5
5
  "keywords": [
6
6
  "agent-skills",