mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-25 08:48:08 +02:00
fix(cli): isolate ktx-owned project repositories (#283)
* fix(cli): isolate ktx project git repos * fix(cli): remove inert auto commit config * test(cli): drop stale auto commit fixtures * docs: document isolated ktx project repos * test(cli): keep stale config grep clean * fix(cli): guide setup away from foreign repos at the project dir ktx owns the git repo rooted at the project dir and refuses to adopt one it did not create (the Finding 3 isolation invariant). But setup steered users straight into that failure: the interactive menu offers "Current directory" first, and `--no-input --yes --project-dir <repo-root>` created directly in place — both then threw a generic "Failed to initialize git repository:" wrapper from deep in GitService.initialize(). Extract the ownership rule into a shared `classifyKtxRepoOwnership(dir)` used by both GitService.initialize() (the invariant) and the setup wizard (pre-flight guidance), so the decision derives from one rule. Setup now detects a foreign repo before constructing GitService and: interactively re-prompts (the user picks the existing `ktx-project` subfolder), or non-interactively returns a clean missing-input with the actionable message. The typed foreign-repo error is also surfaced verbatim instead of being buried under the generic wrapper. Empty/non-repo current directories still work — only foreign repos are blocked. * fix(cli): keep classifyKtxRepoOwnership total for non-directory paths The setup ownership guard runs before the existing not-a-directory check, so pointing a custom/--project-dir path at a file made classifyKtxRepoOwnership lstat `<file>/.git`, hit ENOTDIR, and throw — crashing the setup step instead of returning the friendly "path exists and is not a directory" result. A path that is a file (or missing) holds no git repo for ktx to avoid, so treat ENOTDIR like ENOENT and return 'unowned'. The downstream existingFolderState check still rejects a non-directory with its friendly message, and the classifier no longer throws raw errno for any caller.
This commit is contained in:
parent
f3f893bf01
commit
2877b85adc
20 changed files with 412 additions and 78 deletions
|
|
@ -344,15 +344,14 @@ setup:
|
|||
|
||||
## `storage`
|
||||
|
||||
`storage` controls where **ktx** keeps its own state and search index, and how
|
||||
state changes are committed. Defaults work for a single-user local project.
|
||||
`storage` controls where **ktx** keeps its own state and search index. Defaults
|
||||
work for a single-user local project.
|
||||
|
||||
```yaml
|
||||
storage:
|
||||
state: sqlite # sqlite | postgres
|
||||
search: sqlite-fts5 # sqlite-fts5 | postgres-hybrid
|
||||
git:
|
||||
auto_commit: true
|
||||
author: "ktx <ktx@example.com>"
|
||||
```
|
||||
|
||||
|
|
@ -360,8 +359,7 @@ storage:
|
|||
|-------|------|---------|---------|
|
||||
| `state` | `sqlite` \| `postgres` | `sqlite` | Backend for ktx state. `sqlite` uses `.ktx/db.sqlite`; `postgres` expects a configured Postgres connection. |
|
||||
| `search` | `sqlite-fts5` \| `postgres-hybrid` | `sqlite-fts5` | Backend for search indexes. `postgres-hybrid` combines lexical and vector search in Postgres. |
|
||||
| `git.auto_commit` | `boolean` | `true` | When `true`, ktx auto-commits changes to the git-backed state store. |
|
||||
| `git.author` | `string` | `ktx <ktx@example.com>` | Git author identity for auto-commits. Standard `Name <email>` form. |
|
||||
| `git.author` | `string` | `ktx <ktx@example.com>` | Git author identity for commits. Standard `Name <email>` form. |
|
||||
|
||||
## `llm`
|
||||
|
||||
|
|
@ -608,19 +606,6 @@ agent:
|
|||
| `run_research.max_iterations` | `int ≥ 0` | `20` | Maximum tool-call iterations per research run. |
|
||||
| `run_research.default_toolset` | `string[]` | `[sl_query, wiki_search, sl_read_source]` | Tool identifiers exposed to the research agent. |
|
||||
|
||||
## `memory`
|
||||
|
||||
`memory` controls the agent memory subsystem.
|
||||
|
||||
```yaml
|
||||
memory:
|
||||
auto_commit: true
|
||||
```
|
||||
|
||||
| Field | Type | Default | Purpose |
|
||||
|-------|------|---------|---------|
|
||||
| `auto_commit` | `boolean` | `true` | When `true`, ktx auto-commits memory updates to the git-backed store. |
|
||||
|
||||
## A full example
|
||||
|
||||
Combining the blocks above:
|
||||
|
|
@ -645,7 +630,6 @@ storage:
|
|||
state: sqlite
|
||||
search: sqlite-fts5
|
||||
git:
|
||||
auto_commit: true
|
||||
author: "ktx <ktx@example.com>"
|
||||
llm:
|
||||
provider:
|
||||
|
|
@ -678,8 +662,6 @@ scan:
|
|||
agent:
|
||||
run_research:
|
||||
enabled: true
|
||||
memory:
|
||||
auto_commit: true
|
||||
```
|
||||
|
||||
## Validating your config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue