@danmoisan/drm-copilot-mcp 1.0.11 → 1.0.13

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.
@@ -3,20 +3,25 @@
3
3
  Creates a git worktree and launches a Claude CLI session inside it as a background process.
4
4
 
5
5
  .DESCRIPTION
6
- Creates a new git worktree at a timestamped path derived from the destination
7
- repository's basename, branches it off the current HEAD, and starts the Claude CLI
8
- non-blocking via Start-Process.
6
+ Creates a new git worktree under a per-repository grouping directory and branches it
7
+ off the current HEAD, then starts the Claude CLI non-blocking via Start-Process.
8
+ The worktree is created at the nested path
9
+ <WorktreeParentPath>/<repoName>-wt/<yyyy-MM-ddTHH-mm>, where <repoName>-wt is a single
10
+ grouping directory that holds every timestamped worktree for the repository. The
11
+ grouping directory is created (idempotently) before 'git worktree add' runs.
9
12
  Writes WorktreePath, ProcessId, and LogFile to stdout before returning to the caller.
10
13
 
11
14
  .PARAMETER Objective
12
15
  Prompt text passed to the Claude CLI as its primary argument.
13
16
 
14
17
  .PARAMETER WorktreeParentPath
15
- Parent directory for the new worktree. Defaults to the parent of the repo root.
18
+ Parent directory for the new worktree. Defaults to the parent of the repo root. The
19
+ grouping directory <repoName>-wt is created beneath this path.
16
20
 
17
21
  .PARAMETER BranchName
18
- Explicit branch name for the new worktree. When omitted, defaults to
19
- <repoName>-wt-<timestamp>.
22
+ Explicit branch name for the new worktree. When omitted, defaults to the flat name
23
+ <repoName>-wt-<yyyy-MM-ddTHH-mm>. The branch name is never nested with a slash even
24
+ though the on-disk worktree path is nested.
20
25
  #>
21
26
  [CmdletBinding(SupportsShouldProcess)]
22
27
  param(
@@ -37,7 +42,21 @@ function Get-WorktreeTimestamp {
37
42
  )
38
43
 
39
44
  $now = & $GetDateTime
40
- return $now.ToString('yyyy-MM-dd-HH-mm')
45
+ return $now.ToString('yyyy-MM-ddTHH-mm')
46
+ }
47
+
48
+ function Get-WorktreeGroupDirectory {
49
+ [CmdletBinding()]
50
+ [OutputType([string])]
51
+ param(
52
+ [Parameter(Mandatory = $true)]
53
+ [string] $WorktreeParentPath,
54
+
55
+ [Parameter(Mandatory = $true)]
56
+ [string] $RepoName
57
+ )
58
+
59
+ return "$WorktreeParentPath/$RepoName-wt"
41
60
  }
42
61
 
43
62
  function Build-WorktreePath {
@@ -54,7 +73,8 @@ function Build-WorktreePath {
54
73
  [string] $RepoName
55
74
  )
56
75
 
57
- return "$WorktreeParentPath/$RepoName-wt-$Timestamp"
76
+ $groupDirectory = Get-WorktreeGroupDirectory -WorktreeParentPath $WorktreeParentPath -RepoName $RepoName
77
+ return "$groupDirectory/$Timestamp"
58
78
  }
59
79
 
