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
5 changes: 5 additions & 0 deletions .changeset/typescript-7-compiler-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tanstack/intent': patch
---

Check code examples in repositories that use TypeScript 7.0. `intent validate`, `intent repair`, and maintainer review summaries crashed there because the TypeScript 7 `typescript` package exports no compiler API. Intent now checks examples through the native compiler API that TypeScript 7 publishes, or through `@typescript/typescript6` when it is installed beside TypeScript 7. If neither API can run, Intent reports that the examples were not typechecked and runs the other checks. TypeScript 7.1 is not supported at this time.
2 changes: 1 addition & 1 deletion docs/cli/intent-repair.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Use `intent maintainer sync` afterward when the repository has valid maintainer

Some skills put complete alternative implementations in one fence, each labeled with a top-level `// BEFORE` or `// AFTER` comment. Repair can propose splitting that pair into separate fences when both halves parse. It preserves the code, language, fence style, and title. Markers in strings, nested examples, function bodies, incomplete syntax, unmatched fences, and more than one pair are not split.

The split is always a suggestion: the comments might describe sequential steps instead of alternatives. Check the teaching intent and run validation after applying it. TypeScript 5.0 or newer must be available for these suggestions; the parser does not load a project configuration or execute examples.
The split is always a suggestion: the comments might describe sequential steps instead of alternatives. Check the teaching intent and run validation after applying it. TypeScript 5.0 or newer must be available for these suggestions; the parser does not load a project configuration or execute examples. TypeScript 7 works under the same conditions as code checking in `intent validate`.

Fragments containing `...`, top-level `return`/`yield`, or deliberate `WRONG` examples require assessment and explicit context. Repair does not guess wrappers, insert casts or missing APIs, or suppress diagnostics. Separate fences also do not isolate module augmentations in the validator's package compiler context.

Expand Down
2 changes: 1 addition & 1 deletion docs/cli/intent-validate.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ The checker enables strict null checks because some library APIs require them, w

Module augmentations and global declarations still share the package compiler context. Two examples that pass separately can conflict when checked together. Verify those examples in isolated fixtures before treating the combined diagnostics as defects in the guidance; separate fences alone do not isolate their augmentations.

TypeScript 5.0 or newer must be available in the repository for code checking. If it or the library type entry is unavailable, Intent reports why those checks were skipped; this is not a successful typecheck. Prose-only skills do not load TypeScript.
TypeScript 5.0 or newer must be available in the repository for code checking. If it or the library type entry is unavailable, Intent reports why those checks were skipped; this is not a successful typecheck. Prose-only skills do not load TypeScript. With TypeScript 7.0, Intent checks examples through the compiler API that TypeScript 7 publishes as unstable; Node.js 24 or newer is supported. When `@typescript/typescript6` is installed beside TypeScript 7, Intent uses that package instead. If neither API can run, Intent reports that the checks were skipped. TypeScript 7.1 is not supported at this time.

Relative Markdown links outside fenced examples must point to an existing file or directory. External URLs and anchors are not checked. Link checks still run when TypeScript is unavailable. Repeated validations read current source files and link targets.

Expand Down
3 changes: 2 additions & 1 deletion packages/intent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"semver": "^7.8.4",
"std-env": "^4.1.0",
"tsdown": "^0.22.2",
"typescript7": "npm:typescript@7.0.2",
"verdaccio": "^6.7.2",
"yaml": "2.9.0"
},
Expand All @@ -46,7 +47,7 @@
"test:lib": "vitest run --exclude 'tests/integration/**'",
"test:integration": "vitest run tests/integration/",
"test:distribution": "pnpm run build && vitest run tests/integration/distribution-installers.test.ts",
"test:types": "tsc --noEmit",
"test:types": "node ../../node_modules/typescript/bin/tsc --noEmit",
"test:eslint": "eslint ."
}
}
2 changes: 1 addition & 1 deletion packages/intent/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function createCli(
.option('--patch', 'Print a reviewable patch without editing skill files')
.action(async (dir: string | undefined, options: RepairCommandOptions) => {
const { runRepairCommand } = await import('./commands/repair.js')
runRepairCommand(dir, options)
await runRepairCommand(dir, options)
})

cli
Expand Down
2 changes: 1 addition & 1 deletion packages/intent/src/commands/maintainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ export async function runMaintainerCommand(
? validatedExamples
: options.json
? new Map<string, string>()
: describeSkillExamples(
: await describeSkillExamples(
project.root,
review.items
.filter((item) => item.kind === 'skill' && !item.problems.length)
Expand Down
7 changes: 5 additions & 2 deletions packages/intent/src/commands/repair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface RepairCommandOptions {
patch?: boolean
}

export function runRepairCommand(
export async function runRepairCommand(
dir: string | undefined,
options: RepairCommandOptions,
) {
Expand Down Expand Up @@ -55,7 +55,10 @@ export function runRepairCommand(
changes.push(plan.change)
report.repairs.push({ file, changes: plan.changes })
}
const examples = planExampleRepairs(root, plan.change?.content ?? source)
const examples = await planExampleRepairs(
root,
plan.change?.content ?? source,
)
report.suggestions.push(
...examples.suggestions.map((suggestion) => ({ file, ...suggestion })),
)
Expand Down
2 changes: 1 addition & 1 deletion packages/intent/src/commands/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ async function runValidateCommandInternal(
if (library) (byLibrary[library] ??= []).push(skill)
}
for (const [library, skills] of Object.entries(byLibrary)) {
const result = checkSkillBlocks({
const result = await checkSkillBlocks({
root: process.cwd(),
packageDir: validateContext.packageRoot,
library,
Expand Down
Loading
Loading