@bridge-ds/core 0.9.0 → 0.10.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/README.md +27 -1
- package/bridge.config.schema.json +23 -0
- package/dist/audit/index.js +3 -3
- package/dist/config.d.ts +28 -0
- package/dist/docs-proposal.d.ts +58 -10
- package/dist/figma-push-github.d.ts +143 -0
- package/dist/figma-push.d.ts +204 -0
- package/dist/github-client.d.ts +6 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +998 -2861
- package/dist/index.js.map +1 -1
- package/dist/node/git-local.d.ts +15 -0
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +201 -10
- package/dist/node/index.js.map +1 -1
- package/dist/node/suggestion-apply-node.d.ts +69 -0
- package/dist/{pr-composer-D2SZm7cg.js → prod-branch-BdMPKffE.js} +491 -173
- package/dist/prod-branch-BdMPKffE.js.map +1 -0
- package/dist/prod-branch-github.d.ts +28 -7
- package/dist/prod-branch.d.ts +17 -7
- package/dist/{report-DY_peRy4.js → report-DOnKUw8G.js} +2 -2
- package/dist/{report-DY_peRy4.js.map → report-DOnKUw8G.js.map} +1 -1
- package/dist/suggestion-apply-ByBEYtct.js +4802 -0
- package/dist/suggestion-apply-ByBEYtct.js.map +1 -0
- package/dist/suggestion-apply.d.ts +150 -0
- package/dist/suggestion-review.d.ts +70 -0
- package/dist/suggestions-github.d.ts +131 -0
- package/dist/suggestions.d.ts +236 -0
- package/dist/token-proposal.d.ts +51 -0
- package/package.json +1 -1
- package/dist/component-spec-BzfBkYRD.js +0 -1122
- package/dist/component-spec-BzfBkYRD.js.map +0 -1
- package/dist/pr-composer-D2SZm7cg.js.map +0 -1
- package/dist/prod-branch-D5Tl87Wf.js +0 -266
- package/dist/prod-branch-D5Tl87Wf.js.map +0 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type BridgeConfig } from '../config';
|
|
2
|
+
import { type PlanSuggestionApplyInput, type SuggestionApplyOutcome, type SuggestionApplyPlan, type SuggestionWorkspace } from '../suggestion-apply';
|
|
3
|
+
/** 3-way merge of three texts with `git merge-file -p`: the merged text, with conflict markers when not clean. */
|
|
4
|
+
export declare function mergeText(root: string, input: {
|
|
5
|
+
ours: string;
|
|
6
|
+
base: string;
|
|
7
|
+
theirs: string;
|
|
8
|
+
}): Promise<{
|
|
9
|
+
clean: boolean;
|
|
10
|
+
text: string;
|
|
11
|
+
conflicts: number;
|
|
12
|
+
}>;
|
|
13
|
+
/** A unified diff of one file between two texts (null: absent), with a/ and b/ paths like `git diff`. */
|
|
14
|
+
export declare function fileDiff(path: string, before: string | null, after: string | null): Promise<string>;
|
|
15
|
+
export interface GitWorkspaceOptions {
|
|
16
|
+
/** Read this commit or branch. Absent: the working tree. */
|
|
17
|
+
ref?: string | undefined;
|
|
18
|
+
/** When the base commit is not in the clone, how to read a file there (for example GitHubClient.readFile). */
|
|
19
|
+
readBase?: ((path: string, sha: string) => Promise<string | null>) | undefined;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The workspace a suggestion plans against on a git checkout: the working tree (to write files there) or a ref (to
|
|
23
|
+
* commit on top of it). The base commit is fetched from origin when the clone lacks it.
|
|
24
|
+
*/
|
|
25
|
+
export declare function gitWorkspace(root: string, opts?: GitWorkspaceOptions): SuggestionWorkspace;
|
|
26
|
+
export type LocalApplyMode = 'branch' | 'write' | 'patch';
|
|
27
|
+
export interface ApplySuggestionLocallyInput extends Omit<PlanSuggestionApplyInput, 'workspace' | 'config'> {
|
|
28
|
+
/** Repository root (a git checkout). */
|
|
29
|
+
root: string;
|
|
30
|
+
/** The issue number, for the branch name and the commit message. */
|
|
31
|
+
number: number;
|
|
32
|
+
/** Default: bridge.config.json read where the plan reads (the base ref, or the working tree for "write"). */
|
|
33
|
+
config?: BridgeConfig | undefined;
|
|
34
|
+
/** Default "branch". */
|
|
35
|
+
mode?: LocalApplyMode | undefined;
|
|
36
|
+
/** Plan and diff only: nothing is written. */
|
|
37
|
+
dryRun?: boolean | undefined;
|
|
38
|
+
/** The ref the branch or patch builds on. Default "HEAD". Ignored by "write" (the working tree). */
|
|
39
|
+
base?: string | undefined;
|
|
40
|
+
/** Branch name. Default `<branchPrefix>suggestion-<n>-<slug>`, then -2, -3 when taken. */
|
|
41
|
+
branch?: string | undefined;
|
|
42
|
+
/** GitHub login of the developer, for the applied comment. */
|
|
43
|
+
by?: string | undefined;
|
|
44
|
+
readBase?: GitWorkspaceOptions['readBase'];
|
|
45
|
+
/** Clock for the applied comment (tests). */
|
|
46
|
+
now?: (() => string) | undefined;
|
|
47
|
+
}
|
|
48
|
+
export type LocalApplyStatus = 'dry-run' | 'branch-created' | 'branch-exists' | 'written' | 'patch' | Exclude<SuggestionApplyOutcome, 'ready'>;
|
|
49
|
+
export interface LocalSuggestionApply {
|
|
50
|
+
status: LocalApplyStatus;
|
|
51
|
+
exitCode: 0 | 1 | 3;
|
|
52
|
+
message: string;
|
|
53
|
+
plan: SuggestionApplyPlan;
|
|
54
|
+
branch?: string | undefined;
|
|
55
|
+
commit?: string | undefined;
|
|
56
|
+
/** `git format-patch` text (mode "patch"). */
|
|
57
|
+
patch?: string | undefined;
|
|
58
|
+
/** Unified diff of what is (or, in a dry run, would be) written. */
|
|
59
|
+
diff?: string | undefined;
|
|
60
|
+
/** Files written into the working tree (mode "write"). */
|
|
61
|
+
written?: string[] | undefined;
|
|
62
|
+
/** The applied record to post on the issue once a branch or files exist (posting is the caller's). */
|
|
63
|
+
appliedComment?: string | undefined;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Plans a suggestion against the local checkout and hands the result over as a branch (default), files in the
|
|
67
|
+
* working tree, or a patch. Refused, blocked, conflicting or already applied plans write nothing.
|
|
68
|
+
*/
|
|
69
|
+
export declare function applySuggestionLocally(input: ApplySuggestionLocallyInput): Promise<LocalSuggestionApply>;
|