tokentracker-cli 0.6.3 → 0.6.4

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.
@@ -1858,13 +1858,35 @@ function hashRepoRoot(repoRoot) {
1858
1858
  return crypto.createHash("sha256").update(String(repoRoot)).digest("hex");
1859
1859
  }
1860
1860
 
1861
+ function deriveProjectKeyFromRef(projectRef) {
1862
+ if (typeof projectRef !== "string") return null;
1863
+ try {
1864
+ const parsed = new URL(projectRef);
1865
+ const segments = parsed.pathname.split("/").filter(Boolean);
1866
+ if (segments.length < 2) return null;
1867
+ return `${segments[0]}/${segments[1]}`;
1868
+ } catch (_e) {
1869
+ return null;
1870
+ }
1871
+ }
1872
+
1861
1873
  async function defaultPublicRepoResolver({ projectRef, repoRoot }) {
1874
+ const repoRootHash = repoRoot ? hashRepoRoot(repoRoot) : null;
1875
+ const projectKey = deriveProjectKeyFromRef(projectRef);
1876
+ if (!projectKey) {
1877
+ return {
1878
+ status: "blocked",
1879
+ projectKey: null,
1880
+ projectRef: projectRef || null,
1881
+ repoRootHash,
1882
+ reason: projectRef ? "unparseable_ref" : "missing_ref",
1883
+ };
1884
+ }
1862
1885
  return {
1863
- status: "blocked",
1864
- projectKey: null,
1865
- projectRef: projectRef || null,
1866
- repoRootHash: repoRoot ? hashRepoRoot(repoRoot) : null,
1867
- reason: projectRef ? "local_only" : "missing_ref",
1886
+ status: "public_verified",
1887
+ projectKey,
1888
+ projectRef,
1889
+ repoRootHash,
1868
1890
  };
1869
1891
  }
1870
1892