@orchestrator-claude/cli 3.1.12 → 3.2.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.
Files changed (99) hide show
  1. package/dist/api-client/OrchestratorAPIClient.d.ts +50 -1
  2. package/dist/api-client/OrchestratorAPIClient.d.ts.map +1 -1
  3. package/dist/api-client/OrchestratorAPIClient.js +73 -1
  4. package/dist/api-client/OrchestratorAPIClient.js.map +1 -1
  5. package/dist/api-client/types.d.ts +95 -2
  6. package/dist/api-client/types.d.ts.map +1 -1
  7. package/dist/commands/InitCommand.d.ts +22 -3
  8. package/dist/commands/InitCommand.d.ts.map +1 -1
  9. package/dist/commands/InitCommand.js +147 -13
  10. package/dist/commands/InitCommand.js.map +1 -1
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +1 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/services/BootstrapService.d.ts +100 -0
  16. package/dist/services/BootstrapService.d.ts.map +1 -0
  17. package/dist/services/BootstrapService.js +231 -0
  18. package/dist/services/BootstrapService.js.map +1 -0
  19. package/dist/services/CleanupManager.d.ts +49 -0
  20. package/dist/services/CleanupManager.d.ts.map +1 -0
  21. package/dist/services/CleanupManager.js +87 -0
  22. package/dist/services/CleanupManager.js.map +1 -0
  23. package/dist/services/CredentialGenerator.d.ts +11 -0
  24. package/dist/services/CredentialGenerator.d.ts.map +1 -0
  25. package/dist/services/CredentialGenerator.js +25 -0
  26. package/dist/services/CredentialGenerator.js.map +1 -0
  27. package/dist/services/VerificationService.d.ts +103 -0
  28. package/dist/services/VerificationService.d.ts.map +1 -0
  29. package/dist/services/VerificationService.js +350 -0
  30. package/dist/services/VerificationService.js.map +1 -0
  31. package/dist/templates/base/claude/skills/release/SKILL.md +236 -0
  32. package/dist/templates/base/claude/skills/release/release.sh +460 -0
  33. package/dist/templates/base/docker-compose.yml.hbs +189 -8
  34. package/dist/templates/base/mcp.json.hbs +16 -9
  35. package/dist/templates/default/docker-compose.yml +190 -10
  36. package/package.json +1 -1
  37. package/templates/base/claude/skills/release/SKILL.md +236 -0
  38. package/templates/base/claude/skills/release/release.sh +460 -0
  39. package/templates/base/docker-compose.yml.hbs +189 -8
  40. package/templates/base/mcp.json.hbs +16 -9
  41. package/templates/default/docker-compose.yml +190 -10
  42. package/dist/templates/base/orchestrator-index.json.hbs +0 -37
  43. package/dist/templates/projects/api/files/index.ts.hbs +0 -30
  44. package/dist/templates/projects/api/files/server.ts.hbs +0 -63
  45. package/dist/templates/projects/api/files/tsconfig.json.hbs +0 -27
  46. package/dist/templates/projects/api/files/vitest.config.ts.hbs +0 -28
  47. package/dist/templates/projects/api/template.config.json +0 -238
  48. package/dist/templates/projects/api/template.config.ts +0 -149
  49. package/dist/templates/projects/cli/files/cli.ts.hbs +0 -50
  50. package/dist/templates/projects/cli/files/index.ts.hbs +0 -8
  51. package/dist/templates/projects/cli/files/tsconfig.json.hbs +0 -27
  52. package/dist/templates/projects/cli/files/vitest.config.ts.hbs +0 -28
  53. package/dist/templates/projects/cli/template.config.json +0 -213
  54. package/dist/templates/projects/cli/template.config.ts +0 -126
  55. package/dist/templates/projects/frontend/files/App.tsx.hbs +0 -31
  56. package/dist/templates/projects/frontend/files/index.html.hbs +0 -13
  57. package/dist/templates/projects/frontend/files/main.tsx.hbs +0 -22
  58. package/dist/templates/projects/frontend/files/tsconfig.json.hbs +0 -34
  59. package/dist/templates/projects/frontend/files/tsconfig.node.json.hbs +0 -10
  60. package/dist/templates/projects/frontend/files/vite.config.ts.hbs +0 -19
  61. package/dist/templates/projects/frontend/files/vitest.config.ts.hbs +0 -36
  62. package/dist/templates/projects/frontend/template.config.json +0 -241
  63. package/dist/templates/projects/frontend/template.config.ts +0 -153
  64. package/dist/templates/projects/minimal/files/claude-settings.json.hbs +0 -20
  65. package/dist/templates/projects/minimal/files/env.example.hbs +0 -17
  66. package/dist/templates/projects/minimal/files/gitignore.hbs +0 -41
  67. package/dist/templates/projects/minimal/files/index.ts.hbs +0 -13
  68. package/dist/templates/projects/minimal/files/tsconfig.json.hbs +0 -27
  69. package/dist/templates/projects/minimal/template.config.json +0 -185
  70. package/dist/templates/projects/minimal/template.config.ts +0 -88
  71. package/templates/base/orchestrator-index.json.hbs +0 -37
  72. package/templates/projects/api/files/index.ts.hbs +0 -30
  73. package/templates/projects/api/files/server.ts.hbs +0 -63
  74. package/templates/projects/api/files/tsconfig.json.hbs +0 -27
  75. package/templates/projects/api/files/vitest.config.ts.hbs +0 -28
  76. package/templates/projects/api/template.config.json +0 -238
  77. package/templates/projects/api/template.config.ts +0 -149
  78. package/templates/projects/cli/files/cli.ts.hbs +0 -50
  79. package/templates/projects/cli/files/index.ts.hbs +0 -8
  80. package/templates/projects/cli/files/tsconfig.json.hbs +0 -27
  81. package/templates/projects/cli/files/vitest.config.ts.hbs +0 -28
  82. package/templates/projects/cli/template.config.json +0 -213
  83. package/templates/projects/cli/template.config.ts +0 -126
  84. package/templates/projects/frontend/files/App.tsx.hbs +0 -31
  85. package/templates/projects/frontend/files/index.html.hbs +0 -13
  86. package/templates/projects/frontend/files/main.tsx.hbs +0 -22
  87. package/templates/projects/frontend/files/tsconfig.json.hbs +0 -34
  88. package/templates/projects/frontend/files/tsconfig.node.json.hbs +0 -10
  89. package/templates/projects/frontend/files/vite.config.ts.hbs +0 -19
  90. package/templates/projects/frontend/files/vitest.config.ts.hbs +0 -36
  91. package/templates/projects/frontend/template.config.json +0 -241
  92. package/templates/projects/frontend/template.config.ts +0 -153
  93. package/templates/projects/minimal/files/claude-settings.json.hbs +0 -20
  94. package/templates/projects/minimal/files/env.example.hbs +0 -17
  95. package/templates/projects/minimal/files/gitignore.hbs +0 -41
  96. package/templates/projects/minimal/files/index.ts.hbs +0 -13
  97. package/templates/projects/minimal/files/tsconfig.json.hbs +0 -27
  98. package/templates/projects/minimal/template.config.json +0 -185
  99. package/templates/projects/minimal/template.config.ts +0 -88
