@rightkit/release 0.6.81 → 0.6.82

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.6.81",
3
+ "version": "0.6.82",
4
4
  "description": "Portable release CLI/SDK with fail-closed public GitHub Releases and private R2 + RightApps distribution.",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "type": "module",
@@ -187,27 +187,68 @@ function manifestRoots(root, extraLocks) {
187
187
  /** RightKit dependencies the manifests under root declare (Cargo.toml, package.json): the inputs that need lock proof. */
188
188
  export function declaredRightKitDependencies(root, owned, extraLocks = []) {
189
189
  const found = [];
190
- const take = (ecosystem, name, file, local = false) => {
191
- if (owned[ecosystem].has(name)) found.push({ ecosystem, name, file });
192
- else if (prefixed(ecosystem, name) && !local) found.push({ ecosystem, name, file });
190
+ const take = (ecosystem, name, file, local = false, requirement = null) => {
191
+ if (owned[ecosystem].has(name)) found.push({ ecosystem, name, file, requirement });
192
+ else if (prefixed(ecosystem, name) && !local) found.push({ ecosystem, name, file, requirement });
193
193
  };
194
194
  for (const file of manifestRoots(root, extraLocks).flatMap((dir) => scanFiles(dir, new Set(["Cargo.toml", "package.json"])))) {
195
195
  try {
196
196
  if (path.basename(file) === "package.json") {
197
197
  const pkg = JSON.parse(readFileSync(file, "utf8"));
198
198
  // A git/file/link/workspace specifier never resolves from the registry; the package-contract validator refuses it by name.
199
- for (const section of NPM_DEP_SECTIONS) for (const [name, spec] of Object.entries(pkg[section] ?? {})) if (!/[:/]/.test(String(spec))) take("npm", name, file);
199
+ for (const section of NPM_DEP_SECTIONS) for (const [name, spec] of Object.entries(pkg[section] ?? {})) if (!/[:/]/.test(String(spec))) take("npm", name, file, false, String(spec));
200
200
  } else {
201
201
  const doc = parseToml(readFileSync(file, "utf8"));
202
202
  const tables = [...MANIFEST_DEP_TABLES.map((t) => doc[t]), doc.workspace?.dependencies, ...Object.values(doc.target ?? {}).flatMap((target) => MANIFEST_DEP_TABLES.map((t) => target?.[t]))];
203
203
  // A path or workspace dependency on an unowned prefixed name is app-local (see collectLockedRightKit).
204
- for (const table of tables) for (const [key, spec] of Object.entries(table ?? {})) take("cargo", typeof spec === "object" && spec && typeof spec.package === "string" ? spec.package : key, file, typeof spec === "object" && spec !== null && (typeof spec.path === "string" || spec.workspace === true));
204
+ for (const table of tables) for (const [key, spec] of Object.entries(table ?? {})) take("cargo", typeof spec === "object" && spec && typeof spec.package === "string" ? spec.package : key, file, typeof spec === "object" && spec !== null && (typeof spec.path === "string" || spec.workspace === true), typeof spec === "string" ? spec : typeof spec?.version === "string" ? spec.version : null);
205
205
  }
206
206
  } catch { /* an unreadable manifest is the manifest validators' finding */ }
207
207
  }
208
208
  return found;
209
209
  }
210
210
 
211
+
212
+ /**
213
+ * Whether `version` satisfies a declared requirement, read as the ecosystem reads it: Cargo's bare "0.5.0" is "^0.5.0", npm's is exact;
214
+ * "=", "^", "~", ">=", ">", "<=", "<" and Cargo's comma-joined sets are understood. Returns null when the requirement is not one of these
215
+ * (a tag, a range with spaces or "||", a wildcard), so the caller can stay conservative.
216
+ */
217
+ export function satisfiesRequirement(version, requirement, ecosystem) {
218
+ const parse = (v) => { const m = /^(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-[0-9A-Za-z.-]+)?$/.exec(String(v).trim()); return m ? { parts: [Number(m[1]), m[2] === undefined ? null : Number(m[2]), m[3] === undefined ? null : Number(m[3])] } : null; };
219
+ const full = parse(version);
220
+ if (!full || full.parts.includes(null)) return null;
221
+ const [a, b, c] = full.parts;
222
+ const cmp = (x) => { const p = x.parts.map((n) => n ?? 0); return a !== p[0] ? (a < p[0] ? -1 : 1) : b !== p[1] ? (b < p[1] ? -1 : 1) : c !== p[2] ? (c < p[2] ? -1 : 1) : 0; };
223
+ const one = (text) => {
224
+ const m = /^(=|\^|~|>=|<=|>|<)?\s*v?(\S+)$/.exec(text.trim());
225
+ if (!m) return null;
226
+ const op = m[1] ?? (ecosystem === "cargo" ? "^" : "=");
227
+ const req = parse(m[2]);
228
+ if (!req) return null;
229
+ const [x, y, z] = req.parts;
230
+ if (op === "=") return a === x && (y === null || b === y) && (z === null || c === z);
231
+ if (op === ">=") return cmp(req) >= 0;
232
+ if (op === ">") return cmp(req) > 0;
233
+ if (op === "<=") return cmp(req) <= 0;
234
+ if (op === "<") return cmp(req) < 0;
235
+ if (op === "~") return cmp(req) >= 0 && a === x && (y === null || b === y);
236
+ // Caret: the left-most non-zero part is fixed.
237
+ if (cmp(req) < 0) return false;
238
+ if (x !== 0) return a === x;
239
+ if (y === null) return a === 0;
240
+ if (y !== 0) return a === 0 && b === y;
241
+ if (z === null) return a === 0 && b === 0;
242
+ return a === 0 && b === 0 && c === z;
243
+ };
244
+ const text = String(requirement ?? "").trim();
245
+ if (!text || /\|\||\*|\bx\b/.test(text)) return null;
246
+ const parts = ecosystem === "cargo" ? text.split(",") : [text];
247
+ if (ecosystem !== "cargo" && /\s/.test(text)) return null;
248
+ const results = parts.map(one);
249
+ return results.includes(null) ? null : results.every(Boolean);
250
+ }
251
+
211
252
  /** Declared RightKit dependencies that no lock entry proves: no bundled-only fallback. */
212
253
  export function coverageProblems(declared, lockedEntries) {
213
254
  const have = new Set(lockedEntries.map((e) => `${e.ecosystem}\0${e.name}`));
@@ -665,7 +706,16 @@ export function evaluateRightKitFreshness(snapshot, holds, { enforce = false, de
665
706
  // `declared`: the RightKit names the app's own manifests declare (`${ecosystem}\0${name}`). A stale entry the app does not declare is a
666
707
  // transitive lock entry: only the RightKit units that depend on it can move it, so it is reported, never refused (Pulse 0.6.80: rightkit-fs
667
708
  // 0.4.19, required ^0.4 by the latest rightkit-http, -pdf and others). With no set given every entry is judged as before.
668
- const isDirect = (entry) => !declared || declared.has(`${entry.ecosystem}\0${entry.name}`);
709
+ const isDirect = (entry) => {
710
+ if (!declared) return true;
711
+ const reqs = declared.get(`${entry.ecosystem}\0${entry.name}`);
712
+ if (!reqs) return false;
713
+ // Declared by name: direct only when its version meets one of the app's own requirements for that name (Pulse 0.6.81: it declares
714
+ // rightkit-fs =0.5.0, and the 0.4.19 the latest rightkit-http still pulls in is transitive). A name declared with no readable
715
+ // requirement (a workspace-inherited entry, an unparsed range) stays direct.
716
+ const verdicts = reqs.map((r) => (r === null ? null : satisfiesRequirement(entry.version, r, entry.ecosystem)));
717
+ return verdicts.includes(true) || verdicts.every((v) => v === null);
718
+ };
669
719
  const refusals = [];
670
720
  const newer = [];
671
721
  const tasks = [];
@@ -730,7 +780,13 @@ export async function prepareRightKitResolution({ root, snapshotFile = null, bou
730
780
  // so a publication after admission neither mutates nor restarts an admitted build.
731
781
  const enforce = admission && source === "resolved";
732
782
  let declared = null;
733
- try { declared = new Set(declaredRightKitDependencies(root, ownedRightKitNames(versions, ownership), options.extraLocks ?? []).map((d) => `${d.ecosystem}\0${d.name}`)); } catch { declared = null; }
783
+ try {
784
+ declared = new Map();
785
+ for (const d of declaredRightKitDependencies(root, ownedRightKitNames(versions, ownership), options.extraLocks ?? [])) {
786
+ const key = `${d.ecosystem}\0${d.name}`;
787
+ declared.set(key, [...(declared.get(key) ?? []), d.requirement ?? null]);
788
+ }
789
+ } catch { declared = null; }
734
790
  const freshness = evaluateRightKitFreshness(snapshot, readUpdateHolds(root), { enforce, declared });
735
791
  if (freshness.refusals.length) {
736
792
  throw new RightKitRegistryError("stale-pin", `RightKit pins are behind the latest published version (build admission refused):\n${freshness.refusals.map((p) => `- ${p}`).join("\n")}`, { problems: freshness.refusals });
@@ -49,7 +49,7 @@
49
49
  "@rightkit/qa": "0.7.0",
50
50
  "@rightkit/qa-chrome": "0.1.12",
51
51
  "@rightkit/react-shell": "0.7.9",
52
- "@rightkit/release": "0.6.81",
52
+ "@rightkit/release": "0.6.82",
53
53
  "@rightkit/send-ui": "0.1.0",
54
54
  "@rightkit/settings-ui": "0.7.7",
55
55
  "@rightkit/social-ui": "0.2.1",
@@ -446,7 +446,8 @@
446
446
  "0.6.77",
447
447
  "0.6.78",
448
448
  "0.6.79",
449
- "0.6.80"
449
+ "0.6.80",
450
+ "0.6.81"
450
451
  ],
451
452
  "@rightkit/settings-ui": [
452
453
  "0.1.0",
@@ -576,7 +577,7 @@
576
577
  "rightkit-agents": "0.2.8",
577
578
  "rightkit-ai-accounts": "0.1.3",
578
579
  "rightkit-ai-keys": "0.1.1",
579
- "rightkit-android": "0.3.2",
580
+ "rightkit-android": "0.3.3",
580
581
  "rightkit-app-host": "0.1.3",
581
582
  "rightkit-app-icon": "0.1.0",
582
583
  "rightkit-app-lock": "0.1.0",
@@ -699,7 +700,7 @@
699
700
  "rightkit-memory-core": "0.2.0",
700
701
  "rightkit-memory-store": "0.2.2",
701
702
  "rightkit-mesh": "0.2.3",
702
- "rightkit-models": "0.7.2",
703
+ "rightkit-models": "0.7.3",
703
704
  "rightkit-motion": "0.4.0",
704
705
  "rightkit-notch-ui": "0.2.3",
705
706
  "rightkit-notifications": "0.1.2",
@@ -723,7 +724,7 @@
723
724
  "rightkit-profile": "0.1.0",
724
725
  "rightkit-prompt-recipes": "0.2.1",
725
726
  "rightkit-pty": "0.1.3",
726
- "rightkit-qa": "0.10.12",
727
+ "rightkit-qa": "0.10.13",
727
728
  "rightkit-record": "0.4.1",
728
729
  "rightkit-reframe": "0.2.0",
729
730
  "rightkit-remote-compute": "0.2.1",
@@ -914,7 +915,7 @@
914
915
  "@rightkit/qa": "0.7.0",
915
916
  "@rightkit/qa-chrome": "0.1.12",
916
917
  "@rightkit/react-shell": "0.7.7",
917
- "@rightkit/release": "0.6.80",
918
+ "@rightkit/release": "0.6.81",
918
919
  "@rightkit/settings-ui": "0.7.4",
919
920
  "@rightkit/shell": "0.1.1",
920
921
  "@rightkit/tauri": "0.4.3",
@@ -968,7 +969,8 @@
968
969
  "rightkit-android": [
969
970
  "0.2.0",
970
971
  "0.3.0",
971
- "0.3.1"
972
+ "0.3.1",
973
+ "0.3.2"
972
974
  ],
973
975
  "rightkit-app-manager": [
974
976
  "0.2.2",
@@ -1383,7 +1385,8 @@
1383
1385
  "0.3.1",
1384
1386
  "0.3.2",
1385
1387
  "0.4.4",
1386
- "0.5.1"
1388
+ "0.5.1",
1389
+ "0.7.2"
1387
1390
  ],
1388
1391
  "rightkit-motion": [
1389
1392
  "0.1.0",
@@ -1495,7 +1498,8 @@
1495
1498
  "0.9.1",
1496
1499
  "0.10.8",
1497
1500
  "0.10.10",
1498
- "0.10.11"
1501
+ "0.10.11",
1502
+ "0.10.12"
1499
1503
  ],
1500
1504
  "rightkit-qa-driver": [
1501
1505
  "0.3.0",