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
25 changes: 10 additions & 15 deletions .github/workflows/repo-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,28 @@ jobs:
ref: ${{ inputs.ref }}
fetch-depth: 0

# install.sh resolves the latest published release, for the same reason
# PR Review does β€” a pinned version names an unpublished release for the
# whole of a release-bump PR. See .github/workflows/review.yml.
- name: Install xmd release binary
run: |
curl -fsSL https://executable.md/install.sh | sh
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- uses: denoland/setup-deno@e95548e56dfa95d4e1a28d6f422fafe75c4c26fb # v2.0.3
with:
deno-version: v2.9.5

- name: Install dependencies
run: deno task deps

- name: Build the checked-out xmd binary
run: deno task build

- name: Run repo analysis
env:
DEEPINFRA_TOKEN: ${{ secrets.DEEPINFRA_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
xmd run .reviews/AnalyzeRepoCI.md \
./dist/xmd run .reviews/AnalyzeRepoCI.md \
--component-dir .reviews/components \
--component-dir .reviews/policies \
--component-dir packages/core/components \
-j .reviews/journal.analyze.ci.jsonl > .reviews/analyze-report.md

# xmd embeds a failed EnsureOxlint as a comment and still exits 0, so
# assert the lint binaries were provisioned β€” fail the job if not.
- name: Verify oxlint provisioning
run: |
test -x .reviews/.oxlint/oxlint && test -x .reviews/.oxlint/tsgolint \
|| { echo "::error::oxlint/tsgolint could not be provisioned by EnsureOxlint"; exit 1; }

- name: Write run metadata
if: always()
run: |
Expand Down
26 changes: 10 additions & 16 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ jobs:
with:
fetch-depth: 0

# install.sh resolves the latest published release. Pinning a version here
# broke every release-bump PR, which pinned the release it was preparing
# and downloaded a binary that did not exist yet; the tradeoff is that a
# new release changes PR-review behavior as soon as it is the latest.
- name: Install xmd release binary
run: |
curl -fsSL https://executable.md/install.sh | sh
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- uses: denoland/setup-deno@e95548e56dfa95d4e1a28d6f422fafe75c4c26fb # v2.0.3
with:
deno-version: v2.9.5

- name: Install dependencies
run: deno task deps

- name: Build the checked-out xmd binary
run: deno task build

- name: Run review
env:
Expand All @@ -34,20 +35,13 @@ jobs:
GITHUB_REPOSITORY: ${{ github.repository }}
DEEPINFRA_TOKEN: ${{ secrets.DEEPINFRA_TOKEN }}
run: |
xmd run .reviews/ReviewPR.md \
./dist/xmd run .reviews/ReviewPR.md \
--component-dir .reviews/components \
--component-dir .reviews/policies \
--component-dir packages/core/components \
-j .reviews/journal.jsonl \
--verbose

# xmd embeds a failed EnsureOxlint as a comment and still exits 0, so
# assert the lint binaries were provisioned β€” fail the job if not.
- name: Verify oxlint provisioning
run: |
test -x .reviews/.oxlint/oxlint && test -x .reviews/.oxlint/tsgolint \
|| { echo "::error::oxlint/tsgolint could not be provisioned by EnsureOxlint"; exit 1; }

- name: Upload journal
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
Expand Down
62 changes: 54 additions & 8 deletions .reviews/AnalyzeRepo.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,33 @@ const doctor = parseDoctorResult(doctorJson);

```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 [ -n "$OUT" ]; then
printf '%s' "$OUT"
else
echo "[]"
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
```

Expand All @@ -97,10 +120,33 @@ fi

```bash exec
OUT=$(.reviews/.oxlint/oxlint --config .reviews/.oxlintrc.json --format json 2>/dev/null || true)
if [ -n "$OUT" ]; then
printf '%s' "$OUT"
else
echo "[]"
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
```

Expand Down
66 changes: 58 additions & 8 deletions .reviews/AnalyzeRepoCI.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: Repository Analysis (CI)
---

<Output>

```bash silent exec
mkdir -p .reviews
cat > .reviews/tsconfig.oxlint.json << 'TSCONFIG'
Expand Down Expand Up @@ -79,10 +81,33 @@ const doctor = parseDoctorResult(doctorJson);

```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 [ -n "$OUT" ]; then
printf '%s' "$OUT"
else
echo "[]"
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
```

Expand All @@ -93,10 +118,33 @@ fi

```bash exec
OUT=$(.reviews/.oxlint/oxlint --config .reviews/.oxlintrc.json --format json 2>/dev/null || true)
if [ -n "$OUT" ]; then
printf '%s' "$OUT"
else
echo "[]"
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
```

Expand Down Expand Up @@ -127,3 +175,5 @@ const cleanupAnalysis = buildCleanupAnalysis(diagnostics);
</Instruction>
</DeepInfraProvider>
</ThinkFilter>

</Output>
78 changes: 72 additions & 6 deletions .reviews/ReviewPR.local.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,43 @@ git diff --name-only {BASE_SHA}...{HEAD_SHA} -- '*.ts' '*.tsx' | grep -v '\.test
|| doctor.recommendation === "type-aware-filtered"}>

```bash exec
if [ -n "{changedTsFiles}" ]; then
echo "{changedTsFiles}" | tr '\n' ' ' | OXLINT_TSGOLINT_PATH=.reviews/.oxlint/tsgolint xargs .reviews/.oxlint/oxlint --config .reviews/.oxlintrc.json --type-aware --tsconfig .reviews/tsconfig.oxlint.json --format json 2>/dev/null || true
changed_files=$(cat <<'FILES'
{changedTsFiles}
FILES
)
if [ -z "$changed_files" ]; then
printf '[]'
else
echo "[]"
raw=$(printf '%s\n' "$changed_files" | OXLINT_TSGOLINT_PATH=.reviews/.oxlint/tsgolint xargs .reviews/.oxlint/oxlint --config .reviews/.oxlintrc.json --type-aware --tsconfig .reviews/tsconfig.oxlint.json --format json 2>/dev/null || true)
if [ -z "$raw" ] || ! printf '%s' "$raw" | jq -c --arg changed "$changed_files" '
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
})
| map(select(.file as $file | ($changed | split("\n") | index($file)) != null))
'; then
printf '[]'
fi
fi
```

Expand All @@ -107,10 +140,43 @@ fi
&& doctor.oxlintInstalled}>

```bash exec
if [ -n "{changedTsFiles}" ]; then
echo "{changedTsFiles}" | tr '\n' ' ' | xargs .reviews/.oxlint/oxlint --config .reviews/.oxlintrc.json --format json 2>/dev/null || true
changed_files=$(cat <<'FILES'
{changedTsFiles}
FILES
)
if [ -z "$changed_files" ]; then
printf '[]'
else
echo "[]"
raw=$(printf '%s\n' "$changed_files" | xargs .reviews/.oxlint/oxlint --config .reviews/.oxlintrc.json --format json 2>/dev/null || true)
if [ -z "$raw" ] || ! printf '%s' "$raw" | jq -c --arg changed "$changed_files" '
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
})
| map(select(.file as $file | ($changed | split("\n") | index($file)) != null))
'; then
printf '[]'
fi
fi
```

Expand Down
Loading
Loading