refactor: consolidate packages - move output to cmd, config/session to store, rename Store to GraphStore
This commit is contained in:
13
CLAUDE.md
13
CLAUDE.md
@@ -16,10 +16,10 @@ go test -run TestName . # Run a single test by name
|
||||
|
||||
## Architecture
|
||||
|
||||
The codebase has four distinct layers:
|
||||
The codebase has three distinct layers:
|
||||
|
||||
### 1. `cmd/` — CLI layer (Cobra)
|
||||
Parses flags into typed input structs and calls the service layer. `root.go` handles alias expansion (including `$me`, `$@`, `$1`-`$N` variable substitution) and wires up the `NodeService`.
|
||||
Parses flags into typed input structs and calls the service layer. `root.go` handles alias expansion (including `$me`, `$@`, `$1`-`$N` variable substitution) and wires up the `NodeService`. Also contains `output.go` for colored terminal output and JSON serialization.
|
||||
|
||||
### 2. `service/` — Business logic
|
||||
`NodeService` is the central interface (`service/node_service.go`). The implementation (`node_service_impl.go`) enforces:
|
||||
@@ -29,11 +29,8 @@ Parses flags into typed input structs and calls the service layer. `root.go` han
|
||||
- Single-value relation enforcement (`assignee`, `in_namespace`)
|
||||
- Auto-creation of referenced user/namespace nodes
|
||||
|
||||
### 3. `store/` — Persistence
|
||||
`Store` interface wraps SQLite with graph primitives: nodes, tags, and typed directed edges. Schema is 3 tables (`nodes`, `tags`, `rels`). All multi-step ops use `store.Transaction()`.
|
||||
|
||||
### 4. `output/` — Presentation
|
||||
Handles both colored terminal output and JSON serialization. Applies sort order: open → due → done, high → medium → low priority.
|
||||
### 3. `store/` — Persistence and configuration
|
||||
`GraphStore` interface wraps SQLite with graph primitives: nodes, tags, and typed directed edges. Schema is 3 tables (`nodes`, `tags`, `rels`). All multi-step ops use `store.Transaction()`. Also contains `Config` for user settings, aliases, and session management.
|
||||
|
||||
## Core Data Model
|
||||
|
||||
@@ -47,4 +44,4 @@ Handles both colored terminal output and JSON serialization. Applies sort order:
|
||||
|
||||
## Config
|
||||
|
||||
The CLI searches upward from CWD for `.axconfig` (like git), falling back to `~/.config/ax/config.json`. The `AX_USER` env var overrides the configured username. The database file `.ax.db` is similarly discovered by walking upward.
|
||||
The CLI searches upward from CWD for an `.ax` directory (like git), falling back to `~/.config/ax/` for config and `~/.local/share/ax/` for data. The `AX_USER` env var overrides the configured username. The database file `ax.db` is similarly discovered by walking upward.
|
||||
|
||||
Reference in New Issue
Block a user