Skip to content

feat: add zero-config style guide support with VECTORLINT.md#51

Merged
oshorefueled merged 15 commits intomainfrom
ft/vectorlint-md
Jan 12, 2026
Merged

feat: add zero-config style guide support with VECTORLINT.md#51
oshorefueled merged 15 commits intomainfrom
ft/vectorlint-md

Conversation

@ayo6706
Copy link
Collaborator

@ayo6706 ayo6706 commented Jan 8, 2026

This PR introduces a "Zero-Config" mode that allows users to start linting immediately by placing a VECTORLINT.md file in their project root. It eliminates the need for a .vectorlint.ini file for simple use cases while ensuring global style instructions are respected across all evaluations.

Key Changes

  • Zero-Config Mode: vectorlint now automatically detects VECTORLINT.md. If no config file exists, it generates a default configuration and creates a synthetic "Style Guide Compliance" rule.
  • Prompt Injection: The content of VECTORLINT.md is now prepended to the system prompt for all evaluations, acting as a global context (e.g., for tone, voice, and terminology).
  • CLI Updates: Updated vectorlint init with new flags:
    • --quick: Creates only VECTORLINT.md for immediate start.
    • --full: Creates both VECTORLINT.md and .vectorlint.ini.
  • Config Loader: Refactored loadConfig to return an in-memory default configuration when running in zero-config mode.

How to Test

  1. Quick Start:

Run without existing config

vectorlint init --quick

(Add some rules to VECTORLINT.md)

vectorlint README.md
2. Combined Mode:
vectorlint init --full

Run evaluations; VECTORLINT.md content will be included in the prompt context

Motivation

Simplifies the onboarding process for new users and provides a standard way to define global style instructions (like "Voice and Tone") that apply to every rule in the system.

Summary by CodeRabbit

  • New Features

    • Zero-Config Mode: quick-init creates a local style guide for immediate linting; new init options (--quick, --full) control created files.
    • Local style guide content is included in prompts for checks.
  • Documentation

    • Quick Start and config docs reorganized to highlight Zero-Config flow, credential setup, and new quick/full paths.
  • Bug Fixes

    • Warns when a local style guide is unusually large; clearer missing-config messaging.
  • Tests

    • Added tests for init behavior, zero-config loading, and loader error messaging.
  • Chores

    • Added the local style guide filename to ignore patterns.

✏️ Tip: You can customize this high-level summary in your review settings.

- Add STYLE_GUIDE_FILENAME constant for default style guide file name
- Add STYLE_GUIDE_TOKEN_WARNING_THRESHOLD constant for token limit warnings
- These constants support the style guide feature for content evaluation
- Import STYLE_GUIDE_FILENAME constant for style guide file detection
- Update resolveConfigPath return type to string | undefined instead of throwing error
- Return undefined when no config file is found instead of throwing ConfigError
- Implement zero-config mode that detects VECTORLINT.md style guide file
- Return default configuration with StyleGuide rule when style guide exists
- Preserve original error handling for cases where neither config nor style guide exists
- Enables users to run vectorlint without explicit configuration file when style guide is present
- Create new StyleGuideLoader boundary module for loading VECTORLINT.md files
- Implement estimateTokens utility function using 4 characters per token approximation
- Add loadStyleGuide function to read style guide from specified directory
- Include token count warnings when style guide exceeds recommended threshold
- Return StyleGuideResult interface with content, token estimate, and file path
- Handle file not found and read errors gracefully with appropriate warnings
- Enables zero-config mode to automatically detect and load project style guides
- Add style guide loading from VECTORLINT.md file during command initialization
- Pass loaded style guide content to DefaultRequestBuilder for prompt construction
- Implement zero-config mode that creates synthetic style guide prompt when no rules are configured but VECTORLINT.md exists
- Add createStyleGuidePrompt helper function to generate style guide compliance evaluation prompts
- Update request builder to prepend style guide content to prompt body with proper formatting
- Add verbose logging for style guide loading and zero-config mode activation
- Improve error messaging to distinguish between missing rules and missing style guide scenarios
- Import STYLE_GUIDE_FILENAME constant for style guide file reference
- Add STYLE_GUIDE_TEMPLATE with default writing style, terminology, and tone guidelines
- Add --quick option to create only style guide for zero-config usage
- Add --full option to create both config and style guide files
- Refactor file existence checks to handle both config and style guide files
- Update file creation logic to conditionally write config and style guide based on options
- Enhance success output to display both created files
- Update next steps guidance to include style guide editing instructions
- Improve user experience by supporting multiple initialization workflows
…config

- Add init-command.test.ts with tests for default, --quick, and --full modes
- Test backward compatibility with .vectorlint.ini creation
- Test VECTORLINT.md style guide file creation with --quick flag
- Test simultaneous creation of both config files with --full flag
- Add tests for --force flag to overwrite existing files
- Add tests to verify existing files are respected without --force
- Add zero-config.test.ts with tests for style guide detection
- Test default config generation when only VECTORLINT.md exists
- Test preference for .vectorlint.ini when both files are present
- Test error handling when neither configuration file exists
- Ensure StyleGuide rule is applied in zero-config mode
- Add VECTORLINT.md to .gitignore to prevent accidental commits
- Document global style guide feature in CONFIGURATION.md with zero-config and combined modes
- Explain automatic style guide detection and synthetic rule creation
- Add token limit warning for large VECTORLINT.md files
- Restructure README quick start section with numbered steps
- Add zero-config mode instructions with --quick flag
- Clarify full configuration setup and API key configuration steps
- Improve readability with clearer hierarchy and examples
@coderabbitai
Copy link

coderabbitai bot commented Jan 8, 2026

📝 Walkthrough

Walkthrough

Adds zero‑config support by detecting a local style guide (VECTORLINT.md), loading and token‑estimating it, integrating it into CLI prompts and request building, extending init with --quick/--full options, and updating docs, constants, and tests accordingly.

Changes

