dsh-hashline-edit 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Hashline guidance sections for the dsh host layer.
3
3
  *
4
- * Prompt sections are owned here — `tool:read`, `tool:codegraph`, `tool:diagnostics`,
4
+ * Prompt sections are owned here — `tool:read`, `tool:rg`, `tool:codegraph`, `tool:diagnostics`,
5
5
  * `tool:write`, `tool:apply_patch` and `tool:edit` — because the hashline tools
6
6
  * must bring their own brief. The compiled default text IS the
7
7
  * pi-side guidance (`prompts/*.md`) loaded through `src/prompts.ts`, so the dsh
@@ -23,11 +23,11 @@ export interface GuidanceSection {
23
23
  /** Order used when the harness registry names no slot for this section. */
24
24
  readonly defaultOrder: number;
25
25
  /** The `systemPrompt.getSectionOrder` slot this section shadows, when one exists. */
26
- readonly orderName?: "TOOL_READ" | "TOOL_WRITE" | "TOOL_EDIT" | "TOOL_APPLY_PATCH";
26
+ readonly orderName?: "TOOL_READ" | "TOOL_WRITE" | "TOOL_EDIT" | "TOOL_APPLY_PATCH" | "TOOL_GREP";
27
27
  /** The compiled default text. */
28
28
  renderDefault(): string;
29
29
  }
30
- /** The six sections, in default-order sequence. */
30
+ /** The seven sections, in default-order sequence. */
31
31
  export declare const GUIDANCE_SECTIONS: readonly GuidanceSection[];
32
32
  /** Render the compiled default text for one section. */
33
33
  export declare function renderSectionDefault(name: string): string;
