type-git 0.5.0 → 0.7.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 +27 -7
- package/dist/adapters/bun/index.cjs +82 -13348
- package/dist/adapters/bun/index.d.cts +7 -1
- package/dist/adapters/bun/index.d.ts +7 -1
- package/dist/adapters/bun/index.js +49 -13275
- package/dist/adapters/deno/index.cjs +76 -13344
- package/dist/adapters/deno/index.d.cts +7 -1
- package/dist/adapters/deno/index.d.ts +7 -1
- package/dist/adapters/deno/index.js +44 -13272
- package/dist/adapters/node/index.cjs +5 -13617
- package/dist/adapters/node/index.d.cts +44 -6
- package/dist/adapters/node/index.d.ts +44 -6
- package/dist/adapters/node/index.js +8 -13580
- package/dist/chunk-5NI3KM5Z.js +4822 -0
- package/dist/chunk-IAJF67MB.js +392 -0
- package/dist/chunk-MFY7MGIJ.cjs +4822 -0
- package/dist/chunk-NBX6BNQF.cjs +5588 -0
- package/dist/chunk-X3F6MDXQ.cjs +392 -0
- package/dist/chunk-YIWTIIXH.js +5588 -0
- package/dist/client.d-Cs32YZX6.d.ts +566 -0
- package/dist/client.d-PRQCR2_T.d.cts +566 -0
- package/dist/{client-KHa1WMIH.d.cts → git.d-DrhCzWEn.d.cts} +4541 -6876
- package/dist/index.cjs +42 -13717
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +38 -13649
- package/dist/strict/index.cjs +2919 -0
- package/dist/strict/index.d.cts +134022 -0
- package/dist/strict/index.d.ts +1 -0
- package/dist/strict/index.js +2919 -0
- package/docs/adapters.md +168 -0
- package/docs/migrations/0.7.0.md +152 -0
- package/package.json +58 -21
- 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-KHa1WMIH.d.ts +0 -12041
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -89,19 +89,35 @@ import { TypeGit } from 'type-git/node';
|
|
|
89
89
|
const git = await TypeGit.create({ useLegacyVersion: true });
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
### Typed CLI commands
|
|
92
|
+
### Typed CLI commands (`type-git/strict`)
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
For registered CLI operations without a parsed convenience method, import `strict` from
|
|
95
|
+
`type-git/strict`. It wraps a client or repository and adds a grammar-checked `command()`:
|
|
95
96
|
|
|
96
97
|
```typescript
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
import { strict } from 'type-git/strict';
|
|
99
|
+
|
|
100
|
+
const strictGit = strict(git);
|
|
101
|
+
const hash = await strictGit.command('hash-object', [['--stdin']], { stdin: 'hello' });
|
|
102
|
+
|
|
103
|
+
const strictRepo = strict(repo);
|
|
104
|
+
await strictRepo.command('remote add', [{ operand: 'origin' }, { operand: '/path/to/upstream' }]);
|
|
105
|
+
await strictRepo.status(); // every other method is still available
|
|
99
106
|
```
|
|
100
107
|
|
|
101
108
|
Option tuples and operand objects retain ordering and repeated flags. Literal combinations are
|
|
102
|
-
checked against
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
checked against Git's option grammar at compile time; dynamic input is validated at runtime,
|
|
110
|
+
including probes of the selected Git executable where its parser behavior differs between
|
|
111
|
+
builds. The result contains raw stdout, stderr, and exit status. See the
|
|
112
|
+
[API design and pinned baselines](docs/design/typed-command-api.md) and
|
|
113
|
+
[coverage ledger](docs/design/command-coverage.md) for the registered scopes and remaining audit
|
|
114
|
+
work.
|
|
115
|
+
|
|
116
|
+
The grammar catalogue is large, so it lives only in `type-git/strict`. The main entry point
|
|
117
|
+
(`type-git`, `type-git/node`, `type-git/bun`, `type-git/deno`) keeps `raw()`, the high-level API,
|
|
118
|
+
and the runtime checks against argument injection, and neither its bundle nor its type
|
|
119
|
+
declarations include the catalogue. For an application that only calls high-level methods such
|
|
120
|
+
as `repo.status()`, the bundled size is about 180 KB minified instead of about 1.6 MB.
|
|
105
121
|
|
|
106
122
|
### Advanced Usage
|
|
107
123
|
|
|
@@ -118,6 +134,10 @@ const git = await createGit({
|
|
|
118
134
|
});
|
|
119
135
|
```
|
|
120
136
|
|
|
137
|
+
On Windows, pass `{ windowsHide: true }` to `TypeGit.create()` or `createNodeAdapters()` to keep
|
|
138
|
+
Git from opening console windows. To write your own `ExecAdapter` (for example one that only
|
|
139
|
+
allows specific invocations), see the [adapter contract](docs/adapters.md).
|
|
140
|
+
|
|
121
141
|
### Full Example
|
|
122
142
|
|
|
123
143
|
```typescript
|