@getmarrow/mcp 3.9.102 → 3.9.103

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.
Files changed (109) hide show
  1. package/README.md +49 -23
  2. package/dist/cli.js +41 -10
  3. package/dist/cli.js.map +1 -1
  4. package/dist/codex-plugin-pins.d.ts +19 -0
  5. package/dist/codex-plugin-pins.d.ts.map +1 -0
  6. package/dist/codex-plugin-pins.js +43 -0
  7. package/dist/codex-plugin-pins.js.map +1 -0
  8. package/dist/codex-plugins.d.ts +34 -0
  9. package/dist/codex-plugins.d.ts.map +1 -0
  10. package/dist/codex-plugins.js +240 -0
  11. package/dist/codex-plugins.js.map +1 -0
  12. package/dist/hook-contract.d.ts +2 -2
  13. package/dist/hook-contract.d.ts.map +1 -1
  14. package/dist/hook-contract.js +8 -3
  15. package/dist/hook-contract.js.map +1 -1
  16. package/dist/hook-pre-action.d.ts +48 -2
  17. package/dist/hook-pre-action.d.ts.map +1 -1
  18. package/dist/hook-pre-action.js +195 -22
  19. package/dist/hook-pre-action.js.map +1 -1
  20. package/dist/hook.d.ts +1 -1
  21. package/dist/hook.d.ts.map +1 -1
  22. package/dist/hook.js +12 -6
  23. package/dist/hook.js.map +1 -1
  24. package/dist/host-session.d.ts +11 -0
  25. package/dist/host-session.d.ts.map +1 -1
  26. package/dist/host-session.js +49 -0
  27. package/dist/host-session.js.map +1 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +15 -10
  30. package/dist/index.js.map +1 -1
  31. package/dist/normalized-action.d.ts +29 -6
  32. package/dist/normalized-action.d.ts.map +1 -1
  33. package/dist/normalized-action.js +492 -102
  34. package/dist/normalized-action.js.map +1 -1
  35. package/dist/own-server-identity.d.ts +123 -0
  36. package/dist/own-server-identity.d.ts.map +1 -0
  37. package/dist/own-server-identity.js +1052 -0
  38. package/dist/own-server-identity.js.map +1 -0
  39. package/dist/own-tool.d.ts +7 -3
  40. package/dist/own-tool.d.ts.map +1 -1
  41. package/dist/own-tool.js +7 -3
  42. package/dist/own-tool.js.map +1 -1
  43. package/dist/redact.d.ts +23 -0
  44. package/dist/redact.d.ts.map +1 -1
  45. package/dist/redact.js +181 -8
  46. package/dist/redact.js.map +1 -1
  47. package/dist/seatbelt/classifier-pin.d.ts +15 -0
  48. package/dist/seatbelt/classifier-pin.d.ts.map +1 -0
  49. package/dist/seatbelt/classifier-pin.js +26 -0
  50. package/dist/seatbelt/classifier-pin.js.map +1 -0
  51. package/dist/seatbelt/guards.d.ts +10 -0
  52. package/dist/seatbelt/guards.d.ts.map +1 -0
  53. package/dist/seatbelt/guards.js +509 -0
  54. package/dist/seatbelt/guards.js.map +1 -0
  55. package/dist/seatbelt/hook.d.ts +72 -0
  56. package/dist/seatbelt/hook.d.ts.map +1 -0
  57. package/dist/seatbelt/hook.js +362 -0
  58. package/dist/seatbelt/hook.js.map +1 -0
  59. package/dist/seatbelt/longopts.d.ts +68 -0
  60. package/dist/seatbelt/longopts.d.ts.map +1 -0
  61. package/dist/seatbelt/longopts.js +377 -0
  62. package/dist/seatbelt/longopts.js.map +1 -0
  63. package/dist/seatbelt/mapper.d.ts +83 -0
  64. package/dist/seatbelt/mapper.d.ts.map +1 -0
  65. package/dist/seatbelt/mapper.js +10248 -0
  66. package/dist/seatbelt/mapper.js.map +1 -0
  67. package/dist/seatbelt/record.d.ts +94 -0
  68. package/dist/seatbelt/record.d.ts.map +1 -0
  69. package/dist/seatbelt/record.js +776 -0
  70. package/dist/seatbelt/record.js.map +1 -0
  71. package/dist/seatbelt/tables.d.ts +82 -0
  72. package/dist/seatbelt/tables.d.ts.map +1 -0
  73. package/dist/seatbelt/tables.js +359 -0
  74. package/dist/seatbelt/tables.js.map +1 -0
  75. package/dist/seatbelt-deploy.d.ts +100 -0
  76. package/dist/seatbelt-deploy.d.ts.map +1 -0
  77. package/dist/seatbelt-deploy.js +393 -0
  78. package/dist/seatbelt-deploy.js.map +1 -0
  79. package/dist/seatbelt-fs.d.ts +30 -0
  80. package/dist/seatbelt-fs.d.ts.map +1 -0
  81. package/dist/seatbelt-fs.js +94 -0
  82. package/dist/seatbelt-fs.js.map +1 -0
  83. package/dist/seatbelt-git.d.ts +212 -0
  84. package/dist/seatbelt-git.d.ts.map +1 -0
  85. package/dist/seatbelt-git.js +844 -0
  86. package/dist/seatbelt-git.js.map +1 -0
  87. package/dist/seatbelt-mode.d.ts +77 -0
  88. package/dist/seatbelt-mode.d.ts.map +1 -0
  89. package/dist/seatbelt-mode.js +496 -0
  90. package/dist/seatbelt-mode.js.map +1 -0
  91. package/dist/seatbelt-path.d.ts +123 -0
  92. package/dist/seatbelt-path.d.ts.map +1 -0
  93. package/dist/seatbelt-path.js +482 -0
  94. package/dist/seatbelt-path.js.map +1 -0
  95. package/dist/seatbelt-scripts.d.ts +109 -0
  96. package/dist/seatbelt-scripts.d.ts.map +1 -0
  97. package/dist/seatbelt-scripts.js +1060 -0
  98. package/dist/seatbelt-scripts.js.map +1 -0
  99. package/dist/tool-catalog.js +2 -2
  100. package/dist/tool-catalog.js.map +1 -1
  101. package/dist/types.d.ts +2 -1
  102. package/dist/types.d.ts.map +1 -1
  103. package/package.json +2 -1
  104. package/server.json +3 -3
  105. package/vendor/classifier/MANIFEST.json +25 -0
  106. package/vendor/classifier/classifier.js +1356 -0
  107. package/vendor/classifier/policy-baseline.js +187 -0
  108. package/vendor/classifier/redact.js +59 -0
  109. package/vendor/classifier/shell-parse.js +455 -0
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nodeSeatbeltFs = nodeSeatbeltFs;
4
+ const node_fs_1 = require("node:fs");
5
+ function entryOf(stat) {
6
+ const type = stat.isSymbolicLink() ? 'symlink' : stat.isDirectory() ? 'dir' : stat.isFile() ? 'file' : 'other';
7
+ return { type, size: stat.size, uid: stat.uid, gid: stat.gid, mode: stat.mode & 0o7777, dev: stat.dev, ino: stat.ino };
8
+ }
9
+ function swapCase(name) {
10
+ return name.replace(/[A-Za-z]/g, (ch) => (ch === ch.toLowerCase() ? ch.toUpperCase() : ch.toLowerCase()));
11
+ }
12
+ /**
13
+ * The host filesystem. Case-insensitivity is probed, not assumed from the
14
+ * platform (macOS volumes can be case-sensitive; Linux dirs can casefold): the
15
+ * nearest existing ancestor with a letter in its name is looked up with its
16
+ * case swapped, and only the same inode proves folding. Results are cached per
17
+ * probed directory.
18
+ */
19
+ function nodeSeatbeltFs() {
20
+ const probed = new Map();
21
+ const probe = (path) => {
22
+ let dir = path;
23
+ for (;;) {
24
+ const cut = dir.lastIndexOf('/');
25
+ const name = dir.slice(cut + 1);
26
+ if (cut < 0 || dir === '/')
27
+ return false;
28
+ if (/[A-Za-z]/.test(name)) {
29
+ const cached = probed.get(dir);
30
+ if (cached !== undefined)
31
+ return cached;
32
+ let same = null;
33
+ try {
34
+ const a = (0, node_fs_1.lstatSync)(dir);
35
+ try {
36
+ const b = (0, node_fs_1.lstatSync)(`${dir.slice(0, cut)}/${swapCase(name)}`);
37
+ same = a.dev === b.dev && a.ino === b.ino;
38
+ }
39
+ catch {
40
+ same = false;
41
+ }
42
+ }
43
+ catch {
44
+ same = null;
45
+ }
46
+ if (same !== null) {
47
+ probed.set(dir, same);
48
+ return same;
49
+ }
50
+ }
51
+ dir = dir.slice(0, cut) || '/';
52
+ }
53
+ };
54
+ return {
55
+ lstat(path) {
56
+ try {
57
+ return entryOf((0, node_fs_1.lstatSync)(path));
58
+ }
59
+ catch (error) {
60
+ const code = error.code;
61
+ if (code === 'ENOENT' || code === 'ENOTDIR')
62
+ return null;
63
+ throw error;
64
+ }
65
+ },
66
+ readlink: (path) => (0, node_fs_1.readlinkSync)(path, 'utf8'),
67
+ readFile(path, maxBytes) {
68
+ // Non-blocking open so a planted FIFO cannot hang the hook; no final symlink.
69
+ const fd = (0, node_fs_1.openSync)(path, node_fs_1.constants.O_RDONLY | (node_fs_1.constants.O_NONBLOCK || 0) | (node_fs_1.constants.O_NOFOLLOW || 0));
70
+ try {
71
+ const stat = (0, node_fs_1.fstatSync)(fd);
72
+ if (!stat.isFile() || stat.size > maxBytes)
73
+ return null;
74
+ const buffer = Buffer.alloc(stat.size + 1);
75
+ let length = 0;
76
+ while (length < buffer.length) {
77
+ const read = (0, node_fs_1.readSync)(fd, buffer, length, buffer.length - length, null);
78
+ if (read <= 0)
79
+ break;
80
+ length += read;
81
+ }
82
+ if (length > stat.size)
83
+ return null;
84
+ return buffer.subarray(0, length).toString('utf8');
85
+ }
86
+ finally {
87
+ (0, node_fs_1.closeSync)(fd);
88
+ }
89
+ },
90
+ readdir: (path) => (0, node_fs_1.readdirSync)(path),
91
+ caseInsensitive: (path) => probe(path),
92
+ };
93
+ }
94
+ //# sourceMappingURL=seatbelt-fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seatbelt-fs.js","sourceRoot":"","sources":["../src/seatbelt-fs.ts"],"names":[],"mappings":";;AA8CA,wCAgEC;AA9GD,qCAAgI;AA8BhI,SAAS,OAAO,CAAC,IAAW;IAC1B,MAAM,IAAI,GAAwB,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IACpI,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,GAAG,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;AACzH,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,EAA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AAM,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;gBAC3C,IAAI,MAAM,GAAG,CAAC,CAAC;gBACf,OAAO,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;oBAC9B,MAAM,IAAI,GAAG,IAAA,kBAAQ,EAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,CAAC;oBACxE,IAAI,IAAI,IAAI,CAAC;wBAAE,MAAM;oBACrB,MAAM,IAAI,IAAI,CAAC;gBACjB,CAAC;gBACD,IAAI,MAAM,GAAG,IAAI,CAAC,IAAI;oBAAE,OAAO,IAAI,CAAC;gBACpC,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YACrD,CAAC;oBAAS,CAAC;gBACT,IAAA,mBAAS,EAAC,EAAE,CAAC,CAAC;YAChB,CAAC;QACH,CAAC;QACD,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,qBAAW,EAAC,IAAI,CAAC;QACpC,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;KACvC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,212 @@
1
+ import type { SeatbeltFs } from './seatbelt-fs';
2
+ export declare const MAX_GIT_CONFIG_BYTES: number;
3
+ export declare const MAX_INCLUDE_DEPTH = 10;
4
+ export declare const MAX_ALIAS_DEPTH = 10;
5
+ /** Total alias nodes and config files visited: a planted config cannot fan out without bound. */
6
+ export declare const MAX_ALIAS_STEPS = 256;
7
+ export declare const MAX_CONFIG_FILES = 64;
8
+ export interface GitConfigEntry {
9
+ /** section[.subsection].name; section and name lower-cased, subsection as written. */
10
+ key: string;
11
+ value: string;
12
+ source: string;
13
+ }
14
+ export interface GitConfig {
15
+ entries: GitConfigEntry[];
16
+ /** True when some config could not be read (unreadable file, include too deep): answers that depend on it are unknown. */
17
+ incomplete: boolean;
18
+ }
19
+ /** Canonical config key: git compares section and variable names case-insensitively, subsections exactly. */
20
+ export declare function canonicalGitKey(key: string): string;
21
+ /** Parses git config text into entries (git-config(1) syntax). */
22
+ export declare function parseGitConfigText(text: string, source: string): GitConfigEntry[];
23
+ export interface GitDirs {
24
+ /** The worktree's git dir (HEAD lives here). */
25
+ gitDir: string;
26
+ /** The common dir (config, refs, packed-refs). */
27
+ commonDir: string;
28
+ }
29
+ /**
30
+ * Env that makes git use a different repository, config or work tree than
31
+ * discovery from the cwd finds. The resolvers do not model these: any of
32
+ * them set (in the hook env or as a prefix assignment of the git command)
33
+ * makes discovery and config 'unknown'/incomplete, never a definite answer.
34
+ */
35
+ export declare const GIT_RELOCATING_ENV: string[];
36
+ /**
37
+ * Env and config that make git run another program (ssh, pager, editor,
38
+ * diff/merge drivers, credential helpers, hooks, fsmonitor). The mapper (U2)
39
+ * treats any of them present as a shell command it cannot see: stop.
40
+ */
41
+ export declare const GIT_EXEC_ENV: string[];
42
+ /**
43
+ * Names of exec-capable env vars and config keys present (alias.* with a
44
+ * leading `!` only). Names only, never values. `env` is what the agent set:
45
+ * the git command's prefix assignments and earlier `export`s in the same
46
+ * command line, not the hook's own environment (the user's EDITOR/PAGER).
47
+ */
48
+ export declare function gitExecVectors(config: GitConfig, env?: Record<string, string | undefined>): string[];
49
+ /** The relocating names present in env (any value, even empty, counts). */
50
+ export declare function gitRelocatingEnv(env: Record<string, string | undefined> | undefined): string[];
51
+ /**
52
+ * Finds the git dirs for a working directory the way git's discovery does: at
53
+ * each level a `.git` directory, a `.git` file (`gitdir:`) plus `commondir`,
54
+ * or the level itself as a git directory (bare repo). With relocating env
55
+ * (`env`: hook env merged with the command's prefix assignments) the answer
56
+ * is 'unknown'.
57
+ */
58
+ export declare function discoverGitDirs(fs: SeatbeltFs, cwd: string, env?: Record<string, string | undefined>): GitDirs | null | 'unknown';
59
+ export interface GitConfigSources {
60
+ /** Trusted home (passwd or --home), for ~/.gitconfig, ~/.config/git/config and `~/` in include paths. */
61
+ home: string | null;
62
+ dirs?: GitDirs | null;
63
+ /** `git -c key=value` pairs, in order. */
64
+ commandConfig?: Array<[string, string]>;
65
+ /**
66
+ * The hook's own environment merged with the git command's prefix
67
+ * assignments (they reach git's environment). GIT_CONFIG_* are modelled;
68
+ * GIT_RELOCATING_ENV, a HOME other than `home`, or a relative config path
69
+ * make the config incomplete.
70
+ */
71
+ env?: Record<string, string | undefined>;
72
+ /** System config files; default /etc/gitconfig plus common package-manager prefixes. */
73
+ systemFiles?: string[];
74
+ }
75
+ /**
76
+ * Loads config from every scope git reads, plus every include and includeIf
77
+ * (conditions are not evaluated: including more can only add candidates).
78
+ */
79
+ export declare function loadGitConfig(fs: SeatbeltFs, sources: GitConfigSources): GitConfig;
80
+ /**
81
+ * The config an invocation's own `-c` / `--config-env` pairs (and what they
82
+ * include) add to the loaded config, for resolvers that take a GitConfig
83
+ * (implicitPushTargets): `git -c remote.origin.push=+refs/heads/*:refs/heads/main push`
84
+ * must be judged with that pair, not without it.
85
+ */
86
+ export declare function withInvocationConfig(config: GitConfig, invocation: GitInvocation): GitConfig;
87
+ /** Every value of a key across all scopes, in load order (git uses the last). */
88
+ export declare function gitConfigValues(config: GitConfig, key: string): string[];
89
+ /**
90
+ * Built-ins of every supported git (≥2.20): git runs these before it looks at
91
+ * aliases, so an alias with one of these names never applies.
92
+ */
93
+ export declare const GIT_CORE_BUILTINS: Set<string>;
94
+ /**
95
+ * Commands that shadow an alias only when present: exec-path programs that may
96
+ * not be installed (git-lfs, git-svn ...) and built-ins newer than 2.20. For
97
+ * these the alias is kept as a candidate next to the command itself.
98
+ */
99
+ export declare const GIT_MAYBE_COMMANDS: Set<string>;
100
+ /** git's split_cmdline: whitespace-separated words with single/double quotes and backslash escapes. Null on an unclosed quote. */
101
+ export declare function splitGitCmdline(value: string): string[] | null;
102
+ export interface GitInvocation {
103
+ /** `-c` pairs from the global options. */
104
+ config: Array<[string, string]>;
105
+ /** `-C` directories and `--git-dir`/`--work-tree` values, in order. */
106
+ directories: string[];
107
+ /** Global options seen whose effect is not modelled (or whose value is dynamic). */
108
+ unknownGlobals: string[];
109
+ /**
110
+ * Global options that point git at another repository, config, namespace or
111
+ * exec path than discovery from the cwd finds (`--bare` is `GIT_DIR=$PWD`):
112
+ * the config this resolver loaded is not the one git reads. Also in
113
+ * `unknownGlobals`, so a caller that checks only that list stops too.
114
+ */
115
+ relocated: string[];
116
+ /** `--config-env` pairs: key and the env var name supplying its value. */
117
+ configEnv: Array<[string, string]>;
118
+ subcommand: string | null;
119
+ args: string[];
120
+ }
121
+ /** Splits `git <global options> <subcommand> <args>` (git.c handle_options: exact option names only). */
122
+ export declare function parseGitInvocation(argv: string[]): GitInvocation;
123
+ export type GitExpansion = {
124
+ kind: 'git';
125
+ invocation: GitInvocation;
126
+ } | {
127
+ kind: 'shell';
128
+ command: string;
129
+ args: string[];
130
+ } | {
131
+ kind: 'unknown';
132
+ reason: 'not_found' | 'loop' | 'too_deep' | 'unparsed' | 'config_incomplete' | 'dynamic_config' | 'relocated';
133
+ };
134
+ /**
135
+ * Expands git aliases the way git would, keeping every candidate: each
136
+ * definition of alias.<name> from any scope or include, and `-c alias.*` from
137
+ * the command. Core built-in names are never expanded (git ignores aliases
138
+ * for them); maybe-installed commands keep both answers. `!` aliases become shell commands with the remaining args appended.
139
+ *
140
+ * `config` must be loaded with the same `env`. A per-invocation `-c` or
141
+ * `--config-env` pair that names `include.path` / `includeIf.*.path` is
142
+ * followed like git does when `fs` is given (`home` for `~/`); without `fs`, or
143
+ * when the file cannot be read in full, the answer is `unknown/config_incomplete`.
144
+ * `--bare`, `--exec-path`, `--namespace`, `--attr-source`, `--super-prefix`,
145
+ * `-C`, `--git-dir` and `--work-tree` make it `unknown/relocated`.
146
+ */
147
+ export declare function expandGitAliases(argv: string[], context: {
148
+ config: GitConfig;
149
+ env?: Record<string, string | undefined>;
150
+ fs?: SeatbeltFs;
151
+ home?: string | null;
152
+ }): GitExpansion[];
153
+ /**
154
+ * `git push` long options that can rewrite or delete remote refs (S1): the
155
+ * mapper treats a candidate in this set as risky. `prune` deletes remote
156
+ * branches that have no local counterpart under `--all`/a pattern refspec.
157
+ */
158
+ export declare const GIT_PUSH_RISKY_OPTIONS: string[];
159
+ /** Long options of `git push` (builtin/push.c), for prefix abbreviation. */
160
+ export declare const GIT_PUSH_LONG_OPTIONS: string[];
161
+ /**
162
+ * Every long option a `--name[=value]` argument can mean under git's unique
163
+ * prefix abbreviation. Exact names win; an ambiguous prefix keeps all matches
164
+ * (git would refuse, but the mapper must stop if any match is risky). Negated
165
+ * forms are returned as `no-<name>`.
166
+ */
167
+ export declare function gitLongOptionCandidates(arg: string, options?: string[], negatable?: Set<string>): string[];
168
+ export type GitHead = {
169
+ kind: 'branch';
170
+ branch: string;
171
+ } | {
172
+ kind: 'detached';
173
+ } | {
174
+ kind: 'unknown';
175
+ };
176
+ export declare function readGitHead(fs: SeatbeltFs, dirs: GitDirs): GitHead;
177
+ /** The remote's default branch from refs/remotes/<remote>/HEAD; null when absent; 'unknown' when unreadable. */
178
+ export declare function readRemoteDefaultBranch(fs: SeatbeltFs, dirs: GitDirs, remote: string): string | null | 'unknown';
179
+ export declare const BASELINE_PROTECTED_BRANCHES: string[];
180
+ /** PB membership (§1.2). Compared case-insensitively; an unresolved target is protected. */
181
+ export declare function isProtectedBranch(branch: string | null, extra?: string[]): boolean;
182
+ export interface PushRefspec {
183
+ force: boolean;
184
+ delete: boolean;
185
+ /** Destination branch name, or null when it cannot be resolved locally. */
186
+ destination: string | null;
187
+ /** Refspec names more than one branch (a pattern or a matching `:`). */
188
+ all: boolean;
189
+ }
190
+ /** Resolves one push refspec's destination against HEAD and the upstream config. */
191
+ export declare function resolvePushRefspec(refspec: string, head: GitHead): PushRefspec;
192
+ export interface ImplicitPushTargets {
193
+ /** Branch names a remote-only `git push [remote]` may update. */
194
+ branches: string[];
195
+ /** push.default=matching or a pattern refspec: may update any branch. */
196
+ all: boolean;
197
+ /** Some target could not be resolved (detached HEAD, unreadable config). */
198
+ unknown: boolean;
199
+ /** remote.<r>.push has a `+` refspec. */
200
+ forceFromConfig: boolean;
201
+ /** remote.<r>.mirror is set. */
202
+ mirror: boolean;
203
+ /** Every remote this push may go to. */
204
+ remotes: string[];
205
+ }
206
+ /**
207
+ * Targets of `git push` with no refspec (and optionally no remote), as the
208
+ * union of every config candidate: remote.<r>.push, push.default and the
209
+ * branch's upstream.
210
+ */
211
+ export declare function implicitPushTargets(config: GitConfig, head: GitHead, remote: string | null): ImplicitPushTargets;
212
+ //# sourceMappingURL=seatbelt-git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seatbelt-git.d.ts","sourceRoot":"","sources":["../src/seatbelt-git.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAShD,eAAO,MAAM,oBAAoB,QAAc,CAAC;AAChD,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,iGAAiG;AACjG,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,MAAM,WAAW,cAAc;IAC7B,sFAAsF;IACtF,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,0HAA0H;IAC1H,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,6GAA6G;AAC7G,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMnD;AAuBD,kEAAkE;AAClE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,EAAE,CA8BjF;AAED,MA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