Cohort / File(s) Summary
Constants & Defaults
src/config/constants.ts
Add exported constants (STYLE_GUIDE_FILENAME, STYLE_GUIDE_TOKEN_WARNING_THRESHOLD, DEFAULT_CONCURRENCY, ZERO_CONFIG_PACK_NAME, ZERO_CONFIG_PROMPT_ID, DEFAULT_SCAN_PATTERN); derive ALLOWED_EXTS from a local EXTENSIONS array.
Style‑Guide Loader
src/boundaries/style-guide-loader.ts
New module: loads VECTORLINT.md, returns StyleGuideResult (content/tokenEstimate/path), estimates tokens (~4 chars/token), warns if over threshold, and handles IO errors gracefully.
Config Loader (zero‑config)
src/boundaries/config-loader.ts
resolveConfigPath returns `string
CLI Integration
src/cli/commands.ts, src/cli/init-command.ts
CLI loads style guide at startup (verbose logs); commands can synthesize a prompt in zero‑config and pass style guide content to the request builder; init gains --quick/--full to create VECTORLINT.md (and/or config), detects conflicts, and respects --force.
Request Builder
src/providers/request-builder.ts
DefaultRequestBuilder gains a styleGuide field and optional constructor param; when provided, prepends style guide content to structured prompt bodies.
Docs & Repo Files
.gitignore, CONFIGURATION.md, README.md
Add VECTORLINT.md to .gitignore; document Zero‑Config/Combined modes and quick‑init flow; reorganize Quick Start and config initialization instructions.
Tests
tests/style-guide/*, tests/config-loader-error.test.ts
New tests for init quick/full behavior, zero‑config load precedence and defaults, and error messaging when neither config nor style guide exists.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as CLI (commands / init)
    participant CL as Config Loader
    participant SGL as Style Guide Loader
    participant RB as Request Builder
    participant LLM as LLM Provider

    CLI->>CL: loadConfig(cwd)
    CL->>CL: resolveConfigPath()
    alt INI config found
        CL-->>CLI: return parsed config
    else no INI
        CL->>SGL: loadStyleGuide(cwd)
        alt style guide exists
            SGL-->>CL: StyleGuideResult(content,tokens,path)
            CL-->>CLI: return default in‑code config
        else no style guide
            CL-->>CLI: throw ConfigError
        end
    end

    CLI->>SGL: loadStyleGuide(cwd)
    SGL-->>CLI: StyleGuideResult
    CLI->>RB: new DefaultRequestBuilder(directive, styleGuide?)
    RB->>RB: prepend style guide to prompt (if provided)
    CLI->>LLM: send composed prompt
    LLM-->>CLI: response
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • oshorefueled
  • hurshore

"I hop through folders, nibble tokens with glee,
VECTORLINT.md hums a zero-config key.
I tuck guidance in prompts, tidy and light,
Quick-init or full — I wiggle my whiskers tonight. 🐇"

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% 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 pull request title 'feat: add zero-config style guide support with VECTORLINT.md' accurately and concisely summarizes the main change, which is introducing zero-config mode via VECTORLINT.md file support.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
README.md (1)

81-101: Inconsistent step numbering in Quick Start section.

The section header uses ### 3. Configure API Keys, but line 93 still shows 3. **Run a check:** which creates duplicate step 3s. This appears to be leftover content from a previous structure.

Consider renumbering or restructuring to maintain consistent flow:

📝 Suggested fix
-3.  **Run a check:**
+4.  **Run a check:**

Or restructure as a sub-step under the Configure API Keys section.

🤖 Fix all issues with AI agents
In @.gitignore:
- Line 15: Remove the "VECTORLINT.md" entry from the .gitignore file so the
style guide is tracked in version control; open the .gitignore, delete the line
containing "VECTORLINT.md" (the literal entry shown), commit the change so
VECTORLINT.md can be added and shared across the team and CI.

In @src/boundaries/config-loader.ts:
- Around line 63-84: The zero-config default scan pattern returned when iniPath
is falsy currently uses "**/*.{md,mdx}" but isSupportedPattern validates md,
txt, and mdx; update the default pattern in the object returned (inside the
iniPath falsy branch that checks STYLE_GUIDE_FILENAME) to include txt (e.g.,
"**/*.{md,mdx,txt}") so .txt files are included in zero-config linting; keep the
rest of the returned shape (concurrency, configDir, runRules, overrides)
unchanged.
🧹 Nitpick comments (3)
tests/style-guide/init-command.test.ts (1)

32-43: Potential test isolation issue with Commander's singleton program.

Each test dynamically imports commander's program, but Commander uses a singleton pattern. While testProgram = program.createCommand() creates a new command instance, the repeated dynamic imports and command registrations may lead to subtle test pollution if modules are cached.

Consider extracting the setup into a helper or ensuring module cache is reset between tests:

♻️ Alternative approach using fresh Command instance
+ import { Command } from 'commander';
+
  it('default: creates only .vectorlint.ini (backward compatibility)', async () => {
      const { registerInitCommand } = await import('../../src/cli/init-command');
-     const { program } = await import('commander');
-
-     const testProgram = program.createCommand();
+     const testProgram = new Command();
      registerInitCommand(testProgram);

      await testProgram.parseAsync(['node', 'test', 'init']);
src/cli/commands.ts (1)

238-252: Consider making the synthetic prompt body more descriptive or configurable.

The createStyleGuidePrompt function is well-structured. However, the hardcoded body string is relatively brief. If the style guide contains detailed instructions, this prompt body might benefit from being slightly more directive about how to apply those instructions.

That said, the current implementation is functional and the style guide content itself (prepended via DefaultRequestBuilder) provides the detailed context.

src/boundaries/style-guide-loader.ts (1)

5-9: Consider adding a Zod schema for the result type.

Per coding guidelines for src/boundaries/**/*.ts, Zod schemas should be used for boundary validation. While the style guide content itself is free-form markdown, you could still define a Zod schema for the result structure for consistency:

♻️ Optional Zod schema
import { z } from 'zod';

const StyleGuideResultSchema = z.object({
  content: z.string().nullable(),
  tokenEstimate: z.number(),
  path: z.string().nullable(),
});

export type StyleGuideResult = z.infer<typeof StyleGuideResultSchema>;

That said, since this is an internal result type (not parsing external data format), the current TypeScript interface is reasonable.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0fddb2c and 5dc1500.

📒 Files selected for processing (11)
  • .gitignore
  • CONFIGURATION.md
  • README.md
  • src/boundaries/config-loader.ts
  • src/boundaries/style-guide-loader.ts
  • src/cli/commands.ts
  • src/cli/init-command.ts
  • src/config/constants.ts
  • src/providers/request-builder.ts
  • tests/style-guide/init-command.test.ts
  • tests/style-guide/zero-config.test.ts
🧰 Additional context used
📓 Path-based instructions (4)
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Use TypeScript ESM with explicit imports and narrow types
Use 2-space indentation; avoid trailing whitespace
Maintain strict TypeScript with no any; use unknown + schema validation for external data
Use custom error types with proper inheritance; catch blocks use unknown type

Files:

  • src/config/constants.ts
  • src/cli/init-command.ts
  • src/boundaries/style-guide-loader.ts
  • src/boundaries/config-loader.ts
  • src/providers/request-builder.ts
  • src/cli/commands.ts
tests/**/*.test.ts

📄 CodeRabbit inference engine (AGENTS.md)

tests/**/*.test.ts: Write tests using Vitest framework with focus on config parsing, file discovery, schema/structured output, and locator
Use dependency injection in tests: mock providers; do not hit network in unit tests

Files:

  • tests/style-guide/zero-config.test.ts
  • tests/style-guide/init-command.test.ts
src/boundaries/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use Zod schemas for boundary validation of all external data (files, CLI, env, APIs) at system boundaries

Files:

  • src/boundaries/style-guide-loader.ts
  • src/boundaries/config-loader.ts
src/providers/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/providers/**/*.ts: Depend on LLMProvider and SearchProvider interfaces; keep providers thin (transport only)
Inject RequestBuilder via provider constructor to avoid coupling

Files:

  • src/providers/request-builder.ts
🧠 Learnings (7)
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to .vectorlint.ini : Use `[glob/pattern]` sections in `.vectorlint.ini` to specify which packs run on which files

Applied to files:

  • .gitignore
  • CONFIGURATION.md
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to tests/**/*.test.ts : Write tests using Vitest framework with focus on config parsing, file discovery, schema/structured output, and locator

Applied to files:

  • tests/style-guide/zero-config.test.ts
  • tests/style-guide/init-command.test.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/boundaries/**/*.ts : Use Zod schemas for boundary validation of all external data (files, CLI, env, APIs) at system boundaries

Applied to files:

  • src/boundaries/config-loader.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/providers/**/*.ts : Inject `RequestBuilder` via provider constructor to avoid coupling

Applied to files:

  • src/providers/request-builder.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/providers/**/*.ts : Depend on `LLMProvider` and `SearchProvider` interfaces; keep providers thin (transport only)

Applied to files:

  • src/cli/commands.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/**/*.ts : Use custom error types with proper inheritance; catch blocks use `unknown` type

Applied to files:

  • src/cli/commands.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/**/*.ts : Maintain strict TypeScript with no `any`; use `unknown` + schema validation for external data

Applied to files:

  • src/cli/commands.ts
🧬 Code graph analysis (6)
tests/style-guide/zero-config.test.ts (1)
src/config/constants.ts (2)
  • STYLE_GUIDE_FILENAME (15-15)
  • DEFAULT_CONFIG_FILENAME (12-12)
src/cli/init-command.ts (2)
src/config/constants.ts (2)
  • STYLE_GUIDE_FILENAME (15-15)
  • DEFAULT_CONFIG_FILENAME (12-12)
src/config/global-config.ts (1)
  • ensureGlobalConfig (63-76)
src/boundaries/style-guide-loader.ts (1)
src/config/constants.ts (2)
  • STYLE_GUIDE_FILENAME (15-15)
  • STYLE_GUIDE_TOKEN_WARNING_THRESHOLD (16-16)
src/boundaries/config-loader.ts (2)
src/config/constants.ts (2)
  • STYLE_GUIDE_FILENAME (15-15)
  • DEFAULT_CONFIG_FILENAME (12-12)
src/errors/index.ts (1)
  • ConfigError (18-23)
tests/style-guide/init-command.test.ts (2)
src/cli/init-command.ts (1)
  • registerInitCommand (58-127)
src/config/constants.ts (2)
  • DEFAULT_CONFIG_FILENAME (12-12)
  • STYLE_GUIDE_FILENAME (15-15)
src/cli/commands.ts (4)
src/boundaries/style-guide-loader.ts (1)
  • loadStyleGuide (23-61)
src/config/constants.ts (1)
  • STYLE_GUIDE_FILENAME (15-15)
src/providers/request-builder.ts (1)
  • DefaultRequestBuilder (7-24)
src/prompts/prompt-loader.ts (1)
  • PromptFile (8-8)
🪛 GitHub Actions: Test
tests/style-guide/zero-config.test.ts

[error] 30-30: AssertionError: expected '/*.{md,mdx}' to be '/*.{md,txt,mdx}'

🪛 GitHub Check: Test
tests/style-guide/zero-config.test.ts

[failure] 30-30: tests/style-guide/zero-config.test.ts > Zero-Config Loading > returns default config when only VECTORLINT.md exists
AssertionError: expected '/*.{md,mdx}' to be '/*.{md,txt,mdx}' // Object.is equality

Expected: "/*.{md,txt,mdx}"
Received: "
/*.{md,mdx}"

❯ tests/style-guide/zero-config.test.ts:30:46

🪛 LanguageTool
CONFIGURATION.md

[style] ~77-~77: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...g if the file exceeds ~4,000 tokens, as very large contexts can degrade performance and in...

(EN_WEAK_ADJECTIVE)

🔇 Additional comments (15)
src/providers/request-builder.ts (2)

7-14: LGTM! Clean style guide integration.

The optional styleGuide parameter and field are properly typed and initialized, following TypeScript best practices.


16-23: LGTM! Style guide prepend logic is correct.

The style guide is correctly prepended with proper spacing when present, maintaining the original body and directive structure.

src/boundaries/config-loader.ts (1)

32-52: LGTM! Return type updated correctly for zero-config mode.

The function now appropriately returns string | undefined to support zero-config mode when no configuration file exists.

tests/style-guide/zero-config.test.ts (3)

21-33: Test expectation is correct; production code needs fixing.

The test correctly expects **/*.{md,txt,mdx} based on the isSupportedPattern validation. The pipeline failure is caused by the production code in src/boundaries/config-loader.ts (line 73) using **/*.{md,mdx} instead. Fix the production code pattern to include .txt as flagged in the config-loader.ts review.

Based on pipeline failures, ensure the fix in src/boundaries/config-loader.ts resolves this test failure.


35-51: LGTM! Precedence test correctly validates INI file priority.

The test properly verifies that when both VECTORLINT.md and .vectorlint.ini exist, the INI configuration takes precedence, which is the expected behavior for combined mode.


53-55: LGTM! Error handling test is correct.

The test properly validates that an error is thrown when neither configuration file exists, ensuring appropriate user feedback.

src/config/constants.ts (1)

15-16: LGTM!

The new constants are well-named and appropriately placed alongside other configuration constants. The token threshold of 4000 is a reasonable default for LLM context considerations.

tests/style-guide/init-command.test.ts (1)

74-92: Good coverage of existing file protection.

The test correctly validates that:

  1. Pre-existing files are not overwritten without --force
  2. Original content is preserved
  3. The command exits with an error

The use of exitOverride() to prevent actual process exit is the right approach for testing error paths.

src/cli/commands.ts (2)

81-95: Good integration of style guide loading into the CLI flow.

The style guide is loaded early, logged appropriately in verbose mode, and passed correctly to DefaultRequestBuilder. The || undefined coercion on line 94 properly handles the nullable content for the optional parameter.


147-162: Zero-config mode logic is well-structured.

The fallback to a synthetic style guide prompt when no rules are found but a style guide exists provides a smooth zero-config experience. The differentiated error messages based on whether rulesPath was configured help users understand what's missing.

src/cli/init-command.ts (3)

19-45: Helpful style guide template with practical examples.

The template provides a good starting point with clear sections for Writing Style, Terminology, and Tone. The HTML comments explaining how VectorLint uses the file are useful for onboarding.


70-71: Option logic is correct and handles edge cases well.

The logic ensures:

  • Default (no flags): creates only config (createConfig=true, createStyleGuide=false)
  • --quick: creates only style guide (createConfig=false, createStyleGuide=true)
  • --full: creates both (createConfig=true, createStyleGuide=true)
  • --quick --full: creates both (full takes precedence)

77-88: Good UX for handling existing files.

Aggregating all conflicting files into a single error message (rather than failing on the first one) provides better user feedback. The bulleted list format is clear.

src/boundaries/style-guide-loader.ts (2)

15-17: Token estimation is appropriately documented as approximate.

The 4 chars/token heuristic is a reasonable rough estimate. The docstring clearly states it's an approximation, which sets correct expectations. For more accuracy in the future, you could consider using a tokenizer library, but for warning thresholds this approximation is sufficient.


51-59: Good error handling following coding guidelines.

The catch block correctly types the error as unknown and extracts the message safely. Returning the path even on error (line 58) is a thoughtful design choice that lets callers know the file existed but couldn't be read.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @src/boundaries/config-loader.ts:
- Around line 63-79: The zero-config branch returns a hardcoded config when
STYLE_GUIDE_FILENAME exists (the block using iniPath and styleGuidePath) but
never validates it against CONFIG_SCHEMA; update that branch to construct the
same default object and pass it through CONFIG_SCHEMA.parse(...) (same
validation used for INI parsing) before returning, ensuring the default shape
matches future schema changes and referencing the existing symbols iniPath,
STYLE_GUIDE_FILENAME, and CONFIG_SCHEMA.parse to locate where to perform the
validation.
🧹 Nitpick comments (1)
src/boundaries/config-loader.ts (1)

81-84: Consider mentioning the zero-config alternative in the error message.

Users unfamiliar with zero-config mode may not realize they can place a VECTORLINT.md instead.

💡 Suggested improvement
     throw new ConfigError(
-      `Missing configuration file. Expected ${DEFAULT_CONFIG_FILENAME} in ${cwd}`
+      `Missing configuration file. Expected ${DEFAULT_CONFIG_FILENAME} or ${STYLE_GUIDE_FILENAME} in ${cwd}`
     );
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5dc1500 and adf424c.

📒 Files selected for processing (1)
  • src/boundaries/config-loader.ts
🧰 Additional context used
📓 Path-based instructions (2)
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Use TypeScript ESM with explicit imports and narrow types
Use 2-space indentation; avoid trailing whitespace
Maintain strict TypeScript with no any; use unknown + schema validation for external data
Use custom error types with proper inheritance; catch blocks use unknown type

Files:

  • src/boundaries/config-loader.ts
src/boundaries/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use Zod schemas for boundary validation of all external data (files, CLI, env, APIs) at system boundaries

Files:

  • src/boundaries/config-loader.ts
🧠 Learnings (2)
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to .vectorlint.ini : Use `[glob/pattern]` sections in `.vectorlint.ini` to specify which packs run on which files

Applied to files:

  • src/boundaries/config-loader.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to tests/**/*.test.ts : Write tests using Vitest framework with focus on config parsing, file discovery, schema/structured output, and locator

Applied to files:

  • src/boundaries/config-loader.ts
🧬 Code graph analysis (1)
src/boundaries/config-loader.ts (2)
src/config/constants.ts (2)
  • STYLE_GUIDE_FILENAME (15-15)
  • DEFAULT_CONFIG_FILENAME (12-12)
src/errors/index.ts (1)
  • ConfigError (18-23)
🔇 Additional comments (1)
src/boundaries/config-loader.ts (1)

32-52: LGTM - Clean signature change enabling zero-config mode.

The return type string | undefined correctly signals optional config resolution, and callers handle the undefined case appropriately.

…de prompt

- Add CONFIG_SCHEMA validation to default config in zero-config mode to ensure type safety
- Update style guide prompt body text to clarify evaluation against attached style guide rules
- Fix commander import pattern in tests from deprecated `program` to `Command` constructor
- Improve consistency across all test cases for style guide initialization
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/boundaries/config-loader.ts (1)

185-186: Remove duplicate comment.

There's a duplicated comment on lines 185-186.

Suggested fix
-  // Create config object and validate with schema
   // Create config object and validate with schema
   const configData = {
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between adf424c and 5e18915.

📒 Files selected for processing (3)
  • src/boundaries/config-loader.ts
  • src/cli/commands.ts
  • tests/style-guide/init-command.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/style-guide/init-command.test.ts
🧰 Additional context used
📓 Path-based instructions (2)
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Use TypeScript ESM with explicit imports and narrow types
Use 2-space indentation; avoid trailing whitespace
Maintain strict TypeScript with no any; use unknown + schema validation for external data
Use custom error types with proper inheritance; catch blocks use unknown type

Files:

  • src/boundaries/config-loader.ts
  • src/cli/commands.ts
src/boundaries/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use Zod schemas for boundary validation of all external data (files, CLI, env, APIs) at system boundaries

Files:

  • src/boundaries/config-loader.ts
🧠 Learnings (6)
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/boundaries/**/*.ts : Use Zod schemas for boundary validation of all external data (files, CLI, env, APIs) at system boundaries

Applied to files:

  • src/boundaries/config-loader.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to .vectorlint.ini : Use `[glob/pattern]` sections in `.vectorlint.ini` to specify which packs run on which files

Applied to files:

  • src/boundaries/config-loader.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/boundaries/env-parser.ts : All environment variables must be validated via Zod schemas in `src/boundaries/env-parser.ts`

Applied to files:

  • src/boundaries/config-loader.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/**/*.ts : Maintain strict TypeScript with no `any`; use `unknown` + schema validation for external data

Applied to files:

  • src/boundaries/config-loader.ts
  • src/cli/commands.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/providers/**/*.ts : Depend on `LLMProvider` and `SearchProvider` interfaces; keep providers thin (transport only)

Applied to files:

  • src/cli/commands.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/**/*.ts : Use custom error types with proper inheritance; catch blocks use `unknown` type

Applied to files:

  • src/cli/commands.ts
🧬 Code graph analysis (2)
src/boundaries/config-loader.ts (3)
src/config/constants.ts (2)
  • STYLE_GUIDE_FILENAME (15-15)
  • DEFAULT_CONFIG_FILENAME (12-12)
src/schemas/config-schemas.ts (1)
  • CONFIG_SCHEMA (4-14)
src/errors/index.ts (1)
  • ConfigError (18-23)
src/cli/commands.ts (5)
src/boundaries/style-guide-loader.ts (1)
  • loadStyleGuide (23-61)
src/config/constants.ts (1)
  • STYLE_GUIDE_FILENAME (15-15)
src/providers/request-builder.ts (1)
  • DefaultRequestBuilder (7-24)
src/schemas/prompt-schemas.ts (1)
  • PromptFile (80-80)
src/prompts/prompt-loader.ts (1)
  • PromptFile (8-8)
🔇 Additional comments (8)
src/boundaries/config-loader.ts (3)

12-12: LGTM!

Import of STYLE_GUIDE_FILENAME is correctly added to support zero-config mode detection.


32-52: LGTM!

The signature change to return string | undefined is appropriate for zero-config support. The caller (loadConfig) correctly handles the undefined case by falling back to style-guide detection.


63-85: LGTM!

The zero-config logic is well-structured:

  1. Correctly checks for VECTORLINT.md when no config file is found
  2. Default config is properly validated through CONFIG_SCHEMA.parse()
  3. Error message is clear when neither config nor style guide exists

The default config structure aligns with the schema requirements from src/schemas/config-schemas.ts.

src/cli/commands.ts (5)

10-10: LGTM!

Imports are correctly added for the new style guide functionality and related types.

Also applies to: 22-23


81-86: LGTM!

Style guide loading is properly integrated with verbose logging to aid debugging.


94-94: LGTM!

Correctly converts null to undefined to match the DefaultRequestBuilder constructor's optional parameter signature.


147-163: LGTM!

Zero-config fallback logic is well-structured:

  • Gracefully creates a synthetic prompt when style guide exists but no rules are found
  • Preserves original error handling for cases where neither exists
  • Verbose logging helps users understand the mode being used

238-252: LGTM!

The synthetic prompt is well-defined:

  • Uses StyleGuide pack name matching the zero-config runRules configuration
  • Appropriate default severity of WARNING for style guide violations
  • Body text clearly indicates evaluation against the attached style guide

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/boundaries/config-loader.ts (1)

32-52: Add Zod schema validation for external inputs to resolveConfigPath.

The function accepts two pieces of external data (configPath from CLI/env and cwd from the process) but does not validate them against a Zod schema before use. Per the coding guidelines, all external data at system boundaries must be validated with Zod schemas. Create a schema for the inputs and apply validation at the function entry point.

No external callers of resolveConfigPath exist outside this file, so the signature change is safe. The internal caller at line 63 properly handles the undefined return value.

🧹 Nitpick comments (1)
src/boundaries/config-loader.ts (1)

63-85: "StyleGuide" rule is correctly created and resolved; optional refactor for magic strings remains valid.

Verification confirms the zero-config logic is sound. The hardcoded "StyleGuide" rule is properly created by the createStyleGuidePrompt() function in src/cli/commands.ts when VECTORLINT.md exists and no other rules are found. The ScanPathResolver correctly resolves runRules: ["StyleGuide"] from the config against available prompts. The CONFIG_SCHEMA.parse() at line 79 properly validates the default configuration using Zod, following the boundary validation guideline.

The optional refactor suggestion to extract magic strings ("StyleGuide" and the default config object) to named constants remains valid for maintainability and testability, but is not required for functional correctness.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e18915 and c010793.

📒 Files selected for processing (1)
  • src/boundaries/config-loader.ts
🧰 Additional context used
📓 Path-based instructions (2)
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Use TypeScript ESM with explicit imports and narrow types
Use 2-space indentation; avoid trailing whitespace
Maintain strict TypeScript with no any; use unknown + schema validation for external data
Use custom error types with proper inheritance; catch blocks use unknown type

Files:

  • src/boundaries/config-loader.ts
src/boundaries/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use Zod schemas for boundary validation of all external data (files, CLI, env, APIs) at system boundaries

Files:

  • src/boundaries/config-loader.ts
🧠 Learnings (3)
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/boundaries/**/*.ts : Use Zod schemas for boundary validation of all external data (files, CLI, env, APIs) at system boundaries

Applied to files:

  • src/boundaries/config-loader.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to .vectorlint.ini : Use `[glob/pattern]` sections in `.vectorlint.ini` to specify which packs run on which files

Applied to files:

  • src/boundaries/config-loader.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/boundaries/env-parser.ts : All environment variables must be validated via Zod schemas in `src/boundaries/env-parser.ts`

Applied to files:

  • src/boundaries/config-loader.ts
🧬 Code graph analysis (1)
src/boundaries/config-loader.ts (3)
src/config/constants.ts (2)
  • STYLE_GUIDE_FILENAME (15-15)
  • DEFAULT_CONFIG_FILENAME (12-12)
src/schemas/config-schemas.ts (1)
  • CONFIG_SCHEMA (4-14)
src/errors/index.ts (1)
  • ConfigError (18-23)
🔇 Additional comments (1)
src/boundaries/config-loader.ts (1)

12-12: LGTM: Clean import of style guide constant.

The import of STYLE_GUIDE_FILENAME is properly sourced from constants and used consistently in the zero-config logic.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/boundaries/config-loader.ts (1)

36-42: Consider whether input validation schema is necessary here.

The RESOLVE_CONFIG_PATH_SCHEMA validates simple string parameters that are already typed by TypeScript. Since resolveConfigPath is an internal helper function (not exported), and the inputs come from already-validated sources (the public loadConfig function receives cwd with a default and optional configPath), this Zod validation may be redundant.

Per coding guidelines, Zod schemas should validate external data at boundaries. However, these parameters are internal function arguments, not external inputs.

♻️ Consider removing the validation schema
-const RESOLVE_CONFIG_PATH_SCHEMA = z.object({
-  cwd: z.string(),
-  configPath: z.string().optional(),
-});
-
 function resolveConfigPath(cwd: string, configPath?: string): string | undefined {
-  RESOLVE_CONFIG_PATH_SCHEMA.parse({ cwd, configPath });
   if (configPath) {
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c010793 and 5a23665.

📒 Files selected for processing (4)
  • src/boundaries/config-loader.ts
  • src/cli/commands.ts
  • src/config/constants.ts
  • tests/config-loader-error.test.ts
🧰 Additional context used
📓 Path-based instructions (3)
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Use TypeScript ESM with explicit imports and narrow types
Use 2-space indentation; avoid trailing whitespace
Maintain strict TypeScript with no any; use unknown + schema validation for external data
Use custom error types with proper inheritance; catch blocks use unknown type

Files:

  • src/boundaries/config-loader.ts
  • src/cli/commands.ts
  • src/config/constants.ts
src/boundaries/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use Zod schemas for boundary validation of all external data (files, CLI, env, APIs) at system boundaries

Files:

  • src/boundaries/config-loader.ts
tests/**/*.test.ts

📄 CodeRabbit inference engine (AGENTS.md)

tests/**/*.test.ts: Write tests using Vitest framework with focus on config parsing, file discovery, schema/structured output, and locator
Use dependency injection in tests: mock providers; do not hit network in unit tests

Files:

  • tests/config-loader-error.test.ts
🧠 Learnings (6)
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/boundaries/**/*.ts : Use Zod schemas for boundary validation of all external data (files, CLI, env, APIs) at system boundaries

Applied to files:

  • src/boundaries/config-loader.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/boundaries/env-parser.ts : All environment variables must be validated via Zod schemas in `src/boundaries/env-parser.ts`

Applied to files:

  • src/boundaries/config-loader.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to .vectorlint.ini : Use `[glob/pattern]` sections in `.vectorlint.ini` to specify which packs run on which files

Applied to files:

  • src/boundaries/config-loader.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/providers/**/*.ts : Depend on `LLMProvider` and `SearchProvider` interfaces; keep providers thin (transport only)

Applied to files:

  • src/cli/commands.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/**/*.ts : Use custom error types with proper inheritance; catch blocks use `unknown` type

Applied to files:

  • src/cli/commands.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to tests/**/*.test.ts : Write tests using Vitest framework with focus on config parsing, file discovery, schema/structured output, and locator

Applied to files:

  • tests/config-loader-error.test.ts
🧬 Code graph analysis (3)
src/boundaries/config-loader.ts (3)
src/config/constants.ts (5)
  • STYLE_GUIDE_FILENAME (15-15)
  • DEFAULT_CONCURRENCY (20-20)
  • DEFAULT_SCAN_PATTERN (23-23)
  • ZERO_CONFIG_PACK_NAME (21-21)
  • DEFAULT_CONFIG_FILENAME (12-12)
src/schemas/config-schemas.ts (1)
  • CONFIG_SCHEMA (4-14)
src/errors/index.ts (1)
  • ConfigError (18-23)
src/cli/commands.ts (5)
src/boundaries/style-guide-loader.ts (1)
  • loadStyleGuide (23-61)
src/config/constants.ts (3)
  • STYLE_GUIDE_FILENAME (15-15)
  • ZERO_CONFIG_PROMPT_ID (22-22)
  • ZERO_CONFIG_PACK_NAME (21-21)
src/providers/request-builder.ts (1)
  • DefaultRequestBuilder (7-24)
src/schemas/prompt-schemas.ts (1)
  • PromptFile (80-80)
src/prompts/prompt-loader.ts (1)
  • PromptFile (8-8)
tests/config-loader-error.test.ts (2)
src/boundaries/config-loader.ts (1)
  • loadConfig (67-214)
src/config/constants.ts (2)
  • DEFAULT_CONFIG_FILENAME (12-12)
  • STYLE_GUIDE_FILENAME (15-15)
🔇 Additional comments (9)
tests/config-loader-error.test.ts (1)

1-26: LGTM! Well-structured test for zero-config error messaging.

The test properly validates that the config loader throws an appropriate error message when neither configuration file nor style guide is present. The lifecycle management with temp directory creation and cleanup is correct.

src/boundaries/config-loader.ts (3)

41-62: LGTM! Return type change enables zero-config mode.

The change from throwing an error to returning undefined when no configuration file is found is the key enabler for zero-config mode. This allows the caller (loadConfig) to check for VECTORLINT.md and return a default configuration. The logic correctly checks explicit path → hidden config → legacy config → undefined.


73-95: LGTM! Zero-config logic correctly implements the feature.

The zero-config mode properly:

  1. Detects when no .vectorlint.ini exists
  2. Checks for VECTORLINT.md as an alternative
  3. Returns a valid default configuration with the synthetic StyleGuide pack
  4. Falls back to an informative error mentioning both expected filenames

The default configuration structure is validated by CONFIG_SCHEMA.parse(), ensuring type safety.


193-193: LGTM! Good use of constant over magic number.

Replacing the hardcoded default value with DEFAULT_CONCURRENCY improves maintainability and consistency with the zero-config default.

src/config/constants.ts (1)

15-23: LGTM! Well-organized zero-config constants with DRY improvements.

The new constants are correctly defined and support the zero-config feature:

  • Style guide filename and token threshold are clearly named
  • The refactoring to compute ALLOWED_EXTS and DEFAULT_SCAN_PATTERN from the EXTENSIONS array improves maintainability by defining the supported extensions in one place
  • Zero-config pack and prompt identifiers are consistent with usage throughout the codebase
src/cli/commands.ts (4)

81-85: LGTM! Style guide loading properly integrated.

The style guide is loaded early in the command execution and logged appropriately when verbose mode is enabled. Including the token estimate in the log helps users understand the impact on API costs.


94-94: LGTM! Style guide correctly passed to request builder.

The style guide content is properly threaded into the DefaultRequestBuilder, which will prepend it to all prompts. The || undefined conversion correctly handles the null case from StyleGuideResult.


148-163: LGTM! Zero-config fallback logic is well-designed.

The zero-config mode properly:

  1. Activates when no rule packs are found but a style guide exists
  2. Logs the mode activation for user awareness in verbose mode
  3. Creates a synthetic prompt for style guide compliance
  4. Provides differentiated error messages based on whether rulesPath was configured

The error messages help users understand whether they need to check their rules directory or configure presets.


238-252: LGTM! Synthetic prompt properly structured for zero-config mode.

The createStyleGuidePrompt helper correctly constructs a PromptFile with:

  • Clear evaluation instruction referencing the Global Style Guide
  • Appropriate severity level (WARNING) for zero-config usage
  • Consistent use of zero-config constants for identification
  • Base evaluator type suitable for general style guide compliance

The warning severity is a good default for zero-config mode, being less aggressive than errors while still flagging issues.

- Update CONFIGURATION.md to clarify that style guide evaluates all content types, not just markdown files
- Add prerequisite note in README.md about credential setup before running checks
- Remove unused zod schema validation from config-loader.ts resolveConfigPath function
- Simplify config path resolution by removing redundant type checking
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
README.md (1)

53-105: Fix the spurious list marker on the "Run a check" line.

The "3." prefix on line 97 ("3. Run a check:") is a formatting artifact within the Step 3 section and should be removed. Since the entire content block is already nested under "### 3. Configure API Keys", this line should not have its own numbered marker.

🔧 Proposed formatting fix
    *Note: You can also use a local `.env` file in your project, which takes precedence over the global config.*

-3.  **Run a check:**
+**Run a check:**

    ```bash
    vectorlint doc.md