60
80
  function Build-BranchName {
@@ -77,6 +97,23 @@ function Build-BranchName {
77
97
  return "$RepoName-wt-$Timestamp"
78
98
  }
79
99
 
100
+ function New-WorktreeParentDirectory {
101
+ [CmdletBinding(SupportsShouldProcess = $true)]
102
+ param(
103
+ [Parameter(Mandatory = $true)]
104
+ [string] $GroupDirectory,
105
+
106
+ [scriptblock] $NewDirectory = { param([string] $Path) New-Item -ItemType Directory -Force -Path $Path | Out-Null }
107
+ )
108
+
109
+ # -Force makes creation idempotent (a no-op when the directory already exists) and
110
+ # creates any missing leading directories. The filesystem action is isolated behind
111
+ # the injectable $NewDirectory seam so it can be mocked without touching disk.
112
+ if ($PSCmdlet.ShouldProcess($GroupDirectory, 'Create worktree grouping directory')) {
113
+ & $NewDirectory $GroupDirectory
114
+ }
115
+ }
116
+
80
117
  function Test-PreconditionsMet {
81
118
  [CmdletBinding()]
82
119
  param(
@@ -192,6 +229,14 @@ function Write-LaunchResult {
192
229
  Write-Output "StderrLog: $StderrLog"
193
230
  }
194
231
 
232
+ # When dot-sourced (for example by the Pester test suite, to resolve the functions
233
+ # above for coverage attribution), define the functions but do not execute the
234
+ # top-level script body. Direct invocation leaves $MyInvocation.InvocationName as the
235
+ # script name (not '.'), so the body runs unchanged and production behavior is preserved.
236
+ if ($MyInvocation.InvocationName -eq '.') {
237
+ return
238
+ }
239
+
195
240
  # ---------------------------------------------------------------------------
196
241
  # Script body
197
242
  # ---------------------------------------------------------------------------
@@ -215,6 +260,11 @@ catch {
215
260
  exit 1
216
261
  }
217
262
 
263
+ # Ensure the <repoName>-wt grouping directory exists before 'git worktree add' runs.
264
+ # Creation is idempotent, so re-running for an existing group directory is a no-op.
265
+ $groupDirectory = Get-WorktreeGroupDirectory -WorktreeParentPath $WorktreeParentPath -RepoName $repoName
266
+ New-WorktreeParentDirectory -GroupDirectory $groupDirectory
267
+
218
268
  if ($PSCmdlet.ShouldProcess($worktreePath, 'git worktree add')) {
219
269
  Invoke-GitWorktreeAdd -WorktreePath $worktreePath -BranchName $resolvedBranch
220
270
  }
@@ -229,4 +279,3 @@ $stdoutLog = "$worktreePath/claude-session.stdout.log"
229
279
  $stderrLog = "$worktreePath/claude-session.stderr.log"
230
280
 
231
281
  Write-LaunchResult -WorktreePath $worktreePath -ProcessId $processId -StdoutLog $stdoutLog -StderrLog $stderrLog
232
-
@@ -1,43 +0,0 @@
1
- # <epic-name> - Initiative Overview
2
-
3
- - Issue: #<tracking-issue>
4
- - Owner: <name>
5
- - Last Updated: YYYY-MM-DD
6
-
7
- ## Goal & Outcomes
8
-
9
- State the objective and the measurable outcomes for this initiative. Keep it user/impact oriented, not implementation detail.
10
-
11
- ## Decomposition (Child Features/Workstreams)
12
-
13
- - <Workstream A> (Issue #<id>) - `../<child-folder>/`
14
- - <Workstream B> (Issue #<id>) - `../<child-folder>/`
15
- - <Workstream C> (Issue #<id>) - `../<child-folder>/`
16
-
17
- Dependencies: Describe ordering or coupling between child items (e.g., A → B → C).
18
-
19
- ## Cross-Cutting Constraints & Assumptions
20
-
21
- - Shared behaviors/algorithms that must stay aligned
22
- - Determinism/performance/compatibility guarantees
23
- - Data/artifact locations, formats, or tooling expectations
24
- - Compliance/legal/licensing boundaries
25
- - Quality gates (tests/lint/type-checks) required across all children
26
-
27
- ## Milestones & Status
28
-
29
- - M1 <Name> - <Not started | In progress | Done> (criteria)
30
- - M2 <Name> - <Not started | In progress | Done>
31
- - M3 <Name> - <Not started | In progress | Done>
32
- - CLI/UX alignment or other cross-initiative milestones
33
-
34
- ## Initiative-Level Validation
35
-
36
- - End-to-end: <Describe end-to-end validation that proves the initiative outcome>
37
- - Integration: <Cross-layer checks to ensure child workstreams fit together>
38
- - Determinism/Regression: <What needs to remain stable; how to detect drift>
39
- - Error handling/Resilience: <Key failure modes and expected handling>
40
-
41
- ## Notes / Follow-Ups
42
-
43
- Capture decisions, risks, and future adjustments to decomposition/milestones.