oc-harness-setup 0.3.2 → 0.4.0
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/.docs/unwired-routing.md +16 -15
- package/AGENTS.md +105 -68
- package/CHANGELOG.md +91 -0
- package/GLOSSARY.md +46 -0
- package/LICENSE +1 -1
- package/README.md +48 -61
- package/agents/cleaner.md +86 -0
- package/agents/critic.md +79 -0
- package/agents/historian.md +92 -0
- package/agents/maintainer.md +106 -0
- package/agents/ops.md +69 -0
- package/agents/orchestrator.md +48 -18
- package/agents/researcher.md +72 -0
- package/agents/verifier.md +84 -0
- package/agents/worker.md +87 -0
- package/bin/cli.js +349 -133
- package/commands/close.md +11 -0
- package/commands/evolve.md +11 -0
- package/commands/fast.md +11 -0
- package/commands/goal.md +11 -0
- package/commands/search.md +11 -0
- package/commands/swarm.md +11 -0
- package/opencode.jsonc +42 -80
- package/package.json +13 -6
- package/reference/README.md +12 -14
- package/reference/canon.md +71 -0
- package/reference/context.md +35 -0
- package/reference/enforcement.md +6 -0
- package/reference/flow.md +19 -0
- package/reference/gates.md +23 -0
- package/reference/harness.md +15 -0
- package/reference/hygiene.md +13 -0
- package/reference/memory.md +13 -0
- package/reference/models.md +19 -24
- package/reference/phases.md +23 -0
- package/reference/repos.md +49 -0
- package/reference/tools.md +35 -0
- package/scripts/harness-doctor.ps1 +83 -0
- package/skills/close/SKILL.md +36 -0
- package/skills/evolve/SKILL.md +76 -0
- package/skills/fast/SKILL.md +36 -0
- package/skills/goal/SKILL.md +65 -0
- package/skills/search/SKILL.md +68 -0
- package/skills/swarm/SKILL.md +69 -0
- package/state-seed/lessons.md +22 -0
- package/state-seed/template.md +12 -0
- package/agents/build.md +0 -20
- package/agents/explore.md +0 -26
- package/agents/general.md +0 -19
- package/agents/plan.md +0 -29
- package/agents/reviewer.md +0 -22
- package/agents/vault.md +0 -73
- package/commands/build.md +0 -7
- package/commands/checkpoint.md +0 -7
- package/commands/code-simplify.md +0 -7
- package/commands/gauntlet.md +0 -7
- package/commands/handoff.md +0 -7
- package/commands/keeper.md +0 -7
- package/commands/kill.md +0 -11
- package/commands/plan.md +0 -7
- package/commands/retro.md +0 -15
- package/commands/review.md +0 -7
- package/commands/ship.md +0 -7
- package/commands/spec.md +0 -7
- package/commands/test.md +0 -7
- package/commands/webperf.md +0 -7
- package/reference/auto-mandate.md +0 -11
- package/reference/backup-convention.md +0 -9
- package/reference/clean-mandate.md +0 -13
- package/reference/editor-parity.md +0 -7
- package/reference/gc-scripts.md +0 -8
- package/reference/intent-routing.md +0 -14
- package/reference/lifecycle.md +0 -15
- package/reference/model-keeper.md +0 -46
- package/reference/model-test.md +0 -176
- package/reference/oc-source-map.md +0 -162
- package/reference/owner-pin.md +0 -31
- package/reference/roster.md +0 -15
- package/reference/session-scope.md +0 -9
- package/reference/session-state.md +0 -13
- package/reference/swarm.md +0 -32
- package/scripts/backup-config.ps1 +0 -42
- package/scripts/gc-branch.ps1 +0 -196
- package/scripts/gc-bump.ps1 +0 -198
- package/scripts/gc-clean.ps1 +0 -648
- package/scripts/gc-commit.ps1 +0 -143
- package/scripts/gc-merge.ps1 +0 -272
- package/scripts/gc-pr.ps1 +0 -190
- package/scripts/gc-push.ps1 +0 -111
- package/scripts/gc-read.ps1 +0 -150
- package/scripts/gc-rebase.ps1 +0 -162
- package/scripts/gc-release.ps1 +0 -225
- package/scripts/gc-stage.ps1 +0 -103
- package/scripts/gc-status.ps1 +0 -127
- package/scripts/gc-sync.ps1 +0 -65
- package/scripts/gc.core.ps1 +0 -715
- package/scripts/gc.smoke.ps1 +0 -779
- package/scripts/interrupt-session.ps1 +0 -65
- package/scripts/logbook/README.md +0 -108
- package/scripts/logbook/logbook.test.ts +0 -440
- package/scripts/logbook/logbook.ts +0 -797
- package/scripts/pirep/README.md +0 -147
- package/scripts/pirep/pirep.test.ts +0 -735
- package/scripts/pirep/pirep.ts +0 -836
- package/scripts/testflight/README.md +0 -112
- package/scripts/testflight/testflight.test.ts +0 -512
- package/scripts/testflight/testflight.ts +0 -806
- package/skills/_shared/SOURCES.md +0 -26
- package/skills/_shared/references/accessibility-checklist.md +0 -160
- package/skills/_shared/references/definition-of-done.md +0 -67
- package/skills/_shared/references/observability-checklist.md +0 -92
- package/skills/_shared/references/orchestration-patterns.md +0 -155
- package/skills/_shared/references/performance-checklist.md +0 -236
- package/skills/_shared/references/security-checklist.md +0 -245
- package/skills/_shared/references/testing-patterns.md +0 -235
- package/skills/api-and-interface-design/SKILL.md +0 -14
- package/skills/browser-testing-with-devtools/SKILL.md +0 -303
- package/skills/code-simplification/SKILL.md +0 -14
- package/skills/creative-writing/SKILL.md +0 -96
- package/skills/debugging-and-error-recovery/SKILL.md +0 -15
- package/skills/flight-deck/SKILL.md +0 -17
- package/skills/frontend-ui-engineering/SKILL.md +0 -16
- package/skills/gauntlet/SKILL.md +0 -21
- package/skills/git-ceremony/SKILL.md +0 -27
- package/skills/grilling/SKILL.md +0 -18
- package/skills/observability-and-instrumentation/SKILL.md +0 -18
- package/skills/performance-optimization/SKILL.md +0 -16
- package/skills/pilot-report/SKILL.md +0 -18
- package/skills/planning-and-task-breakdown/SKILL.md +0 -16
- package/skills/security-and-hardening/SKILL.md +0 -18
- package/skills/source-driven-development/SKILL.md +0 -16
- package/skills/spec-driven-development/SKILL.md +0 -26
- package/skills/test-driven-development/SKILL.md +0 -18
- package/skills/test-flight/SKILL.md +0 -14
- package/skills/writing-for-agents/SKILL-MECHANICS.md +0 -22
- package/skills/writing-for-agents/SKILL.md +0 -89
package/scripts/gc-stage.ps1
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
#Requires -Version 7.0
|
|
2
|
-
<#
|
|
3
|
-
.SYNOPSIS
|
|
4
|
-
Stage content with ceremony gates: add the given paths (or -All), run the
|
|
5
|
-
secret scan, report exactly what landed in the index.
|
|
6
|
-
|
|
7
|
-
.DESCRIPTION
|
|
8
|
-
The index is where ceremony violations get caught cheaply. This script adds
|
|
9
|
-
paths, then scans the newly staged files for obvious secret shapes — a hit
|
|
10
|
-
leaves the offending files UNSTAGED (working tree untouched) and exits 4
|
|
11
|
-
with the file list, so the agent can fix and retry without losing anything.
|
|
12
|
-
Nothing staged (unchanged / ignored paths) is a clean no-op, exit 0.
|
|
13
|
-
|
|
14
|
-
Repo rules win: if the repo documents its own convention, follow that
|
|
15
|
-
instead of this script.
|
|
16
|
-
|
|
17
|
-
Output contract: stdout is exactly one RESULT: <json> line with staged
|
|
18
|
-
file names and count; logs go to the console.
|
|
19
|
-
|
|
20
|
-
.PARAMETER Path
|
|
21
|
-
Files or globs to stage, relative to the repo root (or absolute). ONE path
|
|
22
|
-
or glob per -Path invocation — pwsh -File does not array-bind a comma list
|
|
23
|
-
('a,b' arrives as a single literal path). Stage many at once with -All.
|
|
24
|
-
.PARAMETER All
|
|
25
|
-
Stage everything (git add -A) instead of specific paths.
|
|
26
|
-
.PARAMETER RepoRoot
|
|
27
|
-
Repository path (defaults to the current directory); git is always pinned
|
|
28
|
-
with git -C.
|
|
29
|
-
.PARAMETER Detailed
|
|
30
|
-
Restore the step narration, ok/info lines, and raw git/gh relay the terse
|
|
31
|
-
default hides. Never affects the RESULT line, warnings, failures, or the
|
|
32
|
-
security/remediation lines.
|
|
33
|
-
.PARAMETER Quiet
|
|
34
|
-
Accepted for compatibility and now a no-op: the default is already terse.
|
|
35
|
-
-Quiet forces the gate closed and so wins if passed with -Detailed.
|
|
36
|
-
|
|
37
|
-
.EXAMPLE
|
|
38
|
-
pwsh -File scripts\gc-stage.ps1 -Path 'src/foo.ts' -Path 'docs/foo.md'
|
|
39
|
-
|
|
40
|
-
.EXAMPLE
|
|
41
|
-
pwsh -File scripts\gc-stage.ps1 -All
|
|
42
|
-
#>
|
|
43
|
-
param(
|
|
44
|
-
[string[]]$Path,
|
|
45
|
-
[switch]$All,
|
|
46
|
-
[string]$RepoRoot = (Get-Location).Path,
|
|
47
|
-
[switch]$Detailed,
|
|
48
|
-
[switch]$Quiet
|
|
49
|
-
)
|
|
50
|
-
Set-StrictMode -Version Latest
|
|
51
|
-
$ErrorActionPreference = 'Stop'
|
|
52
|
-
. (Join-Path $PSScriptRoot 'gc.core.ps1')
|
|
53
|
-
if ($Detailed) { $script:GcQuiet = $false }
|
|
54
|
-
if ($Quiet) { $script:GcQuiet = $true }
|
|
55
|
-
|
|
56
|
-
try {
|
|
57
|
-
$root = Resolve-GcRoot -Path $RepoRoot
|
|
58
|
-
Write-GcInfo "repo: $root"
|
|
59
|
-
|
|
60
|
-
if (-not $All -and -not $Path) {
|
|
61
|
-
throw [GcException]::new('give -Path <files-or-globs> or -All', $script:GcExitPre)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (-not $All) {
|
|
65
|
-
# validate every path resolves before touching the index (atomic gate)
|
|
66
|
-
foreach ($p in $Path) {
|
|
67
|
-
$joined = Join-Path $root $p
|
|
68
|
-
if ($p -match '[*?\[]') {
|
|
69
|
-
$matched = @(Get-ChildItem -Path $joined -Force -ErrorAction SilentlyContinue)
|
|
70
|
-
if ($matched.Count -eq 0) {
|
|
71
|
-
throw [GcException]::new("no files match glob '$p' (under $root)", $script:GcExitPre)
|
|
72
|
-
}
|
|
73
|
-
} elseif (-not (Test-Path -LiteralPath $joined)) {
|
|
74
|
-
throw [GcException]::new("path does not exist: $p (under $root)", $script:GcExitPre)
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
Invoke-GcGit -Root $root -Argv (@('add','--') + $Path)
|
|
78
|
-
Write-GcOk "staged $($Path -join ', ')"
|
|
79
|
-
} else {
|
|
80
|
-
Invoke-GcGit -Root $root -Argv @('add','-A')
|
|
81
|
-
Write-GcOk 'staged all changes (-All)'
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
# security gate on exactly what is now staged
|
|
85
|
-
Stop-GcOnSecrets -Root $root
|
|
86
|
-
|
|
87
|
-
$staged = @(Get-GcStagedNames -Root $root)
|
|
88
|
-
if (-not $staged) {
|
|
89
|
-
Write-GcInfo 'nothing staged — paths unchanged, ignored, or already staged'
|
|
90
|
-
Write-GcResult -Props @{ staged = @(); count = 0; action = 'no-op' }
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
$stat = Get-GcGit -Root $root -Argv @('diff','--cached','--stat')
|
|
94
|
-
Write-GcNote (($stat -join "`n"))
|
|
95
|
-
Write-GcOk "staged $($staged.Count) file(s)"
|
|
96
|
-
Write-GcResult -Props @{ staged = $staged; count = $staged.Count; action = 'staged' }
|
|
97
|
-
} catch [GcException] {
|
|
98
|
-
Write-GcFail $_.Exception.Message
|
|
99
|
-
Write-GcResult -Code $_.Exception.Code -Props @{ message = $_.Exception.Message }
|
|
100
|
-
} catch {
|
|
101
|
-
Write-GcFail "unexpected: $($_.Exception.Message)"
|
|
102
|
-
Write-GcResult -Code $script:GcExitFail -Props @{ message = $_.Exception.Message }
|
|
103
|
-
}
|
package/scripts/gc-status.ps1
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
#Requires -Version 7.0
|
|
2
|
-
<#
|
|
3
|
-
.SYNOPSIS
|
|
4
|
-
One-shot ceremony-aware repo snapshot: branch, default, staleness, index
|
|
5
|
-
state, upstream, remote, gh, open PR, checks. Read-only — an agent's first
|
|
6
|
-
call in an unfamiliar repo.
|
|
7
|
-
|
|
8
|
-
.DESCRIPTION
|
|
9
|
-
Returns a single RESULT: <json> with everything an agent needs to decide the
|
|
10
|
-
next ceremony step. Read-only: no fetch, no mutation. Every gh-backed field
|
|
11
|
-
is guarded — an unauthenticated or absent gh degrades to gh_authed=false,
|
|
12
|
-
never a failure.
|
|
13
|
-
|
|
14
|
-
Fields: repo, branch, branch_type, detached, default, clean, staged,
|
|
15
|
-
unstaged, conflicts, untracked, upstream, ahead, behind, remote, gh_authed,
|
|
16
|
-
pr (number or null), pr_state, pr_draft, pr_checks
|
|
17
|
-
('pass'|'pending'|'fail'|null), rebase_in_progress. The branch value is
|
|
18
|
-
'(detached)' when HEAD is detached.
|
|
19
|
-
|
|
20
|
-
Repo rules win: this is a read-only snapshot; a repo's own convention still
|
|
21
|
-
governs how git work happens there.
|
|
22
|
-
|
|
23
|
-
.PARAMETER RepoRoot
|
|
24
|
-
Repository path (defaults to the current directory).
|
|
25
|
-
.PARAMETER Detailed
|
|
26
|
-
Restore the step narration, ok/info lines, and raw git/gh relay the terse
|
|
27
|
-
default hides. Never affects the RESULT line, warnings, failures, or the
|
|
28
|
-
security/remediation lines.
|
|
29
|
-
.PARAMETER Quiet
|
|
30
|
-
Accepted for compatibility and now a no-op: the default is already terse.
|
|
31
|
-
-Quiet forces the gate closed and so wins if passed with -Detailed.
|
|
32
|
-
|
|
33
|
-
.EXAMPLE
|
|
34
|
-
pwsh -File scripts\gc-status.ps1
|
|
35
|
-
#>
|
|
36
|
-
param(
|
|
37
|
-
[string]$RepoRoot = (Get-Location).Path,
|
|
38
|
-
[switch]$Detailed,
|
|
39
|
-
[switch]$Quiet
|
|
40
|
-
)
|
|
41
|
-
Set-StrictMode -Version Latest
|
|
42
|
-
$ErrorActionPreference = 'Stop'
|
|
43
|
-
. (Join-Path $PSScriptRoot 'gc.core.ps1')
|
|
44
|
-
if ($Detailed) { $script:GcQuiet = $false }
|
|
45
|
-
if ($Quiet) { $script:GcQuiet = $true }
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
$root = Resolve-GcRoot -Path $RepoRoot
|
|
49
|
-
|
|
50
|
-
$branch = try { Get-GcCurrentBranch -Root $root } catch { '(detached)' }
|
|
51
|
-
$detached = ($branch -eq '(detached)')
|
|
52
|
-
$btype = if (-not $detached -and $branch -match '^([a-z]+)/') { $Matches[1] } else { $null }
|
|
53
|
-
$default = Get-GcDefaultBranch -Root $root
|
|
54
|
-
|
|
55
|
-
# one porcelain v2 call answers clean / staged / unstaged / conflicts /
|
|
56
|
-
# untracked and upstream+ahead/behind (was: status + diff --cached +
|
|
57
|
-
# rev-parse + 2x rev-list)
|
|
58
|
-
$state = Get-GcRepoState -Root $root
|
|
59
|
-
$staged = $state.Staged.Count
|
|
60
|
-
$untracked = $state.Untracked
|
|
61
|
-
$unstaged = $state.Unstaged
|
|
62
|
-
$conflicts = $state.Conflicts
|
|
63
|
-
$upstream = $state.Upstream
|
|
64
|
-
$ahead = $state.Ahead
|
|
65
|
-
$behind = $state.Behind
|
|
66
|
-
|
|
67
|
-
$remote = $null
|
|
68
|
-
try { $remote = Get-GcRemote -Root $root } catch { }
|
|
69
|
-
|
|
70
|
-
$rebaseInProgress = Test-GcRebaseInProgress -Root $root
|
|
71
|
-
|
|
72
|
-
# gh-backed fields — guarded, never fatal. The retired `gh auth status`
|
|
73
|
-
# pre-flight made this three calls (a probe + 2x pr view); one call now
|
|
74
|
-
# answers the whole PR question and its own failure is the auth probe.
|
|
75
|
-
$ghAuthed = $false; $prNumber = $null; $prState = $null; $prDraft = $null; $prChecks = $null
|
|
76
|
-
if ($remote -and -not $detached -and (Get-Command gh -ErrorAction SilentlyContinue)) {
|
|
77
|
-
try {
|
|
78
|
-
$pr = Get-GcGhJson -Root $root -Argv @('pr','view',$branch,'--json','number,state,isDraft,statusCheckRollup')
|
|
79
|
-
$ghAuthed = $true
|
|
80
|
-
$prNumber = $pr.number; $prState = $pr.state; $prDraft = $pr.isDraft
|
|
81
|
-
$rollup = @($pr.statusCheckRollup | Where-Object { $null -ne $_ })
|
|
82
|
-
if ($rollup.Count -gt 0) {
|
|
83
|
-
$verdicts = @($rollup | ForEach-Object {
|
|
84
|
-
if ($_.PSObject.Properties['status'] -and $_.status -in @('QUEUED','IN_PROGRESS')) { 'pending' }
|
|
85
|
-
elseif ($_.PSObject.Properties['state'] -and $_.state -in @('FAILURE','ERROR')) { 'fail' }
|
|
86
|
-
elseif ($_.PSObject.Properties['state'] -and $_.state -in @('PENDING','EXPECTED')) { 'pending' }
|
|
87
|
-
elseif ($_.PSObject.Properties['conclusion'] -and $_.conclusion -and $_.conclusion -notin @('SUCCESS','NEUTRAL','SKIPPED')) { 'fail' }
|
|
88
|
-
else { 'pass' }
|
|
89
|
-
})
|
|
90
|
-
$prChecks = if ($verdicts -contains 'fail') { 'fail' } elseif ($verdicts -contains 'pending') { 'pending' } else { 'pass' }
|
|
91
|
-
}
|
|
92
|
-
} catch {
|
|
93
|
-
# not logged in → gh_authed=false; any other failure (usually "no pull
|
|
94
|
-
# requests found") means authenticated with no open PR for the branch
|
|
95
|
-
$ghAuthed = -not ($_.Exception.Message -match 'gh auth login')
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
Write-GcResult -Props @{
|
|
100
|
-
repo = $root
|
|
101
|
-
branch = $branch
|
|
102
|
-
branch_type = $btype
|
|
103
|
-
detached = $detached
|
|
104
|
-
default = $default
|
|
105
|
-
clean = $state.Clean
|
|
106
|
-
staged = $staged
|
|
107
|
-
unstaged = $unstaged
|
|
108
|
-
conflicts = $conflicts
|
|
109
|
-
untracked = $untracked
|
|
110
|
-
upstream = $upstream
|
|
111
|
-
ahead = $ahead
|
|
112
|
-
behind = $behind
|
|
113
|
-
remote = $remote
|
|
114
|
-
gh_authed = $ghAuthed
|
|
115
|
-
pr = $prNumber
|
|
116
|
-
pr_state = $prState
|
|
117
|
-
pr_draft = $prDraft
|
|
118
|
-
pr_checks = $prChecks
|
|
119
|
-
rebase_in_progress = $rebaseInProgress
|
|
120
|
-
}
|
|
121
|
-
} catch [GcException] {
|
|
122
|
-
Write-GcFail $_.Exception.Message
|
|
123
|
-
Write-GcResult -Code $_.Exception.Code -Props @{ message = $_.Exception.Message }
|
|
124
|
-
} catch {
|
|
125
|
-
Write-GcFail "unexpected: $($_.Exception.Message)"
|
|
126
|
-
Write-GcResult -Code $script:GcExitFail -Props @{ message = $_.Exception.Message }
|
|
127
|
-
}
|
package/scripts/gc-sync.ps1
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
#Requires -Version 7.0
|
|
2
|
-
<#
|
|
3
|
-
.SYNOPSIS
|
|
4
|
-
Sync the default branch to its remote head: fetch origin, then fast-forward
|
|
5
|
-
only. Standalone ceremony §1 — use it at session start and before a rebase.
|
|
6
|
-
|
|
7
|
-
.DESCRIPTION
|
|
8
|
-
The pull step of the ceremony as a stand-alone script. Fetch + fast-forward
|
|
9
|
-
the default branch; never manufactures a merge; refuses to switch branches
|
|
10
|
-
when the tree is dirty (commit or stash first). A repo with no origin is a
|
|
11
|
-
clean no-op ('skipped-local'). Leaves you on the default branch when a
|
|
12
|
-
fast-forward was needed, exactly where you were otherwise.
|
|
13
|
-
|
|
14
|
-
Repo rules win: if the repo documents its own update convention, follow
|
|
15
|
-
that instead of this script.
|
|
16
|
-
|
|
17
|
-
.PARAMETER RepoRoot
|
|
18
|
-
Repository path (defaults to the current directory); git is always pinned
|
|
19
|
-
with git -C.
|
|
20
|
-
.PARAMETER Detailed
|
|
21
|
-
Restore the step narration, ok/info lines, and raw git/gh relay the terse
|
|
22
|
-
default hides. Never affects the RESULT line, warnings, failures, or the
|
|
23
|
-
security/remediation lines.
|
|
24
|
-
.PARAMETER Quiet
|
|
25
|
-
Accepted for compatibility and now a no-op: the default is already terse.
|
|
26
|
-
-Quiet forces the gate closed and so wins if passed with -Detailed.
|
|
27
|
-
|
|
28
|
-
.EXAMPLE
|
|
29
|
-
pwsh -File scripts\gc-sync.ps1
|
|
30
|
-
#>
|
|
31
|
-
param(
|
|
32
|
-
[string]$RepoRoot = (Get-Location).Path,
|
|
33
|
-
[switch]$Detailed,
|
|
34
|
-
[switch]$Quiet
|
|
35
|
-
)
|
|
36
|
-
Set-StrictMode -Version Latest
|
|
37
|
-
$ErrorActionPreference = 'Stop'
|
|
38
|
-
. (Join-Path $PSScriptRoot 'gc.core.ps1')
|
|
39
|
-
if ($Detailed) { $script:GcQuiet = $false }
|
|
40
|
-
if ($Quiet) { $script:GcQuiet = $true }
|
|
41
|
-
|
|
42
|
-
try {
|
|
43
|
-
$root = Resolve-GcRoot -Path $RepoRoot
|
|
44
|
-
Write-GcInfo "repo: $root"
|
|
45
|
-
|
|
46
|
-
$default = Get-GcDefaultBranch -Root $root
|
|
47
|
-
# branch only — targeted rev-parse, no worktree walk (the state this reads
|
|
48
|
-
# would be dropped by the fetch in Sync-GcDefaultBranch anyway).
|
|
49
|
-
$cur = try { Get-GcCurrentBranch -Root $root -Targeted } catch { $null }
|
|
50
|
-
if (-not (Test-GcRef -Root $root -Ref "refs/heads/$default")) {
|
|
51
|
-
Write-GcOk "default branch '$default' is unborn (no commits) — nothing to sync"
|
|
52
|
-
Write-GcResult -Props @{ default = $default; action = 'unborn' }
|
|
53
|
-
}
|
|
54
|
-
$action = Sync-GcDefaultBranch -Root $root -Default $default -CurrentBranch $cur
|
|
55
|
-
|
|
56
|
-
$sha = (Get-GcGit -Root $root -Argv @('rev-parse','--short',"$default") | Select-Object -First 1).Trim()
|
|
57
|
-
Write-GcOk "default branch ($default) @ $sha — sync: $action"
|
|
58
|
-
Write-GcResult -Props @{ default = $default; sha = $sha; action = $action }
|
|
59
|
-
} catch [GcException] {
|
|
60
|
-
Write-GcFail $_.Exception.Message
|
|
61
|
-
Write-GcResult -Code $_.Exception.Code -Props @{ message = $_.Exception.Message }
|
|
62
|
-
} catch {
|
|
63
|
-
Write-GcFail "unexpected: $($_.Exception.Message)"
|
|
64
|
-
Write-GcResult -Code $script:GcExitFail -Props @{ message = $_.Exception.Message }
|
|
65
|
-
}
|