@ckeditor/ckeditor5-dev-agents 0.0.1 → 62.4.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.
@@ -0,0 +1,72 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ import type { Finding } from "../types.js";
6
+ export type ResolveFindingOptions = {
7
+ /**
8
+ * `reject`: the finding is wrong. A decision records why, so it is not reported again while the content stays
9
+ * the same. `dismiss`: the finding is dropped without a decision, so it may be reported again once the judged content
10
+ * changes, for example when its fix is reverted.
11
+ */
12
+ action: "reject" | "dismiss";
13
+ /**
14
+ * The short ID of the finding from the report, or a prefix of it.
15
+ */
16
+ id: string;
17
+ /**
18
+ * Why the finding is wrong. Required to reject it.
19
+ */
20
+ reason?: string;
21
+ /**
22
+ * Continue when reverting the fix also undoes other fixes that changed the same files.
23
+ */
24
+ force: boolean;
25
+ /**
26
+ * An absolute path to the directory with `tasks/` and `targets/`.
27
+ */
28
+ configPath: string;
29
+ /**
30
+ * An absolute path to a directory inside the checkout.
31
+ */
32
+ cwd: string;
33
+ targets: Array<string>;
34
+ tasks: Array<string>;
35
+ };
36
+ export type ResolvedFinding = {
37
+ action: "reject" | "dismiss";
38
+ target: string;
39
+ finding: Finding;
40
+ /**
41
+ * The path of the decision file, relative to the repository root. Only when rejecting.
42
+ */
43
+ decisionFile?: string;
44
+ /**
45
+ * The files restored, relative to the repository root.
46
+ */
47
+ revertedFiles: Array<string>;
48
+ /**
49
+ * The files of the fix that were not restored, because they had no uncommitted changes to revert.
50
+ */
51
+ unrevertedFiles: Array<string>;
52
+ /**
53
+ * Other findings whose fixes were undone. They stay open, and the next run judges and fixes them again.
54
+ */
55
+ reopened: Array<Finding>;
56
+ };
57
+ /**
58
+ * Rejects or dismisses one finding in the working tree of the checkout, by its short ID:
59
+ *
60
+ * 1. If the finding has a fix, every file of the fix is restored: from the base branch on a report branch,
61
+ * from `HEAD` otherwise.
62
+ * 2. If other fixes changed any of those files, they are lost too. Without `force`, nothing changes and the error
63
+ * lists them. With `force`, all their files are restored as well, their findings lose the fix, and their units are
64
+ * judged and fixed again by the next run.
65
+ * 3. The finding leaves `open.json`. When rejecting, a decision file records the reason.
66
+ * 4. `report.md` is regenerated. The changes stay in the working tree for a human to review and commit.
67
+ */
68
+ export declare function resolveFinding(options: ResolveFindingOptions): Promise<ResolvedFinding>;
69
+ /**
70
+ * Renders what `resolveFinding()` did, as plain text for the console.
71
+ */
72
+ export declare function renderResolvedFinding(result: ResolvedFinding): string;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ /**
6
+ * Imports the default export of every file matching the pattern in the directory, sorted by path.
7
+ */
8
+ export declare function importDefaultExports(directory: string, pattern: string): Promise<Array<{
9
+ file: string;
10
+ value: unknown;
11
+ }>>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ import type { Target } from "../types.js";
6
+ /**
7
+ * Loads the targets of the config directory, with their tasks. A directory without tasks or targets is almost always
8
+ * the wrong one, so it throws.
9
+ */
10
+ export declare function loadConfig(configPath: string): Promise<Map<string, Target>>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ import { type LoadedTask } from "./loadtasks.js";
6
+ import type { Target, TargetConfig } from "../types.js";
7
+ /**
8
+ * Loads every target from `<targetsPath>/<name>.{js,mjs,ts,mts}`. Adding a repository means adding a file.
9
+ */
10
+ export declare function loadTargets(targetsPath: string, tasks: Map<string, LoadedTask>): Promise<Map<string, Target>>;
11
+ export declare function normalizeTarget(config: TargetConfig | undefined, { name, tasks }: {
12
+ name: string;
13
+ tasks: Map<string, LoadedTask>;
14
+ }): Target;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ import type { Task } from "../types.js";
6
+ export type LoadedTask = {
7
+ task: Task;
8
+ /**
9
+ * An absolute path to the directory of the task.
10
+ */
11
+ directory: string;
12
+ };
13
+ /**
14
+ * Loads every task from `<tasksPath>/<id>/index.{js,mjs,ts,mts}`. Adding a task means adding a directory.
15
+ */
16
+ export declare function loadTasks(tasksPath: string): Promise<Map<string, LoadedTask>>;
17
+ /**
18
+ * Checks the rules of a task that its type cannot express.
19
+ */
20
+ export declare function validateTask(task: Task | undefined, id: string): void;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ import type { Target } from "../types.js";
6
+ /**
7
+ * Returns the targets to run in a checkout of the `originSlug` repository: the named ones, or every target of
8
+ * the repository. A checkout belongs to one repository, so only the targets of that repository can run in it.
9
+ */
10
+ export declare function selectTargets(targets: Map<string, Target>, { originSlug, names, taskIds }: {
11
+ originSlug: string | undefined;
12
+ names: Array<string>;
13
+ taskIds: Array<string>;
14
+ }): Array<Target>;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ /**
6
+ * The directory, relative to the target root, that holds the state of every task.
7
+ */
8
+ export declare const STATE_DIRECTORY = ".ai-tasks";
9
+ /**
10
+ * The prefix of report branches: `ai-tasks/<task>/<target>/<branch>`.
11
+ */
12
+ export declare const REPORT_BRANCH_PREFIX = "ai-tasks";
13
+ /**
14
+ * The tools an agent may use while judging. None of them can change a file.
15
+ */
16
+ export declare const READ_ONLY_TOOLS: ReadonlyArray<string>;
17
+ /**
18
+ * Every built-in tool of the Pi agent. The agent ignores unknown tool names, so the configuration is checked against it.
19
+ */
20
+ export declare const AGENT_TOOLS: ReadonlyArray<string>;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ import type { FileUnit, TargetConfig, Task, TaskOptions, TaskUnit } from "./types.js";
6
+ /**
7
+ * Defines a task. It returns the task unchanged and only helps with types: they are inferred from the task itself,
8
+ * so every hook knows its input without annotations.
9
+ *
10
+ * * `options` from `defaultOptions`,
11
+ * * `shared` from what `prepare()` returns,
12
+ * * `unit` from what `scope()` returns, or `FileUnit` (with a `path`) for a task that works on `include`,
13
+ * * `payload` from what `payload()` returns.
14
+ *
15
+ * ```ts
16
+ * export default defineTask( {
17
+ * id: 'meta-description',
18
+ * include: [ 'docs/**\/*.md' ],
19
+ * defaultOptions: { maxLength: 160 },
20
+ * …
21
+ * } );
22
+ * ```
23
+ */
24
+ export declare function defineTask<
25
+ TShared = undefined,
26
+ TUnit extends TaskUnit = FileUnit,
27
+ TPayload = unknown,
28
+ TOptions extends TaskOptions = TaskOptions
29
+ >(task: Task<TShared, TUnit, TPayload, TOptions>): Task<TShared, TUnit, TPayload, TOptions>;
30
+ /**
31
+ * Defines a target. It returns the target unchanged and only helps with types.
32
+ */
33
+ export declare function defineTarget(target: TargetConfig): TargetConfig;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ export type GitWorkspace = {
6
+ /**
7
+ * An absolute path to the root of the repository.
8
+ */
9
+ path: string;
10
+ /**
11
+ * The checked-out branch: the base of the report branches. `HEAD` when it is detached.
12
+ */
13
+ branch: string;
14
+ /**
15
+ * The repository on GitHub that `origin` points to, for example `ckeditor/ckeditor5`, or `undefined`.
16
+ */
17
+ originSlug: string | undefined;
18
+ /**
19
+ * Throws when the checkout cannot be published from: a detached `HEAD`, uncommitted changes, a shallow history,
20
+ * or ignored `paths` (relative to the repository root) that the run must commit. The environment that runs
21
+ * the framework must prepare the checkout correctly.
22
+ */
23
+ assertPublishable(paths: Array<string>): Promise<void>;
24
+ /**
25
+ * Checks out the report branch of a task.
26
+ *
27
+ * When the report pull request is open, it continues that branch and merges the base branch into it first, so
28
+ * decisions and fixes merged to the base branch meanwhile are taken into account. A regular merge commit keeps
29
+ * review comments anchored. When there is no open pull request, a fresh branch starts at the base branch.
30
+ */
31
+ checkoutReportBranch(options: {
32
+ name: string;
33
+ continueExisting: boolean;
34
+ }): Promise<void>;
35
+ /**
36
+ * Commits the given paths (relative to the repository root). Returns `false` when there was nothing to commit.
37
+ */
38
+ commit(paths: Array<string>, message: string): Promise<boolean>;
39
+ /**
40
+ * Pushes the report branch with the credentials of the checkout. The first push of a replaced branch is forced,
41
+ * every later push is not.
42
+ */
43
+ push(): Promise<void>;
44
+ /**
45
+ * Drops anything a failed task left behind on the report branch and checks out the base branch again.
46
+ */
47
+ returnToBase(): Promise<void>;
48
+ /**
49
+ * Whether the ref (a branch, a remote branch, or a commit) exists.
50
+ */
51
+ refExists(ref: string): Promise<boolean>;
52
+ /**
53
+ * Whether any of the files (relative to the repository root) has uncommitted changes, or is untracked.
54
+ */
55
+ hasChanges(paths: Array<string>): Promise<boolean>;
56
+ /**
57
+ * Restores the files (relative to the repository root) to their content at the ref. A file that does not exist
58
+ * at the ref is deleted.
59
+ */
60
+ restore(paths: Array<string>, ref: string): Promise<void>;
61
+ };
62
+ /**
63
+ * Opens the checkout that contains `cwd`. The checkout is prepared by whoever runs the framework: cloned, with
64
+ * the dependencies installed, and with the base branch checked out. The `author` is needed only to commit.
65
+ */
66
+ export declare function openWorkspace({ cwd, author }: {
67
+ cwd: string;
68
+ author?: {
69
+ name: string;
70
+ email: string;
71
+ };
72
+ }): Promise<GitWorkspace>;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ export type PullRequest = {
6
+ number: number;
7
+ html_url: string;
8
+ };
9
+ export type GitHubClient = {
10
+ /**
11
+ * Returns the open pull request from the branch, or `null`. The base branch is not a criterion: a human may change
12
+ * it in the pull request.
13
+ */
14
+ findOpenPullRequest(options: {
15
+ slug: string;
16
+ head: string;
17
+ }): Promise<PullRequest | null>;
18
+ createPullRequest(options: {
19
+ slug: string;
20
+ head: string;
21
+ base: string;
22
+ title: string;
23
+ body: string;
24
+ }): Promise<PullRequest>;
25
+ updatePullRequest(options: {
26
+ slug: string;
27
+ number: number;
28
+ body: string;
29
+ }): Promise<PullRequest>;
30
+ createComment(options: {
31
+ slug: string;
32
+ number: number;
33
+ body: string;
34
+ }): Promise<unknown>;
35
+ };
36
+ /**
37
+ * Creates a minimal client of the GitHub REST API with the calls that report pull requests need.
38
+ */
39
+ export declare function createGitHubClient(token: string): GitHubClient;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ export { defineTask, defineTarget } from "./define.js";
6
+ export { findingSchema } from "./utils/findingschema.js";
7
+ export type { FileUnit, Finding, FindingInput, FixInput, JudgeInput, PrepareInput, PriorDecision, ScopeInput, TargetConfig, Task, TaskUnit, UnitInput, VerifyInput } from "./types.js";
package/dist/index.js ADDED
@@ -0,0 +1,79 @@
1
+ //#region src/define.ts
2
+ /**
3
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
4
+ * For licensing, see LICENSE.md.
5
+ */
6
+ /**
7
+ * Defines a task. It returns the task unchanged and only helps with types: they are inferred from the task itself,
8
+ * so every hook knows its input without annotations.
9
+ *
10
+ * * `options` from `defaultOptions`,
11
+ * * `shared` from what `prepare()` returns,
12
+ * * `unit` from what `scope()` returns, or `FileUnit` (with a `path`) for a task that works on `include`,
13
+ * * `payload` from what `payload()` returns.
14
+ *
15
+ * ```ts
16
+ * export default defineTask( {
17
+ * id: 'meta-description',
18
+ * include: [ 'docs/**\/*.md' ],
19
+ * defaultOptions: { maxLength: 160 },
20
+ * …
21
+ * } );
22
+ * ```
23
+ */
24
+ function defineTask(task) {
25
+ return task;
26
+ }
27
+ /**
28
+ * Defines a target. It returns the target unchanged and only helps with types.
29
+ */
30
+ function defineTarget(target) {
31
+ return target;
32
+ }
33
+ //#endregion
34
+ //#region src/utils/findingschema.ts
35
+ /**
36
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
37
+ * For licensing, see LICENSE.md.
38
+ */
39
+ /**
40
+ * Returns the JSON Schema of the findings a judge returns, wrapped in an object (`{ findings: [ … ] }`),
41
+ * because structured-output APIs require an object at the top level. Pass it as `outputSchema` to `agent.run()`.
42
+ */
43
+ function findingSchema({ ruleIds }) {
44
+ return {
45
+ type: "object",
46
+ properties: { findings: {
47
+ type: "array",
48
+ items: {
49
+ type: "object",
50
+ properties: {
51
+ ruleId: {
52
+ type: "string",
53
+ enum: [...ruleIds],
54
+ description: "The rule the finding breaks."
55
+ },
56
+ detail: {
57
+ type: "string",
58
+ minLength: 1,
59
+ description: "A short explanation of what is wrong, written for the person who fixes it."
60
+ },
61
+ discriminator: {
62
+ type: "string",
63
+ description: "Tells apart findings of the same rule in the same unit, for example a heading."
64
+ }
65
+ },
66
+ required: ["ruleId", "detail"]
67
+ }
68
+ } },
69
+ required: ["findings"]
70
+ };
71
+ }
72
+ //#endregion
73
+ //#region src/index.ts
74
+ /**
75
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
76
+ * For licensing, see LICENSE.md.
77
+ */
78
+ //#endregion
79
+ export { defineTarget, defineTask, findingSchema };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ import type { TargetResult } from "../runtasks.js";
6
+ /**
7
+ * Renders what a run did, as plain text for the console: one block per task of every target.
8
+ */
9
+ export declare function renderConsoleSummary(targets: Array<TargetResult>): string;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ import type { Target, TaskSummary } from "../types.js";
6
+ /**
7
+ * Renders the description of the report pull request. It is rewritten on every run that pushes,
8
+ * so it always shows the current number of findings.
9
+ */
10
+ export declare function renderPullRequestBody({ task, target, branch, reportBranch, open, fixed }: {
11
+ task: {
12
+ id: string;
13
+ title: string;
14
+ };
15
+ target: Pick<Target, "name" | "root" | "slug">;
16
+ branch: string;
17
+ reportBranch: string;
18
+ open: number;
19
+ fixed: number;
20
+ }): string;
21
+ /**
22
+ * Renders the comment posted after every run that pushed something.
23
+ */
24
+ export declare function renderRunComment({ today, summary, buildUrl }: {
25
+ today: string;
26
+ summary: TaskSummary;
27
+ buildUrl?: string;
28
+ }): string;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ import type { Finding, Target } from "../types.js";
6
+ /**
7
+ * Renders `report.md` of one task from its findings. The file is regenerated on every run,
8
+ * so `open.json` stays the only source of truth.
9
+ */
10
+ export declare function renderReport({ task, target, branch, open }: {
11
+ task: {
12
+ id: string;
13
+ title: string;
14
+ };
15
+ target: Pick<Target, "root" | "slug">;
16
+ branch: string;
17
+ open: Array<Finding>;
18
+ }): string;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ /**
6
+ * The state before a fix: `HEAD`, the whole working tree as a git tree, and the exact Git index, so staged changes
7
+ * can be restored too.
8
+ */
9
+ export type ChangeSnapshot = {
10
+ head: string;
11
+ tree: string;
12
+ index: Buffer | null;
13
+ };
14
+ export type ChangeTracker = {
15
+ capture(): Promise<ChangeSnapshot>;
16
+ /**
17
+ * Inspects changes relative to the snapshot without modifying HEAD, the index or files.
18
+ */
19
+ collect(snapshot: ChangeSnapshot): Promise<{
20
+ changed: Array<string>;
21
+ headMoved: boolean;
22
+ }>;
23
+ /**
24
+ * Returns the given paths, `HEAD` and the index to their state in the snapshot. It undoes a fix with the snapshot
25
+ * from before it, and brings the fix back with a snapshot taken while it was applied.
26
+ */
27
+ restore(snapshot: ChangeSnapshot, paths: Array<string>): Promise<void>;
28
+ };
29
+ /**
30
+ * Tracks what `fix()` changes in a git working tree. It sees every file git sees: tracked files and untracked files
31
+ * that are not ignored. The working tree may already have changes (the kept fixes of earlier units, or local changes
32
+ * in a local run). Only what changes after a snapshot counts.
33
+ *
34
+ * A snapshot stores the working tree as a tree object, written through a copy of the index, so the real index
35
+ * is never touched.
36
+ */
37
+ export declare function createChangeTracker(root: string): Promise<ChangeTracker>;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ import type { Agent, TaskContext, TaskPhase, WritableTaskContext } from "../types.js";
6
+ type ContextOptions = {
7
+ root: string;
8
+ phase: TaskPhase;
9
+ options: Record<string, unknown>;
10
+ agent: Agent;
11
+ log: (message: string) => void;
12
+ };
13
+ /**
14
+ * Creates the `ctx` of the judging phase. It can read the target, but not change it.
15
+ */
16
+ export declare function createTaskContext({ root, phase, options, agent, log }: ContextOptions): TaskContext;
17
+ /**
18
+ * Creates the `ctx` of `fix()` and `verify()`. It can also change files and run commands in the target root.
19
+ */
20
+ export declare function createWritableTaskContext(options: ContextOptions): WritableTaskContext;
21
+ export declare function resolveInside(root: string, path: string): string;
22
+ export {};
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ import type { ChangeTracker } from "./changetracker.js";
6
+ import type { AppliedFix, Finding, Task, TaskUnit, WritableTaskContext } from "../types.js";
7
+ /**
8
+ * What the run does with one unit, shared by judging and by checking fixes.
9
+ */
10
+ export type UnitOperations = {
11
+ contentHash(unit: TaskUnit): Promise<string>;
12
+ /**
13
+ * Returns the validated findings of `judge()` about the unit, without duplicates.
14
+ */
15
+ judge(unit: TaskUnit, fragment: string): Promise<Array<Finding>>;
16
+ /**
17
+ * Whether a decision that still holds rejects the finding.
18
+ */
19
+ isRejected(finding: Finding): boolean;
20
+ };
21
+ /**
22
+ * One unit in a run. `current` follows accepted fixes, including fixes made while processing another unit. Only
23
+ * the units selected for this run are `judged` and may advance their baseline. Checking a deferred unit during a fix
24
+ * does not select it.
25
+ */
26
+ export type UnitRun = {
27
+ unit: TaskUnit;
28
+ current?: {
29
+ fragment: string;
30
+ findings?: Array<Finding>;
31
+ };
32
+ judged?: Array<Finding>;
33
+ error?: string;
34
+ discarded?: {
35
+ message: string;
36
+ findings: number;
37
+ };
38
+ fixes: Map<string, Omit<AppliedFix, "fragment">>;
39
+ };
40
+ export type FixOutcome = {
41
+ status: "none";
42
+ } | {
43
+ status: "discarded";
44
+ message: string;
45
+ findings: number;
46
+ } | {
47
+ status: "kept";
48
+ files: Array<string>;
49
+ resolved: Map<UnitRun, Set<string>>;
50
+ };
51
+ export type FixUnitOptions = UnitOperations & {
52
+ task: Task;
53
+ shared: unknown;
54
+ root: string;
55
+ units: Map<string, UnitRun>;
56
+ tracker: ChangeTracker;
57
+ fixContext: WritableTaskContext;
58
+ verifyContext: WritableTaskContext;
59
+ };
60
+ /**
61
+ * Fixes one unit transactionally. Every affected unit is checked, including units whose hash depends on
62
+ * files outside their own path. A later fix must preserve the accepted judgments of earlier fixes.
63
+ */
64
+ export declare function fixUnit(runner: FixUnitOptions, record: UnitRun, actionable: Array<Finding>): Promise<FixOutcome>;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+ import type { GitWorkspace } from "../git/gitworkspace.js";
6
+ import type { GitHubClient } from "../github/githubclient.js";
7
+ import type { Target, TaskSummary } from "../types.js";
8
+ export type TaskResult = {
9
+ task: string;
10
+ title: string;
11
+ durationMs: number;
12
+ /**
13
+ * Missing when the task failed before it finished. A task whose publishing failed has both.
14
+ */
15
+ summary?: TaskSummary;
16
+ failure?: string;
17
+ pullRequestUrl?: string;
18
+ };
19
+ export type RunTargetOptions = {
20
+ target: Target;
21
+ /**
22
+ * Tasks requested explicitly. When empty, the tasks enabled in the target run.
23
+ */
24
+ taskIds: Array<string>;
25
+ workspace: GitWorkspace;
26
+ /**
27
+ * Set for a published run. Without it, the results stay in the working tree.
28
+ */
29
+ github?: GitHubClient;
30
+ today: string;
31
+ /**
32
+ * Receives the progress of the run, the tool calls of the agent, and the messages of `log()` in the hooks.
33
+ */
34
+ log: (message: string) => void;
35
+ /**
36
+ * Published run: linked from the run comment.
37
+ */
38
+ buildUrl?: string;
39
+ };
40
+ /**
41
+ * Runs the selected tasks against one target, in the working tree of the checkout.
42
+ *
43
+ * Both flows judge, fix, and write the state in the checkout. Kept fixes and the state stay in the files. A local run
44
+ * stops there: nothing is committed or pushed. A published run does every task on its own report branch: it continues
45
+ * the open report pull request or starts a new branch at the base branch, commits and pushes once, opens or updates
46
+ * the pull request, and checks out the base branch again.
47
+ */
48
+ export declare function runTarget(options: RunTargetOptions): Promise<Array<TaskResult>>;
49
+ export declare function getReportBranch(taskId: string, target: Pick<Target, "name">, branch: string): string;