The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(ci): gate cli dependency on linked-modules bridge
Steven Enamakel19c7241b4f14
diff --git a/scripts/ci/check-crate-chain.mjs b/scripts/ci/check-crate-chain.mjsindex 7b41c8fa33..7611e51127 100644--- a/scripts/ci/check-crate-chain.mjs+++ b/scripts/ci/check-crate-chain.mjs@@ -31,7 +31,7 @@ import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';import { dirname, join, relative, resolve } from 'node:path';import { fileURLToPath, pathToFileURL } from 'node:url';-import { stripComments } from '../lib/feature-forwarding.mjs';+import { parseFeatureTable, stripComments } from '../lib/feature-forwarding.mjs';/*** Package name -> the OpenHuman packages it may name as normal dependencies.@@ -44,10 +44,19 @@ export const CHAIN = {'openhuman-tinyhumans': ['openhuman-embed'],'openhuman-rpc': ['openhuman-tinyhumans'],'openhuman-app': ['openhuman-rpc'],- 'openhuman-cli': ['openhuman-rpc'],+ // The CLI alone may also name the local-development bridge that links module+ // implementation crates; `checkLinkedBridgeGate` pins HOW (optional, behind+ // the non-product `linked-modules` feature).+ 'openhuman-cli': ['openhuman-rpc', 'openhuman-modules-linked'],'openhuman-tui': ['openhuman-rpc'],+ 'openhuman-modules-linked': ['openhuman-rpc'],};+/** The local-development crate that links module implementations. */+export const LINKED_BRIDGE = 'openhuman-modules-linked';+/** The only feature allowed to enable [`LINKED_BRIDGE`]; never a product gate. */+export const LINKED_FEATURE = 'linked-modules';+/** The host crates whose `src/` must not reach core internals by path. */export const HOST_SOURCE_DIRS = ['crates/openhuman-app/src',@@ -360,6 +369,38 @@ export function checkManifestEdges({ crate, deps, workspaceDeps = new Map(), chareturn violations;}+/**+ * How the CLI may depend on the linked-modules bridge: only as an OPTIONAL+ * normal dependency enabled by the `linked-modules` feature and by nothing+ * else (not `default`, not another gate). Returns `{ crate, dependency, reason }`+ * violations; a CLI that does not name the bridge at all has none.+ */+export function checkLinkedBridgeGate(cliToml, crate = 'openhuman-cli') {+ const violations = [];+ const fail = reason => violations.push({ crate, dependency: LINKED_BRIDGE, reason });+ const text = stripComments(cliToml);+ const dep = parseNormalDependencies(cliToml).find(entry => entry.package === LINKED_BRIDGE);+ if (!dep) return violations;+ const declaration = text.match(+ new RegExp(`^[ \\t]*${dep.key}[ \\t]*=[ \\t]*\\{[^}]*\\}`, 'm')+ );+ if (!declaration || !/optional[ \t]*=[ \t]*true/.test(declaration[0])) {+ fail('must be an `optional = true` dependency so a default build does not link it');+ }+ const features = parseFeatureTable(cliToml);+ const gate = features.get(LINKED_FEATURE);+ if (!gate || !gate.includes(`dep:${dep.key}`)) {+ fail(`the \`${LINKED_FEATURE}\` feature must enable it with \`dep:${dep.key}\``);+ }+ for (const [name, items] of features) {+ if (name === LINKED_FEATURE) continue;+ if (items.some(item => item === LINKED_FEATURE || item === `dep:${dep.key}` || item.startsWith(`${dep.key}/`))) {+ fail(`feature \`${name}\` enables the linked-modules bridge; only \`${LINKED_FEATURE}\` may`);+ }+ }+ return violations;+}+/** `{ file, line, pattern }` for every forbidden path in one source text. */export function findForbiddenPaths(text, file, patterns = FORBIDDEN_HOST_PATTERNS) {const hits = [];@@ -404,6 +445,7 @@ export function checkRepository(root) {edgeViolations.push(...checkManifestEdges({ crate, deps: parseNormalDependencies(toml), workspaceDeps }));+ if (crate === 'openhuman-cli') edgeViolations.push(...checkLinkedBridgeGate(toml, crate));}const sourceViolations = [];for (const dir of HOST_SOURCE_DIRS) {