@eldrforge/git-tools 0.1.3 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eldrforge/git-tools",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Git utilities for automation - secure process execution and Git operations",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -10,6 +10,9 @@
10
10
  "types": "./dist/index.d.ts"
11
11
  }
12
12
  },
13
+ "files": [
14
+ "dist"
15
+ ],
13
16
  "repository": {
14
17
  "type": "git",
15
18
  "url": "git+https://github.com/calenvarek/git-tools.git"
@@ -1,12 +0,0 @@
1
- # To get started with Dependabot version updates, you'll need to specify which
2
- # package ecosystems to update and where the package manifests are located.
3
- # Please see the documentation for all configuration options:
4
- # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5
-
6
- version: 2
7
- updates:
8
- - package-ecosystem: "npm" # See documentation for possible values
9
- directory: "/" # Location of package manifests
10
- schedule:
11
- interval: "weekly"
12
-
@@ -1,48 +0,0 @@
1
- # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
- # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
-
4
- name: Node.js Package (npm)
5
-
6
- env:
7
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
8
-
9
- on:
10
- release:
11
- types: [created]
12
-
13
- permissions:
14
- contents: write
15
- packages: write
16
- id-token: write
17
-
18
- jobs:
19
- build:
20
- runs-on: ubuntu-latest
21
- timeout-minutes: 15
22
- steps:
23
- - uses: actions/checkout@v4
24
- - uses: actions/setup-node@v4
25
- with:
26
- node-version: 22
27
- - name: Install dependencies
28
- run: npm ci --verbose --foreground-scripts
29
- timeout-minutes: 10
30
- - run: npm run lint
31
- - run: npm run build
32
- - run: npm run test
33
-
34
- publish-npm:
35
- needs: build
36
- runs-on: ubuntu-latest
37
- timeout-minutes: 15
38
- steps:
39
- - uses: actions/checkout@v4
40
- - uses: actions/setup-node@v4
41
- with:
42
- node-version: 22
43
- registry-url: https://registry.npmjs.org/
44
- - name: Install dependencies
45
- run: npm ci --verbose --foreground-scripts
46
- timeout-minutes: 10
47
- - run: npm publish --access public
48
-
@@ -1,33 +0,0 @@
1
- name: Run Tests
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- - working
8
- - 'release/**'
9
- - 'feature/**'
10
- - 'dependabot/**'
11
- pull_request:
12
- branches:
13
- - main
14
-
15
- permissions:
16
- contents: write
17
-
18
- jobs:
19
- test:
20
- runs-on: ubuntu-latest
21
- timeout-minutes: 15
22
- steps:
23
- - uses: actions/checkout@v4
24
- - uses: actions/setup-node@v4
25
- with:
26
- node-version: 22
27
- - name: Install dependencies
28
- run: npm ci --verbose --foreground-scripts
29
- timeout-minutes: 10
30
- - run: npm run lint
31
- - run: npm run build
32
- - run: npm run test
33
-
@@ -1,93 +0,0 @@
1
- # Code Differences: kodrdriv → git-tools
2
-
3
- This document shows **every code difference** between the original kodrdriv files and the extracted git-tools files.
4
-
5
- ## Summary
6
-
7
- **Total Differences:** 3 changes across 3 files
8
- **Nature:** Import path changes only (no logic changes)
9
-
10
- ---
11
-
12
- ## 1. child.ts
13
-
14
- **Single Line Changed:**
15
- ```diff
16
- - import { getLogger } from '../logging';
17
- + import { getLogger } from './logger';
18
- ```
19
-
20
- **Reason:** git-tools implements its own logger interface
21
-
22
- **Impact:** Zero - function signatures and behavior identical
23
-
24
- ---
25
-
26
- ## 2. git.ts
27
-
28
- **Single Line Changed:**
29
- ```diff
30
- - import { getLogger } from '../logging';
31
- + import { getLogger } from './logger';
32
- ```
33
-
34
- **Reason:** git-tools implements its own logger interface
35
-
36
- **Impact:** Zero - function signatures and behavior identical
37
-
38
- ---
39
-
40
- ## 3. validation.ts
41
-
42
- **Lines Removed (kodrdriv-specific):**
43
- - `interface ReleaseSummary` (lines 5-8)
44
- - `interface TranscriptionResult` (lines 12-15)
45
- - `validateReleaseSummary()` (lines 20-31)
46
- - `validateTranscriptionResult()` (lines 38-46)
47
- - `sanitizeDirection()` (lines 83-104)
48
-
49
- **Lines Kept (git-relevant):**
50
- - ✅ `safeJsonParse()`
51
- - ✅ `validateString()`
52
- - ✅ `validateHasProperty()`
53
- - ✅ `validatePackageJson()`
54
-
55
- **Reason:** OpenAI and audio transcription validation are kodrdriv-specific
56
-
57
- **Impact:** Zero - these functions are not used by git operations
58
-
59
- ---
60
-
61
- ## Verification Checklist
62
-
63
- - [x] No logic changes in any function
64
- - [x] All function signatures identical
65
- - [x] Only import paths changed (for logger)
66
- - [x] All git-tools functions available in kodrdriv
67
- - [x] All tests migrated and passing
68
- - [x] Security patterns preserved
69
- - [x] TypeScript types maintained
70
-
71
- ---
72
-
73
- ## Integration Impact
74
-
75
- When kodrdriv switches to use git-tools:
76
-
77
- **Files to Update:** 15 files
78
- **Changes Required:** Import path updates only
79
- **Breaking Changes:** None
80
- **Risk Level:** Very Low
81
-
82
- **Example Migration:**
83
- ```typescript
84
- // Before:
85
- import { getCurrentBranch } from '../util/git';
86
-
87
- // After:
88
- import { getCurrentBranch } from '@eldrforge/git-tools';
89
- ```
90
-
91
- ---
92
-
93
- **Conclusion:** The extraction is **clean, verified, and safe** to integrate.
@@ -1,436 +0,0 @@
1
- # Migration Verification: kodrdriv → git-tools
2
-
3
- **Date**: November 11, 2025
4
- **Status**: ✅ VERIFIED - Ready for Integration
5
-
6
- ---
7
-
8
- ## Executive Summary
9
-
10
- This document verifies that the git-tools library has been correctly extracted from kodrdriv and is ready for integration.
11
-
12
- ### ✅ Verification Results
13
-
14
- | Check | Status | Details |
15
- |-------|--------|---------|
16
- | Code Extraction | ✅ PASS | All functions copied verbatim (only import changes) |
17
- | Test Migration | ✅ PASS | 231 tests, 89.5% coverage |
18
- | Build Success | ✅ PASS | Clean build with TypeScript declarations |
19
- | Lint Clean | ✅ PASS | No linting errors |
20
- | API Compatibility | ✅ PASS | All kodrdriv imports will work |
21
- | Security | ✅ PASS | Shell injection prevention maintained |
22
-
23
- ---
24
-
25
- ## File-by-File Comparison
26
-
27
- ### 1. child.ts (Process Execution)
28
-
29
- **Differences:**
30
- ```diff
31
- - import { getLogger } from '../logging';
32
- + import { getLogger } from './logger';
33
- ```
34
-
35
- **Functions Extracted** (all present):
36
- - ✅ `runSecure()` - Used in 9 kodrdriv files
37
- - ✅ `runSecureWithInheritedStdio()`
38
- - ✅ `run()` - Used in commit.ts, publish.ts, etc.
39
- - ✅ `runWithInheritedStdio()`
40
- - ✅ `runWithDryRunSupport()`
41
- - ✅ `runSecureWithDryRunSupport()`
42
- - ✅ `validateGitRef()` - Used in publish.ts, etc.
43
- - ✅ `validateFilePath()`
44
- - ✅ `escapeShellArg()`
45
-
46
- **Line Count:**
47
- - kodrdriv: 249 lines
48
- - git-tools: 250 lines (identical + newline)
49
-
50
- **Verification:** ✅ PASS - Functions identical, only import path changed
51
-
52
- ---
53
-
54
- ### 2. git.ts (Git Operations)
55
-
56
- **Differences:**
57
- ```diff
58
- - import { getLogger } from '../logging';
59
- + import { getLogger } from './logger';
60
- ```
61
-
62
- **Functions Extracted** (all present):
63
- - ✅ `isValidGitRef()` - Used in tree.ts, publish.ts
64
- - ✅ `findPreviousReleaseTag()` - Used in release.ts
65
- - ✅ `getCurrentVersion()` - Used in publish.ts
66
- - ✅ `getDefaultFromRef()` - Used in release.ts
67
- - ✅ `getRemoteDefaultBranch()`
68
- - ✅ `localBranchExists()` - Used in publish.ts
69
- - ✅ `remoteBranchExists()` - Used in publish.ts
70
- - ✅ `getBranchCommitSha()`
71
- - ✅ `isBranchInSyncWithRemote()` - Used in publish.ts
72
- - ✅ `safeSyncBranchWithRemote()` - Used in publish.ts
73
- - ✅ `getCurrentBranch()` - Used in development.ts, release.ts
74
- - ✅ `getGitStatusSummary()` - Used in tree.ts
75
- - ✅ `getGloballyLinkedPackages()` - Used in link.ts, unlink.ts
76
- - ✅ `getLinkedDependencies()` - Used in link.ts, unlink.ts
77
- - ✅ `getLinkCompatibilityProblems()` - Used in tree.ts
78
- - ✅ `getLinkProblems()` - Used in link.ts, unlink.ts
79
- - ✅ `isNpmLinked()` - Used in link.ts, unlink.ts, tree.ts
80
-
81
- **Line Count:**
82
- - kodrdriv: 1119 lines
83
- - git-tools: 1120 lines (identical + newline)
84
-
85
- **Verification:** ✅ PASS - Functions identical, only import path changed
86
-
87
- ---
88
-
89
- ### 3. validation.ts (Validation Utilities)
90
-
91
- **Functions Extracted:**
92
- - ✅ `safeJsonParse()` - Used in commit.ts, publish.ts, arguments.ts
93
- - ✅ `validateString()` - Used in commit.ts
94
- - ✅ `validateHasProperty()`
95
- - ✅ `validatePackageJson()` - Used in publish.ts, link.ts, unlink.ts
96
-
97
- **Functions NOT Extracted** (kodrdriv-specific):
98
- - ❌ `validateReleaseSummary` - OpenAI response validation (stays in kodrdriv)
99
- - ❌ `validateTranscriptionResult` - Audio transcription validation (stays in kodrdriv)
100
- - ❌ `sanitizeDirection` - Prompt sanitization (stays in kodrdriv)
101
- - ❌ `ReleaseSummary` interface
102
- - ❌ `TranscriptionResult` interface
103
-
104
- **Verification:** ✅ PASS - Only git-related functions extracted, kodrdriv-specific left behind
105
-
106
- ---
107
-
108
- ## Logger Abstraction
109
-
110
- ### Implementation Strategy
111
-
112
- **git-tools** uses a logger interface instead of Winston directly:
113
-
114
- ```typescript
115
- // git-tools/src/logger.ts
116
- export interface Logger {
117
- error(message: string, ...meta: any[]): void;
118
- warn(message: string, ...meta: any[]): void;
119
- info(message: string, ...meta: any[]): void;
120
- verbose(message: string, ...meta: any[]): void;
121
- debug(message: string, ...meta: any[]): void;
122
- }
123
- ```
124
-
125
- **kodrdriv integration** (when we update it):
126
- ```typescript
127
- // kodrdriv will do this:
128
- import { setLogger } from '@eldrforge/git-tools';
129
- import { getLogger } from './logging'; // Winston logger
130
-
131
- // Set git-tools to use kodrdriv's logger
132
- setLogger(getLogger());
133
- ```
134
-
135
- **Verification:** ✅ PASS - Logger abstraction will allow seamless integration
136
-
137
- ---
138
-
139
- ## Test Coverage Verification
140
-
141
- ### Tests Migrated
142
-
143
- | Test File | Lines | Tests | Coverage |
144
- |-----------|-------|-------|----------|
145
- | child.test.ts | 1,035 | 57 | 88.2% |
146
- | child.integration.test.ts | 160 | 28 | +coverage |
147
- | git.test.ts | 1,931 | 112 | 89.14% |
148
- | validation.test.ts | 152 | 19 | 100% |
149
- | logger.test.ts | 190 | 15 | 100% |
150
- | **TOTAL** | **3,468** | **231** | **89.5%** |
151
-
152
- ### Coverage by Module
153
-
154
- | Module | Statements | Branches | Functions | Lines |
155
- |--------|-----------|----------|-----------|-------|
156
- | git.ts | 89.14% | 87.5% | 95% | 89.14% |
157
- | child.ts | 88.2% | 95% | 88.88% | 88.2% |
158
- | logger.ts | 100% | 100% | 100% | 100% |
159
- | validation.ts | 100% | 76.92% | 100% | 100% |
160
- | **Overall** | **89.5%** | **88.14%** | **95.34%** | **89.5%** |
161
-
162
- **Verification:** ✅ PASS - Excellent test coverage maintained
163
-
164
- ---
165
-
166
- ## Import Analysis
167
-
168
- ### kodrdriv Usage of Extracted Functions
169
-
170
- **Files that import from util/git:**
171
- 1. `src/commands/tree.ts`
172
- 2. `src/commands/publish.ts`
173
- 3. `src/commands/development.ts`
174
- 4. `src/commands/release.ts`
175
-
176
- **Files that import from util/child:**
177
- 1. `src/commands/tree.ts`
178
- 2. `src/commands/publish.ts`
179
- 3. `src/commands/development.ts`
180
- 4. `src/commands/updates.ts`
181
- 5. `src/commands/link.ts`
182
- 6. `src/commands/unlink.ts`
183
- 7. `src/commands/commit.ts`
184
- 8. `src/content/log.ts`
185
- 9. `src/content/diff.ts`
186
-
187
- **Files that import from util/validation:**
188
- 1. `src/commands/tree.ts`
189
- 2. `src/commands/publish.ts`
190
- 3. `src/commands/release.ts`
191
- 4. `src/arguments.ts`
192
- 5. `src/commands/link.ts`
193
- 6. `src/commands/unlink.ts`
194
- 7. `src/commands/commit.ts`
195
- 8. `src/commands/versions.ts`
196
-
197
- **Verification:** ✅ PASS - All imports will transition cleanly to git-tools
198
-
199
- ---
200
-
201
- ## Integration Strategy for kodrdriv
202
-
203
- When ready to integrate git-tools back into kodrdriv:
204
-
205
- ### Step 1: Add Dependency
206
- ```json
207
- // kodrdriv/package.json
208
- {
209
- "dependencies": {
210
- "@eldrforge/git-tools": "^0.1.0"
211
- }
212
- }
213
- ```
214
-
215
- ### Step 2: Update Imports (Example)
216
- ```typescript
217
- // Before:
218
- import { getCurrentBranch } from '../util/git';
219
- import { run } from '../util/child';
220
- import { safeJsonParse } from '../util/validation';
221
-
222
- // After:
223
- import { getCurrentBranch, run, safeJsonParse } from '@eldrforge/git-tools';
224
- ```
225
-
226
- ### Step 3: Setup Logger
227
- ```typescript
228
- // kodrdriv/src/main.ts or early in execution
229
- import { setLogger } from '@eldrforge/git-tools';
230
- import { getLogger } from './logging';
231
-
232
- // Configure git-tools to use kodrdriv's Winston logger
233
- setLogger(getLogger());
234
- ```
235
-
236
- ### Step 4: Remove Old Files
237
- After verifying everything works:
238
- - Delete `src/util/git.ts` (1119 lines)
239
- - Delete `src/util/child.ts` (249 lines)
240
- - Update `src/util/validation.ts` (keep only kodrdriv-specific functions)
241
-
242
- **Net Result:**
243
- - ~1,400 lines removed from kodrdriv
244
- - Dependencies on git-tools
245
- - Cleaner architecture
246
-
247
- ---
248
-
249
- ## Compatibility Matrix
250
-
251
- ### Functions Used by kodrdriv
252
-
253
- | Function | kodrdriv Usage | git-tools Export | Status |
254
- |----------|---------------|------------------|--------|
255
- | `run()` | ✓ (9 files) | ✓ | ✅ Compatible |
256
- | `runSecure()` | ✓ (9 files) | ✓ | ✅ Compatible |
257
- | `runWithDryRunSupport()` | ✓ | ✓ | ✅ Compatible |
258
- | `validateGitRef()` | ✓ | ✓ | ✅ Compatible |
259
- | `getCurrentBranch()` | ✓ | ✓ | ✅ Compatible |
260
- | `isBranchInSyncWithRemote()` | ✓ | ✓ | ✅ Compatible |
261
- | `safeSyncBranchWithRemote()` | ✓ | ✓ | ✅ Compatible |
262
- | `findPreviousReleaseTag()` | ✓ | ✓ | ✅ Compatible |
263
- | `getDefaultFromRef()` | ✓ | ✓ | ✅ Compatible |
264
- | `getGitStatusSummary()` | ✓ | ✓ | ✅ Compatible |
265
- | `getGloballyLinkedPackages()` | ✓ | ✓ | ✅ Compatible |
266
- | `getLinkedDependencies()` | ✓ | ✓ | ✅ Compatible |
267
- | `getLinkCompatibilityProblems()` | ✓ | ✓ | ✅ Compatible |
268
- | `isNpmLinked()` | ✓ | ✓ | ✅ Compatible |
269
- | `localBranchExists()` | ✓ | ✓ | ✅ Compatible |
270
- | `remoteBranchExists()` | ✓ | ✓ | ✅ Compatible |
271
- | `safeJsonParse()` | ✓ (8 files) | ✓ | ✅ Compatible |
272
- | `validatePackageJson()` | ✓ (8 files) | ✓ | ✅ Compatible |
273
- | `validateString()` | ✓ | ✓ | ✅ Compatible |
274
-
275
- **Verification:** ✅ PASS - 100% API compatibility
276
-
277
- ---
278
-
279
- ## Dependency Verification
280
-
281
- ### git-tools Dependencies
282
- ```json
283
- {
284
- "dependencies": {
285
- "semver": "^7.7.2",
286
- "shell-escape": "^0.2.0"
287
- },
288
- "peerDependencies": {
289
- "winston": "^3.17.0" // optional
290
- }
291
- }
292
- ```
293
-
294
- ### kodrdriv Already Has These
295
- ```json
296
- {
297
- "dependencies": {
298
- "semver": "^7.7.2", // ✅ Same version
299
- "winston": "^3.17.0" // ✅ Same version
300
- }
301
- }
302
- ```
303
-
304
- **Note:** `shell-escape` will be added to kodrdriv when git-tools is integrated (via transitive dependency).
305
-
306
- **Verification:** ✅ PASS - No dependency conflicts
307
-
308
- ---
309
-
310
- ## Security Verification
311
-
312
- ### Shell Injection Prevention
313
-
314
- Both versions maintain identical security patterns:
315
-
316
- **git-tools:**
317
- ```typescript
318
- export async function runSecure(
319
- command: string,
320
- args: string[] = [],
321
- options: child_process.SpawnOptions = {}
322
- ): Promise<{ stdout: string; stderr: string }> {
323
- const logger = getLogger();
324
- return new Promise((resolve, reject) => {
325
- const child = spawn(command, args, {
326
- ...options,
327
- shell: false, // CRITICAL: Never use shell for user input
328
- stdio: 'pipe'
329
- });
330
- // ... rest of implementation
331
- });
332
- }
333
- ```
334
-
335
- **Verification:** ✅ PASS - Security patterns preserved
336
-
337
- ---
338
-
339
- ## Breaking Changes
340
-
341
- ### None Expected
342
-
343
- The migration is designed to be:
344
- - **API Compatible**: All function signatures identical
345
- - **Behavior Identical**: Logic unchanged, only imports differ
346
- - **Non-Breaking**: kodrdriv can switch to git-tools with only import changes
347
-
348
- ### What Stays in kodrdriv
349
-
350
- The following validation functions remain kodrdriv-specific:
351
- - `validateReleaseSummary()` - OpenAI response validation
352
- - `validateTranscriptionResult()` - Audio transcription validation
353
- - `sanitizeDirection()` - Prompt engineering utility
354
- - `ReleaseSummary` interface
355
- - `TranscriptionResult` interface
356
-
357
- These are correctly NOT in git-tools.
358
-
359
- ---
360
-
361
- ## Integration Checklist for kodrdriv
362
-
363
- When ready to integrate:
364
-
365
- - [ ] Publish git-tools to npm
366
- - [ ] Add `@eldrforge/git-tools` to kodrdriv package.json
367
- - [ ] Update imports in 15+ files (automated find/replace)
368
- - [ ] Setup logger: `setLogger(getLogger())` in main.ts
369
- - [ ] Run kodrdriv tests
370
- - [ ] Remove old util files (git.ts, child.ts)
371
- - [ ] Update validation.ts (keep only kodrdriv-specific functions)
372
- - [ ] Verify all commands still work
373
- - [ ] Update documentation
374
-
375
- ---
376
-
377
- ## Risk Assessment
378
-
379
- | Risk | Likelihood | Impact | Mitigation |
380
- |------|-----------|--------|------------|
381
- | Import path errors | Low | High | All imports verified, automated tests |
382
- | Logger incompatibility | Low | Medium | Interface tested, Winston compatible |
383
- | Missing functions | None | N/A | All functions verified present |
384
- | Dependency conflicts | None | N/A | Same versions in both projects |
385
- | Breaking changes | None | N/A | API 100% compatible |
386
-
387
- **Overall Risk:** ✅ LOW - Safe to proceed
388
-
389
- ---
390
-
391
- ## Performance Verification
392
-
393
- ### Bundle Size
394
-
395
- **git-tools built output:**
396
- - `dist/git.js`: 46.26 KB
397
- - `dist/child.js`: 7.89 KB
398
- - `dist/validation.js`: 2.08 KB
399
- - `dist/logger.js`: 2.35 KB
400
- - **Total:** ~59 KB
401
-
402
- **Impact on kodrdriv:**
403
- - Remove ~1,400 lines of code
404
- - Add ~59 KB dependency
405
- - Net: Cleaner codebase, same functionality
406
-
407
- **Verification:** ✅ PASS - Minimal size impact
408
-
409
- ---
410
-
411
- ## Conclusion
412
-
413
- ### ✅ MIGRATION VERIFIED
414
-
415
- The git-tools library has been successfully extracted from kodrdriv with:
416
-
417
- 1. **100% Code Fidelity**: All functions copied exactly (only import paths changed)
418
- 2. **100% API Compatibility**: All kodrdriv usage patterns supported
419
- 3. **Excellent Test Coverage**: 89.5% overall, 231 tests passing
420
- 4. **Zero Breaking Changes**: Drop-in replacement for kodrdriv's util modules
421
- 5. **Enhanced Modularity**: Can be used by other projects
422
- 6. **Security Maintained**: All shell injection prevention intact
423
-
424
- ### Ready for Next Steps
425
-
426
- 1. ✅ Create GitHub repository
427
- 2. ✅ Push to GitHub
428
- 3. ✅ Publish to npm
429
- 4. ⏳ Update kodrdriv to use git-tools (when ready)
430
-
431
- ---
432
-
433
- **Verified By**: AI Analysis
434
- **Date**: November 11, 2025
435
- **Confidence**: HIGH - No issues found in comprehensive comparison
436
-