Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
45e0282
deno_ral/errors: runtime-neutral error predicates
cderv Oct 28, 2026
5fb9691
deno_ral/temp: makeTemp* retrying on AlreadyExists only
cderv Oct 28, 2026
08d1368
runtime-migration docs: execution-log routine, PR 09 in progress, tas…
cderv Oct 28, 2026
db541ff
runtime-migration README: multi-session handoff at task boundaries
cderv Oct 28, 2026
2f5b1ae
rt-09 plan: fix shell syntax in execution log commands
cderv Oct 28, 2026
5b7cd9e
deno_ral/fs: plain filesystem calls, canonicalPathSync, layer-typed h…
cderv Oct 28, 2026
0ab7f62
runtime-migration docs: PR 09 task 3 logged, Deno 2.7 check/symlink f…
cderv Oct 28, 2026
24d7998
deno_ral/fs: annotate read errors with String(path), not toPathString
cderv Oct 28, 2026
9cf6441
rt-09 plan: fix Task 3 shell syntax in execution log commands
cderv Oct 28, 2026
408c1e0
deno_ral tests: shared helpers, direct Deno.errors, present-tense com…
cderv Oct 28, 2026
52572bf
runtime-migration docs: PR 09 review round, comment and Deno.errors c…
cderv Oct 28, 2026
f2dc71f
runtime-migration docs: code-quality audit in Step 0, review checklis…
cderv Oct 28, 2026
7faac1c
deno_ral: drop wrapper-file references from two comments
cderv Oct 28, 2026
edecb90
runtime-migration docs: review rule covers every indirect Deno spelling
cderv Oct 28, 2026
91749b0
tools: ts-morph codemod for Deno.* <-> deno_ral rewrites, with fixtures
cderv Oct 28, 2026
7f639a7
runtime-migration docs: HANDOFF lists what rt/09 needs after 02d merged
cderv Oct 28, 2026
2cb8bbd
tools: fix four broken rewrite forms in codemod-deno-ral
cderv Oct 28, 2026
0b47ce9
tools: resolve Deno shadowing per meaning in codemod-deno-ral
cderv Oct 28, 2026
8572c66
tools: codemod-deno-ral skips every write to Deno.*, keeps re-exporte…
cderv Oct 28, 2026
5a2e1aa
tools: codemod-deno-ral treats destructuring and for-of targets as wr…
cderv Oct 28, 2026
c2f4e8f
tools: codemod-deno-ral sees writes through type assertions and wrapp…
cderv Oct 28, 2026
a641efb
tools: codemod-deno-ral skips files that use Deno other than as Deno.x
cderv Oct 28, 2026
2bf46a1
rt-09 plan: codemod forward item 1 lists the current skip reasons
cderv Oct 28, 2026
a14d89f
runtime-migration docs: PR 09 task 4 logged, write-guard review round…
cderv Oct 28, 2026
c274b02
tools: codemod-deno-ral treats { Deno } as a use and unwraps mutator …
cderv Oct 28, 2026
a08403c
runtime-migration docs: PR 09 fifth write-guard round, dry-run delta …
cderv Oct 28, 2026
9515f8f
tools: codemod-deno-ral sees Object["assign"] as a mutator
cderv Oct 28, 2026
b2d9b8c
runtime-migration docs: PR 09 write-guard log cites bf7d2da18 and 947…
cderv Oct 28, 2026
5e3f6b2
tools: codemod-deno-ral reads `x` template keys as static member names
cderv Oct 28, 2026
f154c9c
tools: codemod-deno-ral reads parenthesized keys as static member names
cderv Oct 28, 2026
5c63a96
runtime-migration docs: PR 09 write-guard log adds the sixth and seve…
cderv Oct 28, 2026
3b5f13d
tools: codemod-deno-ral --reverse reports canonicalPathSync instead o…
cderv Oct 29, 2026
1136df4
tools: codemod-deno-ral freezes the write guard and skips the known p…
cderv Oct 29, 2026
037f6bf
runtime-migration docs: PR 09 plan matches its execution; tracking se…
cderv Oct 29, 2026
8339ba4
runtime-migration docs: drop a literal local-path prefix from the PR …
cderv Oct 29, 2026
b6a215e
tools: pin the codemod test files to LF checkouts
cderv Oct 29, 2026
95d0479
runtime-migration docs: 02d is merged and 09 is rebased onto it
cderv Oct 29, 2026
702b0eb
runtime-migration docs: PR 09 branch greps pass on the rebased branch
cderv Oct 29, 2026
a6b3338
runtime-migration: codemod CI step, backport step and rules docs for …
cderv Oct 29, 2026
86a6f31
runtime-migration docs: PR 09 task 5 steps 1-4 logged
cderv Oct 29, 2026
89074cb
runtime-migration: changelog line for the sorted directory order (PR …
cderv Oct 29, 2026
2ec3347
runtime-migration docs: PR 09 task 5 completed, verification re-run
cderv Oct 29, 2026
9aa1ff3
runtime-migration: fix codemod CI triggers, backport recipe and rules…
cderv Oct 29, 2026
4dea767
runtime-migration docs: PR 09 changelog line names character-code order
cderv Oct 29, 2026
9863de7
runtime-migration docs: PR 09 rebased onto main after v1.11, re-verif…
cderv Nov 3, 2026
b121dbb
runtime-migration: backport checklist decides the reverse codemod fro…
cderv Nov 3, 2026
cabc99d
Merge main and refresh runtime migration guidance
cderv Nov 3, 2026
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
17 changes: 7 additions & 10 deletions .claude/rules/typescript/deno-essentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,15 @@ import { join } from "jsr:/@std/path";

## Deno APIs vs Node.js

Use Deno APIs directly:
Import from the runtime layer (`src/deno_ral/`) instead of calling `Deno.*` directly:

```typescript
// Correct - Deno APIs
Deno.env.get("PATH");
Deno.cwd();
Deno.readTextFileSync(path);
Deno.writeTextFileSync(path, content);
Deno.makeTempDirSync({ prefix: "quarto" });
// Correct - runtime layer
import { readTextFileSync, writeTextFileSync } from "../deno_ral/fs.ts";
import { makeTempDirSync } from "../deno_ral/temp.ts";

// Wrong - Node.js patterns
process.env.PATH;
fs.readFileSync(path);
// Wrong - direct runtime calls (the CI ratchet counts these)
Deno.readTextFileSync(path);
```

## Sync vs Async
Expand All @@ -86,6 +82,7 @@ if (isWindows) {
## Lint Directives

Common directives (use sparingly):

- `no-explicit-any` - For Cliffy options, JSON parsing
- `no-control-regex` - For regex with control characters

Expand Down
32 changes: 23 additions & 9 deletions .claude/rules/typescript/deno-ral.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ The `deno_ral/` directory provides a runtime abstraction layer over Deno's stand

## Available Modules

| Module | Purpose | Key exports |
|--------|---------|-------------|
| `fs.ts` | File system | `existsSync`, `ensureDirSync`, `copySync`, `safeMoveSync`, `safeRemoveSync` |
| `path.ts` | Path utilities | `join`, `dirname`, `basename`, `extname` |
| `log.ts` | Logging | `debug`, `info`, `warning`, `error` |
| `kv.ts` | Deno KV cache stores | `openKv`, `getKv`, `kvOp`, `KvDamagedError` |
| `platform.ts` | Platform detection | `isWindows` |
| `process.ts` | Process execution | Process utilities |
| Module | Purpose | Key exports |
| ------------- | ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `fs.ts` | File system | `readTextFileSync`, `writeTextFileSync`, `statSync`, `readDirSync` (sorted), `removeSync`, `mkdirSync`, `copyFileSync`, `open`, `canonicalPathSync` (resolves symlinks), `existsSync`, `ensureDirSync`, `copySync`, `safeMoveSync`, `safeRemoveSync`; types `FileInfo`, `DirEntry`, `FsFile` |
| `temp.ts` | Temp files/dirs (retry on AlreadyExists) | `makeTempDirSync`, `makeTempDir`, `makeTempFileSync`, `makeTempFile`; type `TempOptions` |
| `errors.ts` | Runtime-neutral error predicates | `isNotFound`, `isAlreadyExists`, `isPermissionDenied`, `isAddrInUse`, `isConnectionRefused`, `isConnectionError`, `errorWithPath` |
| `path.ts` | Path utilities | `join`, `dirname`, `basename`, `extname` |
| `log.ts` | Logging | `debug`, `info`, `warning`, `error` |
| `kv.ts` | Deno KV cache stores | `openKv`, `getKv`, `kvOp`, `KvDamagedError` |
| `platform.ts` | Platform detection | `isWindows` |
| `process.ts` | Process execution | Process utilities |

## Why Use deno_ral

Expand All @@ -28,6 +30,7 @@ The `deno_ral/` directory provides a runtime abstraction layer over Deno's stand
## Common Utilities

**Temp files** (`src/core/temp.ts`):

```typescript
import { createTempContext } from "../core/temp.ts";

Expand All @@ -40,6 +43,7 @@ try {
```

**Process execution** (`src/core/process.ts`):

```typescript
import { execProcess } from "../core/process.ts";

Expand All @@ -60,8 +64,18 @@ const result = await execProcess({
## Module Loading Order

`src/quarto.ts` loads monkey patches first:

```typescript
import "./core/deno/monkey-patch.ts"; // Must be first!
import "./core/deno/monkey-patch.ts"; // Must be first!
```

This ensures compatibility shims load before any code runs.

## Moving code off `Deno.*`

Outside `deno_ral/`, never add new `Deno.*` calls; import the equivalent from `deno_ral/`. The `deno_ral/` modules themselves implement those functions with `Deno.*`. To migrate existing files mechanically:

quarto run --dev tools/codemod-deno-ral.ts --rules fs,temp --dir src/<dir> --dry-run
quarto run --dev tools/codemod-deno-ral.ts --rules fs,temp --dir src/<dir>

The tool reports local-name collisions (left as `Deno.*`; fix with an alias import such as `import { stat as fsStat } ...`, which later runs reuse) and skips files that assign to `Deno.*`, `src/core/lib` and the standalone scripts. Replace `instanceof Deno.errors.X` with the predicates in `deno_ral/errors.ts`. After a rebase conflict in a codemodded file, reset the file to `main` and re-run the codemod; never resolve by hand. `--reverse` produces the `Deno.*` form for backports (`dev-docs/checklist-backport-a-pr.md`).
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ src/resources/library/dayjs/** linguist-vendored

# use lf line-endings for source files
src/** text eol=lf
# codemod fixtures and tests compare file bytes verbatim
tools/codemod/** text eol=lf

# Denote all files that are truly binary and should not be modified.
*.png binary
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/runtime-boundary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ on:
- "tests/**"
- "tools/check-runtime-boundary.ts"
- "tools/runtime-boundary-baseline.json"
- "tools/codemod-deno-ral.ts"
- "tools/codemod/**"
- ".github/workflows/runtime-boundary.yml"
push:
branches: [main]
Expand All @@ -30,6 +32,8 @@ on:
- "tests/**"
- "tools/check-runtime-boundary.ts"
- "tools/runtime-boundary-baseline.json"
- "tools/codemod-deno-ral.ts"
- "tools/codemod/**"
- ".github/workflows/runtime-boundary.yml"

permissions:
Expand All @@ -52,6 +56,9 @@ jobs:
- name: Configure Quarto
uses: ./.github/workflows/actions/quarto-dev

- name: Codemod contract test (tools/codemod)
run: package/dist/bin/tools/x86_64/deno test --allow-all --import-map=src/import_map.json tools/codemod/

- name: Check runtime boundary
shell: bash
env:
Expand Down
23 changes: 23 additions & 0 deletions dev-docs/checklist-backport-a-pr.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,29 @@ We backport development PRs to the stable branch using the following steps:
- Cherry-pick the commits from the development branch:
- `git cherry-pick <commit>` for every commit identified above.
- Resolve conflicts as needed.
- If the stable branch predates the runtime-layer codemods (`src/deno_ral/fs.ts` there has no `readTextFileSync`; decide from that file, not the release number: v1.11 and earlier all qualify) and a commit touches TypeScript, cherry-picking conflicts wherever its context lines were codemodded. Build the patch in the stable branch's `Deno.*` form instead, from the `main` checkout:

```bash
c=<commit>
w=$(mktemp -d)/bp
git worktree add --detach "$w" "$c^"
changed() { git diff -z --no-renames --name-only --diff-filter="$1" "$c^" "$c" -- "${@:2}"; }
rev() {
changed "$1" '*.ts' | while IFS= read -r -d '' f; do
quarto run --dev tools/codemod-deno-ral.ts --reverse --rules fs,temp,env,process,platform \
--ral-dir "$w/src/deno_ral" --file "$w/$f"
done
}
rev MD && git -C "$w" commit -qam "reversed base" --allow-empty
changed AM | while IFS= read -r -d '' f; do git -C "$w" checkout "$c" -- "$f"; done
changed D | while IFS= read -r -d '' f; do git -C "$w" rm -q -- "$f"; done
rev AM
git -C "$w" add -A && git -C "$w" diff --cached HEAD > "$w.patch"
git worktree remove --force "$w"
```

Then, on the stable branch: `git apply -3 "$w.patch" && git commit -C "$c"`. The tool prints `left:` for any layer name it cannot express (for example `args` used without a call) and never rewrites `deno_ral/errors.ts` predicates: grep the patch for `deno_ral/errors.ts` and `isNotFound(` and turn them into `instanceof Deno.errors.X` by hand. The tool reports `canonicalPathSync` as `left` (stable branches patch `Deno.realPathSync`): import `originalRealPathSync` from `deno_ral/original-real-path.ts` there.

- Revert the changelog file changes if they were included in the original commits (the dev-branch `changelog-1.(x+1).md` does not exist on the stable branch, so the cherry-pick shows a modify/delete conflict — drop that hunk).
- Add the new changelog entries to `news/changelog-1.x.md`, under `# v1.(x+1) backports` > `## In this release` at the top of the file.
There are change categories in the development release but not in the backport release, so just add them chronologically to the section.
Expand Down
Loading
Loading