Skip to content

Comments

feat(repo-profile): add repo profile generation service (LISA-11)#209

Merged
TonyCasey merged 2 commits intomainfrom
lisa-11
Feb 5, 2026
Merged

feat(repo-profile): add repo profile generation service (LISA-11)#209
TonyCasey merged 2 commits intomainfrom
lisa-11

Conversation

@TonyCasey
Copy link
Owner

@TonyCasey TonyCasey commented Feb 5, 2026

Summary

  • Add RepoProfileService that generates a living markdown profile at .lisa/data/repo-profile.md from git pipeline data (triage, extraction)
  • Provides generate(), read(), and checkFreshness() for downstream integration (LISA-6 CLI, LISA-12 session hooks)
  • Freshness model: fresh (<24h), stale (1-7d), expired (>7d), missing

Changes

Domain interfaces:

  • IFileSystem - minimal file system abstraction (readFile, writeFile, stat)
  • IRepoProfileService - full service contract with profile types

Infrastructure:

  • NodeFileSystem - wraps node:fs/promises with null-safe stat

Application:

  • RepoProfileService - factory function with 8 markdown sections: overview, architecture evolution, hotspots, feature waves, decisions, gotchas, concerns, recent activity
  • Pure exported functions: renderMarkdown(), calculateFreshness()

Tests:

  • 39 unit tests covering generate, read, checkFreshness, and pure function paths

Test plan

  • npm test - 1610 tests pass (39 new)
  • npm run lint - clean
  • npm run build - compiles successfully

Closes LISA-11

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Automatic repository profile generation producing a comprehensive markdown summary (overview, architecture evolution, hotspots, feature waves, decisions, known issues, active concerns, recent activity).
    • Profile freshness indicators showing whether the profile is fresh, stale, expired, or missing.
  • Chores

    • .gitignore updated to exclude .mcp.json.
  • Tests

    • Comprehensive unit tests added for profile generation, rendering, reading, and freshness checks.

Add RepoProfileService that generates a living markdown profile at
.lisa/data/repo-profile.md from git pipeline data (triage, extraction).
Provides read + freshness checking for downstream integration.

- IFileSystem domain interface for testable file I/O
- IRepoProfileService contract with generate/read/checkFreshness
- NodeFileSystem infrastructure implementation
- RepoProfileService with 8 markdown sections (overview, hotspots,
  architecture evolution, feature waves, decisions, gotchas, concerns,
  recent activity)
- Pure exported functions: renderMarkdown, calculateFreshness
- Freshness model: fresh (<24h), stale (1-7d), expired (>7d), missing
- 39 unit tests covering all service methods and pure functions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

Adds a RepoProfileService that renders and manages a Markdown repo profile at .lisa/data/repo-profile.md, plus file-system and repo-profile domain interfaces, a Node-backed IFileSystem implementation, re-exports, and comprehensive unit tests for generation and freshness logic.

Changes

Cohort / File(s) Summary
Ignore Configuration
/.gitignore
Appended /.mcp.json to project ignore list.
Domain Interfaces
src/lib/domain/interfaces/IFileSystem.ts, src/lib/domain/interfaces/IRepoProfileService.ts, src/lib/domain/interfaces/index.ts
Added IFileSystem/IFileStat and full repo-profile contracts: freshness types, IProfileInput, generate/read results, options, and IRepoProfileService interface with generate, read, checkFreshness.
Application Service
src/lib/application/services/RepoProfileService.ts, src/lib/application/services/index.ts
New RepoProfileService: pure renderMarkdown, calculateFreshness, and createRepoProfileService factory; assembles 8-section Markdown, writes/reads profile, computes freshness; exports added.
Infrastructure Implementation
src/lib/infrastructure/services/NodeFileSystem.ts, src/lib/infrastructure/services/index.ts
Added createNodeFileSystem() implementing IFileSystem using Node fs/promises with mkdir recursion, UTF-8 read/write, and ENOENT-safe stat; exported from services index.
Unit Tests
tests/unit/src/lib/application/services/RepoProfileService.test.ts
Comprehensive tests covering markdown rendering, section population, truncation limits, PR/Issue refs, generate/read flows, and freshness calculations (fresh/stale/expired/missing).

Sequence Diagram

sequenceDiagram
    participant Caller
    participant RepoProfileService
    participant FileSystem
    participant Renderer

    Caller->>RepoProfileService: generate(input, options)
    RepoProfileService->>Renderer: renderMarkdown(input, options)
    Renderer-->>RepoProfileService: markdown, sectionsPopulated
    RepoProfileService->>FileSystem: writeFile(profilePath, markdown)
    FileSystem-->>RepoProfileService: ok
    RepoProfileService-->>Caller: IProfileGenerateResult

    Caller->>RepoProfileService: read(projectRoot)
    RepoProfileService->>FileSystem: readFile(profilePath)
    FileSystem-->>RepoProfileService: markdown | throws
    RepoProfileService->>FileSystem: stat(profilePath)
    FileSystem-->>RepoProfileService: IFileStat | null
    RepoProfileService->>RepoProfileService: calculateFreshness(mtime)
    RepoProfileService-->>Caller: IProfileReadResult
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 68.42% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the primary change: introduction of a repo profile generation service with the associated issue reference.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch lisa-11

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot added the nate Nate Plan: Memory improvement features label Feb 5, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @.gitignore:
- Line 49: The .gitignore entry ".mcp.json" is ambiguous; update the .gitignore
by replacing the bare pattern with a clarified entry and comment: if .mcp.json
only lives at the repo root, change the pattern to "/.mcp.json" and add a short
comment explaining what MCP/.mcp.json is and why it must be ignored, otherwise
keep ".mcp.json" but prepend a comment line that documents the file's purpose
and scope (e.g., that all .mcp.json files in subdirectories should be ignored).

In `@src/lib/infrastructure/services/NodeFileSystem.ts`:
- Around line 26-31: The stat() method in NodeFileSystem currently swallows all
errors and returns null; change it to return null only when the filesystem error
is "file not found" and rethrow all other errors. In the async
NodeFileSystem.stat(filePath: string) implementation, catch the thrown error
from fsp.stat, inspect the error (as an ErrnoException) and if err.code ===
'ENOENT' return null, otherwise throw the original error so permission/IO issues
bubble up to callers.

Address CodeRabbit review feedback:
- .gitignore: scope /.mcp.json to repo root with explanatory comment
- NodeFileSystem.stat(): only return null for ENOENT, rethrow other
  filesystem errors (permissions, IO) to prevent misclassifying
  inaccessible profiles as missing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@TonyCasey TonyCasey merged commit 2783f7c into main Feb 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nate Nate Plan: Memory improvement features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant