indraq_cli 2.5.0 → 2.6.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 (69) hide show
  1. package/CHANGELOG_v2.6.0.md +9 -0
  2. package/README.md +31 -2
  3. package/TEST_RESULTS_v2.6.0.txt +16 -0
  4. package/cloud-api/.env.example +15 -15
  5. package/cloud-api/README.md +1 -1
  6. package/cloud-api/dist/index.js +49 -3
  7. package/cloud-api/dist/index.js.map +1 -0
  8. package/cloud-api/package.json +1 -1
  9. package/cloud-api/src/index.ts +42 -2
  10. package/dist/cli/help-content.d.ts.map +1 -1
  11. package/dist/cli/help-content.js +3 -2
  12. package/dist/cli/help-content.js.map +1 -1
  13. package/dist/modules/cloud/commands/cloud.command.d.ts.map +1 -1
  14. package/dist/modules/cloud/commands/cloud.command.js +86 -14
  15. package/dist/modules/cloud/commands/cloud.command.js.map +1 -1
  16. package/dist/modules/cloud/index.js +1 -1
  17. package/dist/modules/cloud/index.js.map +1 -1
  18. package/dist/modules/cloud/services/cloud-aws.service.d.ts +1 -1
  19. package/dist/modules/cloud/services/cloud-aws.service.d.ts.map +1 -1
  20. package/dist/modules/cloud/services/cloud-aws.service.js +2 -2
  21. package/dist/modules/cloud/services/cloud-aws.service.js.map +1 -1
  22. package/dist/modules/cloud/services/cloud-jenkins.service.d.ts +1 -1
  23. package/dist/modules/cloud/services/cloud-jenkins.service.d.ts.map +1 -1
  24. package/dist/modules/cloud/services/cloud-jenkins.service.js +2 -2
  25. package/dist/modules/cloud/services/cloud-jenkins.service.js.map +1 -1
  26. package/dist/modules/cloud/services/cloud-npm.service.d.ts +1 -1
  27. package/dist/modules/cloud/services/cloud-npm.service.d.ts.map +1 -1
  28. package/dist/modules/cloud/services/cloud-npm.service.js +2 -2
  29. package/dist/modules/cloud/services/cloud-npm.service.js.map +1 -1
  30. package/dist/modules/cloud/services/project-cleanup.service.d.ts +24 -0
  31. package/dist/modules/cloud/services/project-cleanup.service.d.ts.map +1 -0
  32. package/dist/modules/cloud/services/project-cleanup.service.js +141 -0
  33. package/dist/modules/cloud/services/project-cleanup.service.js.map +1 -0
  34. package/dist/modules/cloud/services/user-provider.service.d.ts +1 -1
  35. package/dist/modules/cloud/services/user-provider.service.d.ts.map +1 -1
  36. package/dist/modules/cloud/services/user-provider.service.js +3 -3
  37. package/dist/modules/cloud/services/user-provider.service.js.map +1 -1
  38. package/dist/modules/configure/configure.command.js +4 -2
  39. package/dist/modules/configure/configure.command.js.map +1 -1
  40. package/dist/modules/mobile/commands/ota.command.js +3 -3
  41. package/dist/modules/mobile/commands/ota.command.js.map +1 -1
  42. package/dist/modules/mobile/index.d.ts.map +1 -1
  43. package/dist/modules/mobile/index.js +8 -7
  44. package/dist/modules/mobile/index.js.map +1 -1
  45. package/dist/modules/mobile/services/mobile-project-directory.d.ts +3 -0
  46. package/dist/modules/mobile/services/mobile-project-directory.d.ts.map +1 -0
  47. package/dist/modules/mobile/services/mobile-project-directory.js +31 -0
  48. package/dist/modules/mobile/services/mobile-project-directory.js.map +1 -0
  49. package/dist/modules/mobile/services/ota-setup.service.d.ts.map +1 -1
  50. package/dist/modules/mobile/services/ota-setup.service.js +5 -3
  51. package/dist/modules/mobile/services/ota-setup.service.js.map +1 -1
  52. package/dist/modules/prebuild/commands/prebuild.command.d.ts +1 -0
  53. package/dist/modules/prebuild/commands/prebuild.command.d.ts.map +1 -1
  54. package/dist/modules/prebuild/commands/prebuild.command.js +18 -2
  55. package/dist/modules/prebuild/commands/prebuild.command.js.map +1 -1
  56. package/dist/modules/scaffold/commands/init.command.d.ts.map +1 -1
  57. package/dist/modules/scaffold/commands/init.command.js +29 -7
  58. package/dist/modules/scaffold/commands/init.command.js.map +1 -1
  59. package/dist/modules/scaffold/types.d.ts +3 -1
  60. package/dist/modules/scaffold/types.d.ts.map +1 -1
  61. package/dist/modules/setup/commands/setup.command.d.ts.map +1 -1
  62. package/dist/modules/setup/commands/setup.command.js +8 -1
  63. package/dist/modules/setup/commands/setup.command.js.map +1 -1
  64. package/dist/shared/process/run-npx.d.ts +4 -0
  65. package/dist/shared/process/run-npx.d.ts.map +1 -0
  66. package/dist/shared/process/run-npx.js +31 -0
  67. package/dist/shared/process/run-npx.js.map +1 -0
  68. package/docs/README_v2.6.0_DETAILED.md +1021 -0
  69. package/package.json +7 -4
