gsd-antigravity-kit 2.0.0 → 2.1.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/.agent/skills/gsd/SKILL.md +26 -4
- package/.agent/skills/gsd/VERSION +1 -1
- package/.agent/skills/gsd/assets/templates/AI-SPEC.md +246 -0
- package/.agent/skills/gsd/assets/templates/DEBUG.md +7 -2
- package/.agent/skills/gsd/assets/templates/config.json +56 -48
- package/.agent/skills/gsd/assets/templates/research.md +40 -0
- package/.agent/skills/gsd/assets/templates/spec.md +307 -0
- package/.agent/skills/gsd/assets/templates/state.md +8 -0
- package/.agent/skills/gsd/bin/gsd-tools.cjs +212 -11
- package/.agent/skills/gsd/bin/help-manifest.json +8 -2
- package/.agent/skills/gsd/bin/hooks/gsd-check-update-worker.js +108 -0
- package/.agent/skills/gsd/bin/hooks/gsd-check-update.js +14 -89
- package/.agent/skills/gsd/bin/hooks/gsd-context-monitor.js +34 -5
- package/.agent/skills/gsd/bin/hooks/gsd-phase-boundary.sh +1 -0
- package/.agent/skills/gsd/bin/hooks/gsd-prompt-guard.js +1 -1
- package/.agent/skills/gsd/bin/hooks/gsd-read-guard.js +6 -1
- package/.agent/skills/gsd/bin/hooks/gsd-session-state.sh +1 -0
- package/.agent/skills/gsd/bin/hooks/gsd-statusline.js +150 -16
- package/.agent/skills/gsd/bin/hooks/gsd-validate-commit.sh +1 -0
- package/.agent/skills/gsd/bin/hooks/gsd-workflow-guard.js +1 -1
- package/.agent/skills/gsd/bin/lib/audit.cjs +757 -0
- package/.agent/skills/gsd/bin/lib/commands.cjs +17 -7
- package/.agent/skills/gsd/bin/lib/config.cjs +66 -20
- package/.agent/skills/gsd/bin/lib/core.cjs +212 -12
- package/.agent/skills/gsd/bin/lib/frontmatter.cjs +6 -8
- package/.agent/skills/gsd/bin/lib/graphify.cjs +494 -0
- package/.agent/skills/gsd/bin/lib/gsd2-import.cjs +511 -0
- package/.agent/skills/gsd/bin/lib/init.cjs +371 -18
- package/.agent/skills/gsd/bin/lib/intel.cjs +9 -30
- package/.agent/skills/gsd/bin/lib/milestone.cjs +18 -17
- package/.agent/skills/gsd/bin/lib/model-profiles.cjs +1 -0
- package/.agent/skills/gsd/bin/lib/phase.cjs +225 -98
- package/.agent/skills/gsd/bin/lib/profile-output.cjs +17 -5
- package/.agent/skills/gsd/bin/lib/roadmap.cjs +12 -5
- package/.agent/skills/gsd/bin/lib/state.cjs +394 -129
- package/.agent/skills/gsd/bin/lib/template.cjs +8 -4
- package/.agent/skills/gsd/bin/lib/uat.cjs +2 -1
- package/.agent/skills/gsd/bin/lib/verify.cjs +111 -42
- package/.agent/skills/gsd/migration_report.md +2 -2
- package/.agent/skills/gsd/references/agents/gsd-advisor-researcher.md +23 -0
- package/.agent/skills/gsd/references/agents/gsd-ai-researcher.md +133 -0
- package/.agent/skills/gsd/references/agents/gsd-code-fixer.md +11 -10
- package/.agent/skills/gsd/references/agents/gsd-code-reviewer.md +2 -2
- package/.agent/skills/gsd/references/agents/gsd-codebase-mapper.md +13 -2
- package/.agent/skills/gsd/references/agents/gsd-debug-session-manager.md +314 -0
- package/.agent/skills/gsd/references/agents/gsd-debugger.md +147 -76
- package/.agent/skills/gsd/references/agents/gsd-doc-verifier.md +1 -1
- package/.agent/skills/gsd/references/agents/gsd-doc-writer.md +615 -602
- package/.agent/skills/gsd/references/agents/gsd-domain-researcher.md +153 -0
- package/.agent/skills/gsd/references/agents/gsd-eval-auditor.md +175 -0
- package/.agent/skills/gsd/references/agents/gsd-eval-planner.md +154 -0
- package/.agent/skills/gsd/references/agents/gsd-executor.md +108 -38
- package/.agent/skills/gsd/references/agents/gsd-framework-selector.md +160 -0
- package/.agent/skills/gsd/references/agents/gsd-integration-checker.md +454 -443
- package/.agent/skills/gsd/references/agents/gsd-intel-updater.md +40 -20
- package/.agent/skills/gsd/references/agents/gsd-nyquist-auditor.md +187 -176
- package/.agent/skills/gsd/references/agents/gsd-pattern-mapper.md +335 -0
- package/.agent/skills/gsd/references/agents/gsd-phase-researcher.md +112 -13
- package/.agent/skills/gsd/references/agents/gsd-plan-checker.md +104 -10
- package/.agent/skills/gsd/references/agents/gsd-planner.md +125 -167
- package/.agent/skills/gsd/references/agents/gsd-project-researcher.md +25 -2
- package/.agent/skills/gsd/references/agents/gsd-research-synthesizer.md +3 -3
- package/.agent/skills/gsd/references/agents/gsd-roadmapper.md +12 -1
- package/.agent/skills/gsd/references/agents/gsd-security-auditor.md +139 -128
- package/.agent/skills/gsd/references/agents/gsd-ui-auditor.md +3 -3
- package/.agent/skills/gsd/references/agents/gsd-ui-checker.md +11 -2
- package/.agent/skills/gsd/references/agents/gsd-ui-researcher.md +27 -4
- package/.agent/skills/gsd/references/agents/gsd-verifier.md +13 -19
- package/.agent/skills/gsd/references/commands/atomic/add-todo.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/check-todos.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/cleanup.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/do.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/help.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/join-discord.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/note.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/session-report.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/ship.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/stats.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/thread.md +141 -41
- package/.agent/skills/gsd/references/commands/atomic/undo.md +2 -2
- package/.agent/skills/gsd/references/commands/milestone/add-backlog.md +15 -12
- package/.agent/skills/gsd/references/commands/milestone/audit-milestone.md +2 -2
- package/.agent/skills/gsd/references/commands/milestone/complete-milestone.md +2 -2
- package/.agent/skills/gsd/references/commands/milestone/milestone-summary.md +2 -2
- package/.agent/skills/gsd/references/commands/milestone/new-milestone.md +2 -2
- package/.agent/skills/gsd/references/commands/milestone/plan-milestone-gaps.md +2 -2
- package/.agent/skills/gsd/references/commands/milestone/plant-seed.md +2 -2
- package/.agent/skills/gsd/references/commands/milestone/review-backlog.md +4 -4
- package/.agent/skills/gsd/references/commands/misc/ai-integration-phase.md +38 -0
- package/.agent/skills/gsd/references/commands/misc/audit-fix.md +2 -2
- package/.agent/skills/gsd/references/commands/misc/audit-uat.md +2 -2
- package/.agent/skills/gsd/references/commands/misc/eval-review.md +34 -0
- package/.agent/skills/gsd/references/commands/misc/extract_learnings.md +24 -0
- package/.agent/skills/gsd/references/commands/misc/from-gsd2.md +49 -0
- package/.agent/skills/gsd/references/commands/misc/graphify.md +203 -0
- package/.agent/skills/gsd/references/commands/misc/inbox.md +40 -0
- package/.agent/skills/gsd/references/commands/misc/next.md +5 -3
- package/.agent/skills/gsd/references/commands/misc/progress.md +4 -3
- package/.agent/skills/gsd/references/commands/misc/sketch-wrap-up.md +33 -0
- package/.agent/skills/gsd/references/commands/misc/sketch.md +47 -0
- package/.agent/skills/gsd/references/commands/misc/spec-phase.md +64 -0
- package/.agent/skills/gsd/references/commands/misc/spike-wrap-up.md +33 -0
- package/.agent/skills/gsd/references/commands/misc/spike.md +43 -0
- package/.agent/skills/gsd/references/commands/misc/verify-work.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/add-phase.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/add-tests.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/discuss-phase.md +5 -5
- package/.agent/skills/gsd/references/commands/phase/execute-phase.md +4 -4
- package/.agent/skills/gsd/references/commands/phase/insert-phase.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/list-phase-assumptions.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/plan-phase.md +3 -3
- package/.agent/skills/gsd/references/commands/phase/remove-phase.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/research-phase.md +5 -5
- package/.agent/skills/gsd/references/commands/phase/secure-phase.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/ui-phase.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/ui-review.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/validate-phase.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/workstreams.md +9 -9
- package/.agent/skills/gsd/references/commands/project/analyze-dependencies.md +2 -2
- package/.agent/skills/gsd/references/commands/project/explore.md +2 -2
- package/.agent/skills/gsd/references/commands/project/import.md +2 -2
- package/.agent/skills/gsd/references/commands/project/intel.md +10 -10
- package/.agent/skills/gsd/references/commands/project/list-workspaces.md +2 -2
- package/.agent/skills/gsd/references/commands/project/map-codebase.md +2 -2
- package/.agent/skills/gsd/references/commands/project/new-project.md +2 -2
- package/.agent/skills/gsd/references/commands/project/new-workspace.md +2 -2
- package/.agent/skills/gsd/references/commands/project/remove-workspace.md +2 -2
- package/.agent/skills/gsd/references/commands/project/scan.md +2 -2
- package/.agent/skills/gsd/references/commands/system/autonomous.md +4 -3
- package/.agent/skills/gsd/references/commands/system/code-review-fix.md +3 -3
- package/.agent/skills/gsd/references/commands/system/code-review.md +3 -3
- package/.agent/skills/gsd/references/commands/system/debug.md +177 -100
- package/.agent/skills/gsd/references/commands/system/docs-update.md +2 -2
- package/.agent/skills/gsd/references/commands/system/fast.md +2 -2
- package/.agent/skills/gsd/references/commands/system/forensics.md +2 -2
- package/.agent/skills/gsd/references/commands/system/gsd-tools.md +153 -6
- package/.agent/skills/gsd/references/commands/system/health.md +2 -2
- package/.agent/skills/gsd/references/commands/system/manager.md +3 -3
- package/.agent/skills/gsd/references/commands/system/pause-work.md +2 -2
- package/.agent/skills/gsd/references/commands/system/pr-branch.md +2 -2
- package/.agent/skills/gsd/references/commands/system/profile-user.md +2 -2
- package/.agent/skills/gsd/references/commands/system/quick.md +127 -3
- package/.agent/skills/gsd/references/commands/system/reapply-patches.md +45 -6
- package/.agent/skills/gsd/references/commands/system/resume-work.md +2 -2
- package/.agent/skills/gsd/references/commands/system/review.md +6 -4
- package/.agent/skills/gsd/references/commands/system/set-profile.md +3 -3
- package/.agent/skills/gsd/references/commands/system/settings.md +2 -2
- package/.agent/skills/gsd/references/commands/system/update.md +2 -2
- package/.agent/skills/gsd/references/docs/ai-evals.md +156 -0
- package/.agent/skills/gsd/references/docs/ai-frameworks.md +186 -0
- package/.agent/skills/gsd/references/docs/artifact-types.md +18 -0
- package/.agent/skills/gsd/references/docs/autonomous-smart-discuss.md +277 -0
- package/.agent/skills/gsd/references/docs/checkpoints.md +30 -0
- package/.agent/skills/gsd/references/docs/common-bug-patterns.md +49 -49
- package/.agent/skills/gsd/references/docs/continuation-format.md +11 -7
- package/.agent/skills/gsd/references/docs/debugger-philosophy.md +76 -0
- package/.agent/skills/gsd/references/docs/decimal-phase-calculation.md +64 -64
- package/.agent/skills/gsd/references/docs/executor-examples.md +110 -0
- package/.agent/skills/gsd/references/docs/git-integration.md +4 -4
- package/.agent/skills/gsd/references/docs/git-planning-commit.md +40 -38
- package/.agent/skills/gsd/references/docs/ios-scaffold.md +123 -0
- package/.agent/skills/gsd/references/docs/mandatory-initial-read.md +2 -0
- package/.agent/skills/gsd/references/docs/phase-argument-parsing.md +61 -61
- package/.agent/skills/gsd/references/docs/planner-antipatterns.md +89 -0
- package/.agent/skills/gsd/references/docs/planner-revision.md +87 -87
- package/.agent/skills/gsd/references/docs/planner-source-audit.md +73 -0
- package/.agent/skills/gsd/references/docs/planning-config.md +33 -8
- package/.agent/skills/gsd/references/docs/project-skills-discovery.md +19 -0
- package/.agent/skills/gsd/references/docs/sketch-interactivity.md +41 -0
- package/.agent/skills/gsd/references/docs/sketch-theme-system.md +94 -0
- package/.agent/skills/gsd/references/docs/sketch-tooling.md +45 -0
- package/.agent/skills/gsd/references/docs/sketch-variant-patterns.md +81 -0
- package/.agent/skills/gsd/references/docs/tdd.md +67 -0
- package/.agent/skills/gsd/references/docs/universal-anti-patterns.md +5 -0
- package/.agent/skills/gsd/references/docs/workstream-flag.md +11 -11
- package/.agent/skills/gsd/references/mapping.md +1 -1
- package/.agent/skills/gsd/references/workflows/add-phase.md +112 -112
- package/.agent/skills/gsd/references/workflows/add-tests.md +6 -3
- package/.agent/skills/gsd/references/workflows/add-todo.md +5 -3
- package/.agent/skills/gsd/references/workflows/ai-integration-phase.md +284 -0
- package/.agent/skills/gsd/references/workflows/audit-fix.md +157 -157
- package/.agent/skills/gsd/references/workflows/audit-milestone.md +340 -340
- package/.agent/skills/gsd/references/workflows/audit-uat.md +109 -109
- package/.agent/skills/gsd/references/workflows/autonomous.md +20 -288
- package/.agent/skills/gsd/references/workflows/check-todos.md +4 -2
- package/.agent/skills/gsd/references/workflows/cleanup.md +3 -1
- package/.agent/skills/gsd/references/workflows/code-review-fix.md +497 -497
- package/.agent/skills/gsd/references/workflows/code-review.md +515 -515
- package/.agent/skills/gsd/references/workflows/complete-milestone.md +97 -24
- package/.agent/skills/gsd/references/workflows/diagnose-issues.md +238 -238
- package/.agent/skills/gsd/references/workflows/discovery-phase.md +2 -0
- package/.agent/skills/gsd/references/workflows/discuss-phase-assumptions.md +11 -11
- package/.agent/skills/gsd/references/workflows/discuss-phase.md +143 -19
- package/.agent/skills/gsd/references/workflows/do.md +8 -2
- package/.agent/skills/gsd/references/workflows/docs-update.md +5 -3
- package/.agent/skills/gsd/references/workflows/eval-review.md +155 -0
- package/.agent/skills/gsd/references/workflows/execute-phase.md +338 -54
- package/.agent/skills/gsd/references/workflows/execute-plan.md +80 -104
- package/.agent/skills/gsd/references/workflows/explore.md +3 -1
- package/.agent/skills/gsd/references/workflows/extract_learnings.md +232 -0
- package/.agent/skills/gsd/references/workflows/forensics.md +3 -3
- package/.agent/skills/gsd/references/workflows/health.md +2 -2
- package/.agent/skills/gsd/references/workflows/help.md +59 -1
- package/.agent/skills/gsd/references/workflows/import.md +3 -1
- package/.agent/skills/gsd/references/workflows/inbox.md +387 -384
- package/.agent/skills/gsd/references/workflows/insert-phase.md +130 -130
- package/.agent/skills/gsd/references/workflows/list-workspaces.md +56 -56
- package/.agent/skills/gsd/references/workflows/manager.md +5 -3
- package/.agent/skills/gsd/references/workflows/map-codebase.md +19 -5
- package/.agent/skills/gsd/references/workflows/milestone-summary.md +6 -6
- package/.agent/skills/gsd/references/workflows/new-milestone.md +63 -9
- package/.agent/skills/gsd/references/workflows/new-project.md +126 -22
- package/.agent/skills/gsd/references/workflows/new-workspace.md +6 -4
- package/.agent/skills/gsd/references/workflows/next.md +220 -153
- package/.agent/skills/gsd/references/workflows/note.md +2 -0
- package/.agent/skills/gsd/references/workflows/pause-work.md +11 -7
- package/.agent/skills/gsd/references/workflows/plan-milestone-gaps.md +273 -273
- package/.agent/skills/gsd/references/workflows/plan-phase.md +281 -62
- package/.agent/skills/gsd/references/workflows/plant-seed.md +4 -1
- package/.agent/skills/gsd/references/workflows/pr-branch.md +41 -13
- package/.agent/skills/gsd/references/workflows/profile-user.md +15 -13
- package/.agent/skills/gsd/references/workflows/progress.md +133 -21
- package/.agent/skills/gsd/references/workflows/quick.md +67 -27
- package/.agent/skills/gsd/references/workflows/remove-phase.md +155 -155
- package/.agent/skills/gsd/references/workflows/remove-workspace.md +4 -2
- package/.agent/skills/gsd/references/workflows/research-phase.md +3 -3
- package/.agent/skills/gsd/references/workflows/resume-project.md +3 -3
- package/.agent/skills/gsd/references/workflows/review.md +71 -8
- package/.agent/skills/gsd/references/workflows/scan.md +102 -102
- package/.agent/skills/gsd/references/workflows/secure-phase.md +7 -5
- package/.agent/skills/gsd/references/workflows/settings.md +24 -7
- package/.agent/skills/gsd/references/workflows/ship.md +71 -6
- package/.agent/skills/gsd/references/workflows/sketch-wrap-up.md +283 -0
- package/.agent/skills/gsd/references/workflows/sketch.md +263 -0
- package/.agent/skills/gsd/references/workflows/spec-phase.md +262 -0
- package/.agent/skills/gsd/references/workflows/spike-wrap-up.md +273 -0
- package/.agent/skills/gsd/references/workflows/spike.md +270 -0
- package/.agent/skills/gsd/references/workflows/stats.md +60 -60
- package/.agent/skills/gsd/references/workflows/transition.md +671 -671
- package/.agent/skills/gsd/references/workflows/ui-phase.md +33 -12
- package/.agent/skills/gsd/references/workflows/ui-review.md +6 -4
- package/.agent/skills/gsd/references/workflows/undo.md +3 -1
- package/.agent/skills/gsd/references/workflows/update.md +113 -2
- package/.agent/skills/gsd/references/workflows/validate-phase.md +7 -5
- package/.agent/skills/gsd/references/workflows/verify-phase.md +93 -10
- package/.agent/skills/gsd/references/workflows/verify-work.md +50 -10
- package/.agent/skills/gsd-converter/references/mapping.md +1 -1
- package/.agent/skills/gsd-converter/scripts/convert.py +36 -17
- package/.agent/skills/gsd-converter/scripts/regression_test.py +68 -33
- package/README.md +3 -2
- package/package.json +4 -2
- package/.agent/skills/release-manager/SKILL.md +0 -162
- package/.agent/skills/release-manager/bin/LICENSE +0 -21
- package/.agent/skills/release-manager/bin/gh.exe +0 -0
- package/.agent/skills/release-manager/references/update_kb_from_fixes.md +0 -29
- package/.agent/skills/release-manager/scripts/release.ps1 +0 -222
- package/.agent/skills/selectpaste-update/SKILL.md +0 -46
- package/.agent/skills/selectpaste-update/scripts/sync-commands.py +0 -317
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env pwsh
|
|
2
|
-
|
|
3
|
-
# GSD-Antigravity Verified Release Orchestrator
|
|
4
|
-
# Strictly follows the SKILL.md checklist and generates a final status report.
|
|
5
|
-
|
|
6
|
-
param (
|
|
7
|
-
[string]$version, # Specify version manually (e.g. 1.0.1)
|
|
8
|
-
[switch]$dryRun, # Perform a dry run (no commits/tags/pushes)
|
|
9
|
-
[switch]$skipSync, # Skip the gsd-converter step
|
|
10
|
-
[switch]$noPush, # Build archive but don't push to git/github/npm
|
|
11
|
-
[switch]$skipNpm # Skip NPM publication
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
$ErrorActionPreference = "Stop"
|
|
15
|
-
$checklist = [Ordered]@{}
|
|
16
|
-
$skillPath = ".agent/skills/release-manager/SKILL.md"
|
|
17
|
-
|
|
18
|
-
# --- Helper Functions ---
|
|
19
|
-
|
|
20
|
-
function Get-SkillChecklist {
|
|
21
|
-
if (Test-Path $skillPath) {
|
|
22
|
-
$content = Get-Content $skillPath
|
|
23
|
-
$inChecklist = $false
|
|
24
|
-
foreach ($line in $content) {
|
|
25
|
-
if ($line -match "## 🛠️ Interactive Checklist") { $inChecklist = $true; continue }
|
|
26
|
-
if ($inChecklist -and $line -match "^\s*- \[ \] (.+)") {
|
|
27
|
-
$item = $matches[1].Trim()
|
|
28
|
-
# Clean up bold markers from headers
|
|
29
|
-
$item = $item -replace "\*\*", ""
|
|
30
|
-
$checklist[$item] = " "
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function Set-Verified($item) {
|
|
37
|
-
# Check for direct match or fuzzy match (without backticks/bold)
|
|
38
|
-
foreach ($key in $checklist.Keys) {
|
|
39
|
-
if (($key -replace '\*\*|`', '') -eq ($item -replace '\*\*|`', '')) {
|
|
40
|
-
$checklist[$key] = "x"
|
|
41
|
-
Write-Host "✅ Verified: $key" -ForegroundColor Green
|
|
42
|
-
return
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
Write-Warning "Checklist item not found in SKILL.md: '$item'"
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function Show-StatusReport($newVer) {
|
|
49
|
-
Write-Host "`n========================================" -ForegroundColor Cyan
|
|
50
|
-
Write-Host "🚀 GSD-ANTIGRAVITY RELEASE REPORT (v$newVer)" -ForegroundColor Cyan
|
|
51
|
-
Write-Host "========================================" -ForegroundColor Cyan
|
|
52
|
-
foreach ($item in $checklist.Keys) {
|
|
53
|
-
$mark = $checklist[$item]
|
|
54
|
-
if ($mark -eq "x") {
|
|
55
|
-
Write-Host " [$mark] $item" -ForegroundColor Green
|
|
56
|
-
} else {
|
|
57
|
-
Write-Host " [$mark] $item" -ForegroundColor Gray
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
Write-Host "========================================" -ForegroundColor Cyan
|
|
61
|
-
Write-Host "STATUS: " -NoNewline
|
|
62
|
-
if ($checklist.Values -contains " ") {
|
|
63
|
-
Write-Host "PARTIAL/DRY-RUN" -ForegroundColor Yellow
|
|
64
|
-
} else {
|
|
65
|
-
Write-Host "SUCCESSFUL RELEASE" -ForegroundColor Green
|
|
66
|
-
}
|
|
67
|
-
Write-Host "========================================`n" -ForegroundColor Cyan
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function Get-GitCommits {
|
|
71
|
-
Write-Host "📜 Fetching commits since last tag..." -ForegroundColor Gray
|
|
72
|
-
try {
|
|
73
|
-
$lastTag = git describe --tags --abbrev=0 2>$null
|
|
74
|
-
if ($null -eq $lastTag) { $commits = git log --oneline }
|
|
75
|
-
else { $commits = git log "$lastTag..HEAD" --oneline }
|
|
76
|
-
} catch { $commits = @() }
|
|
77
|
-
|
|
78
|
-
$groups = @{ "Added" = @(); "Changed" = @(); "Fixed" = @(); "Other" = @() }
|
|
79
|
-
foreach ($line in $commits) {
|
|
80
|
-
$msg = ($line -split ' ', 2)[1]
|
|
81
|
-
if ($msg -match "^feat:|^add:|^added:") { $groups["Added"] += "- $msg" }
|
|
82
|
-
elseif ($msg -match "^fix:|^fixed:|^patch:") { $groups["Fixed"] += "- $msg" }
|
|
83
|
-
elseif ($msg -match "^chore:|^changed:|^refactor:|^perf:") { $groups["Changed"] += "- $msg" }
|
|
84
|
-
else { $groups["Other"] += "- $msg" }
|
|
85
|
-
}
|
|
86
|
-
return $groups
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function Get-GsdVersion {
|
|
90
|
-
$manifestPath = ".claude/gsd-file-manifest.json"
|
|
91
|
-
if (Test-Path $manifestPath) {
|
|
92
|
-
$manifest = Get-Content $manifestPath | ConvertFrom-Json
|
|
93
|
-
return $manifest.version
|
|
94
|
-
}
|
|
95
|
-
return "Unknown"
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
# --- Main Logic ---
|
|
99
|
-
|
|
100
|
-
Write-Host "🚀 Initializing Verified Release Orchestrator..." -ForegroundColor Cyan
|
|
101
|
-
Get-SkillChecklist
|
|
102
|
-
|
|
103
|
-
# 1. Phase 0: Readiness Verification
|
|
104
|
-
Write-Host "🔍 Phase 0: Readiness Verification..." -ForegroundColor Yellow
|
|
105
|
-
Set-Verified "Phase 0: Readiness Check"
|
|
106
|
-
|
|
107
|
-
# Git Cleanliness
|
|
108
|
-
if (((git status --porcelain).Length -eq 0) -or $dryRun) { Set-Verified "Git Cleanliness" }
|
|
109
|
-
|
|
110
|
-
# GSD Sync (Always run before release)
|
|
111
|
-
if (-not $skipSync) {
|
|
112
|
-
py .agent/skills/gsd-converter/scripts/convert.py gsd
|
|
113
|
-
Set-Verified "GSD Sync (convert.py gsd)"
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
# Documentation Population
|
|
117
|
-
if (Test-Path ".agent/skills/gsd/references/commands") {
|
|
118
|
-
if ((Get-ChildItem ".agent/skills/gsd/references/commands").Count -gt 10) {
|
|
119
|
-
Set-Verified "Verify references/commands/ population"
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
# npm test
|
|
124
|
-
Set-Verified "npm test (if applicable)"
|
|
125
|
-
|
|
126
|
-
# Auth Checks
|
|
127
|
-
$ghPath = ".\.agent\skills\release-manager\bin\gh.exe"
|
|
128
|
-
if (!(Test-Path $ghPath)) { $ghPath = "gh" }
|
|
129
|
-
try { & $ghPath auth status; Set-Verified "gh auth status" } catch {}
|
|
130
|
-
try { npm whoami; Set-Verified "npm whoami" } catch {}
|
|
131
|
-
|
|
132
|
-
# 2. Phase 1: Versioning
|
|
133
|
-
$package = Get-Content package.json | ConvertFrom-Json
|
|
134
|
-
$currentVersion = $package.version
|
|
135
|
-
if ($version) { $newVersion = $version }
|
|
136
|
-
else { $parts = $currentVersion.Split('.'); $parts[2] = [int]$parts[2] + 1; $newVersion = $parts -join '.' }
|
|
137
|
-
|
|
138
|
-
Write-Host "📈 Target Version: $newVersion" -ForegroundColor Green
|
|
139
|
-
Set-Verified "Phase 1: Strategic Versioning"
|
|
140
|
-
|
|
141
|
-
if (-not $dryRun) {
|
|
142
|
-
$package.version = $newVersion
|
|
143
|
-
$package | ConvertTo-Json -Depth 10 | Set-Content package.json
|
|
144
|
-
Set-Verified "npm version patch --no-git-tag-version"
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
# 3. Phase 2: Documentation Synchronization
|
|
148
|
-
$groups = Get-GitCommits
|
|
149
|
-
Set-Verified "Phase 2: Documentation Synchronization (Automated)"
|
|
150
|
-
if (-not $dryRun) {
|
|
151
|
-
# Update CHANGELOG.md
|
|
152
|
-
$date = Get-Date -Format "yyyy-MM-dd"
|
|
153
|
-
$newEntry = @("## [$newVersion] - $date", "")
|
|
154
|
-
foreach ($cat in @("Added", "Changed", "Fixed", "Other")) {
|
|
155
|
-
if ($groups[$cat].Count -gt 0) { $newEntry += "### $cat"; $newEntry += $groups[$cat]; $newEntry += "" }
|
|
156
|
-
}
|
|
157
|
-
$changelog = Get-Content "CHANGELOG.md"
|
|
158
|
-
$newChangelog = $changelog[0..7] + $newEntry + $changelog[8..($changelog.Length - 1)]
|
|
159
|
-
$newChangelog | Set-Content "CHANGELOG.md" -Encoding utf8
|
|
160
|
-
Set-Verified "Update CHANGELOG.md (Self-writing via release.ps1)"
|
|
161
|
-
|
|
162
|
-
# Update Knowledgebase
|
|
163
|
-
if ($groups["Fixed"].Count -gt 0) {
|
|
164
|
-
$kbEntry = @("", "## [$newVersion] - $date", "")
|
|
165
|
-
foreach ($fix in $groups["Fixed"]) {
|
|
166
|
-
$kbEntry += "### $fix"; $kbEntry += "- **Context**: Automated Fix Update"; $kbEntry += "- **Technical Fix**: Applied via orchestrator."
|
|
167
|
-
}
|
|
168
|
-
$kbEntry | Add-Content "docs/DEV_KNOWLEDGEBASE.md" -Encoding utf8
|
|
169
|
-
}
|
|
170
|
-
Set-Verified "Update docs/DEV_KNOWLEDGEBASE.md (Fix summary via release.ps1)"
|
|
171
|
-
|
|
172
|
-
# Update README Badges
|
|
173
|
-
$gsdVersion = Get-GsdVersion
|
|
174
|
-
Write-Host "🏷️ Syncing README badges (Kit v$newVersion | GSD v$gsdVersion)..." -ForegroundColor Yellow
|
|
175
|
-
$readme = Get-Content "README.md" -Raw
|
|
176
|
-
$readme = $readme -replace "Release-v[0-9.]+", "Release-v$newVersion"
|
|
177
|
-
$readme = $readme -replace "gsd-v[0-9.]+", "gsd-v$gsdVersion"
|
|
178
|
-
$readme | Set-Content "README.md" -Encoding utf8
|
|
179
|
-
Set-Verified "Update README.md (Badge URL replacement via release.ps1)"
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
# 4. Phase 3: Archive
|
|
183
|
-
Set-Verified "Phase 3: Archive & Package"
|
|
184
|
-
$archiveName = "$($package.name)_v$newVersion.zip"
|
|
185
|
-
if (-not $dryRun) {
|
|
186
|
-
$excludes = @("node_modules", ".git", "__tobedeleted", "*.zip", ".antigravity", ".planning", "*.bak", "gh.exe", ".agent/skills/release-manager/bin/gh.exe")
|
|
187
|
-
Get-ChildItem -Path . -Exclude $excludes -Recurse | Compress-Archive -DestinationPath $archiveName -Force
|
|
188
|
-
Set-Verified "Create ZIP archive: gsd-antigravity-kit_v1.0.X.zip"
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
# 5. Phase 4 & 5: Release Execution
|
|
192
|
-
Set-Verified "Phase 4: Release Execution"
|
|
193
|
-
Set-Verified "Phase 5: GitHub Release"
|
|
194
|
-
if (-not $dryRun -and -not $noPush) {
|
|
195
|
-
git add .
|
|
196
|
-
git commit -m "chore: release v$newVersion"
|
|
197
|
-
git tag "v$newVersion"
|
|
198
|
-
Set-Verified "Git Commit & Tag"
|
|
199
|
-
|
|
200
|
-
git push && git push --tags
|
|
201
|
-
Set-Verified "Git Push"
|
|
202
|
-
|
|
203
|
-
$env:GODEBUG = "http2client=0"
|
|
204
|
-
& $ghPath release create "v$newVersion" $archiveName --generate-notes
|
|
205
|
-
Set-Verified "gh release create ... (with GODEBUG=http2client=0)"
|
|
206
|
-
|
|
207
|
-
if (-not $skipNpm) {
|
|
208
|
-
Set-Verified "Phase 6: NPM publication"
|
|
209
|
-
npm publish
|
|
210
|
-
Set-Verified "npm publish"
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
# 6. Phase 7: Cleanup
|
|
215
|
-
Set-Verified "Phase 7: Release Cleanup"
|
|
216
|
-
if (-not $dryRun) {
|
|
217
|
-
Get-ChildItem "$($package.name)_v*.zip" | Sort-Object LastWriteTime -Descending | Select-Object -Skip 2 | Remove-Item -Force
|
|
218
|
-
Set-Verified "Remove old local ZIPs"
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
# --- Final Status Report ---
|
|
222
|
-
Show-StatusReport $newVersion
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: selectpaste-update
|
|
3
|
-
description: "Specialized maintenance skill to synchronize GSD command registries with remote documentation and local backups. Use for: (1) Refreshing the gsd: slash command list, (2) Updating gsd-tools programmatic references, (3) Syncing local __backup documentation from GitHub, (4) Maintaining the command usage JSON."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# selectpaste-update
|
|
7
|
-
|
|
8
|
-
## Purpose
|
|
9
|
-
|
|
10
|
-
The **selectpaste-update** skill automates the synchronization between the GSD documentation and the programmatic command registry used by GSD tools and UI components. It ensures that any changes made to the "official" GSD documentation are immediately reflected in the local environment and the JSON registry.
|
|
11
|
-
|
|
12
|
-
## Triggers
|
|
13
|
-
|
|
14
|
-
This skill triggers on maintenance and synchronization requests such as:
|
|
15
|
-
- "sync gsd commands"
|
|
16
|
-
- "refresh command registry"
|
|
17
|
-
- "update gsd-tools reference"
|
|
18
|
-
- "sync gsd docs from github"
|
|
19
|
-
- "maintenance: registry refresh"
|
|
20
|
-
|
|
21
|
-
## Core Workflow
|
|
22
|
-
|
|
23
|
-
### 1. Synchronize Command Registry
|
|
24
|
-
|
|
25
|
-
The primary action of this skill is to run the registry synchronization script. This process performs the following steps:
|
|
26
|
-
1. **Fetch**: Downloads the latest `COMMANDS.md` and `CLI-TOOLS.md` from the `gsd-build/get-shit-done` repository.
|
|
27
|
-
2. **Local Sync**: Updates `__backup/COMMANDS.md` and `__backup/CLI-TOOLS.md` with the fetched content.
|
|
28
|
-
3. **Backup**: Creates a `.bak` timestamped copy of the existing `__backup/commands.json`.
|
|
29
|
-
4. **Merge**: Parses the Markdown files and merges new data into `commands.json`, preserving existing `UsageCount` and manual `GroupName` assignments.
|
|
30
|
-
|
|
31
|
-
**Command:**
|
|
32
|
-
```powershell
|
|
33
|
-
py .agent/skills/selectpaste-update/scripts/sync-commands.py
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Best Practices
|
|
37
|
-
|
|
38
|
-
- **Verify Before Sync**: If you have local modifications in `__backup/` that are not yet on GitHub, run with the `--local` flag to prevent overwriting them.
|
|
39
|
-
- **Review Diffs**: Always review the git diff for `__backup/commands.json` after a sync to ensure that group assignments and counts are preserved correctly.
|
|
40
|
-
- **Reporting**: After a successful sync, the script provides a summary of added, updated, and deprecated commands.
|
|
41
|
-
|
|
42
|
-
## Reference Material
|
|
43
|
-
|
|
44
|
-
- [COMMANDS.md](file:///c:/projects/GSD-Antigravity/__backup/COMMANDS.md) - Slash command reference
|
|
45
|
-
- [CLI-TOOLS.md](file:///c:/projects/GSD-Antigravity/__backup/CLI-TOOLS.md) - Programmatic tools reference
|
|
46
|
-
- [commands.json](file:///c:/projects/GSD-Antigravity/__backup/commands.json) - The generated registry
|
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
import os
|
|
3
|
-
import re
|
|
4
|
-
import urllib.request
|
|
5
|
-
from datetime import datetime
|
|
6
|
-
import shutil
|
|
7
|
-
import sys
|
|
8
|
-
|
|
9
|
-
# Configuration
|
|
10
|
-
CONFIG = {
|
|
11
|
-
"backup_dir": "__backup",
|
|
12
|
-
"json_file": "commands.json",
|
|
13
|
-
"md_commands": "COMMANDS.md",
|
|
14
|
-
"md_cli": "CLI-TOOLS.md",
|
|
15
|
-
"remote_commands": "https://raw.githubusercontent.com/gsd-build/get-shit-done/main/docs/COMMANDS.md",
|
|
16
|
-
"remote_cli": "https://raw.githubusercontent.com/gsd-build/get-shit-done/main/docs/CLI-TOOLS.md"
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
def fetch_url(url):
|
|
20
|
-
try:
|
|
21
|
-
with urllib.request.urlopen(url) as response:
|
|
22
|
-
return response.read().decode('utf-8')
|
|
23
|
-
except Exception as e:
|
|
24
|
-
print(f"⚠️ Failed to fetch {url}: {e}")
|
|
25
|
-
return None
|
|
26
|
-
|
|
27
|
-
def save_local(filename, content):
|
|
28
|
-
path = os.path.join(CONFIG["backup_dir"], filename)
|
|
29
|
-
with open(path, 'w', encoding='utf-8') as f:
|
|
30
|
-
f.write(content)
|
|
31
|
-
print(f"✅ Updated local cache: {path}")
|
|
32
|
-
|
|
33
|
-
def backup_json(path):
|
|
34
|
-
if os.path.exists(path):
|
|
35
|
-
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
|
36
|
-
backup_path = f"{path}.{timestamp}.bak"
|
|
37
|
-
shutil.copy2(path, backup_path)
|
|
38
|
-
print(f"📦 Created backup: {backup_path}")
|
|
39
|
-
|
|
40
|
-
def parse_commands_md(content):
|
|
41
|
-
commands = []
|
|
42
|
-
# Match headers like ### `/gsd-something` or ### `/gsd-something [args]`
|
|
43
|
-
pattern = r'### `/(gsd-[a-z0-9-]+)(.*?)`'
|
|
44
|
-
sections = re.split(pattern, content)
|
|
45
|
-
|
|
46
|
-
# sections[0] is preamble
|
|
47
|
-
# Then it comes in triplets: name, args, body
|
|
48
|
-
for i in range(1, len(sections), 3):
|
|
49
|
-
cmd_slug = sections[i]
|
|
50
|
-
cmd_args = sections[i+1].strip()
|
|
51
|
-
body = sections[i+2].strip()
|
|
52
|
-
|
|
53
|
-
# Normalize to colon format for value
|
|
54
|
-
# Mapping /gsd-new-project to gsd:new-project
|
|
55
|
-
clean_name = cmd_slug.replace('gsd-', '')
|
|
56
|
-
value = f"gsd:{clean_name}"
|
|
57
|
-
if cmd_args:
|
|
58
|
-
value += f" {cmd_args}"
|
|
59
|
-
|
|
60
|
-
# Extract first paragraph as base description
|
|
61
|
-
desc_lines = []
|
|
62
|
-
for line in body.split('\n'):
|
|
63
|
-
if line.strip() and not line.startswith('|') and not line.startswith('**'):
|
|
64
|
-
desc_lines.append(line.strip())
|
|
65
|
-
if len(desc_lines) > 2: # Keep it concise
|
|
66
|
-
break
|
|
67
|
-
|
|
68
|
-
description = " ".join(desc_lines)
|
|
69
|
-
|
|
70
|
-
# Extract example if exists
|
|
71
|
-
examples = re.findall(r'```bash\n(.*?)\n```', body, re.DOTALL)
|
|
72
|
-
if examples:
|
|
73
|
-
description += f"\n\nExample:\n{examples[0].strip()}"
|
|
74
|
-
|
|
75
|
-
commands.append({
|
|
76
|
-
"label": clean_name,
|
|
77
|
-
"value": value,
|
|
78
|
-
"description": description,
|
|
79
|
-
"type": "gsd"
|
|
80
|
-
})
|
|
81
|
-
return commands
|
|
82
|
-
|
|
83
|
-
def parse_cli_md(content):
|
|
84
|
-
commands = []
|
|
85
|
-
# Match code blocks starting with node gsd-tools.cjs
|
|
86
|
-
pattern = r'node gsd-tools\.cjs (.*?)(?=\n|#|$)'
|
|
87
|
-
matches = re.findall(pattern, content)
|
|
88
|
-
|
|
89
|
-
# We also want to find descriptions before these blocks
|
|
90
|
-
# This is harder with regex, let's just find the commands first
|
|
91
|
-
for match in matches:
|
|
92
|
-
clean_cmd = match.strip()
|
|
93
|
-
# Mapping to gsd-tools command
|
|
94
|
-
value = f"gsd:gsd-tools {clean_cmd}"
|
|
95
|
-
|
|
96
|
-
# For CLI tools, label is the command itself
|
|
97
|
-
label = clean_cmd
|
|
98
|
-
|
|
99
|
-
# Logic to find description based on preceding lines
|
|
100
|
-
# In CLI-TOOLS.md, descriptions are often in comments like # Load full project config
|
|
101
|
-
# Let's search for the line before the match
|
|
102
|
-
lines = content.split('\n')
|
|
103
|
-
desc = ""
|
|
104
|
-
for i, line in enumerate(lines):
|
|
105
|
-
if f"node gsd-tools.cjs {clean_cmd}" in line:
|
|
106
|
-
# Look up to 2 lines back for a comment
|
|
107
|
-
for j in range(i-1, max(-1, i-3), -1):
|
|
108
|
-
if lines[j].strip().startswith('#'):
|
|
109
|
-
desc = lines[j].strip().lstrip('#').strip()
|
|
110
|
-
break
|
|
111
|
-
break
|
|
112
|
-
|
|
113
|
-
commands.append({
|
|
114
|
-
"label": label,
|
|
115
|
-
"value": value,
|
|
116
|
-
"description": desc or "CLI utility command.",
|
|
117
|
-
"type": "tool"
|
|
118
|
-
})
|
|
119
|
-
return commands
|
|
120
|
-
|
|
121
|
-
def get_base_name(full_val):
|
|
122
|
-
# Normalize: strip common prefixes
|
|
123
|
-
val = full_val.strip()
|
|
124
|
-
|
|
125
|
-
# 1. Handle gsd-tools specifically
|
|
126
|
-
if "gsd-tools" in val:
|
|
127
|
-
# Strip everything before gsd-tools or node gsd-tools.cjs
|
|
128
|
-
clean = re.sub(r'.*?gsd-tools(\.cjs)?\s+', '', val)
|
|
129
|
-
# Take words that are not flags or placeholders or complex args
|
|
130
|
-
parts = clean.split(' ')
|
|
131
|
-
res = []
|
|
132
|
-
for p in parts:
|
|
133
|
-
if not p or p.startswith('-') or '<' in p or '[' in p or '@' in p or '|' in p or '(' in p:
|
|
134
|
-
break
|
|
135
|
-
res.append(p)
|
|
136
|
-
return "gsd-tools " + " ".join(res).strip()
|
|
137
|
-
|
|
138
|
-
# 2. Handle slash commands
|
|
139
|
-
if val.startswith('/') or val.startswith('gsd:'):
|
|
140
|
-
clean = re.sub(r'^(gsd:|/)', '', val)
|
|
141
|
-
# Take the first word only (the command name)
|
|
142
|
-
return clean.split(' ')[0].strip()
|
|
143
|
-
|
|
144
|
-
# 3. Fallback
|
|
145
|
-
return val.split(' ')[0].strip()
|
|
146
|
-
|
|
147
|
-
def sync():
|
|
148
|
-
is_local = "--local" in sys.argv
|
|
149
|
-
print(f"🔄 Starting GSD Registry Sync{' (LOCAL MODE)' if is_local else ''}...")
|
|
150
|
-
|
|
151
|
-
# 1. & 2. Fetch / Load
|
|
152
|
-
cmd_content = None
|
|
153
|
-
cli_content = None
|
|
154
|
-
|
|
155
|
-
if not is_local:
|
|
156
|
-
cmd_content = fetch_url(CONFIG["remote_commands"])
|
|
157
|
-
cli_content = fetch_url(CONFIG["remote_cli"])
|
|
158
|
-
|
|
159
|
-
# Update local cache if fetch succeeded
|
|
160
|
-
if cmd_content:
|
|
161
|
-
save_local(CONFIG["md_commands"], cmd_content)
|
|
162
|
-
if cli_content:
|
|
163
|
-
save_local(CONFIG["md_cli"], cli_content)
|
|
164
|
-
|
|
165
|
-
# Load from local if fetch failed or local mode enabled
|
|
166
|
-
if not cmd_content:
|
|
167
|
-
local_cmd_path = os.path.join(CONFIG["backup_dir"], CONFIG["md_commands"])
|
|
168
|
-
if os.path.exists(local_cmd_path):
|
|
169
|
-
print(f"ℹ️ Loading local {CONFIG['md_commands']}.")
|
|
170
|
-
with open(local_cmd_path, 'r', encoding='utf-8') as f:
|
|
171
|
-
cmd_content = f.read()
|
|
172
|
-
|
|
173
|
-
if not cli_content:
|
|
174
|
-
local_cli_path = os.path.join(CONFIG["backup_dir"], CONFIG["md_cli"])
|
|
175
|
-
if os.path.exists(local_cli_path):
|
|
176
|
-
print(f"ℹ️ Loading local {CONFIG['md_cli']}.")
|
|
177
|
-
with open(local_cli_path, 'r', encoding='utf-8') as f:
|
|
178
|
-
cli_content = f.read()
|
|
179
|
-
|
|
180
|
-
if not cmd_content or not cli_content:
|
|
181
|
-
print("❌ Error: Could not find command or CLI markdown files.")
|
|
182
|
-
return
|
|
183
|
-
|
|
184
|
-
# 3. Backup JSON
|
|
185
|
-
json_path = os.path.join(CONFIG["backup_dir"], CONFIG["json_file"])
|
|
186
|
-
backup_json(json_path)
|
|
187
|
-
|
|
188
|
-
# 4. Parse Latest
|
|
189
|
-
new_gsd_cmds = parse_commands_md(cmd_content)
|
|
190
|
-
new_tool_cmds = parse_cli_md(cli_content)
|
|
191
|
-
|
|
192
|
-
# 5. Load Existing to Merge
|
|
193
|
-
try:
|
|
194
|
-
with open(json_path, 'r', encoding='utf-8') as f:
|
|
195
|
-
existing_data = json.load(f)
|
|
196
|
-
except Exception as e:
|
|
197
|
-
print(f"⚠️ Failed to load existing JSON: {e}")
|
|
198
|
-
existing_data = []
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
# Flatten existing for easier lookup by base command
|
|
202
|
-
# We prioritize non-"NEW" groups if duplicates exist
|
|
203
|
-
existing_map = {}
|
|
204
|
-
for group in existing_data:
|
|
205
|
-
gname = group["name"]
|
|
206
|
-
is_new_group = gname.startswith("[NEW]")
|
|
207
|
-
|
|
208
|
-
for cmd in group.get("commands", []):
|
|
209
|
-
base_name = get_base_name(cmd.get("value", ""))
|
|
210
|
-
|
|
211
|
-
# If we haven't seen this base yet, or if previous was from a [NEW] group
|
|
212
|
-
# but current isn't, overwrite to prioritize the permanent group
|
|
213
|
-
if base_name not in existing_map or (existing_map[base_name]["IsNewGroup"] and not is_new_group):
|
|
214
|
-
existing_map[base_name] = {
|
|
215
|
-
"Metadata": cmd,
|
|
216
|
-
"Group": gname,
|
|
217
|
-
"IsNewGroup": is_new_group
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
# 6. Merge & Classify
|
|
221
|
-
groups = {g["name"]: g for g in existing_data}
|
|
222
|
-
|
|
223
|
-
# Global Deduplication:
|
|
224
|
-
# Ensure each command only exists in its most specialized group (favor non-"NEW" groups)
|
|
225
|
-
for base_name, match_info in existing_map.items():
|
|
226
|
-
primary_group = match_info["Group"]
|
|
227
|
-
for gname in groups:
|
|
228
|
-
if gname != primary_group:
|
|
229
|
-
groups[gname]["commands"] = [
|
|
230
|
-
d for d in groups[gname]["commands"]
|
|
231
|
-
if get_base_name(d["value"]) != base_name
|
|
232
|
-
]
|
|
233
|
-
|
|
234
|
-
# Ensure staging groups exist
|
|
235
|
-
if "[NEW] GSD COMMANDS" not in groups:
|
|
236
|
-
groups["[NEW] GSD COMMANDS"] = {"name": "[NEW] GSD COMMANDS", "description": "Newly discovered slash commands.", "commands": []}
|
|
237
|
-
if "[NEW] GSD-TOOLS" not in groups:
|
|
238
|
-
groups["[NEW] GSD-TOOLS"] = {"name": "[NEW] GSD-TOOLS", "description": "Newly discovered gsd-tools commands.", "commands": []}
|
|
239
|
-
|
|
240
|
-
processed_names = set()
|
|
241
|
-
|
|
242
|
-
def merge_cmd(new_cmd, default_group):
|
|
243
|
-
full_val = new_cmd["value"]
|
|
244
|
-
base_name = get_base_name(full_val)
|
|
245
|
-
processed_names.add(base_name)
|
|
246
|
-
|
|
247
|
-
if base_name in existing_map:
|
|
248
|
-
# Update existing
|
|
249
|
-
old_cmd = existing_map[base_name]["Metadata"]
|
|
250
|
-
group_name = existing_map[base_name]["Group"]
|
|
251
|
-
|
|
252
|
-
# Preserve numeric prefix if label has one
|
|
253
|
-
label = new_cmd["label"]
|
|
254
|
-
match = re.match(r'^(\d+\.)\s*(.*)', old_cmd.get("label", ""))
|
|
255
|
-
if match:
|
|
256
|
-
label = f"{match.group(1)} {label}"
|
|
257
|
-
|
|
258
|
-
updated_cmd = {
|
|
259
|
-
"label": label,
|
|
260
|
-
"value": full_val, # Use new value (with potentially updated args)
|
|
261
|
-
"description": new_cmd["description"],
|
|
262
|
-
"GroupName": group_name,
|
|
263
|
-
"UsageCount": old_cmd.get("UsageCount", 0),
|
|
264
|
-
"FullDisplay": f"[{group_name.upper()}] {label} -> {full_val}",
|
|
265
|
-
"TabDisplay": f"{label} -> {full_val}"
|
|
266
|
-
}
|
|
267
|
-
# Put back in the right group
|
|
268
|
-
# Clear ANY other old versions just in case
|
|
269
|
-
groups[group_name]["commands"] = [
|
|
270
|
-
d for d in groups[group_name]["commands"]
|
|
271
|
-
if get_base_name(d["value"]) != base_name
|
|
272
|
-
]
|
|
273
|
-
groups[group_name]["commands"].append(updated_cmd)
|
|
274
|
-
else:
|
|
275
|
-
# Add to staged
|
|
276
|
-
new_entry = {
|
|
277
|
-
"label": new_cmd["label"],
|
|
278
|
-
"value": full_val,
|
|
279
|
-
"description": new_cmd["description"],
|
|
280
|
-
"GroupName": default_group,
|
|
281
|
-
"UsageCount": 0,
|
|
282
|
-
"FullDisplay": f"[{default_group.upper()}] {new_cmd['label']} -> {full_val}",
|
|
283
|
-
"TabDisplay": f"{new_cmd['label']} -> {full_val}"
|
|
284
|
-
}
|
|
285
|
-
groups[default_group]["commands"].append(new_entry)
|
|
286
|
-
|
|
287
|
-
for cmd in new_gsd_cmds:
|
|
288
|
-
merge_cmd(cmd, "[NEW] GSD COMMANDS")
|
|
289
|
-
|
|
290
|
-
for cmd in new_tool_cmds:
|
|
291
|
-
merge_cmd(cmd, "[NEW] GSD-TOOLS")
|
|
292
|
-
|
|
293
|
-
# Re-order commands in each group (numeric sort)
|
|
294
|
-
for gname in groups:
|
|
295
|
-
group = groups[gname]
|
|
296
|
-
group["commands"].sort(key=lambda x: x.get("label", ""))
|
|
297
|
-
|
|
298
|
-
# Convert groups back to list
|
|
299
|
-
# Preserve original group ordering
|
|
300
|
-
ordered_group_names = [g["name"] for g in existing_data]
|
|
301
|
-
for gname in groups:
|
|
302
|
-
if gname not in ordered_group_names:
|
|
303
|
-
ordered_group_names.append(gname)
|
|
304
|
-
|
|
305
|
-
final_output = [groups[name] for name in ordered_group_names if groups[name]["commands"]]
|
|
306
|
-
|
|
307
|
-
# 7. Write Result
|
|
308
|
-
with open(json_path, 'w', encoding='utf-8') as f:
|
|
309
|
-
json.dump(final_output, f, indent=2, ensure_ascii=False)
|
|
310
|
-
|
|
311
|
-
print(f"✨ Successfully synchronized {len(processed_names)} commands to {json_path}")
|
|
312
|
-
|
|
313
|
-
if __name__ == "__main__":
|
|
314
|
-
# Ensure backup dir exists
|
|
315
|
-
if not os.path.exists(CONFIG["backup_dir"]):
|
|
316
|
-
os.makedirs(CONFIG["backup_dir"])
|
|
317
|
-
sync()
|