Skip to content

ts-ai-indexer: add command#15

Open
genesiscz wants to merge 1 commit intomasterfrom
feat/ts-ai-indexer
Open

ts-ai-indexer: add command#15
genesiscz wants to merge 1 commit intomasterfrom
feat/ts-ai-indexer

Conversation

@genesiscz
Copy link
Owner

@genesiscz genesiscz commented Feb 9, 2026

Summary by CodeRabbit

Release Notes

  • Documentation

    • README restructured with reorganized sections, renamed components, and streamlined content for a more focused layout.
  • New Features

    • Added TypeScript indexer tool for analyzing TypeScript projects and generating AI-friendly documentation in Markdown format.
  • Chores

    • Dependency graph updated with package consolidation and version adjustments across build and runtime toolchains.

Copilot AI review requested due to automatic review settings February 9, 2026 03:00
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

Warning

Rate limit exceeded

@genesiscz has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 49 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 29c34aa and 9d86cb0.

📒 Files selected for processing (1)
  • package.json
📝 Walkthrough

Walkthrough

This PR reorganizes project documentation, updates the dependency graph, and introduces a new TypeScript-based indexer tool that analyzes TS projects to generate AI-friendly Markdown documentation. The README was restructured with condensed sections and renamed components, the package.json saw significant dependency changes, and a new indexer CLI was added at src/ts-ai-indexer/.

Changes

Cohort / File(s) Summary
Documentation Restructuring
README.md
Large content rewrite with reorganized sections, renamed tool references (e.g., "TS AI Indexer" replacing prior TS tooling), trimmed content, and reformatted tables and examples. Overall shift to a leaner, more structured layout.
Dependency Management
package.json
Significant updates to devDependencies and dependencies with removal of Babel/React-related types, Markdown-related libraries, and various utility packages; introduction of alternative packages and version adjustments affecting runtime and build toolchain.
TypeScript Indexer Tool
src/ts-ai-indexer/index.ts
New CLI tool for analyzing TypeScript projects using ts-morph. Extracts classes, interfaces, functions, enums, type aliases, constants, and imports; generates Markdown documentation with configurable filtering, output formatting, and clipboard/file export options.

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as TS AI Indexer CLI
    participant Resolver as Path Resolver
    participant Parser as ts-morph Parser
    participant Analyzer as File Analyzer
    participant Generator as Markdown Generator
    participant Output as File/Clipboard Output

    User->>CLI: Provide path or accept prompt
    CLI->>Resolver: Resolve & validate target path
    Resolver-->>CLI: Resolved path
    CLI->>Parser: Create Project & collect TS/TSX files
    Parser-->>CLI: File collection with exclusions
    
    loop For each SourceFile
        CLI->>Analyzer: Analyze file for metadata
        Analyzer->>Parser: Extract imports, classes, interfaces, functions, etc.
        Parser-->>Analyzer: AST metadata
        Analyzer-->>CLI: FileInfo with structured data
    end
    
    CLI->>Generator: Generate compact/detailed Markdown
    Generator->>Generator: Group by directory, format sections
    Generator-->>CLI: Markdown output
    
    CLI->>Output: Write to clipboard or file
    Output-->>User: Documentation generated
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~70 minutes

Poem

A rabbit hops through code so bright,
With indexer tools and docs rewrite,
Dependencies dance in new array,
TypeScript parsed in Markdown's way! 🐰✨
From chaos, order blooms anew.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 'ts-ai-indexer: add command' accurately and concisely describes the primary change: adding a new ts-ai-indexer command-line tool to the project.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/ts-ai-indexer

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @genesiscz, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request fundamentally refactors the project by introducing a powerful new ts-ai-indexer command-line tool. This tool is designed to parse TypeScript codebases and generate comprehensive, AI-friendly markdown documentation, detailing classes, interfaces, functions, and other code constructs. Concurrently, the project's dependencies have been extensively pruned and updated, and the README.md has been revised to accurately represent the current toolset, emphasizing the new TypeScript indexing capabilities.