@@ -0,0 +1,9 @@
1
+ # IndraQ CLI v2.6.0
2
+
3
+ - Fixed Windows OTA codesigning generation with argument-preserving `npx` invocation; temporary key material is always cleaned up.
4
+ - Added project kind `backend-mobile` for existing and newly scaffolded projects, with backend Docker/Jenkins/GitHub Packages and mobile Jenkins/OTA setup in one Cloud project.
5
+ - Added `indraq project delete` selective external cleanup: Route53 A records, GitHub Packages container packages, Jenkins project deployment jobs, and Nginx Proxy Manager proxy hosts. Every option defaults to KEEP. Shared and global Jenkins jobs are protected; failed provider operations stop Cloud-project deletion.
6
+ - Added Cloud endpoint `GET /projects/:id/cleanup-inventory` for authorized project managers/admins, with cross-project resource reference checks.
7
+ - No schema migration is needed. The Cloud API must be deployed before using v2.6.0's new cleanup feature.
8
+
9
+ Validation: source syntax checks and local regression tests. Dependency-backed build and integration tests must run in a network-enabled environment.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # IndraQ CLI v2.5.0
1
+ # IndraQ CLI v2.6.0
2
2
 
3
3
  IndraQ CLI helps our team set up, build and deploy web and mobile apps.
4
4
 
@@ -674,4 +674,33 @@ npm publish
674
674
 
675
675
  ---
676
676
 
677
- **IndraQ Innovations — IndraQ CLI v2.5.0**
677
+ **IndraQ Innovations — IndraQ CLI v2.6.0**
678
+
679
+
680
+ ---
681
+
682
+ # What is new in v2.6.0
683
+
684
+ ## Backend + Mobile App
685
+
686
+ Choose **Backend + Mobile App** under `indraq init` or `indraq project create`.
687
+ The backend lives in `backend/` and uses normal Docker, GitHub Packages, Jenkins,
688
+ Route53, and NPM provisioning. The mobile app lives in `mobile/` and uses
689
+ Jenkins native builds and IndraQ OTA. `indraq setup` configures both once.
690
+
691
+ ## Project deletion cleanup
692
+
693
+ `indraq project delete` lists the actual resources linked to the project and
694
+ asks which to delete: Route53 A records, GitHub Packages container packages,
695
+ project-specific Jenkins jobs, and NPM proxy hosts. **Everything starts as KEEP.**
696
+ Shared resources and the shared mobile Jenkins pipeline are protected.
697
+ An external resource marked as linked requires extra approval to delete.
698
+ If any chosen provider deletion fails, the Cloud project stays available for retry.
699
+ Deleting GitHub Packages removes all tags and versions of the selected package.
700
+ AWS health checks, NPM certificates, running containers, and local source files
701
+ are not automatically deleted. `--yes` does not select any resources automatically.
702
+
703
+ ## Windows OTA signing fix
704
+
705
+ `expo-updates codesigning:generate` now uses a Windows-safe argument-preserving
706
+ `npx` launcher. Temporary private key material is cleaned up after errors too.
@@ -0,0 +1,16 @@
1
+ IndraQ CLI v2.6.0 — local validation (November 19, 2026)
2
+
3
+ PASS — npm test (all scripted regression suites, including v2.6.0)
4
+ PASS — v2.6.0 selective cleanup mock-provider tests (DNS, NPM, Jenkins, GHCR)
5
+ PASS — shared resource and shared Jenkins pipeline protection tests
6
+ PASS — Windows npx argument-preservation regression (mocked Windows child process)
7
+ PASS — 98 TypeScript source files parsed without syntax errors
8
+ PASS — 98 TypeScript JavaScript output files generated using global TypeScript transpileModule
9
+ PASS — node --check for all generated CLI and Cloud API JavaScript files
10
+
11
+ NOT RUN — dependency-backed tsc build; npm registry unavailable in build environment.
12
+ NOT RUN — live Windows Expo codesigning, live AWS/GitHub/Jenkins/NPM deletions, Cloud API/PostgreSQL integration.
13
+
14
+ Before production: install dependencies and run npm run build && npm test
15
+ in the CLI root; npm install && npm run build in cloud-api; deploy Cloud API
16
+ v1.2.0 before CLI v2.6.0 and test against disposable provider resources.
@@ -1,24 +1,24 @@
1
1
  PORT=4010
