diff --git a/biome.json b/biome.json index f2380c3e7..a5a8f3ecf 100644 --- a/biome.json +++ b/biome.json @@ -1,4 +1,10 @@ { + "vcs": { + "enabled": true, + "clientKind": "git", + "useIgnoreFile": true, + "defaultBranch": "main" + }, "linter": { "enabled": true, "rules": { diff --git a/package.json b/package.json index dd2fe8dc9..672afbf95 100644 --- a/package.json +++ b/package.json @@ -100,8 +100,11 @@ "fmt:tools": "biome format --write . --no-errors-on-unmatched", "fmt:rs": "bun scripts/run-rs-task.ts fmt:rs", "fix": "bun run --parallel fix:ts fix:rs", - "fix:ts": "bun run fix:tools && bun run --workspaces --if-present fix", - "fix:tools": "bun run fmt:tools && biome check --write --unsafe . --no-errors-on-unmatched", + "fix:all": "bun run --parallel fix:ts:all fix:rs", + "fix:ts": "bun run fix:tools && bun --cwd=packages/coding-agent run format-prompts && bun --cwd=packages/coding-agent run generate-docs-index", + "fix:ts:all": "bun run fix:tools:all && bun --cwd=packages/coding-agent run format-prompts && bun --cwd=packages/coding-agent run generate-docs-index", + "fix:tools": "biome check --write --unsafe --changed --no-errors-on-unmatched .", + "fix:tools:all": "biome check --write --unsafe --no-errors-on-unmatched .", "fix:rs": "bun scripts/run-rs-task.ts fix:rs", "ci:check:full": "bun run check:ts", "ci:build:native": "bun scripts/ci-build-native.ts", diff --git a/packages/coding-agent/src/prompts/tools/chunk-edit.md b/packages/coding-agent/src/prompts/tools/chunk-edit.md index 0e0bc336d..5ca211a2a 100644 --- a/packages/coding-agent/src/prompts/tools/chunk-edit.md +++ b/packages/coding-agent/src/prompts/tools/chunk-edit.md @@ -140,17 +140,17 @@ Only body changes; doc comment, signature, and closing `}` are preserved. `{ "path": "counter.rs:impl_Counte.fn_increm#ouer", "write": "/// Increments by the given step, clamping at max.\npub fn increment(&mut self, step: i32) {\n\tself.value = (self.value + step).min(self.max);\n}\n" }` Everything is rewritten. Omitting the doc comment or signature deletes them. # Write head (`^` — attributes, doc comments, signature) -`{ "path": "counter.rs:impl_Counte.fn_get#arco^", "write": "/// Returns the current counter value.\n#[inline]\npub fn get(&self) -> i32 {\n" }` +`{ "path": "counter.rs:impl_Counte.fn_get#arco^", "write": "/// Returns the current counter value.\n#[inline]\npub fn get(&self) → i32 {\n" }` Head changes (all `^` lines + opening brace); body untouched. # Insert before a chunk (`prepend`) `{ "path": "counter.rs:impl_Counte.fn_get", "insert": { "loc": "prepend", "body": "/// Resets the counter to zero.\npub fn reset(&mut self) {\n\tself.value = 0;\n}\n\n" } }` # Insert after a chunk (`append`) -`{ "path": "counter.rs:struct_Counte", "insert": { "loc": "append", "body": "\nimpl Default for Counter {\n\tfn default() -> Self {\n\t\tSelf { value: 0, max: 100 }\n\t}\n}\n" } }` +`{ "path": "counter.rs:struct_Counte", "insert": { "loc": "append", "body": "\nimpl Default for Counter {\n\tfn default() → Self {\n\t\tSelf { value: 0, max: 100 }\n\t}\n}\n" } }` # Insert at start of container body (`~` + `prepend`) -`{ "path": "counter.rs:impl_Counte~", "insert": { "loc": "prepend", "body": "/// Creates a counter starting at the given value.\npub fn with_value(value: i32, max: i32) -> Self {\n\tSelf { value: value.min(max), max }\n}\n\n" } }` +`{ "path": "counter.rs:impl_Counte~", "insert": { "loc": "prepend", "body": "/// Creates a counter starting at the given value.\npub fn with_value(value: i32, max: i32) → Self {\n\tSelf { value: value.min(max), max }\n}\n\n" } }` Lands at the top of the impl body, before existing methods. # Insert at end of container body (`~` + `append`) -`{ "path": "counter.rs:impl_Counte~", "insert": { "loc": "append", "body": "\n/// Returns true if the counter is at its maximum.\npub fn is_maxed(&self) -> bool {\n\tself.value >= self.max\n}\n" } }` +`{ "path": "counter.rs:impl_Counte~", "insert": { "loc": "append", "body": "\n/// Returns true if the counter is at its maximum.\npub fn is_maxed(&self) → bool {\n\tself.value ≥ self.max\n}\n" } }` Lands at the end of the impl body, before the closing `}`. # Delete a chunk `{ "path": "counter.rs:impl_Counte.fn_decrem#arve", "delete": true }` diff --git a/packages/coding-agent/src/utils/file-display-mode.ts b/packages/coding-agent/src/utils/file-display-mode.ts index e9a26ee8d..688a51540 100644 --- a/packages/coding-agent/src/utils/file-display-mode.ts +++ b/packages/coding-agent/src/utils/file-display-mode.ts @@ -26,10 +26,7 @@ export interface FileDisplayModeSession { * and when the caller signals a `raw` read — raw output should be returned as-is * without injecting hashline anchors or line numbers. */ -export function resolveFileDisplayMode( - session: FileDisplayModeSession, - options?: { raw?: boolean }, -): FileDisplayMode { +export function resolveFileDisplayMode(session: FileDisplayModeSession, options?: { raw?: boolean }): FileDisplayMode { const { settings } = session; const hasEditTool = session.hasEditTool ?? true; const editMode = resolveEditMode(session); diff --git a/scripts/edit-benchmark.py b/scripts/edit-benchmark.py index 0f5bb1a56..3f749d01b 100755 --- a/scripts/edit-benchmark.py +++ b/scripts/edit-benchmark.py @@ -17,10 +17,6 @@ import sys from edit_benchmark_common import BenchmarkSpec, EDIT_DIFF, EXPECTED_CONTENT, run_benchmark_main -# Variants recognised by packages/coding-agent/src/utils/edit-mode.ts. -VALID_VARIANTS = ("replace", "patch", "hashline", "chunk", "vim", "apply_patch") - - def _extract_variant_arg() -> str | None: """Pop `--variant ` (or `--variant=`) from sys.argv before argparse in common runs.""" argv = sys.argv @@ -40,15 +36,7 @@ def _resolve_variant() -> str: cli_variant = _extract_variant_arg() variant = cli_variant or os.environ.get("PI_EDIT_VARIANT") if not variant: - raise SystemExit( - "edit-benchmark: set PI_EDIT_VARIANT= or pass --variant .\n" - f"Valid variants: {', '.join(VALID_VARIANTS)}" - ) - if variant not in VALID_VARIANTS: - raise SystemExit( - f"edit-benchmark: unknown variant '{variant}'.\n" - f"Valid variants: {', '.join(VALID_VARIANTS)}" - ) + raise SystemExit("edit-benchmark: set PI_EDIT_VARIANT= or pass --variant .") return variant diff --git a/scripts/run-rs-task.ts b/scripts/run-rs-task.ts index 466758504..523d32813 100644 --- a/scripts/run-rs-task.ts +++ b/scripts/run-rs-task.ts @@ -27,10 +27,8 @@ const TASK_COMMANDS = { "--workspace", "--fix", "--allow-dirty", - "--all-targets", "--no-deps", "--allow-staged", - "--broken-code", "--allow-no-vcs", ], ],