Commit graph

9 commits

Author SHA1 Message Date
sahalterion
1cc6888e19 test(group,cli): cover depth traversal, repoPaths, and CLI commands
Integration:
- group-graph.test.ts: chain apps/web -> libs/shared -> libs/deep
  exercises findConnections recursion at depth 1/2/5, plus A -> B -> A
  cycle guard via the visited set.
- auto-discover.test.ts: explicit repoPaths mode (happy path, unindexed-
  path error, basename fallback when resolveRepo throws).

Unit:
- cli-group.test.ts: 25 tests mocking LocalBackend/storage/sync across
  create, auto-discover, repos, add, remove, list, status, sync, graph,
  query, contracts.
- cli-status.test.ts: 6 tests covering git-repo guard, stale-Kuzu prompt,
  up-to-date vs stale report.
- cli-tool.test.ts: 16 tests covering query/context/impact/cypher arg
  validation, optional-param branches, backend-init failure, EPIPE/EACCES
  fallbacks in output().

Coverage delta vs main: +1.33% statements, +0.77% branches, +1.22%
functions, +1.46% lines — clears the +0.5% review bar on all metrics.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 06:50:16 -07:00
sahalterion
b893a06780 feat(web): group-view URL persistence and symmetric mode-switch UX
Also: atomic ~/.gitnexus/registry.json write (macOS APFS race fix), per-test GITNEXUS_HOME isolation, and simplifier dead-code cleanup.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 06:50:16 -07:00
sahalterion
17294656b0 feat(group): support explicit --repos paths in auto-discover
Add --repos flag to `group auto-discover` so users can pass explicit
repo paths instead of scanning a directory:

  gitnexus group auto-discover --repos /path/to/repo1 /path/to/repo2

Also removes unused buildPackageMap() and findSiblingDependencies()
functions, and cleans up redundant inline comments across extractors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-28 06:46:54 -07:00
sahalterion
b59493932d feat(group): add cross-repo graph traversal CLI and MCP tool
Add `gitnexus group graph <name> <symbol>` command and `group_graph`
MCP tool that traverses CrossLinks to find how a symbol connects to
other repos in a group. Returns local context plus remote connections
with their contract metadata.

Searches all repos in the group when --repo is not specified. Supports
--depth (max 2) and --direction (upstream/downstream/both) options.

Includes 6 integration tests with mock GroupToolPort.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-28 06:46:30 -07:00
sahalterion
03e0abf022 feat(group): add auto-discover CLI command and MCP tool
Add `gitnexus group auto-discover [directory]` that scans a parent
directory for indexed repos, reads their package manifests, builds
package mappings, and creates a group with code-level dependency
detection enabled.

Also adds `group_discover` MCP tool for programmatic access and
`groupDiscover()` method on GroupService.

Includes 5 integration tests covering discovery, error handling,
and non-indexed directory filtering.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-28 06:42:05 -07:00
sahalterion
05636bf681 feat(group): add code-level dependency detection between repos
Add CodeDepExtractor that detects when repo B imports symbols from
repo A's npm package. Wires into the existing group sync pipeline
using the already-declared `lib` contract type and `shared_libs`
detection flag.

New files:
- manifest-reader.ts: reads package.json for name + dependencies
- import-scanner.ts: scans source for ES/CJS imports matching sibling packages
- code-dep-extractor.ts: ContractExtractor producing lib::{pkg}::{symbol} contracts

Auto-discovers package mappings when config.packages is empty by reading
each repo's package.json name and checking cross-dependencies.

Includes 58 unit tests and 3 integration tests covering all extraction
paths, edge cases, and the full sync → match → CrossLink pipeline.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-28 06:27:17 -07:00
ivkond
00966630c4
feat: cross-repo impact analysis (#794) — @repo MCP routing + group resources (#984) 2026-04-20 11:55:07 +01:00
ivkond
255e3e79eb fix(group): address 4 HIGH-priority issues from PR #626 review
1. Path traversal via group name — add validateGroupName() with regex
   [a-zA-Z0-9][a-zA-Z0-9_-]*, called in getGroupDir (defense in depth)

2. gRPC proto regex can't handle nested braces — replace serviceRe with
   extractServiceBlocks() brace-depth counter (init depth=1, skip
   malformed protos)

3. Service boundary detector directory exclusions — add EXCLUDED_DIRS
   set (vendor, target, build, dist, __pycache__, .venv, venv, .tox,
   .mypy_cache, .gradle, .mvn, out, bin) replacing inline node_modules

4. Double-close of LadybugDB pools — remove blanket closeLbug() from
   cli/group.ts; sync.ts per-id cleanup is sufficient

Tests: 22 new tests across 5 files. Full suite: 4706 passed, 0 failed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 12:55:33 +03:00
ivkond
4fed097abb feat(group): add sync pipeline, CLI, MCP tools, and monorepo fixture
Wire extractors into the sync pipeline with service boundary detection.
GroupService provides high-level API for all group operations.

- Sync pipeline: orchestrates extraction (HTTP, gRPC, topics) with
  service boundary assignment and exact matching
- GroupService: groupList, groupSync, groupContracts, groupQuery,
  groupStatus (groupImpact deferred to cross-repo follow-up PR)
- CLI: group create/add/remove/list/sync/contracts/query/status
- MCP tools: group_list, group_sync, group_contracts, group_query,
  group_status
- Monorepo fixture: 3 services (auth/orders/gateway) connected via
  gRPC + Kafka + HTTP — all intra-repo cross-links discovered
- Documentation: CLI commands and MCP tools added to both READMEs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 00:40:31 +03:00