resulgit 1.0.15 → 1.0.17

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.
Files changed (3) hide show
  1. package/README.md +7 -4
  2. package/package.json +1 -1
  3. package/resulgit.js +31 -3
package/README.md CHANGED
@@ -48,10 +48,13 @@ resulgit <command> [options]
48
48
  ### Branch Operations
49
49
 
50
50
  - `resulgit branch list` - List all branches
51
- - `resulgit branch create --name <branch> [--base <branch>]` - Create new branch
52
- - `resulgit branch delete --name <branch>` - Delete a branch
53
- - `resulgit switch --branch <name>` - Switch to a branch
54
- - `resulgit checkout --branch <name>` - Checkout a branch
51
+ - `resulgit branch create <name>` - Create new branch (simple)
52
+ - `resulgit branch create <name> --base <branch>` - Create from specific base
53
+ - `resulgit branch delete <name>` - Delete a branch
54
+ - `resulgit switch <branch>` - Switch to a branch
55
+ - `resulgit switch -c <branch>` - Create and switch to new branch
56
+ - `resulgit checkout <branch>` - Checkout a branch
57
+ - `resulgit merge <branch>` - Merge a branch into current
55
58
 
56
59
  ### File Operations
57
60
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resulgit",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "A powerful CLI tool for version control system operations - clone, commit, push, pull, merge, branch management, and more",
5
5
  "main": "resulgit.js",
6
6
  "bin": {
package/resulgit.js CHANGED
@@ -44,13 +44,15 @@ function parseArgs(argv) {
44
44
  const key = t.slice(1)
45
45
  const val = tokens[i + 1] && !tokens[i + 1].startsWith('-') ? tokens[++i] : 'true'
46
46
  opts[key] = val
47
- } else if (cmd.length < 2) {
47
+ } else if (cmd.length < 3) {
48
+ // Allow up to 3 positional args: e.g. 'branch create DevBranch'
48
49
  cmd.push(t)
49
50
  }
50
51
  }
51
52
  // Map short flags to long flags
52
53
  if (opts.m && !opts.message) { opts.message = opts.m; delete opts.m }
53
54
  if (opts.a && !opts.all) { opts.all = opts.a; delete opts.a }
55
+ if (opts.b && !opts.branch) { opts.branch = opts.b; delete opts.b }
54
56
  return { cmd, opts }
55
57
  }
56
58
 
@@ -1406,15 +1408,29 @@ async function cmdPush(opts) {
1406
1408
  const merged = {}
1407
1409
  const paths = new Set([...Object.keys(base), ...Object.keys(remote.files), ...Object.keys(local).map(k => k)])
1408
1410
  spinnerUpdate(spinner, 'Merging changes...')
1411
+
1412
+ // Helper to check if content has unresolved conflict markers
1413
+ const hasConflictMarkers = (content) => {
1414
+ if (!content) return false
1415
+ return content.includes('<<<<<<<') && content.includes('=======') && content.includes('>>>>>>>')
1416
+ }
1417
+
1409
1418
  for (const p of paths) {
1410
1419
  const b = p in base ? base[p] : null
1411
1420
  const r = p in remote.files ? remote.files[p] : null
1412
1421
  const l = p in local ? local[p].content : null
1413
1422
  const changedLocal = String(l) !== String(b)
1414
1423
  const changedRemote = String(r) !== String(b)
1415
- if (changedLocal && changedRemote && String(l) !== String(r)) {
1424
+
1425
+ // Check if local file has conflict markers (unresolved)
1426
+ if (l && hasConflictMarkers(l)) {
1416
1427
  const line = firstDiffLine(l || '', r || '')
1417
- conflicts.push({ path: p, line })
1428
+ conflicts.push({ path: p, line, reason: 'Unresolved conflict markers in file' })
1429
+ } else if (changedLocal && changedRemote && String(l) !== String(r)) {
1430
+ // Both changed and different - but if local is the "resolved" version, use it
1431
+ // This happens when user resolved a conflict and is pushing the resolution
1432
+ // The local version wins if it doesn't have conflict markers
1433
+ if (l !== null) merged[p] = l
1418
1434
  } else if (changedLocal && !changedRemote) {
1419
1435
  // Local changed, use local version
1420
1436
  if (l !== null) merged[p] = l
@@ -3340,10 +3356,18 @@ async function main() {
3340
3356
  return
3341
3357
  }
3342
3358
  if (cmd[0] === 'branch') {
3359
+ // Support positional: 'branch create DevBranch' or 'branch delete DevBranch'
3360
+ if ((cmd[1] === 'create' || cmd[1] === 'delete') && cmd[2] && !opts.name) {
3361
+ opts.name = cmd[2]
3362
+ }
3343
3363
  await cmdBranch(cmd[1], opts)
3344
3364
  return
3345
3365
  }
3346
3366
  if (cmd[0] === 'switch') {
3367
+ // Support positional: 'switch main' instead of 'switch --branch main'
3368
+ if (cmd[1] && !cmd[1].startsWith('-') && !opts.branch) {
3369
+ opts.branch = cmd[1]
3370
+ }
3347
3371
  await cmdSwitch(opts)
3348
3372
  return
3349
3373
  }
@@ -3356,6 +3380,10 @@ async function main() {
3356
3380
  return
3357
3381
  }
3358
3382
  if (cmd[0] === 'merge') {
3383
+ // Support positional: 'merge DevBranch' instead of 'merge --branch DevBranch'
3384
+ if (cmd[1] && !cmd[1].startsWith('-') && !opts.branch) {
3385
+ opts.branch = cmd[1]
3386
+ }
3359
3387
  await cmdMerge(opts)
3360
3388
  return
3361
3389
  }