Commit Graph

21 Commits

Author SHA1 Message Date
alt-glitch 5008f123ae feat(workspace): FileParser ABC and MarkitdownParser 2026-04-20 03:38:32 +05:30
alt-glitch ec0fa5a2be feat(workspace): add PARSEABLE_SUFFIXES and ParsingConfig 2026-04-20 03:35:26 +05:30
alt-glitch 263c357d06 feat(workspace): add CLI commands, agent tools, and slash commands
Complete workspace CLI coverage with status, list, retrieve, delete
commands. Add 6 separate agent tools (workspace_search, workspace_index,
workspace_status, workspace_list, workspace_retrieve, workspace_delete)
with per-tool schemas and check_fn gating on workspace.enabled. Wire
/workspace slash command in interactive REPL with Rich formatting.

- workspace_search and workspace_index are default-enabled in core tools
- Full workspace toolset available for opt-in via /tools enable
- BaseIndexer ABC extended with list_files(), retrieve(), delete()
- SQLiteFTS5Store gains list_files() and get_chunks_for_file()
2026-04-20 00:55:06 +05:30
alt-glitch 4921bad61f style(workspace): remove __future__ annotations, fix ty diagnostics
- Remove `from __future__ import annotations` from all new workspace files
- Convert TYPE_CHECKING imports to real imports in base.py (no circular deps)
- Quote self-referential forward ref in config.py model_validator
- Add null checks on spec.loader in plugin discovery to satisfy ty
2026-04-18 15:58:54 +05:30
alt-glitch 4fb0c7d08d refactor(workspace): remove indexer.py and search.py, use DefaultIndexer everywhere
Delete the old workspace/indexer.py and workspace/search.py modules.
All test imports now use workspace.default.DefaultIndexer directly.
Backwards-compat re-exports removed from workspace/__init__.py.
2026-04-18 15:54:54 +05:30
alt-glitch 09c50ebb40 refactor(workspace): wire CLI through get_indexer() factory 2026-04-18 15:48:48 +05:30
alt-glitch 577e27373d feat(workspace): add DefaultIndexer class 2026-04-18 15:46:59 +05:30
alt-glitch b40075e85d refactor(workspace): migrate config to Pydantic models 2026-04-18 15:43:10 +05:30
alt-glitch 742cb556bb feat(workspace): add BaseIndexer ABC
Plugin contract for workspace backends. Implementations must define
__init__(config), index(), and search(). status() is optional.
2026-04-18 15:37:30 +05:30
alt-glitch 5d99a78fe1 lint fixes et. al 2026-04-18 14:21:38 +05:30
alt-glitch 161a3d5d61 fix(workspace): quote self-referential forward refs
Drop 'from __future__ import annotations' from store.py and use
quoted forward refs instead. Add matching quotes in config.py for
KnowledgebaseConfig.from_dict and WorkspaceConfig.from_dict — these
were raising NameError at class-definition time after an earlier
lint pass stripped the future import that had been masking them.
2026-04-18 09:40:49 +05:30
alt-glitch 7460975174 style(workspace): appease ruff (E402 import order, F821 forward ref)
- Move PipelineKind = Literal[...] below all imports in indexer.py
- Add 'from __future__ import annotations' to store.py so the
  SQLiteFTS5Store self-reference in __enter__'s return annotation
  resolves without the explicit string quote.
2026-04-18 08:22:55 +05:30
alt-glitch 07f1a364ed refactor(workspace): narrow code/plain pipeline results to Document
The MarkdownDocument narrow in _process_markdown addressed one of three
call sites. _process_code and _process_plain had the same Pyright gap —
.chunks access on Document | list[Document]. Narrow with isinstance
assert, consistent with the markdown path.
2026-04-18 08:18:37 +05:30
alt-glitch ec18a783d8 refactor(workspace): tighten types + dedupe after /simplify pass
- Narrow markdown pipeline result with isinstance assert (static type
  correctness; .code/.tables/.images access no longer leaks Document
  abstraction).
- Simplify _execute_with_lock_retry to 5 linear-backoff attempts; the
  helper was tuned for WAL schema bootstrap, not repeated retry.
- Add Literal['markdown','code','plain'] alias for pipeline keys so
  typos at the dispatch site become type errors.
- Fix misleading stage="discover" label on post-discovery errors;
  relabel as "read" where it actually applies.
- Extract _make_config / _write into tests/workspace/conftest.py
  fixtures so the two test files share one source.
