Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/repo-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ jobs:
ref: ${{ inputs.ref }}
fetch-depth: 0

- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4

- uses: denoland/setup-deno@e95548e56dfa95d4e1a28d6f422fafe75c4c26fb # v2.0.3
with:
deno-version: v2.9.5

- name: Install dependencies
run: deno task deps
- name: Prepare the checked-out xmd binary
run: deno task setup

- name: Build the checked-out xmd binary
run: deno task build
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ jobs:
with:
fetch-depth: 0

- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4

- uses: denoland/setup-deno@e95548e56dfa95d4e1a28d6f422fafe75c4c26fb # v2.0.3
with:
deno-version: v2.9.5

- name: Install dependencies
run: deno task deps
- name: Prepare the checked-out xmd binary
run: deno task setup

- name: Build the checked-out xmd binary
run: deno task build
Expand Down
13 changes: 13 additions & 0 deletions .reviews/.oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@
"eslint/no-console": ["warn", { "allow": ["warn", "error"] }],
"eslint/no-debugger": "warn",

"eslint/func-style": "off",
"eslint/no-magic-numbers": "off",
"eslint/require-yield": "off",
"eslint/sort-keys": "off",
"eslint/sort-imports": "off",
"typescript/prefer-readonly-parameter-types": "off",
"import/exports-last": "off",
"import/group-exports": "off",
"import/no-named-export": "off",
"import/prefer-default-export": "off",
"import/consistent-type-specifier-style": "off",
"unicorn/filename-case": "off",

"typescript/no-unnecessary-type-arguments": "warn",
"typescript/no-unnecessary-type-assertion": "warn",
"typescript/no-redundant-type-constituents": "warn",
Expand Down
175 changes: 24 additions & 151 deletions .reviews/AnalyzeRepo.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,171 +2,42 @@
title: Repository Analysis
---

```bash silent exec
mkdir -p .reviews
cat > .reviews/tsconfig.oxlint.json << 'TSCONFIG'
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"noEmit": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"lib": ["ESNext", "DOM"],
"types": []
},
"include": ["packages/*/src/**/*.ts", "packages/*/*.ts", "durable-effects/**/*.ts"],
"exclude": ["node_modules", "dist", ".vendor", "**/*.test.ts"]
}
TSCONFIG
```

```bash silent exec
ollama show qwen3:30b-a3b >/dev/null 2>&1 || ollama pull qwen3:30b-a3b
```
<GitHubAuth>
<ReviewSetup pullModel={true} />

<Capture as="repoStats">

```bash exec
find durable-effects packages -name '*.ts' -not -name '*.test.ts' -not -name '*.spec.ts' -not -path '*/node_modules/*' 2>/dev/null | tee /tmp/xmd-repo-files.txt | wc -l | tr -d ' '
```

</Capture>

<Capture as="repoLineCount">

```bash exec
cat /tmp/xmd-repo-files.txt | xargs wc -l 2>/dev/null | tail -1 | awk '{print $1}'
```

</Capture>

<Capture as="fileList">

```bash exec
cat /tmp/xmd-repo-files.txt
```

</Capture>
<RepositoryInventory as="inventory" />

```ts eval
const fileCount = parseInt(repoStats.trim(), 10) || 0;
const lineCount = parseInt(repoLineCount.trim(), 10) || 0;

const fileList = inventory.fileList;
const fileCount = inventory.fileCount;
const lineCount = inventory.lineCount;
const pr = {
files: [], added: [], removed: [], created: [], modified: [], deleted: [],
files: [],
added: [],
removed: [],
created: [],
modified: [],
deleted: [],
directories: new Set(),
addedSource: "", diffPreview: "",
addedSource: "",
diffPreview: "",
stats: { totalFiles: fileCount, additions: lineCount, deletions: 0, totalChanges: lineCount },
meta: { title: "Repo Analysis", body: "", number: "" },
};
```

