git-chopstick-core 0.1.4 → 0.1.6

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,130 @@
1
+ # Changelog
2
+
3
+ ## [0.1.6] — 2026-06-13
4
+
5
+ ### Fixed
6
+ - **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.
7
+
8
+ ---
9
+
10
+ ## [0.1.5] — 2026-06-13
11
+
12
+ ### Added
13
+ - **Progress reporting**: Real `parse()` methods on all progress parsers (Checkout, Fetch, Pull, Push, Clone). Progress callbacks now receive percentage updates during long-running operations.
14
+ - **`getCurrentBranch(path)`**: New helper in `rev-parse.ts` that returns the current branch name or `undefined` for detached HEAD.
15
+ - **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`.
16
+ - **Migration guide**: Added `docs/exec-to-git-migration.md` documenting the transition from `exec()` to `git()` with before/after examples.
17
+
18
+ ### Changed
19
+ - **`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.
20
+ - **README**: Updated architecture diagram (progress 🟢), consumption patterns (no `exec`), known limitations (progress now real, tests now exist).
21
+
22
+ ### Fixed
23
+ - **RevertProgressParser**: Now returns proper `IGitOutput | null` type.
24
+
25
+ ---
26
+
27
+ ## [0.1.4] — 2026-06-13
28
+
29
+ ### Added
30
+ - **Public exec API**: Exported `exec`, `spawnGit`, `parseError`, `parseBadConfigValueErrorInfo`, `ExecError` from the git barrel for low-level Git execution.
31
+ - **Repository.id default**: `Repository` constructor `id` parameter now defaults to `0` — no longer requires a placeholder value.
32
+ - **Consumption patterns**: Documented 4 import patterns in README: root barrel, git subpath, models only, and granular subpath imports.
33
+ - **Status section**: Added pre-1.0 status note with TypeScript 5.7+ compatibility to README.
34
+
35
+ ### Changed
36
+ - **TypeScript strictness**: Enabled `noUnusedLocals` and `noUnusedParameters` in `tsconfig.json` to catch dead code. Fixed 5 newly detected unused variables.
37
+ - **prepublishOnly**: Now runs `npm run typecheck && npm run build` to prevent shipping type-broken packages.
38
+ - **README**: Removed stale "Not Published on npm" section (package is published).
39
+
40
+ ### Fixed
41
+ - **Unused variables**: Fixed 5 TS6133 errors caught by new strict settings in `apply.ts`, `environment.ts`, `gitignore.ts`, `progress/revert.ts`.
42
+
43
+ ---
44
+
45
+ ## [0.1.3] — 2026-06-13
46
+
47
+ ### Changed
48
+ - **Build pipeline**: Added `clean` script; `build` now runs `npm run clean && tsc` for deterministic fresh builds.
49
+ - **Exports**: Switched `exports` map from raw `./src/*.ts` to compiled `./dist/*.js` / `./dist/*.d.ts` with explicit directory barrel entries.
50
+ - **Package files**: Reduced npm package size to only `dist/` (removed `src/` from `files`).
51
+ - **Peer dependencies**: Moved `@types/node` and `@types/byline` from `dependencies`/`devDependencies` to optional `peerDependencies` to avoid version conflicts with consumers.
52
+ - **`.npmignore`**: Added as safety net alongside `"files": ["dist"]`.
53
+
54
+ ### Fixed
55
+ - **TypeScript compilation**: Resolved 10 TS6133 errors (unused variables) across `fatal-error.ts`, `progress/`, and `status-parser.ts`.
56
+ - **Missing type declarations**: Added `@types/byline` to fix TS7016.
57
+ - **Buffer type mismatch**: Fixed TS2345 in `exec.ts` for `Buffer.concat()` compatibility with newer `@types/node`.
58
+
59
+ ### Cleanup
60
+ - **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.
61
+
62
+ ### Documentation
63
+ - **README**: Added Known Limitations section, full API reference table, error handling guide, updated architecture diagram.
64
+ - **Examples**: Created `examples/branch-operations.ts` and `examples/create-commit.ts`. Updated imports to use `'../src/index.js'`.
65
+ - **CHANGELOG.md**: Created with full version history since 0.1.0.
66
+
67
+ ---
68
+
69
+ ## [0.1.2] — 2026-06-13
70
+
71
+ ### Added
72
+ - **Public API expansion**: `src/index.ts` now exports all 40+ git operations and all domain models through barrel files.
73
+ - **New barrel file**: `src/models/index.ts` with explicit type-only re-exports (handles naming conflicts like `ComputedAction` and `SubmoduleStatus`).
74
+ - **Missing git operations**: Added `add`, `cherry-pick`, `clean`, `lfs`, `merge-tree`, `reorder`, `squash`, `stage`, `stash`, `update-index`, `worktree-include` to the git barrel.
75
+ - **Documentation**: Rewrote README with full API reference, usage examples, and architecture docs.
76
+ - **Examples**: Added branch operations and commit creation examples.
77
+
78
+ ### Changed
79
+ - **ESM imports**: Added `.js` extensions to all 150+ relative imports across 71 source files for full Node.js ESM compatibility.
80
+ - **Git barrel** (`src/git/index.ts`): Expanded from 35 to 46 module exports with `.js` extensions.
81
+
82
+ ### Fixed
83
+ - **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.
84
+
85
+ ### Build
86
+ - **tsconfig.json**: Added `outDir: "dist"` and `rootDir: "src"` settings.
87
+ - **package.json**: Added deep import paths via `"./*"` export pattern, `types` field, and build/prepublish scripts.
88
+
89
+ ---
90
+
91
+ ## [0.1.1] — 2026-06-07
92
+
93
+ ### Added
94
+ - Initial public release extracted from GitHub Desktop.
95
+ - Git operations: status, commit, log, branch, merge, rebase, push, pull, fetch, stash, cherry-pick, reset, diff, and more.
96
+ - Domain models: Repository, Commit, Branch, Status, Diff, StashEntry, Merge, Rebase, and more.
97
+ - Authentication support for HTTPS and SSH.
98
+ - LFS support stubs.
99
+ - Proxy resolution.
100
+ - Submodule support.
101
+
102
+ ### Notes
103
+ - This is a fork of [desktop/desktop](https://github.com/desktop/desktop)'s Git backend, extracted and adapted as a standalone library.
104
+ - Several subsystems are stubbed: progress callbacks, hook interception, and the LFS trampoline environment.
105
+
106
+ ---
107
+
108
+ ## [0.1.0] — 2026-06-07
109
+
110
+ ### Added
111
+ - Initial setup: package scaffolding, tsconfig, and project structure.
112
+ - Core Git execution layer (`git/exec.ts`, `git/core.ts`, `git/spawn.ts`).
113
+ - Authentication, proxy resolution, and environment helpers.
114
+ - MIT license.
115
+
116
+ ---
117
+
118
+ [0.1.4]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.4
119
+ [0.1.3]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.3
120
+ [0.1.2]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.2
121
+ [0.1.1]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.1
122
+ [0.1.0]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.0
123
+ [0.1.6]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.6
124
+ [0.1.5]: https://github.com/parkiyong/git-chopstick-core/releases/tag/v0.1.5
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
+ [Unreleased]: https://github.com/parkiyong/git-chopstick-core/compare/v0.1.5...HEAD
package/README.md CHANGED
@@ -233,7 +233,7 @@ try {
233
233
  | `reset` | `reset`, `resetPaths`, `unstageAll` | Reset operations |
234
234
  | `revert` | `revertCommit` | Revert a commit |
235
235
  | `rev-list` | `getAheadBehind`, `getBranchAheadBehind`, `revRange`, `revSymmetricDifference` | Commit range queries |
236
- | `rev-parse` | `getRepositoryType`, `getUpstreamRefForRef`, `getCurrentUpstreamRef` | Rev parsing |
236
+ | `rev-parse` | `getRepositoryType`, `getCurrentBranch`, `getUpstreamRefForRef`, `getCurrentUpstreamRef` | Rev parsing / branch detection |
237
237
  | `rm` | `removeConflictedFile` | Remove files |
238
238
  | `squash` | `squash` | Interactive rebase squashing |
239
239
  | `stage` | `stageManualConflictResolution`, `stageResolvedConflictFiles` | Stage conflict resolutions |
@@ -279,12 +279,11 @@ try {
279
279
 
280
280
  This library is extracted directly from [GitHub Desktop](https://github.com/desktop/desktop), a mature Electron application. Some subsystems that depend on GitHub Desktop's specific runtime environment have been extracted as **stubs** — they compile and type-check correctly but don't provide real functionality:
281
281
 
282
- ### 🟡 Progress Reporting (`src/lib/progress/`)
282
+ ### 🟢 Progress Reporting (`src/lib/progress/`)
283
283
 
284
- The progress parsers (`CheckoutProgressParser`, `FetchProgressParser`, `PullProgressParser`, `PushProgressParser`, `CloneProgressParser`, `RevertProgressParser`) are **stubbed**. Their `parse()` methods always return `null`, and `executionOptionsWithProgress` passes options through unchanged. This means:
284
+ The progress parsers (`CheckoutProgressParser`, `FetchProgressParser`, `PullProgressParser`, `PushProgressParser`, `CloneProgressParser`, `RevertProgressParser`) now have real `parse()` methods that extract percentage and description from git's stderr output. Progress callbacks receive updates for clone, fetch, push, pull, and checkout operations.
285
285
 
286
- - Progress callbacks for clone, fetch, push, pull, and checkout will fire the initial `0%` callback but **never receive updates**
287
- - Long-running operations will complete correctly but without intermediate progress reporting
286
+ Note: `git revert` does not produce progress output, so `RevertProgressParser` still returns `null` from its `parse()` method this is correct behavior.
288
287
 
289
288
  ### 🟡 Git Hook Interception (`src/lib/hooks/`)
290
289
 
@@ -294,9 +293,9 @@ The progress parsers (`CheckoutProgressParser`, `FetchProgressParser`, `PullProg
294
293
 
295
294
  `withTrampolineEnv` is a **stub** that calls through without setting up the Git LFS trampoline environment. Git LFS operations may not work correctly as a result.
296
295
 
297
- ### 🟡 No Tests
296
+ ### 🟢 Integration Tests
298
297
 
299
- There are no unit or integration tests yet. While the code is a faithful extraction of the stable GitHub Desktop codebase, there are no automated tests to verify the extraction.
298
+ Integration tests are available in `src/__tests__/integration.test.ts` and run against real git repositories in temp directories. Run `npm test` to execute them.
300
299
 
301
300
  ---
302
301
 
@@ -318,9 +317,9 @@ src/
318
317
  └── lib/ ← Utilities: parsers, progress reporting, hooks, fs helpers
319
318
  ├── diff-parser.ts ← Full diff parser (text/binary/image)
320
319
  ├── status-parser.ts ← Porcelain v2 status parser
321
- ├── progress/ ← 🟡 Progress parsers (stubbed — see Limitations)
322
- ├── hooks/ ← 🟡 Git hook env (stubbed — see Limitations)
323
- └── trampoline/ ← 🟡 Git LFS trampoline (stubbed — see Limitations)
320
+ ├── progress/ ← 🟢 Progress parsers (real — see Known Limitations)
321
+ ├── hooks/ ← 🟡 Git hook env (stubbed — see Known Limitations)
322
+ └── trampoline/ ← 🟡 Git LFS trampoline (stubbed — see Known Limitations)
324
323
  ```
325
324
 
326
325
  ## Development
@@ -347,6 +346,8 @@ npx tsx examples/create-commit.ts /path/to/repo
347
346
 
348
347
  ## Consumption Patterns
349
348
 
349
+ > Upgrading from v0.1.4? See the [exec → git() migration guide](./docs/exec-to-git-migration.md) if you were using `exec()` from the public API.
350
+
350
351
  ### Root barrel (recommended for most use cases)
351
352
 
352
353
  ```typescript
@@ -357,10 +358,13 @@ import { Repository, getStatus, createCommit, getBranches, merge, GitError, GitE
357
358
  ### Git subpath (low-level access)
358
359
 
359
360
  ```typescript
360
- // Raw git process execution (for operations not covered by wrappers)
361
- import { exec, parseError, spawnGit } from 'git-chopstick-core/git'
361
+ // Low-level helpers (parse git errors, spawn streaming git processes)
362
+ import { parseError, spawnGit } from 'git-chopstick-core/git'
363
+
364
+ // Use git() from the root barrel for most operations
365
+ import { git } from 'git-chopstick-core'
362
366
 
363
- const result = await exec(['rev-parse', '--show-toplevel'], '/path/to/repo')
367
+ const result = await git(['rev-parse', '--show-toplevel'], '/path/to/repo', 'my-op')
364
368
  console.log(result.stdout)
365
369
  ```
366
370
 
@@ -1,4 +1,4 @@
1
- export { exec, spawnGit, parseError, parseBadConfigValueErrorInfo, ExecError, type IGitSpawnOptions } from './exec.js';
1
+ export { spawnGit, parseError, parseBadConfigValueErrorInfo, ExecError, type IGitSpawnOptions } from './exec.js';
2
2
  export * from './add.js';
3
3
  export * from './apply.js';
4
4
  export * from './branch.js';
package/dist/git/index.js CHANGED
@@ -1,5 +1,5 @@
1
- // ── Low-level execution API ──
2
- export { exec, spawnGit, parseError, parseBadConfigValueErrorInfo, ExecError } from './exec.js';
1
+ // ── Low-level execution API (exec is internal — use git() from core.js instead) ──
2
+ export { spawnGit, parseError, parseBadConfigValueErrorInfo, ExecError } from './exec.js';
3
3
  // ── Git operations ──
4
4
  export * from './add.js';
5
5
  export * from './apply.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/git/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,4BAA4B,EAAE,SAAS,EAAyB,MAAM,WAAW,CAAC;AAEvH,uBAAuB;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,WAAW,CAAA;AACzB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,yBAAyB,CAAA;AACvC,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,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,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA"}
@@ -22,3 +22,10 @@ export declare function getUpstreamRefForRef(path: string, ref?: string): Promis
22
22
  export declare function getUpstreamRemoteNameForRef(path: string, ref?: string): Promise<string | null>;
23
23
  export declare const getCurrentUpstreamRef: (path: string) => Promise<string | null>;
24
24
  export declare const getCurrentUpstreamRemoteName: (path: string) => Promise<string | null>;
25
+ /**
26
+ * Get the current branch name for the repository at the given path.
27
+ *
28
+ * Returns the branch name (e.g. `"main"`) if on a named branch,
29
+ * or `undefined` if HEAD is detached.
30
+ */
31
+ export declare function getCurrentBranch(path: string): Promise<string | undefined>;
@@ -62,4 +62,17 @@ export async function getUpstreamRemoteNameForRef(path, ref) {
62
62
  }
63
63
  export const getCurrentUpstreamRef = (path) => getUpstreamRefForRef(path);
64
64
  export const getCurrentUpstreamRemoteName = (path) => getUpstreamRemoteNameForRef(path);
65
+ /**
66
+ * Get the current branch name for the repository at the given path.
67
+ *
68
+ * Returns the branch name (e.g. `"main"`) if on a named branch,
69
+ * or `undefined` if HEAD is detached.
70
+ */
71
+ export async function getCurrentBranch(path) {
72
+ const result = await git(['symbolic-ref', '--short', 'HEAD'], path, 'getCurrentBranch', { successExitCodes: new Set([0, 128]) });
73
+ if (result.exitCode === 128) {
74
+ return undefined;
75
+ }
76
+ return result.stdout.trim();
77
+ }
65
78
  //# sourceMappingURL=rev-parse.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rev-parse.js","sourceRoot":"","sources":["../../src/git/rev-parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAQ9B;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAY;IAClD,IAAI,CAAC,CAAC,MAAM,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACnC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;IAC5B,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,GAAG,CACtB,CAAC,WAAW,EAAE,sBAAsB,EAAE,aAAa,EAAE,WAAW,CAAC,EACjE,IAAI,EACJ,mBAAmB,EACnB,EAAE,gBAAgB,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CACxC,CAAA;QAED,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YAC1B,yEAAyE;YACzE,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACvC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;YACzB,CAAC;YAED,sEAAsE;YACtE,uEAAuE;YACvE,sEAAsE;YACtE,uEAAuE;YACvE,qEAAqE;YACrE,MAAM,KAAK,GAAG,MAAM,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AC,EACnC,IAAI,EACJ,kBAAkB,EAClB,EAAE,gBAAgB,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CACxC,CAAA;IAED,IAAI,MAAM,CAAC,QAAQ,KAAK,GAAG,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;AAC7B,CAAC"}
@@ -1,2 +1,20 @@
1
1
  import { IGitExecutionOptions } from '../../git/core.js';
2
- export declare function executionOptionsWithProgress(options: IGitExecutionOptions, _parser: any, _progressCallback: (progress: any) => void): Promise<IGitExecutionOptions>;
2
+ import type { IGitOutput } from './index.js';
3
+ /**
4
+ * Wraps git execution options with a `processCallback` that intercepts
5
+ * stderr output and feeds progress lines to the provided parser.
6
+ *
7
+ * Git writes progress updates to stderr using carriage return (`\r`) to
8
+ * overwrite the current line, producing output like:
9
+ * Receiving objects: 15% (150/1000)
10
+ * Resolving deltas: 100% (2145/2145), done.
11
+ *
12
+ * This function:
13
+ * 1. Buffers stderr chunks split on `\r` to extract individual progress lines
14
+ * 2. Feeds each line to the parser, which extracts percentage + description
15
+ * 3. Calls the progress callback with the parsed result
16
+ * 4. Chains to any existing processCallback set on the options
17
+ */
18
+ export declare function executionOptionsWithProgress(options: IGitExecutionOptions, parser: {
19
+ parse: (line: string) => IGitOutput | null;
20
+ }, progressCallback: (progress: any) => void): Promise<IGitExecutionOptions>;
@@ -1,4 +1,45 @@
1
- export async function executionOptionsWithProgress(options, _parser, _progressCallback) {
2
- return options;
1
+ /**
2
+ * Wraps git execution options with a `processCallback` that intercepts
3
+ * stderr output and feeds progress lines to the provided parser.
4
+ *
5
+ * Git writes progress updates to stderr using carriage return (`\r`) to
6
+ * overwrite the current line, producing output like:
7
+ * Receiving objects: 15% (150/1000)
8
+ * Resolving deltas: 100% (2145/2145), done.
9
+ *
10
+ * This function:
11
+ * 1. Buffers stderr chunks split on `\r` to extract individual progress lines
12
+ * 2. Feeds each line to the parser, which extracts percentage + description
13
+ * 3. Calls the progress callback with the parsed result
14
+ * 4. Chains to any existing processCallback set on the options
15
+ */
16
+ export async function executionOptionsWithProgress(options, parser,
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
+ progressCallback) {
19
+ return {
20
+ ...options,
21
+ processCallback: (process) => {
22
+ // Chain to any existing processCallback (e.g. from core.ts)
23
+ options.processCallback?.(process);
24
+ // Buffer for stderr chunks — git progress lines are terminated by \r
25
+ let buffer = '';
26
+ process.stderr?.on('data', (chunk) => {
27
+ buffer += chunk.toString();
28
+ // Split on \r to get individual progress lines
29
+ const lines = buffer.split('\r');
30
+ // Keep any incomplete trailing data in the buffer for the next chunk
31
+ buffer = lines.pop() ?? '';
32
+ for (const line of lines) {
33
+ const trimmed = line.trim();
34
+ if (!trimmed)
35
+ continue;
36
+ const output = parser.parse(trimmed);
37
+ if (output !== null) {
38
+ progressCallback(output);
39
+ }
40
+ }
41
+ });
42
+ },
43
+ };
3
44
  }
4
45
  //# sourceMappingURL=from-process.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"from-process.js","sourceRoot":"","sources":["../../../src/lib/progress/from-process.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,OAA6B,EAC7B,OAAY,EACZ,iBAA0C;IAE1C,OAAO,OAAO,CAAA;AAChB,CAAC"}
1
+ {"version":3,"file":"from-process.js","sourceRoot":"","sources":["../../../src/lib/progress/from-process.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,OAA6B,EAC7B,MAAsD;AACtD,8DAA8D;AAC9D,gBAAyC;IAEzC,OAAO;QACL,GAAG,OAAO;QACV,eAAe,EAAE,CAAC,OAAY,EAAE,EAAE;YAChC,4DAA4D;YAC5D,OAAO,CAAC,eAAe,EAAE,CAAC,OAAO,CAAC,CAAA;YAElC,qEAAqE;YACrE,IAAI,MAAM,GAAG,EAAE,CAAA;YAEf,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;gBAC3C,MAAM,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAA;gBAE1B,+CAA+C;gBAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;gBAChC,qEAAqE;gBACrE,MAAM,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,CAAA;gBAE1B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;oBACzB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;oBAC3B,IAAI,CAAC,OAAO;wBAAE,SAAQ;oBAEtB,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;oBACpC,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;wBACpB,gBAAgB,CAAC,MAAM,CAAC,CAAA;oBAC1B,CAAC;gBACH,CAAC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -5,10 +5,13 @@ export interface IGitOutput {
5
5
  percent: number;
6
6
  details?: {
7
7
  text: string;
8
+ title?: string;
8
9
  };
9
10
  }
10
11
  export declare class CheckoutProgressParser {
11
- parse(_line: string): any;
12
+ private _percent;
13
+ private _details;
14
+ parse(line: string): IGitOutput | null;
12
15
  get percent(): number;
13
16
  get details(): {
14
17
  text: string;
@@ -16,7 +19,9 @@ export declare class CheckoutProgressParser {
16
19
  get kind(): string;
17
20
  }
18
21
  export declare class FetchProgressParser {
19
- parse(_line: string): any;
22
+ private _percent;
23
+ private _details;
24
+ parse(line: string): IGitOutput | null;
20
25
  get percent(): number;
21
26
  get details(): {
22
27
  text: string;
@@ -24,7 +29,9 @@ export declare class FetchProgressParser {
24
29
  get kind(): string;
25
30
  }
26
31
  export declare class PullProgressParser {
27
- parse(_line: string): any;
32
+ private _percent;
33
+ private _details;
34
+ parse(line: string): IGitOutput | null;
28
35
  get percent(): number;
29
36
  get details(): {
30
37
  text: string;
@@ -32,7 +39,9 @@ export declare class PullProgressParser {
32
39
  get kind(): string;
33
40
  }
34
41
  export declare class PushProgressParser {
35
- parse(_line: string): any;
42
+ private _percent;
43
+ private _details;
44
+ parse(line: string): IGitOutput | null;
36
45
  get percent(): number;
37
46
  get details(): {
38
47
  text: string;
@@ -40,7 +49,9 @@ export declare class PushProgressParser {
40
49
  get kind(): string;
41
50
  }
42
51
  export declare class CloneProgressParser {
43
- parse(_line: string): any;
52
+ private _percent;
53
+ private _details;
54
+ parse(line: string): IGitOutput | null;
44
55
  get percent(): number;
45
56
  get details(): {
46
57
  text: string;
@@ -1,32 +1,133 @@
1
1
  export { executionOptionsWithProgress } from './from-process.js';
2
+ /**
3
+ * Extract progress percentage from common git progress lines.
4
+ * Matches patterns like:
5
+ * Receiving objects: 15% (150/1000)
6
+ * Resolving deltas: 0% (0/2145)
7
+ * Checking out files: 45% (230/512)
8
+ * Writing objects: 10% (5/50)
9
+ * remote: Counting objects: 100% (15/15)
10
+ */
11
+ function parseProgressLine(line) {
12
+ const match = line.match(/(\d+)%\s*\([\d/]+\)/);
13
+ if (match) {
14
+ return { percent: parseInt(match[1], 10), text: line };
15
+ }
16
+ return null;
17
+ }
2
18
  export class CheckoutProgressParser {
3
- parse(_line) { return null; }
4
- get percent() { return 0; }
5
- get details() { return { text: '' }; }
19
+ _percent = 0;
20
+ _details = { text: '' };
21
+ parse(line) {
22
+ // Checking out files: 45% (230/512)
23
+ const progress = parseProgressLine(line);
24
+ if (progress && line.includes('Checking out files')) {
25
+ this._percent = progress.percent;
26
+ this._details = { text: line };
27
+ return { kind: 'progress', percent: this._percent, details: this._details };
28
+ }
29
+ return null;
30
+ }
31
+ get percent() { return this._percent; }
32
+ get details() { return this._details; }
6
33
  get kind() { return 'progress'; }
7
34
  }
8
35
  export class FetchProgressParser {
9
- parse(_line) { return null; }
10
- get percent() { return 0; }
11
- get details() { return { text: '' }; }
36
+ _percent = 0;
37
+ _details = { text: '' };
38
+ parse(line) {
39
+ // Receiving objects: 15% (150/1000)
40
+ // Resolving deltas: 0% (0/2145)
41
+ const progress = parseProgressLine(line);
42
+ if (progress && (line.includes('Receiving objects') || line.includes('Resolving deltas'))) {
43
+ this._percent = progress.percent;
44
+ this._details = { text: line };
45
+ return { kind: 'progress', percent: this._percent, details: this._details };
46
+ }
47
+ // remote: Counting objects, remote: Compressing objects, etc.
48
+ if (line.startsWith('remote:')) {
49
+ return { kind: 'context', text: line, percent: this._percent };
50
+ }
51
+ return null;
52
+ }
53
+ get percent() { return this._percent; }
54
+ get details() { return this._details; }
12
55
  get kind() { return 'progress'; }
13
56
  }
14
57
  export class PullProgressParser {
15
- parse(_line) { return null; }
16
- get percent() { return 0; }
17
- get details() { return { text: '' }; }
58
+ _percent = 0;
59
+ _details = { text: '' };
60
+ parse(line) {
61
+ // Pull combines fetch + merge, so it can have receiving/resolving deltas
62
+ const progress = parseProgressLine(line);
63
+ if (progress && (line.includes('Receiving objects') || line.includes('Resolving deltas'))) {
64
+ this._percent = progress.percent;
65
+ this._details = { text: line };
66
+ return { kind: 'progress', percent: this._percent, details: this._details };
67
+ }
68
+ // remote: Counting objects, etc.
69
+ if (line.startsWith('remote:')) {
70
+ return { kind: 'context', text: line, percent: this._percent };
71
+ }
72
+ return null;
73
+ }
74
+ get percent() { return this._percent; }
75
+ get details() { return this._details; }
18
76
  get kind() { return 'progress'; }
19
77
  }
20
78
  export class PushProgressParser {
21
- parse(_line) { return null; }
22
- get percent() { return 0; }
23
- get details() { return { text: '' }; }
79
+ _percent = 0;
80
+ _details = { text: '' };
81
+ parse(line) {
82
+ // Writing objects: 10% (5/50)
83
+ const progress = parseProgressLine(line);
84
+ if (progress && line.includes('Writing objects')) {
85
+ this._percent = progress.percent;
86
+ this._details = { text: line };
87
+ return { kind: 'progress', percent: this._percent, details: this._details };
88
+ }
89
+ // remote: Resolving deltas: 100%, remote: Processing references, etc.
90
+ if (line.startsWith('remote:')) {
91
+ const remoteProgress = parseProgressLine(line);
92
+ if (remoteProgress) {
93
+ // remote lines that contain progress (e.g. remote: Resolving deltas: 100% (12/12))
94
+ this._percent = remoteProgress.percent;
95
+ this._details = { text: line };
96
+ return { kind: 'progress', percent: this._percent, details: this._details };
97
+ }
98
+ return { kind: 'context', text: line, percent: this._percent };
99
+ }
100
+ return null;
101
+ }
102
+ get percent() { return this._percent; }
103
+ get details() { return this._details; }
24
104
  get kind() { return 'progress'; }
25
105
  }
26
106
  export class CloneProgressParser {
27
- parse(_line) { return null; }
28
- get percent() { return 0; }
29
- get details() { return { text: '' }; }
107
+ _percent = 0;
108
+ _details = { text: '' };
109
+ parse(line) {
110
+ // Cloning into 'repo-name'...
111
+ if (line.startsWith('Cloning into')) {
112
+ return { kind: 'context', text: line, percent: 0 };
113
+ }
114
+ // Receiving objects: 15% (150/1000) — clone downloads objects
115
+ // Resolving deltas: 0% (0/2145) — clone resolves deltas
116
+ // Checking out files: 45% (230/512) — clone checks out working tree
117
+ const progress = parseProgressLine(line);
118
+ if (progress && (line.includes('Receiving objects') || line.includes('Resolving deltas') || line.includes('Checking out files'))) {
119
+ this._percent = progress.percent;
120
+ this._details = { text: line };
121
+ return { kind: 'progress', percent: this._percent, details: this._details };
122
+ }
123
+ // remote: Enumerating objects, remote: Counting objects, etc.
124
+ if (line.startsWith('remote:')) {
125
+ return { kind: 'context', text: line, percent: this._percent };
126
+ }
127
+ return null;
128
+ }
129
+ get percent() { return this._percent; }
130
+ get details() { return this._details; }
30
131
  get kind() { return 'progress'; }
31
132
  }
32
133
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/progress/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAA;AAShE,MAAM,OAAO,sBAAsB;IAC1B,KAAK,CAAC,KA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C,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;YACpC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAA;QACpD,CAAC;QAED,8DAA8D;QAC9D,0DAA0D;QAC1D,oEAAoE;QACpE,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAA;QACxC,IAAI,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC;YACjI,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;YAChC,IAAI,CAAC,QAAQ,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;YAC9B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAA;QAC7E,CAAC;QAED,8DAA8D;QAC9D,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC/B,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAA;QAChE,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,OAAO,KAAa,OAAO,IAAI,CAAC,QAAQ,CAAA,CAAC,CAAC;IAC9C,IAAI,OAAO,KAAuB,OAAO,IAAI,CAAC,QAAQ,CAAA,CAAC,CAAC;IACxD,IAAI,IAAI,KAAa,OAAO,UAAU,CAAA,CAAC,CAAC;CACzC"}
@@ -1,5 +1,10 @@
1
+ import { IGitOutput } from './index.js';
2
+ /**
3
+ * Git revert does not produce progress output on stderr,
4
+ * so this parser remains effectively a stub for the interface.
5
+ */
1
6
  export declare class RevertProgressParser {
2
- parse(_line: string): any;
7
+ parse(_line: string): IGitOutput | null;
3
8
  get percent(): number;
4
9
  get details(): {
5
10
  text: string;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Git revert does not produce progress output on stderr,
3
+ * so this parser remains effectively a stub for the interface.
4
+ */
1
5
  export class RevertProgressParser {
2
6
  parse(_line) {
3
7
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"revert.js","sourceRoot":"","sources":["../../../src/lib/progress/revert.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,oBAAoB;IACxB,KAAK,CAAC,KAAa;QACxB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,CAAC,CAAA;IACV,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAA;IACrB,CAAC;IAED,IAAW,IAAI;QACb,OAAO,UAAU,CAAA;IACnB,CAAC;CACF"}
1
+ {"version":3,"file":"revert.js","sourceRoot":"","sources":["../../../src/lib/progress/revert.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IACxB,KAAK,CAAC,KAAa;QACxB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,CAAC,CAAA;IACV,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAA;IACrB,CAAC;IAED,IAAW,IAAI;QACb,OAAO,UAAU,CAAA;IACnB,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-chopstick-core",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -31,13 +31,15 @@
31
31
  }
32
32
  },
33
33
  "files": [
34
- "dist"
34
+ "dist",
35
+ "CHANGELOG.md"
35
36
  ],
36
37
  "description": "Git backend library extracted from GitHub Desktop",
37
38
  "scripts": {
38
39
  "clean": "rm -rf dist",
39
40
  "build": "npm run clean && tsc",
40
41
  "typecheck": "tsc --noEmit",
42
+ "test": "vitest run",
41
43
  "prepublishOnly": "npm run typecheck && npm run build"
42
44
  },
43
45
  "dependencies": {
@@ -60,6 +62,7 @@
60
62
  "devDependencies": {
61
63
  "@types/byline": "^4.2.36",
62
64
  "@types/node": "^22.19.20",
63
- "typescript": "^5.9.3"
65
+ "typescript": "^5.9.3",
66
+ "vitest": "^4.1.8"
64
67
  }
65
68
  }