@git-stunts/git-cas 5.2.1 → 5.3.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/CHANGELOG.md +100 -0
- package/README.md +67 -5
- package/bin/actions.js +38 -8
- package/bin/config.js +203 -0
- package/bin/git-cas.js +200 -54
- package/bin/ui/context.js +13 -0
- package/bin/ui/dashboard-cmds.js +14 -6
- package/bin/ui/dashboard-view.js +55 -6
- package/bin/ui/dashboard.js +109 -7
- package/bin/ui/encryption-card.js +2 -2
- package/bin/ui/heatmap.js +20 -2
- package/bin/ui/history-timeline.js +8 -6
- package/bin/ui/manifest-view.js +37 -8
- package/bin/ui/passphrase-prompt.js +100 -0
- package/bin/ui/progress.js +60 -38
- package/index.d.ts +20 -1
- package/index.js +74 -218
- package/package.json +2 -1
- package/src/domain/errors/CasError.js +3 -1
- package/src/domain/helpers/buildKdfMetadata.js +18 -0
- package/src/domain/services/CasService.d.ts +21 -1
- package/src/domain/services/CasService.js +134 -228
- package/src/domain/services/KeyResolver.js +220 -0
- package/src/domain/services/Semaphore.js +2 -2
- package/src/domain/services/VaultService.js +72 -29
- package/src/domain/services/rotateVaultPassphrase.js +143 -0
- package/src/infrastructure/adapters/BunCryptoAdapter.js +38 -6
- package/src/infrastructure/adapters/EventEmitterObserver.js +19 -7
- package/src/infrastructure/adapters/FileIOHelper.js +64 -0
- package/src/infrastructure/adapters/GitPersistenceAdapter.js +21 -5
- package/src/infrastructure/adapters/GitRefAdapter.js +27 -5
- package/src/infrastructure/adapters/NodeCryptoAdapter.js +49 -8
- package/src/infrastructure/adapters/SilentObserver.js +15 -0
- package/src/infrastructure/adapters/StatsCollector.js +15 -1
- package/src/infrastructure/adapters/WebCryptoAdapter.js +120 -42
- package/src/infrastructure/adapters/createCryptoAdapter.js +25 -0
- package/src/infrastructure/chunkers/CdcChunker.js +5 -0
- package/src/infrastructure/chunkers/FixedChunker.js +28 -8
- package/src/infrastructure/chunkers/resolveChunker.js +45 -0
- package/src/infrastructure/codecs/CborCodec.js +11 -3
- package/src/infrastructure/codecs/JsonCodec.js +10 -2
- package/src/ports/CodecPort.js +3 -3
- package/src/ports/CryptoPort.js +56 -23
- package/src/ports/GitPersistencePort.js +4 -4
- package/src/ports/GitRefPort.js +10 -10
- package/src/types/ambient.d.ts +37 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
export default class GitPersistencePort {
|
|
6
6
|
/**
|
|
7
7
|
* Writes content as a Git blob object.
|
|
8
|
-
* @param {Buffer|string}
|
|
8
|
+
* @param {Buffer|string} _content - Data to store.
|
|
9
9
|
* @returns {Promise<string>} The Git OID of the stored blob.
|
|
10
10
|
*/
|
|
11
11
|
async writeBlob(_content) {
|
|
@@ -14,7 +14,7 @@ export default class GitPersistencePort {
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Creates a Git tree object from formatted entries.
|
|
17
|
-
* @param {string[]}
|
|
17
|
+
* @param {string[]} _entries - Lines in `git mktree` format.
|
|
18
18
|
* @returns {Promise<string>} The Git OID of the created tree.
|
|
19
19
|
*/
|
|
20
20
|
async writeTree(_entries) {
|
|
@@ -23,7 +23,7 @@ export default class GitPersistencePort {
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Reads a Git blob by its OID.
|
|
26
|
-
* @param {string}
|
|
26
|
+
* @param {string} _oid - Git object ID.
|
|
27
27
|
* @returns {Promise<Buffer>} The blob content.
|
|
28
28
|
*/
|
|
29
29
|
async readBlob(_oid) {
|
|
@@ -32,7 +32,7 @@ export default class GitPersistencePort {
|
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Reads and parses a Git tree object.
|
|
35
|
-
* @param {string}
|
|
35
|
+
* @param {string} _treeOid - Git tree OID.
|
|
36
36
|
* @returns {Promise<Array<{ mode: string, type: string, oid: string, name: string }>>} Parsed tree entries.
|
|
37
37
|
*/
|
|
38
38
|
async readTree(_treeOid) {
|
package/src/ports/GitRefPort.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
export default class GitRefPort {
|
|
6
6
|
/**
|
|
7
7
|
* Resolves a Git ref to its commit OID.
|
|
8
|
-
* @param {string}
|
|
8
|
+
* @param {string} _ref - Git ref (e.g. 'refs/cas/vault').
|
|
9
9
|
* @returns {Promise<string>} The commit OID.
|
|
10
10
|
* @throws If the ref does not exist.
|
|
11
11
|
*/
|
|
@@ -15,7 +15,7 @@ export default class GitRefPort {
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Resolves the tree OID from a commit OID.
|
|
18
|
-
* @param {string}
|
|
18
|
+
* @param {string} _commitOid - Git commit OID.
|
|
19
19
|
* @returns {Promise<string>} The tree OID.
|
|
20
20
|
*/
|
|
21
21
|
async resolveTree(_commitOid) {
|
|
@@ -24,10 +24,10 @@ export default class GitRefPort {
|
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Creates a Git commit object.
|
|
27
|
-
* @param {Object}
|
|
28
|
-
* @param {string}
|
|
29
|
-
* @param {string|null} [
|
|
30
|
-
* @param {string}
|
|
27
|
+
* @param {Object} _options
|
|
28
|
+
* @param {string} _options.treeOid - Tree OID for the commit.
|
|
29
|
+
* @param {string|null} [_options.parentOid] - Parent commit OID (null for root commit).
|
|
30
|
+
* @param {string} _options.message - Commit message.
|
|
31
31
|
* @returns {Promise<string>} The new commit OID.
|
|
32
32
|
*/
|
|
33
33
|
async createCommit(_options) {
|
|
@@ -36,10 +36,10 @@ export default class GitRefPort {
|
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Atomically updates a Git ref with optional CAS (compare-and-swap) semantics.
|
|
39
|
-
* @param {Object}
|
|
40
|
-
* @param {string}
|
|
41
|
-
* @param {string}
|
|
42
|
-
* @param {string|null} [
|
|
39
|
+
* @param {Object} _options
|
|
40
|
+
* @param {string} _options.ref - Git ref to update.
|
|
41
|
+
* @param {string} _options.newOid - New OID to set.
|
|
42
|
+
* @param {string|null} [_options.expectedOldOid] - Expected current OID for CAS.
|
|
43
43
|
* @returns {Promise<void>}
|
|
44
44
|
*/
|
|
45
45
|
async updateRef(_options) {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ambient module declarations for dependencies that lack type definitions.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
declare module '@git-stunts/plumbing' {
|
|
6
|
+
interface ExecuteOptions {
|
|
7
|
+
args: string[];
|
|
8
|
+
input?: string | Buffer;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface StreamResult {
|
|
12
|
+
collect(options?: { asString?: boolean }): Promise<Uint8Array>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface ShellRunner {
|
|
16
|
+
run(command: string, args: string[], options?: Record<string, unknown>): Promise<unknown>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class ShellRunnerFactory {
|
|
20
|
+
static create(options?: Record<string, unknown>): ShellRunner;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default class GitPlumbing {
|
|
24
|
+
constructor(options: { runner: ShellRunner; cwd?: string });
|
|
25
|
+
execute(options: ExecuteOptions): Promise<string>;
|
|
26
|
+
executeStream(options: ExecuteOptions): Promise<StreamResult>;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare module 'bun' {
|
|
31
|
+
export class CryptoHasher {
|
|
32
|
+
constructor(algorithm: string);
|
|
33
|
+
update(data: Buffer | Uint8Array | string): this;
|
|
34
|
+
digest(encoding: 'hex'): string;
|
|
35
|
+
digest(): Uint8Array;
|
|
36
|
+
}
|
|
37
|
+
}
|