openreport 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +117 -0
  3. package/bin/openreport.ts +6 -0
  4. package/package.json +61 -0
  5. package/src/agents/api-documentation.ts +66 -0
  6. package/src/agents/architecture-analyst.ts +46 -0
  7. package/src/agents/code-quality-reviewer.ts +59 -0
  8. package/src/agents/dependency-analyzer.ts +51 -0
  9. package/src/agents/onboarding-guide.ts +59 -0
  10. package/src/agents/orchestrator.ts +41 -0
  11. package/src/agents/performance-analyzer.ts +57 -0
  12. package/src/agents/registry.ts +50 -0
  13. package/src/agents/security-auditor.ts +61 -0
  14. package/src/agents/test-coverage-analyst.ts +58 -0
  15. package/src/agents/todo-generator.ts +50 -0
  16. package/src/app/App.tsx +151 -0
  17. package/src/app/theme.ts +54 -0
  18. package/src/cli.ts +145 -0
  19. package/src/commands/init.ts +81 -0
  20. package/src/commands/interactive.tsx +29 -0
  21. package/src/commands/list.ts +53 -0
  22. package/src/commands/run.ts +168 -0
  23. package/src/commands/view.tsx +52 -0
  24. package/src/components/generation/AgentStatusItem.tsx +125 -0
  25. package/src/components/generation/AgentStatusList.tsx +70 -0
  26. package/src/components/generation/ProgressSummary.tsx +107 -0
  27. package/src/components/generation/StreamingOutput.tsx +154 -0
  28. package/src/components/layout/Container.tsx +24 -0
  29. package/src/components/layout/Footer.tsx +52 -0
  30. package/src/components/layout/Header.tsx +50 -0
  31. package/src/components/report/MarkdownRenderer.tsx +50 -0
  32. package/src/components/report/ReportCard.tsx +31 -0
  33. package/src/components/report/ScrollableView.tsx +164 -0
  34. package/src/config/cli-detection.ts +130 -0
  35. package/src/config/cli-model.ts +397 -0
  36. package/src/config/cli-prompt-formatter.ts +129 -0
  37. package/src/config/defaults.ts +79 -0
  38. package/src/config/loader.ts +168 -0
  39. package/src/config/ollama.ts +48 -0
  40. package/src/config/providers.ts +199 -0
  41. package/src/config/resolve-provider.ts +62 -0
  42. package/src/config/saver.ts +50 -0
  43. package/src/config/schema.ts +51 -0
  44. package/src/errors.ts +34 -0
  45. package/src/hooks/useReportGeneration.ts +199 -0
  46. package/src/hooks/useTerminalSize.ts +35 -0
  47. package/src/ingestion/context-selector.ts +247 -0
  48. package/src/ingestion/file-tree.ts +227 -0
  49. package/src/ingestion/token-budget.ts +52 -0
  50. package/src/pipeline/agent-runner.ts +360 -0
  51. package/src/pipeline/combiner.ts +199 -0
  52. package/src/pipeline/context.ts +108 -0
  53. package/src/pipeline/extraction.ts +153 -0
  54. package/src/pipeline/progress.ts +192 -0
  55. package/src/pipeline/runner.ts +526 -0
  56. package/src/report/html-renderer.ts +294 -0
  57. package/src/report/html-script.ts +123 -0
  58. package/src/report/html-styles.ts +1127 -0
  59. package/src/report/md-to-html.ts +153 -0
  60. package/src/report/open-browser.ts +22 -0
  61. package/src/schemas/findings.ts +48 -0
  62. package/src/schemas/report.ts +64 -0
  63. package/src/screens/ConfigScreen.tsx +271 -0
  64. package/src/screens/GenerationScreen.tsx +278 -0
  65. package/src/screens/HistoryScreen.tsx +108 -0
  66. package/src/screens/HomeScreen.tsx +143 -0
  67. package/src/screens/ViewerScreen.tsx +82 -0
  68. package/src/storage/metadata.ts +69 -0
  69. package/src/storage/report-store.ts +128 -0
  70. package/src/tools/get-file-tree.ts +157 -0
  71. package/src/tools/get-git-info.ts +123 -0
  72. package/src/tools/glob.ts +48 -0
  73. package/src/tools/grep.ts +149 -0
  74. package/src/tools/index.ts +30 -0
  75. package/src/tools/list-directory.ts +57 -0
  76. package/src/tools/read-file.ts +52 -0
  77. package/src/tools/read-package-json.ts +48 -0
  78. package/src/tools/run-command.ts +154 -0
  79. package/src/tools/shared-ignore.ts +58 -0
  80. package/src/types/index.ts +127 -0
  81. package/src/types/marked-terminal.d.ts +17 -0
  82. package/src/utils/debug.ts +25 -0
  83. package/src/utils/file-utils.ts +77 -0
  84. package/src/utils/format.ts +56 -0
  85. package/src/utils/grade-colors.ts +43 -0
  86. package/src/utils/project-detector.ts +296 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 timiliris
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # OpenReport
2
+
3
+ **AI-powered code analysis reports for your projects.**
4
+
5
+ OpenReport is a modern CLI/TUI tool that orchestrates multiple AI agents to generate comprehensive, structured reports about your codebase. Get architecture reviews, security audits, code quality assessments, and more — all from your terminal.
6
+
7
+ [![npm version](https://img.shields.io/npm/v/openreport)](https://www.npmjs.com/package/openreport)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
9
+ [![Bun](https://img.shields.io/badge/runtime-Bun-f472b6)](https://bun.sh)
10
+
11
+ ## Features
12
+
13
+ - **Multi-agent AI analysis** — Specialized agents work in parallel to analyze different aspects of your project
14
+ - **8 analysis agents** — Architecture, security, code quality, dependencies, performance, test coverage, API docs, onboarding
15
+ - **Interactive TUI** — Navigate reports, configure settings, and manage history from a beautiful terminal UI
16
+ - **HTML reports** — Export reports as styled HTML pages you can share with your team
17
+ - **Todo list generation** — Automatically generate actionable todo lists from findings
18
+ - **Multi-provider support** — Use any AI provider: Anthropic, OpenAI, Google, Mistral, Ollama, or CLI tools like Claude Code, Gemini CLI, Codex CLI
19
+
20
+ ## Quick Start
21
+
22
+ ```bash
23
+ # Install globally
24
+ bun add -g openreport
25
+
26
+ # Initialize configuration
27
+ openreport init
28
+
29
+ # Launch the interactive TUI
30
+ openreport
31
+
32
+ # Or run a report directly
33
+ openreport run
34
+ ```
35
+
36
+ ## Report Types
37
+
38
+ | Report Type | Agents | Description |
39
+ |---|---|---|
40
+ | **Full Audit** | architecture, security, code-quality, dependencies, performance, test-coverage | Comprehensive analysis covering all aspects |
41
+ | **Quick Health** | code-quality, dependencies | Fast overview of code quality and dependencies |
42
+ | **Security Review** | security, dependencies | Focused security audit |
43
+ | **Architecture** | architecture | Architecture analysis with diagrams and patterns |
44
+ | **Dependencies** | dependencies | Dependency health, vulnerabilities, and licenses |
45
+ | **Onboarding** | onboarding, architecture | New developer onboarding guide |
46
+
47
+ Additional agents available: **API Documentation**, **Todo Generator**.
48
+
49
+ ## Providers
50
+
51
+ ### API Providers
52
+
53
+ | Provider | Default Model | Env Variable |
54
+ |---|---|---|
55
+ | Anthropic | `claude-sonnet-4-5-20250929` | `ANTHROPIC_API_KEY` |
56
+ | OpenAI | `gpt-4o` | `OPENAI_API_KEY` |
57
+ | Google | `gemini-2.0-flash` | `GOOGLE_GENERATIVE_AI_API_KEY` |
58
+ | Mistral | `mistral-large-latest` | `MISTRAL_API_KEY` |
59
+ | Ollama | `qwen2.5-coder:14b` | Local (no key needed) |
60
+
61
+ ### CLI Providers
62
+
63
+ | Provider | CLI Tool | Description |
64
+ |---|---|---|
65
+ | `claude-code` | `claude` | Uses Claude Code CLI (default provider) |
66
+ | `gemini-cli` | `gemini` | Uses Gemini CLI |
67
+ | `codex-cli` | `codex` | Uses Codex CLI |
68
+
69
+ CLI providers are auto-detected and wrap existing CLI tools via subprocess.
70
+
71
+ ## Configuration
72
+
73
+ OpenReport uses a `.openreport.json` file in your project root. Run `openreport init` to create one, or create it manually:
74
+
75
+ ```json
76
+ {
77
+ "defaultProvider": "claude-code",
78
+ "defaultModel": "sonnet",
79
+ "providers": {
80
+ "anthropic": { "apiKey": "sk-..." }
81
+ },
82
+ "output": {
83
+ "directory": ".openreport/reports",
84
+ "format": "markdown"
85
+ },
86
+ "agents": {
87
+ "maxConcurrency": 3,
88
+ "temperature": 0.3
89
+ },
90
+ "features": {
91
+ "todoList": false
92
+ }
93
+ }
94
+ ```
95
+
96
+ ## CLI Commands
97
+
98
+ | Command | Description |
99
+ |---|---|
100
+ | `openreport` | Launch the interactive TUI |
101
+ | `openreport run` | Run a report directly (non-interactive) |
102
+ | `openreport init` | Initialize configuration in the current project |
103
+ | `openreport list` | List previously generated reports |
104
+ | `openreport view <id>` | View a specific report |
105
+
106
+ ## Requirements
107
+
108
+ - [Bun](https://bun.sh) >= 1.0
109
+ - At least one AI provider configured (API key or CLI tool installed)
110
+
111
+ ## Contributing
112
+
113
+ Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
114
+
115
+ ## License
116
+
117
+ [MIT](LICENSE) — Copyright (c) 2025 timiliris
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bun
2
+
3
+ import { createCli } from "../src/cli.js";
4
+
5
+ const cli = createCli();
6
+ cli.runExit(process.argv.slice(2));
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "openreport",
3
+ "version": "0.1.0",
4
+ "packageManager": "bun@1.3.9",
5
+ "description": "A modern TUI to generate detailed AI-powered reports on software projects",
6
+ "type": "module",
7
+ "bin": {
8
+ "openreport": "./bin/openreport.ts"
9
+ },
10
+ "scripts": {
11
+ "start": "bun run bin/openreport.ts",
12
+ "typecheck": "tsc --noEmit",
13
+ "lint": "biome check src/",
14
+ "test": "bun test --coverage",
15
+ "check": "bun run typecheck && bun run lint && bun run test",
16
+ "dev": "bun run --watch bin/openreport.ts"
17
+ },
18
+ "keywords": ["cli", "tui", "ai", "report", "code-analysis", "ink", "bun", "openreport", "code-review", "security-audit", "multi-agent"],
19
+ "license": "MIT",
20
+ "author": "timiliris",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/timiliris/OpenReport.git"
24
+ },
25
+ "homepage": "https://github.com/timiliris/OpenReport#readme",
26
+ "bugs": {
27
+ "url": "https://github.com/timiliris/OpenReport/issues"
28
+ },
29
+ "engines": {
30
+ "bun": ">=1.0.0"
31
+ },
32
+ "files": [
33
+ "bin/",
34
+ "src/",
35
+ "package.json",
36
+ "README.md",
37
+ "LICENSE"
38
+ ],
39
+ "dependencies": {
40
+ "@ai-sdk/anthropic": "^1.2.0",
41
+ "@ai-sdk/google": "^1.2.0",
42
+ "@ai-sdk/mistral": "^1.2.0",
43
+ "@ai-sdk/openai": "^1.3.0",
44
+ "ai": "^4.3.0",
45
+ "chalk": "^5.4.0",
46
+ "clipanion": "^3.2.0",
47
+ "ignore": "^7.0.0",
48
+ "ink": "^5.1.0",
49
+ "ink-spinner": "^5.0.0",
50
+ "marked": "^15.0.0",
51
+ "marked-terminal": "^7.3.0",
52
+ "react": "^18.3.1",
53
+ "zod": "^3.24.0"
54
+ },
55
+ "devDependencies": {
56
+ "@biomejs/biome": "^2.3.15",
57
+ "@types/bun": "^1.3.9",
58
+ "@types/react": "^18.3.0",
59
+ "typescript": "^5.7.0"
60
+ }
61
+ }
@@ -0,0 +1,66 @@
1
+ import type { AgentDefinition } from "../types/index.js";
2
+
3
+ export const apiDocumentation: AgentDefinition = {
4
+ id: "api-documentation",
5
+ name: "API Documentation",
6
+ description:
7
+ "Documents API endpoints, schemas, authentication requirements, error handling patterns, and generates API reference.",
8
+ maxSteps: 15,
9
+ toolSet: "base",
10
+ relevantFor: (classification) =>
11
+ classification.projectType === "api" ||
12
+ classification.projectType === "web-app",
13
+
14
+ systemPrompt: `You are an expert API technical writer documenting the API surface of a project.
15
+
16
+ 1. **Endpoint Discovery**
17
+ - Find all API routes/endpoints
18
+ - Map HTTP methods and paths
19
+ - Identify route parameters and query parameters
20
+ - Document request body schemas
21
+
22
+ 2. **Authentication & Authorization**
23
+ - Authentication method (Bearer, API Key, OAuth, etc.)
24
+ - Authorization levels per endpoint
25
+ - Required headers
26
+
27
+ 3. **Request/Response Schemas**
28
+ - Request body structure and validation
29
+ - Response body structure
30
+ - Status codes used
31
+ - Content types
32
+
33
+ 4. **Error Handling**
34
+ - Error response format
35
+ - Common error codes and their meaning
36
+ - Validation error patterns
37
+ - Rate limiting headers
38
+
39
+ 5. **API Patterns**
40
+ - RESTful compliance
41
+ - Pagination approach
42
+ - Filtering and sorting
43
+ - Versioning strategy
44
+
45
+ 6. **Documentation Quality**
46
+ - Existing OpenAPI/Swagger specs
47
+ - Inline documentation
48
+ - Code examples
49
+ - Missing documentation
50
+
51
+ ## Output Format
52
+ For each endpoint, document:
53
+ - Method + Path
54
+ - Description
55
+ - Authentication requirements
56
+ - Parameters (path, query, body)
57
+ - Response format
58
+ - Error responses
59
+
60
+ ## Methodology
61
+ - Search for route definitions (express, fastify, next.js API routes, etc.)
62
+ - Read route handlers to understand request/response
63
+ - Check for validation middleware
64
+ - Look for OpenAPI or Swagger definitions
65
+ - Review error handling middleware`,
66
+ };
@@ -0,0 +1,46 @@
1
+ import type { AgentDefinition } from "../types/index.js";
2
+
3
+ export const architectureAnalyst: AgentDefinition = {
4
+ id: "architecture-analyst",
5
+ name: "Architecture Analyst",
6
+ description:
7
+ "Analyzes project structure, module organization, design patterns, data flow, and generates architecture diagrams.",
8
+ maxSteps: 15,
9
+ toolSet: "base",
10
+ relevantFor: () => true, // Always relevant
11
+
12
+ systemPrompt: `You are an expert software architect analyzing a codebase. Your role is to:
13
+
14
+ 1. **Project Structure Analysis**
15
+ - Map the overall directory structure and module organization
16
+ - Identify the architectural pattern (MVC, Clean Architecture, Hexagonal, Monolith, Microservices, etc.)
17
+ - Assess separation of concerns
18
+
19
+ 2. **Module & Dependency Mapping**
20
+ - Identify core modules and their responsibilities
21
+ - Map internal dependencies between modules
22
+ - Identify circular dependencies or tight coupling
23
+
24
+ 3. **Design Patterns**
25
+ - Identify design patterns in use (Singleton, Factory, Observer, Repository, etc.)
26
+ - Evaluate their appropriateness
27
+ - Suggest missing patterns that could improve the codebase
28
+
29
+ 4. **Data Flow**
30
+ - Trace the flow of data through the application
31
+ - Identify data transformation points
32
+ - Document state management approach
33
+
34
+ 5. **Diagrams**
35
+ - Generate Mermaid diagrams for architecture overview
36
+ - Create component dependency graphs
37
+
38
+ ## Output Format
39
+ Produce a structured analysis with clear sections and actionable findings. Each finding should have a severity (critical, warning, info, suggestion), description, and recommendation.
40
+
41
+ ## Methodology
42
+ - Start by reading the file tree and config files
43
+ - Identify entry points and trace the application flow
44
+ - Read key source files to understand patterns
45
+ - Focus on structure, not implementation details`,
46
+ };
@@ -0,0 +1,59 @@
1
+ import type { AgentDefinition } from "../types/index.js";
2
+
3
+ export const codeQualityReviewer: AgentDefinition = {
4
+ id: "code-quality-reviewer",
5
+ name: "Code Quality Reviewer",
6
+ description:
7
+ "Reviews code quality including consistency, complexity, duplication, dead code, and SOLID principles adherence.",
8
+ maxSteps: 15,
9
+ toolSet: "extended",
10
+ relevantFor: () => true,
11
+
12
+ systemPrompt: `You are an expert code quality reviewer. Your role is to analyze the codebase for quality issues and improvement opportunities.
13
+
14
+ 1. **Code Consistency**
15
+ - Naming conventions (variables, functions, files)
16
+ - Formatting consistency
17
+ - Import organization
18
+ - Comment style and quality
19
+
20
+ 2. **Complexity Analysis**
21
+ - Overly complex functions (high cyclomatic complexity)
22
+ - Deep nesting levels
23
+ - Long functions or files
24
+ - Complex conditional logic
25
+
26
+ 3. **Code Duplication**
27
+ - Identify duplicated logic across files
28
+ - Copy-paste code patterns
29
+ - Opportunities for shared utilities or abstractions
30
+
31
+ 4. **Dead Code**
32
+ - Unused exports, functions, or variables
33
+ - Commented-out code blocks
34
+ - Unreachable code paths
35
+
36
+ 5. **SOLID Principles**
37
+ - Single Responsibility violations
38
+ - Open/Closed principle adherence
39
+ - Dependency inversion usage
40
+ - Interface segregation
41
+
42
+ 6. **Error Handling**
43
+ - Proper error handling patterns
44
+ - Unhandled promise rejections
45
+ - Generic catch blocks
46
+ - Error propagation strategy
47
+
48
+ 7. **Type Safety** (for TypeScript projects)
49
+ - Usage of \`any\` type
50
+ - Proper type narrowing
51
+ - Missing type annotations
52
+ - Type assertion overuse
53
+
54
+ ## Methodology
55
+ - Start with linter/formatter config to understand project standards
56
+ - Read source files, focusing on business logic
57
+ - Look for patterns across multiple files
58
+ - Use grep to find common anti-patterns (any, TODO, HACK, console.log)`,
59
+ };
@@ -0,0 +1,51 @@
1
+ import type { AgentDefinition } from "../types/index.js";
2
+
3
+ export const dependencyAnalyzer: AgentDefinition = {
4
+ id: "dependency-analyzer",
5
+ name: "Dependency Analyzer",
6
+ description:
7
+ "Analyzes project dependencies for vulnerabilities, outdated packages, license issues, bundle size impact, and redundancy.",
8
+ maxSteps: 10,
9
+ toolSet: "extended",
10
+ relevantFor: (classification) => classification.packageManager !== null,
11
+
12
+ systemPrompt: `You are an expert dependency analyst. Your role is to analyze all project dependencies for health, security, and optimization.
13
+
14
+ 1. **Dependency Overview**
15
+ - Total dependency count (direct + dev)
16
+ - Dependency categories (frameworks, utilities, dev tools, etc.)
17
+ - Dependency tree depth
18
+
19
+ 2. **Version Analysis**
20
+ - Outdated dependencies
21
+ - Major version behind
22
+ - Pre-release or unstable versions
23
+ - Version pinning strategy (exact vs range)
24
+
25
+ 3. **Vulnerability Assessment**
26
+ - Run npm audit if available
27
+ - Known CVEs in dependencies
28
+ - Transitive vulnerability exposure
29
+
30
+ 4. **License Compliance**
31
+ - License types across all dependencies
32
+ - Copyleft license contamination risk
33
+ - Missing license declarations
34
+
35
+ 5. **Bundle Impact**
36
+ - Heavy dependencies that could be replaced
37
+ - Tree-shaking compatibility
38
+ - Duplicate functionality across packages
39
+
40
+ 6. **Redundancy**
41
+ - Multiple packages serving the same purpose
42
+ - Built-in alternatives (Node.js APIs vs packages)
43
+ - Unnecessary polyfills
44
+
45
+ ## Methodology
46
+ - Read package.json or equivalent manifest
47
+ - Run npm audit or similar if available
48
+ - Check for lock file presence and health
49
+ - Analyze each dependency category
50
+ - Look for opportunities to reduce dependency count`,
51
+ };
@@ -0,0 +1,59 @@
1
+ import type { AgentDefinition } from "../types/index.js";
2
+
3
+ export const onboardingGuide: AgentDefinition = {
4
+ id: "onboarding-guide",
5
+ name: "Onboarding Guide",
6
+ description:
7
+ "Generates a comprehensive onboarding guide for new developers including prerequisites, setup, project structure, workflow, and troubleshooting.",
8
+ maxSteps: 12,
9
+ toolSet: "base",
10
+ relevantFor: () => true,
11
+
12
+ systemPrompt: `You are an expert developer relations engineer creating an onboarding guide for new developers joining this project.
13
+
14
+ 1. **Prerequisites**
15
+ - Required system software and versions (Node.js, Python, etc.)
16
+ - Required global tools (CLI tools, package managers)
17
+ - Required accounts or access (API keys, services)
18
+ - Environment setup (env variables)
19
+
20
+ 2. **Getting Started**
21
+ - Step-by-step setup instructions
22
+ - Installation commands
23
+ - Configuration steps
24
+ - Running the application locally
25
+ - Running tests
26
+
27
+ 3. **Project Structure**
28
+ - Directory layout explanation
29
+ - Key files and their purposes
30
+ - Module organization
31
+ - Configuration files
32
+
33
+ 4. **Development Workflow**
34
+ - Branch naming conventions
35
+ - Commit message format
36
+ - Code review process
37
+ - CI/CD pipeline overview
38
+ - Common development commands
39
+
40
+ 5. **Key Concepts**
41
+ - Architecture overview
42
+ - Core patterns used in the codebase
43
+ - Important abstractions
44
+ - Domain terminology
45
+
46
+ 6. **Troubleshooting**
47
+ - Common setup issues and solutions
48
+ - Debugging tips
49
+ - Useful commands
50
+ - Where to find help
51
+
52
+ ## Methodology
53
+ - Read README.md and CONTRIBUTING.md first
54
+ - Check package.json scripts
55
+ - Review configuration files
56
+ - Look at CI/CD configuration
57
+ - Examine project structure
58
+ - Read key documentation files`,
59
+ };
@@ -0,0 +1,41 @@
1
+ import type { LanguageModelV1 } from "ai";
2
+ import type { OpenReportConfig } from "../config/schema.js";
3
+ import type { FullReport } from "../types/index.js";
4
+ import { ProgressTracker } from "../pipeline/progress.js";
5
+ import { runPipeline } from "../pipeline/runner.js";
6
+
7
+ export interface OrchestratorOptions {
8
+ projectRoot: string;
9
+ reportType: string;
10
+ model: LanguageModelV1;
11
+ modelId: string;
12
+ config: OpenReportConfig;
13
+ onProgress?: (progress: ProgressTracker) => void;
14
+ signal?: AbortSignal;
15
+ generateTodoList?: boolean;
16
+ }
17
+
18
+ export async function orchestrate(
19
+ options: OrchestratorOptions
20
+ ): Promise<{ report: FullReport; progress: ProgressTracker }> {
21
+ const { projectRoot, reportType, model, modelId, config, onProgress, signal, generateTodoList } = options;
22
+
23
+ const progress = new ProgressTracker();
24
+
25
+ if (onProgress) {
26
+ onProgress(progress);
27
+ }
28
+
29
+ const report = await runPipeline({
30
+ projectRoot,
31
+ reportType,
32
+ model,
33
+ modelId,
34
+ config,
35
+ progress,
36
+ signal,
37
+ generateTodoList,
38
+ });
39
+
40
+ return { report, progress };
41
+ }
@@ -0,0 +1,57 @@
1
+ import type { AgentDefinition } from "../types/index.js";
2
+
3
+ export const performanceAnalyzer: AgentDefinition = {
4
+ id: "performance-analyzer",
5
+ name: "Performance Analyzer",
6
+ description:
7
+ "Identifies performance bottlenecks including algorithmic complexity, N+1 queries, memory leaks, caching opportunities, and async patterns.",
8
+ maxSteps: 15,
9
+ toolSet: "extended",
10
+ relevantFor: (classification) =>
11
+ classification.projectType !== "library" || classification.hasTests,
12
+
13
+ systemPrompt: `You are an expert performance engineer analyzing a codebase for performance issues and optimization opportunities.
14
+
15
+ 1. **Algorithmic Complexity**
16
+ - Identify O(n^2) or worse operations
17
+ - Nested loops over large datasets
18
+ - Inefficient sorting or searching
19
+ - Missing memoization or caching
20
+
21
+ 2. **Database & Query Patterns**
22
+ - N+1 query patterns
23
+ - Missing indexes (if schema files exist)
24
+ - Unbounded queries (missing LIMIT)
25
+ - Inefficient ORM usage
26
+
27
+ 3. **Memory Management**
28
+ - Potential memory leaks (event listeners, closures, global caches)
29
+ - Large object allocations
30
+ - Missing cleanup in effects/hooks (React)
31
+ - Buffer/stream handling
32
+
33
+ 4. **Async Patterns**
34
+ - Sequential awaits that could be parallel
35
+ - Missing error handling in async code
36
+ - Unhandled promise rejections
37
+ - Blocking operations on the main thread
38
+
39
+ 5. **Caching Opportunities**
40
+ - Expensive computations without caching
41
+ - API responses that could be cached
42
+ - Static assets optimization
43
+ - Build-time vs runtime computation
44
+
45
+ 6. **Frontend Performance** (if applicable)
46
+ - Bundle size concerns
47
+ - Render performance (unnecessary re-renders)
48
+ - Image/asset optimization
49
+ - Code splitting opportunities
50
+
51
+ ## Methodology
52
+ - Read entry points and hot paths first
53
+ - Search for common performance anti-patterns
54
+ - Analyze database interaction code
55
+ - Review async/await patterns
56
+ - Check for caching mechanisms`,
57
+ };
@@ -0,0 +1,50 @@
1
+ import type { AgentDefinition, AgentId } from "../types/index.js";
2
+ import { architectureAnalyst } from "./architecture-analyst.js";
3
+ import { securityAuditor } from "./security-auditor.js";
4
+ import { codeQualityReviewer } from "./code-quality-reviewer.js";
5
+ import { dependencyAnalyzer } from "./dependency-analyzer.js";
6
+ import { performanceAnalyzer } from "./performance-analyzer.js";
7
+ import { testCoverageAnalyst } from "./test-coverage-analyst.js";
8
+ import { apiDocumentation } from "./api-documentation.js";
9
+ import { onboardingGuide } from "./onboarding-guide.js";
10
+ import { todoGenerator } from "./todo-generator.js";
11
+ import { REPORT_TYPES, type ReportTypeId } from "../config/defaults.js";
12
+
13
+ const AGENT_REGISTRY: Map<AgentId, AgentDefinition> = new Map([
14
+ ["architecture-analyst", architectureAnalyst],
15
+ ["security-auditor", securityAuditor],
16
+ ["code-quality-reviewer", codeQualityReviewer],
17
+ ["dependency-analyzer", dependencyAnalyzer],
18
+ ["performance-analyzer", performanceAnalyzer],
19
+ ["test-coverage-analyst", testCoverageAnalyst],
20
+ ["api-documentation", apiDocumentation],
21
+ ["onboarding-guide", onboardingGuide],
22
+ ["todo-generator", todoGenerator],
23
+ ]);
24
+
25
+ export function getAgentById(id: AgentId): AgentDefinition | undefined {
26
+ return AGENT_REGISTRY.get(id);
27
+ }
28
+
29
+ export function getAllAgents(): AgentDefinition[] {
30
+ return Array.from(AGENT_REGISTRY.values());
31
+ }
32
+
33
+ export function getAgentIds(): AgentId[] {
34
+ return Array.from(AGENT_REGISTRY.keys());
35
+ }
36
+
37
+ export function getAgentsForReportType(reportTypeId: string): AgentId[] {
38
+ const reportType = REPORT_TYPES[reportTypeId as ReportTypeId];
39
+ if (reportType) {
40
+ return [...reportType.agents] as AgentId[];
41
+ }
42
+
43
+ // If unknown type, try to find matching agent ID directly
44
+ if (AGENT_REGISTRY.has(reportTypeId as AgentId)) {
45
+ return [reportTypeId as AgentId];
46
+ }
47
+
48
+ // Default to full audit
49
+ return [...REPORT_TYPES["full-audit"].agents] as AgentId[];
50
+ }