ref(tools): extract 28 inline types to named interfaces#108
ref(tools): extract 28 inline types to named interfaces#108
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (18)
📝 WalkthroughWalkthroughThis pull request performs a systematic refactoring across 17 files to extract inline object types into named interfaces. The changes preserve all existing logic and behavior while improving type clarity and maintainability by replacing anonymous type definitions with declared named types. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
Summary of ChangesHello, 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 significantly improves the codebase's maintainability and readability by formalizing inline TypeScript type definitions into named interfaces. This refactoring effort enhances type clarity and promotes reusability across various modules without altering any runtime behavior or introducing new functionality. Highlights
Using Gemini Code AssistThe 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
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 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a large-scale refactoring that extracts 28 inline type annotations into named interfaces across 16 files. This improves code readability and maintainability by giving descriptive names to what were previously anonymous object types. The changes are consistent with the goal of the pull request and have been applied correctly across all modified files.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/ask/utils/cli.ts (1)
260-266:⚠️ Potential issue | 🟠 MajorPreserve filename casing in
parseOutputFormat.
outputArg.toLowerCase()lowercases the filename too, which can redirect output to the wrong file on case-sensitive filesystems.💡 Suggested fix
- const parts = outputArg.toLowerCase().split(/\s+/); - const format = parts[0] as OutputFormat; + const parts = outputArg.trim().split(/\s+/); + const format = parts[0].toLowerCase() as OutputFormat; if (format === "file" && parts.length > 1) { const filename = parts.slice(1).join(" "); return { type: "file", filename }; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ask/utils/cli.ts` around lines 260 - 266, The parseOutputFormat implementation lowercases the entire outputArg which also lowercases the filename; instead, split outputArg first (const parts = outputArg.split(/\s+/)), then derive format by lowercasing only parts[0] (const format = parts[0].toLowerCase() as OutputFormat), and keep parts.slice(1).join(" ") as the filename preserving original casing; update the logic in parseOutputFormat to use these variables so format matching still works but filenames remain unchanged.src/automate/lib/builtins.ts (1)
111-149:⚠️ Potential issue | 🟠 MajorUse strict JSON parsing for subprocess output in
handleShell.Line 148 in
src/automate/lib/builtins.tsuses lenient parsing for subprocess output. Since this is a non-config boundary (subprocess stdout), strict mode is required to avoid silently accepting malformed JSON.🔧 Proposed fix
- output = SafeJSON.parse(stdout); + output = SafeJSON.parse(stdout, { strict: true });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/automate/lib/builtins.ts` around lines 111 - 149, The code in handleShell currently tries to leniently parse subprocess stdout using SafeJSON.parse(stdout) and then silently ignores failures; change this to strict JSON parsing so malformed JSON is not accepted: in function handleShell replace the SafeJSON.parse(stdout) call with a strict parser (e.g., JSON.parse(stdout) or SafeJSON.parseStrict if available) and on parse failure throw a descriptive error (include step.id and raw stdout) instead of swallowing the exception so callers know the subprocess produced invalid JSON; reference symbols: handleShell, stdout, output, SafeJSON.parse.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/ask/utils/cli.ts`:
- Around line 260-266: The parseOutputFormat implementation lowercases the
entire outputArg which also lowercases the filename; instead, split outputArg
first (const parts = outputArg.split(/\s+/)), then derive format by lowercasing
only parts[0] (const format = parts[0].toLowerCase() as OutputFormat), and keep
parts.slice(1).join(" ") as the filename preserving original casing; update the
logic in parseOutputFormat to use these variables so format matching still works
but filenames remain unchanged.
In `@src/automate/lib/builtins.ts`:
- Around line 111-149: The code in handleShell currently tries to leniently
parse subprocess stdout using SafeJSON.parse(stdout) and then silently ignores
failures; change this to strict JSON parsing so malformed JSON is not accepted:
in function handleShell replace the SafeJSON.parse(stdout) call with a strict
parser (e.g., JSON.parse(stdout) or SafeJSON.parseStrict if available) and on
parse failure throw a descriptive error (include step.id and raw stdout) instead
of swallowing the exception so callers know the subprocess produced invalid
JSON; reference symbols: handleShell, stdout, output, SafeJSON.parse.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: d1757f44-6312-4aef-bdbe-4e20e0e95da7
📒 Files selected for processing (19)
.claude/plans/2026-03-18-InlineTypeExtraction.mdsrc/Internal/LoggerLib/Logger.tssrc/ask/AIChat.tssrc/ask/providers/ProviderManager.tssrc/ask/utils/cli.tssrc/ask/utils/websearch.tssrc/automate/lib/builtins.tssrc/automate/lib/step-runner.tssrc/automate/lib/types.tssrc/azure-devops/commands/timelog/prepare-import.tssrc/claude-history-dashboard/src/integrations/tanstack-query/root-provider.tsxsrc/github-release-notes/index.tssrc/macos-resources/index.tsxsrc/markdown-cli/index.tssrc/mcp-manager/utils/command.utils.tssrc/mcp-tsc/LspWorker.tssrc/mcp-web-reader/utils/tokens.tssrc/telegram/lib/TGClient.tssrc/utils/markdown/index.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,js,jsx}: Do not add file-path comments as the first line of files
Do not add obvious comments that restate what the code already says
Never use one-lineifstatements; always use block form with braces
Include an empty line beforeifstatements, unless the preceding line is a variable declaration used by thatif
Include an empty line after closing}unless followed byelse,catch,finally, or another}
Use object parameters for functions with 3+ parameters or optional parameters
Use positional parameters only for 1-2 required and obvious parameters such asestimateTokens(text)orresolve(base, path)
Prefererror: errovererror: err instanceof Error ? err.message : String(err)when the error field accepts unknown
Files:
src/ask/providers/ProviderManager.tssrc/claude-history-dashboard/src/integrations/tanstack-query/root-provider.tsxsrc/github-release-notes/index.tssrc/automate/lib/types.tssrc/markdown-cli/index.tssrc/mcp-tsc/LspWorker.tssrc/ask/AIChat.tssrc/mcp-web-reader/utils/tokens.tssrc/utils/markdown/index.tssrc/ask/utils/cli.tssrc/automate/lib/step-runner.tssrc/azure-devops/commands/timelog/prepare-import.tssrc/Internal/LoggerLib/Logger.tssrc/telegram/lib/TGClient.tssrc/automate/lib/builtins.tssrc/ask/utils/websearch.tssrc/mcp-manager/utils/command.utils.tssrc/macos-resources/index.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Do not useas anyfor type casting; use proper type narrowing, type guards, or explicit interfaces instead
Use discriminant checks for union types (e.g.,entity.className === "User")
Files:
src/ask/providers/ProviderManager.tssrc/claude-history-dashboard/src/integrations/tanstack-query/root-provider.tsxsrc/github-release-notes/index.tssrc/automate/lib/types.tssrc/markdown-cli/index.tssrc/mcp-tsc/LspWorker.tssrc/ask/AIChat.tssrc/mcp-web-reader/utils/tokens.tssrc/utils/markdown/index.tssrc/ask/utils/cli.tssrc/automate/lib/step-runner.tssrc/azure-devops/commands/timelog/prepare-import.tssrc/Internal/LoggerLib/Logger.tssrc/telegram/lib/TGClient.tssrc/automate/lib/builtins.tssrc/ask/utils/websearch.tssrc/mcp-manager/utils/command.utils.tssrc/macos-resources/index.tsx
src/claude-history-dashboard/**/*.{ts,tsx,jsx,js}
📄 CodeRabbit inference engine (src/claude-history-dashboard/.cursorrules)
Use the latest version of Shadcn to install new components with the command:
pnpm dlx shadcn@latest add <component>
Files:
src/claude-history-dashboard/src/integrations/tanstack-query/root-provider.tsx
src/**/index.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
src/**/index.{ts,tsx}: Usecommanderfor parsing command-line arguments with subcommands and options
Use@clack/promptsfor interactive user experience in new tools; use@inquirer/promptsonly for legacy tools
Support multiple output destinations (file, clipboard, stdout) and useclipboardyfor clipboard operations
Usechalkfor colored terminal output but strip ANSI codes for non-TTY environments
UseBun.spawn()for executing external commands and handle stdout/stderr streams properly
Use Node.jspathmodule for cross-platform path handling and resolve relative paths to absolute
Use Bun's native file APIs (Bun.write()) for better performance in file operations
Files:
src/github-release-notes/index.tssrc/markdown-cli/index.tssrc/utils/markdown/index.tssrc/macos-resources/index.tsx
src/utils/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Place general-purpose utility functions in
src/utils/instead of inside tool directories
Files:
src/utils/markdown/index.ts
🧠 Learnings (31)
📓 Common learnings
Learnt from: CR
Repo: genesiscz/GenesisTools PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-15T23:02:14.981Z
Learning: Applies to **/*.{ts,tsx} : Do not use `as any` for type casting; use proper type narrowing, type guards, or explicit interfaces instead
📚 Learning: 2026-02-20T00:52:27.023Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 31
File: src/ask/utils/helpers.ts:3-3
Timestamp: 2026-02-20T00:52:27.023Z
Learning: In all TypeScript source files under src, prefer using picocolors for colored terminal output in new code. Picocolors is smaller and faster than chalk, so adopt it for CLI output coloring and avoid adding chalk in new code paths unless there is a compelling compatibility reason.
Applied to files:
src/ask/providers/ProviderManager.tssrc/github-release-notes/index.tssrc/automate/lib/types.tssrc/markdown-cli/index.tssrc/mcp-tsc/LspWorker.tssrc/ask/AIChat.tssrc/mcp-web-reader/utils/tokens.tssrc/utils/markdown/index.tssrc/ask/utils/cli.tssrc/automate/lib/step-runner.tssrc/azure-devops/commands/timelog/prepare-import.tssrc/Internal/LoggerLib/Logger.tssrc/telegram/lib/TGClient.tssrc/automate/lib/builtins.tssrc/ask/utils/websearch.tssrc/mcp-manager/utils/command.utils.ts
📚 Learning: 2026-02-24T15:32:37.494Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 54
File: src/github/lib/output.ts:109-113
Timestamp: 2026-02-24T15:32:37.494Z
Learning: In TypeScript files under src/, do not require a leading blank line before an if statement that is the first statement inside a function body (immediately after the function signature). The blank line rule should only apply to if statements that come after other statements within the function body. Apply this guideline consistently across TS files in src to reduce unnecessary vertical whitespace and keep concise function bodies.
Applied to files:
src/ask/providers/ProviderManager.tssrc/github-release-notes/index.tssrc/automate/lib/types.tssrc/markdown-cli/index.tssrc/mcp-tsc/LspWorker.tssrc/ask/AIChat.tssrc/mcp-web-reader/utils/tokens.tssrc/utils/markdown/index.tssrc/ask/utils/cli.tssrc/automate/lib/step-runner.tssrc/azure-devops/commands/timelog/prepare-import.tssrc/Internal/LoggerLib/Logger.tssrc/telegram/lib/TGClient.tssrc/automate/lib/builtins.tssrc/ask/utils/websearch.tssrc/mcp-manager/utils/command.utils.ts
📚 Learning: 2026-03-09T13:13:58.786Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 81
File: src/github/commands/get.ts:209-212
Timestamp: 2026-03-09T13:13:58.786Z
Learning: In the GenesisTools repo (genesiscz/GenesisTools), do not treat CI formatter warnings as enforceable formatting rules for TypeScript files under src/. Focus reviews on logical correctness and consistency with existing code patterns. For files under src (e.g., src/github/commands/get.ts), prioritize code structure, readability, naming, correctness, and adherence to project conventions over automated formatting warnings from CI tools.
Applied to files:
src/ask/providers/ProviderManager.tssrc/github-release-notes/index.tssrc/automate/lib/types.tssrc/markdown-cli/index.tssrc/mcp-tsc/LspWorker.tssrc/ask/AIChat.tssrc/mcp-web-reader/utils/tokens.tssrc/utils/markdown/index.tssrc/ask/utils/cli.tssrc/automate/lib/step-runner.tssrc/azure-devops/commands/timelog/prepare-import.tssrc/Internal/LoggerLib/Logger.tssrc/telegram/lib/TGClient.tssrc/automate/lib/builtins.tssrc/ask/utils/websearch.tssrc/mcp-manager/utils/command.utils.ts
📚 Learning: 2026-03-12T01:26:31.610Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 95
File: src/timely/utils/entry-processor.ts:0-0
Timestamp: 2026-03-12T01:26:31.610Z
Learning: In code paths where JSON is consumed, prefer strict RFC 8259 validation by using SafeJSON.parse(text, { strict: true }) instead of the lenient default. Apply this at non-config boundaries (e.g., API responses, JSONL, cache outputs, subprocess outputs). Reserve the lenient comment-json behavior only for user-authored config files that may legitimately contain comments or trailing commas. For src/timely/utils/entry-processor.ts and similar modules, replace or wrap JSON parsing with SafeJSON.parse(text, { strict: true }) unless you are explicitly handling config files that require comments.
Applied to files:
src/ask/providers/ProviderManager.tssrc/github-release-notes/index.tssrc/automate/lib/types.tssrc/markdown-cli/index.tssrc/mcp-tsc/LspWorker.tssrc/ask/AIChat.tssrc/mcp-web-reader/utils/tokens.tssrc/utils/markdown/index.tssrc/ask/utils/cli.tssrc/automate/lib/step-runner.tssrc/azure-devops/commands/timelog/prepare-import.tssrc/Internal/LoggerLib/Logger.tssrc/telegram/lib/TGClient.tssrc/automate/lib/builtins.tssrc/ask/utils/websearch.tssrc/mcp-manager/utils/command.utils.ts
📚 Learning: 2026-03-12T01:58:27.831Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 103
File: src/port/index.ts:137-144
Timestamp: 2026-03-12T01:58:27.831Z
Learning: In GenesisTools, apply a no-obvious-comments rule: do not add inline comments for well-known POSIX patterns or standard idioms (e.g., a process.kill(pid, 0) probe) when surrounding code is self-documenting through descriptive function/variable names. This guidance applies to TypeScript files under src (src/**/*.ts). Only include comments if they add non-obvious rationale, edge-case behavior, or explain complex logic that cannot be inferred from code alone.
Applied to files:
src/ask/providers/ProviderManager.tssrc/github-release-notes/index.tssrc/automate/lib/types.tssrc/markdown-cli/index.tssrc/mcp-tsc/LspWorker.tssrc/ask/AIChat.tssrc/mcp-web-reader/utils/tokens.tssrc/utils/markdown/index.tssrc/ask/utils/cli.tssrc/automate/lib/step-runner.tssrc/azure-devops/commands/timelog/prepare-import.tssrc/Internal/LoggerLib/Logger.tssrc/telegram/lib/TGClient.tssrc/automate/lib/builtins.tssrc/ask/utils/websearch.tssrc/mcp-manager/utils/command.utils.ts
📚 Learning: 2026-02-24T15:32:44.925Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 54
File: src/github/lib/review-output.ts:18-20
Timestamp: 2026-02-24T15:32:44.925Z
Learning: In TypeScript files, do not require a blank line between the opening brace of a function and the first statement if the first statement is the if statement immediately after the signature. The blank-line rule applies to separating an if from unrelated preceding code within the same block, not to spacing after the function opening brace. Apply this rule to all TS functions across the codebase.
Applied to files:
src/ask/providers/ProviderManager.tssrc/github-release-notes/index.tssrc/automate/lib/types.tssrc/markdown-cli/index.tssrc/mcp-tsc/LspWorker.tssrc/ask/AIChat.tssrc/mcp-web-reader/utils/tokens.tssrc/utils/markdown/index.tssrc/ask/utils/cli.tssrc/automate/lib/step-runner.tssrc/azure-devops/commands/timelog/prepare-import.tssrc/Internal/LoggerLib/Logger.tssrc/telegram/lib/TGClient.tssrc/automate/lib/builtins.tssrc/ask/utils/websearch.tssrc/mcp-manager/utils/command.utils.ts
📚 Learning: 2026-03-12T01:26:03.611Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 95
File: src/ask/lib/ChatSessionManager.ts:0-0
Timestamp: 2026-03-12T01:26:03.611Z
Learning: Use SafeJSON.parse(text, { strict: true }) for strict RFC 8259 validation in all non-config boundaries (API responses, JSONL, cache, subprocess output). The 3-arg form SafeJSON.parse(text, null, { strict: true }) is invalid and should not be used. Only lenient default (no options) is appropriate for user-authored config files that may contain comments/trailing commas. Apply this guideline across TypeScript files (src/**/*.ts) wherever SafeJSON.parse is used.
Applied to files:
src/ask/providers/ProviderManager.tssrc/github-release-notes/index.tssrc/automate/lib/types.tssrc/markdown-cli/index.tssrc/mcp-tsc/LspWorker.tssrc/ask/AIChat.tssrc/mcp-web-reader/utils/tokens.tssrc/utils/markdown/index.tssrc/ask/utils/cli.tssrc/automate/lib/step-runner.tssrc/azure-devops/commands/timelog/prepare-import.tssrc/Internal/LoggerLib/Logger.tssrc/telegram/lib/TGClient.tssrc/automate/lib/builtins.tssrc/ask/utils/websearch.tssrc/mcp-manager/utils/command.utils.ts
📚 Learning: 2026-03-12T01:26:18.985Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 95
File: src/claude/lib/history/search.ts:0-0
Timestamp: 2026-03-12T01:26:18.985Z
Learning: When using SafeJSON.parse in TypeScript code, prefer the two-argument form SafeJSON.parse(text, { strict: true }) to enable strict RFC 8259 validation via the native JSON.parse. Do NOT use the three-argument form SafeJSON.parse(text, null, { strict: true }). Apply strict parsing at remote/third-party API boundaries, JSONL parsing points, and subprocess output. Fall back to the lenient/default form only for user-authored config files that may legitimately contain comments or trailing commas. This pattern keeps strict validation where appropriate and preserves leniency for internal/config data.
Applied to files:
src/ask/providers/ProviderManager.tssrc/github-release-notes/index.tssrc/automate/lib/types.tssrc/markdown-cli/index.tssrc/mcp-tsc/LspWorker.tssrc/ask/AIChat.tssrc/mcp-web-reader/utils/tokens.tssrc/utils/markdown/index.tssrc/ask/utils/cli.tssrc/automate/lib/step-runner.tssrc/azure-devops/commands/timelog/prepare-import.tssrc/Internal/LoggerLib/Logger.tssrc/telegram/lib/TGClient.tssrc/automate/lib/builtins.tssrc/ask/utils/websearch.tssrc/mcp-manager/utils/command.utils.ts
📚 Learning: 2026-03-12T01:26:27.000Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 95
File: src/debugging-master/commands/tail.ts:0-0
Timestamp: 2026-03-12T01:26:27.000Z
Learning: In the genesiscz/GenesisTools repository, prefer using SafeJSON.parse(text, { strict: true }) (2-argument form) at all non-config JSON boundaries such as API responses, JSONL parsers, cache files, and subprocess stdout. Reserve the lenient default (SafeJSON.parse(text) with no options) only for user-authored config files that may legitimately contain comments or trailing commas.
Applied to files:
src/ask/providers/ProviderManager.tssrc/github-release-notes/index.tssrc/automate/lib/types.tssrc/markdown-cli/index.tssrc/mcp-tsc/LspWorker.tssrc/ask/AIChat.tssrc/mcp-web-reader/utils/tokens.tssrc/utils/markdown/index.tssrc/ask/utils/cli.tssrc/automate/lib/step-runner.tssrc/azure-devops/commands/timelog/prepare-import.tssrc/Internal/LoggerLib/Logger.tssrc/telegram/lib/TGClient.tssrc/automate/lib/builtins.tssrc/ask/utils/websearch.tssrc/mcp-manager/utils/command.utils.ts
📚 Learning: 2026-03-12T01:26:24.859Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 95
File: src/azure-devops/commands/history-sync.ts:0-0
Timestamp: 2026-03-12T01:26:24.859Z
Learning: In GenesisTools, ensure SafeJSON.parse is called with exactly two arguments. Use SafeJSON.parse(text, { strict: true }) for strict RFC 8259 validation, or pass a reviver function as the second argument. Do not call SafeJSON.parse(text, null, { strict: true }) since the function signature does not support a three-argument form. Apply this guideline to all TypeScript files that use SafeJSON.parse (e.g., src/utils/json.ts) and other related code.
Applied to files:
src/ask/providers/ProviderManager.tssrc/github-release-notes/index.tssrc/automate/lib/types.tssrc/markdown-cli/index.tssrc/mcp-tsc/LspWorker.tssrc/ask/AIChat.tssrc/mcp-web-reader/utils/tokens.tssrc/utils/markdown/index.tssrc/ask/utils/cli.tssrc/automate/lib/step-runner.tssrc/azure-devops/commands/timelog/prepare-import.tssrc/Internal/LoggerLib/Logger.tssrc/telegram/lib/TGClient.tssrc/automate/lib/builtins.tssrc/ask/utils/websearch.tssrc/mcp-manager/utils/command.utils.ts
📚 Learning: 2026-03-17T01:30:56.939Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 107
File: src/utils/macos/tts.ts:130-139
Timestamp: 2026-03-17T01:30:56.939Z
Learning: In genesiscz/GenesisTools, do not suggest converting two-argument functions with an optional second parameter (for example setMute(muted: boolean, app?: string)) to an object-parameter form. The project prefers simple positional parameters for short utility functions, even when an optional argument is present. The object-parameter guideline should only apply when a function has 3 or more parameters.
Applied to files:
src/ask/providers/ProviderManager.tssrc/github-release-notes/index.tssrc/automate/lib/types.tssrc/markdown-cli/index.tssrc/mcp-tsc/LspWorker.tssrc/ask/AIChat.tssrc/mcp-web-reader/utils/tokens.tssrc/utils/markdown/index.tssrc/ask/utils/cli.tssrc/automate/lib/step-runner.tssrc/azure-devops/commands/timelog/prepare-import.tssrc/Internal/LoggerLib/Logger.tssrc/telegram/lib/TGClient.tssrc/automate/lib/builtins.tssrc/ask/utils/websearch.tssrc/mcp-manager/utils/command.utils.ts
📚 Learning: 2026-03-12T03:48:42.474Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 104
File: src/darwinkit/index.ts:146-156
Timestamp: 2026-03-12T03:48:42.474Z
Learning: In TypeScript files that use Commander subcommands and exit after showing help, replace code after Command.help() with the pattern: call sub.outputHelp(); (returns void) followed by process.exit(0) or process.exit(1). This avoids TS7027 unreachable-code because Command.help() returns never. Apply this pattern in all src/**/*.ts files where subcommands need to display help before exiting.
Applied to files:
src/ask/providers/ProviderManager.tssrc/github-release-notes/index.tssrc/automate/lib/types.tssrc/markdown-cli/index.tssrc/mcp-tsc/LspWorker.tssrc/ask/AIChat.tssrc/mcp-web-reader/utils/tokens.tssrc/utils/markdown/index.tssrc/ask/utils/cli.tssrc/automate/lib/step-runner.tssrc/azure-devops/commands/timelog/prepare-import.tssrc/Internal/LoggerLib/Logger.tssrc/telegram/lib/TGClient.tssrc/automate/lib/builtins.tssrc/ask/utils/websearch.tssrc/mcp-manager/utils/command.utils.ts
📚 Learning: 2026-03-15T23:02:14.981Z
Learnt from: CR
Repo: genesiscz/GenesisTools PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-15T23:02:14.981Z
Learning: Applies to src/**/index.{ts,tsx} : Use `commander` for parsing command-line arguments with subcommands and options
Applied to files:
src/markdown-cli/index.tssrc/ask/utils/cli.tssrc/azure-devops/commands/timelog/prepare-import.tssrc/mcp-manager/utils/command.utils.ts
📚 Learning: 2026-02-24T22:38:35.375Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 54
File: src/ask/chat/ChatEngine.ts:26-26
Timestamp: 2026-02-24T22:38:35.375Z
Learning: In `src/ask/chat/ChatEngine.ts`, the `tools` parameter in `sendMessage()` (and the corresponding `_tools` in `sendStreamingMessage()` and `sendNonStreamingMessage()`) is intentionally kept as a placeholder for future tool-calling support to maintain API contract stability, even though it's currently unused. Do not flag this as an issue or suggest its removal.
Applied to files:
src/ask/AIChat.ts
📚 Learning: 2026-03-15T23:02:14.981Z
Learnt from: CR
Repo: genesiscz/GenesisTools PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-15T23:02:14.981Z
Learning: Applies to src/**/index.{ts,tsx} : Use `clack/prompts` for interactive user experience in new tools; use `inquirer/prompts` only for legacy tools
Applied to files:
src/ask/utils/cli.tssrc/automate/lib/builtins.tssrc/mcp-manager/utils/command.utils.ts
📚 Learning: 2026-03-12T01:26:33.308Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 95
File: src/mcp-tsc/utils/ServerManager.ts:0-0
Timestamp: 2026-03-12T01:26:33.308Z
Learning: In genesiscz/GenesisTools, `SafeJSON.parse` in `src/utils/json.ts` accepts exactly **two** arguments: `(text: string, reviverOrOptions?: Reviver | ParseOptions | null)`. The second argument is a union of a reviver function or a ParseOptions object — there is no separate third `options` argument. To enable strict RFC 8259 validation (native JSON.parse), pass `{ strict: true }` as the second argument: `SafeJSON.parse(text, { strict: true })`. Use this form at all external API response boundaries, JSONL parsing points, cache files, machine-written JSON files, and subprocess output. The lenient default (comment-json) is reserved for user-authored config files that may contain comments or trailing commas.
Applied to files:
src/ask/utils/cli.ts
📚 Learning: 2026-03-12T01:26:38.771Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 95
File: src/utils/claude/auth.ts:0-0
Timestamp: 2026-03-12T01:26:38.771Z
Learning: In genesiscz/GenesisTools, `SafeJSON.parse` in `src/utils/json.ts` accepts two arguments: `(text: string, reviverOrOptions?: Reviver | ParseOptions | null)`. The second argument can be either a reviver function or a `ParseOptions` object (e.g., `{ strict: true }`). There is no separate third `options` argument. Use `SafeJSON.parse(text, { strict: true })` at external/API/subprocess/JSONL/cache-file boundaries so malformed data fails fast with strict RFC 8259 validation. Use the lenient default (no second arg) only for user-authored config files that may legitimately contain comments or trailing commas.
Applied to files:
src/ask/utils/cli.ts
📚 Learning: 2026-03-12T01:26:30.872Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 95
File: src/hold-ai/client.ts:0-0
Timestamp: 2026-03-12T01:26:30.872Z
Learning: In genesiscz/GenesisTools, `SafeJSON.parse` in `src/utils/json.ts` accepts two arguments: `(text: string, reviverOrOptions?: Reviver | ParseOptions | null)`. The second argument can be either a reviver function or a `ParseOptions` object (e.g., `{ strict: true }`). To enable strict RFC 8259 validation (delegating to native `JSON.parse`), use `SafeJSON.parse(text, { strict: true })` — there is no separate third `options` parameter. Apply `{ strict: true }` at all non-config boundaries: API responses, JSONL parsing, cache files, and subprocess output. Reserve lenient default (no options) for user-authored config files that may contain comments or trailing commas.
Applied to files:
src/ask/utils/cli.ts
📚 Learning: 2026-03-12T01:26:31.776Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 95
File: src/daemon/lib/log-reader.ts:0-0
Timestamp: 2026-03-12T01:26:31.776Z
Learning: In genesiscz/GenesisTools, `SafeJSON.parse` in `src/utils/json.ts` accepts exactly two arguments: `(text: string, reviverOrOptions?: Reviver | ParseOptions | null)`. The second argument can be either a reviver function OR an options object (e.g., `{ strict: true }`). It does NOT accept a third `options` argument. Use `SafeJSON.parse(text, { strict: true })` (not `SafeJSON.parse(text, null, { strict: true })`) at external API response boundaries, JSONL parsing points, and subprocess output to delegate to native `JSON.parse` for strict RFC 8259 validation.
Applied to files:
src/ask/utils/cli.ts
📚 Learning: 2026-03-09T13:39:43.059Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 82
File: src/claude/lib/usage/dashboard-config.ts:24-25
Timestamp: 2026-03-09T13:39:43.059Z
Learning: GenesisTools (genesiscz/GenesisTools) is a personal CLI tool, not a multi-tenant service. Do not suggest data migration paths or backward-compatibility shims for simple default value changes in configuration files (e.g., dashboard-config.ts). The TUI provides interactive controls (e.g., the `i` key to cycle poll intervals at runtime), so users can adjust settings without needing automated migrations. Avoid overengineering suggestions in this context.
Applied to files:
src/ask/utils/cli.ts
📚 Learning: 2026-03-12T01:26:34.677Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 95
File: src/debugging-master/commands/tail.ts:0-0
Timestamp: 2026-03-12T01:26:34.677Z
Learning: In genesiscz/GenesisTools, `SafeJSON.parse` in `src/utils/json.ts` accepts exactly TWO arguments: `(text: string, reviverOrOptions?: Reviver | ParseOptions | null)`. The second argument is a union — pass a function for reviver behaviour, or pass `{ strict: true }` (a ParseOptions object) to delegate to native `JSON.parse` for strict RFC 8259 validation. There is NO separate third `options` argument. Correct usage at JSONL/API-response boundaries: `SafeJSON.parse(line, { strict: true })`. The 3-arg form `SafeJSON.parse(text, null, { strict: true })` is INCORRECT for this codebase.
Applied to files:
src/ask/utils/cli.ts
📚 Learning: 2026-03-17T01:47:54.903Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 107
File: .claude/plans/2026-03-17-Plan3-AIFoundation.md:207-207
Timestamp: 2026-03-17T01:47:54.903Z
Learning: In files under .claude/plans/ (e.g., .claude/plans/2026-03-17-Plan3-AIFoundation.md) in genesiscz/GenesisTools, treats contained code blocks as illustrative/pseudocode. Do not raise code quality, style, or correctness issues for code blocks within these plan documents. Acknowledge that actual implementations may differ from the plan sketches; focus reviews on real production code elsewhere.
Applied to files:
.claude/plans/2026-03-18-InlineTypeExtraction.md
📚 Learning: 2026-03-17T01:47:54.736Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 107
File: .claude/plans/2026-03-17-Plan1-NotifyAndSay.md:148-148
Timestamp: 2026-03-17T01:47:54.736Z
Learning: Do not raise code-quality, robustness, or implementation-detail review comments on plan documents located under .claude/plans/. Treat these Markdown plans as design/intent descriptions, and reserve such comments for the actual implementation files (e.g., src/**/*.ts) where production code resides.
Applied to files:
.claude/plans/2026-03-18-InlineTypeExtraction.md
📚 Learning: 2026-03-17T01:47:54.235Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 107
File: .claude/plans/2026-03-17-TeamRules.md:15-15
Timestamp: 2026-03-17T01:47:54.235Z
Learning: Guideline: For files in .claude/plans used for implementation planning, do not raise review comments for inconsistencies between plan documents. The authoritative source of truth is the actual implementation in the codebase. If a plan document conflicts with code, ignore the discrepancy unless the code has not yet incorporated the change. Apply this guidance to all .claude/plans/*.md files across the repository.
Applied to files:
.claude/plans/2026-03-18-InlineTypeExtraction.md
📚 Learning: 2026-03-17T01:47:52.068Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 107
File: .claude/plans/2026-03-16-AITools.md:112-112
Timestamp: 2026-03-17T01:47:52.068Z
Learning: In GenesisTools repos, files under .claude/plans/ are design/implementation plans (not production code). Do not flag code-quality issues (e.g., magic numbers, missing named constants, style concerns) in code blocks within these MD plan documents, as they are illustrative; only flag issues in actual production code. If there is any production-facing code, review it separately in its corresponding source files.
Applied to files:
.claude/plans/2026-03-18-InlineTypeExtraction.md
📚 Learning: 2026-03-17T01:47:51.462Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 107
File: .claude/plans/2026-03-16-ToolsEnhancements.md:131-131
Timestamp: 2026-03-17T01:47:51.462Z
Learning: In the genesiscz/GenesisTools repository, files under .claude/plans/ are design/plan documents, not production code. Do not flag implementation-level issues (e.g., filename uniqueness, overwrite risks, edge-case handling) in these files. Treat them as design artifacts only; reserve review actions for artifacts that impact implementation or design decisions, not for prose plan documents.
Applied to files:
.claude/plans/2026-03-18-InlineTypeExtraction.md
📚 Learning: 2026-03-17T01:47:59.765Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 107
File: .claude/plans/2026-03-17-Plan1-NotifyAndSay.md:209-222
Timestamp: 2026-03-17T01:47:59.765Z
Learning: In genesiscz/GenesisTools, treat files under .claude/plans/ as implementation plan documents, not production code. Do not raise code-quality, consistency, or architectural issues against these plan files. Only flag genuinely problematic structural issues (e.g., broken links, missing required sections) if they would block implementation. This exemption should apply to all review categories, extending beyond markdownlint to cover all reviews.
Applied to files:
.claude/plans/2026-03-18-InlineTypeExtraction.md
📚 Learning: 2026-02-17T01:37:29.373Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 29
File: .claude/plans/2026-02-16-ClaudeHistory-SummarizeMemorize-Implementation.md:11-15
Timestamp: 2026-02-17T01:37:29.373Z
Learning: Do not apply markdownlint to files under the .claude/ directory. This exemption covers design documents, plans, and archived content within .claude/ (e.g., .claude/plans/.../*.md). Treat these files as exempt from markdownlint rules to avoid false positives on non-standard or archival content.
Applied to files:
.claude/plans/2026-03-18-InlineTypeExtraction.md
📚 Learning: 2026-03-17T01:47:58.626Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 107
File: .claude/plans/2026-03-17-AITools.md:94-100
Timestamp: 2026-03-17T01:47:58.626Z
Learning: In the GenesisTools repository, files under .claude/plans/ are implementation plan/design documents and should not be flagged for security issues, missing implementation details, or other code-quality concerns. Treat these plan files as exempt; raise such concerns only in actual implementation files. This extends the existing exemption for the .claude/ directory.
Applied to files:
.claude/plans/2026-03-18-InlineTypeExtraction.md
📚 Learning: 2026-03-15T15:49:07.694Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 106
File: plugins/genesis-tools/skills/github/scripts/actions-cost.ts:154-163
Timestamp: 2026-03-15T15:49:07.694Z
Learning: In genesiscz/GenesisTools, standalone bun scripts (e.g., `plugins/genesis-tools/skills/github/scripts/actions-cost.ts`) do not have access to `SafeJSON` from `app/utils/json`. When these scripts must use native `JSON.parse`, suppress the `noRestrictedGlobals` Biome rule with `// biome-ignore lint/style/noRestrictedGlobals: standalone script without access to SafeJSON` on the specific line, rather than importing SafeJSON.
Applied to files:
src/automate/lib/builtins.ts
🧬 Code graph analysis (3)
src/ask/utils/cli.ts (3)
src/ask/types/chat.ts (1)
OutputFormat(84-84)src/ask/types/config.ts (1)
CLIOptions(1-28)src/ask/output/OutputManager.ts (1)
getOutputFormat(45-47)
src/automate/lib/step-runner.ts (1)
src/automate/lib/types.ts (1)
StepHandlerResult(79-82)
src/automate/lib/builtins.ts (1)
src/automate/lib/types.ts (3)
StepHandlerResult(79-82)PresetStep(18-39)ExecutionContext(58-65)
🪛 markdownlint-cli2 (0.21.0)
.claude/plans/2026-03-18-InlineTypeExtraction.md
[warning] 19-19: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 29-29: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 40-40: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 45-45: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 54-54: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 60-60: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 69-69: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 74-74: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 83-83: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 93-93: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 103-103: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 113-113: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 123-123: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 128-128: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 137-137: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 141-141: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 150-150: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 168-168: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 180-180: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 185-185: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 194-194: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 201-201: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 210-210: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 231-231: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 244-244: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 250-250: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 273-273: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 278-278: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 287-287: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 293-293: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 302-302: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 308-308: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
🔇 Additional comments (20)
src/markdown-cli/index.ts (1)
8-13: Type extraction for CLI options looks correct.
MarkdownCLIOptionscleanly replaces the inline shape and keeps the action handler typing explicit without altering behavior.Also applies to: 29-29
src/ask/providers/ProviderManager.ts (1)
20-23: Model metadata interface extraction is solid.The new
ModelMetadatatype and updated method signature stay consistent with existing usage and preserve behavior.Also applies to: 380-380
src/claude-history-dashboard/src/integrations/tanstack-query/root-provider.tsx (1)
3-6: Provider props extraction is clean and consistent.Using
ProviderPropsimproves readability and keeps the component contract unchanged.Also applies to: 15-15
src/mcp-manager/utils/command.utils.ts (1)
7-15: Command parsing type extraction is correctly applied.
ParsedCommandandKeyValuePairmap directly to existing return shapes, so this remains a safe, behavior-preserving refactor.Also applies to: 114-114, 131-131
src/utils/markdown/index.ts (1)
152-155: Table token return-type extraction looks good.
ParsedTableTokensis a clear replacement for the inline return shape with no behavioral impact.Also applies to: 157-157
src/github-release-notes/index.ts (1)
19-22: Repository identity typing update is correct.The new
RepoIdentityinterface cleanly replaces the inline return type while preserving parse behavior.Also applies to: 132-132
src/telegram/lib/TGClient.ts (1)
17-19: Typing-loop handle extraction is well done.
StopHandleimproves clarity of the public method contract without changing runtime behavior.Also applies to: 99-99
src/mcp-web-reader/utils/tokens.ts (1)
3-7: Token result type extraction is consistent and safe.
TokenLimitResultis a good named replacement for the inline return type, with unchanged logic.Also applies to: 18-18
src/ask/AIChat.ts (1)
22-25: Clean type extraction for_getEnginereturn contract.Using
EngineWithRestorekeeps the method signature clearer without changing behavior.Also applies to: 249-249
src/Internal/LoggerLib/Logger.ts (1)
710-714:FileTransportOptionsextraction looks good.This keeps the transport API clearer and consistent with the PR’s interface-extraction goal.
Also applies to: 716-716
src/ask/utils/websearch.ts (1)
4-8: Nice interface extraction for tool execute params.
WebSearchParamsmakes the execute contract explicit and easier to reuse.Also applies to: 184-184
src/macos-resources/index.tsx (1)
114-131: Memoized component prop typing refactor is solid.The extracted prop interfaces improve readability and keep memoized component signatures consistent.
Also applies to: 168-168, 194-194, 203-203, 225-225
src/mcp-tsc/LspWorker.ts (1)
67-75: Good type contract cleanup in LSP worker.Using named interfaces for diagnostics notifications and queue stats improves maintainability with no behavioral drift.
Also applies to: 288-289, 910-910
src/azure-devops/commands/timelog/prepare-import.ts (1)
45-64: Handler option interfaces are a good extraction.This makes the command handler contracts clearer and consistent across subcommands.
Also applies to: 107-107, 211-211, 231-231, 300-300
src/ask/utils/cli.ts (1)
6-14: Type extraction for CLI result shapes looks good.
ValidationResultandOutputFormatResultmake return contracts clearer and easier to consume.Also applies to: 170-170, 255-255, 275-275
src/automate/lib/types.ts (1)
78-82:StepHandlerResultextraction is a good shared-contract improvement.This cleanly centralizes a cross-module return shape and keeps handlers/runner signatures aligned.
.claude/plans/2026-03-18-InlineTypeExtraction.md (1)
1-346: Plan document only — no actionable implementation review comments.This file is a planning artifact under
.claude/plans/, so I’m intentionally skipping implementation-level/code-quality feedback here.Based on learnings: In GenesisTools, files under
.claude/plans/are design/implementation plans and are exempt from code-quality/security/markdownlint review comments.src/automate/lib/step-runner.ts (1)
8-21: Step-handler type unification is correct and non-functional.
executeStepnow consistently advertisesPromise<StepHandlerResult>, matching the shared type contract and current return shapes.src/automate/lib/builtins.ts (2)
6-79: Built-in handler return-type consolidation looks good.The
StepHandlerResultmigration is consistent acrossexecuteBuiltin,handleIf,handleLog, andhandlePrompt.
165-165:handleSetsignature update is aligned with shared step-handler typing.Return contract remains compatible while reducing inline type duplication.
94cc152 to
54b8433
Compare
Summary
types.tsBy module:
ValidationResult,OutputFormatResult,EngineWithRestore,WebSearchParams,ModelMetadataParsedCommand,KeyValuePairLspDiagnosticsNotification,QueueStatsRepoIdentityStopHandleMemoizedHeaderProps,MemoizedCellProps,MemoizedNotificationsPanelProps,MemoizedCommandPanelPropsProviderPropsMarkdownCLIOptionsTimelogAddOptions,TimelogRemoveOptions,TimelogListOptions,TimelogClearOptionsStepHandlerResult(shared intypes.ts, used inbuiltins.ts+step-runner.ts)ParsedTableTokensTokenLimitResultFileTransportOptionsTest plan
tsgo --noEmitpasses with zero errors after every commit and at the endSummary by CodeRabbit
Refactor
Improvements