🤖 Fix all issues with AI agents
In @CONFIGURATION.md:
- Around line 64-79: Documentation notes that VECTORLINT.md is used but lacks a
minimal example; add a short sample snippet to CONFIGURATION.md demonstrating a
basic VECTORLINT.md content (e.g., a few lines for tone, terminology, and
preferred formatting) so users can copy/paste for zero-config mode; ensure the
example mentions the token warning threshold and references the
STYLE_GUIDE_TOKEN_WARNING_THRESHOLD constant semantics to align text with
src/config/constants.ts.
🧹 Nitpick comments (1)
CONFIGURATION.md (1)

77-77: Strengthen the language on the token-limit note.

The phrase "very large contexts" uses an over-used intensifier. Consider a more specific or direct alternative (e.g., "large," "substantial," or "excessive").

✏️ Suggested revision
-> **Note:** Keep `VECTORLINT.md` concise. VectorLint will emit a warning if the file exceeds ~4,000 tokens, as large contexts can degrade performance and increase costs.
+> **Note:** Keep `VECTORLINT.md` concise. VectorLint will emit a warning if the file exceeds ~4,000 tokens, as large contexts can degrade performance and increase costs.

Alternatively, if you want to be even more specific:

-> **Note:** Keep `VECTORLINT.md` concise. VectorLint will emit a warning if the file exceeds ~4,000 tokens, as excessive context can degrade performance and increase costs.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5a23665 and 3be260b.

