type-git 0.4.0 → 0.6.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 +24 -1
- package/dist/adapters/bun/index.cjs +81 -6493
- package/dist/adapters/bun/index.d.cts +6 -1
- package/dist/adapters/bun/index.d.ts +6 -1
- package/dist/adapters/bun/index.js +48 -6420
- package/dist/adapters/deno/index.cjs +75 -6489
- package/dist/adapters/deno/index.d.cts +6 -1
- package/dist/adapters/deno/index.d.ts +6 -1
- package/dist/adapters/deno/index.js +43 -6417
- package/dist/adapters/node/index.cjs +4 -6762
- package/dist/adapters/node/index.d.cts +43 -6
- package/dist/adapters/node/index.d.ts +43 -6
- package/dist/adapters/node/index.js +7 -6725
- package/dist/chunk-BRFWPLJ7.cjs +13025 -0
- package/dist/chunk-DDWWKTAE.cjs +392 -0
- package/dist/chunk-FHV2WOQG.js +392 -0
- package/dist/chunk-IYOGHATP.js +13025 -0
- package/dist/client.d-D9Lqi1a2.d.cts +140336 -0
- package/dist/index.cjs +42 -6868
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +32 -6794
- package/docs/adapters.md +168 -0
- package/package.json +48 -18
- package/dist/adapters/bun/index.cjs.map +0 -1
- package/dist/adapters/bun/index.js.map +0 -1
- package/dist/adapters/deno/index.cjs.map +0 -1
- package/dist/adapters/deno/index.js.map +0 -1
- package/dist/adapters/node/index.cjs.map +0 -1
- package/dist/adapters/node/index.js.map +0 -1
- package/dist/client-DAAbUvgo.d.cts +0 -5291
- package/dist/client-DAAbUvgo.d.ts +0 -5291
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Typed inputs are checked against supported output contracts, with runtime valida
|
|
|
23
23
|
|
|
24
24
|
This library wraps Git CLI with a focus on:
|
|
25
25
|
|
|
26
|
-
1. **Output Contract Safety**:
|
|
26
|
+
1. **Output Contract Safety**: Parsed convenience APIs expose operations with stable stdout formats; typed CLI access returns raw output
|
|
27
27
|
2. **Repository Context**: Separates `Git` (non-repo operations) from `Repo` (repo operations)
|
|
28
28
|
3. **Worktree vs Bare**: Type-safe distinction between worktree and bare repositories
|
|
29
29
|
4. **Raw Escape Hatch**: Arbitrary git commands via `raw()` when needed
|
|
@@ -89,6 +89,20 @@ import { TypeGit } from 'type-git/node';
|
|
|
89
89
|
const git = await TypeGit.create({ useLegacyVersion: true });
|
|
90
90
|
```
|
|
91
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
|
+
|
|
92
106
|
### Advanced Usage
|
|
93
107
|
|
|
94
108
|
For more control over adapters, you can use the factory function:
|
|
@@ -104,6 +118,10 @@ const git = await createGit({
|
|
|
104
118
|
});
|
|
105
119
|
```
|
|
106
120
|
|
|
121
|
+
On Windows, pass `{ windowsHide: true }` to `TypeGit.create()` or `createNodeAdapters()` to keep
|
|
122
|
+
Git from opening console windows. To write your own `ExecAdapter` (for example one that only
|
|
123
|
+
allows specific invocations), see the [adapter contract](docs/adapters.md).
|
|
124
|
+
|
|
107
125
|
### Full Example
|
|
108
126
|
|
|
109
127
|
```typescript
|
|
@@ -193,6 +211,7 @@ src/
|
|
|
193
211
|
│ ├── node/ # Node.js adapter
|
|
194
212
|
│ ├── bun/ # Bun adapter
|
|
195
213
|
│ └── deno/ # Deno adapter
|
|
214
|
+
├── constraints/ # Declarative Git rules, type projection, and finite-domain exploration
|
|
196
215
|
├── impl/ # Git and repository operations
|
|
197
216
|
├── runner/ # Command execution, progress, and errors
|
|
198
217
|
├── parsers/ # Machine-output parsers
|
|
@@ -206,6 +225,10 @@ See the [migration guide](docs/migrations/0.4.0.md) for breaking changes and API
|
|
|
206
225
|
The public API is still evolving; pin an exact version for controlled upgrades.
|
|
207
226
|
Some flags require newer Git versions; LFS JSON queries require a compatible Git LFS installation.
|
|
208
227
|
|
|
228
|
+
Option restrictions are maintained in an [evidence-backed constraint model](docs/design/option-constraints.md).
|
|
229
|
+
Git restrictions and typed API exceptions are listed separately. Clone has generated finite-domain
|
|
230
|
+
compiler tests and independent Git conformance tests; this does not claim exhaustive Git coverage.
|
|
231
|
+
|
|
209
232
|
### Validation scope
|
|
210
233
|
|
|
211
234
|
- **Node.js**: Unit and real-Git integration tests run in CI on Linux and Windows
|