Code reference detail
base-discovery.ts
packages/analytical/src/core/base-discovery.ts
| Idea | Status | Tags | Summary |
|---|---|---|---|
| base | A base is a container for ideas, ideasets, and files. It forms the boundary of one ideas graph and is consumed by the CLI and the extension. Marker: a directory is a base only when it owns a `.reqlan` folder ( [app_memory_doc.application_memory] ). No bare workspace folder is treated as a base until the user creates `.reqlan` there ( [create_base_onboarding] ). Aligns with [ontology_base]. Discovery and registry: [base_discovery], [base_registry]. Marker path helpers: [application_memory_impl]. | ||
| base_nesting | Bases may nest: any subdirectory that owns its own `.reqlan` is a child base. Parent-base indexing includes only `.rq` files under the parent root that are * * not * * under any child base root ( [base_discovery] ownership exclusion ). Nested bases appear as siblings in the multi-base registry; the longest-matching base root wins for a given file path ( [implied_context] ). | ||
| implied_context | The * * active base * * for editor-adjacent surfaces is the longest-matching base root that contains the focused file path. When no file is focused, the last selected base ( Ideas Summary switcher / activity bar ) or the first discovered base is used. Context, local graph, and analysers bind to the active base's index — not a merged global graph. User / explicit pin is a pointer swap only — [active_base_switch]. Core selection: [base_discovery] ( `baseForPath` / `selectDefaultBase` ); editor pin / switch: [editor_index_adapter]. | ||
| multi_base_environment | Analytical features are multibase aware via [base_registry]: one [ideas_index] / `WorkspaceIndex` per base, isolated catalogs ( no cross-base idea-id collision ). Surfaces list all discovered bases; Ideas Summary and context panes scope to the active / selected base ( [active_base_switch] ). Cross-base reference resolution and merged graphs are out of scope for the first multi-base pass. Headless ( CLI / MCP ) selects one base via [analysis_runtime]; the editor hosts [editor_index_adapter]. | ||
| configuration_location | An optional `.reqlan/config.json` may appear under a base's `.reqlan` directory. For a given `.rq` file, the applying base is the nearest ancestor directory that owns a `.reqlan` folder. The applying config is that base's `.reqlan/config.json` when present. If the owning base has no `config.json`, or no owning base is found, defaults from [configuration_import_roots] apply. A child base does not inherit a parent base's config. Implemented by ["../../packages/language/src/reqlan-path-resolve.ts"]. | ||
| configuration_rqignore | done | Each base may define path ignore rules in `.reqlan/.rqignore` using * * gitignore syntax * *. Patterns are relative to the base root ( parent of `.reqlan` ), not the `.reqlan` directory. Owned by `@reqlan/analytical` so the CLI, MCP, and extension share one filter for discovery and indexing walks. Built-in defaults always apply ( dependencies, venvs, build output, VCS / editor stores, `*.db3` / sqlite DBs, `*.secret.rq`, hidden entries, and `.reqlan/` itself ); the on-disk file adds or overrides via the same syntax, including `!` negation. New bases seed `.reqlan/.rqignore` with those defaults ( ["./module/index.rq".rqignore] ). Missing or unreadable `.rqignore` still uses built-in defaults. Location convention: [configuration_location]. Application memory: ["./module/index.rq".application_memory]. | |
| application_memory | done | Base-local application memory for reqlan tools lives under `<base>/.reqlan/`. The presence of `.reqlan` * * marks * * a directory as a ["../../bases/base.rq".base]; each base owns its own store. Shared by the VS Code extension, ["../../cli/cli_package.rq".cli_package], and MCP ( [mcp_server] ) — not VS Code `globalStorageUri` / extension-private storage. The ideas graph index ( ["../features-graph-analysers.rq".index_ideas] / ["../features-graph-analysers.rq".index_technology] ) persists as `ideas-index.sqlite` inside that directory. Index timing diagnostics persist separately as `index-diagnostics.sqlite` ( [index_diagnostics_store] / ["../features-index-diagnostics.rq".index_diagnostics] ) so rebuilds of the ideas index do not wipe history. Export form defaults ( all formats via ["../features-export.rq".export_webview], including HTML options in ["../features-html-export.rq".html_export_form] ) persist as `export_settings.json` in the same directory ( active base ). Path ignore rules live as `.rqignore` in the same directory ( [rqignore] / [configuration.configuration_rqignore] ). Path resolution is owned by [application_memory_impl] ( `resolveApplicationMemoryPath` ); consumers must use it ( or `REQLAN_INDEX_PATH` override for a single store ) so tools read and write the same store for a given base. Multi-base discovery / registry: ["../../bases/base.rq".multi_base_environment]. Index engine ownership: ["../../indexer/indexer.rq".ownership]. Extension wiring: [analytical_submodule]. Aligns with ["../../cli/cli_package.rq".function_parity]: shared analytical memory, not host-only state. | |
| rqignore | done | `.reqlan/.rqignore` filters which paths discovery and indexing crawl, using gitignore syntax relative to the base root. Owned by [rqignore_impl] in `@reqlan/analytical` so CLI and editor share behaviour. Defaults cover `node_modules/`, virtualenvs, build dirs, VCS / editor stores, database files ( `*.db3`, sqlite ), secrets, and hidden entries; new bases seed the file via create-base. Product configuration statement: [configuration.configuration_rqignore]. |
Reference labels
../../../packages/analytical/src/core/base-discovery.ts, ../../packages/analytical/src/core/base-discovery.ts, base_discovery