<Capture as="doctorJson" select="code[lang=json]">

<Doctor pr={pr} />

</Capture>

```ts eval
import { parseDoctorResult } from "@executablemd/code-review-agent";

const doctor = parseDoctorResult(doctorJson);
```

<Capture as="rawDiagnostics">

<Show when={doctor.recommendation === "type-aware"
|| doctor.recommendation === "type-aware-filtered"}>

```bash exec
OUT=$(OXLINT_TSGOLINT_PATH=.reviews/.oxlint/tsgolint .reviews/.oxlint/oxlint --config .reviews/.oxlintrc.json --type-aware --tsconfig .reviews/tsconfig.oxlint.json --format json 2>/dev/null || true)
if [ -z "$OUT" ] || ! printf '%s' "$OUT" | jq -c '
def entries:
if type == "array" then .
elif (.diagnostics? | type) == "array" then .diagnostics
else []
end;
def span_line:
if (.line? | type) == "number" then .line
elif (.labels?[0].span.line? | type) == "number" then .labels[0].span.line
else 0
end;
def span_column:
if (.column? | type) == "number" then .column
elif (.labels?[0].span.column? | type) == "number" then .labels[0].span.column
else 0
end;
entries
| map({
message: (if (.message? | type) == "string" then .message else "" end),
ruleId: (if (.ruleId? | type) == "string" then .ruleId elif (.code? | type) == "string" then .code else "unknown" end),
severity: (if .severity == "error" then "error" else "warning" end),
file: (if (.file? | type) == "string" then .file elif (.filename? | type) == "string" then .filename else "" end),
line: span_line,
column: span_column
})
'; then
printf '[]'
fi
```

</Show>
<Doctor pr={pr} as="doctor" />

<Show when={doctor.recommendation === "syntax-only"
&& doctor.oxlintInstalled}>

```bash exec
OUT=$(.reviews/.oxlint/oxlint --config .reviews/.oxlintrc.json --format json 2>/dev/null || true)
if [ -z "$OUT" ] || ! printf '%s' "$OUT" | jq -c '
def entries:
if type == "array" then .
elif (.diagnostics? | type) == "array" then .diagnostics
else []
end;
def span_line:
if (.line? | type) == "number" then .line
elif (.labels?[0].span.line? | type) == "number" then .labels[0].span.line
else 0
end;
def span_column:
if (.column? | type) == "number" then .column
elif (.labels?[0].span.column? | type) == "number" then .labels[0].span.column
else 0
end;
entries
| map({
message: (if (.message? | type) == "string" then .message else "" end),
ruleId: (if (.ruleId? | type) == "string" then .ruleId elif (.code? | type) == "string" then .code else "unknown" end),
severity: (if .severity == "error" then "error" else "warning" end),
file: (if (.file? | type) == "string" then .file elif (.filename? | type) == "string" then .filename else "" end),
line: span_line,
column: span_column
})
'; then
printf '[]'
fi
```

</Show>

<Show when={!doctor.oxlintInstalled}>

[]

</Show>

</Capture>
<OxlintDiagnostics
files={fileList}
typeAware={doctor.recommendation !== "syntax-only"}
as="rawDiagnostics"
/>

```ts eval
import {
buildCleanupAnalysis,
parseDiagnostics,
} from "@executablemd/code-review-agent";
import { buildCleanupAnalysis, buildDiagnostics } from "@executablemd/code-review-agent";

const diagnostics = parseDiagnostics(rawDiagnostics, pr, doctor);
const diagnostics = buildDiagnostics(rawDiagnostics, pr, doctor);
const cleanupAnalysis = buildCleanupAnalysis(diagnostics);
```

Expand All @@ -177,3 +48,5 @@ const cleanupAnalysis = buildCleanupAnalysis(diagnostics);
</Instruction>
</OllamaProvider>
</ThinkFilter>

</GitHubAuth>
Loading
Loading