2
- DATABASE_URL=postgresql://harry:Staykool%401@192.168.10.101:23561/indraq_cloud
3
- JWT_SECRET=8f3c2a9d4e6b7f00112233445566778899aabbccddeeff001122334455667788
4
- MASTER_KEY=8f3c2a9d4e6b7f00112233445566778899aabbccddeeff001122334455667788
5
- BOOTSTRAP_ADMIN_EMAIL=harkaran@indraq.com
6
- BOOTSTRAP_ADMIN_PASSWORD=Saini@harkaran-1
2
+ DATABASE_URL=postgresql://indraq:change-me@127.0.0.1:5432/indraq_cloud
3
+ JWT_SECRET=replace-with-64-random-characters
4
+ MASTER_KEY=replace-with-64-hex-characters
5
+ BOOTSTRAP_ADMIN_EMAIL=admin@example.com
6
+ BOOTSTRAP_ADMIN_PASSWORD=change-this-immediately
7
7
 
8
8
  # Password-reset email (required for `indraq password reset`)
9
- SMTP_HOST=smtp.gmail.com
9
+ SMTP_HOST=smtp.example.com
10
10
  SMTP_PORT=587
11
11
  SMTP_SECURE=false
12
- SMTP_USER=info@indraq.com
13
- SMTP_PASS=wvmvbrwarpgraepy
14
- SMTP_FROM=IndraQ <info@indraq.com>
12
+ SMTP_USER=
13
+ SMTP_PASS=
14
+ SMTP_FROM=IndraQ <no-reply@example.com>
15
15
 
16
16
  # Mobile OTA / MinIO
17
- MINIO_ENDPOINT=api-minio.indraq.com
18
- MINIO_PORT=443
19
- MINIO_USE_SSL=true
20
- MINIO_ACCESS_KEY=Fp3uJObyDMciLxLJcZis
21
- MINIO_SECRET_KEY=EjGsHlglPsBtHNxNIofQq4A8jHlEMRwPwLTnnYg1-me
17
+ MINIO_ENDPOINT=127.0.0.1
18
+ MINIO_PORT=9000
19
+ MINIO_USE_SSL=false
20
+ MINIO_ACCESS_KEY=minioadmin
21
+ MINIO_SECRET_KEY=change-me
22
22
  MINIO_BUCKET=indraq-ota
23
23
  # Public Cloud API URL embedded into mobile builds. Keep this on the same cli.indraq.com backend.
24
- PUBLIC_API_URL=https://cli.indraq.com
24
+ PUBLIC_API_URL=https://cli.indraq.com
@@ -1,6 +1,6 @@
1
1
  # IndraQ Cloud API
2
2
 
3
- Control plane for IndraQ CLI v2.5.0 / Cloud API v1.1.0. The public CLI and OTA endpoint is `https://cli.indraq.com`.
3
+ Control plane for IndraQ CLI v2.6.0 / Cloud API v1.2.0. The public CLI and OTA endpoint is `https://cli.indraq.com`.
4
4
 
5
5
  ## Responsibilities
6
6
 
@@ -1228,6 +1228,47 @@ app.put('/projects/:id/deployment-topology', auth, async (req, res) => {
1228
1228
  await audit(req.auth.id, 'project.deployment.update', 'project', id, reason, { mode, environments: names });
1229
1229
  res.json({ ...result.rows[0], effective_access: 'write' });
1230
1230
  });
