feat: use altimate-code check for deterministic SQL analysis#3
Merged
anandgupta42 merged 3 commits intomainfrom Mar 25, 2026
Merged
feat: use altimate-code check for deterministic SQL analysis#3anandgupta42 merged 3 commits intomainfrom
altimate-code check for deterministic SQL analysis#3anandgupta42 merged 3 commits intomainfrom
Conversation
- Add `src/analysis/cli-check.ts` wrapping `altimate-code check` with structured JSON parsing — maps findings to `SQLIssue[]` with category prefixes (e.g. `lint/L001`, `safety/injection`, `pii/email`) - Update `sql-review.ts` static mode to try CLI `check` first, fall back to the regex `RuleRegistry` when the CLI is unavailable - Add v2 config types in `config/schema.ts` (`AltimateConfigV2`) that map directly to `altimate-code check --checks` options - Update `index.ts` to detect v2 config and route through a single CLI invocation with all enabled checks - Enhance `comment.ts` to group issues by check category (Lint, Safety, Policy, PII, Validate) with subsection headers - Update `.altimate.yml.example` with full v2 configuration reference - Add unit tests for `parseCheckOutput`, `buildCheckOptionsFromV2`, and category-grouped comment rendering (368 tests, all passing) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add v2 configuration reference to `docs/configuration.md` with checks reference, lint rules L001-L026, schema config, and policy config - Create `docs/v2-migration.md` with step-by-step v1-to-v2 upgrade guide - Create `docs/policy-guide.md` with full policy file format, rule categories (`cost_control`, `data_protection`, `query_patterns`, `tag_rules`), and practical examples - Update `README.md` with "Powered by altimate-code" section, v2 feature comparison table, and quick start config - Expand `cli-check.test.ts` from 12 to 24 tests: null/undefined results, missing fields, 1500-finding stress test, all severity case variations, all 7 category prefixes, non-number line handling - Expand `config-v2.test.ts` from 7 to 26 tests: all-enabled config, mixed enable/disable, multiple dialects, empty/missing schema paths, `LintCheckConfig`/`PolicyCheckConfig`/`PIICheckConfig` type checks, inline policy handling - Create `test/e2e/v2-check-integration.test.ts` with 8 end-to-end tests: full v2 flow (config -> options -> parse -> comment), category grouping, subsection headers, mixed v1/v2 issues, single-category rendering Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Routes all SQL analysis through
altimate-code checkCLI instead of the hand-written regex rules. This unlocks all altimate-core capabilities (26 lint rules, DataFusion validation, safety scanning, policy enforcement, PII detection) while maintaining the correct architecture:Never imports
@altimateai/altimate-coredirectly.Changes
New:
src/analysis/cli-check.tsaltimate-code check --format json --checks lint,safety,...SQLIssue[]with category prefixes (lint/L001,safety/injection)isCheckCommandAvailable()probes CLI before useUpdated:
src/analysis/sql-review.tsaltimate-code checkfirst, falls back to regex rulesUpdated:
src/config/schema.tsbuildCheckOptionsFromV2()converts config to CLI argumentsUpdated:
src/index.tsrunV2CheckAnalysis()— single CLI invocation for all checksUpdated:
src/reporting/comment.tsNew:
.altimate.yml.exampleType of change
How did you verify your code works?
Checklist
@altimateai/altimate-coreimportaltimate-codeCLIDepends on: AltimateAI/altimate-code#453