chore: include pre-built dist for github install
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
export declare function stripTrailingContinuationTokens(text: string): string;
|
||||
export declare function stripMergeOperatorChars(text: string): string;
|
||||
export declare function restoreOldWrappedLines(originalLines: string[], replacementLines: string[]): string[];
|
||||
export declare function maybeExpandSingleLineMerge(originalLines: string[], replacementLines: string[]): string[];
|
||||
export declare function restoreIndentForPairedReplacement(originalLines: string[], replacementLines: string[]): string[];
|
||||
export declare function autocorrectReplacementLines(originalLines: string[], replacementLines: string[]): string[];
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
export declare const NIBBLE_STR = "ZPMQVRWSNKTXJBYH";
|
||||
export declare const HASHLINE_DICT: string[];
|
||||
export declare const HASHLINE_REF_PATTERN: RegExp;
|
||||
export declare const HASHLINE_OUTPUT_PATTERN: RegExp;
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
export declare function toHashlineContent(content: string): string;
|
||||
export declare function generateUnifiedDiff(oldContent: string, newContent: string, filePath: string): string;
|
||||
export declare function countLineDiffs(oldContent: string, newContent: string): {
|
||||
additions: number;
|
||||
deletions: number;
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
import type { HashlineEdit } from "./types";
|
||||
export declare function dedupeEdits(edits: HashlineEdit[]): {
|
||||
edits: HashlineEdit[];
|
||||
deduplicatedEdits: number;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
interface EditApplyOptions {
|
||||
skipValidation?: boolean;
|
||||
}
|
||||
export declare function applySetLine(lines: string[], anchor: string, newText: string | string[], options?: EditApplyOptions): string[];
|
||||
export declare function applyReplaceLines(lines: string[], startAnchor: string, endAnchor: string, newText: string | string[], options?: EditApplyOptions): string[];
|
||||
export declare function applyInsertAfter(lines: string[], anchor: string, text: string | string[], options?: EditApplyOptions): string[];
|
||||
export declare function applyInsertBefore(lines: string[], anchor: string, text: string | string[], options?: EditApplyOptions): string[];
|
||||
export declare function applyAppend(lines: string[], text: string | string[]): string[];
|
||||
export declare function applyPrepend(lines: string[], text: string | string[]): string[];
|
||||
export {};
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { HashlineEdit } from "./types";
|
||||
export interface HashlineApplyReport {
|
||||
content: string;
|
||||
noopEdits: number;
|
||||
deduplicatedEdits: number;
|
||||
}
|
||||
export declare function applyHashlineEditsWithReport(content: string, edits: HashlineEdit[]): HashlineApplyReport;
|
||||
export declare function applyHashlineEdits(content: string, edits: HashlineEdit[]): string;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import type { HashlineEdit } from "./types";
|
||||
export declare function getEditLineNumber(edit: HashlineEdit): number;
|
||||
export declare function collectLineRefs(edits: HashlineEdit[]): string[];
|
||||
export declare function detectOverlappingRanges(edits: HashlineEdit[]): string | null;
|
||||
@@ -0,0 +1,7 @@
|
||||
export declare function stripLinePrefixes(lines: string[]): string[];
|
||||
export declare function toNewLines(input: string | string[]): string[];
|
||||
export declare function restoreLeadingIndent(templateLine: string, line: string): string;
|
||||
export declare function stripInsertAnchorEcho(anchorLine: string, newLines: string[]): string[];
|
||||
export declare function stripInsertBeforeEcho(anchorLine: string, newLines: string[]): string[];
|
||||
export declare function stripInsertBoundaryEcho(afterLine: string, beforeLine: string, newLines: string[]): string[];
|
||||
export declare function stripRangeBoundaryEcho(lines: string[], startLine: number, endLine: number, newLines: string[]): string[];
|
||||
@@ -0,0 +1,7 @@
|
||||
export interface FileTextEnvelope {
|
||||
content: string;
|
||||
hadBom: boolean;
|
||||
lineEnding: "\n" | "\r\n";
|
||||
}
|
||||
export declare function canonicalizeFileText(content: string): FileTextEnvelope;
|
||||
export declare function restoreFileText(content: string, envelope: FileTextEnvelope): string;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
export declare function computeLineHash(lineNumber: number, content: string): string;
|
||||
export declare function formatHashLine(lineNumber: number, content: string): string;
|
||||
export declare function formatHashLines(content: string): string;
|
||||
export interface HashlineStreamOptions {
|
||||
startLine?: number;
|
||||
maxChunkLines?: number;
|
||||
maxChunkBytes?: number;
|
||||
}
|
||||
export declare function streamHashLinesFromUtf8(source: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>, options?: HashlineStreamOptions): AsyncGenerator<string>;
|
||||
export declare function streamHashLinesFromLines(lines: Iterable<string> | AsyncIterable<string>, options?: HashlineStreamOptions): AsyncGenerator<string>;
|
||||
@@ -0,0 +1,10 @@
|
||||
export interface HashlineChunkFormatter {
|
||||
push(formattedLine: string): string[];
|
||||
flush(): string | undefined;
|
||||
}
|
||||
interface HashlineChunkFormatterOptions {
|
||||
maxChunkLines: number;
|
||||
maxChunkBytes: number;
|
||||
}
|
||||
export declare function createHashlineChunkFormatter(options: HashlineChunkFormatterOptions): HashlineChunkFormatter;
|
||||
export {};
|
||||
@@ -0,0 +1 @@
|
||||
export declare function generateHashlineDiff(oldContent: string, newContent: string, filePath: string): string;
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { ToolContext } from "@opencode-ai/plugin/tool";
|
||||
import { type RawHashlineEdit } from "./normalize-edits";
|
||||
interface HashlineEditArgs {
|
||||
filePath: string;
|
||||
edits: RawHashlineEdit[];
|
||||
delete?: boolean;
|
||||
rename?: string;
|
||||
}
|
||||
export declare function executeHashlineEditTool(args: HashlineEditArgs, context: ToolContext): Promise<string>;
|
||||
export {};
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
export { computeLineHash, formatHashLine, formatHashLines, streamHashLinesFromLines, streamHashLinesFromUtf8, } from "./hash-computation";
|
||||
export { parseLineRef, validateLineRef } from "./validation";
|
||||
export type { LineRef } from "./validation";
|
||||
export type { ReplaceEdit, AppendEdit, PrependEdit, HashlineEdit, } from "./types";
|
||||
export { NIBBLE_STR, HASHLINE_DICT, HASHLINE_REF_PATTERN, HASHLINE_OUTPUT_PATTERN } from "./constants";
|
||||
export { applyHashlineEdits, } from "./edit-operations";
|
||||
export { createHashlineEditTool } from "./tools";
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import type { HashlineEdit } from "./types";
|
||||
type HashlineToolOp = "replace" | "append" | "prepend";
|
||||
export interface RawHashlineEdit {
|
||||
op?: HashlineToolOp;
|
||||
pos?: string;
|
||||
end?: string;
|
||||
lines?: string | string[] | null;
|
||||
}
|
||||
export declare function normalizeHashlineEdits(rawEdits: RawHashlineEdit[]): HashlineEdit[];
|
||||
export {};
|
||||
@@ -0,0 +1 @@
|
||||
export declare const HASHLINE_EDIT_DESCRIPTION = "Edit files using LINE#ID format for precise, safe modifications.\n\nWORKFLOW:\n1. Read target file/range and copy exact LINE#ID tags.\n2. Pick the smallest operation per logical mutation site.\n3. Submit one edit call per file with all related operations.\n4. If same file needs another call, re-read first.\n5. Use anchors as \"LINE#ID\" only (never include trailing \"|content\").\n\nVALIDATION:\n Payload shape: { \"filePath\": string, \"edits\": [...], \"delete\"?: boolean, \"rename\"?: string }\n Each edit must be one of: replace, append, prepend\n Edit shape: { \"op\": \"replace\"|\"append\"|\"prepend\", \"pos\"?: \"LINE#ID\", \"end\"?: \"LINE#ID\", \"lines\": string|string[]|null }\n lines must contain plain replacement text only (no LINE#ID prefixes, no diff + markers)\n CRITICAL: all operations validate against the same pre-edit file snapshot and apply bottom-up. Refs/tags are interpreted against the last-read version of the file.\n\nLINE#ID FORMAT (CRITICAL):\n Each line reference must be in \"{line_number}#{hash_id}\" format where:\n {line_number}: 1-based line number\n {hash_id}: Two CID letters from the set ZPMQVRWSNKTXJBYH\n\nFILE MODES:\n delete=true deletes file and requires edits=[] with no rename\n rename moves final content to a new path and removes old path\n\nCONTENT FORMAT:\n lines can be a string (single line) or string[] (multi-line, preferred).\n If you pass a multi-line string, it is split by real newline characters.\n Literal \"\\n\" is preserved as text.\n\nFILE CREATION:\n append without anchors adds content at EOF. If file does not exist, creates it.\n prepend without anchors adds content at BOF. If file does not exist, creates it.\n CRITICAL: only unanchored append/prepend can create a missing file.\n\nOPERATION CHOICE:\n replace with pos only -> replace one line at pos\n replace with pos+end -> replace ENTIRE range pos..end as a block (ranges MUST NOT overlap across edits)\n append with pos/end anchor -> insert after that anchor\n prepend with pos/end anchor -> insert before that anchor\n append/prepend without anchors -> EOF/BOF insertion\n\nRULES (CRITICAL):\n 1. Minimize scope: one logical mutation site per operation.\n 2. Preserve formatting: keep indentation, punctuation, line breaks, trailing commas, brace style.\n 3. Prefer insertion over neighbor rewrites: anchor to structural boundaries (}, ], },), not interior property lines.\n 4. No no-ops: replacement content must differ from current content.\n 5. Touch only requested code: avoid incidental edits.\n 6. Use exact current tokens: NEVER rewrite approximately.\n 7. For swaps/moves: prefer one range operation over multiple single-line operations.\n 8. Output tool calls only; no prose or commentary between them.\n\nTAG CHOICE (ALWAYS):\n - Copy tags exactly from read output or >>> mismatch output.\n - NEVER guess tags.\n - Anchor to structural lines (function/class/brace), NEVER blank lines.\n - Anti-pattern warning: blank/whitespace anchors are fragile.\n - Re-read after each successful edit call before issuing another on the same file.\n\nAUTOCORRECT (built-in - you do NOT need to handle these):\n Merged lines are auto-expanded back to original line count.\n Indentation is auto-restored from original lines.\n BOM and CRLF line endings are preserved automatically.\n Hashline prefixes and diff markers in text are auto-stripped.\n\nRECOVERY (when >>> mismatch error appears):\n Copy the updated LINE#ID tags shown in the error output directly.\n Re-read only if the needed tags are missing from the error snippet.\n ALWAYS batch all edits for one file in a single call.";
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
import { type ToolDefinition } from "@opencode-ai/plugin/tool";
|
||||
export declare function createHashlineEditTool(): ToolDefinition;
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
export interface ReplaceEdit {
|
||||
op: "replace";
|
||||
pos: string;
|
||||
end?: string;
|
||||
lines: string | string[];
|
||||
}
|
||||
export interface AppendEdit {
|
||||
op: "append";
|
||||
pos?: string;
|
||||
lines: string | string[];
|
||||
}
|
||||
export interface PrependEdit {
|
||||
op: "prepend";
|
||||
pos?: string;
|
||||
lines: string | string[];
|
||||
}
|
||||
export type HashlineEdit = ReplaceEdit | AppendEdit | PrependEdit;
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
export interface LineRef {
|
||||
line: number;
|
||||
hash: string;
|
||||
}
|
||||
interface HashMismatch {
|
||||
line: number;
|
||||
expected: string;
|
||||
}
|
||||
export declare function normalizeLineRef(ref: string): string;
|
||||
export declare function parseLineRef(ref: string): LineRef;
|
||||
export declare function validateLineRef(lines: string[], ref: string): void;
|
||||
export declare class HashlineMismatchError extends Error {
|
||||
private readonly mismatches;
|
||||
private readonly fileLines;
|
||||
readonly remaps: ReadonlyMap<string, string>;
|
||||
constructor(mismatches: HashMismatch[], fileLines: string[]);
|
||||
static formatMessage(mismatches: HashMismatch[], fileLines: string[]): string;
|
||||
}
|
||||
export declare function validateLineRefs(lines: string[], refs: string[]): void;
|
||||
export {};
|
||||
Reference in New Issue
Block a user