@open-cr-agent/core 0.11.0 → 0.13.0
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.
- package/dist/agent/settings.d.ts +1 -1
- package/dist/agent/settings.js +2 -1
- package/dist/{rereview → anchor}/quote.js +1 -1
- package/dist/contracts.d.ts +3 -0
- package/dist/docs/guidelines.d.ts +19 -0
- package/dist/docs/guidelines.js +97 -0
- package/dist/fix/check.d.ts +13 -0
- package/dist/fix/check.js +62 -0
- package/dist/fix/prompt.d.ts +11 -0
- package/dist/fix/prompt.js +42 -0
- package/dist/fix/propose.d.ts +31 -0
- package/dist/fix/propose.js +96 -0
- package/dist/fix/select.d.ts +7 -0
- package/dist/fix/select.js +22 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +3 -0
- package/dist/internal.d.ts +3 -1
- package/dist/internal.js +3 -1
- package/dist/pipeline/assemble-report.d.ts +2 -0
- package/dist/pipeline/assemble-report.js +6 -2
- package/dist/pipeline/check-stage.js +1 -2
- package/dist/pipeline/context-footprint.d.ts +10 -0
- package/dist/pipeline/context-footprint.js +36 -0
- package/dist/pipeline/execute-stage.d.ts +1 -1
- package/dist/pipeline/execute-stage.js +4 -1
- package/dist/pipeline/execute.d.ts +4 -0
- package/dist/pipeline/execute.js +6 -1
- package/dist/pipeline/findings.js +1 -1
- package/dist/pipeline/fix-stage.d.ts +12 -0
- package/dist/pipeline/fix-stage.js +34 -0
- package/dist/pipeline/options.d.ts +12 -2
- package/dist/pipeline/options.js +20 -0
- package/dist/pipeline/plan-output.d.ts +21 -0
- package/dist/pipeline/plan-output.js +11 -0
- package/dist/pipeline/plan.d.ts +2 -0
- package/dist/pipeline/plan.js +2 -0
- package/dist/pipeline/preview.d.ts +2 -0
- package/dist/pipeline/preview.js +12 -4
- package/dist/pipeline/run.js +4 -1
- package/dist/pipeline/task-prompt.d.ts +5 -1
- package/dist/pipeline/task-prompt.js +15 -4
- package/dist/plugin/types.d.ts +1 -0
- package/dist/report/output-schema.d.ts +17 -0
- package/dist/report/output-schema.js +8 -0
- package/dist/report/output.js +8 -0
- package/dist/report/report.d.ts +3 -1
- package/dist/report/report.js +1 -0
- package/dist/report/serialize.d.ts +0 -1
- package/dist/report/serialize.js +1 -15
- package/dist/rereview/presence.js +1 -1
- package/dist/review/context-sources.d.ts +5 -0
- package/dist/review/context-sources.js +37 -0
- package/dist/review/prompt-text.d.ts +1 -1
- package/dist/review/prompt-text.js +1 -0
- package/dist/review/prompt.d.ts +10 -2
- package/dist/review/prompt.js +106 -44
- package/dist/task/linked-task.d.ts +2 -0
- package/dist/task/linked-task.js +2 -0
- package/dist/unsafe-text.d.ts +1 -0
- package/dist/unsafe-text.js +15 -0
- package/package.json +1 -1
- /package/dist/{rereview → anchor}/quote.d.ts +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// What a review task's prompt is made of, one source per part (ADR-0057):
|
|
2
|
+
// the plan preview counts each one's tokens, and an ablation run leaves out
|
|
3
|
+
// the ones it names to measure what each is worth.
|
|
4
|
+
export const CONTEXT_SOURCES = [
|
|
5
|
+
"system",
|
|
6
|
+
"change_request",
|
|
7
|
+
"changed_files",
|
|
8
|
+
"linked_tasks",
|
|
9
|
+
"guidelines",
|
|
10
|
+
"rules",
|
|
11
|
+
"accepted",
|
|
12
|
+
"learnings",
|
|
13
|
+
"project_docs",
|
|
14
|
+
"diff",
|
|
15
|
+
"callers",
|
|
16
|
+
"analyzer",
|
|
17
|
+
"plan",
|
|
18
|
+
"instructions",
|
|
19
|
+
];
|
|
20
|
+
// The sources a run can leave out. The reviewer's own instructions, the diff
|
|
21
|
+
// and the plan phase are the review itself; "description" leaves out only the
|
|
22
|
+
// change request's description, and "rules" only the repository's rules.
|
|
23
|
+
export const OPTIONAL_CONTEXT = [
|
|
24
|
+
"description",
|
|
25
|
+
"changed_files",
|
|
26
|
+
"linked_tasks",
|
|
27
|
+
"guidelines",
|
|
28
|
+
"rules",
|
|
29
|
+
"accepted",
|
|
30
|
+
"learnings",
|
|
31
|
+
"project_docs",
|
|
32
|
+
"callers",
|
|
33
|
+
"analyzer",
|
|
34
|
+
];
|
|
35
|
+
export function isOptionalContext(value) {
|
|
36
|
+
return OPTIONAL_CONTEXT.includes(value);
|
|
37
|
+
}
|
|
@@ -2,7 +2,7 @@ declare const brand: unique symbol;
|
|
|
2
2
|
export type PromptText = string & {
|
|
3
3
|
readonly [brand]: "PromptText";
|
|
4
4
|
};
|
|
5
|
-
declare const SECTIONS: readonly ["change_request", "title", "description", "changed_files", "linked_tasks", "task", "body", "parent", "subtasks", "project_docs", "doc", "doc_index", "repository_guidelines", "review_rules", "accepted_findings", "team_learnings", "learning", "learning_index", "review_files", "file", "findings", "finding", "diff", "file_excerpt", "related_code", "callers", "analyzer_results", "review_plan", "reply", "thread", "question", "merge_checks", "check"];
|
|
5
|
+
declare const SECTIONS: readonly ["change_request", "title", "description", "changed_files", "linked_tasks", "task", "body", "parent", "subtasks", "project_docs", "doc", "doc_index", "repository_guidelines", "review_rules", "accepted_findings", "team_learnings", "learning", "learning_index", "review_files", "file", "findings", "finding", "lines_to_replace", "diff", "file_excerpt", "related_code", "callers", "analyzer_results", "review_plan", "reply", "thread", "question", "merge_checks", "check"];
|
|
6
6
|
export type SectionName = (typeof SECTIONS)[number];
|
|
7
7
|
export declare function data(text: string): PromptText;
|
|
8
8
|
export declare function ocraText(text: string): PromptText;
|
package/dist/review/prompt.d.ts
CHANGED
|
@@ -4,17 +4,19 @@ import type { Learning } from "../knowledge/learning.js";
|
|
|
4
4
|
import type { MemoryEntry } from "../memory/memory.js";
|
|
5
5
|
import type { AnalyzerResult } from "../sarif/evidence.js";
|
|
6
6
|
import { type LinkedTask } from "../task/linked-task.js";
|
|
7
|
+
import type { ContextSource, OptionalContext } from "./context-sources.js";
|
|
7
8
|
import type { SymbolUse } from "./impact.js";
|
|
8
9
|
import { type PromptText } from "./prompt-text.js";
|
|
9
10
|
import type { ReviewerDefinition } from "./reviewer.js";
|
|
10
|
-
export declare const MAX_GUIDELINES_CHARS = 20000;
|
|
11
11
|
export interface ReviewPromptInput {
|
|
12
12
|
reviewer: ReviewerDefinition;
|
|
13
13
|
changeRequest: ChangeRequest;
|
|
14
14
|
changedFiles: readonly FileDiff[];
|
|
15
15
|
bundle: readonly FileDiff[];
|
|
16
16
|
rules: string;
|
|
17
|
+
repoRules?: string;
|
|
17
18
|
guidelines?: string | undefined;
|
|
19
|
+
moreGuidelines?: readonly string[];
|
|
18
20
|
linkedTasks?: readonly LinkedTask[];
|
|
19
21
|
accepted?: readonly MemoryEntry[];
|
|
20
22
|
learnings?: readonly Learning[];
|
|
@@ -24,11 +26,17 @@ export interface ReviewPromptInput {
|
|
|
24
26
|
analyzerResults?: readonly AnalyzerResult[];
|
|
25
27
|
plan?: string | undefined;
|
|
26
28
|
forPlanning?: boolean;
|
|
29
|
+
without?: ReadonlySet<OptionalContext>;
|
|
27
30
|
}
|
|
28
31
|
export interface ReviewPrompt {
|
|
29
32
|
system: string;
|
|
30
33
|
user: string;
|
|
31
34
|
}
|
|
35
|
+
export interface PromptPart {
|
|
36
|
+
source: ContextSource;
|
|
37
|
+
text: PromptText;
|
|
38
|
+
}
|
|
32
39
|
export declare function buildReviewPrompt(input: ReviewPromptInput): ReviewPrompt;
|
|
33
|
-
export declare function
|
|
40
|
+
export declare function reviewPromptParts(input: ReviewPromptInput): PromptPart[];
|
|
41
|
+
export declare function renderChangeRequest(cr: ChangeRequest, maxDescription?: number, withDescription?: boolean): PromptText;
|
|
34
42
|
export declare const MAX_LISTED_LEARNINGS = 10;
|
package/dist/review/prompt.js
CHANGED
|
@@ -1,63 +1,107 @@
|
|
|
1
|
+
import { MAX_GUIDELINES_CHARS } from "../docs/guidelines.js";
|
|
1
2
|
import { PROJECT_DOC_LIMITS } from "../docs/project-docs.js";
|
|
2
3
|
import { LINKED_TASK_LIMITS } from "../task/linked-task.js";
|
|
3
4
|
import { data, join, ocraText, oneLine, section, truncated, } from "./prompt-text.js";
|
|
4
5
|
import { REVIEW_TOOLS } from "./tools.js";
|
|
5
|
-
export const MAX_GUIDELINES_CHARS = 20_000;
|
|
6
6
|
// Runtimes cap an agent's turns, and on OpenCode the last turn has no tools:
|
|
7
7
|
// a reviewer that kept its findings for the end lost them. A quarter of the
|
|
8
8
|
// review tasks on Vertex ended at the cap (2026-09-28).
|
|
9
9
|
const TURN_BUDGET = `## Turn budget
|
|
10
10
|
Your turns are limited, and the last one allows no tool calls, so a finding you have not reported by then is lost. Report each issue with ${REVIEW_TOOLS.reportFinding} as soon as you have confirmed it, before you investigate the next one; never keep findings for the end. Spread your turns over every file in <ocra_review_files>.`;
|
|
11
|
-
// Sections shared by every bundle of a run come first so providers can reuse
|
|
12
|
-
// the cached prefix; bundle-specific sections follow.
|
|
13
11
|
export function buildReviewPrompt(input) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
const [system, ...user] = reviewPromptParts(input);
|
|
13
|
+
return {
|
|
14
|
+
system: system?.text ?? "",
|
|
15
|
+
user: join(user.map((p) => p.text), "\n\n"),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
// The system prompt first, then the user prompt's parts in order. Parts
|
|
19
|
+
// shared by every bundle of a run come first so providers can reuse the
|
|
20
|
+
// cached prefix; bundle-specific parts follow.
|
|
21
|
+
export function reviewPromptParts(input) {
|
|
22
|
+
const without = input.without ?? new Set();
|
|
23
|
+
const parts = [];
|
|
24
|
+
const add = (source, text) => parts.push({ source, text });
|
|
25
|
+
add("system", ocraText(`${input.reviewer.systemPrompt}\n\n${TURN_BUDGET}`));
|
|
26
|
+
add("change_request", renderChangeRequest(input.changeRequest, MAX_DESCRIPTION_CHARS, !without.has("description")));
|
|
27
|
+
if (!without.has("changed_files"))
|
|
28
|
+
add("changed_files", renderChangedFiles(input.changedFiles));
|
|
29
|
+
if (input.linkedTasks && input.linkedTasks.length > 0 && !without.has("linked_tasks")) {
|
|
30
|
+
add("linked_tasks", renderLinkedTasks(input.linkedTasks));
|
|
31
|
+
}
|
|
32
|
+
if (input.guidelines?.trim() && !without.has("guidelines")) {
|
|
33
|
+
add("guidelines", renderGuidelines(input.guidelines, input.moreGuidelines ?? []));
|
|
20
34
|
}
|
|
21
|
-
|
|
22
|
-
|
|
35
|
+
const rules = renderRules(input.rules, without.has("rules") ? "" : (input.repoRules ?? ""));
|
|
36
|
+
if (rules)
|
|
37
|
+
add("rules", rules);
|
|
38
|
+
if (input.accepted && input.accepted.length > 0 && !without.has("accepted")) {
|
|
39
|
+
add("accepted", renderAccepted(input.accepted));
|
|
23
40
|
}
|
|
24
|
-
if (input.rules.trim())
|
|
25
|
-
sections.push(section("review_rules", data(input.rules)));
|
|
26
|
-
if (input.accepted && input.accepted.length > 0)
|
|
27
|
-
sections.push(renderAccepted(input.accepted));
|
|
28
41
|
const given = input.learnings ?? [];
|
|
29
42
|
const more = input.moreLearnings ?? [];
|
|
30
|
-
if (given.length > 0 || more.length > 0)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
if ((given.length > 0 || more.length > 0) && !without.has("learnings")) {
|
|
44
|
+
add("learnings", renderLearnings(given, more));
|
|
45
|
+
}
|
|
46
|
+
if (input.projectDocs && !without.has("project_docs")) {
|
|
47
|
+
add("project_docs", renderProjectDocs(input.projectDocs));
|
|
48
|
+
}
|
|
49
|
+
add("diff", section("review_files", input.bundle.map(renderFile)));
|
|
50
|
+
if (input.callers && input.callers.length > 0 && !without.has("callers")) {
|
|
51
|
+
add("callers", renderCallers(input.callers));
|
|
52
|
+
}
|
|
53
|
+
if (input.analyzerResults && input.analyzerResults.length > 0 && !without.has("analyzer")) {
|
|
54
|
+
add("analyzer", renderAnalyzerResults(input.analyzerResults));
|
|
55
|
+
}
|
|
56
|
+
if (input.plan) {
|
|
57
|
+
add("plan", section("review_plan", [
|
|
58
|
+
ocraText("A planning pass suggests checking these first; it may be wrong, so verify before you report."),
|
|
59
|
+
data(input.plan),
|
|
60
|
+
]));
|
|
61
|
+
}
|
|
44
62
|
if (!input.forPlanning) {
|
|
45
|
-
|
|
63
|
+
add("instructions", ocraText(`Review every file in <ocra_review_files>. Report each issue with ${REVIEW_TOOLS.reportFinding} as soon as you confirm it, then call ${REVIEW_TOOLS.taskDone}. Where a file shows "‹ocra_", the file itself has "<ocra_"; quote it that way.`));
|
|
46
64
|
}
|
|
47
|
-
return
|
|
48
|
-
system: `${input.reviewer.systemPrompt}\n\n${TURN_BUDGET}`,
|
|
49
|
-
user: join(sections, "\n\n"),
|
|
50
|
-
};
|
|
65
|
+
return parts;
|
|
51
66
|
}
|
|
52
67
|
const MAX_TITLE_CHARS = 300;
|
|
53
68
|
const MAX_DESCRIPTION_CHARS = 8_000;
|
|
69
|
+
const MAX_REPO_RULES_CHARS = 12_000;
|
|
54
70
|
// Also used by the judge, which sees the same change request.
|
|
55
|
-
export function renderChangeRequest(cr, maxDescription = MAX_DESCRIPTION_CHARS) {
|
|
71
|
+
export function renderChangeRequest(cr, maxDescription = MAX_DESCRIPTION_CHARS, withDescription = true) {
|
|
56
72
|
return section("change_request", [
|
|
57
73
|
section("title", truncated(cr.title, MAX_TITLE_CHARS)),
|
|
58
|
-
section("description", truncated(cr.description, maxDescription)),
|
|
74
|
+
...(withDescription ? [section("description", truncated(cr.description, maxDescription))] : []),
|
|
75
|
+
]);
|
|
76
|
+
}
|
|
77
|
+
const MAX_LISTED_GUIDELINES = 30;
|
|
78
|
+
// Sections are chosen whole (docs/guidelines.ts); the cut here only bounds
|
|
79
|
+
// a document whose first section alone is over the limit.
|
|
80
|
+
function renderGuidelines(text, left) {
|
|
81
|
+
const listed = left.slice(0, MAX_LISTED_GUIDELINES);
|
|
82
|
+
return section("repository_guidelines", [
|
|
83
|
+
truncated(text, MAX_GUIDELINES_CHARS),
|
|
84
|
+
...(listed.length > 0
|
|
85
|
+
? [
|
|
86
|
+
ocraText(`More sections of AGENTS.md, by heading; read it with ${REVIEW_TOOLS.readFile} if one may apply:`),
|
|
87
|
+
...listed.map((h) => data(`- ${oneLine(clip(h, MAX_TITLE_CHARS))}`)),
|
|
88
|
+
...(left.length > listed.length
|
|
89
|
+
? [ocraText(`and ${left.length - listed.length} more.`)]
|
|
90
|
+
: []),
|
|
91
|
+
]
|
|
92
|
+
: []),
|
|
59
93
|
]);
|
|
60
94
|
}
|
|
95
|
+
// The reviewer's rules are ocra's and short; the repository's are held to a
|
|
96
|
+
// limit, as the guidelines are.
|
|
97
|
+
function renderRules(builtin, repo) {
|
|
98
|
+
const parts = [];
|
|
99
|
+
if (builtin.trim())
|
|
100
|
+
parts.push(data(builtin));
|
|
101
|
+
if (repo.trim())
|
|
102
|
+
parts.push(truncated(repo, MAX_REPO_RULES_CHARS));
|
|
103
|
+
return parts.length > 0 ? section("review_rules", join(parts, "\n\n")) : undefined;
|
|
104
|
+
}
|
|
61
105
|
// Every task of a run shares the list: rendered once per run.
|
|
62
106
|
const changedFilesText = new WeakMap();
|
|
63
107
|
function renderChangedFiles(files) {
|
|
@@ -68,12 +112,20 @@ function renderChangedFiles(files) {
|
|
|
68
112
|
}
|
|
69
113
|
return text;
|
|
70
114
|
}
|
|
115
|
+
// Every task carries the list, so a change of thousands of files would
|
|
116
|
+
// repeat it in each; the bundle's own files are in its review_files anyway.
|
|
117
|
+
const MAX_LISTED_CHANGED_FILES = 150;
|
|
71
118
|
function renderChangedFilesOnce(files) {
|
|
72
|
-
const
|
|
119
|
+
const listed = files.slice(0, MAX_LISTED_CHANGED_FILES);
|
|
120
|
+
const lines = listed.map((f) => {
|
|
73
121
|
const path = f.kind === "renamed" ? `${f.oldPath} -> ${f.newPath}` : f.newPath;
|
|
74
122
|
return join([ocraText(`${f.kind} `), data(oneLine(path)), ocraText(` (+${f.additions} -${f.deletions})`)], "");
|
|
75
123
|
});
|
|
76
|
-
|
|
124
|
+
const unlisted = files.length - listed.length;
|
|
125
|
+
return section("changed_files", [
|
|
126
|
+
...lines,
|
|
127
|
+
...(unlisted > 0 ? [ocraText(`and ${unlisted} more changed files.`)] : []),
|
|
128
|
+
]);
|
|
77
129
|
}
|
|
78
130
|
// Every task of a run shares the tasks: rendered once per run.
|
|
79
131
|
const linkedTasksText = new WeakMap();
|
|
@@ -90,17 +142,17 @@ function renderLinkedTasks(tasks) {
|
|
|
90
142
|
}
|
|
91
143
|
function renderLinkedTask(task) {
|
|
92
144
|
const parts = [
|
|
93
|
-
section("title", data(oneLine(task.title))),
|
|
145
|
+
section("title", data(oneLine(clip(task.title, LINKED_TASK_LIMITS.title)))),
|
|
94
146
|
section("body", truncated(task.body, LINKED_TASK_LIMITS.body)),
|
|
95
147
|
];
|
|
96
148
|
if (task.parent) {
|
|
97
149
|
parts.push(section("parent", [
|
|
98
|
-
data(oneLine(task.parent.title)),
|
|
150
|
+
data(oneLine(clip(task.parent.title, LINKED_TASK_LIMITS.title))),
|
|
99
151
|
truncated(task.parent.body, LINKED_TASK_LIMITS.parentBody),
|
|
100
152
|
], { key: task.parent.key }));
|
|
101
153
|
}
|
|
102
154
|
if (task.subtasks.length > 0) {
|
|
103
|
-
parts.push(section("subtasks", task.subtasks.map((t) => data(oneLine(`- ${t.key} ${t.title}${t.state ? ` (${t.state})` : ""}`)))));
|
|
155
|
+
parts.push(section("subtasks", task.subtasks.map((t) => data(oneLine(`- ${t.key} ${clip(t.title, LINKED_TASK_LIMITS.subtaskTitle)}${t.state ? ` (${t.state})` : ""}`)))));
|
|
104
156
|
}
|
|
105
157
|
return section("task", parts, {
|
|
106
158
|
tracker: task.tracker,
|
|
@@ -109,18 +161,25 @@ function renderLinkedTask(task) {
|
|
|
109
161
|
...(task.labels.length > 0 ? { labels: task.labels.join(", ") } : {}),
|
|
110
162
|
});
|
|
111
163
|
}
|
|
164
|
+
// Memory only grows, and every entry on a bundle's files would otherwise
|
|
165
|
+
// reach its prompt: the last listed are shown, each on one short line.
|
|
166
|
+
// applyMemory still drops every remembered finding by its fingerprint.
|
|
167
|
+
const ACCEPTED_LIMITS = { entries: 20, title: 160, reason: 240 };
|
|
112
168
|
function renderAccepted(entries) {
|
|
113
|
-
const
|
|
169
|
+
const kept = entries.slice(-ACCEPTED_LIMITS.entries);
|
|
170
|
+
const lines = kept.map((e) => data(oneLine(`- ${e.file}: ${clip(e.title, ACCEPTED_LIMITS.title)} (accepted: ${clip(e.reason, ACCEPTED_LIMITS.reason)})`)));
|
|
171
|
+
const earlier = entries.length - kept.length;
|
|
114
172
|
return section("accepted_findings", [
|
|
115
173
|
ocraText("The team has accepted these; do not report them again."),
|
|
116
174
|
...lines,
|
|
175
|
+
...(earlier > 0 ? [ocraText(`and ${earlier} more accepted earlier.`)] : []),
|
|
117
176
|
]);
|
|
118
177
|
}
|
|
119
178
|
export const MAX_LISTED_LEARNINGS = 10;
|
|
120
179
|
function renderLearnings(given, more) {
|
|
121
180
|
return section("team_learnings", [
|
|
122
181
|
ocraText("What the team learned from earlier changes to this code. Check whether this change repeats a mistake one describes; report only what the change itself gets wrong, never a learning alone."),
|
|
123
|
-
...given.map((l) => section("learning", [data(oneLine(l.title)), data(l.body)], {
|
|
182
|
+
...given.map((l) => section("learning", [data(oneLine(clip(l.title, MAX_TITLE_CHARS))), data(l.body)], {
|
|
124
183
|
id: l.id,
|
|
125
184
|
paths: l.paths.join(", "),
|
|
126
185
|
...(l.critical ? { critical: "true" } : {}),
|
|
@@ -135,7 +194,7 @@ function renderLearningIndex(more) {
|
|
|
135
194
|
const unlisted = more.length - listed.length;
|
|
136
195
|
return section("learning_index", [
|
|
137
196
|
ocraText(`More learnings that match this change, by id and title; read one that may apply with ${REVIEW_TOOLS.readLearning}:`),
|
|
138
|
-
...listed.map((l) => data(`- ${l.id}: ${oneLine(l.title)}`)),
|
|
197
|
+
...listed.map((l) => data(`- ${l.id}: ${oneLine(clip(l.title, MAX_TITLE_CHARS))}`)),
|
|
139
198
|
...(unlisted > 0 ? [ocraText(`and ${unlisted} more.`)] : []),
|
|
140
199
|
]);
|
|
141
200
|
}
|
|
@@ -197,3 +256,6 @@ function renderHunk(hunk) {
|
|
|
197
256
|
});
|
|
198
257
|
return [hunk.header, ...lines].join("\n");
|
|
199
258
|
}
|
|
259
|
+
function clip(text, max) {
|
|
260
|
+
return text.length > max ? `${text.slice(0, max)}…` : text;
|
|
261
|
+
}
|
package/dist/task/linked-task.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isUnsafeCodePoint(code: number): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Characters a terminal or an editor acts on: C0 controls but tab and
|
|
2
|
+
// newline, DEL and C1 controls (ANSI and OSC escapes), line and paragraph
|
|
3
|
+
// separators, and bidirectional marks and overrides ("Trojan Source"). One
|
|
4
|
+
// definition for every output: terminal text replaces them, JSON escapes them.
|
|
5
|
+
export function isUnsafeCodePoint(code) {
|
|
6
|
+
return ((code <= 0x1f && code !== 0x09 && code !== 0x0a) ||
|
|
7
|
+
(code >= 0x7f && code <= 0x9f) ||
|
|
8
|
+
code === 0x061c ||
|
|
9
|
+
code === 0x200e ||
|
|
10
|
+
code === 0x200f ||
|
|
11
|
+
code === 0x2028 ||
|
|
12
|
+
code === 0x2029 ||
|
|
13
|
+
(code >= 0x202a && code <= 0x202e) ||
|
|
14
|
+
(code >= 0x2066 && code <= 0x2069));
|
|
15
|
+
}
|
package/package.json
CHANGED
|
File without changes
|