📒 Files selected for processing (3)
  • CONFIGURATION.md
  • README.md
  • src/boundaries/config-loader.ts
🧰 Additional context used
📓 Path-based instructions (2)
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Use TypeScript ESM with explicit imports and narrow types
Use 2-space indentation; avoid trailing whitespace
Maintain strict TypeScript with no any; use unknown + schema validation for external data
Use custom error types with proper inheritance; catch blocks use unknown type

Files:

  • src/boundaries/config-loader.ts
src/boundaries/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use Zod schemas for boundary validation of all external data (files, CLI, env, APIs) at system boundaries

Files:

  • src/boundaries/config-loader.ts
🧠 Learnings (3)
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/boundaries/**/*.ts : Use Zod schemas for boundary validation of all external data (files, CLI, env, APIs) at system boundaries

Applied to files:

  • src/boundaries/config-loader.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to .vectorlint.ini : Use `[glob/pattern]` sections in `.vectorlint.ini` to specify which packs run on which files

Applied to files:

  • src/boundaries/config-loader.ts
  • CONFIGURATION.md
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/boundaries/env-parser.ts : All environment variables must be validated via Zod schemas in `src/boundaries/env-parser.ts`

Applied to files:

  • src/boundaries/config-loader.ts
🧬 Code graph analysis (1)
src/boundaries/config-loader.ts (3)
src/config/constants.ts (5)
  • STYLE_GUIDE_FILENAME (15-15)
  • DEFAULT_CONCURRENCY (20-20)
  • DEFAULT_SCAN_PATTERN (23-23)
  • ZERO_CONFIG_PACK_NAME (21-21)
  • DEFAULT_CONFIG_FILENAME (12-12)