Highlights

  • New ts-ai-indexer command: A new command-line tool has been introduced to generate AI-friendly markdown documentation from TypeScript codebases, providing detailed insights into code structure.
  • Dependency overhaul: The project's package.json has been significantly cleaned up, removing numerous unused dependencies and adding ts-morph and enquirer to support the new TypeScript indexing functionality.
  • Documentation refactoring: The README.md has been extensively updated to reflect the new ts-ai-indexer tool and remove documentation for many deprecated or removed tools, streamlining the project's overview.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • README.md
    • Removed the 'DeepWiki' badge from the header.
    • Removed the entire 'Claude Code Plugin' section, including installation instructions and component details.
    • Streamlined the 'Table of Contents' by removing entries for many deprecated tools.
    • Updated the 'AI & Analysis' section to include the new 'TS AI Indexer' and removed several other AI-related tools.
    • Removed documentation for numerous tools across 'Git & Version Control', 'Monitoring & Watching', and other categories.
    • Adjusted markdown list and table formatting for consistency.
    • Updated the 'Git Commit' tool's description and options.
    • Revised the 'MCP Configuration Example for Claude Desktop' and 'MCP Configuration Example for Cursor' sections, removing some MCP server entries.
  • package.json
    • Removed the scripts section, simplifying project build and type-checking commands.
    • Removed a large number of development dependencies, including various @types packages for Babel, SQLite, Markdown, React, JSDOM, and Yargs.
    • Removed react-devtools-core from dev dependencies.
    • Removed numerous production dependencies, such as @ai-sdk/anthropic, @ai-sdk/google, @ai-sdk/groq, @ai-sdk/openai-compatible, @babel/core, @clack/prompts, @gitbeaker/rest, @iarna/toml, @inquirer/prompts, @mdit/plugin-alert, @mozilla/readability, @nanocollective/get-md, @toon-format/toon, babel-plugin-react-compiler, better-sqlite3, cli-html, commander, fsevents, gpt-3-encoder, ink-table, jsdom, jsonpath, markdown-it and its plugins, md-to-pdf, mdream, object-hash, octokit, picocolors, react, react-devtools, supports-color, ts-lsp-client, turndown, and yargs.
    • Added ts-morph for advanced TypeScript Abstract Syntax Tree (AST) manipulation and analysis.
    • Added enquirer for interactive command-line prompts.
    • Updated @ai-sdk/openai to ^1.3.22.
    • Updated @modelcontextprotocol/sdk to ^1.11.0.
    • Updated axios to ^1.8.4.
    • Updated chalk to ^5.4.1.
    • Updated ink to ^6.0.0.
    • Added @types/minimist and minimist.
    • Removed the patchedDependencies section.
  • src/ts-ai-indexer/index.ts
    • New file added, implementing the ts-ai-indexer command-line tool.
    • Provides functionality to parse TypeScript source files using ts-morph and extract detailed information about classes, interfaces, functions, enums, types, and constants.
    • Includes helper functions for extracting JSDoc comments, access modifiers, decorators, and simplifying complex type signatures.
    • Supports generating markdown documentation in a compact format, with options to include private/protected members and exclude specific files or node_modules.
    • Offers flexible output options, allowing the generated documentation to be written to a specified file or copied directly to the clipboard.
    • Features command-line argument parsing with minimist and interactive prompts with enquirer for user input.
Activity
  • No specific human activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new ts-ai-indexer tool, a powerful utility for generating AI-friendly documentation from TypeScript codebases. The implementation is comprehensive and leverages ts-morph for AST analysis. Additionally, the PR includes a significant cleanup of the README.md and package.json, which streamlines the project. I've identified a few areas for improvement, including a bug in the file exclusion logic of the new tool, some opportunities to enhance code quality by using TypeScript features more effectively, and a minor documentation issue.

