Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 31, 2025

The src/tools directory had 12 scattered root-level files with inconsistent organization. This refactoring groups tools into logical categories and enforces kebab-case naming.

Changes

Directory Structure

  • Created src/tools/analysis/ for code analysis and scoring tools (7 files)
  • Created src/tools/utility/ for general-purpose tools (7 files)
  • Added barrel exports (index.ts) for both directories

Files Moved to analysis/

  • clean-code-scorer.ts, code-hygiene-analyzer.ts, dependency-auditor.ts
  • iterative-coverage-enhancer.ts, semantic-code-analyzer.ts
  • Already present: strategy-frameworks-builder.ts

Files Moved to utility/

  • guidelines-validator.ts, memory-context-optimizer.ts, mermaid-diagram-generator.ts
  • mode-switcher.ts, model-compatibility-checker.ts, project-onboarding.ts, sprint-timeline-calculator.ts

Renamed for Consistency

  • gap-frameworks-analyzers.tsgap-frameworks-analyzer.ts (singular form)
  • Function: gapFrameworksAnalyzers()gapFrameworksAnalyzer()

Import Path Updates

  • Updated src/index.ts imports from ./tools/{file} to ./tools/{category}/{file}
  • Fixed relative imports in moved files: ./shared/../shared/
  • Updated 50+ test files (static and dynamic imports)

Example

Before:

import { cleanCodeScorer } from "./tools/clean-code-scorer.js";
import { guidelinesValidator } from "./tools/guidelines-validator.js";

After:

import { cleanCodeScorer } from "./tools/analysis/clean-code-scorer.js";
import { guidelinesValidator } from "./tools/utility/guidelines-validator.js";

All tests pass (167 files, 2400 tests). No external API changes.

Original prompt

Refactor Project Structure for Better Organization and Consistency

Problem Statement

The current src directory structure suffers from several organizational issues that impact maintainability and developer experience:

Current Issues

  1. Inconsistent file naming conventions

    • Mix of kebab-case (clean-code-scorer.ts) and camelCase in imports
    • No clear naming standard across the project
  2. Confusing directory organization

    • Prompt-related functionality split between /tools/prompt/ and /prompts/
    • Some tools at root of /tools/ while others are categorized
    • Unclear distinction between different tool categories
  3. Excessive nesting

    • Deep directory structure makes navigation difficult
    • Path imports become unwieldy (e.g., ../../../shared/utils.js)
  4. Poor discoverability

    • Related tools scattered across different directories
    • No clear categorization strategy for new tools

Proposed Solution

Reorganize the src directory with a flatter, more logical structure that groups related functionality together AND enforce consistent kebab-case naming.

New Structure with Consistent Naming

