/** * The synthesized profile of a repository: languages, frameworks, cloud/deploy * targets, and the canonical commands a model should run — all derived purely * from on-disk signature files and the project's own `package.json` scripts (no * network, no execution), so the same tree always yields the same {@link RepoStack}. * * Commands are only populated when they actually exist: `testRunner` is left * `undefined` for a placeholder `echo` test script, and `lintCommand` is omitted * when no lint script/linter is present, so downstream hooks never reference a * script the repo doesn't have. */ export interface WorkspaceStack { /** Detected language(s) for this workspace/package root. */ languages: string[]; /** Workspace-local package manager, if one is derivable. */ packageManager?: string; /** Workspace-local test command, when derivable from that workspace's manifest. */ testRunner?: string; /** Workspace-local build command, when derivable from that workspace's manifest. */ buildCommand?: string; /** Workspace-local lint command, when derivable from that workspace's manifest. */ lintCommand?: string; /** Workspace-local format command, when derivable from that workspace's manifest. */ formatCommand?: string; /** Workspace-local start command, when declared by that workspace's manifest. */ startCommand?: string; /** Workspace-local aggregate verification command, when declared by its manifest. */ verifyCommand?: string; /** Workspace-local typecheck command, when declared by its manifest. */ typecheckCommand?: string; } export interface DeploymentCommands { cdkSynth?: string; cdkDiff?: string; cdkDeploy?: string; } export interface RepoStack { /** Detected languages/runtimes, deduped, in first-seen order. */ languages: string[]; /** Frameworks detected from manifests (e.g. "Serverless Framework", "Next.js"). */ frameworks: string[]; /** Cloud providers in play (e.g. "AWS"), from SDK deps / serverless provider. */ cloud: string[]; /** Datastores in play (PostgreSQL / MySQL / MongoDB / SQLite / Redis / DynamoDB). */ databases: string[]; /** Deployment targets (Docker / Kubernetes-Helm / Terraform / Serverless Framework / …). */ deployment: string[]; /** Primary package manager from manifest/lockfile signals, if any. */ packageManager?: string; /** True when TypeScript is actually present (tsconfig.json or a .ts/.tsx source). */ hasTypeScript: boolean; /** Raw `scripts` from the primary package.json (empty if none). */ scripts: Record; /** One-line human description (package.json description or a synthesized one). */ description?: string; /** Notable entry points (serverless functions, main, detected handlers). */ entryPoints: string[]; /** How to run the test suite, or undefined when the repo has no real test command. */ testRunner?: string; /** How to produce a build, or undefined when none is defined. */ buildCommand?: string; /** How to lint, or undefined when the repo defines no lint command. */ lintCommand?: string; /** How to check formatting, or undefined when the repo defines no format command. */ formatCommand?: string; /** How to start the local app/server, or undefined when none is defined. */ startCommand?: string; /** Aggregate quality gate, declared-only and never inferred. */ verifyCommand?: string; /** Typecheck gate, declared-only and never inferred. */ typecheckCommand?: string; /** Deployment/tool verbs derived from deployment manifests such as cdk.json. */ deploymentCommands?: DeploymentCommands; /** True when tests run in a real browser (Karma/Cypress/…) — they hang in a headless agent. */ browserTest: boolean; /** True when a workspace/monorepo orchestrator or multiple package manifests are present. */ isMonorepo: boolean; /** Detected workspace tool (turbo/nx/pnpm/rush/lerna/bazel/maven/gradle/npm-yarn), if any. */ workspaceTool?: string; /** Per-workspace command/package facts keyed by repo-relative POSIX workspace path. */ workspaces?: Record; /** Total detected workspace roots before the emitted workspace map was capped. */ workspaceCount?: number; /** Local Python virtualenv directories found and excluded from source scanning. */ virtualEnvPaths?: string[]; } export interface ScanOptions { /** How deep to recurse below `root` (root itself is depth 0). */ maxDepth: number; /** * The repo's configured canonical context dir (e.g. `ai-coding`), excluded from * the walk so the scanner never treats its OWN generated canon as repo stack. * The static {@link EXCLUDED_DIRS} only covers the legacy `.ai-context` default, * so a custom/visible context dir must be excluded dynamically. */ contextDir?: string; /** Internal: false when scanning one workspace root to avoid recursive workspace maps. */ includeWorkspaces?: boolean; } /** * Recursively scan `root` and synthesize an accurate {@link RepoStack}. Pure and * side-effect-free beyond reading the filesystem: skips vendored/generated dirs, * tolerates unreadable dirs, and reads the project's own manifests to avoid * guessing (JS vs TS, real scripts, serverless/SAM/CDK/AWS). */ export declare function scanRepo(root: string, opts: ScanOptions): RepoStack;