Part of Plannotator, try Plannotator Inbox; an inbox to stay in the loop and organize better code review. A diff shows lines that were added and deleted. Much of that is not a real change: a function moved, a variable renamed, code reformatted, a block pulled out into a helper. sem-jiff reads both versions of a file and says what each change really is, so a reviewer can skip what kept its meaning. It returns plain data (semanticOperations, semanticFolds and the matching patch) that any diff viewer can draw. The operation types in src/pierre-types.ts are copied from Pierre (Apache-2.0). Example, rendered in Plannotator: What it finds It prefers saying nothing to saying something wrong: a missed change falls back to the plain diff, while a wrong label would mislead the reviewer. npm install @plannotator/sem-jiff import { semanticDiffFile, languageForPath } from '@plannotator/sem-jiff'; const language = languageForPath('src/users.ts'); // 'typescript' const { semanticOperations, semanticFolds, patch } = await semanticDiffFile(language, oldText, newText, 'src/users.ts'); // Give your diff viewer the patch too, so its layout matches the operations, // then draw semanticOperations over it. In Node nothing else is needed. In a browser, copy the grammars next to your app (npx sem-jiff-copy-wasm ) and tell the engine where they are served from with configure({ locateGrammar, locateRuntime }). Options, reviewSummary and browser setup: docs/usage.md. Power Up: Jev and Clef The rules are strict, so they miss extracted functions whose code was reworded on the way out. Add a decision model and the engine asks it about exactly those candidates, once per file. Your key, your account; call it from a server or your own machine. Try it with Jev (by TypeSafe): import { jevOpinion } from '@plannotator/sem-jiff/opinions'; const diff = await semanticDiffFile('typescript', oldText, newText, 'src/cart.ts', { secondOpinion: jevOpinion({ apiKey }), }); Or with both: Clef (Cloudflare) breaks the tie when Jev is unsure. import { jevOpinion, clefScore } from '@plannotator/sem-jiff/opinions'; const secondOpinion = jevOpinion({ apiKey, tieBreaker: { ask: clefScore({ accountId, apiToken }) } }); About $0.0004 per 500-line change with Jev. Answers are remembered, so opening the same diff again costs nothing. More in docs/usage.md. How it compares On TypeScript practice commits (187 real cases): RefactoringMiner 73 found, 14 wrong; sem-jiff 105, 1 wrong; with Jev 148, 1 wrong. Every comparison: harness/compare/README.md. How the engine is tested: docs/verification.md. Languages TypeScript and TSX, JavaScript, Python, Go, Rust, Java, C#, PHP, Ruby, Kotlin and Swift. What each one holds back in this version is in CHANGELOG.md. docs/usage.md: options, reviewSummary, browser setup, second opinion, development commands docs/verification.md: how it is verified, every result, the known erratum in Pierre's fixture docs/history.md: development milestones docs/layout.md: source layout and how a language is added PACKAGING.md, CHANGELOG.md MIT or Apache-2.0, at your choice (LICENSE-MIT, LICENSE-APACHE), like Plannotator. src/pierre-types.ts and the Pierre fixture are Apache-2.0, copied from Pierre. The WebAssembly files in wasm/ (web-tree-sitter and the grammars) keep their own licences: see THIRD-PARTY-NOTICES.
AI NEWS JOURNAL
Hacker News Show HNAI NEWS / JOURNAL
Show HN: Semantic/Structural diffs powered by Jev
Bit of a promo/explainer video: https://x.com/plannotator/status/2122076678155604016?a=6kshg...https://plannotator.ai/sem-jiff/ Comments URL: https://news.ycombinator.com/item?id=50510982 Points: 1 # Comments: 0
翻译服务暂未运行,当前显示原文。