Comment on lines +896 to +924
if (isDirectory) {
const patterns = ["**/*.ts", "**/*.tsx"];
const excludePatterns = argv.exclude?.split(",").map((p) => p.trim()) || [];

if (!argv.includeNodeModules) {
excludePatterns.push("**/node_modules/**");
}

// Add common exclusions
excludePatterns.push("**/*.d.ts", "**/*.test.ts", "**/*.spec.ts");

project.addSourceFilesAtPaths(patterns.map((p: string) => join(targetPath, p)));

// Filter out excluded files
const allSourceFiles = project.getSourceFiles();
const excludedPaths = excludePatterns.map((p: string) => join(targetPath, p));

for (const sourceFile of allSourceFiles) {
const filePath = sourceFile.getFilePath();
for (const excludePattern of excludedPaths) {
if (filePath.includes(excludePattern.replace(/\*\*/g, '').replace(/\*/g, ''))) {
project.removeSourceFile(sourceFile);
break;
}
}
}
} else {
project.addSourceFileAtPath(targetPath);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The current file exclusion logic is incorrect. It uses filePath.includes() with a naively processed glob pattern, which will not work as expected for glob patterns and can lead to incorrect file filtering. For example, an exclude pattern of **/tests/** would incorrectly exclude any file path containing the substring "tests".

A more robust approach is to use ts-morph's built-in support for negative glob patterns when adding source files. This is both cleaner and more reliable.

    if (isDirectory) {
        const patterns = ["**/*.ts", "**/*.tsx"];
        const excludePatterns = argv.exclude?.split(",").map((p) => p.trim()) || [];

        if (!argv.includeNodeModules) {
            excludePatterns.push("**/node_modules/**");
        }

        // Add common exclusions
        excludePatterns.push("**/*.d.ts", "**/*.test.ts", "**/*.spec.ts");

        const globs = patterns.map(p => join(targetPath, p));
        excludePatterns.forEach(p => globs.push(`!${join(targetPath, p)}`));

        project.addSourceFilesAtPaths(globs);
    } else {
        project.addSourceFileAtPath(targetPath);
    }

README.md Outdated
6. **Push (Optional)** → Asks if you want to push to remote

> Monitor macOS Endpoint Security events in real-time using the ESLogger utility - perfect for security monitoring and debugging process execution!
### 13. 📊 TS AI Indexer
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The tool numbering in the documentation has a gap. It jumps from section 11 (Git Commit) to section 13 (TS AI Indexer), skipping section 12. Please renumber the sections sequentially for clarity and consistency.

package.json Outdated
"commander": "^14.0.2",
"diff": "^8.0.2",
"diff2html": "^3.4.51",
"enquirer": "^2.4.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The enquirer package is imported in src/ts-ai-indexer/index.ts but it is not used. It seems like it was intended to be used for prompting the user, but @clack/prompts or a similar library might be used instead, or the functionality was removed. Please remove this unused dependency.