- Factor str(Path(raw).resolve()) into workspace.constants.resolve_path_prefix
  and call from both search_workspace and the CLI command.
- Drop a stale WHAT-comment on the retry backoff line.
2026-04-18 08:17:39 +05:30
alt-glitch 9ed83932a8 fix(workspace): close post-migration gaps surfaced by verification
Follow-up to the chonkie Pipeline migration. Parallel black-box verification
surfaced four bugs and three minor follow-ups:

- Add PRAGMA busy_timeout via sqlite3.connect(timeout=5.0) — fixes
  concurrent index crashes exposed when _build_pipelines removed the
  lazy-init skew that previously hid the race.
- Resolve path_prefix in search_workspace (Python API entry) so it
  matches the indexer's resolved stored paths, mirroring what the CLI
  already does in commands.py.
- Hardcode .hermesignore exclusion in discovery, and add it to
  DEFAULT_IGNORE_PATTERNS belt-and-suspenders.
- Extend DiscoveryResult with filtered_count and roll it into
  files_skipped so empty/oversized files stop vanishing from summaries.
- Tighten pipelines dict type from dict[str, Any] to dict[str, Pipeline].
- Drop dead {"language": lang} branch in _process_code — CodeChunker
  language="auto" never populates the attribute.
- Tighten test_small_markdown_file_is_split_into_modalities to assert
  prose doesn't swallow the code fence.

Adds four regression tests covering each fix.
2026-04-18 08:08:10 +05:30
alt-glitch 669905e854 refactor(workspace): drop dead helpers + clean up stale test docstrings
Code-review follow-up to the chonkie Pipeline migration:
- Delete _extract_first_heading and _kind_from_suffix (only callers
  were _single_chunk, which was removed in the migration).
- Drop unused `import pytest` in test_indexer_pipeline.py (all xfail
  markers removed post-migration).
- Update test_indexer_pipeline.py docstrings to describe post-migration
  invariants rather than "current impl" behavior that no longer exists.
2026-04-18 07:41:04 +05:30
alt-glitch 77c10079c8 refactor(workspace): migrate indexer to chonkie.Pipeline
Replaces the manual MarkdownChef → chunker → OverlapRefinery wiring (and
the _ChunkerCache / _apply_overlap / _group_overlap_runs / _neural_enforce_size
layer) with three pre-built chonkie.Pipeline instances dispatched by file suffix.

- Drop 'semantic' and 'neural' chunking strategies and their model pins;
  RecursiveChunker is the only prose chunker. BM25/FTS5 doesn't benefit
  from topical coherence.
- Drop ChunkingConfig.strategy and ChunkingConfig.threshold. No legacy
  compatibility — old keys in user configs are silently ignored.
- Drop block_index / src / link / row_count / column_count metadata as not
  load-bearing for keyword search.
- Drop _single_chunk short-circuit so small files still flow through the
  Pipeline (preserves prose/code split for tiny multimodal markdown).
- Drop manual _apply_overlap; OverlapRefinery.refine_document handles prose
  chunks inside the Pipeline, populating Chunk.context directly.
- Bump CHUNKING_PLAN_VERSION from v1 to v2 so existing indexes get
  re-built cleanly on upgrade.
2026-04-18 07:36:13 +05:30
alt-glitch 026c9c9533 refactor(workspace): simplify PR — lint, rename IndexError, remove dead code
- Rename IndexError → IndexingError (shadows Python builtin)
- Use cached CodeChunker instead of per-block instantiation
- Collapse identical strategy branches in _process_plain
- Remove unused suffix param from _process_code/_process_plain
- Remove dead iter_workspace_files function
- Expose overlap property on _ChunkerCache (was accessing private _config)
- Rewrite _build_line_offsets with regex (was O(n) char loop)
- Fix duplicate --human argparse registration
- Fix LIKE %/_ semantic bug in path prefix search (use substr)
- Pre-compile FTS token regex at module level
- Use dataclasses.replace for frozen record updates
- Remove decisions.md and workspace-findings.md from PR
- ruff format + lint clean on workspace/
2026-04-18 02:41:15 +05:30
alt-glitch 066d285527 fix(workspace): harden indexing and CLI edge cases 2026-04-18 02:25:29 +05:30
alt-glitch 3db1a7e451 Harden workspace indexing and document verification 2026-04-17 23:59:43 +05:30
alt-glitch 228a23198b Add workspace FTS indexing and search 2026-04-17 07:25:11 +05:30