Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
940908a
deno_ral/errors: runtime-neutral error predicates
cderv Oct 28, 2026
fbd24a6
deno_ral/temp: makeTemp* retrying on AlreadyExists only
cderv Oct 28, 2026
810227f
runtime-migration docs: execution-log routine, PR 09 in progress, tas…
cderv Oct 28, 2026
04df3bc
runtime-migration README: multi-session handoff at task boundaries
cderv Oct 28, 2026
1f4fa7d
rt-09 plan: fix shell syntax in execution log commands
cderv Oct 28, 2026
f014366
deno_ral/fs: plain filesystem calls, canonicalPathSync, layer-typed h…
cderv Oct 28, 2026
373e638
runtime-migration docs: PR 09 task 3 logged, Deno 2.7 check/symlink f…
cderv Oct 28, 2026
034aef9
deno_ral/fs: annotate read errors with String(path), not toPathString
cderv Oct 28, 2026
e70f003
rt-09 plan: fix Task 3 shell syntax in execution log commands
cderv Oct 28, 2026
0d3ef3a
deno_ral tests: shared helpers, direct Deno.errors, present-tense com…
cderv Oct 28, 2026
790c04b
runtime-migration docs: PR 09 review round, comment and Deno.errors c…
cderv Oct 28, 2026
ce21943
runtime-migration docs: code-quality audit in Step 0, review checklis…
cderv Oct 28, 2026
d9daa27
deno_ral: drop wrapper-file references from two comments
cderv Oct 28, 2026
e0c6798
runtime-migration docs: review rule covers every indirect Deno spelling
cderv Oct 28, 2026
ca452bb
runtime-migration docs: HANDOFF names 09 as in progress
cderv Oct 28, 2026
a8230cd
tools: ts-morph codemod for Deno.* <-> deno_ral rewrites, with fixtures
cderv Oct 28, 2026
347e68d
runtime-migration docs: HANDOFF lists what rt/09 needs after 02d merged
cderv Oct 28, 2026
143007e
tools: fix four broken rewrite forms in codemod-deno-ral
cderv Oct 28, 2026
c0cba65
tools: resolve Deno shadowing per meaning in codemod-deno-ral
cderv Oct 28, 2026
7793ce9
tools: codemod-deno-ral skips every write to Deno.*, keeps re-exporte…
cderv Oct 28, 2026
13238c5
tools: codemod-deno-ral treats destructuring and for-of targets as wr…
cderv Oct 28, 2026
ce7c5da
tools: codemod-deno-ral sees writes through type assertions and wrapp…
cderv Oct 28, 2026
73d017f
tools: codemod-deno-ral skips files that use Deno other than as Deno.x
cderv Oct 28, 2026
ace18fd
rt-09 plan: codemod forward item 1 lists the current skip reasons
cderv Oct 28, 2026
9ac1f1b
runtime-migration docs: PR 09 task 4 logged, write-guard review round…
cderv Oct 28, 2026
5648cf0
tools: codemod-deno-ral treats { Deno } as a use and unwraps mutator …
cderv Oct 28, 2026
0839065
runtime-migration docs: PR 09 fifth write-guard round, dry-run delta …
cderv Oct 28, 2026
bbd1831
tools: codemod-deno-ral sees Object["assign"] as a mutator
cderv Oct 28, 2026
7908159
runtime-migration docs: PR 09 write-guard log cites bf7d2da18 and 947…
cderv Oct 28, 2026
4d16916
tools: codemod-deno-ral reads `x` template keys as static member names
cderv Oct 28, 2026
5020329
tools: codemod-deno-ral reads parenthesized keys as static member names
cderv Oct 28, 2026
99e13d7
runtime-migration docs: PR 09 write-guard log adds the sixth and seve…
cderv Oct 28, 2026
e05db9b
tools: codemod-deno-ral --reverse reports canonicalPathSync instead o…
cderv Oct 29, 2026
d841852
tools: codemod-deno-ral freezes the write guard and skips the known p…
cderv Oct 29, 2026
bb0a773
runtime-migration docs: PR 09 plan matches its execution; tracking se…
cderv Oct 29, 2026
bb54314
runtime-migration docs: drop a literal local-path prefix from the PR …
cderv Oct 29, 2026
22490c9
tools: pin the codemod test files to LF checkouts
cderv Oct 29, 2026
6d87537
runtime-migration docs: 02d is merged and 09 is rebased onto it
cderv Oct 29, 2026
e80c88a
runtime-migration docs: PR 09 branch greps pass on the rebased branch
cderv Oct 29, 2026
2aade3d
runtime-migration: codemod CI step, backport step and rules docs for …
cderv Oct 29, 2026
f1693e6
runtime-migration docs: PR 09 task 5 steps 1-4 logged
cderv Oct 29, 2026
04927ee
runtime-migration: changelog line for the sorted directory order (PR …
cderv Oct 29, 2026
3e1a29a
runtime-migration docs: PR 09 task 5 completed, verification re-run
cderv Oct 29, 2026
1a3d068
runtime-migration: fix codemod CI triggers, backport recipe and rules…
cderv Oct 29, 2026
2358d28
runtime-migration docs: PR 09 changelog line names character-code order
cderv Oct 29, 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 (v1.10 and earlier: `src/deno_ral/fs.ts` there has no `readTextFileSync`) 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