Moves all Mosaic framework runtime files from the separate bootstrap repo into the monorepo as canonical source. The @mosaic/mosaic npm package now ships the complete framework — bin scripts, runtime configs, tools, and templates — enabling standalone installation via npm install. Structure: packages/mosaic/framework/ ├── bin/ 28 CLI scripts (mosaic, mosaic-doctor, mosaic-sync-skills, etc.) ├── runtime/ Runtime adapters (claude, codex, opencode, pi, mcp) ├── tools/ Shell tooling (git, prdy, orchestrator, quality, etc.) ├── templates/ Agent and repo templates ├── defaults/ Default identity files (AGENTS.md, STANDARDS.md, SOUL.md, etc.) ├── install.sh Legacy bash installer └── remote-install.sh One-liner remote installer Key files with Pi support and recent fixes: - bin/mosaic: launch_pi() with skills-local loop - bin/mosaic-doctor: --fix auto-wiring for all 4 harnesses - bin/mosaic-sync-skills: Pi as 4th link target, symlink-aware find - bin/mosaic-link-runtime-assets: Pi settings.json patching - bin/mosaic-migrate-local-skills: Pi skill roots, symlink find - runtime/pi/RUNTIME.md + mosaic-extension.ts Package ships 251 framework files in the npm tarball (278KB compressed).
99 lines
3.0 KiB
PowerShell
Executable File
99 lines
3.0 KiB
PowerShell
Executable File
# pr-merge.ps1 - Merge pull requests on Gitea or GitHub
|
|
# Usage: .\pr-merge.ps1 -Number PR_NUMBER [-Method squash] [-DeleteBranch]
|
|
|
|
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Mandatory=$true)]
|
|
[Alias("n")]
|
|
[int]$Number,
|
|
|
|
[Alias("m")]
|
|
[string]$Method = "squash",
|
|
|
|
[Alias("d")]
|
|
[switch]$DeleteBranch,
|
|
|
|
[switch]$SkipQueueGuard,
|
|
|
|
[Alias("h")]
|
|
[switch]$Help
|
|
)
|
|
|
|
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
. "$ScriptDir\detect-platform.ps1"
|
|
|
|
function Show-Usage {
|
|
@"
|
|
Usage: pr-merge.ps1 [OPTIONS]
|
|
|
|
Merge a pull request on the current repository (Gitea or GitHub).
|
|
|
|
Options:
|
|
-Number, -n NUMBER PR number to merge (required)
|
|
-Method, -m METHOD Merge method: squash only (default: squash)
|
|
-DeleteBranch, -d Delete the head branch after merge
|
|
-SkipQueueGuard Skip CI queue guard wait before merge
|
|
-Help, -h Show this help message
|
|
|
|
Examples:
|
|
.\pr-merge.ps1 -n 42 # Merge PR #42
|
|
.\pr-merge.ps1 -n 42 -m squash # Squash merge
|
|
.\pr-merge.ps1 -n 42 -d # Squash merge and delete branch
|
|
"@
|
|
exit 1
|
|
}
|
|
|
|
if ($Help) {
|
|
Show-Usage
|
|
}
|
|
|
|
if ($Method -ne "squash") {
|
|
Write-Error "Mosaic policy enforces squash merge only. Received '$Method'."
|
|
exit 1
|
|
}
|
|
|
|
$platform = Get-GitPlatform
|
|
|
|
switch ($platform) {
|
|
"github" {
|
|
$baseRef = (& gh pr view $Number --json baseRefName --jq ".baseRefName").Trim()
|
|
if ($baseRef -ne "main") {
|
|
Write-Error "Mosaic policy allows merges only for PRs targeting 'main' (found '$baseRef')."
|
|
exit 1
|
|
}
|
|
|
|
if (-not $SkipQueueGuard) {
|
|
$timeout = if ($env:MOSAIC_CI_QUEUE_TIMEOUT_SEC) { [int]$env:MOSAIC_CI_QUEUE_TIMEOUT_SEC } else { 900 }
|
|
$interval = if ($env:MOSAIC_CI_QUEUE_POLL_SEC) { [int]$env:MOSAIC_CI_QUEUE_POLL_SEC } else { 15 }
|
|
& "$ScriptDir\ci-queue-wait.ps1" -Purpose merge -Branch $baseRef -TimeoutSeconds $timeout -IntervalSeconds $interval
|
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
}
|
|
|
|
$cmd = @("gh", "pr", "merge", $Number, "--squash")
|
|
if ($DeleteBranch) { $cmd += "--delete-branch" }
|
|
& $cmd[0] $cmd[1..($cmd.Length-1)]
|
|
}
|
|
"gitea" {
|
|
if (-not $SkipQueueGuard) {
|
|
$timeout = if ($env:MOSAIC_CI_QUEUE_TIMEOUT_SEC) { [int]$env:MOSAIC_CI_QUEUE_TIMEOUT_SEC } else { 900 }
|
|
$interval = if ($env:MOSAIC_CI_QUEUE_POLL_SEC) { [int]$env:MOSAIC_CI_QUEUE_POLL_SEC } else { 15 }
|
|
& "$ScriptDir\ci-queue-wait.ps1" -Purpose merge -Branch "main" -TimeoutSeconds $timeout -IntervalSeconds $interval
|
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
}
|
|
|
|
$cmd = @("tea", "pr", "merge", $Number, "--style", "squash")
|
|
|
|
if ($DeleteBranch) {
|
|
Write-Warning "Branch deletion after merge may need to be done separately with tea"
|
|
}
|
|
|
|
& $cmd[0] $cmd[1..($cmd.Length-1)]
|
|
}
|
|
default {
|
|
Write-Error "Could not detect git platform"
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
Write-Host "PR #$Number merged successfully"
|