@@ -36,6 +36,8 @@ export interface GuidanceToggles {
36
36
  readonly read: boolean;
37
37
  readonly applyPatch: boolean;
38
38
  readonly edit: boolean;
39
+ /** Whether the system-`rg` search tool registered; absent keeps its section dark. */
40
+ readonly rg?: boolean;
39
41
  /** Whether the codegraph tool set registered; absent keeps its section dark. */
40
42
  readonly codegraph?: boolean;
41
43
  /** Whether the diagnostics tool registered; absent keeps its section dark. */
@@ -8,6 +8,12 @@ export interface NativeHideConfig {
8
8
  readonly hideNativeWriteTools?: BooleanSource;
9
9
  /** Extra global tool names to hide alongside the native set. */
10
10
  readonly hiddenToolNames?: readonly string[];
11
+ /**
12
+ * The denial text for one hidden name when the default editor wording would be wrong.
13
+ * The caller that configured the name is the only party that knows what replaces it;
14
+ * this layer only knows the names. Returning `undefined` keeps the editor wording.
15
+ */
16
+ readonly denialText?: ((name: string) => string | undefined) | undefined;
11
17
  /** Guidance sections to empty because this plugin provides no such tool. */
12
18
  readonly guidanceToClear?: readonly string[];
13
19
  /** The Agent scope key used for the agent-view probe; absent keeps the global probe. */
@@ -40,6 +40,8 @@ export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
40
40
  codegraph: Schema<boolean, boolean, "volatile-defined">;
41
41
  codegraphPath: Schema<string, string, "volatile-defined">;
42
42
  diagnostics: Schema<boolean, boolean, "volatile-defined">;
43
+ rg: Schema<boolean, boolean, "volatile-defined">;
44
+ rgPath: Schema<string, string, "volatile-defined">;
43
45
  }>>, Schemastery.ObjectT<NoInfer<{
44
46
  read: Schema<boolean, boolean, "volatile-defined">;
45
47
  applyPatch: Schema<boolean, boolean, "volatile-defined">;
@@ -47,6 +49,8 @@ export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
47
49
  codegraph: Schema<boolean, boolean, "volatile-defined">;
48
50
  codegraphPath: Schema<string, string, "volatile-defined">;
49
51
  diagnostics: Schema<boolean, boolean, "volatile-defined">;
52
+ rg: Schema<boolean, boolean, "volatile-defined">;
53
+ rgPath: Schema<string, string, "volatile-defined">;
50
54
  }>>, "plain">;
51
55
  /** The plugin configuration the loader passes as the second `apply` argument. */
52
56
  export interface PluginConfig {
@@ -90,6 +94,19 @@ export interface PluginConfig {
90
94
  * it needs that toolchain on the machine, and a missing one is reported as call text.
91
95
  */
92
96
  diagnostics?: boolean;
97
+ /**
98
+ * Expose the `rg` tool: file-content search executed by the system `rg`, so the user's own
99
+ * ripgrep, its version and its config are what runs. Defaults to true; while it is on the
100
+ * native `grep` tool and its `tool:grep` brief are hidden in favour of this surface, and
101
+ * its matches come back in the native grep's value shape so the read switch's grep view
102
+ * still serves them as `HASH│content` rows.
103
+ */
104
+ rg?: boolean;
105
+ /**
106
+ * Executable used for `rg` calls. Empty uses the first `rg` on `PATH`; set it when
107
+ * ripgrep lives outside `PATH` or a specific install must be pinned.
108
+ */
109
+ rgPath?: string;
93
110
  }
94
111
  /** The feature switches after the shipped defaults are applied. */
95
112
  export interface ResolvedSwitches {
@@ -99,8 +116,10 @@ export interface ResolvedSwitches {
99
116
  readonly codegraph: boolean;
100
117
  readonly codegraphPath: string;
101
118
  readonly diagnostics: boolean;
119
+ readonly rg: boolean;
120
+ readonly rgPath: string;
102
121
  }
103
- /** Resolve the plugin's switches with the shipped defaults: read and apply_patch on, edit, codegraph and diagnostics off. */
122
+ /** Resolve the plugin's switches with the shipped defaults: read, apply_patch and rg on; edit, codegraph and diagnostics off. */
104
123
  export declare function resolveSwitches(config?: PluginConfig): ResolvedSwitches;
105
124
  /**
106
125
  * Install the hashline toolset for one agent inside its own effect, so the
@@ -0,0 +1,67 @@
1
+ /** One located executable plus the arguments that always precede the call's own arguments. */
2
+ export interface RgInvocation {
3
+ /** Executable to spawn. */
4
+ readonly command: string;
5
+ /** Arguments that always precede the call arguments (unused today; a script layout would fill it). */
6
+ readonly prefixArgs: readonly string[];
7
+ /** The entry point that was found, for refusal text and diagnostics. */
8
+ readonly source: string;
9
+ }
10
+ /** A located ripgrep, or the reason none could be located. */
11
+ export type RgResolution = {
12
+ readonly ok: true;
13
+ readonly invocation: RgInvocation;
14
+ } | {
15
+ readonly ok: false;
16
+ readonly problem: string;
17
+ };
18
+ /** Inputs of {@link resolveRgInvocation}; every ambient fact is injectable for tests. */
19
+ export interface ResolveRgOptions {
20
+ /** The plugin's `rgPath` config; an empty or absent value falls back to `PATH`. */
21
+ readonly explicitPath?: string | undefined;
22
+ /** The `PATH` value to scan; defaults to `process.env.PATH`. */
23
+ readonly pathValue?: string | undefined;
24
+ /** Target platform; defaults to `process.platform`. */
25
+ readonly platform?: NodeJS.Platform | undefined;
26
+ /** Existence oracle; defaults to `existsSync`. */
27
+ readonly exists?: ((candidate: string) => boolean) | undefined;
28
+ }
29
+ /**
30
+ * Locate the ripgrep executable: an explicit `rgPath` wins, then the first `rg` entry on `PATH`.
31
+ *
32
+ * A `.cmd`/`.bat` shim is refused rather than run through a shell — a shell would re-quote the
33
+ * pattern and target this plugin passes as plain argv.
34
+ */
35
+ export declare function resolveRgInvocation(options?: ResolveRgOptions): RgResolution;
36
+ /** Default wall clock one search may take before it is killed. */
37
+ export declare const RG_TIMEOUT_MS = 30000;
38
+ /** One search's process facts. */
39
+ export interface RgRunOptions {
40
+ /** Working directory the search runs in (the live session directory). */
41
+ readonly cwd: string;
42
+ /** Caller cancellation; aborts the child and rejects with the abort reason. */
43
+ readonly signal: AbortSignal | undefined;
44
+ /** Wall clock budget; defaults to {@link RG_TIMEOUT_MS}. */
45
+ readonly timeoutMs?: number | undefined;
46
+ /** Extra environment entries layered over the host environment. */
47
+ readonly env?: NodeJS.ProcessEnv | undefined;
48
+ }
49
+ /** A finished search: both streams, the exit code, and how it ended. */
50
+ export interface RgRunResult {
51
+ readonly stdout: string;
52
+ readonly stderr: string;
53
+ /** Ripgrep's exit code: `0` matches found, `1` none, `2` an error (bad pattern, unreadable target). */
54
+ readonly code: number | null;
55
+ /** Whether the deadline killed it. */
56
+ readonly timedOut: boolean;
57
+ /** Whether the capture ceiling was reached (the stdout is then incomplete). */
58
+ readonly overflow: boolean;
59
+ }
60
+ /**
61
+ * Run one ripgrep command and capture its output.
62
+ *
63
+ * The promise resolves for every outcome the caller can report — a non-zero exit, a timeout, a
64
+ * capture overflow — and rejects only for cancellation, so a failed search never becomes an
65
+ * opaque tool error.
66
+ */
67
+ export declare function runRg(invocation: RgInvocation, args: readonly string[], options: RgRunOptions): Promise<RgRunResult>;
@@ -0,0 +1,70 @@
1
+ /** One matched line as ripgrep reported it, before display-path normalization. */
2
+ export interface RgMatch {
3
+ /** The path ripgrep printed for the match (relative to its working directory, or as given). */
4
+ readonly path: string;
5
+ /** 1-based line number of the match inside that file. */
6
+ readonly lineNumber: number;
7
+ /** The matched line's text, without its line terminator. */
8
+ readonly line: string;
9
+ }
10
+ /** Validated `grep` arguments. */
11
+ export interface RgInput {
12
+ /** The ripgrep regular expression (or literal text when {@link RgInput.fixedStrings}). */
13
+ readonly pattern: string;
14
+ /** File or directory to search; absent searches the working directory. */
15
+ readonly path?: string;
16
+ /** One positive glob filter for which files to search. */
17
+ readonly include?: string;
18
+ /** Force a case-insensitive search (`-i`); absent keeps ripgrep's smart case. */
19
+ readonly ignoreCase?: boolean;
20
+ /** Treat the pattern as literal text (`-F`) instead of a regular expression. */
21
+ readonly fixedStrings?: boolean;
22
+ /** Only match whole words (`-w`). */
23
+ readonly wordMatch?: boolean;
24
+ /** Also search hidden files and directories (`--hidden`). */
25
+ readonly hidden?: boolean;
26
+ /** Ignore `.gitignore`/`.ignore` rules and search every file (`--no-ignore`). */
27
+ readonly noIgnore?: boolean;
28
+ }
29
+ /**
30
+ * Validate the raw tool arguments into {@link RgInput}.
31
+ *
32
+ * The parameter schema already refuses a wrong type; this admission keeps the contract explicit for
33
+ * a direct (nested `run_code`) call and for the value constraints the schema cannot express: a
34
+ * non-EMPTY `pattern` (whitespace is a legitimate regex), a non-blank `path` when given, and a
35
+ * single positive `include` glob. An exact empty `include` is treated as omitted.
36
+ *
37
+ * @param raw - the tool call's raw arguments.
38
+ * @returns the accepted input.
39
+ */
40
+ export declare function parseRgArgs(raw: unknown): RgInput;
41
+ /**
42
+ * Build the fixed `rg --json` argv for one `grep` call.
43
+ *
44
+ * Every model-controlled value is a plain argv element — no shell layer exists, so no quoting
45
+ * applies. The pattern rides in `--regexp=` form and the target behind `--`, so a leading-dash
46
+ * value can never be parsed as a flag.
47
+ *
48
+ * @param input - the validated arguments.
49
+ * @returns the complete ripgrep argument vector (excluding the binary itself).
50
+ */
51
+ export declare function buildRgCommand(input: RgInput): string[];
52
+ /**
53
+ * Parse complete `rg --json` stdout into flat matches, in output order (ripgrep emits one file's
54
+ * matches contiguously and in ascending line order, which the grep view relies on).
55
+ *
56
+ * @param stdout - the complete raw `rg --json` stdout.
57
+ * @returns the flat matches; empty for output with no match records.
58
+ */
59
+ export declare function parseRgOutput(stdout: string): RgMatch[];
60
+ /**
61
+ * The model-facing path of one match: `./` stripped, and an absolute path inside the working
62
+ * directory shown relative to it.
63
+ *
64
+ * WHY: ripgrep echoes the operand it was given, so `grep path: "."` would otherwise print
65
+ * `./src/a.ts` and an absolute target would print the whole drive path. Neither is wrong, but the
66
+ * grep view resolves matches back against the working directory and the model reads the shorter
67
+ * form; a path outside the directory is kept absolute because relativizing it would invent `..`
68
+ * segments the search never named.
69
+ */
70
+ export declare function displayPath(rawPath: string, cwd: string): string;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The `rg` tool: file-content search executed by the system `rg` executable.
3
+ *
4
+ * ## Why a replacement instead of the host's grep
5
+ * The host's `grep` (`@deepseek-ai/dsh-tool-fs-search`) spawns the ripgrep binary vendored in
6
+ * `@vscode/ripgrep` with one fixed argv. This plugin is personal tooling on machines that already
7
+ * have ripgrep installed and configured (`RIPGREP_CONFIG_PATH`), and the user's own `rg` is the one
8
+ * they keep current; a first-class tool also exposes the matching switches that fixed argv cannot
9
+ * (`ignoreCase`, `fixedStrings`, `wordMatch`, `hidden`, `noIgnore`) without a shell command.
10
+ *
11
+ * ## Naming contract: `rg`, and the native `grep` is hidden
12
+ * The tool is named `rg` — the executable it runs — never `grep`: a call therefore cannot be
13
+ * confused with the host's built-in `grep` tool or with a shell `grep`/`rg` command, and no
14
+ * same-name shadowing has to be reasoned about. While the `rg` switch is on, `dsh/index.ts`
15
+ * removes the native `grep` from the agent's tool view through the native-hide lane
16
+ * (`dsh/hide.ts`), and the native `tool:grep` prompt section goes dark because the name it
17
+ * describes no longer resolves. This module owns the replacement brief (`tool:rg`, see
18
+ * `prompts/rg-guidelines.md`).
19
+ *
20
+ * ## Serving contract: the native grep's canonical value shape
21
+ * The result value is the host grep's `{ matches: [{ path, lineNumber, line }] }`, so the existing
22
+ * `dsh/shell-hook.ts` grep view re-reads each matched row from disk, serves it as `HASH│content` and
23
+ * leases it whenever the `read` switch is on. This module renders and never serves: anchors stay
24
+ * owned by one seam.
25
+ *
26
+ * @module dsh-hashline-edit/rg/tools
27
+ */
28
+ import { type ToolDefinition } from "@deepseek-ai/dsh-tools";
29
+ import { type RgInvocation, type RgResolution, type RgRunOptions, type RgRunResult } from "./cli.js";
30
+ /** The tool name this module registers: the executable it runs, deliberately not `grep`. */
31
+ export declare const RG_TOOL_NAME = "rg";
32
+ /** What one agent install hands the tool. */
33
+ export interface RgToolOptions {
34
+ /** ripgrep locator; defaults to the real PATH resolution. Re-run per call, so a PATH change is seen. */
35
+ readonly resolveRg?: (() => RgResolution) | undefined;
36
+ /** Search runner; defaults to the real spawn. */
37
+ readonly run?: ((invocation: RgInvocation, args: readonly string[], options: RgRunOptions) => Promise<RgRunResult>) | undefined;
38
+ /** Per-call wall clock budget; defaults to {@link RG_TIMEOUT_MS}. */
39
+ readonly timeoutMs?: number | undefined;
40
+ }
41
+ /**
42
+ * Build the `rg` tool definition.
43
+ *
44
+ * @param options - optional seams: a ripgrep locator, a runner and the wall clock budget.
45
+ * @returns the tool definition, ready for a scoped registration.
46
+ */
47
+ export declare function buildRgTool(options?: RgToolOptions): ToolDefinition;
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Rendering for the `rg` tool: the model-facing match text and the search-card
3
+ * projection a UI renders.
4
+ *
5
+ * WHY the same caps the grep view enforces: this tool's canonical value carries EVERY parsed match
6
+ * (so the shell/grep view can prove and serve all of them), while the text a model reads is capped
7
+ * exactly like the host grep's — at most {@link GREP_INLINE_MAX_MATCHES} matches and a bounded
8
+ * per-line preview. A result over the cap is reported as a count, never silently shortened.
9
+ *
10
+ * WHY `presentationMeta` at all: the canonical value never crosses the wire — only the rendered
11
+ * text and this metadata do — so the structured by-file shape a search card renders rides here,
12
+ * bounded to a payload small enough to persist in the session log beside every result.
13
+ *
14
+ * @module dsh-hashline-edit/rg/view
15
+ */
16
+ import type { SearchResultView } from "@deepseek-ai/dsh-tools";
17
+ import type { RgMatch } from "./command.js";
18
+ /** One match page after the inline cap was applied. */
19
+ interface RetainedMatches {
20
+ /** The matches kept inline, in output order. */
21
+ readonly items: readonly RgMatch[];
22
+ /** Every match the search found, before the cap. */
23
+ readonly seen: number;
24
+ /** Whether the cap dropped any match. */
25
+ readonly truncated: boolean;
26
+ }
27
+ /**
28
+ * Cut one matched line at a byte budget without splitting a UTF-8 code point.
29
+ *
30
+ * WHY a byte budget and not a character count: the cap exists to bound what a very long
31
+ * minified/generated line costs the model, and the cut must never emit a broken code point.
32
+ */
33
+ export declare function previewLine(line: string, maxBytes?: number): string;
34
+ /** Apply the inline match cap: the first `maxMatches` matches, plus what the search really found. */
35
+ export declare function retainMatches(matches: readonly RgMatch[], maxMatches?: number): RetainedMatches;
36
+ /**
37
+ * The model-facing `rg` text: a found-count header, the retained matches grouped by file, then —
38
+ * when the result was capped — a footer naming how many matches were not shown. A zero-match search
39
+ * reads `No matches found`, the text the host grep uses for the same state.
40
+ *
41
+ * @param matches - every match the search found, in output order.
42
+ * @returns the model-facing text.
43
+ */
44
+ export declare function formatRgText(matches: readonly RgMatch[]): string;
45
+ /**
46
+ * The private `tool/result` metadata payload: the capped, structured search result a search card
47
+ * renders on the live and replayed paths alike. `failed` marks a result that carries guidance
48
+ * instead of a search (no `rg`, a rejected pattern, the deadline), so a caller never presents it as
49
+ * an empty result; it is omitted for a real zero-match search.
50
+ */
51
+ export type RgSearchMeta = {
52
+ shape: "matches";
53
+ files: {
54
+ path: string;
55
+ matches: {
56
+ lineNumber: number;
57
+ line: string;
58
+ }[];
59
+ }[];
60
+ truncated: boolean;
61
+ total: number;
62
+ failed?: true;
63
+ };
64
+ /**
65
+ * Project the retained matches into {@link RgSearchMeta} for the search card.
66
+ *
67
+ * @param matches - every match the search found, in output order.
68
+ * @param failed - whether the call carried guidance instead of a search result.
69
+ * @returns the byte-bounded metadata.
70
+ */
71
+ export declare function rgMeta(matches: readonly RgMatch[], failed?: boolean): RgSearchMeta;
72
+ /**
73
+ * Narrow opaque live or replayed result metadata back to a search card. Malformed metadata, or a
74
+ * result that carried guidance instead of a search, returns `undefined` so the caller keeps the
75
+ * generic card instead of rendering a wrong one.
76
+ *
77
+ * @param meta - the metadata this tool projected through `output.presentationMeta`.
78
+ * @returns the search view, or `undefined` for the generic fallback.
79
+ */
80
+ export declare function searchViewFromMeta(meta: unknown): SearchResultView | undefined;
81
+ export {};
@@ -95,8 +95,8 @@ export declare function align(stdoutLines: readonly string[], fileLines: readonl
95
95
  * @returns the plan, or `undefined` when the host must pass the output through.
96
96
  */
97
97
  export declare function plan(deps: ToolDependencies, request: ShellViewRequest): Promise<ShellViewPlan | undefined>;
98
- /** The host tool whose canonical value is `{ matches: [{ path, lineNumber, line }] }`. */
99
- export declare const GREP_TOOL_NAME = "grep";
98
+ /** Every tool whose result this view serves — the native grep and this plugin's `rg`. */
99
+ export declare const GREP_TOOL_NAMES: readonly string[];
100
100
  /** The host `grepMaxMatches` default (`@deepseek-ai/dsh-tool-fs-search` `Config`). */
101
101
  export declare const GREP_INLINE_MAX_MATCHES = 250;
102
102
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-hashline-edit",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Hash-anchored read/apply_patch/edit tools for DeepSeek Harness (dsh). Every line gets a unique 3- or 4-char hash (A-Za-z0-9, configurable) that stays stable across edits; apply_patch and the anchored range edit tool are the file-mutation entry points, each committing its whole batch as one transaction.",
5
5
  "keywords": [
6
6
  "anchors",
@@ -49,6 +49,25 @@
49
49
  },
50
50
  "./package.json": "./package.json"
51
51
  },
52
+ "scripts": {
53
+ "test": "vitest run",
54
+ "test:watch": "vitest",
55
+ "test:coverage": "vitest run --coverage --coverage.thresholds.lines=85 --coverage.thresholds.statements=85 --coverage.thresholds.functions=85 --coverage.thresholds.branches=80",
56
+ "test:win": "vitest run --config vitest.config.windows.ts",
57
+ "test:win:3": "node scripts/test-width.mjs 3 dsh",
58
+ "test:win:coverage": "vitest run --config vitest.config.windows.ts --coverage --coverage.thresholds.lines=85 --coverage.thresholds.statements=85 --coverage.thresholds.functions=85 --coverage.thresholds.branches=80",
59
+ "lint": "oxlint . && knip --max-issues 0",
60
+ "lint:knip": "knip --max-issues 0",
61
+ "format": "oxfmt --check .",
62
+ "format:fix": "oxfmt .",
63
+ "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.dsh.json",
64
+ "build": "node scripts/build-dsh.mjs",
65
+ "prepublishOnly": "node scripts/build-dsh.mjs && pnpm run typecheck && pnpm run lint && pnpm run test:win",
66
+ "canon:audit": "node scripts/canon-churn-audit.mjs",
67
+ "prepack": "node scripts/build-dsh.mjs",
68
+ "audit": "pnpm audit --audit-level high --registry https://registry.npmjs.org/",
69
+ "verify": "pnpm run lint && pnpm run format && pnpm run typecheck && pnpm run test:win:coverage"
70
+ },
52
71
  "dependencies": {
53
72
  "diff": "^8.0.2",
54
73
  "file-type": "^21.3.0",
@@ -96,6 +115,7 @@
96
115
  "dsh": ">=0.2.2-rc.1 <0.2.3-0",
97
116
  "node": ">=24.0.0"
98
117
  },
118
+ "packageManager": "pnpm@12.0.0",
99
119
  "dsh": {
100
120
  "bundle": {
101
121
  "patch": "./cordis.patch.yml"
@@ -112,22 +132,5 @@
112
132
  "platform": "web",
113
133
  "immediately": true
114
134
  }
115
- },
116
- "scripts": {
117
- "test": "vitest run",
118
- "test:watch": "vitest",
119
- "test:coverage": "vitest run --coverage --coverage.thresholds.lines=85 --coverage.thresholds.statements=85 --coverage.thresholds.functions=85 --coverage.thresholds.branches=80",
120
- "test:win": "vitest run --config vitest.config.windows.ts",
121
- "test:win:3": "node scripts/test-width.mjs 3 dsh",
122
- "test:win:coverage": "vitest run --config vitest.config.windows.ts --coverage --coverage.thresholds.lines=85 --coverage.thresholds.statements=85 --coverage.thresholds.functions=85 --coverage.thresholds.branches=80",
123
- "lint": "oxlint . && knip --max-issues 0",
124
- "lint:knip": "knip --max-issues 0",
125
- "format": "oxfmt --check .",
126
- "format:fix": "oxfmt .",
127
- "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.dsh.json",
128
- "build": "node scripts/build-dsh.mjs",
129
- "canon:audit": "node scripts/canon-churn-audit.mjs",
130
- "audit": "pnpm audit --audit-level high --registry https://registry.npmjs.org/",
131
- "verify": "pnpm run lint && pnpm run format && pnpm run typecheck && pnpm run test:win:coverage"
132
135
  }
133
- }
136
+ }
@@ -0,0 +1,8 @@
1
+ # rg guidelines
2
+
3
+ - `rg` is the file-content search tool: call it instead of a shell `grep`/`rg` command, and instead of the built-in `grep`, which this profile hides while `rg` is on.
4
+ - Prefer one `rg` call over a search-then-read loop: with `read` on, every matched line comes back as `HASH│content` and is already served, so `edit`/`apply_patch` can target those anchors with no separate `read`.
5
+ - The default is ripgrep's smart case (insensitive only when the pattern has no uppercase); pass `ignoreCase` to force `-i`, `fixedStrings` for literal text, `wordMatch` for whole words.
6
+ - `hidden` adds dotfiles and directories, `noIgnore` drops `.gitignore`/`.ignore` filtering: use them to reach a file the default search skipped, not by default.
7
+ - Narrow instead of enlarging: `include` takes ONE positive glob (`*.ts`, `*.{js,jsx}`) and `path` scopes the search to a file or directory. Past 250 matches the result is reported as a count and passes through unserved.
8
+ - A result that reports no `rg` on PATH, a pattern ripgrep rejected or the time budget is guidance, not a failure: fix `rgPath`, simplify the pattern, or narrow the path rather than repeating the call.