@seeka-labs/cli-apps-azure 3.7.0 → 3.8.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 ADDED
@@ -0,0 +1,307 @@
1
+ # @seeka-labs/cli-apps-azure
2
+
3
+ Azure-specific CLI tools for Seeka Apps. This package provides commands for setting up GitHub repositories and managing deployment environments for Seeka apps running on Azure Functions.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # Using npm
9
+ npm install -g @seeka-labs/cli-apps-azure
10
+
11
+ # Using yarn
12
+ yarn global add @seeka-labs/cli-apps-azure
13
+
14
+ # Or run directly with npx
15
+ npx @seeka-labs/cli-apps-azure
16
+ ```
17
+
18
+ ## Prerequisites
19
+
20
+ - A Seeka app created with [`@seeka-labs/cli-apps`](https://www.npmjs.com/package/@seeka-labs/cli-apps)
21
+ - A GitHub account with permissions to create repositories
22
+ - Node.js 18 or later
23
+
24
+ ## Quick Start
25
+
26
+ Run the CLI from your Seeka app directory:
27
+
28
+ ```bash
29
+ cd your-seeka-app
30
+ npx @seeka-labs/cli-apps-azure
31
+ ```
32
+
33
+ The CLI will automatically detect your app configuration from `.seeka/init.app.seeka.cli.config.json`.
34
+
35
+ ## Commands
36
+
37
+ The CLI operates in **interactive mode** and presents a menu of available actions:
38
+
39
+ ### 1. Initialize GitHub Repository
40
+
41
+ Creates a new GitHub repository for your Seeka app with all the necessary configuration for Azure Functions deployment.
42
+
43
+ #### What It Does
44
+
45
+ 1. **Prompts for VITE_BASE_URL** - The base URL path for your app (default: `/{appName}/app/`)
46
+ 2. **Authenticates with GitHub** - Uses OAuth Device Flow (opens browser for authorization)
47
+ 3. **Selects repository owner** - Choose between your personal account or an organization
48
+ 4. **Creates private repository** - Named `seeka-app-{appName}`
49
+ 5. **Sets repository variables**:
50
+ - `AZURE_FUNC_RESOURCE_NAME` - Azure Function resource name
51
+ 6. **Creates `prod` environment** with variables:
52
+ - `VITE_BASE_URL` - Base URL for the app
53
+ - `HOSTING_ENV_NAME` - Set to `prod`
54
+
55
+ #### Example Flow
56
+
57
+ ```
58
+ $ npx @seeka-labs/cli-apps-azure
59
+
60
+ 🔐 Authenticating with GitHub...
61
+
62
+ Please visit: https://github.com/login/device
63
+ And enter code: ABCD-1234
64
+
65
+ ? Open browser automatically? Yes
66
+ Waiting for authorization...
67
+
68
+ ✓ Successfully authenticated with GitHub!
69
+
70
+ ? Where do you want to create the repository?
71
+ > my-username (Personal Account)
72
+ my-organization - My Organization Description
73
+
74
+ ✅ GitHub repository initialized successfully!
75
+
76
+ Repository: https://github.com/my-username/seeka-app-my-app
77
+ Environment: prod
78
+ ```
79
+
80
+ ---
81
+
82
+ ### 2. Add Environment to Existing Repository
83
+
84
+ Adds a new deployment environment (e.g., staging) to an existing GitHub repository.
85
+
86
+ #### What It Does
87
+
88
+ 1. **Prompts for environment details**:
89
+ - Repository owner (username or organization)
90
+ - Repository name (default: `seeka-app-{appName}`)
91
+ - Environment name (default: `seeka-app-{appName}-stag`)
92
+ - Azure Function slot name (default: `staging`)
93
+ - Various URL configurations
94
+ 2. **Authenticates with GitHub**
95
+ 3. **Creates the environment**
96
+ 4. **Sets environment variables**:
97
+ - `AZURE_FUNC_SLOT_NAME` - Azure Function deployment slot
98
+ - `VITE_BASE_URL` - Base URL for the app
99
+ - `VITE_URLS_SEEKA_API_CORE` - Seeka API Core URL (optional)
100
+ - `VITE_URLS_SEEKA_APP_CORE_ORIGIN` - Seeka App Core Origin (optional)
101
+ - `HOSTING_ENV_NAME` - Environment name (e.g., `stag`)
102
+ - `SEEKA_APP_SETTINGS` - App settings JSON (default: `{}`)
103
+ - `SEEKA_APP_CFG_SEEKA_APP_SECRET` - Placeholder for app secret
104
+
105
+ #### Example Flow
106
+
107
+ ```
108
+ $ npx @seeka-labs/cli-apps-azure
109
+
110
+ ? What would you like to do? Add environment to existing GitHub repository
111
+
112
+ ? Enter GitHub repository owner: my-username
113
+ ? Enter GitHub repository name: seeka-app-my-app
114
+ ? Enter environment name: stag
115
+ ? Enter AZURE_FUNC_SLOT_NAME: staging
116
+ ? Enter VITE_BASE_URL: /my-app/app/
117
+ ? Enter VITE_URLS_SEEKA_API_CORE (optional):
118
+ ? Enter VITE_URLS_SEEKA_APP_CORE_ORIGIN (optional):
119
+ ? Enter HOSTING_ENV_NAME: stag
120
+
121
+ 🔐 Authenticating with GitHub...
122
+ ...
123
+
124
+ ✅ Environment added successfully!
125
+
126
+ Repository: https://github.com/my-username/seeka-app-my-app
127
+ Environment: stag
128
+ ```
129
+
130
+ ---
131
+
132
+ ### 3. Update Environment Variables and Secrets
133
+
134
+ Updates all environment variables and secrets for an existing environment, with confirmation prompts before overwriting existing values.
135
+
136
+ #### What It Does
137
+
138
+ 1. **Prompts for environment details**:
139
+ - Repository owner (username or organization)
140
+ - Repository name (default: `seeka-app-{appName}`)
141
+ - Environment name (default: `seeka-app-{appName}-stag`)
142
+ 2. **Authenticates with GitHub**
143
+ 3. **Fetches existing variables and secrets**
144
+ 4. **For each variable/secret to update**:
145
+ - If it exists, prompts for confirmation before overwriting
146
+ - For plain text variables: shows old and new values in the confirmation
147
+ - For secrets: only shows the name (value hidden for security)
148
+ 5. **Sets environment variables and secrets** based on configuration
149
+
150
+ #### Example Flow
151
+
152
+ ```
153
+ $ npx @seeka-labs/cli-apps-azure
154
+
155
+ ? What would you like to do? Update environment variables and secrets (overwrite existing)
156
+
157
+ ? Enter GitHub repository owner: my-username
158
+ ? Enter GitHub repository name: seeka-app-my-app
159
+ ? Enter environment name: stag
160
+
161
+ 🔐 Authenticating with GitHub...
162
+ ...
163
+
164
+ 🔐 Processing environment secrets...
165
+ ? Overwrite secret "SEEKA_APP_CFG_SEEKA_APP_SECRET"? (value hidden for security) Yes
166
+ ✓ Set environment secret: SEEKA_APP_CFG_SEEKA_APP_SECRET
167
+
168
+ 🔧 Processing environment variables...
169
+ ? Overwrite variable "VITE_BASE_URL"?
170
+ Old: /old-app/app/
171
+ New: /my-app/app/ Yes
172
+ ✓ Set environment variable: VITE_BASE_URL
173
+
174
+ ✅ Environment updated successfully!
175
+
176
+ Repository: https://github.com/my-username/seeka-app-my-app
177
+ Environment: stag
178
+ ```
179
+
180
+ ---
181
+
182
+ ## Configuration
183
+
184
+ ### Automatic Configuration Detection
185
+
186
+ The CLI automatically looks for configuration in:
187
+
188
+ ```
189
+ .seeka/init.app.seeka.cli.config.json
190
+ ```
191
+
192
+ This file is created when you initialize a Seeka app with `@seeka-labs/cli-apps`.
193
+
194
+ ### Manual Configuration
195
+
196
+ You can specify a custom configuration file:
197
+
198
+ ```bash
199
+ npx @seeka-labs/cli-apps-azure --configFile ./path/to/config.json
200
+ ```
201
+
202
+ #### Configuration File Format
203
+
204
+ ```json
205
+ {
206
+ "orgName": "my-org",
207
+ "appName": "my-app"
208
+ }
209
+ ```
210
+
211
+ If no configuration file is found, the CLI will prompt you for the organization and app name.
212
+
213
+ ---
214
+
215
+ ## GitHub Authentication
216
+
217
+ This CLI uses **OAuth Device Flow** for GitHub authentication:
218
+
219
+ 1. **Secure** - No client secret required (safe for public npm distribution)
220
+ 2. **Browser-based** - Opens your browser for authorization
221
+ 3. **Scoped** - Only requests `repo` scope for repository management
222
+ 4. **Session-only** - Access tokens are stored in-memory only and never persisted to disk
223
+
224
+ ### Required GitHub Permissions
225
+
226
+ The authenticated user needs:
227
+ - Permission to create repositories (personal or in the selected organization)
228
+ - Permission to manage repository variables and environments
229
+
230
+ ---
231
+
232
+ ## Environment Variables Reference
233
+
234
+ ### Repository-Level Variables
235
+
236
+ | Variable | Description |
237
+ |----------|-------------|
238
+ | `AZURE_FUNC_RESOURCE_NAME` | Name of the Azure Function App resource |
239
+
240
+ ### Environment-Level Variables
241
+
242
+ | Variable | Description |
243
+ |----------|-------------|
244
+ | `AZURE_FUNC_SLOT_NAME` | Azure Function deployment slot name |
245
+ | `VITE_BASE_URL` | Base URL path for the app |
246
+ | `VITE_URLS_SEEKA_API_CORE` | Seeka API Core URL |
247
+ | `VITE_URLS_SEEKA_APP_CORE_ORIGIN` | Seeka App Core Origin URL |
248
+ | `HOSTING_ENV_NAME` | Environment name (e.g., `prod`, `stag`) |
249
+ | `SEEKA_APP_SETTINGS` | JSON object for app-specific settings |
250
+ | `SEEKA_APP_CFG_SEEKA_APP_SECRET` | Seeka App Secret (configure in GitHub) |
251
+
252
+ ---
253
+
254
+ ## Typical Workflow
255
+
256
+ 1. **Create your Seeka app**:
257
+ ```bash
258
+ npx @seeka-labs/cli-apps init my-org my-app --template azure-function
259
+ ```
260
+
261
+ 2. **Initialize GitHub repository**:
262
+ ```bash
263
+ cd seeka-app-my-app
264
+ npx @seeka-labs/cli-apps-azure
265
+ # Select "Initialize GitHub repository"
266
+ ```
267
+
268
+ 3. **Push your code**:
269
+ ```bash
270
+ git init
271
+ git add .
272
+ git commit -m "Initial commit"
273
+ git remote add origin https://github.com/your-username/seeka-app-my-app.git
274
+ git push -u origin main
275
+ ```
276
+
277
+ 4. **Add staging environment** (optional):
278
+ ```bash
279
+ npx @seeka-labs/cli-apps-azure
280
+ # Select "Add environment to existing GitHub repository"
281
+ ```
282
+
283
+ 5. **Configure Azure OIDC** in GitHub repository secrets:
284
+ - `AZURE_CLIENT_ID`
285
+ - `AZURE_TENANT_ID`
286
+ - `AZURE_SUBSCRIPTION_ID`
287
+
288
+ 6. **Deploy** - Push to `main` or `staging` branch to trigger GitHub Actions deployment
289
+
290
+ ---
291
+
292
+ ## Related Packages
293
+
294
+ - [`@seeka-labs/cli-apps`](https://www.npmjs.com/package/@seeka-labs/cli-apps) - Main Seeka Apps CLI for scaffolding applications
295
+
296
+ ---
297
+
298
+ ## Support
299
+
300
+ - [Seeka Developer Documentation](https://developers.seeka.co)
301
+ - [Seeka Platform](https://seeka.app)
302
+
303
+ ---
304
+
305
+ ## License
306
+
307
+ MIT