/** * bootstrap — performs the one-time (per-process) STARTUP phase registrations * (language adapters + tool admission via the uniform dynamic path) and * returns the populated registries + provenance/manifests to the composition * root. * * The full 10-step canonical lifecycle (including the PER-RUN steps that * happen later in the preAction hook) is documented in `tool-lifecycle.ts`. * This module owns steps 1-4 (discover/compat/trust/import for bundled + * installed + authored) plus the mount seam re-export. * * See tool-lifecycle.ts for the ordered steps and phase split. */ import { type CliDiagnostic, type LanguageRegistry, type ToolPluginManifest, type ToolProvenance, type ToolRegistry } from '@opensip-cli/core'; import { type StartupTimingEvent } from './bootstrap-diagnostics-buffer.js'; import { type BootstrapPolicyState } from './bootstrap-policy.js'; import type { ToolRuntimeExecutionMode } from './worker-datastore.js'; export * from './bootstrap-exports.js'; export interface BootstrapOptions { readonly langRegistry: LanguageRegistry; readonly toolRegistry: ToolRegistry; /** * User args after the binary (`process.argv.slice(2)`). Used for bootstrap- * time global flags (e.g. `--no-plugins`) that must be honored before Commander * parses. */ readonly argv?: readonly string[]; /** * The CLI's own install directory. Anchors discovery of graph adapters * and of tools installed as siblings of a global `opensip-cli`. */ readonly projectDir: string; /** * The user's working directory (process.cwd()). Anchors project-local * and user-global tool discovery (a plain `npm install @tool`, the * project's `.runtime/plugins/tool`, and `~/.opensip-cli/plugins/tool`). */ readonly cwd: string; /** Whether `cwd` came from the command's explicit `--cwd` option. */ readonly cwdExplicit?: boolean; /** * Early `--config` selection, parsed before dynamic Tool discovery so startup * trust/discovery and the later authoritative planner resolve one project. */ readonly explicitConfigPath?: string; /** * `import.meta.url` of the CLI entry. Used to init telemetry as early as * possible (reads the CLI package version for the `service.version` resource * attribute). Telemetry init is a no-op unless `OTEL_EXPORTER_OTLP_ENDPOINT` * is set, so this is inert for standalone runs. */ readonly cliEntryUrl: string; /** Exact startup posture, validated before any external runtime discovery. */ readonly runtimeMode: ToolRuntimeExecutionMode; /** * Composition-root proof that project/user discovery is covered by its * startup reader. Optional only for direct library tests and embedders. */ readonly assertExternalDiscoveryProtected?: (projectRoot: string) => void; /** * Register only trusted bundled language/Tool surfaces. This mode exists for * the pre-lease Commander bailout probe and must not inspect project/user * policy, installed packages, authored Tools, telemetry, or runtime state. */ readonly discoveryMode?: 'standard' | 'bundled-surface-only'; } /** * One-shot bootstrap: register language adapters, register the first- * party tools, and discover-and-register every third-party tool + * @opensip-cli/graph-* adapter pack. Datastore is NOT opened here — * it's a lazy getter on ToolCliContext (cli-context.ts), so dry-runs * and error paths that never read `cli.datastore` don't materialise * `.runtime/datastore.sqlite`. * * Graph adapter discovery runs BEFORE `mountAllToolCommands`: the * graph tool's `register()` method assumes adapters are already * available so its lang-adapter registry isn't empty when the first * `pickAdapter()` lands during a real run. PR 1a of plan * local architecture planning notes */ export declare function bootstrapCli(opts: BootstrapOptions): Promise; /** What {@link bootstrapCli} hands back to the composition root. */ export interface BootstrapResult { /** * Provenance for every tool admitted through the compatibility gate * (bundled + installed), in registration order. Reachable by `plugin * list` (Phase 4) via the cli-context per-run holder. */ readonly provenance: readonly ToolProvenance[]; /** * Manifests for every tool admitted through the compatibility gate * (bundled + installed), in registration order. The composition root * seeds the per-run capability registry from these (§5.3) via the * cli-context per-run holder. */ readonly manifests: readonly ToolPluginManifest[]; /** * Typed bootstrap diagnostics gathered during startup discovery/load (ADR-0060). * Transferred onto the per-run {@link RunScope} by the composition root. */ readonly bootstrapDiagnostics: readonly CliDiagnostic[]; /** Startup phase timings captured before Commander preAction enters the run scope. */ readonly startupTimings: readonly StartupTimingEvent[]; /** Resolved pre-scope policy used for startup extension admission. */ readonly trustPolicy: BootstrapPolicyState['policy']; /** Bootstrap policy audit events gathered before per-run scope construction. */ readonly policyAudit: BootstrapPolicyState['audit']; } //# sourceMappingURL=index.d.ts.map