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 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
- (To be honest, I wrote the entire code with Claude Code. But it works appropriately.)
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 (and optionally libgit2) with a focus on:
24
+ This library wraps Git CLI with a focus on:
23
25
 
24
- 1. **Output Contract Safety**: Typed APIs only expose operations where stdout format is guaranteed
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@beta
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
- if (progress.kind === 'git') {
116
- console.log(`${progress.phase}: ${progress.message}`);
117
- } else if (progress.kind === 'lfs') {
118
- console.log(`LFS ${progress.direction}: ${progress.bytesSoFar}/${progress.bytesTotal}`);
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
- ├── cli/ # CLI command builders
196
- ├── lfs/ # LFS-specific logic
197
- ├── parsers/ # Output parsers
198
- └── utils/ # Utilities
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
- type-git 0.3.0 is in **beta** and ready for evaluation in real applications. The
204
- public API is taking shape, but compatibility is not yet guaranteed. Breaking
205
- changes during beta will be documented in the changelog; pin an exact version if
206
- your application needs controlled upgrades. Install with `npm install type-git@beta`.
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 basic repository-operation smoke tests run on Linux.
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,