1231
+ // Inventory of exact project-owned provider resources before destructive project deletion.
1232
+ // The CLI uses this authoritative list, not guesses based on project names or DNS.
1233
+ app.get('/projects/:id/cleanup-inventory', ...allow('manager', 'admin'), async (req, res) => {
1234
+ const id = ensureUuid(routeParam(req.params.id), 'Project ID');
1235
+ if ((await projectAccessLevel(id, req.auth, true)) !== 'write') {
1236
+ res.status(403).json({ error: 'WRITE access to the project is required.' });
1237
+ return;
1238
+ }
1239
+ const rows = await pool.query(`SELECT id,environment,resource_type,provider,external_id,config
1240
+ FROM project_resources WHERE project_id=$1 ORDER BY provider,environment,resource_type`, [id]);
1241
+ const response = [];
1242
+ for (const row of rows.rows) {
1243
+ // A provider identifier alone is not enough when scopes may point to different accounts.
1244
+ // Treat same provider + resource identity anywhere in another project as shared; this
1245
+ // intentionally errs on the side of refusing destructive cleanup.
1246
+ const config = row.config || {};
1247
+ let shared = false;
1248
+ if (row.provider === 'ghcr' && typeof config.fullImage === 'string') {
1249
+ const result = await pool.query(`SELECT 1 FROM project_resources
1250
+ WHERE project_id<>$1 AND provider='ghcr' AND lower(config->>'fullImage')=lower($2) LIMIT 1`, [id, config.fullImage]);
1251
+ shared = !!result.rowCount;
1252
+ }
1253
+ else if (row.provider === 'aws' && config.zoneId && config.domain) {
1254
+ const result = await pool.query(`SELECT 1 FROM project_resources
1255
+ WHERE project_id<>$1 AND provider='aws' AND config->>'zoneId'=$2 AND lower(trim(trailing '.' from config->>'domain'))=lower(trim(trailing '.' from $3::text)) LIMIT 1`, [id, String(config.zoneId), String(config.domain)]);
1256
+ shared = !!result.rowCount;
1257
+ }
1258
+ else if (row.provider === 'npm' && config.proxyHostId) {
1259
+ const result = await pool.query(`SELECT 1 FROM project_resources
1260
+ WHERE project_id<>$1 AND provider='npm' AND config->>'proxyHostId'=$2 LIMIT 1`, [id, String(config.proxyHostId)]);
1261
+ shared = !!result.rowCount;
1262
+ }
1263
+ else if (String(row.provider).startsWith('jenkins-') && (config.jobName || row.external_id)) {
1264
+ const result = await pool.query(`SELECT 1 FROM project_resources
1265
+ WHERE project_id<>$1 AND provider=$2 AND coalesce(config->>'jobName',external_id)=$3 LIMIT 1`, [id, row.provider, String(config.jobName || row.external_id)]);
1266
+ shared = !!result.rowCount;
1267
+ }
1268
+ response.push({ ...row, shared_elsewhere: shared });
1269
+ }
1270
+ res.json(response);
1271
+ });
1231
1272
  app.delete('/projects/:id', ...allow('manager', 'admin'), async (req, res) => {
1232
1273
  const reason = requireReason(req, res);
1233
1274
  if (!reason)
@@ -1752,7 +1793,11 @@ app.post('/me/scopes/:provider/resolve', auth, async (req, res) => {
1752
1793
  }
1753
1794
  const projectId = req.body?.projectId ? ensureUuid(String(req.body.projectId), 'Project ID') : '';
1754
1795
  const environment = req.body?.environment ? environmentName(req.body.environment) : '';
1755
- if (projectId && !(await hasProjectAccess(projectId, req.auth))) {
1796
+ const mayCleanupArchived = req.body?.forCleanup === true && ['manager', 'admin'].includes(req.auth.role);
1797
+ const allowedProject = projectId && (mayCleanupArchived
1798
+ ? (await projectAccessLevel(projectId, req.auth, true)) === 'write'
1799
+ : await hasProjectAccess(projectId, req.auth));
1800
+ if (projectId && !allowedProject) {
1756
1801
  res.status(404).json({ error: 'Project not found or access denied' });
1757
1802
  return;
1758
1803
  }
@@ -3057,8 +3102,8 @@ app.post('/projects/:projectId/mobile/register', auth, async (req, res) => {
3057
3102
  return;
3058
3103
  }
3059
3104
  const project = (await pool.query('SELECT id,kind FROM projects WHERE id=$1', [projectId])).rows[0];
3060
- if (!project || project.kind !== 'mobile') {
3061
- res.status(400).json({ error: 'OTA registration is available only for mobile projects.' });
3105
+ if (!project || !['mobile', 'backend-mobile'].includes(project.kind)) {
3106
+ res.status(400).json({ error: 'OTA registration requires a mobile or backend-mobile project.' });
3062
3107
  return;
3063
3108
  }
3064
3109
  const appName = textValue(req.body?.appName, 'App name', 100);
@@ -3575,3 +3620,4 @@ if (process.env.MINIO_ENDPOINT && process.env.MINIO_ACCESS_KEY && process.env.MI
3575
3620
  console.log(`OTA MinIO bucket ready: ${minioBucket}`);
3576
3621
  }
3577
3622
  app.listen(Number(process.env.PORT || 4010), () => console.log(`IndraQ Cloud API listening on ${process.env.PORT || 4010}`));
3623
+ //# sourceMappingURL=index.js.map