git-chopstick-core 0.1.6 → 0.1.7

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.7] — 2026-06-13
4
+
5
+ ### Added
6
+ - **Documentation included in package**: Added `docs/` to the `files` array in `package.json`. The migration guide (`docs/exec-to-git-migration.md`) and release skill (`docs/skills/release.md`) now ship with the installed package.
7
+
8
+ ---
9
+
3
10
  ## [0.1.6] — 2026-06-13
4
11
 
5
12
  ### Fixed
@@ -120,6 +127,7 @@
120
127
  [0.1.2]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.2
121
128
  [0.1.1]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.1
122
129
  [0.1.0]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.0
130
+ [0.1.7]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.7
123
131
  [0.1.6]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.6
124
132
  [0.1.5]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.5
125
133
  [0.1.4]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.4
@@ -127,4 +135,4 @@
127
135
  [0.1.2]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.2
128
136
  [0.1.1]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.1
129
137
  [0.1.0]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.0
130
- [Unreleased]: https://github.com/parkiyong/git-chopstick-core/compare/v0.1.5...HEAD
138
+ [Unreleased]: https://github.com/parkiyong/git-chopstick-core/compare/v0.1.7...HEAD
@@ -0,0 +1,75 @@
1
+ # Migration Guide: `exec` → `git()`
2
+
3
+ > **Applies to:** Upgrading from `git-chopstick-core@0.1.4` to `0.1.5+`
4
+
5
+ In v0.1.4, `exec()` was briefly exposed as a public function. Starting in **v0.1.5**, `exec()` is no longer part of the public API — `git()` is the single function for running Git commands.
6
+
7
+ ## Why?
8
+
9
+ `exec()` and `git()` did the same thing with different semantics:
10
+
11
+ | Aspect | `exec()` | `git()` |
12
+ |--------|----------|---------|
13
+ | `successExitCodes` | ❌ No — raw exit code | ✅ Yes — configurable set |
14
+ | Error parsing | ❌ No | ✅ Yes — 50-code `GitError` enum |
15
+ | Throws on bad exit | ❌ No — returns raw result | ✅ Yes — throws `GitError` |
16
+ | Hook interception | ❌ No | ✅ Yes — `interceptHooks` option |
17
+ | Buffer output | ✅ Yes — `encoding: 'buffer'` | ✅ Yes — `{ encoding: 'buffer' }` |
18
+
19
+ `git()` does everything `exec()` did, plus error handling, typed error codes, and hook support. Maintaining both was confusing.
20
+
21
+ ## Before → After
22
+
23
+ ### Raw git execution (basic)
24
+
25
+ ```typescript
26
+ // Before (v0.1.4)
27
+ import { exec } from 'git-chopstick-core/git'
28
+ const result = await exec(['rev-parse', '--show-toplevel'], '/path/to/repo')
29
+
30
+ // After (v0.1.5+)
31
+ import { git } from 'git-chopstick-core'
32
+ const result = await git(['rev-parse', '--show-toplevel'], '/path/to/repo', 'my-op')
33
+ ```
34
+
35
+ ### Buffer output (binary diffs)
36
+
37
+ ```typescript
38
+ // Before
39
+ import { exec } from 'git-chopstick-core/git'
40
+ const result = await exec(['diff', '--binary', sha], path, { encoding: 'buffer' })
41
+
42
+ // After
43
+ import { git } from 'git-chopstick-core'
44
+ const result = await git(['diff', '--binary', sha], path, 'my-op', { encoding: 'buffer' })
45
+ ```
46
+
47
+ ### Ignoring non-zero exit codes
48
+
49
+ ```typescript
50
+ // Before — exec doesn't filter, so you check exitCode manually
51
+ const result = await exec(['symbolic-ref', '--short', 'HEAD'], path)
52
+ const branch = result.exitCode === 0 ? result.stdout.toString().trim() : undefined
53
+
54
+ // After — git() accepts successExitCodes, returns result or throws
55
+ const result = await git(['symbolic-ref', '--short', 'HEAD'], path, 'getBranch', {
56
+ successExitCodes: new Set([0, 128]),
57
+ })
58
+ const branch = result.exitCode === 0 ? result.stdout.trim() : undefined
59
+
60
+ // Or just use the built-in helper:
61
+ import { getCurrentBranch } from 'git-chopstick-core'
62
+ const branch = await getCurrentBranch(path)
63
+ ```
64
+
65
+ ## What stayed public?
66
+
67
+ The following from `exec.ts` remain in the public API because they serve different purposes:
68
+
69
+ | Export | Purpose |
70
+ |--------|---------|
71
+ | `spawnGit(args, path, options?)` | Returns a `ChildProcess` for streaming git access — useful for long-running operations where you want direct process control |
72
+ | `parseError(stderr)` | Parse git stderr into a `GitError` enum value for manual error inspection |
73
+ | `parseBadConfigValueErrorInfo(stderr)` | Extract key/value from bad config value errors |
74
+ | `ExecError` (class) | Error thrown when maxBuffer is exceeded |
75
+ | `GitError` (enum) | 50+ typed error codes (available as `GitErrorCodes` from root barrel) |
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: release
3
+ description: Automated release workflow for git-chopstick-core — version bump, changelog, build, validation, and npm publish.
4
+ ---
5
+
6
+ # Release: git-chopstick-core
7
+
8
+ > Loaded via `skill("release")`. Run this whenever you need to publish a new release.
9
+
10
+ ## Process
11
+
12
+ ### 1. Read current state
13
+
14
+ Read `package.json`, `CHANGELOG.md`, and run `git log --oneline -5` to understand what has changed since the last release.
15
+
16
+ ### 2. Determine version bump
17
+
18
+ Check what has changed:
19
+
20
+ - **Breaking API changes** (removed exports, changed signatures) → minor bump (0.x.0)
21
+ - **New features** (new functions, new exports) → patch bump (0.0.x)
22
+ - **Bug fixes, docs, internal refactoring** → patch bump (0.0.x)
23
+
24
+ Current version: read from `package.json`. Bump accordingly.
25
+
26
+ ### 3. Update `CHANGELOG.md`
27
+
28
+ Insert a new `## [VERSION] — YYYY-MM-DD` section at the top (below the `# Changelog` heading) with:
29
+
30
+ - `### Added` — new features, exports, helpers
31
+ - `### Changed` — behavioral changes, renames, config changes
32
+ - `### Fixed` — bug fixes
33
+
34
+ Then update the link references at the bottom:
35
+
36
+ - Add `[VERSION]: https://github.com/parkiyong/git-chopstick-core/releases/tag/vVERSION`
37
+ - Update `[Unreleased]: .../compare/vVERSION...HEAD`
38
+
39
+ ### 4. Bump `package.json`
40
+
41
+ Update `"version"` field.
42
+
43
+ ### 5. Build and validate
44
+
45
+ Run all of these (use parallel agents):
46
+
47
+ - `npm run typecheck` — must pass with zero errors
48
+ - `npm run build` — must produce a clean `dist/`
49
+ - `npm test` — all integration tests must pass
50
+ - `npm pack --dry-run` — confirm all of:
51
+ - `dist/` is included (expect ~351 files, ~700kB)
52
+ - `CHANGELOG.md` and `docs/` appear in the file list
53
+ - `package.json`, `README.md`, `LICENSE` are present (npm includes these automatically)
54
+ - No unexpected files are leaking through (check for test artifacts, `.ts` sources outside `dist/`)
55
+
56
+ If any fail, fix before proceeding.
57
+
58
+ ### 6. Stage and commit
59
+
60
+ ```
61
+ git add -A
62
+ git commit -m "vVERSION: <short summary of changes>"
63
+ ```
64
+
65
+ ### 7. Push and publish
66
+
67
+ ```
68
+ git push origin main
69
+ npm publish
70
+ ```
71
+
72
+ ### 8. Verify
73
+
74
+ - Confirm npm shows the new version: `npm view git-chopstick-core version`
75
+ - Confirm the tag exists on GitHub: `git tag -l`
76
+ - Suggest followup tasks
77
+
78
+ ## Notes
79
+
80
+ - `prepublishOnly` runs `npm run typecheck && npm run build` automatically, so no need to build before publish — but validate first anyway.
81
+ - If this is the first release in a session, run `setup-matt-pocock-skills` first to configure issue tracker context.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-chopstick-core",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -32,7 +32,8 @@
32
32
  },
33
33
  "files": [
34
34
  "dist",
35
- "CHANGELOG.md"
35
+ "CHANGELOG.md",
36
+ "docs"
36
37
  ],
37
38
  "description": "Git backend library extracted from GitHub Desktop",
38
39
  "scripts": {