src/schemas/config-schemas.ts (1)
  • CONFIG_SCHEMA (4-14)
src/errors/index.ts (1)
  • ConfigError (18-23)
🪛 LanguageTool
CONFIGURATION.md

[style] ~77-~77: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...g if the file exceeds ~4,000 tokens, as very large contexts can degrade performance and in...

(EN_WEAK_ADJECTIVE)

🔇 Additional comments (5)
src/boundaries/config-loader.ts (5)

12-16: LGTM!

The new constant imports are well-organized and necessary for the zero-config functionality.


35-35: LGTM!

The signature change to string | undefined is appropriate for signaling "no config found" without throwing, enabling the zero-config flow.


54-55: LGTM!

Returning undefined instead of throwing allows the caller to implement zero-config fallback logic.


186-186: LGTM!

Using DEFAULT_CONCURRENCY constant ensures consistency between zero-config mode and the fallback for parsed configs.


66-88: Zero-config implementation is correct and properly constrained.

The zero-config logic correctly:

  • Falls back to VECTORLINT.md when no .ini config exists
  • Creates a default config validated through Zod schema (per boundary validation guidelines)
  • Uses DEFAULT_SCAN_PATTERN which is hardcoded from EXTENSIONS constant (['md', 'txt', 'mdx']), making it inherently safe

