feat: MVP — move files, rewrite imports, atomically
- core: gitignore-aware index (ignore crate), forward/reverse import graph,
relative-specifier math, pure-data move plans
- apply: rewrite-first + rename-last with fsync, temp+rename, full rollback
(incl. stale-plan detection before any write); unified diff for dry-run
- cli: mv + check commands, human output, --json envelope with stable error
codes (SOURCE_NOT_FOUND, TARGET_EXISTS, ...) and hints; exit codes 0/1/2
- parser/core split into submodules to keep files <=250 lines
- tests: 37 unit + 10 e2e + 2 doctests; fixtures tests/typescript/{basic,normal,complex}
- docs: SKILL.md synced (no --force in Phase 1), EXAMPLES.md
- plan: AI/agent support done; Phase 1.5 = Java niche
This commit is contained in:
parent
9d8f1e0bba
commit
55670030c3
37 changed files with 1851 additions and 139 deletions
5
tests/typescript/basic/app.ts
Normal file
5
tests/typescript/basic/app.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { sum } from "./lib/sum";
|
||||
|
||||
export function main(): number {
|
||||
return sum(1, 2);
|
||||
}
|
||||
3
tests/typescript/basic/lib/sum.ts
Normal file
3
tests/typescript/basic/lib/sum.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export function sum(a: number, b: number): number {
|
||||
return a + b;
|
||||
}
|
||||
1
tests/typescript/basic/package.json
Normal file
1
tests/typescript/basic/package.json
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ "name": "basic" }
|
||||
1
tests/typescript/complex/package.json
Normal file
1
tests/typescript/complex/package.json
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ "name": "complex" }
|
||||
6
tests/typescript/complex/src/broken.ts
Normal file
6
tests/typescript/complex/src/broken.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// Fixture with one intentionally broken relative import.
|
||||
|
||||
export const flag = true;
|
||||
import { ghost } from "./gone";
|
||||
|
||||
export const who = ghost;
|
||||
3
tests/typescript/complex/src/config.ts
Normal file
3
tests/typescript/complex/src/config.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import { trim } from "./util/../util/text";
|
||||
|
||||
export const DEFAULT = trim(" hi ");
|
||||
5
tests/typescript/complex/src/engine/index.ts
Normal file
5
tests/typescript/complex/src/engine/index.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { trim } from "../util/text";
|
||||
|
||||
export function solve(input: string): string {
|
||||
return trim(input);
|
||||
}
|
||||
7
tests/typescript/complex/src/ui/deep/nested/view.ts
Normal file
7
tests/typescript/complex/src/ui/deep/nested/view.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import {
|
||||
pad,
|
||||
} from "../../../util/text";
|
||||
|
||||
export function render(value: string): string {
|
||||
return pad(value);
|
||||
}
|
||||
7
tests/typescript/complex/src/util/text.ts
Normal file
7
tests/typescript/complex/src/util/text.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export function trim(s: string): string {
|
||||
return s.trim();
|
||||
}
|
||||
|
||||
export function pad(s: string): string {
|
||||
return ` ${s} `;
|
||||
}
|
||||
1
tests/typescript/normal/.gitignore
vendored
Normal file
1
tests/typescript/normal/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
node_modules/
|
||||
1
tests/typescript/normal/package.json
Normal file
1
tests/typescript/normal/package.json
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ "name": "normal" }
|
||||
14
tests/typescript/normal/src/app.ts
Normal file
14
tests/typescript/normal/src/app.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import type { Thing } from "./types";
|
||||
import express from "express";
|
||||
import "./impl/core";
|
||||
import { log } from "./utils/logger";
|
||||
|
||||
const cfg = require("./types");
|
||||
const later = () => import("./types");
|
||||
|
||||
export const app = express();
|
||||
export function render(t: Thing): string {
|
||||
log(cfg.name, t.id);
|
||||
return t.id;
|
||||
}
|
||||
export { later };
|
||||
3
tests/typescript/normal/src/impl/core.ts
Normal file
3
tests/typescript/normal/src/impl/core.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export function compute(x: number): number {
|
||||
return x * 2;
|
||||
}
|
||||
1
tests/typescript/normal/src/impl/index.ts
Normal file
1
tests/typescript/normal/src/impl/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from "./core";
|
||||
1
tests/typescript/normal/src/index.ts
Normal file
1
tests/typescript/normal/src/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from "./impl";
|
||||
3
tests/typescript/normal/src/types.ts
Normal file
3
tests/typescript/normal/src/types.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export interface Thing {
|
||||
id: string;
|
||||
}
|
||||
3
tests/typescript/normal/src/utils/logger.ts
Normal file
3
tests/typescript/normal/src/utils/logger.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export function log(...parts: unknown[]): void {
|
||||
void parts;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue