git-chopstick-core 0.1.5 → 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 ADDED
@@ -0,0 +1,138 @@
1
+ # Changelog
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
+
10
+ ## [0.1.6] — 2026-06-13
11
+
12
+ ### Fixed
13
+ - **CHANGELOG.md included in package**: Added `CHANGELOG.md` to the `files` array in `package.json` so consumers can read release notes from the installed package.
14
+
15
+ ---
16
+
17
+ ## [0.1.5] — 2026-06-13
18
+
19
+ ### Added
20
+ - **Progress reporting**: Real `parse()` methods on all progress parsers (Checkout, Fetch, Pull, Push, Clone). Progress callbacks now receive percentage updates during long-running operations.
21
+ - **`getCurrentBranch(path)`**: New helper in `rev-parse.ts` that returns the current branch name or `undefined` for detached HEAD.
22
+ - **Integration tests**: 10 tests covering repository type detection, branch lookup, status parsing, commit history, branch CRUD, createCommit, and non-repo error handling. Run with `npm test`.
23
+ - **Migration guide**: Added `docs/exec-to-git-migration.md` documenting the transition from `exec()` to `git()` with before/after examples.
24
+
25
+ ### Changed
26
+ - **`exec()` removed from public API**: `exec()` is now an internal function used only by `core.ts`. Use `git()` instead — it's a strict superset with error handling, typed error codes, `successExitCodes`, and hook support.
27
+ - **README**: Updated architecture diagram (progress 🟢), consumption patterns (no `exec`), known limitations (progress now real, tests now exist).
28
+
29
+ ### Fixed
30
+ - **RevertProgressParser**: Now returns proper `IGitOutput | null` type.
31
+
32
+ ---
33
+
34
+ ## [0.1.4] — 2026-06-13
35
+
36
+ ### Added
37
+ - **Public exec API**: Exported `exec`, `spawnGit`, `parseError`, `parseBadConfigValueErrorInfo`, `ExecError` from the git barrel for low-level Git execution.
38
+ - **Repository.id default**: `Repository` constructor `id` parameter now defaults to `0` — no longer requires a placeholder value.
39
+ - **Consumption patterns**: Documented 4 import patterns in README: root barrel, git subpath, models only, and granular subpath imports.
40
+ - **Status section**: Added pre-1.0 status note with TypeScript 5.7+ compatibility to README.
41
+
42
+ ### Changed
43
+ - **TypeScript strictness**: Enabled `noUnusedLocals` and `noUnusedParameters` in `tsconfig.json` to catch dead code. Fixed 5 newly detected unused variables.
44
+ - **prepublishOnly**: Now runs `npm run typecheck && npm run build` to prevent shipping type-broken packages.
45
+ - **README**: Removed stale "Not Published on npm" section (package is published).
46
+
47
+ ### Fixed
48
+ - **Unused variables**: Fixed 5 TS6133 errors caught by new strict settings in `apply.ts`, `environment.ts`, `gitignore.ts`, `progress/revert.ts`.
49
+
50
+ ---
51
+
52
+ ## [0.1.3] — 2026-06-13
53
+
54
+ ### Changed
55
+ - **Build pipeline**: Added `clean` script; `build` now runs `npm run clean && tsc` for deterministic fresh builds.
56
+ - **Exports**: Switched `exports` map from raw `./src/*.ts` to compiled `./dist/*.js` / `./dist/*.d.ts` with explicit directory barrel entries.
57
+ - **Package files**: Reduced npm package size to only `dist/` (removed `src/` from `files`).
58
+ - **Peer dependencies**: Moved `@types/node` and `@types/byline` from `dependencies`/`devDependencies` to optional `peerDependencies` to avoid version conflicts with consumers.
59
+ - **`.npmignore`**: Added as safety net alongside `"files": ["dist"]`.
60
+
61
+ ### Fixed
62
+ - **TypeScript compilation**: Resolved 10 TS6133 errors (unused variables) across `fatal-error.ts`, `progress/`, and `status-parser.ts`.
63
+ - **Missing type declarations**: Added `@types/byline` to fix TS7016.
64
+ - **Buffer type mismatch**: Fixed TS2345 in `exec.ts` for `Buffer.concat()` compatibility with newer `@types/node`.
65
+
66
+ ### Cleanup
67
+ - **Removed GitHub Desktop branding**: Renamed Desktop-branded symbols in `stash.ts` (`DesktopStashEntryMarker` → `StashEntryMarker`, etc.). Stripped 13 unused feature flags. Updated comments in 9 source files.
68
+
69
+ ### Documentation
70
+ - **README**: Added Known Limitations section, full API reference table, error handling guide, updated architecture diagram.
71
+ - **Examples**: Created `examples/branch-operations.ts` and `examples/create-commit.ts`. Updated imports to use `'../src/index.js'`.
72
+ - **CHANGELOG.md**: Created with full version history since 0.1.0.
73
+
74
+ ---
75
+
76
+ ## [0.1.2] — 2026-06-13
77
+
78
+ ### Added
79
+ - **Public API expansion**: `src/index.ts` now exports all 40+ git operations and all domain models through barrel files.
80
+ - **New barrel file**: `src/models/index.ts` with explicit type-only re-exports (handles naming conflicts like `ComputedAction` and `SubmoduleStatus`).
81
+ - **Missing git operations**: Added `add`, `cherry-pick`, `clean`, `lfs`, `merge-tree`, `reorder`, `squash`, `stage`, `stash`, `update-index`, `worktree-include` to the git barrel.
82
+ - **Documentation**: Rewrote README with full API reference, usage examples, and architecture docs.
83
+ - **Examples**: Added branch operations and commit creation examples.
84
+
85
+ ### Changed
86
+ - **ESM imports**: Added `.js` extensions to all 150+ relative imports across 71 source files for full Node.js ESM compatibility.
87
+ - **Git barrel** (`src/git/index.ts`): Expanded from 35 to 46 module exports with `.js` extensions.
88
+
89
+ ### Fixed
90
+ - **Runtime crash**: Fixed `localStorage.getItem('git-trace')` → `process.env.GIT_TRACE ?? '0'` in `authentication.ts` which was blocking all remote operations (push, pull, fetch, clone) in Node.js/Bun.
91
+
92
+ ### Build
93
+ - **tsconfig.json**: Added `outDir: "dist"` and `rootDir: "src"` settings.
94
+ - **package.json**: Added deep import paths via `"./*"` export pattern, `types` field, and build/prepublish scripts.
95
+
96
+ ---
97
+
98
+ ## [0.1.1] — 2026-06-07
99
+
100
+ ### Added
101
+ - Initial public release extracted from GitHub Desktop.
102
+ - Git operations: status, commit, log, branch, merge, rebase, push, pull, fetch, stash, cherry-pick, reset, diff, and more.
103
+ - Domain models: Repository, Commit, Branch, Status, Diff, StashEntry, Merge, Rebase, and more.
104
+ - Authentication support for HTTPS and SSH.
105
+ - LFS support stubs.
106
+ - Proxy resolution.
107
+ - Submodule support.
108
+
109
+ ### Notes
110
+ - This is a fork of [desktop/desktop](https://github.com/desktop/desktop)'s Git backend, extracted and adapted as a standalone library.
111
+ - Several subsystems are stubbed: progress callbacks, hook interception, and the LFS trampoline environment.
112
+
113
+ ---
114
+
115
+ ## [0.1.0] — 2026-06-07
116
+
117
+ ### Added
118
+ - Initial setup: package scaffolding, tsconfig, and project structure.
119
+ - Core Git execution layer (`git/exec.ts`, `git/core.ts`, `git/spawn.ts`).
120
+ - Authentication, proxy resolution, and environment helpers.
121
+ - MIT license.
122
+
123
+ ---
124
+
125
+ [0.1.4]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.4
126
+ [0.1.3]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.3
127
+ [0.1.2]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.2
128
+ [0.1.1]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.1
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
131
+ [0.1.6]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.6
132
+ [0.1.5]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.5
133
+ [0.1.4]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.4
134
+ [0.1.3]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.3
135
+ [0.1.2]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.2
136
+ [0.1.1]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.1
137
+ [0.1.0]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.0
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.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -31,7 +31,9 @@
31
31
  }
32
32
  },
33
33
  "files": [
34
- "dist"
34
+ "dist",
35
+ "CHANGELOG.md",
36
+ "docs"
35
37
  ],
36
38
  "description": "Git backend library extracted from GitHub Desktop",
37
39
  "scripts": {