@bluestep-systems/b6p-core 1.2.0 → 1.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.
- package/README.md +133 -2
- package/dist/B6PCore.d.ts +22 -0
- package/dist/B6PCore.js +60 -8
- package/dist/B6PCore.js.map +1 -1
- package/dist/Err.d.ts +39 -0
- package/dist/Err.js +57 -0
- package/dist/Err.js.map +1 -1
- package/dist/cache/GitCredentialHosts.d.ts +46 -0
- package/dist/cache/GitCredentialHosts.js +90 -0
- package/dist/cache/GitCredentialHosts.js.map +1 -0
- package/dist/cache/GitCredentialResets.d.ts +89 -0
- package/dist/cache/GitCredentialResets.js +119 -0
- package/dist/cache/GitCredentialResets.js.map +1 -0
- package/dist/constants/GitCredential.d.ts +19 -0
- package/dist/constants/GitCredential.js +24 -0
- package/dist/constants/GitCredential.js.map +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +3 -1
- package/dist/constants/index.js.map +1 -1
- package/dist/gateway/GatewayClient.js +10 -0
- package/dist/gateway/GatewayClient.js.map +1 -1
- package/dist/gateway/GatewayMarketplace.d.ts +28 -4
- package/dist/gateway/GatewayMarketplace.js +141 -5
- package/dist/gateway/GatewayMarketplace.js.map +1 -1
- package/dist/gitCredential/GitConfigRunner.d.ts +97 -0
- package/dist/gitCredential/GitConfigRunner.js +244 -0
- package/dist/gitCredential/GitConfigRunner.js.map +1 -0
- package/dist/gitCredential/GitCredentialContext.d.ts +39 -0
- package/dist/gitCredential/GitCredentialContext.js +3 -0
- package/dist/gitCredential/GitCredentialContext.js.map +1 -0
- package/dist/gitCredential/GitCredentialService.d.ts +390 -0
- package/dist/gitCredential/GitCredentialService.js +594 -0
- package/dist/gitCredential/GitCredentialService.js.map +1 -0
- package/dist/gitCredential/configFile.d.ts +71 -0
- package/dist/gitCredential/configFile.js +289 -0
- package/dist/gitCredential/configFile.js.map +1 -0
- package/dist/gitCredential/credentialConfig.d.ts +146 -0
- package/dist/gitCredential/credentialConfig.js +523 -0
- package/dist/gitCredential/credentialConfig.js.map +1 -0
- package/dist/gitCredential/hosts.d.ts +17 -0
- package/dist/gitCredential/hosts.js +44 -0
- package/dist/gitCredential/hosts.js.map +1 -0
- package/dist/index.d.ts +15 -2
- package/dist/index.js +34 -2
- package/dist/index.js.map +1 -1
- package/dist/persistence/PersistenceKeys.d.ts +12 -1
- package/dist/persistence/PersistenceKeys.js +11 -0
- package/dist/persistence/PersistenceKeys.js.map +1 -1
- package/dist/persistence/SharedFilePersistence.d.ts +30 -11
- package/dist/persistence/SharedFilePersistence.js +66 -13
- package/dist/persistence/SharedFilePersistence.js.map +1 -1
- package/dist/persistence/exitCleanup.d.ts +37 -0
- package/dist/persistence/exitCleanup.js +142 -0
- package/dist/persistence/exitCleanup.js.map +1 -0
- package/dist/persistence/fileLock.d.ts +57 -0
- package/dist/persistence/fileLock.js +252 -0
- package/dist/persistence/fileLock.js.map +1 -0
- package/dist/persistence/lockedMutation.d.ts +26 -0
- package/dist/persistence/lockedMutation.js +45 -0
- package/dist/persistence/lockedMutation.js.map +1 -0
- package/dist/providers.d.ts +15 -0
- package/dist/script/ScriptContext.d.ts +7 -0
- package/dist/script/ScriptService.d.ts +6 -0
- package/dist/script/ScriptService.js +14 -0
- package/dist/script/ScriptService.js.map +1 -1
- package/dist/testing/FakeGateway.d.ts +15 -1
- package/dist/testing/FakeGateway.js +53 -1
- package/dist/testing/FakeGateway.js.map +1 -1
- package/dist/types.d.ts +53 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -84,6 +84,10 @@ between the local filesystem and the platform (the draft over git, `declarations
|
|
|
84
84
|
holds the HTTP client, the git layer, `core.gateway.kb` (knowledge bases), `core.gateway.marketplace`
|
|
85
85
|
and `core.gateway.tokens` for managing the caller's own access tokens; see [Gateway](#gateway) below.
|
|
86
86
|
|
|
87
|
+
`core.gitCredential` ([`GitCredentialService`](src/gitCredential/GitCredentialService.ts)) — b6p as git's
|
|
88
|
+
credential helper, so plain `git fetch`, `pull` and `push` use the stored token; see
|
|
89
|
+
[git's credential helper](#gits-credential-helper) below.
|
|
90
|
+
|
|
87
91
|
`core` itself — cross-cutting state that is not specific to any one subsystem:
|
|
88
92
|
|
|
89
93
|
| Method | Purpose |
|
|
@@ -233,6 +237,9 @@ Failures are typed, all extending `Err.GatewayError` (`status`, `code`):
|
|
|
233
237
|
| `GatewayConflictError` | `409 non-fast-forward` |
|
|
234
238
|
| `GatewayAliasTakenError` | `409 alias-taken` |
|
|
235
239
|
| `GatewayTooLargeError` | `413 too-large` |
|
|
240
|
+
| `GatewayRepoExistsError` | `409 repo-exists`: a marketplace repo of that name has history, is archived, or differs in case (a `GatewayConflictError`) |
|
|
241
|
+
| `GatewayRewriteInProgressError` | `409 rewrite-in-progress`: another change holds the repo; retry shortly (a `GatewayConflictError`) |
|
|
242
|
+
| `GatewayForgeUnavailableError` | `502 forge-unavailable` (a `GatewayUnavailableError`); a repo create may have left an empty repo, and calling it again adopts it |
|
|
236
243
|
| `GatewayUnavailableError` | `502`/`503`/`504`, a network failure or a timeout |
|
|
237
244
|
| `GatewayUnexpectedResponseError` | any other status, a redirect (`code: "redirect-refused"`, not followed), or a 2xx body that is not JSON |
|
|
238
245
|
| `GatewayConfigError` | an unusable `gatewayUrl`, or a URL or request path that resolves off the gateway's origin |
|
|
@@ -351,16 +358,25 @@ await core.gateway.tokens.rotate("laptop"); // → { replaced, token, rotatedCur
|
|
|
351
358
|
|
|
352
359
|
`core.gateway.marketplace` ([`GatewayMarketplace`](src/gateway/GatewayMarketplace.ts)) lists the
|
|
353
360
|
marketplace repos (name, description, default branch, tags, `gitUrl`; the body is validated) and
|
|
354
|
-
pulls a plain working clone of one
|
|
355
|
-
no push
|
|
361
|
+
pulls a plain working clone of one, and creates a new one (`create`, below). It is unrelated to any
|
|
362
|
+
script's sources or pins. Core has no push of its own: a marketplace repo is pushed with plain `git`.
|
|
356
363
|
|
|
357
364
|
```typescript
|
|
358
365
|
const repos = await core.gateway.marketplace.list();
|
|
359
366
|
const repo = await core.gateway.marketplace.get("core"); // GatewayNotFoundError if absent
|
|
360
367
|
await core.gateway.marketplace.pull("core", { cwd }); // <cwd>/core at the default branch
|
|
361
368
|
await core.gateway.marketplace.pull("core", { cwd, dir, ref: "v1.1.0" }); // a tag (detached head) or branch
|
|
369
|
+
const { repo, created } = await core.gateway.marketplace.create({ name: "kb", description: "Knowledge base", topics: ["kb"] });
|
|
362
370
|
```
|
|
363
371
|
|
|
372
|
+
`create` (`POST /api/v1/registry/repos`, scope `registry:push`, a fleet super) makes a private, empty repo with default
|
|
373
|
+
branch `main`, protected, with the metadata given (`description`, `website`, `topics`; only what is given is sent, and the
|
|
374
|
+
request is checked as the gateway checks it, so a bad one is `GatewayInvalidArgumentError` with nothing sent; names the forge reserves, `.`, `..`, `-` and any ending `.git`, `.wiki`, `.rss` or `.atom`, are refused too). `created`
|
|
375
|
+
is `true` for a new repo (`201`) and `false` when an existing empty repo of that name was adopted (`200`). The repo is
|
|
376
|
+
empty, so it is not in `list()` until its first push: `create` returns it from the answer, and the first push is
|
|
377
|
+
`git push <repo.gitUrl> main` alone; its tags go in a second push (the gateway refuses `main` together with tags). `409 repo-exists`, `409 rewrite-in-progress` and
|
|
378
|
+
`502 forge-unavailable` are `GatewayRepoExistsError`, `GatewayRewriteInProgressError` and `GatewayForgeUnavailableError`.
|
|
379
|
+
|
|
364
380
|
`cwd` is the consumer's own working directory (core never reads `process.cwd()`); `dir` is relative to it.
|
|
365
381
|
`list` leaves out a malformed entry rather than failing for every repo (`get` of that name is
|
|
366
382
|
`GatewayUnexpectedResponseError`), and a name is checked as a folder name only when `dir` is omitted.
|
|
@@ -428,6 +444,121 @@ answers the contract's REST routes (the token routes included) and error codes,
|
|
|
428
444
|
`issuedTokens`, `issuedSecrets` (every secret ever accepted, revoked ones included, for leak
|
|
429
445
|
checks), `failNext` and `route` (for mounting git smart-HTTP handlers).
|
|
430
446
|
|
|
447
|
+
### git's credential helper
|
|
448
|
+
|
|
449
|
+
`core.gitCredential` ([`GitCredentialService`](src/gitCredential/GitCredentialService.ts)) lets plain `git` in a
|
|
450
|
+
knowledge-base clone (the gateway) or a script's `draft/` folder (a tenant's git proxy) use the stored `b6pt_`
|
|
451
|
+
token without asking, the way `gh auth setup-git` does for github.com. Both git proxies take the token as the Basic
|
|
452
|
+
password, so git needs nothing else: no CSRF token and no session.
|
|
453
|
+
|
|
454
|
+
Plain `git pull` and `git push` then work in knowledge bases and in script drafts. A plain push in a draft lands the
|
|
455
|
+
commit on the platform's draft branch but does not build or publish it: the platform's build and a snapshot publish
|
|
456
|
+
still take `core.script.push` (the CLI's `b6p script push` or publish), which is unchanged.
|
|
457
|
+
|
|
458
|
+
```ts
|
|
459
|
+
// git runs `<helper> get|store|erase` with the request on stdin; the consumer passes it through:
|
|
460
|
+
process.stdout.write(await core.gitCredential.answer(action, stdinText)); // then exit 0
|
|
461
|
+
|
|
462
|
+
await core.gitCredential.allowedHosts(); // [{ host: "gateway.bluestep.net", source: "gateway" }, { host, source: "script-pull" }]
|
|
463
|
+
await core.gitCredential.setupStatus({ cwd }); // { hosts: [{ host, source, configured, alsoAsked, others }], configured, otherHelpers, scope }
|
|
464
|
+
await core.gitCredential.cloneStatus(cloneDir); // that clone's remote host, read with the clone's own config; null off the list
|
|
465
|
+
await core.gitCredential.setupGit(); // per allowed host: credential.https://<host>.helper = "" then = !b6p auth git-credential; also keptResets
|
|
466
|
+
await core.gitCredential.removeGit(); // { removed, keptResets: [{ url, file, reason }] }: takes those entries out again
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
- **What it answers for.** `get` answers `username=b6p` and `password=<token>` only for `protocol=https` and a host
|
|
470
|
+
exactly on the allowlist (`host[:port]`, the port only when not 443): the configured gateway's host when it is https,
|
|
471
|
+
and every tenant host a `core.script.pull` reached through its git proxy with the token
|
|
472
|
+
([`GitCredentialHosts`](src/cache/GitCredentialHosts.ts), recorded after the git half of the pull succeeds). No host
|
|
473
|
+
rule such as `*.bluestep.net` is assumed. A lookalike host, another port, http, a request naming another username
|
|
474
|
+
or carrying a `url=` (git never sends one to a helper) gets an empty answer, so git asks its other helpers.
|
|
475
|
+
- **`store` and `erase` do nothing.** The token enters only through the consumer's sign-in. git sends `erase` after
|
|
476
|
+
any 401, and one tenant refusing the token (or an outage answered with a 401) must not sign b6p out everywhere.
|
|
477
|
+
- **git 2.27 or later; 2.42 or later for setup.** Status, `cloneStatus` and removal refuse an older git
|
|
478
|
+
(`git --version`), because the partial-URL fallback their matching follows arrived in git 2.27.0 (git 2.26 ignores
|
|
479
|
+
a pattern such as `https://`, so the same config means something else there). Setup also needs
|
|
480
|
+
`git var GIT_CONFIG_GLOBAL` (git 2.42.0). Both fail as `Err.GitCredentialSetupError`.
|
|
481
|
+
- **Setup resets, like gh.** For each allowed host it appends a new `[credential "https://<host>"]` section holding
|
|
482
|
+
an empty `helper =` (git's reset, so no earlier helper such as `store` or `cache` answers that host or is told to
|
|
483
|
+
keep the token) and then `helper =` b6p's command, to the file git itself reports `git config --global` writes
|
|
484
|
+
(`git var GIT_CONFIG_GLOBAL`, chosen by git's own rule; never worked out from `HOME` or `USERPROFILE`, which Git
|
|
485
|
+
for Windows does not always use; a relative `GIT_CONFIG_GLOBAL` is resolved against the process's directory, once,
|
|
486
|
+
for every read, edit and record). The pair is written in one edit under git's own lock on that file
|
|
487
|
+
(`<file>.lock`, created exclusively and owner-only, set to the file's mode as read under the lock, and renamed over
|
|
488
|
+
the file, as every git writer does; a
|
|
489
|
+
symlink is followed to its target, even a missing one, as git's `resolve_symlink` does, so it stays a link). The
|
|
490
|
+
file never holds one line without the other, and no other git writer's change lands in between. The file is edited
|
|
491
|
+
as bytes, so a value that is not UTF-8 is kept exactly; a last value continued with a trailing `\` is ended with an
|
|
492
|
+
empty line first; and setup refuses an edit that would change any entry git already reads there. A host already
|
|
493
|
+
set up in the system and global config is left alone, so a second run changes nothing; otherwise b6p's own entries
|
|
494
|
+
and pair for it are taken out first, so neither line is ever doubled. A tenant recorded later needs another run.
|
|
495
|
+
- **Status follows git's credential contexts exactly.** `setupStatus()` works out, per host, every entry git 2.53
|
|
496
|
+
applies to it (`credentialContextMatch`, from git's `credential.c` and `urlmatch.c`): every matching entry in config
|
|
497
|
+
order, resets included, not only the most specific. A pattern git can normalize matches by scheme and host
|
|
498
|
+
case-insensitively, a whole `*` label matching any one label, by port with leading zeros dropped and `:443` the same
|
|
499
|
+
as none, by the user when it names one, and by path prefix (escapes normalized, dot segments resolved). Any other
|
|
500
|
+
pattern (no scheme, a `%` in the host, port 0, `https://` with no host at all, or an empty subsection,
|
|
501
|
+
`[credential ""]`) is matched as git's partial-URL fallback does: only the parts it names, percent-decoded, compared
|
|
502
|
+
exactly, so `https://` and `""` apply to every https request. A pattern naming any user (`https://alice@<host>`)
|
|
503
|
+
is `maybe` for its host: a remote URL naming that user brings its helper in, and one that answers `username=b6p`
|
|
504
|
+
makes git ask b6p next, which answers, and git then hands the token to that helper on `store`. Each entry is
|
|
505
|
+
`yes` (every request b6p answers for the host), `no` or `maybe` (only some: a path, the `b6p` user, a partial
|
|
506
|
+
pattern's host spelling). In doubt, another helper counts as asked, and a reset or b6p's own entry as not applying
|
|
507
|
+
when it would hide one, so `configured` is true only when git certainly asks b6p alone; setup repairs any host
|
|
508
|
+
that is not. `alsoAsked` lists the other helpers and `others` the config entries responsible (key, value, file,
|
|
509
|
+
`null` for the command line). Setup never moves or deletes the user's entries, so the consumer tells the user to
|
|
510
|
+
move such an entry before b6p's section or remove it. `otherHelpers` lists the generic helpers.
|
|
511
|
+
- **Which config status reads.** The config in effect where it runs (`{ cwd }`, default the process's directory):
|
|
512
|
+
system, `~/.gitconfig`, `$XDG_CONFIG_HOME/git/config`, the command line and `GIT_CONFIG_COUNT`, and inside a
|
|
513
|
+
repository its local and worktree config, with every file they `[include]` (`git config --includes --show-scope
|
|
514
|
+
--show-origin`). `scope` says which: `"global"` outside any repository, `"global+here"` inside one. **No status
|
|
515
|
+
covers another repository's own config**: a helper set in some other clone's `.git/config`, or in a file an
|
|
516
|
+
`includeIf` reads only there, is seen only from that clone. So an `includeIf` after b6p's pair counts as a helper
|
|
517
|
+
that may be asked (`configured: false`, the entry in `others`), and setup repairs it by appending the pair after it.
|
|
518
|
+
`cloneStatus(dir, { remote })` answers for one clone: the host of its remote (`origin` by default), read with that
|
|
519
|
+
clone's config, or `null` when the remote's host is not an allowed one; the remote's URL is never in the result.
|
|
520
|
+
A consumer calls it after a knowledge-base or script pull to warn that git there would ask another helper too.
|
|
521
|
+
Setup and removal change only the global files.
|
|
522
|
+
- **b6p removes only pairs that are certainly its own.** Each pair setup writes is recorded in public state
|
|
523
|
+
`b6p:git_credential_resets` as `{ "<file>": { "<exact key>": { state, helper, pairsBefore? } } }`, `adding` (with how
|
|
524
|
+
many reset-then-helper pairs the key had in the file, counted as git sees them) before the edit and `installed`
|
|
525
|
+
after; a run that stopped in between is settled from the file: the count it had means not written, one more means
|
|
526
|
+
written, anything else `unconfirmed`. A pair stays b6p's only while its helper directly follows an empty value of
|
|
527
|
+
that key in that file; if the user took b6p's helper out, b6p drops its claim and deletes nothing. Removal re-reads
|
|
528
|
+
the file under git's lock and removes b6p's pair, both lines in that one edit (and the section header when nothing
|
|
529
|
+
else is left under it), only when the file holds exactly one such pair, each on its own line: a reset anyone else
|
|
530
|
+
wrote (one a moment ago included) is never touched. With several pairs under the key, only b6p's helper lines go,
|
|
531
|
+
the resets stay inert, and the key is reported in `keptResets` (`reason: "shared-key"`); one pair sharing a line
|
|
532
|
+
with other text, and an `unconfirmed` claim, are reported as `unconfirmed`, each once. Then every other entry whose
|
|
533
|
+
value is b6p's command, in any spelling of the URL, is removed from the global file it came from. So an
|
|
534
|
+
interruption at any point leaves either b6p's whole pair or an inert reset, never b6p's helper on its own. File
|
|
535
|
+
paths are compared as git reports them (on Windows, either slash and any case). The record survives
|
|
536
|
+
`clearSettings()` and `clearAll()`, which keep it in the same write that clears the rest of public state
|
|
537
|
+
(`Persistence.clearPublicExcept`), because the entries it describes stay in the git config until a removal takes
|
|
538
|
+
them out; every read of the record takes its lock.
|
|
539
|
+
- **Locks.** One lock guards the whole of `SharedFilePersistence`'s state file (`state.json.lock`): every write
|
|
540
|
+
re-reads the file under it and changes only its own key, so no process's setting, cache entry or record is lost to
|
|
541
|
+
another's. Each record or forget of a tenant host, and each reset record, is also one read-modify-write under
|
|
542
|
+
`Persistence.withLock`, and each setup or removal holds one git config lock (`b6p:git_credential_config`) from
|
|
543
|
+
reading the config to settling the last record, so two never interleave, in one process or several. A lockfile
|
|
544
|
+
(`withFileLock`) works as git's `<file>.lock` does: created exclusively, its stamp (process id, host name, a
|
|
545
|
+
token) written and the file registered for cleanup in one synchronous step, held for as long as the work runs, and **never removed by another
|
|
546
|
+
process**, whatever its age or holder. Release removes it only while it holds this acquisition's token, retrying a
|
|
547
|
+
transient `EPERM`/`EBUSY`/`EACCES`; a release still refused stays pending, and this process (only this one) removes
|
|
548
|
+
that lock on its next acquisition of it and on exit. As git's tempfile.c does, b6p removes the locks it holds, and
|
|
549
|
+
git's `<config>.lock` while it is editing a config file (only while it is still the file it created: the same
|
|
550
|
+
device and inode, and for b6p's lock its own stamp), when the process exits, gets SIGINT, SIGTERM or SIGHUP while
|
|
551
|
+
no handler of the host's is listening (then stopping with that signal; a host handler decides instead, and if it
|
|
552
|
+
exits the locks go with the exit; a host `once` handler taking the signal is left to finish, and a second signal
|
|
553
|
+
stops the process), or dies of an uncaught exception that nothing catches. Both
|
|
554
|
+
locks are created and tracked in one synchronous step, so only a hard kill (SIGKILL, power loss) can leave one. A
|
|
555
|
+
lock held by another is waited for; any other refusal to create one fails at once (on Windows, `EPERM`/`EBUSY`/
|
|
556
|
+
`EACCES` are waited for too). A deleted `~/.b6p` is created again. After 10 s a waiter gives up with an error naming the
|
|
557
|
+
lockfile and its holder (or saying the lock is empty): "If no b6p or VS Code process is running, delete <path>." A pull whose host cannot be recorded still succeeds.
|
|
558
|
+
- The helper command defaults to `GitCredential.DEFAULT_HELPER`; pass `{ helper }` to write another.
|
|
559
|
+
- The token never reaches git's argv, a config file, a log line or an error message. Failures of `git config`, and
|
|
560
|
+
of a config file edit, are `Err.GitCredentialSetupError` (`exitCode`).
|
|
561
|
+
|
|
431
562
|
## Development
|
|
432
563
|
|
|
433
564
|
```bash
|
package/dist/B6PCore.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import type { AuthProvider, B6PProviders } from "./providers";
|
|
|
3
3
|
import type { AuthParams } from "./types";
|
|
4
4
|
import { ScriptMetaDataStore } from "./cache/ScriptMetaDataStore";
|
|
5
5
|
import { OrgCache } from "./cache/OrgCache";
|
|
6
|
+
import { GitCredentialHosts } from "./cache/GitCredentialHosts";
|
|
7
|
+
import { GitCredentialService } from "./gitCredential/GitCredentialService";
|
|
6
8
|
import { ScriptService } from "./script/ScriptService";
|
|
7
9
|
import { UpdateService } from "./update/UpdateService";
|
|
8
10
|
import { GatewayService } from "./gateway/GatewayService";
|
|
@@ -55,6 +57,11 @@ export declare class B6PCore {
|
|
|
55
57
|
readonly sessionManager: SessionManager;
|
|
56
58
|
readonly scriptMetadataStore: ScriptMetaDataStore;
|
|
57
59
|
readonly orgCache: OrgCache;
|
|
60
|
+
/**
|
|
61
|
+
* The tenant hosts script pulls reached with the stored token.
|
|
62
|
+
* @lastreviewed null
|
|
63
|
+
*/
|
|
64
|
+
readonly gitCredentialHosts: GitCredentialHosts;
|
|
58
65
|
readonly updateService: UpdateService | null;
|
|
59
66
|
/**
|
|
60
67
|
* Script management: push, pull, audit, deploy, and setup-URL resolution.
|
|
@@ -72,6 +79,12 @@ export declare class B6PCore {
|
|
|
72
79
|
* @lastreviewed null
|
|
73
80
|
*/
|
|
74
81
|
readonly schema: SchemaService;
|
|
82
|
+
/**
|
|
83
|
+
* b6p as git's credential helper: answer git for the gateway and the tenant hosts script pulls
|
|
84
|
+
* reached, and set that up in (or take it out of) the user's global git config.
|
|
85
|
+
* @lastreviewed null
|
|
86
|
+
*/
|
|
87
|
+
readonly gitCredential: GitCredentialService;
|
|
75
88
|
private readonly _isDebugMode;
|
|
76
89
|
constructor(providers: B6PProviders);
|
|
77
90
|
isDebugMode(): boolean;
|
|
@@ -79,6 +92,15 @@ export declare class B6PCore {
|
|
|
79
92
|
clearSessions(): Promise<void>;
|
|
80
93
|
clearSettings(): Promise<void>;
|
|
81
94
|
clearAll(): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Clear public state, all but the record of the resets b6p wrote into the user's git config
|
|
97
|
+
* ({@link GitCredentialResets}): those entries stay in the git config until `removeGit` takes them
|
|
98
|
+
* out, and without the record it could not tell them from the user's. One write when the
|
|
99
|
+
* persistence has `clearPublicExcept` (`SharedFilePersistence` does); otherwise a clear and a
|
|
100
|
+
* write-back, both under the record's lock, which every read of the record also takes.
|
|
101
|
+
* @lastreviewed null
|
|
102
|
+
*/
|
|
103
|
+
private clearPublicState;
|
|
82
104
|
report(): Promise<ReportResult>;
|
|
83
105
|
checkForUpdates(): Promise<void>;
|
|
84
106
|
setConfig(key: string, value: unknown): Promise<void>;
|
package/dist/B6PCore.js
CHANGED
|
@@ -40,6 +40,12 @@ const BearerAuthProvider_1 = require("./auth/BearerAuthProvider");
|
|
|
40
40
|
const SessionManager_1 = require("./session/SessionManager");
|
|
41
41
|
const ScriptMetaDataStore_1 = require("./cache/ScriptMetaDataStore");
|
|
42
42
|
const OrgCache_1 = require("./cache/OrgCache");
|
|
43
|
+
const GitCredentialHosts_1 = require("./cache/GitCredentialHosts");
|
|
44
|
+
const GitCredentialResets_1 = require("./cache/GitCredentialResets");
|
|
45
|
+
const lockedMutation_1 = require("./persistence/lockedMutation");
|
|
46
|
+
const PersistenceKeys_1 = require("./persistence/PersistenceKeys");
|
|
47
|
+
const GitCredentialService_1 = require("./gitCredential/GitCredentialService");
|
|
48
|
+
const GitConfigRunner_1 = require("./gitCredential/GitConfigRunner");
|
|
43
49
|
const ScriptService_1 = require("./script/ScriptService");
|
|
44
50
|
const UpdateService_1 = require("./update/UpdateService");
|
|
45
51
|
const GatewayService_1 = require("./gateway/GatewayService");
|
|
@@ -117,6 +123,11 @@ class B6PCore {
|
|
|
117
123
|
sessionManager;
|
|
118
124
|
scriptMetadataStore;
|
|
119
125
|
orgCache;
|
|
126
|
+
/**
|
|
127
|
+
* The tenant hosts script pulls reached with the stored token.
|
|
128
|
+
* @lastreviewed null
|
|
129
|
+
*/
|
|
130
|
+
gitCredentialHosts;
|
|
120
131
|
updateService = null;
|
|
121
132
|
/**
|
|
122
133
|
* Script management: push, pull, audit, deploy, and setup-URL resolution.
|
|
@@ -134,6 +145,12 @@ class B6PCore {
|
|
|
134
145
|
* @lastreviewed null
|
|
135
146
|
*/
|
|
136
147
|
schema;
|
|
148
|
+
/**
|
|
149
|
+
* b6p as git's credential helper: answer git for the gateway and the tenant hosts script pulls
|
|
150
|
+
* reached, and set that up in (or take it out of) the user's global git config.
|
|
151
|
+
* @lastreviewed null
|
|
152
|
+
*/
|
|
153
|
+
gitCredential;
|
|
137
154
|
_isDebugMode;
|
|
138
155
|
constructor(providers) {
|
|
139
156
|
this.fs = providers.fs;
|
|
@@ -146,6 +163,7 @@ class B6PCore {
|
|
|
146
163
|
this.sessionManager = new SessionManager_1.SessionManager(this.persistence, this.logger, this.auth, this._isDebugMode, this.prompt, providers.fetchFn);
|
|
147
164
|
this.scriptMetadataStore = new ScriptMetaDataStore_1.ScriptMetaDataStore(this.persistence);
|
|
148
165
|
this.orgCache = new OrgCache_1.OrgCache(this.persistence, this.logger, providers.orgCacheSettings ?? NOOP_ORG_CACHE_SETTINGS, this._isDebugMode, this.prompt);
|
|
166
|
+
this.gitCredentialHosts = new GitCredentialHosts_1.GitCredentialHosts(this.persistence);
|
|
149
167
|
// The shared half of every subsystem's dependency bundle, built once. A second
|
|
150
168
|
// service spreads this same object and adds only what is specific to it, so the
|
|
151
169
|
// members below have one construction site rather than one per subsystem.
|
|
@@ -164,6 +182,7 @@ class B6PCore {
|
|
|
164
182
|
...platform,
|
|
165
183
|
scriptMetadataStore: this.scriptMetadataStore,
|
|
166
184
|
orgCache: this.orgCache,
|
|
185
|
+
gitCredentialHosts: this.gitCredentialHosts,
|
|
167
186
|
gitFs: providers.gitFs ?? nodeFs,
|
|
168
187
|
gitToken: async () => {
|
|
169
188
|
const header = await this.auth.authHeaderValue();
|
|
@@ -178,18 +197,29 @@ class B6PCore {
|
|
|
178
197
|
// bootstrap or `auth.authHeaderValue()`. Its URL is read from core config on every
|
|
179
198
|
// request (default gateway.bluestep.net) and validated by the client.
|
|
180
199
|
const persistence = this.persistence;
|
|
200
|
+
const gatewayUrl = async () => {
|
|
201
|
+
const configured = await persistence.get(`settings.${SettingsKeys_1.SettingsKeys.GATEWAY_URL}`);
|
|
202
|
+
return configured === undefined || configured === null || configured === ""
|
|
203
|
+
? Gateway_1.Gateway.DEFAULT_URL
|
|
204
|
+
: String(configured);
|
|
205
|
+
};
|
|
181
206
|
this.gateway = new GatewayService_1.GatewayService({
|
|
182
207
|
...platform,
|
|
183
208
|
gatewayToken: gatewayTokenFrom(this.auth),
|
|
184
209
|
gatewayTokenStore: gatewayTokenStoreFrom(this.auth),
|
|
185
|
-
gatewayUrl
|
|
186
|
-
const configured = await persistence.get(`settings.${SettingsKeys_1.SettingsKeys.GATEWAY_URL}`);
|
|
187
|
-
return configured === undefined || configured === null || configured === ""
|
|
188
|
-
? Gateway_1.Gateway.DEFAULT_URL
|
|
189
|
-
: String(configured);
|
|
190
|
-
},
|
|
210
|
+
gatewayUrl,
|
|
191
211
|
fetchFn: providers.fetchFn ?? globalThis.fetch.bind(globalThis),
|
|
192
212
|
});
|
|
213
|
+
// git's credential helper reads the same stored token the gateway does (never prompting) and
|
|
214
|
+
// answers only the gateway's host and the tenant hosts recorded by successful script pulls.
|
|
215
|
+
this.gitCredential = new GitCredentialService_1.GitCredentialService({
|
|
216
|
+
...platform,
|
|
217
|
+
token: gatewayTokenFrom(this.auth),
|
|
218
|
+
gatewayUrl,
|
|
219
|
+
hosts: this.gitCredentialHosts,
|
|
220
|
+
resets: new GitCredentialResets_1.GitCredentialResets(this.persistence),
|
|
221
|
+
gitConfig: (0, GitConfigRunner_1.gitConfigRunner)(),
|
|
222
|
+
});
|
|
193
223
|
// Initialize update service if configuration is provided
|
|
194
224
|
if (providers.updateServiceConfig) {
|
|
195
225
|
this.updateService = new UpdateService_1.UpdateService(this.persistence, this.logger, providers.updateServiceConfig, providers.fetchFn);
|
|
@@ -210,14 +240,36 @@ class B6PCore {
|
|
|
210
240
|
// ── Settings ──────────────────────────────────────────────────────
|
|
211
241
|
async clearSettings() {
|
|
212
242
|
this.prompt.info("Reverting to default settings");
|
|
213
|
-
await this.
|
|
243
|
+
await this.clearPublicState();
|
|
214
244
|
}
|
|
215
245
|
async clearAll() {
|
|
216
246
|
this.prompt.info("Clearing sessions, auth, and settings");
|
|
217
|
-
await this.
|
|
247
|
+
await this.clearPublicState();
|
|
218
248
|
await this.sessionManager.clearAll();
|
|
219
249
|
await this.auth.clear();
|
|
220
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Clear public state, all but the record of the resets b6p wrote into the user's git config
|
|
253
|
+
* ({@link GitCredentialResets}): those entries stay in the git config until `removeGit` takes them
|
|
254
|
+
* out, and without the record it could not tell them from the user's. One write when the
|
|
255
|
+
* persistence has `clearPublicExcept` (`SharedFilePersistence` does); otherwise a clear and a
|
|
256
|
+
* write-back, both under the record's lock, which every read of the record also takes.
|
|
257
|
+
* @lastreviewed null
|
|
258
|
+
*/
|
|
259
|
+
async clearPublicState() {
|
|
260
|
+
const key = PersistenceKeys_1.PublicKeys.GIT_CREDENTIAL_RESETS;
|
|
261
|
+
await (0, lockedMutation_1.exclusive)(this.persistence, key, async () => {
|
|
262
|
+
if (this.persistence.clearPublicExcept) {
|
|
263
|
+
await this.persistence.clearPublicExcept([key]);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
const kept = await this.persistence.get(key);
|
|
267
|
+
await this.persistence.clearPublic();
|
|
268
|
+
if (kept !== undefined) {
|
|
269
|
+
await this.persistence.set(key, kept);
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}
|
|
221
273
|
// ── State ─────────────────────────────────────────────────────────
|
|
222
274
|
async report() {
|
|
223
275
|
// Note: This is a basic implementation. Full functionality requires
|
package/dist/B6PCore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"B6PCore.js","sourceRoot":"","sources":["../src/B6PCore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,MAAM,oCAAgB;AAClC,2CAAwC;AACxC,kEAA+D;AAC/D,6DAA0D;AAG1D,qEAAkE;AAClE,+CAAmE;
|
|
1
|
+
{"version":3,"file":"B6PCore.js","sourceRoot":"","sources":["../src/B6PCore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,MAAM,oCAAgB;AAClC,2CAAwC;AACxC,kEAA+D;AAC/D,6DAA0D;AAG1D,qEAAkE;AAClE,+CAAmE;AACnE,mEAAgE;AAChE,qEAAkE;AAClE,iEAAyD;AACzD,mEAA2D;AAC3D,+EAA4E;AAC5E,qEAAkE;AAElE,0DAAuD;AACvD,0DAAuD;AACvD,6DAA0D;AAC1D,0DAAuD;AAEvD,iDAA8C;AAC9C,2DAAwD;AAExD,MAAM,uBAAuB,GAAqB;IAChD,6BAA6B,EAAE,GAAG,EAAE,CAAC,IAAI;CAC1C,CAAC;AAEF;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,IAA8B;IACtD,IAAI,IAAI,YAAY,uCAAkB,EAAE,CAAC;QACvC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;IAC7C,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC;AAC1C,CAAC;AAED;;;;;GAKG;AACH,SAAS,qBAAqB,CAA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I,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;CACF"}
|
package/dist/Err.d.ts
CHANGED
|
@@ -687,6 +687,22 @@ export declare namespace Err {
|
|
|
687
687
|
class GatewayLiveBranchUnprotectedError extends GatewayConflictError {
|
|
688
688
|
constructor(message: string);
|
|
689
689
|
}
|
|
690
|
+
/**
|
|
691
|
+
* `409 repo-exists`: a marketplace repo of that name already exists with history, is archived, or differs
|
|
692
|
+
* only in case. Nothing was changed.
|
|
693
|
+
* @lastreviewed null
|
|
694
|
+
*/
|
|
695
|
+
class GatewayRepoExistsError extends GatewayConflictError {
|
|
696
|
+
constructor(message: string);
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* `409 rewrite-in-progress`: another change holds the repo (its lock is busy, or was lost mid-way). Nothing
|
|
700
|
+
* is known to have changed; trying again shortly is safe.
|
|
701
|
+
* @lastreviewed null
|
|
702
|
+
*/
|
|
703
|
+
class GatewayRewriteInProgressError extends GatewayConflictError {
|
|
704
|
+
constructor(message: string);
|
|
705
|
+
}
|
|
690
706
|
/**
|
|
691
707
|
* `413 too-large`: the request body exceeds what the gateway accepts.
|
|
692
708
|
* @lastreviewed null
|
|
@@ -702,6 +718,14 @@ export declare namespace Err {
|
|
|
702
718
|
class GatewayUnavailableError extends GatewayError {
|
|
703
719
|
constructor(message: string, status: number | null, code: string | null);
|
|
704
720
|
}
|
|
721
|
+
/**
|
|
722
|
+
* `502 forge-unavailable`: the gateway answered, but the forge behind it failed (or a repo's protection could
|
|
723
|
+
* not be confirmed). A repo create may have left an empty repo behind; calling it again adopts and finishes it.
|
|
724
|
+
* @lastreviewed null
|
|
725
|
+
*/
|
|
726
|
+
class GatewayForgeUnavailableError extends GatewayUnavailableError {
|
|
727
|
+
constructor(message: string);
|
|
728
|
+
}
|
|
705
729
|
/**
|
|
706
730
|
* Any other non-2xx status, a refused redirect (code `redirect-refused`; redirects are never
|
|
707
731
|
* followed), or a 2xx whose body is not the JSON the route promises.
|
|
@@ -947,4 +971,19 @@ export declare namespace Err {
|
|
|
947
971
|
readonly ref: string;
|
|
948
972
|
constructor(message: string, ref: string);
|
|
949
973
|
}
|
|
974
|
+
/**
|
|
975
|
+
* Setting b6p up as git's credential helper, taking it out, or reading its status failed: git
|
|
976
|
+
* could not be run or is too old, `git config` refused, or a config file could not be locked,
|
|
977
|
+
* parsed or written. The message never contains the token, which never reaches git's arguments
|
|
978
|
+
* or a config file.
|
|
979
|
+
* @lastreviewed null
|
|
980
|
+
*/
|
|
981
|
+
class GitCredentialSetupError extends Error {
|
|
982
|
+
/**
|
|
983
|
+
* git's exit code, or `null` when git could not be run or the request was refused before it.
|
|
984
|
+
* @lastreviewed null
|
|
985
|
+
*/
|
|
986
|
+
readonly exitCode: number | null;
|
|
987
|
+
constructor(message: string, exitCode: number | null);
|
|
988
|
+
}
|
|
950
989
|
}
|
package/dist/Err.js
CHANGED
|
@@ -1102,6 +1102,30 @@ var Err;
|
|
|
1102
1102
|
}
|
|
1103
1103
|
}
|
|
1104
1104
|
Err.GatewayLiveBranchUnprotectedError = GatewayLiveBranchUnprotectedError;
|
|
1105
|
+
/**
|
|
1106
|
+
* `409 repo-exists`: a marketplace repo of that name already exists with history, is archived, or differs
|
|
1107
|
+
* only in case. Nothing was changed.
|
|
1108
|
+
* @lastreviewed null
|
|
1109
|
+
*/
|
|
1110
|
+
class GatewayRepoExistsError extends GatewayConflictError {
|
|
1111
|
+
constructor(message) {
|
|
1112
|
+
super(message, "repo-exists");
|
|
1113
|
+
this.name = "GatewayRepoExistsError";
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
Err.GatewayRepoExistsError = GatewayRepoExistsError;
|
|
1117
|
+
/**
|
|
1118
|
+
* `409 rewrite-in-progress`: another change holds the repo (its lock is busy, or was lost mid-way). Nothing
|
|
1119
|
+
* is known to have changed; trying again shortly is safe.
|
|
1120
|
+
* @lastreviewed null
|
|
1121
|
+
*/
|
|
1122
|
+
class GatewayRewriteInProgressError extends GatewayConflictError {
|
|
1123
|
+
constructor(message) {
|
|
1124
|
+
super(message, "rewrite-in-progress");
|
|
1125
|
+
this.name = "GatewayRewriteInProgressError";
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
Err.GatewayRewriteInProgressError = GatewayRewriteInProgressError;
|
|
1105
1129
|
/**
|
|
1106
1130
|
* `413 too-large`: the request body exceeds what the gateway accepts.
|
|
1107
1131
|
* @lastreviewed null
|
|
@@ -1125,6 +1149,18 @@ var Err;
|
|
|
1125
1149
|
}
|
|
1126
1150
|
}
|
|
1127
1151
|
Err.GatewayUnavailableError = GatewayUnavailableError;
|
|
1152
|
+
/**
|
|
1153
|
+
* `502 forge-unavailable`: the gateway answered, but the forge behind it failed (or a repo's protection could
|
|
1154
|
+
* not be confirmed). A repo create may have left an empty repo behind; calling it again adopts and finishes it.
|
|
1155
|
+
* @lastreviewed null
|
|
1156
|
+
*/
|
|
1157
|
+
class GatewayForgeUnavailableError extends GatewayUnavailableError {
|
|
1158
|
+
constructor(message) {
|
|
1159
|
+
super(message, 502, "forge-unavailable");
|
|
1160
|
+
this.name = "GatewayForgeUnavailableError";
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
Err.GatewayForgeUnavailableError = GatewayForgeUnavailableError;
|
|
1128
1164
|
/**
|
|
1129
1165
|
* Any other non-2xx status, a refused redirect (code `redirect-refused`; redirects are never
|
|
1130
1166
|
* followed), or a 2xx whose body is not the JSON the route promises.
|
|
@@ -1441,5 +1477,26 @@ var Err;
|
|
|
1441
1477
|
}
|
|
1442
1478
|
}
|
|
1443
1479
|
Err.GatewayKnowledgeBasePushNotPermittedError = GatewayKnowledgeBasePushNotPermittedError;
|
|
1480
|
+
// Git credential helper errors
|
|
1481
|
+
/**
|
|
1482
|
+
* Setting b6p up as git's credential helper, taking it out, or reading its status failed: git
|
|
1483
|
+
* could not be run or is too old, `git config` refused, or a config file could not be locked,
|
|
1484
|
+
* parsed or written. The message never contains the token, which never reaches git's arguments
|
|
1485
|
+
* or a config file.
|
|
1486
|
+
* @lastreviewed null
|
|
1487
|
+
*/
|
|
1488
|
+
class GitCredentialSetupError extends Error {
|
|
1489
|
+
/**
|
|
1490
|
+
* git's exit code, or `null` when git could not be run or the request was refused before it.
|
|
1491
|
+
* @lastreviewed null
|
|
1492
|
+
*/
|
|
1493
|
+
exitCode;
|
|
1494
|
+
constructor(message, exitCode) {
|
|
1495
|
+
super(message);
|
|
1496
|
+
this.name = "GitCredentialSetupError";
|
|
1497
|
+
this.exitCode = exitCode;
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
Err.GitCredentialSetupError = GitCredentialSetupError;
|
|
1444
1501
|
})(Err || (exports.Err = Err = {}));
|
|
1445
1502
|
//# sourceMappingURL=Err.js.map
|