src/
├── index.ts                              # MCP server entry point
├── prompts/                              # Prompt definitions (keep as-is)
│   └── index.ts
├── resources/                            # Static resources (keep as-is)
│   ├── index.ts
│   └── structured.ts
├── schemas/                              # Schema definitions
│   └── flow-tool-schemas.ts
├── tools/                                # All tool implementations
│   ├── index.ts                          # Main barrel export
│   ├── analysis/                         # Analysis and scoring tools
│   │   ├── index.ts
│   │   ├── clean-code-scorer.ts
│   │   ├── code-hygiene-analyzer.ts
│   │   ├── dependency-auditor.ts
│   │   ├── gap-frameworks-analyzer.ts    # RENAMED from gap-frameworks-analyzers.ts
│   │   ├── iterative-coverage-enhancer.ts
│   │   ├── semantic-code-analyzer.ts
│   │   └── strategy-frameworks-builder.ts
│   ├── bridge/                           # Bridge services (keep structure)
│   │   ├── index.ts
│   │   ├── project-onboarding-bridge.ts
│   │   └── semantic-analyzer-bridge.ts
│   ├── config/                           # Configuration management
│   │   ├── guidelines-config.ts
│   │   ├── model-config.ts
│   │   └── types/
│   │       ├── guidelines.types.ts
│   │       ├── index.ts
│   │       └── model.types.ts
│   ├── design/                           # Design workflow tools
│   │   ├── index.ts
│   │   ├── adr-generator.ts
│   │   ├── confirmation-module.ts
│   │   ├── confirmation-prompt-builder.ts
│   │   ├── constraint-consistency-enforcer.ts
│   │   ├── constraint-manager.ts
│   │   ├── coverage-enforcer.ts
│   │   ├── cross-session-consistency-enforcer.ts
│   │   ├── design-assistant.ts
│   │   ├── design-phase-workflow.ts
│   │   ├── methodology-selector.ts
│   │   ├── pivot-module.ts
│   │   ├── roadmap-generator.ts
│   │   ├── spec-generator.ts
│   │   ├── strategic-pivot-prompt-builder.ts
│   │   ├── types.ts
│   │   ├── config/
│   │   │   └── design-constraints.yaml
│   │   ├── services/
│   │   │   ├── additional-operations.service.ts
│   │   │   ├── artifact-generation.service.ts
│   │   │   ├── consistency.service.ts
│   │   │   ├── context-pattern-analyzer.service.ts
│   │   │   ├── index.ts
│   │   │   ├── phase-management.service.ts
│   │   │   └── session-management.service.ts
│   │   └── types/
│   │       ├── artifact.types.ts
│   │       ├── common.types.ts
│   │       ├── consistency.types.ts
│   │       ├── constraint.types.ts
│   │       ├── coverage.types.ts
│   │       ├── index.ts
│   │       ├── methodology.types.ts
│   │       ├── pivot.types.ts
│   │       └── session.types.ts
│   ├── prompt/                           # All prompt builders
│   │   ├── index.ts
│   │   ├── architecture-design-prompt-builder.ts
│   │   ├── code-analysis-prompt-builder.ts
│   │   ├── debugging-assistant-prompt-builder.ts
│   │   ├── documentation-generator-prompt-builder.ts
│   │   ├── domain-neutral-prompt-builder.ts
│   │   ├── enterprise-architect-prompt-builder.ts  # Add missing EA prompt
│   │   ├── hierarchical-prompt-builder.ts
│   │   ├── hierarchy-level-selector.ts
│   │   ├── prompt-chaining-builder.ts
│   │   ├── prompt-flow-builder.ts
│   │   ├── prompting-hierarchy-evaluator.ts
│   │   ├── security-hardening-prompt-builder.ts
│   │   ├── spark-prompt-builder.ts
│   │   ├── technique-applicator.ts
│   │   └── types/
│   │       ├── hierarchy.types.ts
│   │       └── index.ts
│   ├── utility/                          # General utility tools
│   │   ├── index.ts
│   │   ├── guidelines-validator.ts
│   │   ├── memory-context-optimizer.ts
│   │   ├── mermaid-diagram-generator.ts
│   │   ├── mode-switcher.ts
│   │   ├── model-compatibility-checker.ts
│   │   ├── project-onboarding.ts
│   │   └── sprint-timeline-calculator.ts
│   └── shar...

</details>



<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.

…p-frameworks-analyzers.ts

- Moved 5 analysis tools to src/tools/analysis/
- Moved 7 utility tools to src/tools/utility/
- Renamed gap-frameworks-analyzers.ts to gap-frameworks-analyzer.ts (singular)
- Updated all imports in src/index.ts and test files
- Fixed relative imports to ../shared/ in moved files
- All tests passing (167 test files, 2400 tests)

Co-authored-by: Anselmoo <13209783+Anselmoo@users.noreply.github.com>
All phases completed successfully:
- Directory structure reorganized
- All imports updated and validated
- All tests passing (167 files, 2400 tests)
- Quality checks passing
- Build successful
- Demo scripts working
- MCP server operational

Co-authored-by: Anselmoo <13209783+Anselmoo@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor project structure for better organization and consistency Reorganize src/tools into analysis/ and utility/ categories Oct 31, 2025
Copilot AI requested a review from Anselmoo October 31, 2025 20:36
@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

❌ Patch coverage is 62.16216% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.29%. Comparing base (9d54d99) to head (fa3aa18).

Files with missing lines Patch % Lines
src/tools/analysis/index.ts 0.00% 7 Missing ⚠️
src/tools/utility/index.ts 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #242      +/-   ##
==========================================
- Coverage   95.35%   95.29%   -0.06%     
==========================================
  Files          83       85       +2     
  Lines       26024    26038      +14     
  Branches     3165     3165              
==========================================
  Hits        24814    24814              
- Misses       1154     1168      +14     
  Partials       56       56              
Flag Coverage Δ
unittests 95.29% <62.16%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants