@bendyline/gezel-sdk 1.1.1 → 1.1.3

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/checks.d.ts CHANGED
@@ -420,6 +420,13 @@ declare function citationsResolve(ws: WorkspaceLike, file: string, opts?: {
420
420
  minCitations?: number;
421
421
  corpus?: string[];
422
422
  knownPaths?: readonly string[];
423
+ /**
424
+ * Resolves a `knowledge://` citation against the installed catalogs.
425
+ * Without it those citations are counted as unchecked URLs; with it, one
426
+ * that names a catalog, document or passage that is not installed fails
427
+ * like a missing file.
428
+ */
429
+ resolveKnowledge?: (uri: string) => Promise<boolean>;
423
430
  }): Promise<CitationsResult>;
424
431
  /** Spec for {@link valuesSubsetOf}. */
425
432
  interface ValuesSubsetSpec {
package/dist/checks.js CHANGED
@@ -1114,6 +1114,11 @@ async function citationsResolve(ws, file, opts = {}) {
1114
1114
  const urls = [];
1115
1115
  const forgiven = [];
1116
1116
  for (const c of cites) {
1117
+ if (opts.resolveKnowledge && /^knowledge:\/\//i.test(c)) {
1118
+ if (await opts.resolveKnowledge(c)) resolved.push(c);
1119
+ else unresolved.push(c);
1120
+ continue;
1121
+ }
1117
1122
  if (/^[a-z][\w+.-]*:\/\//i.test(c) || c.startsWith("mailto:")) {
1118
1123
  urls.push(c);
1119
1124
  if (corpus && !corpus.has(c.toLowerCase())) unresolved.push(c);
@@ -1142,7 +1147,7 @@ async function citationsResolve(ws, file, opts = {}) {
1142
1147
  const listed = unresolved.slice(0, 5).map((u) => `\`${u}\``).join(", ");
1143
1148
  return {
1144
1149
  ok: false,
1145
- detail: `${file} cites ${unresolved.length} source(s) that do not exist: ${listed}${unresolved.length > 5 ? ", \u2026" : ""} \u2014 every cited path must resolve to a real file in the workspace${corpus ? "/corpus" : ""} (no fabricated citations).`,
1150
+ detail: `${file} cites ${unresolved.length} source(s) that do not exist: ${listed}${unresolved.length > 5 ? ", \u2026" : ""} \u2014 every cited path must resolve to a real file in the workspace${corpus ? "/corpus" : ""}${unresolved.some((u) => /^knowledge:\/\//i.test(u)) ? ", and every knowledge:// citation to a passage in an installed catalog (copy the URI from a search result; do not compose one)" : ""} (no fabricated citations).`,
1146
1151
  resolved,
1147
1152
  unresolved,
1148
1153
  urls,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/gezel-sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "SDK imported by scripts running in the Gezel sandbox. Exposes the `gezel` object and `defineScript` helper.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -63,7 +63,7 @@
63
63
  "!dist/**/*.map"
64
64
  ],
65
65
  "devDependencies": {
66
- "@bendyline/gezel": "1.2.1",
66
+ "@bendyline/gezel": "1.2.3",
67
67
  "tsup": "^8.5.1",
68
68
  "typescript": "^6.0.3",
69
69
  "vitest": "^4.1.10"