@bradygaster/squad-sdk 0.9.0 → 0.9.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.md +296 -296
- package/dist/agents/history-shadow.js +30 -30
- package/dist/build/github-dist.js +42 -42
- package/dist/config/init.js +173 -173
- package/dist/sharing/consult.js +78 -78
- package/package.json +1 -1
- package/templates/casting/Futurama.json +9 -9
- package/templates/casting-history.json +4 -4
- package/templates/casting-policy.json +37 -37
- package/templates/casting-reference.md +104 -104
- package/templates/casting-registry.json +3 -3
- package/templates/ceremonies.md +41 -41
- package/templates/charter.md +53 -53
- package/templates/constraint-tracking.md +38 -38
- package/templates/cooperative-rate-limiting.md +229 -229
- package/templates/copilot-instructions.md +46 -46
- package/templates/history.md +10 -10
- package/templates/identity/now.md +9 -9
- package/templates/identity/wisdom.md +15 -15
- package/templates/issue-lifecycle.md +412 -412
- package/templates/keda-scaler.md +164 -164
- package/templates/machine-capabilities.md +74 -74
- package/templates/mcp-config.md +90 -90
- package/templates/multi-agent-format.md +28 -28
- package/templates/plugin-marketplace.md +49 -49
- package/templates/ralph-circuit-breaker.md +313 -313
- package/templates/raw-agent-output.md +37 -37
- package/templates/roster.md +60 -60
- package/templates/routing.md +39 -39
- package/templates/run-output.md +50 -50
- package/templates/schedule.json +19 -19
- package/templates/scribe-charter.md +119 -119
- package/templates/skill.md +24 -24
- package/templates/skills/agent-collaboration/SKILL.md +42 -42
- package/templates/skills/agent-conduct/SKILL.md +24 -24
- package/templates/skills/architectural-proposals/SKILL.md +151 -151
- package/templates/skills/ci-validation-gates/SKILL.md +84 -84
- package/templates/skills/cli-wiring/SKILL.md +47 -47
- package/templates/skills/client-compatibility/SKILL.md +89 -89
- package/templates/skills/cross-squad/SKILL.md +114 -114
- package/templates/skills/distributed-mesh/SKILL.md +287 -287
- package/templates/skills/distributed-mesh/mesh.json.example +30 -30
- package/templates/skills/distributed-mesh/sync-mesh.ps1 +111 -111
- package/templates/skills/distributed-mesh/sync-mesh.sh +104 -104
- package/templates/skills/docs-standards/SKILL.md +71 -71
- package/templates/skills/economy-mode/SKILL.md +114 -114
- package/templates/skills/external-comms/SKILL.md +329 -329
- package/templates/skills/gh-auth-isolation/SKILL.md +183 -183
- package/templates/skills/git-workflow/SKILL.md +204 -204
- package/templates/skills/github-multi-account/SKILL.md +95 -95
- package/templates/skills/history-hygiene/SKILL.md +36 -36
- package/templates/skills/humanizer/SKILL.md +105 -105
- package/templates/skills/init-mode/SKILL.md +102 -102
- package/templates/skills/model-selection/SKILL.md +117 -117
- package/templates/skills/nap/SKILL.md +24 -24
- package/templates/skills/personal-squad/SKILL.md +57 -57
- package/templates/skills/project-conventions/SKILL.md +56 -56
- package/templates/skills/release-process/SKILL.md +423 -423
- package/templates/skills/reskill/SKILL.md +92 -92
- package/templates/skills/reviewer-protocol/SKILL.md +79 -79
- package/templates/skills/secret-handling/SKILL.md +200 -200
- package/templates/skills/session-recovery/SKILL.md +155 -155
- package/templates/skills/squad-conventions/SKILL.md +69 -69
- package/templates/skills/test-discipline/SKILL.md +37 -37
- package/templates/skills/windows-compatibility/SKILL.md +74 -74
- package/templates/workflows/squad-ci.yml +24 -24
- package/templates/workflows/squad-docs.yml +54 -54
- package/templates/workflows/squad-heartbeat.yml +171 -171
- package/templates/workflows/squad-insider-release.yml +61 -61
- package/templates/workflows/squad-issue-assign.yml +161 -161
- package/templates/workflows/squad-label-enforce.yml +181 -181
- package/templates/workflows/squad-preview.yml +55 -55
- package/templates/workflows/squad-promote.yml +120 -120
- package/templates/workflows/squad-release.yml +77 -77
- package/templates/workflows/squad-triage.yml +260 -260
- package/templates/workflows/sync-squad-labels.yml +169 -169
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
# sync-mesh.ps1 — Materialize remote squad state locally
|
|
2
|
-
#
|
|
3
|
-
# Reads mesh.json, fetches remote squads into local directories.
|
|
4
|
-
# Run before agent reads. No daemon. No service. ~40 lines.
|
|
5
|
-
#
|
|
6
|
-
# Usage: .\sync-mesh.ps1 [path-to-mesh.json]
|
|
7
|
-
# .\sync-mesh.ps1 -Init [path-to-mesh.json]
|
|
8
|
-
# Requires: git
|
|
9
|
-
param(
|
|
10
|
-
[switch]$Init,
|
|
11
|
-
[string]$MeshJson = "mesh.json"
|
|
12
|
-
)
|
|
13
|
-
$ErrorActionPreference = "Stop"
|
|
14
|
-
|
|
15
|
-
# Handle -Init mode
|
|
16
|
-
if ($Init) {
|
|
17
|
-
if (-not (Test-Path $MeshJson)) {
|
|
18
|
-
Write-Host "❌ $MeshJson not found"
|
|
19
|
-
exit 1
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
Write-Host "🚀 Initializing mesh state repository..."
|
|
23
|
-
$config = Get-Content $MeshJson -Raw | ConvertFrom-Json
|
|
24
|
-
$squads = $config.squads.PSObject.Properties.Name
|
|
25
|
-
|
|
26
|
-
# Create squad directories with placeholder SUMMARY.md
|
|
27
|
-
foreach ($squad in $squads) {
|
|
28
|
-
if (-not (Test-Path $squad)) {
|
|
29
|
-
New-Item -ItemType Directory -Path $squad | Out-Null
|
|
30
|
-
Write-Host " ✓ Created $squad/"
|
|
31
|
-
} else {
|
|
32
|
-
Write-Host " • $squad/ exists (skipped)"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
$summaryPath = "$squad/SUMMARY.md"
|
|
36
|
-
if (-not (Test-Path $summaryPath)) {
|
|
37
|
-
"# $squad`n`n_No state published yet._" | Set-Content $summaryPath
|
|
38
|
-
Write-Host " ✓ Created $summaryPath"
|
|
39
|
-
} else {
|
|
40
|
-
Write-Host " • $summaryPath exists (skipped)"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
# Generate root README.md
|
|
45
|
-
if (-not (Test-Path "README.md")) {
|
|
46
|
-
$readme = @"
|
|
47
|
-
# Squad Mesh State Repository
|
|
48
|
-
|
|
49
|
-
This repository tracks published state from participating squads.
|
|
50
|
-
|
|
51
|
-
## Participating Squads
|
|
52
|
-
|
|
53
|
-
"@
|
|
54
|
-
foreach ($squad in $squads) {
|
|
55
|
-
$zone = $config.squads.$squad.zone
|
|
56
|
-
$readme += "- **$squad** (Zone: $zone)`n"
|
|
57
|
-
}
|
|
58
|
-
$readme += @"
|
|
59
|
-
|
|
60
|
-
Each squad directory contains a ``SUMMARY.md`` with their latest published state.
|
|
61
|
-
State is synchronized using ``sync-mesh.sh`` or ``sync-mesh.ps1``.
|
|
62
|
-
"@
|
|
63
|
-
$readme | Set-Content "README.md"
|
|
64
|
-
Write-Host " ✓ Created README.md"
|
|
65
|
-
} else {
|
|
66
|
-
Write-Host " • README.md exists (skipped)"
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
Write-Host ""
|
|
70
|
-
Write-Host "✅ Mesh state repository initialized"
|
|
71
|
-
exit 0
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
$config = Get-Content $MeshJson -Raw | ConvertFrom-Json
|
|
75
|
-
|
|
76
|
-
# Zone 2: Remote-trusted — git clone/pull
|
|
77
|
-
foreach ($entry in $config.squads.PSObject.Properties | Where-Object { $_.Value.zone -eq "remote-trusted" }) {
|
|
78
|
-
$squad = $entry.Name
|
|
79
|
-
$source = $entry.Value.source
|
|
80
|
-
$ref = if ($entry.Value.ref) { $entry.Value.ref } else { "main" }
|
|
81
|
-
$target = $entry.Value.sync_to
|
|
82
|
-
|
|
83
|
-
if (Test-Path "$target/.git") {
|
|
84
|
-
git -C $target pull --rebase --quiet 2>$null
|
|
85
|
-
if ($LASTEXITCODE -ne 0) { Write-Host "⚠ ${squad}: pull failed (using stale)" }
|
|
86
|
-
} else {
|
|
87
|
-
New-Item -ItemType Directory -Force -Path (Split-Path $target -Parent) | Out-Null
|
|
88
|
-
git clone --quiet --depth 1 --branch $ref $source $target 2>$null
|
|
89
|
-
if ($LASTEXITCODE -ne 0) { Write-Host "⚠ ${squad}: clone failed (unavailable)" }
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
# Zone 3: Remote-opaque — fetch published contracts
|
|
94
|
-
foreach ($entry in $config.squads.PSObject.Properties | Where-Object { $_.Value.zone -eq "remote-opaque" }) {
|
|
95
|
-
$squad = $entry.Name
|
|
96
|
-
$source = $entry.Value.source
|
|
97
|
-
$target = $entry.Value.sync_to
|
|
98
|
-
$auth = $entry.Value.auth
|
|
99
|
-
|
|
100
|
-
New-Item -ItemType Directory -Force -Path $target | Out-Null
|
|
101
|
-
$params = @{ Uri = $source; OutFile = "$target/SUMMARY.md"; UseBasicParsing = $true }
|
|
102
|
-
if ($auth -eq "bearer") {
|
|
103
|
-
$tokenVar = ($squad.ToUpper() -replace '-', '_') + "_TOKEN"
|
|
104
|
-
$token = [Environment]::GetEnvironmentVariable($tokenVar)
|
|
105
|
-
if ($token) { $params.Headers = @{ Authorization = "Bearer $token" } }
|
|
106
|
-
}
|
|
107
|
-
try { Invoke-WebRequest @params -ErrorAction Stop }
|
|
108
|
-
catch { "# ${squad} — unavailable ($(Get-Date))" | Set-Content "$target/SUMMARY.md" }
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
Write-Host "✓ Mesh sync complete"
|
|
1
|
+
# sync-mesh.ps1 — Materialize remote squad state locally
|
|
2
|
+
#
|
|
3
|
+
# Reads mesh.json, fetches remote squads into local directories.
|
|
4
|
+
# Run before agent reads. No daemon. No service. ~40 lines.
|
|
5
|
+
#
|
|
6
|
+
# Usage: .\sync-mesh.ps1 [path-to-mesh.json]
|
|
7
|
+
# .\sync-mesh.ps1 -Init [path-to-mesh.json]
|
|
8
|
+
# Requires: git
|
|
9
|
+
param(
|
|
10
|
+
[switch]$Init,
|
|
11
|
+
[string]$MeshJson = "mesh.json"
|
|
12
|
+
)
|
|
13
|
+
$ErrorActionPreference = "Stop"
|
|
14
|
+
|
|
15
|
+
# Handle -Init mode
|
|
16
|
+
if ($Init) {
|
|
17
|
+
if (-not (Test-Path $MeshJson)) {
|
|
18
|
+
Write-Host "❌ $MeshJson not found"
|
|
19
|
+
exit 1
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
Write-Host "🚀 Initializing mesh state repository..."
|
|
23
|
+
$config = Get-Content $MeshJson -Raw | ConvertFrom-Json
|
|
24
|
+
$squads = $config.squads.PSObject.Properties.Name
|
|
25
|
+
|
|
26
|
+
# Create squad directories with placeholder SUMMARY.md
|
|
27
|
+
foreach ($squad in $squads) {
|
|
28
|
+
if (-not (Test-Path $squad)) {
|
|
29
|
+
New-Item -ItemType Directory -Path $squad | Out-Null
|
|
30
|
+
Write-Host " ✓ Created $squad/"
|
|
31
|
+
} else {
|
|
32
|
+
Write-Host " • $squad/ exists (skipped)"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
$summaryPath = "$squad/SUMMARY.md"
|
|
36
|
+
if (-not (Test-Path $summaryPath)) {
|
|
37
|
+
"# $squad`n`n_No state published yet._" | Set-Content $summaryPath
|
|
38
|
+
Write-Host " ✓ Created $summaryPath"
|
|
39
|
+
} else {
|
|
40
|
+
Write-Host " • $summaryPath exists (skipped)"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# Generate root README.md
|
|
45
|
+
if (-not (Test-Path "README.md")) {
|
|
46
|
+
$readme = @"
|
|
47
|
+
# Squad Mesh State Repository
|
|
48
|
+
|
|
49
|
+
This repository tracks published state from participating squads.
|
|
50
|
+
|
|
51
|
+
## Participating Squads
|
|
52
|
+
|
|
53
|
+
"@
|
|
54
|
+
foreach ($squad in $squads) {
|
|
55
|
+
$zone = $config.squads.$squad.zone
|
|
56
|
+
$readme += "- **$squad** (Zone: $zone)`n"
|
|
57
|
+
}
|
|
58
|
+
$readme += @"
|
|
59
|
+
|
|
60
|
+
Each squad directory contains a ``SUMMARY.md`` with their latest published state.
|
|
61
|
+
State is synchronized using ``sync-mesh.sh`` or ``sync-mesh.ps1``.
|
|
62
|
+
"@
|
|
63
|
+
$readme | Set-Content "README.md"
|
|
64
|
+
Write-Host " ✓ Created README.md"
|
|
65
|
+
} else {
|
|
66
|
+
Write-Host " • README.md exists (skipped)"
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
Write-Host ""
|
|
70
|
+
Write-Host "✅ Mesh state repository initialized"
|
|
71
|
+
exit 0
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
$config = Get-Content $MeshJson -Raw | ConvertFrom-Json
|
|
75
|
+
|
|
76
|
+
# Zone 2: Remote-trusted — git clone/pull
|
|
77
|
+
foreach ($entry in $config.squads.PSObject.Properties | Where-Object { $_.Value.zone -eq "remote-trusted" }) {
|
|
78
|
+
$squad = $entry.Name
|
|
79
|
+
$source = $entry.Value.source
|
|
80
|
+
$ref = if ($entry.Value.ref) { $entry.Value.ref } else { "main" }
|
|
81
|
+
$target = $entry.Value.sync_to
|
|
82
|
+
|
|
83
|
+
if (Test-Path "$target/.git") {
|
|
84
|
+
git -C $target pull --rebase --quiet 2>$null
|
|
85
|
+
if ($LASTEXITCODE -ne 0) { Write-Host "⚠ ${squad}: pull failed (using stale)" }
|
|
86
|
+
} else {
|
|
87
|
+
New-Item -ItemType Directory -Force -Path (Split-Path $target -Parent) | Out-Null
|
|
88
|
+
git clone --quiet --depth 1 --branch $ref $source $target 2>$null
|
|
89
|
+
if ($LASTEXITCODE -ne 0) { Write-Host "⚠ ${squad}: clone failed (unavailable)" }
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
# Zone 3: Remote-opaque — fetch published contracts
|
|
94
|
+
foreach ($entry in $config.squads.PSObject.Properties | Where-Object { $_.Value.zone -eq "remote-opaque" }) {
|
|
95
|
+
$squad = $entry.Name
|
|
96
|
+
$source = $entry.Value.source
|
|
97
|
+
$target = $entry.Value.sync_to
|
|
98
|
+
$auth = $entry.Value.auth
|
|
99
|
+
|
|
100
|
+
New-Item -ItemType Directory -Force -Path $target | Out-Null
|
|
101
|
+
$params = @{ Uri = $source; OutFile = "$target/SUMMARY.md"; UseBasicParsing = $true }
|
|
102
|
+
if ($auth -eq "bearer") {
|
|
103
|
+
$tokenVar = ($squad.ToUpper() -replace '-', '_') + "_TOKEN"
|
|
104
|
+
$token = [Environment]::GetEnvironmentVariable($tokenVar)
|
|
105
|
+
if ($token) { $params.Headers = @{ Authorization = "Bearer $token" } }
|
|
106
|
+
}
|
|
107
|
+
try { Invoke-WebRequest @params -ErrorAction Stop }
|
|
108
|
+
catch { "# ${squad} — unavailable ($(Get-Date))" | Set-Content "$target/SUMMARY.md" }
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
Write-Host "✓ Mesh sync complete"
|
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# sync-mesh.sh — Materialize remote squad state locally
|
|
3
|
-
#
|
|
4
|
-
# Reads mesh.json, fetches remote squads into local directories.
|
|
5
|
-
# Run before agent reads. No daemon. No service. ~40 lines.
|
|
6
|
-
#
|
|
7
|
-
# Usage: ./sync-mesh.sh [path-to-mesh.json]
|
|
8
|
-
# ./sync-mesh.sh --init [path-to-mesh.json]
|
|
9
|
-
# Requires: jq (https://github.com/jqlang/jq), git, curl
|
|
10
|
-
|
|
11
|
-
set -euo pipefail
|
|
12
|
-
|
|
13
|
-
# Handle --init mode
|
|
14
|
-
if [ "${1:-}" = "--init" ]; then
|
|
15
|
-
MESH_JSON="${2:-mesh.json}"
|
|
16
|
-
|
|
17
|
-
if [ ! -f "$MESH_JSON" ]; then
|
|
18
|
-
echo "❌ $MESH_JSON not found"
|
|
19
|
-
exit 1
|
|
20
|
-
fi
|
|
21
|
-
|
|
22
|
-
echo "🚀 Initializing mesh state repository..."
|
|
23
|
-
squads=$(jq -r '.squads | keys[]' "$MESH_JSON")
|
|
24
|
-
|
|
25
|
-
# Create squad directories with placeholder SUMMARY.md
|
|
26
|
-
for squad in $squads; do
|
|
27
|
-
if [ ! -d "$squad" ]; then
|
|
28
|
-
mkdir -p "$squad"
|
|
29
|
-
echo " ✓ Created $squad/"
|
|
30
|
-
else
|
|
31
|
-
echo " • $squad/ exists (skipped)"
|
|
32
|
-
fi
|
|
33
|
-
|
|
34
|
-
if [ ! -f "$squad/SUMMARY.md" ]; then
|
|
35
|
-
echo -e "# $squad\n\n_No state published yet._" > "$squad/SUMMARY.md"
|
|
36
|
-
echo " ✓ Created $squad/SUMMARY.md"
|
|
37
|
-
else
|
|
38
|
-
echo " • $squad/SUMMARY.md exists (skipped)"
|
|
39
|
-
fi
|
|
40
|
-
done
|
|
41
|
-
|
|
42
|
-
# Generate root README.md
|
|
43
|
-
if [ ! -f "README.md" ]; then
|
|
44
|
-
{
|
|
45
|
-
echo "# Squad Mesh State Repository"
|
|
46
|
-
echo ""
|
|
47
|
-
echo "This repository tracks published state from participating squads."
|
|
48
|
-
echo ""
|
|
49
|
-
echo "## Participating Squads"
|
|
50
|
-
echo ""
|
|
51
|
-
for squad in $squads; do
|
|
52
|
-
zone=$(jq -r ".squads.\"$squad\".zone" "$MESH_JSON")
|
|
53
|
-
echo "- **$squad** (Zone: $zone)"
|
|
54
|
-
done
|
|
55
|
-
echo ""
|
|
56
|
-
echo "Each squad directory contains a \`SUMMARY.md\` with their latest published state."
|
|
57
|
-
echo "State is synchronized using \`sync-mesh.sh\` or \`sync-mesh.ps1\`."
|
|
58
|
-
} > README.md
|
|
59
|
-
echo " ✓ Created README.md"
|
|
60
|
-
else
|
|
61
|
-
echo " • README.md exists (skipped)"
|
|
62
|
-
fi
|
|
63
|
-
|
|
64
|
-
echo ""
|
|
65
|
-
echo "✅ Mesh state repository initialized"
|
|
66
|
-
exit 0
|
|
67
|
-
fi
|
|
68
|
-
|
|
69
|
-
MESH_JSON="${1:-mesh.json}"
|
|
70
|
-
|
|
71
|
-
# Zone 2: Remote-trusted — git clone/pull
|
|
72
|
-
for squad in $(jq -r '.squads | to_entries[] | select(.value.zone == "remote-trusted") | .key' "$MESH_JSON"); do
|
|
73
|
-
source=$(jq -r ".squads.\"$squad\".source" "$MESH_JSON")
|
|
74
|
-
ref=$(jq -r ".squads.\"$squad\".ref // \"main\"" "$MESH_JSON")
|
|
75
|
-
target=$(jq -r ".squads.\"$squad\".sync_to" "$MESH_JSON")
|
|
76
|
-
|
|
77
|
-
if [ -d "$target/.git" ]; then
|
|
78
|
-
git -C "$target" pull --rebase --quiet 2>/dev/null \
|
|
79
|
-
|| echo "⚠ $squad: pull failed (using stale)"
|
|
80
|
-
else
|
|
81
|
-
mkdir -p "$(dirname "$target")"
|
|
82
|
-
git clone --quiet --depth 1 --branch "$ref" "$source" "$target" 2>/dev/null \
|
|
83
|
-
|| echo "⚠ $squad: clone failed (unavailable)"
|
|
84
|
-
fi
|
|
85
|
-
done
|
|
86
|
-
|
|
87
|
-
# Zone 3: Remote-opaque — fetch published contracts
|
|
88
|
-
for squad in $(jq -r '.squads | to_entries[] | select(.value.zone == "remote-opaque") | .key' "$MESH_JSON"); do
|
|
89
|
-
source=$(jq -r ".squads.\"$squad\".source" "$MESH_JSON")
|
|
90
|
-
target=$(jq -r ".squads.\"$squad\".sync_to" "$MESH_JSON")
|
|
91
|
-
auth=$(jq -r ".squads.\"$squad\".auth // \"\"" "$MESH_JSON")
|
|
92
|
-
|
|
93
|
-
mkdir -p "$target"
|
|
94
|
-
auth_flag=""
|
|
95
|
-
if [ "$auth" = "bearer" ]; then
|
|
96
|
-
token_var="$(echo "${squad}" | tr '[:lower:]-' '[:upper:]_')_TOKEN"
|
|
97
|
-
[ -n "${!token_var:-}" ] && auth_flag="--header \"Authorization: Bearer ${!token_var}\""
|
|
98
|
-
fi
|
|
99
|
-
|
|
100
|
-
eval curl --silent --fail $auth_flag "$source" -o "$target/SUMMARY.md" 2>/dev/null \
|
|
101
|
-
|| echo "# ${squad} — unavailable ($(date))" > "$target/SUMMARY.md"
|
|
102
|
-
done
|
|
103
|
-
|
|
104
|
-
echo "✓ Mesh sync complete"
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# sync-mesh.sh — Materialize remote squad state locally
|
|
3
|
+
#
|
|
4
|
+
# Reads mesh.json, fetches remote squads into local directories.
|
|
5
|
+
# Run before agent reads. No daemon. No service. ~40 lines.
|
|
6
|
+
#
|
|
7
|
+
# Usage: ./sync-mesh.sh [path-to-mesh.json]
|
|
8
|
+
# ./sync-mesh.sh --init [path-to-mesh.json]
|
|
9
|
+
# Requires: jq (https://github.com/jqlang/jq), git, curl
|
|
10
|
+
|
|
11
|
+
set -euo pipefail
|
|
12
|
+
|
|
13
|
+
# Handle --init mode
|
|
14
|
+
if [ "${1:-}" = "--init" ]; then
|
|
15
|
+
MESH_JSON="${2:-mesh.json}"
|
|
16
|
+
|
|
17
|
+
if [ ! -f "$MESH_JSON" ]; then
|
|
18
|
+
echo "❌ $MESH_JSON not found"
|
|
19
|
+
exit 1
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
echo "🚀 Initializing mesh state repository..."
|
|
23
|
+
squads=$(jq -r '.squads | keys[]' "$MESH_JSON")
|
|
24
|
+
|
|
25
|
+
# Create squad directories with placeholder SUMMARY.md
|
|
26
|
+
for squad in $squads; do
|
|
27
|
+
if [ ! -d "$squad" ]; then
|
|
28
|
+
mkdir -p "$squad"
|
|
29
|
+
echo " ✓ Created $squad/"
|
|
30
|
+
else
|
|
31
|
+
echo " • $squad/ exists (skipped)"
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
if [ ! -f "$squad/SUMMARY.md" ]; then
|
|
35
|
+
echo -e "# $squad\n\n_No state published yet._" > "$squad/SUMMARY.md"
|
|
36
|
+
echo " ✓ Created $squad/SUMMARY.md"
|
|
37
|
+
else
|
|
38
|
+
echo " • $squad/SUMMARY.md exists (skipped)"
|
|
39
|
+
fi
|
|
40
|
+
done
|
|
41
|
+
|
|
42
|
+
# Generate root README.md
|
|
43
|
+
if [ ! -f "README.md" ]; then
|
|
44
|
+
{
|
|
45
|
+
echo "# Squad Mesh State Repository"
|
|
46
|
+
echo ""
|
|
47
|
+
echo "This repository tracks published state from participating squads."
|
|
48
|
+
echo ""
|
|
49
|
+
echo "## Participating Squads"
|
|
50
|
+
echo ""
|
|
51
|
+
for squad in $squads; do
|
|
52
|
+
zone=$(jq -r ".squads.\"$squad\".zone" "$MESH_JSON")
|
|
53
|
+
echo "- **$squad** (Zone: $zone)"
|
|
54
|
+
done
|
|
55
|
+
echo ""
|
|
56
|
+
echo "Each squad directory contains a \`SUMMARY.md\` with their latest published state."
|
|
57
|
+
echo "State is synchronized using \`sync-mesh.sh\` or \`sync-mesh.ps1\`."
|
|
58
|
+
} > README.md
|
|
59
|
+
echo " ✓ Created README.md"
|
|
60
|
+
else
|
|
61
|
+
echo " • README.md exists (skipped)"
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
echo ""
|
|
65
|
+
echo "✅ Mesh state repository initialized"
|
|
66
|
+
exit 0
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
MESH_JSON="${1:-mesh.json}"
|
|
70
|
+
|
|
71
|
+
# Zone 2: Remote-trusted — git clone/pull
|
|
72
|
+
for squad in $(jq -r '.squads | to_entries[] | select(.value.zone == "remote-trusted") | .key' "$MESH_JSON"); do
|
|
73
|
+
source=$(jq -r ".squads.\"$squad\".source" "$MESH_JSON")
|
|
74
|
+
ref=$(jq -r ".squads.\"$squad\".ref // \"main\"" "$MESH_JSON")
|
|
75
|
+
target=$(jq -r ".squads.\"$squad\".sync_to" "$MESH_JSON")
|
|
76
|
+
|
|
77
|
+
if [ -d "$target/.git" ]; then
|
|
78
|
+
git -C "$target" pull --rebase --quiet 2>/dev/null \
|
|
79
|
+
|| echo "⚠ $squad: pull failed (using stale)"
|
|
80
|
+
else
|
|
81
|
+
mkdir -p "$(dirname "$target")"
|
|
82
|
+
git clone --quiet --depth 1 --branch "$ref" "$source" "$target" 2>/dev/null \
|
|
83
|
+
|| echo "⚠ $squad: clone failed (unavailable)"
|
|
84
|
+
fi
|
|
85
|
+
done
|
|
86
|
+
|
|
87
|
+
# Zone 3: Remote-opaque — fetch published contracts
|
|
88
|
+
for squad in $(jq -r '.squads | to_entries[] | select(.value.zone == "remote-opaque") | .key' "$MESH_JSON"); do
|
|
89
|
+
source=$(jq -r ".squads.\"$squad\".source" "$MESH_JSON")
|
|
90
|
+
target=$(jq -r ".squads.\"$squad\".sync_to" "$MESH_JSON")
|
|
91
|
+
auth=$(jq -r ".squads.\"$squad\".auth // \"\"" "$MESH_JSON")
|
|
92
|
+
|
|
93
|
+
mkdir -p "$target"
|
|
94
|
+
auth_flag=""
|
|
95
|
+
if [ "$auth" = "bearer" ]; then
|
|
96
|
+
token_var="$(echo "${squad}" | tr '[:lower:]-' '[:upper:]_')_TOKEN"
|
|
97
|
+
[ -n "${!token_var:-}" ] && auth_flag="--header \"Authorization: Bearer ${!token_var}\""
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
eval curl --silent --fail $auth_flag "$source" -o "$target/SUMMARY.md" 2>/dev/null \
|
|
101
|
+
|| echo "# ${squad} — unavailable ($(date))" > "$target/SUMMARY.md"
|
|
102
|
+
done
|
|
103
|
+
|
|
104
|
+
echo "✓ Mesh sync complete"
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: "docs-standards"
|
|
3
|
-
description: "Microsoft Style Guide + Squad-specific documentation patterns"
|
|
4
|
-
domain: "documentation"
|
|
5
|
-
confidence: "high"
|
|
6
|
-
source: "earned (PAO charter, multiple doc PR reviews)"
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Context
|
|
10
|
-
|
|
11
|
-
Squad documentation follows the Microsoft Style Guide with Squad-specific conventions. Consistency across docs builds trust and improves discoverability.
|
|
12
|
-
|
|
13
|
-
## Patterns
|
|
14
|
-
|
|
15
|
-
### Microsoft Style Guide Rules
|
|
16
|
-
- **Sentence-case headings:** "Getting started" not "Getting Started"
|
|
17
|
-
- **Active voice:** "Run the command" not "The command should be run"
|
|
18
|
-
- **Second person:** "You can configure..." not "Users can configure..."
|
|
19
|
-
- **Present tense:** "The system routes..." not "The system will route..."
|
|
20
|
-
- **No ampersands in prose:** "and" not "&" (except in code, brand names, or UI elements)
|
|
21
|
-
|
|
22
|
-
### Squad Formatting Patterns
|
|
23
|
-
- **Scannability first:** Paragraphs for narrative (3-4 sentences max), bullets for scannable lists, tables for structured data
|
|
24
|
-
- **"Try this" prompts at top:** Start feature/scenario pages with practical prompts users can copy
|
|
25
|
-
- **Experimental warnings:** Features in preview get callout at top
|
|
26
|
-
- **Cross-references at bottom:** Related pages linked after main content
|
|
27
|
-
|
|
28
|
-
### Structure
|
|
29
|
-
- **Title (H1)** → **Warning/callout** → **Try this code** → **Overview** → **HR** → **Content (H2 sections)**
|
|
30
|
-
|
|
31
|
-
### Test Sync Rule
|
|
32
|
-
- **Always update test assertions:** When adding docs pages to `features/`, `scenarios/`, `guides/`, update corresponding `EXPECTED_*` arrays in `test/docs-build.test.ts` in the same commit
|
|
33
|
-
|
|
34
|
-
## Examples
|
|
35
|
-
|
|
36
|
-
✓ **Correct:**
|
|
37
|
-
```markdown
|
|
38
|
-
# Getting started with Squad
|
|
39
|
-
|
|
40
|
-
> ⚠️ **Experimental:** This feature is in preview.
|
|
41
|
-
|
|
42
|
-
Try this:
|
|
43
|
-
\`\`\`bash
|
|
44
|
-
squad init
|
|
45
|
-
\`\`\`
|
|
46
|
-
|
|
47
|
-
Squad helps you build AI teams...
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## Install Squad
|
|
52
|
-
|
|
53
|
-
Run the following command...
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
✗ **Incorrect:**
|
|
57
|
-
```markdown
|
|
58
|
-
# Getting Started With Squad // Title case
|
|
59
|
-
|
|
60
|
-
Squad is a tool which will help users... // Third person, future tense
|
|
61
|
-
|
|
62
|
-
You can install Squad with npm & configure it... // Ampersand in prose
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Anti-Patterns
|
|
66
|
-
|
|
67
|
-
- Title-casing headings because "it looks nicer"
|
|
68
|
-
- Writing in passive voice or third person
|
|
69
|
-
- Long paragraphs of dense text (breaks scannability)
|
|
70
|
-
- Adding doc pages without updating test assertions
|
|
71
|
-
- Using ampersands outside code blocks
|
|
1
|
+
---
|
|
2
|
+
name: "docs-standards"
|
|
3
|
+
description: "Microsoft Style Guide + Squad-specific documentation patterns"
|
|
4
|
+
domain: "documentation"
|
|
5
|
+
confidence: "high"
|
|
6
|
+
source: "earned (PAO charter, multiple doc PR reviews)"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
Squad documentation follows the Microsoft Style Guide with Squad-specific conventions. Consistency across docs builds trust and improves discoverability.
|
|
12
|
+
|
|
13
|
+
## Patterns
|
|
14
|
+
|
|
15
|
+
### Microsoft Style Guide Rules
|
|
16
|
+
- **Sentence-case headings:** "Getting started" not "Getting Started"
|
|
17
|
+
- **Active voice:** "Run the command" not "The command should be run"
|
|
18
|
+
- **Second person:** "You can configure..." not "Users can configure..."
|
|
19
|
+
- **Present tense:** "The system routes..." not "The system will route..."
|
|
20
|
+
- **No ampersands in prose:** "and" not "&" (except in code, brand names, or UI elements)
|
|
21
|
+
|
|
22
|
+
### Squad Formatting Patterns
|
|
23
|
+
- **Scannability first:** Paragraphs for narrative (3-4 sentences max), bullets for scannable lists, tables for structured data
|
|
24
|
+
- **"Try this" prompts at top:** Start feature/scenario pages with practical prompts users can copy
|
|
25
|
+
- **Experimental warnings:** Features in preview get callout at top
|
|
26
|
+
- **Cross-references at bottom:** Related pages linked after main content
|
|
27
|
+
|
|
28
|
+
### Structure
|
|
29
|
+
- **Title (H1)** → **Warning/callout** → **Try this code** → **Overview** → **HR** → **Content (H2 sections)**
|
|
30
|
+
|
|
31
|
+
### Test Sync Rule
|
|
32
|
+
- **Always update test assertions:** When adding docs pages to `features/`, `scenarios/`, `guides/`, update corresponding `EXPECTED_*` arrays in `test/docs-build.test.ts` in the same commit
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
✓ **Correct:**
|
|
37
|
+
```markdown
|
|
38
|
+
# Getting started with Squad
|
|
39
|
+
|
|
40
|
+
> ⚠️ **Experimental:** This feature is in preview.
|
|
41
|
+
|
|
42
|
+
Try this:
|
|
43
|
+
\`\`\`bash
|
|
44
|
+
squad init
|
|
45
|
+
\`\`\`
|
|
46
|
+
|
|
47
|
+
Squad helps you build AI teams...
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Install Squad
|
|
52
|
+
|
|
53
|
+
Run the following command...
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
✗ **Incorrect:**
|
|
57
|
+
```markdown
|
|
58
|
+
# Getting Started With Squad // Title case
|
|
59
|
+
|
|
60
|
+
Squad is a tool which will help users... // Third person, future tense
|
|
61
|
+
|
|
62
|
+
You can install Squad with npm & configure it... // Ampersand in prose
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Anti-Patterns
|
|
66
|
+
|
|
67
|
+
- Title-casing headings because "it looks nicer"
|
|
68
|
+
- Writing in passive voice or third person
|
|
69
|
+
- Long paragraphs of dense text (breaks scannability)
|
|
70
|
+
- Adding doc pages without updating test assertions
|
|
71
|
+
- Using ampersands outside code blocks
|