type-git 0.3.0-beta.0 → 0.5.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 +38 -18
- package/dist/adapters/bun/index.cjs +13187 -0
- package/dist/adapters/bun/index.cjs.map +1 -1
- package/dist/adapters/bun/index.d.cts +11 -6
- package/dist/adapters/bun/index.d.ts +11 -6
- package/dist/adapters/bun/index.js +13176 -0
- package/dist/adapters/bun/index.js.map +1 -1
- package/dist/adapters/deno/index.cjs +13187 -0
- package/dist/adapters/deno/index.cjs.map +1 -1
- package/dist/adapters/deno/index.d.cts +11 -6
- package/dist/adapters/deno/index.d.ts +11 -6
- package/dist/adapters/deno/index.js +13176 -0
- package/dist/adapters/deno/index.js.map +1 -1
- package/dist/adapters/node/index.cjs +8231 -1249
- package/dist/adapters/node/index.cjs.map +1 -1
- package/dist/adapters/node/index.d.cts +8 -4268
- package/dist/adapters/node/index.d.ts +8 -4268
- package/dist/adapters/node/index.js +8231 -1249
- package/dist/adapters/node/index.js.map +1 -1
- package/dist/client-KHa1WMIH.d.cts +12041 -0
- package/dist/client-KHa1WMIH.d.ts +12041 -0
- package/dist/index.cjs +8230 -1264
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8230 -1264
- package/dist/index.js.map +1 -1
- package/docs/migrations/0.4.0.md +93 -0
- package/package.json +9 -4
- package/dist/adapters-CZ8wj9Kr.d.cts +0 -850
- package/dist/adapters-CZ8wj9Kr.d.ts +0 -850
package/README.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Type-safe Git wrapper library with LFS support, progress tracking, and abort control for Node.js/Deno/Bun.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Typed inputs are checked against supported output contracts, with runtime validation for JavaScript callers.
|
|
6
|
+
|
|
7
|
+
**Upgrading:** [0.4.0 migration guide](docs/migrations/0.4.0.md).
|
|
6
8
|
|
|
7
9
|
**[Documentation](https://ash-r1.github.io/type-git/)** | **[API Reference](https://ash-r1.github.io/type-git/api/readme/)**
|
|
8
10
|
|
|
@@ -19,9 +21,9 @@ Type-safe Git wrapper library with LFS support, progress tracking, and abort con
|
|
|
19
21
|
|
|
20
22
|
## Design Philosophy
|
|
21
23
|
|
|
22
|
-
This library wraps Git CLI
|
|
24
|
+
This library wraps Git CLI with a focus on:
|
|
23
25
|
|
|
24
|
-
1. **Output Contract Safety**:
|
|
26
|
+
1. **Output Contract Safety**: Parsed convenience APIs expose operations with stable stdout formats; typed CLI access returns raw output
|
|
25
27
|
2. **Repository Context**: Separates `Git` (non-repo operations) from `Repo` (repo operations)
|
|
26
28
|
3. **Worktree vs Bare**: Type-safe distinction between worktree and bare repositories
|
|
27
29
|
4. **Raw Escape Hatch**: Arbitrary git commands via `raw()` when needed
|
|
@@ -45,7 +47,7 @@ This library wraps Git CLI (and optionally libgit2) with a focus on:
|
|
|
45
47
|
## Installation
|
|
46
48
|
|
|
47
49
|
```bash
|
|
48
|
-
npm install type-git
|
|
50
|
+
npm install type-git
|
|
49
51
|
```
|
|
50
52
|
|
|
51
53
|
## Usage
|
|
@@ -87,6 +89,20 @@ import { TypeGit } from 'type-git/node';
|
|
|
87
89
|
const git = await TypeGit.create({ useLegacyVersion: true });
|
|
88
90
|
```
|
|
89
91
|
|
|
92
|
+
### Typed CLI commands
|
|
93
|
+
|
|
94
|
+
Use `command()` for registered CLI operations, including ones without a parsed convenience method:
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
const hash = await git.command('hash-object', [['--stdin']], { stdin: 'hello' });
|
|
98
|
+
await repo.command('remote add', [{ operand: 'origin' }, { operand: '/path/to/upstream' }]);
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Option tuples and operand objects retain ordering and repeated flags. Literal combinations are
|
|
102
|
+
checked against declarative rules; dynamic input is validated at runtime. The result contains
|
|
103
|
+
raw stdout, stderr, and exit status. See the [API design and pinned baselines](docs/design/typed-command-api.md)
|
|
104
|
+
and [coverage ledger](docs/design/command-coverage.md) for the currently registered scopes and remaining audit work.
|
|
105
|
+
|
|
90
106
|
### Advanced Usage
|
|
91
107
|
|
|
92
108
|
For more control over adapters, you can use the factory function:
|
|
@@ -112,11 +128,10 @@ const git = await TypeGit.create();
|
|
|
112
128
|
// Clone a repository with progress tracking
|
|
113
129
|
const repo = await git.clone('https://github.com/user/repo.git', '/path/to/clone', {
|
|
114
130
|
onProgress: (progress) => {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
131
|
+
console.log(`${progress.phase}: ${progress.message}`);
|
|
132
|
+
},
|
|
133
|
+
onLfsProgress: (progress) => {
|
|
134
|
+
console.log(`LFS ${progress.direction}: ${progress.bytesSoFar}/${progress.bytesTotal}`);
|
|
120
135
|
},
|
|
121
136
|
});
|
|
122
137
|
|
|
@@ -192,24 +207,29 @@ src/
|
|
|
192
207
|
│ ├── node/ # Node.js adapter
|
|
193
208
|
│ ├── bun/ # Bun adapter
|
|
194
209
|
│ └── deno/ # Deno adapter
|
|
195
|
-
├──
|
|
196
|
-
├──
|
|
197
|
-
├──
|
|
198
|
-
|
|
210
|
+
├── constraints/ # Declarative Git rules, type projection, and finite-domain exploration
|
|
211
|
+
├── impl/ # Git and repository operations
|
|
212
|
+
├── runner/ # Command execution, progress, and errors
|
|
213
|
+
├── parsers/ # Machine-output parsers
|
|
214
|
+
└── internal/ # Shared clients, transport, config, and LFS helpers
|
|
199
215
|
```
|
|
200
216
|
|
|
201
217
|
## Development Status
|
|
202
218
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
219
|
+
0.4.0 strengthens typed output contracts and rejects conflicting options before execution.
|
|
220
|
+
See the [migration guide](docs/migrations/0.4.0.md) for breaking changes and API boundaries.
|
|
221
|
+
The public API is still evolving; pin an exact version for controlled upgrades.
|
|
222
|
+
Some flags require newer Git versions; LFS JSON queries require a compatible Git LFS installation.
|
|
223
|
+
|
|
224
|
+
Option restrictions are maintained in an [evidence-backed constraint model](docs/design/option-constraints.md).
|
|
225
|
+
Git restrictions and typed API exceptions are listed separately. Clone has generated finite-domain
|
|
226
|
+
compiler tests and independent Git conformance tests; this does not claim exhaustive Git coverage.
|
|
207
227
|
|
|
208
228
|
### Validation scope
|
|
209
229
|
|
|
210
230
|
- **Node.js**: Unit and real-Git integration tests run in CI on Linux and Windows
|
|
211
231
|
with Node.js 20, 22, and 24. A separate job checks legacy Git 2.25 compatibility.
|
|
212
|
-
- **Bun and Deno**: Adapter and
|
|
232
|
+
- **Bun and Deno**: Adapter smoke tests and a shared repository contract suite run on Linux.
|
|
213
233
|
Their test coverage is narrower than Node.js; cross-runtime behavior still needs
|
|
214
234
|
more real-application feedback.
|
|
215
235
|
- **Package distribution**: CI installs the npm tarball and checks ESM, CommonJS,
|