Comment on lines +241 to +250
function getDecorators(node: Node): string[] {
if (!Node.isDecoratable(node)) return [];

const decoratableNode = node as any;
return decoratableNode.getDecorators().map((decorator: any) => {
const name = decorator.getName();
const args = decorator.getArguments().map((arg: any) => arg.getText());
return args.length > 0 ? `@${name}(${args.join(", ")})` : `@${name}`;
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The use of as any after a type guard like Node.isDecoratable(node) is unnecessary and bypasses TypeScript's type safety. Once the type guard confirms the node's type, the node variable is automatically narrowed within that scope, allowing you to call its methods directly without casting. This principle also applies to other similar helper functions in this file, such as getTypeParameters.

function getDecorators(node: Node): string[] {
    if (!Node.isDecoratable(node)) return [];

    return node.getDecorators().map((decorator) => {
        const name = decorator.getName();
        const args = decorator.getArguments().map((arg) => arg.getText());
        return args.length > 0 ? `@${name}(${args.join(", ")})` : `@${name}`;
    });
}

// Group by directory
const byDirectory = new Map<string, FileInfo[]>();
for (const file of fileInfos) {
const dir = file.path.substring(0, file.path.lastIndexOf("/")) || "/";
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Using string manipulation for path handling is not robust, especially across different operating systems (e.g., Windows uses \). It's better to use the node:path module, which is already imported, to handle path operations reliably. This line should use dirname(), and line 550 should use basename(). You will need to add dirname and basename to the import from node:path.

        const dir = dirname(file.path);

Copy link
Contributor

@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: 10

🤖 Fix all issues with AI agents
In `@package.json`:
- Line 51: Update the "ts-morph" dependency in package.json from "^26.0.0" to
"^27.0.2" to pick up the browser support fixes; then reinstall and update the
lockfile (run npm install or yarn install) so the lockfile reflects the new
version; verify no breaking API changes affect code that imports "ts-morph" and
run the test/build to ensure compatibility.

In `@README.md`:
- Line 644: Update the default output filename from "ts-ai-context.md" to
"ts-ai-indexer.md" wherever it is inconsistent: change the README table entry
for `--output`/`-o`, update the default string used in the showHelp() function
(symbol: showHelp) in index.ts, and update the argv.default value (symbol:
argv.default) to "ts-ai-indexer.md" so the displayed help, runtime default, and
docs match the actual tool directory name.
- Around line 619-634: The README examples use the wrong tool name: they call
"tools ts-ai-context" but the actual tool directory is "src/ts-ai-indexer";
update all CLI example lines referencing "tools ts-ai-context" to "tools
ts-ai-indexer" (or alternatively rename the directory to "ts-ai-context" if you
prefer) so the tools executable can discover the tool; search for occurrences of
the literal "tools ts-ai-context" and replace them with "tools ts-ai-indexer"
(or adjust the directory name "src/ts-ai-indexer") to ensure the examples match
the tool-discovery behavior.
- Around line 573-585: The README has an unclosed <details> block that starts at
the "📋 Workflow" summary causing "13. 📊 TS AI Indexer" and everything after to
be hidden; fix it by adding a closing </details> immediately after the end of
the Workflow list (after step 6 / before "13. 📊 TS AI Indexer") so the
<details> opened for the Workflow is properly balanced, and scan for any other
unmatched <details> / </details> pairs to ensure all accordion sections render
correctly.
- Around line 86-95: Fix the broken TOC fragments by updating the links for the
"Hold-AI" ("10. Hold-AI Tool"), "Watchman" ("5. Watchman") and "Watch" ("6. 🔄
Watch") entries so they match the repository's auto-generated Markdown anchors:
normalize to lowercase, remove emoji characters from the fragment, replace
spaces/periods with hyphens, and ensure the text portion matches the heading
(e.g., use a fragment like the slugified form of the heading rather than the
current emoji-containing or outdated fragment); alternatively, remove emojis
from the corresponding headings ("Hold-AI", "Watchman", "6. 🔄 Watch") to keep
fragments stable—update either the TOC entries or the heading text where you
find "Hold-AI", "Watchman", and "Watch" to make anchors consistent.

In `@src/ts-ai-indexer/index.ts`:
- Around line 951-954: The CLI currently ignores argv.format and always calls
generateCompactMarkdown; implement support for the "detailed" format by adding a
generateDetailedMarkdown(fileInfos, argv) function (matching the signature of
generateCompactMarkdown) and change the call at the markdown generation site to
branch on argv.format (e.g., if (argv.format === 'detailed') use
generateDetailedMarkdown(...) else use generateCompactMarkdown(...)); ensure the
Options/interface that defines format still allows "detailed" and update any
callers/exports accordingly so --format detailed produces the detailed output
instead of silently falling back to compact.
- Around line 864-876: The interactive prompt that assigns targetPath via
prompter.prompt can throw when the user cancels (e.g., Ctrl+C); wrap the await
prompter.prompt(...) call in a try/catch around the block that sets targetPath
(the code handling argv._[0] || argv.path and the subsequent prompt) and on
catch detect a user-cancellation error (the Enquirer cancellation/error) and
exit gracefully (e.g., return/process.exit(0) or log a friendly message) instead
of letting the error bubble to the top-level; ensure you only catch and handle
cancellation while rethrowing or logging other unexpected errors.
- Around line 839-857: The parsed argv currently misses kebab-case flags because
minimist doesn't convert them; update the minimist configuration in main() (the
minimist call that produces argv) to map kebab-case names to the camelCase
properties (add alias entries for "include-private" -> "includePrivate",
"include-protected" -> "includeProtected", "include-node-modules" ->
"includeNodeModules"), or alternatively normalize argv immediately after parsing
by copying argv['include-private'] to argv.includePrivate (and similarly for the
other two) so the rest of the code using argv.includePrivate /
argv.includeProtected / argv.includeNodeModules works correctly.
- Around line 909-921: The current exclusion loop builds excludedPaths by
naively stripping wildcards and then uses filePath.includes(...), which
mis-matches globs; update the logic to use the existing minimatch library to
test each source file against the original excludePatterns: compute a file path
relative to targetPath (use project.getSourceFiles() -> sourceFile.getFilePath()
and path.relative(targetPath, filePath) or similar), then for each pattern in
excludePatterns call minimatch(relativePath, pattern, { dot: true }) and if any
match call project.removeSourceFile(sourceFile); replace the
string-stripping/excludedPaths array and the includes check with this
minimatch-based test so patterns like "**/*.test.ts" and "src/legacy/*" behave
correctly.
- Around line 179-202: Update the help text and default output filename to use
the correct tool name "ts-ai-indexer": in the showHelp() function replace
occurrences of the command invocation string "tools ts-ai-context" with "tools
ts-ai-indexer" and update the usage/examples accordingly; also change the
default output filename variable (the constant that currently defaults to
"ts-ai-context.md") to "ts-ai-indexer.md" so the help, examples and default
output are consistent (search for showHelp and the default output filename
constant to locate both places).
🧹 Nitpick comments (5)
package.json (1)

28-28: minimist and enquirer contradict project coding guidelines.

The coding guidelines specify:

  • Use commander for parsing command-line arguments with subcommands and options in CLI tools
  • Use @clack/prompts for interactive prompts in new tools (preferred over @inquirer/prompts)

Yet minimist (Line 46) and enquirer (Line 39) were added as new dependencies for the ts-ai-indexer tool. Consider replacing these with commander and @clack/prompts respectively to stay consistent with the rest of the toolkit.

As per coding guidelines: src/**/*.ts: Use commander for parsing command-line arguments and @clack/prompts for interactive prompts in new tools.

Also applies to: 39-39, 46-46

README.md (1)

658-658: Capitalize "Markdown" as a proper noun.

-The tool generates a structured markdown document with:
+The tool generates a structured Markdown document with:
src/ts-ai-indexer/index.ts (3)

1-6: Coding guideline deviations: minimistcommander, Enquirer@clack/prompts, writeFileSyncBun.write().

Three guideline violations in this new tool:

  1. minimist instead of commander for argument parsing (Line 1)
  2. Enquirer instead of @clack/prompts for interactive prompts (Line 2, 177)
  3. writeFileSync from node:fs instead of Bun.write() for file output (Line 4, used at Line 962)

Switching to commander would also fix the kebab-case flag bug above and provide auto-generated --help. Using @clack/prompts provides cancellation detection via p.isCancel() as recommended by guidelines.

As per coding guidelines: src/**/*.ts specifies commander, @clack/prompts, and Bun.write() as the required tools.

Also applies to: 177-177


904-905: Hardcoded exclusion of *.d.ts, *.test.ts, *.spec.ts with no opt-out.

These patterns are always appended to the exclusion list. A user who intentionally wants to index declaration files or test files has no way to override this behavior. Consider making these defaults that can be disabled with a flag (e.g., --include-tests, --include-declarations), or at least document this behavior in the help text.


526-836: Large generateCompactMarkdown function — consider extracting per-entity renderers.

This 310-line function handles rendering for classes, interfaces, functions, enums, types, and constants, each with repetitive parameter-formatting logic (the map((p) => ...) pattern for parameters appears 3 times at Lines 657–667, 718–728, and 750–760). Extracting a formatParameter helper and per-entity renderClass/renderInterface/etc. functions would reduce duplication and improve readability.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new TypeScript AST-based “AI indexer” CLI under src/ts-ai-indexer/ intended to generate AI-friendly markdown summaries of a TS codebase. The PR also heavily edits package.json and significantly rewrites README.md.

Changes:

  • Introduces a new ts-ai-indexer implementation using ts-morph to analyze TS/TSX files and emit markdown.
  • Updates README.md, including adding/adjusting the “TS AI Indexer” section and restructuring/removing large parts of existing documentation.
  • Large dependency/script changes in package.json (including removal of dependencies still used by existing tools).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 11 comments.

File Description
src/ts-ai-indexer/index.ts New CLI tool for indexing TypeScript projects and generating markdown output.
package.json Major dependency reshuffle/removals that currently conflict with existing imports across the repo.
README.md Documentation restructure; adds TS AI Indexer section but also removes many existing tool docs and contains command-name mismatches.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +536 to +540
const dir = file.path.substring(0, file.path.lastIndexOf("/")) || "/";
if (!byDirectory.has(dir)) {
byDirectory.set(dir, []);
}
byDirectory.get(dir)!.push(file);
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Directory grouping uses string operations with hard-coded "/" separators. This will break on Windows paths. Prefer node:path dirname/basename (and possibly path.sep normalization) for portability.

Copilot uses AI. Check for mistakes.
Comment on lines 20 to 24
"dependencies": {
"@ai-sdk/anthropic": "^2.0.40",
"@ai-sdk/google": "^2.0.26",
"@ai-sdk/groq": "^2.0.27",
"@ai-sdk/openai": "^2.0.59",
"@ai-sdk/openai-compatible": "^1.0.25",
"@babel/core": "^7.28.6",
"@babel/preset-typescript": "^7.28.5",
"@clack/prompts": "^1.0.0",
"@gitbeaker/rest": "^43.5.0",
"@iarna/toml": "^2.2.5",
"@inquirer/prompts": "^8.2.0",
"@mdit/plugin-alert": "^0.22.4",
"@modelcontextprotocol/sdk": "^1.25.2",
"@ai-sdk/openai": "^1.3.22",
"@modelcontextprotocol/sdk": "^1.11.0",
"@modelcontextprotocol/server-github": "^2025.4.8",
"@mozilla/readability": "^0.6.0",
"@nanocollective/get-md": "1.1.0-beta.1",
"@openrouter/ai-sdk-provider": "^0.7.2",
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

package.json no longer lists dependencies that are imported across the repo (e.g. commander, @inquirer/prompts, @inquirer/core, @clack/prompts, picocolors). With the current dependency set, many tools will fail to install/run. Re-add the missing dependencies or update the codebase to remove those imports before merging.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +5
import minimist from "minimist";
import Enquirer from "enquirer";
import { resolve, join, relative } from "node:path";
import { existsSync, writeFileSync, statSync } from "node:fs";
import logger from "../logger";
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

This tool imports logger via a relative path ("../logger"), while the repo generally uses the tsconfig alias "@app/logger" (e.g. src/collect-files-for-ai/index.ts:4). Aligning with the alias avoids brittle relative paths and keeps imports consistent.

Copilot uses AI. Check for mistakes.
v: "verbose",
h: "help",
c: "clipboard",
f: "format",
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

minimist won’t automatically map kebab-case flags (documented in showHelp as --include-private/--include-node-modules) to camelCase properties like argv.includePrivate/includeNodeModules. As-is, the documented flags won’t work. Either switch to commander (used throughout the repo) or read kebab-case keys / add explicit aliases.

Suggested change
f: "format",
f: "format",
"include-private": "includePrivate",
"include-node-modules": "includeNodeModules",

Copilot uses AI. Check for mistakes.
Comment on lines +914 to +918
const filePath = sourceFile.getFilePath();
for (const excludePattern of excludedPaths) {
if (filePath.includes(excludePattern.replace(/\*\*/g, '').replace(/\*/g, ''))) {
project.removeSourceFile(sourceFile);
break;
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

The exclude filtering isn’t doing real glob matching. Stripping ""/"" and then using string includes will miss common patterns like "/.test.ts" (won’t match "foo.test.ts"), so excluded files will leak into analysis. Use minimatch/micromatch (ideally on relative paths) or negated globs passed to addSourceFilesAtPaths.

Copilot uses AI. Check for mistakes.
README.md Outdated
Comment on lines +618 to +622
# Generate documentation for a directory
tools ts-ai-context src/

</details>

<details>
<summary><b>🔍 Filter Syntax</b></summary>
# Output to specific file
tools ts-ai-context . --output api-docs.md
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

README examples for TS AI Indexer use "tools ts-ai-context ...", but the tool added in this PR lives under src/ts-ai-indexer (invoked as "tools ts-ai-indexer"). Update the examples (or rename the tool) so the documented command matches what the launcher will execute.

Copilot uses AI. Check for mistakes.
"turndown": "^7.2.1",
"yargs": "^18.0.0",
"ts-morph": "^26.0.0",
"zod": "^3.25.64"
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

The repo still contains patches/cli-table3@0.6.5.patch, but package.json no longer declares patchedDependencies to apply it. If the patch is still required for cli-table3 ESM interop, the removal will reintroduce that runtime issue; otherwise, the patch file should be removed to avoid dead/unused maintenance artifacts.

Suggested change
"zod": "^3.25.64"
"zod": "^3.25.64"
},
"pnpm": {
"patchedDependencies": {
"cli-table3@0.6.5": "patches/cli-table3@0.6.5.patch"
}

Copilot uses AI. Check for mistakes.
README.md Outdated
Comment on lines +22 to +26
- [🚀 Quick Start](#-quick-start)
- [🛠️ Available Tools](#️-available-tools)
- [🔍 Git & Version Control](#-git--version-control)
- [🤖 AI & Analysis](#-ai--analysis)
- [📊 Monitoring & Watching](#-monitoring--watching)
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

This PR updates the Table of Contents but also removes large sections that documented other existing tools. Since those tools still exist under src/, this is a user-facing doc regression and also seems out-of-scope for a PR titled only "ts-ai-indexer: add command". Consider restoring the removed docs or splitting the README overhaul into a separate PR.

Copilot uses AI. Check for mistakes.
output?: string;
includePrivate?: boolean;
includeProtected?: boolean;
excludePattern?: string;
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Options declares excludePattern, but argv parsing and later code use argv.exclude. This is a TypeScript type mismatch (Args/Options don’t define "exclude") and also leaves excludePattern unused. Rename the option consistently and update minimist alias/docs accordingly.

Suggested change
excludePattern?: string;
exclude?: string;

Copilot uses AI. Check for mistakes.
Comment on lines +181 to +183
Usage: tools ts-ai-context [options] <path>

Generate AI-friendly markdown documentation from TypeScript codebase.
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

The help text and examples reference the command name "ts-ai-context", but this tool will be invoked as "tools ts-ai-indexer" (directory name). This will confuse users and makes the CLI docs inaccurate.

Copilot uses AI. Check for mistakes.
genesiscz added a commit that referenced this pull request Feb 17, 2026
- Replace duplicate stripAnsi with import from utils/string (#18)
- Fix wrapToWidth ANSI-aware truncation (#1/#3/#22)
- Add await to recursive executeTool call (#9/#20)
- Guard cursor when filtered list is empty (#5/#19)
- Use basename() instead of split("/").pop() (#10/#16)
- Validate --width NaN input (#14)
- Re-display watch message after screen clear (#15)
genesiscz added a commit that referenced this pull request Feb 18, 2026
- Replace duplicate stripAnsi with import from utils/string (#18)
- Fix wrapToWidth ANSI-aware truncation (#1/#3/#22)
- Add await to recursive executeTool call (#9/#20)
- Guard cursor when filtered list is empty (#5/#19)
- Use basename() instead of split("/").pop() (#10/#16)
- Validate --width NaN input (#14)
- Re-display watch message after screen clear (#15)
genesiscz added a commit that referenced this pull request Feb 18, 2026
* fix: clean error formatting and fuzzy match for tools entry point

* feat(tools): add discovery, introspection, and search-select modules

- discovery.ts: scans src/ for tools, extracts descriptions from README.md
- introspect.ts: runs --help on tools and parses Commander output into structured data
- search-select.ts: single-select search prompt with onHighlight callback, modeled on search-multiselect

* feat(tools): interactive browser with search, README preview, and subcommand explorer

* feat(markdown): add render options and CLI flags (--watch, --width, --theme, --no-color)

* fix: improve fuzzy matching to handle trailing dashes and segment matching

"tools cli-" now correctly matches "markdown-cli" by stripping trailing
dashes and checking dash-separated segments.

* feat(markdown-cli): add demo subcommand with interactive template gallery

* Revert "feat(markdown-cli): add demo subcommand with interactive template gallery"

This reverts commit f5c84db.

* feat(markdown): implement theme palette system (dark/light/minimal)

Wire up the --theme flag to actual color palettes that change
mermaid blocks, table borders, and alert colors per theme.

* fix: address PR #28 code review feedback

- Replace duplicate stripAnsi with import from utils/string (#18)
- Fix wrapToWidth ANSI-aware truncation (#1/#3/#22)
- Add await to recursive executeTool call (#9/#20)
- Guard cursor when filtered list is empty (#5/#19)
- Use basename() instead of split("/").pop() (#10/#16)
- Validate --width NaN input (#14)
- Re-display watch message after screen clear (#15)

* fix(markdown-cli/tools): address PR #28 review feedback

- Remove stray n8n.json (unrelated to PR scope)
- fix(markdown-cli): reject invalid --theme values via Commander .choices() (Thread #23)
- fix(tools): guard discoverTools against missing srcDir with existsSync check (Thread #24)
- fix(markdown): use display width for emoji/wide chars in wrapToWidth (Thread #25)
@genesiscz genesiscz force-pushed the feat/ts-ai-indexer branch from 9d86cb0 to 1a0cc19 Compare March 10, 2026 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants