@getsolaris/copse 1.0.3 → 1.1.1

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/README.ko.md CHANGED
@@ -282,6 +282,8 @@ copse init --skill claude-code
282
282
  ```bash
283
283
  copse add feature/login # 필요하면 브랜치를 만들고 worktree 생성
284
284
  copse add feature/login --base main # 새 브랜치는 main에서 시작
285
+ copse add feature/login --base origin/main # origin/main 을 자동 fetch 후 분기 (아래 참고)
286
+ copse add feature/login --base origin/main --no-fetch # 자동 fetch 건너뛰기
285
287
  copse add existing-branch # 기존 브랜치로 worktree 생성
286
288
 
287
289
  # 모노레포: 포커스 패키지와 함께 생성
@@ -296,6 +298,33 @@ copse add --pr 123
296
298
  copse add --pr 456 --template review
297
299
  ```
298
300
 
301
+ #### Remote 인식 base + 자동 fetch
302
+
303
+ `--base` (또는 config 의 `defaults.base`) 값이 `<remote>/<branch>` 패턴이고 `<remote>` 가 실제로 등록된
304
+ git remote 이면, `copse add` 는 worktree 를 만들기 전에 `git fetch <remote> <branch>` 를 먼저 실행합니다.
305
+ stale 한 remote-tracking ref 에서 실수로 분기하는 걸 막아줍니다.
306
+
307
+ - `--base main`, `--base develop`, `--base HEAD`, `--base <sha>` → fetch 없음 (local ref).
308
+ - `--base origin/main`, `--base upstream/release/v2` → 해당 브랜치만 fetch 후 분기.
309
+ - `--base fork/main` 인데 `fork` 가 등록된 remote 가 아님 → local ref 로 취급 (fetch 없음).
310
+ - Fetch 실패 (오프라인, 인증 오류 등) 시 경고만 출력하고 local copy 로 계속 진행합니다.
311
+ - 대상 브랜치가 이미 로컬에 존재하면 자동 fetch 는 건너뜁니다 (`--base` 는 새 브랜치에만 의미).
312
+
313
+ `--no-fetch` 로 자동 fetch 를 강제로 건너뛸 수 있습니다. 매번 `copse add` 에서 remote-aware base 를
314
+ 기본으로 하고 싶으면 `defaults.base` 를 설정하세요:
315
+
316
+ ```json
317
+ {
318
+ "version": 1,
319
+ "defaults": {
320
+ "base": "origin/main"
321
+ }
322
+ }
323
+ ```
324
+
325
+ Base 우선순위 (높은 쪽이 이김): `--base` 플래그 → `template.base` → repo 별 `repos[].base` →
326
+ `defaults.base` → git `HEAD`.
327
+
299
328
  ### `copse doctor`
300
329
 
301
330
  ```bash
@@ -656,6 +685,7 @@ copse: created default config at /Users/you/.config/copse/config.json
656
685
  | `linkFiles` | `string[]` | `[]` | 심볼릭 링크할 파일/디렉토리 (디스크 절약) |
657
686
  | `postCreate` | `string[]` | `[]` | worktree 생성 후 실행할 커맨드 |
658
687
  | `postRemove` | `string[]` | `[]` | worktree 제거 전 실행할 커맨드 |
688
+ | `base` | `string` | — | 새 브랜치의 기본 base ref. 값이 등록된 remote 의 `<remote>/<branch>` 형태이면 `copse add` 가 `git fetch <remote> <branch>` 를 자동 실행 |
659
689
 
660
690
  #### `repos[]`
661
691
 
@@ -669,6 +699,7 @@ copse: created default config at /Users/you/.config/copse/config.json
669
699
  | `linkFiles` | `string[]` | 아니오 | 기본 링크 파일 오버라이드 |
670
700
  | `postCreate` | `string[]` | 아니오 | 기본 postCreate 훅 오버라이드 |
671
701
  | `postRemove` | `string[]` | 아니오 | 기본 postRemove 훅 오버라이드 |
702
+ | `base` | `string` | 아니오 | 기본 base ref 오버라이드 |
672
703
  | `monorepo` | `object` | 아니오 | 모노레포 지원 설정 |
673
704
 
674
705
  #### `workspaces[]`
package/README.md CHANGED
@@ -299,6 +299,8 @@ Every commit runs `validateConfig` before writing. Invalid input surfaces as an
299
299
  ```bash
300
300
  copse add feature/login # Create branch if needed + worktree
301
301
  copse add feature/login --base main # New branches start from main
302
+ copse add feature/login --base origin/main # Auto-fetches origin/main first (see below)
303
+ copse add feature/login --base origin/main --no-fetch # Skip auto-fetch
302
304
  copse add existing-branch # Worktree for existing branch
303
305
 
304
306
  # Monorepo: create with focus packages
@@ -313,6 +315,33 @@ copse add --pr 123
313
315
  copse add --pr 456 --template review
314
316
  ```
315
317
 
318
+ #### Remote-aware base + auto-fetch
319
+
320
+ When `--base` (or `defaults.base` in config) matches `<remote>/<branch>` and `<remote>` is a
321
+ known git remote, `copse add` runs `git fetch <remote> <branch>` before creating the worktree.
322
+ This prevents accidentally branching from a stale local copy of a remote-tracking ref.
323
+
324
+ - `--base main`, `--base develop`, `--base HEAD`, `--base <sha>` → no fetch (local ref).
325
+ - `--base origin/main`, `--base upstream/release/v2` → fetch that specific branch, then branch from it.
326
+ - `--base fork/main` when `fork` is not a configured remote → treated as a local ref (no fetch).
327
+ - Fetch failures (offline, auth errors) print a warning and continue with the local copy.
328
+ - Auto-fetch is skipped when the target branch already exists locally (`--base` only matters for new branches).
329
+
330
+ Pass `--no-fetch` to skip the auto-fetch unconditionally. Set `defaults.base` to make
331
+ remote-aware base the default for every `copse add`:
332
+
333
+ ```json
334
+ {
335
+ "version": 1,
336
+ "defaults": {
337
+ "base": "origin/main"
338
+ }
339
+ }
340
+ ```
341
+
342
+ Base resolution order (highest wins): `--base` flag → `template.base` → per-repo
343
+ `repos[].base` → `defaults.base` → git `HEAD`.
344
+
316
345
  ### `copse doctor`
317
346
 
318
347
  ```bash
@@ -673,6 +702,7 @@ All repos inherit these unless overridden.
673
702
  | `linkFiles` | `string[]` | `[]` | Files/dirs to symlink (saves disk) |
674
703
  | `postCreate` | `string[]` | `[]` | Commands to run after worktree creation |
675
704
  | `postRemove` | `string[]` | `[]` | Commands to run before worktree removal |
705
+ | `base` | `string` | — | Default base ref for new branches. If it matches `<remote>/<branch>` of a known remote, `copse add` auto-runs `git fetch <remote> <branch>` first |
676
706
 
677
707
  #### `repos[]`
678
708
 
@@ -686,6 +716,7 @@ Per-repo overrides. Each entry requires `path`.
686
716
  | `linkFiles` | `string[]` | No | Override default link files |
687
717
  | `postCreate` | `string[]` | No | Override default post-create hooks |
688
718
  | `postRemove` | `string[]` | No | Override default post-remove hooks |
719
+ | `base` | `string` | No | Override default base ref |
689
720
  | `monorepo` | `object` | No | Monorepo support config |
690
721
 
691
722
  #### `workspaces[]`