The EXTENSIONS constant is properly constrained to only the three supported file types, so DEFAULT_SCAN_PATTERN becomes **/*.{md,txt,mdx} at definition time. Unlike config files loaded from .ini paths (which require runtime validation via isSupportedPattern), the zero-config pattern cannot include unsupported file types by design and requires no additional validation.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
README.md (1)

76-83: Clarify what vectorlint init actually creates.

The description suggests vectorlint init creates both the VectorLint Config (.vectorlint.ini) and the global App Config (~/.vectorlint/config.toml). However, these are typically separate concerns:

  • Project-level config (.vectorlint.ini, VECTORLINT.md) is created by vectorlint init
  • Global app config (~/.vectorlint/config.toml) is a separate, user-level setup that users create or edit manually

The phrase "This creates:" followed by two items may suggest both are created by the same command, which could mislead users. Consider rewriting to clarify that Step 3 covers the separate global config setup.

✏️ Suggested revision
 This creates:
-- **VectorLint Config** (`.vectorlint.ini`): Project-specific settings.
-- **App Config** (`~/.vectorlint/config.toml`): LLM provider API keys.
+- **VectorLint Config** (`.vectorlint.ini`): Project-specific settings for rules and targets.
+- **Style Guide** (`VECTORLINT.md`): Your project's style guide and conventions.
+
+Next, configure your global API credentials in Step 3.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3be260b and ed05912.

📒 Files selected for processing (1)
  • README.md
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to .vectorlint.ini : Use `[glob/pattern]` sections in `.vectorlint.ini` to specify which packs run on which files

Applied to files:

  • README.md

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/cli/commands.ts (3)

94-94: Consider using nullish coalescing for clarity.

The expression styleGuide.content || undefined works correctly but could be slightly clearer with nullish coalescing: styleGuide.content ?? undefined.

♻️ Proposed refactor
-    new DefaultRequestBuilder(directive, styleGuide.content || undefined)
+    new DefaultRequestBuilder(directive, styleGuide.content ?? undefined)

147-162: Zero-config logic is solid, with one minor optimization opportunity.

The fallback on line 153 is unnecessary defensive code. When styleGuide.content is truthy, styleGuide.path is guaranteed to be set by the loader's success path. The error messages (lines 155-159) provide clear, context-aware feedback.

♻️ Optional: Remove unnecessary fallback
-            prompts.push(createStyleGuidePrompt(styleGuide.path || path.resolve(process.cwd(), STYLE_GUIDE_FILENAME)));
+            prompts.push(createStyleGuidePrompt(styleGuide.path!));

Since we're inside the if (styleGuide.content) block, the path is guaranteed to be non-null from the loader's success path.


237-251: Consider adding JSDoc to document zero-config behavior.

The helper function creates a synthetic prompt for zero-config mode, which is a key feature. Adding JSDoc would clarify its purpose, especially regarding:

  • When this synthetic prompt is used (no explicit rules, but VECTORLINT.md exists)
  • Why severity is set to WARNING
  • The relationship between the top-level id and meta.id fields
📝 Suggested JSDoc
+/**
+ * Creates a synthetic prompt for zero-config mode.
+ * Used when no explicit rule files exist but VECTORLINT.md is present.
+ * Generates a "Style Guide Compliance" rule that evaluates content against the style guide.
+ * @param fullPath - Absolute path to VECTORLINT.md
+ * @returns A PromptFile configured for zero-config style guide evaluation
+ */
 function createStyleGuidePrompt(fullPath: string): PromptFile {
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between add8f4a and 55fdc5d.

📒 Files selected for processing (1)
  • src/cli/commands.ts
🧰 Additional context used
📓 Path-based instructions (1)
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Use TypeScript ESM with explicit imports and narrow types
Use 2-space indentation; avoid trailing whitespace
Maintain strict TypeScript with no any; use unknown + schema validation for external data
Use custom error types with proper inheritance; catch blocks use unknown type

Files:

  • src/cli/commands.ts
🧠 Learnings (2)
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/providers/**/*.ts : Depend on `LLMProvider` and `SearchProvider` interfaces; keep providers thin (transport only)

Applied to files:

  • src/cli/commands.ts
📚 Learning: 2025-12-28T19:43:51.189Z
Learnt from: CR
Repo: TRocket-Labs/vectorlint PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T19:43:51.189Z
Learning: Applies to src/**/*.ts : Use custom error types with proper inheritance; catch blocks use `unknown` type

Applied to files:

  • src/cli/commands.ts
🧬 Code graph analysis (1)
src/cli/commands.ts (5)
src/boundaries/style-guide-loader.ts (1)
  • loadStyleGuide (23-61)
src/config/constants.ts (3)
  • STYLE_GUIDE_FILENAME (15-15)
  • ZERO_CONFIG_PROMPT_ID (22-22)
  • ZERO_CONFIG_PACK_NAME (21-21)
src/providers/request-builder.ts (1)
  • DefaultRequestBuilder (7-24)
src/schemas/prompt-schemas.ts (1)
  • PromptFile (80-80)
src/prompts/prompt-loader.ts (1)
  • PromptFile (8-8)
🔇 Additional comments (2)
src/cli/commands.ts (2)

10-10: LGTM! Clean imports following TypeScript ESM conventions.

The new imports for style guide support are properly structured with explicit named imports.

Also applies to: 22-23


81-85: LGTM! Style guide loading is clean and informative.

The verbose logging provides helpful feedback about token estimates, which aligns with the token warning feature in the loader.

@oshorefueled oshorefueled merged commit 37dcff8 into main Jan 12, 2026
3 checks passed
oshorefueled pushed a commit that referenced this pull request Mar 2, 2026
* chore(constants): Add style guide configuration constants

- Add STYLE_GUIDE_FILENAME constant for default style guide file name
- Add STYLE_GUIDE_TOKEN_WARNING_THRESHOLD constant for token limit warnings
- These constants support the style guide feature for content evaluation

* feat(config-loader): Support zero-config mode with style guide detection

- Import STYLE_GUIDE_FILENAME constant for style guide file detection
- Update resolveConfigPath return type to string | undefined instead of throwing error
- Return undefined when no config file is found instead of throwing ConfigError
- Implement zero-config mode that detects VECTORLINT.md style guide file
- Return default configuration with StyleGuide rule when style guide exists
- Preserve original error handling for cases where neither config nor style guide exists
- Enables users to run vectorlint without explicit configuration file when style guide is present

* feat(style-guide-loader): Add style guide loading with token estimation

- Create new StyleGuideLoader boundary module for loading VECTORLINT.md files
- Implement estimateTokens utility function using 4 characters per token approximation
- Add loadStyleGuide function to read style guide from specified directory
- Include token count warnings when style guide exceeds recommended threshold
- Return StyleGuideResult interface with content, token estimate, and file path
- Handle file not found and read errors gracefully with appropriate warnings
- Enables zero-config mode to automatically detect and load project style guides

* feat(cli): Integrate style guide loading into command execution

- Add style guide loading from VECTORLINT.md file during command initialization
- Pass loaded style guide content to DefaultRequestBuilder for prompt construction
- Implement zero-config mode that creates synthetic style guide prompt when no rules are configured but VECTORLINT.md exists
- Add createStyleGuidePrompt helper function to generate style guide compliance evaluation prompts
- Update request builder to prepend style guide content to prompt body with proper formatting
- Add verbose logging for style guide loading and zero-config mode activation
- Improve error messaging to distinguish between missing rules and missing style guide scenarios

* feat(cli): Add style guide initialization to init command

- Import STYLE_GUIDE_FILENAME constant for style guide file reference
- Add STYLE_GUIDE_TEMPLATE with default writing style, terminology, and tone guidelines
- Add --quick option to create only style guide for zero-config usage
- Add --full option to create both config and style guide files
- Refactor file existence checks to handle both config and style guide files
- Update file creation logic to conditionally write config and style guide based on options
- Enhance success output to display both created files
- Update next steps guidance to include style guide editing instructions
- Improve user experience by supporting multiple initialization workflows

* test(style-guide): Add comprehensive tests for init command and zero-config

- Add init-command.test.ts with tests for default, --quick, and --full modes
- Test backward compatibility with .vectorlint.ini creation
- Test VECTORLINT.md style guide file creation with --quick flag
- Test simultaneous creation of both config files with --full flag
- Add tests for --force flag to overwrite existing files
- Add tests to verify existing files are respected without --force
- Add zero-config.test.ts with tests for style guide detection
- Test default config generation when only VECTORLINT.md exists
- Test preference for .vectorlint.ini when both files are present
- Test error handling when neither configuration file exists
- Ensure StyleGuide rule is applied in zero-config mode

* docs: Add VECTORLINT.md style guide documentation and update quick start

- Add VECTORLINT.md to .gitignore to prevent accidental commits
- Document global style guide feature in CONFIGURATION.md with zero-config and combined modes
- Explain automatic style guide detection and synthetic rule creation
- Add token limit warning for large VECTORLINT.md files
- Restructure README quick start section with numbered steps
- Add zero-config mode instructions with --quick flag
- Clarify full configuration setup and API key configuration steps
- Improve readability with clearer hierarchy and examples

* chore: Add txt file format for VECTORLINT.md

* fix(config-loader,cli): Validate default config and improve style guide prompt

- Add CONFIG_SCHEMA validation to default config in zero-config mode to ensure type safety
- Update style guide prompt body text to clarify evaluation against attached style guide rules
- Fix commander import pattern in tests from deprecated `program` to `Command` constructor
- Improve consistency across all test cases for style guide initialization

* chore: Update config error to include VECTORLINT.md

* chore: clean up

* docs: Clarify style guide setup and remove unnecessary validation

- Update CONFIGURATION.md to clarify that style guide evaluates all content types, not just markdown files
- Add prerequisite note in README.md about credential setup before running checks
- Remove unused zod schema validation from config-loader.ts resolveConfigPath function
- Simplify config path resolution by removing redundant type checking

* docs: Clean up readme

* chore: Update readme

* chore: Remove unwanted comments
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