@@ -0,0 +1,236 @@
1
+ ---
2
+ name: release
3
+ description: Executa release oficial do Orchestrator via CI/CD. NUNCA faca bump manual de versao - sempre use esta skill.
4
+ allowed-tools: Read, Bash, Grep, Glob
5
+ ---
6
+
7
+ # Release Skill
8
+
9
+ ## REGRA CRITICA
10
+
11
+ **NUNCA faca bump de versao manualmente!**
12
+
13
+ - ❌ NUNCA edite `package.json` para alterar versao
14
+ - ❌ NUNCA crie tags git manualmente
15
+ - ❌ NUNCA faca `docker build` + `docker push` manual
16
+ - ✅ SEMPRE use esta skill para releases
17
+
18
+ Releases manuais causam dessincronizacao entre npm, Docker e package.json.
19
+
20
+ ## Descricao
21
+
22
+ Esta skill automatiza o processo de release do Orchestrator:
23
+
24
+ 1. Valida pre-requisitos (git clean, branch main)
25
+ 2. Calcula nova versao (patch/minor/major)
26
+ 3. Atualiza TODOS os arquivos de versao
27
+ 4. Cria commit e tag
28
+ 5. Push dispara CI/CD (npm publish + Docker build)
29
+
30
+ ## Arquivos Atualizados pelo Script
31
+
32
+ O script atualiza automaticamente:
33
+
34
+ - `package.json` (root)
35
+ - `packages/cli/package.json`
36
+ - `packages/mcp-server/package.json`
37
+ - `packages/cli/src/index.ts` (CLI_VERSION constant)
38
+ - `src/infrastructure/templates/base/package.json.hbs` (template versions)
39
+
40
+ ## Invocacao
41
+
42
+ ```
43
+ /release patch # 1.5.6 -> 1.5.7
44
+ /release minor # 1.5.6 -> 1.6.0
45
+ /release major # 1.5.6 -> 2.0.0
46
+ /release 2.0.0 # Versao explicita
47
+ ```
48
+
49
+ ## Parametros
50
+
51
+ | Parametro | Tipo | Obrigatorio | Descricao |
52
+ |-----------|------|-------------|-----------|
53
+ | `version` | string | Sim | patch, minor, major, ou x.y.z |
54
+ | `--dry-run` | flag | Nao | Mostra o que seria feito sem executar |
55
+ | `--force` | flag | Nao | Pula confirmacoes interativas |
56
+
57
+ ## Processo de Execucao
58
+
59
+ ### 1. Pre-verificacao
60
+
61
+ Antes de executar o script, verifique:
62
+
63
+ ```bash
64
+ # Working tree limpa?
65
+ git status
66
+
67
+ # Na branch main?
68
+ git branch --show-current
69
+
70
+ # Ultima tag?
71
+ git describe --tags --abbrev=0
72
+ ```
73
+
74
+ ### 2. Dry Run (Recomendado)
75
+
76
+ Sempre faca dry-run primeiro:
77
+
78
+ ```bash
79
+ ./scripts/release.sh --dry-run patch
80
+ ```
81
+
82
+ ### 3. Executar Release
83
+
84
+ ```bash
85
+ ./scripts/release.sh patch
86
+ ```
87
+
88
+ ### 4. Monitorar CI/CD
89
+
90
+ Apos o push, monitore o pipeline:
91
+ - GitHub Actions: https://github.com/orchestratorAII/orchestrator_claude/actions
92
+
93
+ ## Exemplos de Uso
94
+
95
+ ### Release de Patch (Bug Fix)
96
+
97
+ ```
98
+ User: "Faca release do fix que acabamos de fazer"
99
+
100
+ Claude:
101
+ 1. Verifico pre-requisitos
102
+ 2. Executo: ./scripts/release.sh --dry-run patch
103
+ 3. Confirmo com usuario
104
+ 4. Executo: ./scripts/release.sh patch
105
+ 5. Reporto URL do pipeline
106
+ ```
107
+
108
+ ### Release de Minor (Nova Feature)
109
+
110
+ ```
111
+ User: "Release da nova feature de dashboard"
112
+
113
+ Claude:
114
+ 1. Verifico CHANGELOG atualizado
115
+ 2. Executo: ./scripts/release.sh --dry-run minor
116
+ 3. Confirmo com usuario
117
+ 4. Executo: ./scripts/release.sh minor
118
+ ```
119
+
120
+ ### Release de Major (Breaking Change)
121
+
122
+ ```
123
+ User: "Precisamos fazer release 2.0.0"
124
+
125
+ Claude:
126
+ 1. Verifico CHANGELOG com breaking changes documentados
127
+ 2. Executo: ./scripts/release.sh --dry-run 2.0.0
128
+ 3. ALERTA sobre breaking changes
129
+ 4. Confirmo DUAS vezes com usuario
130
+ 5. Executo: ./scripts/release.sh 2.0.0
131
+ ```
132
+
133
+ ## Output Esperado
134
+
135
+ ```
136
+ ════════════════════════════════════════
137
+ Orchestrator Release Script
138
+ ════════════════════════════════════════
139
+
140
+ 🔍 Validating prerequisites...
141
+ ✅ All prerequisites satisfied
142
+ 🔍 Validating working tree...
143
+ ✅ Working tree is clean
144
+
145
+ Release Plan:
146
+ Current version: 1.5.6
147
+ New version: 1.5.7
148
+ Git tag: v1.5.7
149
+
150
+ ✅ Tag 'v1.5.7' is available
151
+
152
+ Files to update:
153
+ - package.json (root)
154
+ - packages/cli/package.json
155
+ - packages/mcp-server/package.json
156
+ - packages/cli/src/index.ts (CLI_VERSION)
157
+ - src/infrastructure/templates/base/package.json.hbs (templates)
158
+
159
+ Continue with release? (y/N): y
160
+
161
+ 📝 Updating versions to 1.5.7...
162
+ ✅ All versions updated to 1.5.7
163
+ ✅ Version bump committed
164
+ ✅ Tag created: v1.5.7
165
+ ⬆️ Pushing to remote...
166
+ ✅ Pushed main and tag v1.5.7
167
+
168
+ ════════════════════════════════════════
169
+ Release v1.5.7 initiated!
170
+ ════════════════════════════════════════
171
+
172
+ 🚀 CI/CD pipeline will now:
173
+ - Build and publish Docker image
174
+ - Publish npm packages
175
+
176
+ 📍 Monitor pipeline at:
177
+ https://github.com/orchestratorAII/orchestrator_claude/actions
178
+ ```
179
+
180
+ ## Troubleshooting
181
+
182
+ ### Working tree not clean
183
+
184
+ ```
185
+ ❌ Working tree is not clean
186
+ Please commit or stash your changes
187
+ ```
188
+
189
+ **Solucao:** Commit ou stash as mudancas pendentes antes do release.
190
+
191
+ ### Tag already exists
192
+
193
+ ```
194
+ ❌ Tag 'v1.5.7' already exists
195
+ ```
196
+
197
+ **Solucao:** Use uma versao diferente ou delete a tag existente (se foi erro).
198
+
199
+ ### Not on main branch
200
+
201
+ ```
202
+ ⚠️ You are on branch 'feature-x', not main
203
+ ```
204
+
205
+ **Solucao:** Merge para main primeiro, depois faca release.
206
+
207
+ ## Integracao com CI/CD
208
+
209
+ O push da tag dispara automaticamente:
210
+
211
+ 1. **GitHub Actions** (`release.yml`)
212
+ - Build e teste
213
+ - Publish npm packages
214
+ - Build e push Docker image
215
+
216
+ 2. **Versoes Sincronizadas**
217
+ - npm: @orchestrator-claude/cli
218
+ - npm: @orchestrator-claude/mcp-server
219
+ - Docker: orchestrator-api:vX.Y.Z
220
+
221
+ ## Notas Importantes
222
+
223
+ 1. **Sempre faca dry-run primeiro** para verificar mudancas
224
+ 2. **CHANGELOG deve estar atualizado** antes do release
225
+ 3. **CI/CD faz o publish** - nunca publique manualmente
226
+ 4. **Uma tag = uma versao** em todos os lugares
227
+ 5. **Major releases** requerem confirmacao extra
228
+
229
+ ## Checklist Pre-Release
230
+
231
+ - [ ] CHANGELOG.md atualizado com todas as mudancas
232
+ - [ ] Todos os testes passando (`npm test`)
233
+ - [ ] Build funcionando (`npm run build`)
234
+ - [ ] Working tree limpa
235
+ - [ ] Na branch main
236
+ - [ ] Dry-run executado e revisado
@@ -0,0 +1,460 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # ============================================================================
5
+ # Release Script - Orchestrator v1.5.x
6
+ # ============================================================================
7
+ # Automates version bump and tag creation. CI/CD handles npm/Docker publish.
8
+ #
9
+ # Usage:
10
+ # ./scripts/release.sh patch # 1.5.0 -> 1.5.1
11
+ # ./scripts/release.sh minor # 1.5.0 -> 1.6.0
12
+ # ./scripts/release.sh major # 1.5.0 -> 2.0.0
13
+ # ./scripts/release.sh 1.5.1 # Explicit version
14
+ #
15
+ # Files updated:
16
+ # - package.json (root)
17
+ # - packages/cli/package.json
18
+ # - packages/mcp-server/package.json
19
+ # - packages/cli/src/index.ts (CLI_VERSION constant)
20
+ # - src/infrastructure/templates/base/package.json.hbs (template versions)
21
+ #
22
+ # ============================================================================
23
+
24
+ # Colors for output
25
+ RED='\033[0;31m'
26
+ GREEN='\033[0;32m'
27
+ YELLOW='\033[1;33m'
28
+ BLUE='\033[0;34m'
29
+ NC='\033[0m' # No Color
30
+
31
+ # Global variables
32
+ FORCE=false
33
+ DRY_RUN=false
34
+
35
+ # Parse arguments
36
+ VERSION_ARG=""
37
+ while [[ $# -gt 0 ]]; do
38
+ case $1 in
39
+ -y|--yes|--force)
40
+ FORCE=true
41
+ shift
42
+ ;;
43
+ --dry-run)
44
+ DRY_RUN=true
45
+ shift
46
+ ;;
47
+ -h|--help)
48
+ echo "Usage: $0 [options] <version>"
49
+ echo ""
50
+ echo "Version can be:"
51
+ echo " patch Increment patch version (1.4.1 -> 1.4.2)"
52
+ echo " minor Increment minor version (1.4.1 -> 1.5.0)"
53
+ echo " major Increment major version (1.4.1 -> 2.0.0)"
54
+ echo " x.y.z Explicit version number"
55
+ echo ""
56
+ echo "Options:"
57
+ echo " -y, --yes, --force Skip confirmation prompts"
58
+ echo " --dry-run Show what would be done without making changes"
59
+ echo " -h, --help Show this help message"
60
+ echo ""
61
+ echo "Examples:"
62
+ echo " $0 patch # Bump patch version"
63
+ echo " $0 1.4.2 # Set explicit version"
64
+ echo " $0 --dry-run patch # Preview changes"
65
+ echo ""
66
+ echo "What this script does:"
67
+ echo " 1. Validates prerequisites and working tree"
68
+ echo " 2. Bumps version in all package files"
69
+ echo " 3. Updates CLI_VERSION constant"
70
+ echo " 4. Commits version bump"
71
+ echo " 5. Creates and pushes git tag"
72
+ echo " 6. Tag push triggers CI/CD pipeline (npm + Docker publish)"
73
+ exit 0
74
+ ;;
75
+ *)
76
+ if [ -z "$VERSION_ARG" ]; then
77
+ VERSION_ARG="$1"
78
+ else
79
+ echo "Unknown option: $1"
80
+ exit 1
81
+ fi
82
+ shift
83
+ ;;
84
+ esac
85
+ done
86
+
87
+ if [ -z "$VERSION_ARG" ]; then
88
+ echo -e "${RED}❌ Version argument required${NC}"
89
+ echo "Usage: $0 [patch|minor|major|x.y.z]"
90
+ echo "Run '$0 --help' for more information"
91
+ exit 1
92
+ fi
93
+
94
+ # ============================================================================
95
+ # Utility Functions
96
+ # ============================================================================
97
+
98
+ log_info() {
99
+ echo -e "${BLUE}ℹ${NC} $1"
100
+ }
101
+
102
+ log_success() {
103
+ echo -e "${GREEN}✅${NC} $1"
104
+ }
105
+
106
+ log_warning() {
107
+ echo -e "${YELLOW}⚠️${NC} $1"
108
+ }
109
+
110
+ log_error() {
111
+ echo -e "${RED}❌${NC} $1"
112
+ }
113
+
114
+ # ============================================================================
115
+ # Validation Functions
116
+ # ============================================================================
117
+
118
+ validate_prerequisites() {
119
+ echo "🔍 Validating prerequisites..."
120
+ local missing=()
121
+
122
+ # Check git
123
+ if ! command -v git &> /dev/null; then
124
+ missing+=("git")
125
+ fi
126
+
127
+ # Check node
128
+ if ! command -v node &> /dev/null; then
129
+ missing+=("node")
130
+ fi
131
+
132
+ # Check we're in the right directory
133
+ if [ ! -f "package.json" ] || [ ! -d "packages/cli" ]; then
134
+ log_error "Must be run from orchestrator root directory"
135
+ exit 1
136
+ fi
137
+
138
+ if [ ${#missing[@]} -ne 0 ]; then
139
+ log_error "Missing required tools: ${missing[*]}"
140
+ exit 1
141
+ fi
142
+
143
+ log_success "All prerequisites satisfied"
144
+ }
145
+
146
+ validate_working_tree() {
147
+ echo "🔍 Validating working tree..."
148
+
149
+ # Check if working tree is clean
150
+ if [ -n "$(git status --porcelain)" ]; then
151
+ log_error "Working tree is not clean"
152
+ echo "Please commit or stash your changes:"
153
+ git status --short
154
+ exit 1
155
+ fi
156
+
157
+ # Check if on main branch
158
+ local branch
159
+ branch=$(git rev-parse --abbrev-ref HEAD)
160
+
161
+ if [[ "$branch" != "main" ]]; then
162
+ log_warning "You are on branch '$branch', not main"
163
+ if [ "$FORCE" = true ]; then
164
+ echo "Continuing with --force flag..."
165
+ else
166
+ read -p "Continue anyway? (y/N): " -n 1 -r
167
+ echo
168
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
169
+ echo "Aborted by user"
170
+ exit 1
171
+ fi
172
+ fi
173
+ fi
174
+
175
+ log_success "Working tree is clean"
176
+ }
177
+
178
+ validate_tag_not_exists() {
179
+ local tag=$1
180
+
181
+ if git rev-parse "$tag" &> /dev/null; then
182
+ log_error "Tag '$tag' already exists"
183
+ echo "Choose a different version or delete the existing tag"
184
+ exit 1
185
+ fi
186
+
187
+ log_success "Tag '$tag' is available"
188
+ }
189
+
190
+ # ============================================================================
191
+ # Version Functions
192
+ # ============================================================================
193
+
194
+ get_current_version() {
195
+ node -p "require('./packages/cli/package.json').version"
196
+ }
197
+
198
+ calculate_new_version() {
199
+ local current=$1
200
+ local bump_type=$2
201
+
202
+ # Parse current version
203
+ local major minor patch
204
+ IFS='.' read -r major minor patch <<< "$current"
205
+
206
+ case $bump_type in
207
+ patch)
208
+ echo "${major}.${minor}.$((patch + 1))"
209
+ ;;
210
+ minor)
211
+ echo "${major}.$((minor + 1)).0"
212
+ ;;
213
+ major)
214
+ echo "$((major + 1)).0.0"
215
+ ;;
216
+ *)
217
+ # Assume it's an explicit version
218
+ if [[ "$bump_type" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
219
+ echo "$bump_type"
220
+ else
221
+ log_error "Invalid version format: $bump_type"
222
+ echo "Use: patch, minor, major, or x.y.z format"
223
+ exit 1
224
+ fi
225
+ ;;
226
+ esac
227
+ }
228
+
229
+ # ============================================================================
230
+ # Update Functions
231
+ # ============================================================================
232
+
233
+ update_package_version() {
234
+ local file=$1
235
+ local version=$2
236
+
237
+ if [ ! -f "$file" ]; then
238
+ log_warning "File not found: $file"
239
+ return
240
+ fi
241
+
242
+ if [ "$DRY_RUN" = true ]; then
243
+ echo " [dry-run] Would update: $file"
244
+ return
245
+ fi
246
+
247
+ # Use node to update version (handles JSON properly)
248
+ node -e "
249
+ const fs = require('fs');
250
+ const pkg = JSON.parse(fs.readFileSync('$file', 'utf8'));
251
+ pkg.version = '$version';
252
+ fs.writeFileSync('$file', JSON.stringify(pkg, null, 2) + '\n');
253
+ "
254
+
255
+ log_info "Updated: $file"
256
+ }
257
+
258
+ update_cli_version_constant() {
259
+ local version=$1
260
+ local file="packages/cli/src/index.ts"
261
+
262
+ if [ ! -f "$file" ]; then
263
+ log_warning "File not found: $file"
264
+ return
265
+ fi
266
+
267
+ if [ "$DRY_RUN" = true ]; then
268
+ echo " [dry-run] Would update CLI_VERSION in: $file"
269
+ return
270
+ fi
271
+
272
+ # Update CLI_VERSION constant
273
+ sed -i "s/export const CLI_VERSION = '[^']*'/export const CLI_VERSION = '${version}'/" "$file"
274
+
275
+ log_info "Updated CLI_VERSION in: $file"
276
+ }
277
+
278
+ update_template_version() {
279
+ local version=$1
280
+ local file="src/infrastructure/templates/base/package.json.hbs"
281
+
282
+ if [ ! -f "$file" ]; then
283
+ log_warning "Template file not found: $file"
284
+ return
285
+ fi
286
+
287
+ if [ "$DRY_RUN" = true ]; then
288
+ echo " [dry-run] Would update template: $file"
289
+ return
290
+ fi
291
+
292
+ # Update @orchestrator-claude/cli and @orchestrator-claude/mcp-server versions
293
+ sed -i "s|\"@orchestrator-claude/cli\": \"\\^[0-9]*\\.[0-9]*\\.[0-9]*\"|\"@orchestrator-claude/cli\": \"^${version}\"|g" "$file"
294
+ sed -i "s|\"@orchestrator-claude/mcp-server\": \"\\^[0-9]*\\.[0-9]*\\.[0-9]*\"|\"@orchestrator-claude/mcp-server\": \"^${version}\"|g" "$file"
295
+
296
+ log_info "Updated template: $file"
297
+ }
298
+
299
+ update_all_versions() {
300
+ local version=$1
301
+
302
+ echo "📝 Updating versions to $version..."
303
+
304
+ # Update root package.json
305
+ update_package_version "package.json" "$version"
306
+
307
+ # Update CLI package
308
+ update_package_version "packages/cli/package.json" "$version"
309
+
310
+ # Update MCP server package
311
+ update_package_version "packages/mcp-server/package.json" "$version"
312
+
313
+ # Update CLI_VERSION constant
314
+ update_cli_version_constant "$version"
315
+
316
+ # Update templates
317
+ update_template_version "$version"
318
+
319
+ log_success "All versions updated to $version"
320
+ }
321
+
322
+ # ============================================================================
323
+ # Git Functions
324
+ # ============================================================================
325
+
326
+ commit_version_bump() {
327
+ local version=$1
328
+ local tag="v${version}"
329
+
330
+ if [ "$DRY_RUN" = true ]; then
331
+ echo " [dry-run] Would commit: chore: bump version to ${tag}"
332
+ return
333
+ fi
334
+
335
+ git add package.json \
336
+ packages/cli/package.json \
337
+ packages/mcp-server/package.json \
338
+ packages/cli/src/index.ts \
339
+ src/infrastructure/templates/base/package.json.hbs
340
+
341
+ git commit -m "chore: bump version to ${tag}
342
+
343
+ Updates:
344
+ - package.json (root)
345
+ - packages/cli/package.json
346
+ - packages/mcp-server/package.json
347
+ - packages/cli/src/index.ts (CLI_VERSION)
348
+ - src/infrastructure/templates/base/package.json.hbs (templates)
349
+
350
+ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"
351
+
352
+ log_success "Version bump committed"
353
+ }
354
+
355
+ create_and_push_tag() {
356
+ local version=$1
357
+ local tag="v${version}"
358
+
359
+ if [ "$DRY_RUN" = true ]; then
360
+ echo " [dry-run] Would create tag: $tag"
361
+ echo " [dry-run] Would push: main and $tag"
362
+ return
363
+ fi
364
+
365
+ # Create annotated tag
366
+ git tag -a "$tag" -m "Release $tag"
367
+ log_success "Tag created: $tag"
368
+
369
+ # Push commit and tag
370
+ echo "⬆️ Pushing to remote..."
371
+ git push origin main
372
+ git push origin "$tag"
373
+
374
+ log_success "Pushed main and tag $tag"
375
+ }
376
+
377
+ # ============================================================================
378
+ # Main Flow
379
+ # ============================================================================
380
+
381
+ main() {
382
+ echo ""
383
+ echo -e "${BLUE}════════════════════════════════════════${NC}"
384
+ echo -e "${BLUE} Orchestrator Release Script${NC}"
385
+ echo -e "${BLUE}════════════════════════════════════════${NC}"
386
+ echo ""
387
+
388
+ validate_prerequisites
389
+ validate_working_tree
390
+
391
+ # Get current and new versions
392
+ local current_version
393
+ current_version=$(get_current_version)
394
+
395
+ local new_version
396
+ new_version=$(calculate_new_version "$current_version" "$VERSION_ARG")
397
+
398
+ local tag="v${new_version}"
399
+
400
+ echo ""
401
+ echo -e "${BLUE}Release Plan:${NC}"
402
+ echo " Current version: $current_version"
403
+ echo " New version: $new_version"
404
+ echo " Git tag: $tag"
405
+ echo ""
406
+
407
+ if [ "$DRY_RUN" = true ]; then
408
+ echo -e "${YELLOW}[DRY RUN MODE - No changes will be made]${NC}"
409
+ echo ""
410
+ fi
411
+
412
+ validate_tag_not_exists "$tag"
413
+
414
+ # Show what will be updated
415
+ echo ""
416
+ echo "Files to update:"
417
+ echo " - package.json (root)"
418
+ echo " - packages/cli/package.json"
419
+ echo " - packages/mcp-server/package.json"
420
+ echo " - packages/cli/src/index.ts (CLI_VERSION)"
421
+ echo " - src/infrastructure/templates/base/package.json.hbs (templates)"
422
+ echo ""
423
+ echo "Actions:"
424
+ echo " 1. Update version in all files"
425
+ echo " 2. Commit version bump"
426
+ echo " 3. Create git tag $tag"
427
+ echo " 4. Push main + tag to origin"
428
+ echo " 5. CI/CD pipeline will publish npm + Docker"
429
+ echo ""
430
+
431
+ if [ "$FORCE" = false ] && [ "$DRY_RUN" = false ]; then
432
+ read -p "Continue with release? (y/N): " -n 1 -r
433
+ echo
434
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
435
+ echo "Aborted by user"
436
+ exit 1
437
+ fi
438
+ fi
439
+
440
+ # Execute release steps
441
+ update_all_versions "$new_version"
442
+ commit_version_bump "$new_version"
443
+ create_and_push_tag "$new_version"
444
+
445
+ echo ""
446
+ echo -e "${GREEN}════════════════════════════════════════${NC}"
447
+ echo -e "${GREEN} Release $tag initiated!${NC}"
448
+ echo -e "${GREEN}════════════════════════════════════════${NC}"
449
+ echo ""
450
+ echo "🚀 CI/CD pipeline will now:"
451
+ echo " - Build and publish Docker image"
452
+ echo " - Publish npm packages"
453
+ echo ""
454
+ echo "📍 Monitor pipeline at:"
455
+ echo " https://github.com/orchestratorAII/orchestrator/actions"
456
+ echo ""
457
+ }
458
+
459
+ # Entry point
460
+ main