Implement index new project indexing and atomic publication #8

Closed
opened 2026-09-03 14:22:17 +00:00 by JayKobe6k · 0 comments
Owner

Goal

Create a complete LadybugDB index for a local C project or Git origin and register it in the user index catalog.

Command contract

claritree index new <source> [project/build options]

<source> accepts a local directory or Git origin. Project/build options provide everything needed to locate or generate the compilation database and invoke libclang with the correct working directories and arguments. The resulting database is stored under the standard user cache location unless an explicit destination is provided.

Behavior

  • Resolve/acquire the source and build a deterministic compilation plan.
  • Reject catalog/name collisions unless an explicit replacement policy is selected.
  • Index every planned translation unit, remap parser-local IDs, canonicalize shared symbols/source files, preserve TU provenance, and aggregate diagnostics.
  • Run semantic lineage analysis and persist both source and lineage facts.
  • Build in a staging revision/database and atomically publish only after validation succeeds.
  • Remove failed staging data and never expose a partial index.
  • Return a typed summary containing index identity/name/path, source identity/revision, translation-unit and fact counts, diagnostics, and elapsed status suitable for text and JSON rendering.

Acceptance criteria

  • Application tests use fake source, parser, analysis, and repository ports.
  • LadybugDB integration tests index a multi-TU fixture and reopen the database.
  • CLI tests cover a local project, local Git origin fixture, invalid source, missing build information, collision, parser failure, and JSON/text output.
  • Successful output includes a selector/handle that can be passed directly to query --index.
  • No indexing/domain logic or direct database access is implemented in the CLI handler.

Dependencies

Depends on #2, #3, #4, #5, #6, #7, and #11.

## Goal Create a complete LadybugDB index for a local C project or Git origin and register it in the user index catalog. ## Command contract ```text claritree index new <source> [project/build options] ``` `<source>` accepts a local directory or Git origin. Project/build options provide everything needed to locate or generate the compilation database and invoke libclang with the correct working directories and arguments. The resulting database is stored under the standard user cache location unless an explicit destination is provided. ## Behavior - Resolve/acquire the source and build a deterministic compilation plan. - Reject catalog/name collisions unless an explicit replacement policy is selected. - Index every planned translation unit, remap parser-local IDs, canonicalize shared symbols/source files, preserve TU provenance, and aggregate diagnostics. - Run semantic lineage analysis and persist both source and lineage facts. - Build in a staging revision/database and atomically publish only after validation succeeds. - Remove failed staging data and never expose a partial index. - Return a typed summary containing index identity/name/path, source identity/revision, translation-unit and fact counts, diagnostics, and elapsed status suitable for text and JSON rendering. ## Acceptance criteria - Application tests use fake source, parser, analysis, and repository ports. - LadybugDB integration tests index a multi-TU fixture and reopen the database. - CLI tests cover a local project, local Git origin fixture, invalid source, missing build information, collision, parser failure, and JSON/text output. - Successful output includes a selector/handle that can be passed directly to `query --index`. - No indexing/domain logic or direct database access is implemented in the CLI handler. ## Dependencies Depends on #2, #3, #4, #5, #6, #7, and #11.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
JayKobe6k/ClariTree#8
No description provided.