indraq_cli 1.3.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 (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1191 -0
  3. package/dist/cli/create-program.d.ts +3 -0
  4. package/dist/cli/create-program.d.ts.map +1 -0
  5. package/dist/cli/create-program.js +28 -0
  6. package/dist/cli/create-program.js.map +1 -0
  7. package/dist/cli/doctor.command.d.ts +2 -0
  8. package/dist/cli/doctor.command.d.ts.map +1 -0
  9. package/dist/cli/doctor.command.js +32 -0
  10. package/dist/cli/doctor.command.js.map +1 -0
  11. package/dist/index.d.ts +3 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +15 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/modules/deploy/commands/build.command.d.ts +6 -0
  16. package/dist/modules/deploy/commands/build.command.d.ts.map +1 -0
  17. package/dist/modules/deploy/commands/build.command.js +127 -0
  18. package/dist/modules/deploy/commands/build.command.js.map +1 -0
  19. package/dist/modules/deploy/commands/configure.command.d.ts +2 -0
  20. package/dist/modules/deploy/commands/configure.command.d.ts.map +1 -0
  21. package/dist/modules/deploy/commands/configure.command.js +404 -0
  22. package/dist/modules/deploy/commands/configure.command.js.map +1 -0
  23. package/dist/modules/deploy/config/deployment-config.d.ts +29 -0
  24. package/dist/modules/deploy/config/deployment-config.d.ts.map +1 -0
  25. package/dist/modules/deploy/config/deployment-config.js +164 -0
  26. package/dist/modules/deploy/config/deployment-config.js.map +1 -0
  27. package/dist/modules/deploy/index.d.ts +3 -0
  28. package/dist/modules/deploy/index.d.ts.map +1 -0
  29. package/dist/modules/deploy/index.js +57 -0
  30. package/dist/modules/deploy/index.js.map +1 -0
  31. package/dist/modules/deploy/services/docker.service.d.ts +7 -0
  32. package/dist/modules/deploy/services/docker.service.d.ts.map +1 -0
  33. package/dist/modules/deploy/services/docker.service.js +67 -0
  34. package/dist/modules/deploy/services/docker.service.js.map +1 -0
  35. package/dist/modules/deploy/services/jenkins.service.d.ts +23 -0
  36. package/dist/modules/deploy/services/jenkins.service.d.ts.map +1 -0
  37. package/dist/modules/deploy/services/jenkins.service.js +273 -0
  38. package/dist/modules/deploy/services/jenkins.service.js.map +1 -0
  39. package/dist/shared/git/git.service.d.ts +11 -0
  40. package/dist/shared/git/git.service.d.ts.map +1 -0
  41. package/dist/shared/git/git.service.js +110 -0
  42. package/dist/shared/git/git.service.js.map +1 -0
  43. package/dist/shared/github/github-api.service.d.ts +8 -0
  44. package/dist/shared/github/github-api.service.d.ts.map +1 -0
  45. package/dist/shared/github/github-api.service.js +77 -0
  46. package/dist/shared/github/github-api.service.js.map +1 -0
  47. package/dist/shared/github/github-auth.service.d.ts +10 -0
  48. package/dist/shared/github/github-auth.service.d.ts.map +1 -0
  49. package/dist/shared/github/github-auth.service.js +79 -0
  50. package/dist/shared/github/github-auth.service.js.map +1 -0
  51. package/dist/shared/runtime/runtime-doctor.d.ts +8 -0
  52. package/dist/shared/runtime/runtime-doctor.d.ts.map +1 -0
  53. package/dist/shared/runtime/runtime-doctor.js +31 -0
  54. package/dist/shared/runtime/runtime-doctor.js.map +1 -0
  55. package/docs/assets/indraq-logo.png +0 -0
  56. package/docs/assets/indraq-mark.png +0 -0
  57. package/package.json +54 -0
package/README.md ADDED
@@ -0,0 +1,1191 @@
1
+ <p align="center">
2
+ <img src="docs/assets/indraq-logo.png" alt="IndraQ Innovations" width="620" />
3
+ </p>
4
+
5
+ <h1 align="center">IndraQ CLI</h1>
6
+
7
+ <p align="center">
8
+ <strong>One command-line tool for IndraQ engineering operations.</strong>
9
+ </p>
10
+
11
+ <p align="center">
12
+ Build Docker images · Push to GHCR · Run Jenkins pipelines · Stream deployment logs
13
+ </p>
14
+
15
+ <p align="center">
16
+ <img alt="Node 24" src="https://img.shields.io/badge/Node.js-24.x-339933?logo=node.js&logoColor=white" />
17
+ <img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-strict-3178C6?logo=typescript&logoColor=white" />
18
+ <img alt="npm" src="https://img.shields.io/npm/v/indraq_cli?logo=npm&label=npm" />
19
+ <img alt="License" src="https://img.shields.io/npm/l/indraq_cli" />
20
+ <img alt="Version" src="https://img.shields.io/badge/version-1.3.0-264B63" />
21
+ </p>
22
+
23
+ > [!IMPORTANT]
24
+ > **IndraQ CLI is built for IndraQ Innovations engineering operations and is publicly distributed on npm.** Anyone can install and use it with compatible Docker, GitHub/GHCR, and Jenkins infrastructure. The deployment module is the first module; more tools can be added without turning the project into one giant script.
25
+
26
+ ---
27
+
28
+ ## Index
29
+
30
+ 1. [What are we building?](#what-are-we-building)
31
+ 2. [Explain it like I am new](#explain-it-like-i-am-new)
32
+ 3. [What happens during deployment?](#what-happens-during-deployment)
33
+ 4. [Requirements](#requirements)
34
+ 5. [Install Java 21](#install-java-21)
35
+ 6. [Install the CLI](#install-the-cli)
36
+ 7. [First-time configuration](#first-time-configuration)
37
+ 8. [Change configuration later](#change-configuration-later)
38
+ 9. [Deploy development](#deploy-development)
39
+ 10. [Deploy production](#deploy-production)
40
+ 11. [Jenkins setup and rules](#jenkins-setup-and-rules)
41
+ 12. [GitHub and GHCR](#github-and-ghcr)
42
+ 13. [Where configuration and secrets live](#where-configuration-and-secrets-live)
43
+ 14. [Command reference](#command-reference)
44
+ 15. [Project architecture](#project-architecture)
45
+ 16. [Common errors](#common-errors)
46
+ 17. [Frequently asked questions](#frequently-asked-questions)
47
+ 18. [Final checklist](#final-checklist)
48
+ 19. [Future modules](#future-modules)
49
+ 20. [Publishing and npm organization management](#publishing-and-npm-organization-management)
50
+ 21. [License](#license)
51
+
52
+ ---
53
+
54
+ ## What are we building?
55
+
56
+ IndraQ CLI is a small program that runs inside your terminal. Instead of remembering many Docker, GitHub, GHCR, and Jenkins commands, you tell **IndraQ CLI what you want**, and it performs the boring steps for you.
57
+
58
+ Today it handles deployment:
59
+
60
+ ```text
61
+ Your project
62
+
63
+ ├── Dockerfile
64
+
65
+ └── indraq deploy:dev
66
+
67
+ ├── check Docker / GitHub / Java / Jenkins
68
+ ├── build Docker image
69
+ ├── push image to GHCR
70
+ ├── find matching Jenkins job
71
+ ├── start Jenkins build
72
+ └── show Jenkins logs in this terminal
73
+ ```
74
+
75
+ The goal is not to make one huge deployment script. The goal is to build a **modular engineering CLI platform** where future commands can live beside deployment cleanly.
76
+
77
+ ---
78
+
79
+ ## Explain it like I am new
80
+
81
+ Imagine you made a school project and want to put the new version on a server.
82
+
83
+ Without IndraQ CLI, you may need to remember a long list of commands: build an image, log in to GitHub's registry, push the image, open Jenkins, find the correct pipeline, start it, and then watch the logs.
84
+
85
+ With IndraQ CLI, after one-time setup you type:
86
+
87
+ ```bash
88
+ indraq deploy:dev
89
+ ```
90
+
91
+ The CLI does the sequence for you. If something is wrong, it stops and tells you what is wrong instead of silently continuing.
92
+
93
+ ### The three names you should remember
94
+
95
+ | Thing | Simple meaning |
96
+ |---|---|
97
+ | **Docker image** | A packaged copy of your application |
98
+ | **GHCR** | GitHub's place for storing Docker images |
99
+ | **Jenkins pipeline/job** | The automation that deploys or processes your image |
100
+
101
+ ---
102
+
103
+ ## What happens during deployment?
104
+
105
+ ```mermaid
106
+ flowchart TD
107
+ A[indraq deploy:dev / deploy:prod] --> B{Configuration exists?}
108
+ B -- No --> C[Stop: run indraq configure]
109
+ B -- Yes --> D[Check Docker, GitHub, Java and Jenkins]
110
+ D --> E{Jenkins job exists?}
111
+ E -- No --> F[Stop with clear error]
112
+ E -- Yes --> G[Ask for Docker tag]
113
+ G --> H[Build Docker image]
114
+ H --> I[Authenticate to GHCR]
115
+ I --> J[Push image to GHCR]
116
+ J --> K[Run Jenkins CLI build]
117
+ K --> L[Stream Jenkins console output]
118
+ L --> M{Pipeline result}
119
+ M -- Failed --> N[Return failure and keep logs visible]
120
+ M -- Success --> O[Deployment complete]
121
+ ```
122
+
123
+ The Jenkins job name is intentionally simple:
124
+
125
+ > **Jenkins job name = configured image name**
126
+
127
+ Example:
128
+
129
+ ```text
130
+ Image name: immortality-accounting-service
131
+ Expected Jenkins job: immortality-accounting-service
132
+ GHCR image: ghcr.io/indraq-innovations/immortality-accounting-service
133
+ ```
134
+
135
+ If Jenkins does not contain that job, deployment stops before building the Docker image.
136
+
137
+ ---
138
+
139
+ ## Requirements
140
+
141
+ Install these before using the deployment module.
142
+
143
+ | Requirement | Why it is needed | Quick check |
144
+ |---|---|---|
145
+ | **Node.js 24** | Runs IndraQ CLI | `node --version` |
146
+ | **npm** | Installs the CLI | `npm --version` |
147
+ | **Git** | Detects your GitHub authentication | `git --version` |
148
+ | **Docker** | Builds and pushes images | `docker --version` |
149
+ | **Java** | Runs `jenkins-cli.jar` | `java -version` |
150
+ | **Jenkins account** | Starts your pipeline | Jenkins username + API token/password |
151
+
152
+ > [!TIP]
153
+ > Jenkins accepts passwords for the CLI in many configurations, but an **API token is strongly preferred**. Treat the prompt `API token or password` as "paste your Jenkins API token here" whenever possible.
154
+
155
+ ### Java is not optional
156
+
157
+ Jenkins provides its CLI as a Java `.jar` file. IndraQ CLI downloads that file from your Jenkins server, so your computer must be able to run:
158
+
159
+ ```bash
160
+ java -version
161
+ ```
162
+
163
+ If that command is not found, **do not continue to `indraq configure` yet**. Install Java first using the next section.
164
+
165
+ > [!IMPORTANT]
166
+ > **IndraQ standard: Java 21 LTS.** Jenkins applies its Java support policy to CLI clients as well as controllers and agents. Standardizing every IndraQ developer machine on Java 21 avoids different developers running different Java versions.
167
+
168
+ ---
169
+
170
+ ## Install Java 21
171
+
172
+ You only need to do this once on each developer machine.
173
+
174
+ ### Windows — recommended method
175
+
176
+ Open **PowerShell** or **Windows Terminal** and install Eclipse Temurin 21:
177
+
178
+ ```powershell
179
+ winget install EclipseAdoptium.Temurin.21.JDK
180
+ ```
181
+
182
+ When installation finishes, **close VS Code and all terminal windows, then reopen them**. This is important because an already-open terminal may still have the old `PATH`.
183
+
184
+ Verify Java:
185
+
186
+ ```powershell
187
+ java -version
188
+ ```
189
+
190
+ A successful result should begin with Java 21, for example:
191
+
192
+ ```text
193
+ openjdk version "21..."
194
+ ```
195
+
196
+ Also verify where Windows found Java:
197
+
198
+ ```powershell
199
+ where.exe java
200
+ ```
201
+
202
+ You should see a Java installation path instead of an error.
203
+
204
+ #### If `winget` is unavailable
205
+
206
+ Download a **Java 21 JDK** installer from Eclipse Adoptium / Temurin and install it. During setup, enable the options that add Java to `PATH` and set `JAVA_HOME` when available.
207
+
208
+ Official installation documentation:
209
+
210
+ - https://adoptium.net/installation/windows
211
+ - https://learn.microsoft.com/windows/dev-environment/java
212
+
213
+ #### If Java is installed but `java -version` still fails
214
+
215
+ First restart VS Code / your terminal. If it still fails, check:
216
+
217
+ ```powershell
218
+ $env:JAVA_HOME
219
+ $env:Path
220
+ where.exe java
221
+ ```
222
+
223
+ If needed, set `JAVA_HOME` to your Java 21 installation folder and add `%JAVA_HOME%\bin` to the Windows system `Path`.
224
+
225
+ Example installation location:
226
+
227
+ ```text
228
+ C:\Program Files\Eclipse Adoptium\jdk-21...
229
+ ```
230
+
231
+ Then reopen the terminal and verify again:
232
+
233
+ ```powershell
234
+ java -version
235
+ javac -version
236
+ ```
237
+
238
+ ### Ubuntu / Debian
239
+
240
+ Install OpenJDK 21:
241
+
242
+ ```bash
243
+ sudo apt update
244
+ sudo apt install -y openjdk-21-jdk
245
+ ```
246
+
247
+ Verify:
248
+
249
+ ```bash
250
+ java -version
251
+ javac -version
252
+ ```
253
+
254
+ If more than one Java version is installed, check/select the active version with:
255
+
256
+ ```bash
257
+ sudo update-alternatives --config java
258
+ ```
259
+
260
+ ### macOS
261
+
262
+ If Homebrew is installed:
263
+
264
+ ```bash
265
+ brew install --cask temurin@21
266
+ ```
267
+
268
+ Then reopen the terminal and verify:
269
+
270
+ ```bash
271
+ java -version
272
+ ```
273
+
274
+ ### Final Java check
275
+
276
+ Do not continue until this works:
277
+
278
+ ```bash
279
+ java -version
280
+ ```
281
+
282
+ Then run:
283
+
284
+ ```bash
285
+ indraq configure
286
+ ```
287
+
288
+ IndraQ CLI will perform the Java check again before downloading and starting `jenkins-cli.jar`.
289
+
290
+ ---
291
+
292
+ ## Install the CLI
293
+
294
+ IndraQ CLI is published as the public npm package **`indraq_cli`**. Install it globally once:
295
+
296
+ ```bash
297
+ npm install -g indraq_cli
298
+ ```
299
+
300
+ Then verify the command:
301
+
302
+ ```bash
303
+ indraq --version
304
+ indraq --help
305
+ ```
306
+
307
+ You should now be able to use `indraq` from any project folder:
308
+
309
+ ```bash
310
+ indraq configure
311
+ indraq deploy:dev
312
+ indraq deploy:prod
313
+ ```
314
+
315
+ ### Update to the newest version
316
+
317
+ ```bash
318
+ npm update -g indraq_cli
319
+ ```
320
+
321
+ Then confirm the installed version:
322
+
323
+ ```bash
324
+ indraq --version
325
+ ```
326
+
327
+ ### Uninstall
328
+
329
+ ```bash
330
+ npm uninstall -g indraq_cli
331
+ ```
332
+
333
+ ### If `indraq` is not found after installation
334
+
335
+ First check where npm installs global commands:
336
+
337
+ ```bash
338
+ npm prefix -g
339
+ ```
340
+
341
+ On Windows, also run:
342
+
343
+ ```powershell
344
+ where.exe indraq
345
+ ```
346
+
347
+ On macOS/Linux:
348
+
349
+ ```bash
350
+ which indraq
351
+ ```
352
+
353
+ If another file or program is found before the npm launcher, run `indraq doctor` if the CLI is reachable by another terminal/session, or fix the conflicting PATH entry.
354
+
355
+ ### Developing the CLI itself
356
+
357
+ Contributors working on the IndraQ CLI source can still use:
358
+
359
+ ```bash
360
+ npm ci
361
+ npm run build
362
+ npm link
363
+ ```
364
+
365
+ `npm link` is for CLI development only. Normal users should install the published package with `npm install -g indraq_cli`.
366
+
367
+ ---
368
+
369
+ ## First-time configuration
370
+
371
+ Go to the **application repository you want to deploy**, not the IndraQ CLI source repository.
372
+
373
+ Example:
374
+
375
+ ```bash
376
+ cd C:\Projects\my-service
377
+ indraq configure
378
+ ```
379
+
380
+ On the **first run only**, IndraQ CLI does a complete setup because the project does not have a finished deployment configuration yet.
381
+
382
+ ```text
383
+ indraq configure
384
+
385
+ ├── choose environment
386
+ ├── configure image name
387
+ ├── connect and verify Jenkins
388
+ ├── choose GitHub / GHCR destination
389
+ ├── choose Dockerfile
390
+ └── save configuration
391
+ ```
392
+
393
+ After this first successful setup, `indraq configure` changes behavior. It does **not** make you enter everything again. See [Change configuration later](#change-configuration-later).
394
+
395
+ ### Step 1 - Choose environment
396
+
397
+ ```text
398
+ ? Select the environment you want to configure:
399
+ > Development
400
+ Production
401
+ ```
402
+
403
+ Development is stored as `dev`; production is stored as `prod`.
404
+
405
+ ### Step 2 - Enter image name
406
+
407
+ Example:
408
+
409
+ ```text
410
+ ? Enter image name for DEV environment:
411
+ immortality-accounting-service
412
+ ```
413
+
414
+ This name is important because the CLI also looks for a Jenkins job with **the same name**.
415
+
416
+ ### Step 3 - Connect Jenkins
417
+
418
+ You enter:
419
+
420
+ ```text
421
+ Jenkins URL/domain
422
+ Jenkins username
423
+ Jenkins API token or password
424
+ ```
425
+
426
+ Example Jenkins URL:
427
+
428
+ ```text
429
+ https://jenkins.example.com
430
+ ```
431
+
432
+ IndraQ CLI then performs these checks automatically:
433
+
434
+ ```text
435
+ 1. Is Java available?
436
+ 2. Can the CLI download /jnlpJars/jenkins-cli.jar?
437
+ 3. Can these credentials authenticate?
438
+ 4. Does Jenkins CLI `who-am-i` identify a real user?
439
+ 5. Does WebSocket mode work? If not, can HTTP CLI mode work?
440
+ ```
441
+
442
+ If the credentials are wrong, configuration **fails immediately**. Bad Jenkins credentials are not silently saved.
443
+
444
+ > [!NOTE]
445
+ > The Jenkins connection is currently **project-level**. Development and Production share the same Jenkins controller/account, while each environment can have its own image/job name.
446
+
447
+ ### Step 4 - Choose GitHub destination
448
+
449
+ You choose:
450
+
451
+ ```text
452
+ Personal GitHub account
453
+ or
454
+ GitHub organization
455
+ ```
456
+
457
+ If you select an organization, the CLI shows the organizations available to your authenticated GitHub account.
458
+
459
+ Example:
460
+
461
+ ```text
462
+ ? Where do you want to push the GHCR image? Organization
463
+ ? Select a GitHub organization: IndraQ-Innovations
464
+ ```
465
+
466
+ > [!NOTE]
467
+ > The GitHub/GHCR destination is currently **project-level** and is shared by Development and Production.
468
+
469
+ ### Step 5 - Choose Dockerfile
470
+
471
+ Usually choose the normal file:
472
+
473
+ ```text
474
+ Dockerfile
475
+ ```
476
+
477
+ If your Dockerfile has another path, select the custom-path option.
478
+
479
+ The Dockerfile path is stored separately for Development and Production.
480
+
481
+ ---
482
+
483
+ ## Change configuration later
484
+
485
+ This is the normal behavior after the project has already been configured once.
486
+
487
+ Run:
488
+
489
+ ```bash
490
+ indraq configure
491
+ ```
492
+
493
+ First choose the environment you want to work on:
494
+
495
+ ```text
496
+ ? Select the environment you want to configure:
497
+ > Development
498
+ Production
499
+ ```
500
+
501
+ Then IndraQ CLI shows a **settings menu** instead of replaying the whole setup wizard:
502
+
503
+ ```text
504
+ ? What do you want to configure for Development?
505
+ > Image name (immortality-accounting-service)
506
+ Jenkins connection (https://jenkins.example.com (harry)) [shared]
507
+ GitHub / GHCR destination (organization: indraq-innovations) [shared]
508
+ Dockerfile path (Dockerfile)
509
+ ─────────────────────────────────────────────────────────────
510
+ Review current configuration
511
+ Exit configuration
512
+ ```
513
+
514
+ Choose **only the setting you actually want to change**.
515
+
516
+ For example, if you only want to change the Dockerfile:
517
+
518
+ ```text
519
+ Dockerfile path
520
+
521
+ change Dockerfile
522
+
523
+ save only that change
524
+
525
+ return to the settings menu
526
+ ```
527
+
528
+ The other settings are left untouched.
529
+
530
+ ### The menu stays open until you exit
531
+
532
+ After every successful change, IndraQ CLI saves it and returns you to the same menu:
533
+
534
+ ```text
535
+ Change image name
536
+
537
+ Saved
538
+
539
+ Settings menu
540
+
541
+ Change GitHub destination
542
+
543
+ Saved
544
+
545
+ Settings menu
546
+
547
+ Exit configuration
548
+ ```
549
+
550
+ This lets you update several settings in one session without running `indraq configure` again and again.
551
+
552
+ If you are finished, choose:
553
+
554
+ ```text
555
+ Exit configuration
556
+ ```
557
+
558
+ ### Review without changing anything
559
+
560
+ Choose:
561
+
562
+ ```text
563
+ Review current configuration
564
+ ```
565
+
566
+ The CLI shows the selected environment's non-secret settings, including:
567
+
568
+ ```text
569
+ Environment
570
+ Image name
571
+ Dockerfile path
572
+ GHCR destination
573
+ Jenkins URL
574
+ Jenkins username
575
+ Expected Jenkins job name
576
+ ```
577
+
578
+ The Jenkins API token/password is **never printed**.
579
+
580
+ ### What is environment-specific and what is shared?
581
+
582
+ | Setting | Development / Production separate? |
583
+ |---|---|
584
+ | Image name | **Yes** |
585
+ | Dockerfile path | **Yes** |
586
+ | Jenkins connection | No — shared by the project |
587
+ | GitHub / GHCR destination | No — shared by the project |
588
+ | Jenkins API token/password | No — tied to the saved Jenkins account and kept outside the project config |
589
+
590
+ If you change a setting marked **`[shared]`**, that change affects deployments for both Development and Production.
591
+
592
+ ---
593
+
594
+ ## Deploy development
595
+
596
+ Use either command:
597
+
598
+ ```bash
599
+ indraq deploy:dev
600
+ ```
601
+
602
+ or the long alias:
603
+
604
+ ```bash
605
+ indraq deploy:development
606
+ ```
607
+
608
+ The CLI checks the **development** configuration, builds the configured image, pushes it to GHCR, and starts the Jenkins job with the same image name.
609
+
610
+ You will be asked for one or more Docker tags:
611
+
612
+ ```text
613
+ ? Enter image tags: latest
614
+ ```
615
+
616
+ Multiple tags are supported:
617
+
618
+ ```text
619
+ latest,dev-2026-08-30
620
+ ```
621
+
622
+ ---
623
+
624
+ ## Deploy production
625
+
626
+ Use either:
627
+
628
+ ```bash
629
+ indraq deploy:prod
630
+ ```
631
+
632
+ or:
633
+
634
+ ```bash
635
+ indraq deploy:production
636
+ ```
637
+
638
+ A production deployment follows the same protected flow but uses the production environment configuration.
639
+
640
+ Example:
641
+
642
+ ```text
643
+ Environment: PROD
644
+ Image: ghcr.io/indraq-innovations/my-service
645
+ Tag: 1.8.0
646
+ Jenkins job: my-service
647
+ ```
648
+
649
+ ---
650
+
651
+ ## Jenkins setup and rules
652
+
653
+ ### How Jenkins CLI is obtained
654
+
655
+ You do **not** manually download a generic Jenkins CLI file.
656
+
657
+ During `indraq configure`, the CLI downloads the JAR directly from the Jenkins controller you entered:
658
+
659
+ ```text
660
+ https://YOUR-JENKINS/jnlpJars/jenkins-cli.jar
661
+ ```
662
+
663
+ This keeps the client aligned with that Jenkins controller.
664
+
665
+ ### How credentials are checked
666
+
667
+ IndraQ CLI uses Jenkins CLI's `who-am-i` command. If Jenkins authenticates the user, setup continues. If authentication fails or Jenkins sees the request as anonymous, configuration stops.
668
+
669
+ ### How a deployment is triggered
670
+
671
+ After the Docker image is successfully pushed, IndraQ CLI runs the equivalent of:
672
+
673
+ ```text
674
+ jenkins-cli.jar build <IMAGE_NAME> -s -v
675
+ ```
676
+
677
+ `-s` waits for Jenkins to finish and returns Jenkins' success/failure result. `-v` prints the build console output.
678
+
679
+ That means the VS Code terminal becomes your Jenkins log window:
680
+
681
+ ```text
682
+ Started my-service #142
683
+ [Pipeline] Start of Pipeline
684
+ [Pipeline] stage
685
+ [Pipeline] { (Deploy)
686
+ ...
687
+ Finished: SUCCESS
688
+ Completed my-service #142 : SUCCESS
689
+ ```
690
+
691
+ If Jenkins fails, the CLI also fails and leaves the Jenkins error output visible above it.
692
+
693
+ ### Required Jenkins permissions
694
+
695
+ The Jenkins user must be allowed to:
696
+
697
+ - authenticate to Jenkins CLI;
698
+ - read the target job;
699
+ - trigger/build the target job;
700
+ - view the build output needed by the CLI.
701
+
702
+ If Jenkins returns `403`, ask the Jenkins administrator to check permissions for that account.
703
+
704
+ ### Job naming rule
705
+
706
+ For now, IndraQ CLI deliberately uses a zero-mapping rule:
707
+
708
+ ```text
709
+ Docker image name == Jenkins job name
710
+ ```
711
+
712
+ This avoids hidden routing tables and webhook payload rules.
713
+
714
+ ---
715
+
716
+ ## GitHub and GHCR
717
+
718
+ IndraQ CLI accepts normal Git/Git Bash authentication and does **not** require GitHub CLI (`gh`).
719
+
720
+ It can use:
721
+
722
+ - Git Credential Manager / HTTPS credentials;
723
+ - GitHub CLI credentials when available;
724
+ - GitHub SSH authentication for Git operations.
725
+
726
+ GHCR does not accept SSH keys as registry credentials. If your GitHub session is SSH-only, Docker may still require a one-time registry login:
727
+
728
+ ```bash
729
+ docker login ghcr.io
730
+ ```
731
+
732
+ Your final image looks like:
733
+
734
+ ```text
735
+ ghcr.io/<owner>/<image>:<tag>
736
+ ```
737
+
738
+ Example:
739
+
740
+ ```text
741
+ ghcr.io/indraq-innovations/immortality-accounting-service:latest
742
+ ```
743
+
744
+ ---
745
+
746
+ ## Where configuration and secrets live
747
+
748
+ ### Project configuration
749
+
750
+ Each application gets:
751
+
752
+ ```text
753
+ <your-project>/.indraq/deploy.json
754
+ ```
755
+
756
+ Example:
757
+
758
+ ```json
759
+ {
760
+ "schemaVersion": 2,
761
+ "github": {
762
+ "ownerType": "organization",
763
+ "owner": "IndraQ-Innovations"
764
+ },
765
+ "jenkins": {
766
+ "url": "https://jenkins.example.com",
767
+ "username": "developer",
768
+ "serverId": "8be77a9980d4c19a",
769
+ "connectionMode": "webSocket"
770
+ },
771
+ "environments": {
772
+ "dev": {
773
+ "name": "Development",
774
+ "imageName": "my-service-dev",
775
+ "dockerfilePath": "Dockerfile"
776
+ },
777
+ "prod": {
778
+ "name": "Production",
779
+ "imageName": "my-service",
780
+ "dockerfilePath": "Dockerfile"
781
+ }
782
+ }
783
+ }
784
+ ```
785
+
786
+ Notice what is **not** there: your Jenkins API token/password.
787
+
788
+ ### Jenkins CLI cache and secret
789
+
790
+ Jenkins runtime files are kept under the user's home directory:
791
+
792
+ ```text
793
+ ~/.indraq/jenkins/<server-id>/
794
+ ├── jenkins-cli.jar
795
+ └── auth
796
+ ```
797
+
798
+ The `auth` file is passed to Jenkins CLI using its credential-file mechanism instead of putting the secret directly into the Java command line.
799
+
800
+ > [!CAUTION]
801
+ > This is still a local secret. Never copy the `auth` file into a repository, chat message, ticket, or documentation. On shared computers, use a dedicated OS account and prefer Jenkins API tokens with limited permissions.
802
+
803
+ The project-local `.indraq` folder also gets a `.gitignore` so its local state is not accidentally committed.
804
+
805
+ ---
806
+
807
+ ## Command reference
808
+
809
+ ### Normal commands
810
+
811
+ | Command | What it does |
812
+ |---|---|
813
+ | `indraq --version` | Show installed CLI version |
814
+ | `indraq --help` | Show available commands |
815
+ | `indraq configure` | First run: complete setup. Later runs: open the environment settings menu |
816
+ | `indraq deploy:dev` | Deploy development |
817
+ | `indraq deploy:development` | Same as `deploy:dev` |
818
+ | `indraq deploy:prod` | Deploy production |
819
+ | `indraq deploy:production` | Same as `deploy:prod` |
820
+
821
+ ### Structured commands
822
+
823
+ These are kept for automation and discoverability:
824
+
825
+ ```bash
826
+ indraq deploy configure
827
+ indraq deploy build --env dev
828
+ indraq deploy build --env development
829
+ indraq deploy build --env prod
830
+ indraq deploy build --env production
831
+ ```
832
+
833
+ ---
834
+
835
+ ## Project architecture
836
+
837
+ IndraQ CLI is module-based from day one:
838
+
839
+ ```text
840
+ src/
841
+ ├── index.ts
842
+ ├── cli/
843
+ │ └── create-program.ts
844
+ ├── modules/
845
+ │ └── deploy/
846
+ │ ├── commands/
847
+ │ │ ├── configure.command.ts
848
+ │ │ └── build.command.ts
849
+ │ ├── config/
850
+ │ │ └── deployment-config.ts
851
+ │ └── services/
852
+ │ ├── docker.service.ts
853
+ │ └── jenkins.service.ts
854
+ └── shared/
855
+ ├── git/
856
+ └── github/
857
+ ```
858
+
859
+ The rule is simple:
860
+
861
+ > A future feature should become a module, not another giant block inside deployment.
862
+
863
+ For example:
864
+
865
+ ```text
866
+ src/modules/database/
867
+ src/modules/backup/
868
+ src/modules/server/
869
+ src/modules/secrets/
870
+ src/modules/diagnostics/
871
+ ```
872
+
873
+ ---
874
+
875
+ ## Common errors
876
+
877
+ ### `Java is required for Jenkins CLI but was not found`
878
+
879
+ IndraQ CLI cannot run `jenkins-cli.jar` without Java.
880
+
881
+ Check:
882
+
883
+ ```bash
884
+ java -version
885
+ ```
886
+
887
+ If that command fails, install **Java 21 LTS** using the [Install Java 21](#install-java-21) section above. On Windows, the quickest supported path is:
888
+
889
+ ```powershell
890
+ winget install EclipseAdoptium.Temurin.21.JDK
891
+ ```
892
+
893
+ After installation, completely close and reopen VS Code / the terminal and run:
894
+
895
+ ```powershell
896
+ java -version
897
+ where.exe java
898
+ ```
899
+
900
+ Only retry `indraq configure` after Java is visible in the new terminal.
901
+
902
+ ### `Jenkins authentication failed`
903
+
904
+ Check all three values:
905
+
906
+ ```text
907
+ Jenkins URL
908
+ Jenkins username
909
+ Jenkins API token/password
910
+ ```
911
+
912
+ Prefer creating a fresh Jenkins API token and running:
913
+
914
+ ```bash
915
+ indraq configure
916
+ ```
917
+
918
+ Choose the environment, select **Jenkins connection**, and enter the new credentials.
919
+
920
+ ### `No Jenkins pipeline/job named "my-service" was found`
921
+
922
+ Your configured image name and Jenkins job name do not match.
923
+
924
+ If configuration says:
925
+
926
+ ```text
927
+ imageName = my-service
928
+ ```
929
+
930
+ Jenkins must contain:
931
+
932
+ ```text
933
+ my-service
934
+ ```
935
+
936
+ Either rename/create the Jenkins job or run `indraq configure`, choose the environment, and change **Image name** to the correct Jenkins job name.
937
+
938
+ ### `Jenkins denied access`
939
+
940
+ The user authenticated successfully but does not have enough permission for that job. Ask the Jenkins administrator to check the account's read/build permissions.
941
+
942
+ ### `Docker is not installed or is not accessible`
943
+
944
+ Check:
945
+
946
+ ```bash
947
+ docker --version
948
+ docker info
949
+ ```
950
+
951
+ Make sure Docker Desktop / Docker Engine is running.
952
+
953
+ ### GHCR push is denied
954
+
955
+ Your GitHub credential may not have package write access for the selected owner/organization.
956
+
957
+ If you use SSH-only Git authentication, also try:
958
+
959
+ ```bash
960
+ docker login ghcr.io
961
+ ```
962
+
963
+ ### `indraq` opens the wrong Windows program
964
+
965
+ Run:
966
+
967
+ ```powershell
968
+ where.exe indraq
969
+ ```
970
+
971
+ If another program appears before npm's launcher, Windows has a command-name collision. Remove/rename the unrelated launcher or correct PATH ordering.
972
+
973
+ ---
974
+
975
+ ## Frequently asked questions
976
+
977
+ ### Do I need the Generic Webhook Trigger plugin now?
978
+
979
+ No. The deployment flow no longer depends on a generic webhook URL. IndraQ CLI talks directly to Jenkins using Jenkins CLI.
980
+
981
+ ### Do I need to download `jenkins-cli.jar` myself?
982
+
983
+ No. The first-time setup or the **Jenkins connection** option inside `indraq configure` downloads the JAR from the Jenkins server you entered.
984
+
985
+ ### Do I have to install GitHub CLI (`gh`)?
986
+
987
+ No. Normal Git/Git Bash authentication is supported. `gh` is optional.
988
+
989
+ ### Can I use a Jenkins password?
990
+
991
+ The CLI accepts an API token or password, subject to your Jenkins security configuration. An API token is the safer choice and is recommended.
992
+
993
+ ### Where can I see Jenkins build logs?
994
+
995
+ Directly in the same terminal where you ran:
996
+
997
+ ```bash
998
+ indraq deploy:dev
999
+ ```
1000
+
1001
+ The deployment command waits for Jenkins and streams its console output.
1002
+
1003
+ ### What happens if Jenkins fails?
1004
+
1005
+ The command exits as failed. The Docker image may already be in GHCR because Jenkins is intentionally triggered **after** a successful image push. The Jenkins error remains visible in your terminal for debugging.
1006
+
1007
+ ### What if the Jenkins job does not exist?
1008
+
1009
+ The CLI checks before building the Docker image and stops with a clear error.
1010
+
1011
+ ### Why does Jenkins job name have to equal image name?
1012
+
1013
+ It keeps the first deployment system predictable. A developer can know the expected pipeline name without searching a mapping file or webhook configuration.
1014
+
1015
+ ### Can development and production have different image names?
1016
+
1017
+ Yes. Image names and Dockerfile paths are environment-specific.
1018
+
1019
+ Run:
1020
+
1021
+ ```bash
1022
+ indraq configure
1023
+ ```
1024
+
1025
+ Select Development or Production, then change only the setting you need from the configuration menu. When you are done, choose **Exit configuration**.
1026
+
1027
+ ### Can both environments use the same Jenkins server?
1028
+
1029
+ Yes. Jenkins server configuration is project-level; each environment's image name decides which matching job is triggered.
1030
+
1031
+ ### Are Jenkins secrets stored in `deploy.json`?
1032
+
1033
+ No. The project config contains the Jenkins URL, username, server ID, and connection mode. The secret is stored separately in the local IndraQ cache.
1034
+
1035
+ ---
1036
+
1037
+ ## Final checklist
1038
+
1039
+ Before calling a machine ready for IndraQ deployments, confirm:
1040
+
1041
+ - [ ] Node.js 24 is installed.
1042
+ - [ ] `indraq --version` works.
1043
+ - [ ] Git authentication works.
1044
+ - [ ] Docker is installed and running.
1045
+ - [ ] Java is installed and `java -version` works.
1046
+ - [ ] First-time `indraq configure` completes successfully.
1047
+ - [ ] Running `indraq configure` again opens the selective settings menu instead of the full wizard.
1048
+ - [ ] Jenkins credentials pass the `who-am-i` check.
1049
+ - [ ] The correct GitHub personal account or organization is selected.
1050
+ - [ ] Development image name matches its Jenkins job name.
1051
+ - [ ] Production image name matches its Jenkins job name.
1052
+ - [ ] The project has the expected Dockerfile.
1053
+ - [ ] The Jenkins user has read/build permission.
1054
+ - [ ] GHCR push permission exists for the selected owner.
1055
+ - [ ] `indraq deploy:dev` can build, push, run Jenkins, and show logs.
1056
+ - [ ] Production is tested deliberately before relying on it for releases.
1057
+
1058
+ ---
1059
+
1060
+ ## Future modules
1061
+
1062
+ Deployment is only the beginning. The CLI structure is intentionally ready for internal commands such as:
1063
+
1064
+ ```text
1065
+ indraq db:backup
1066
+ indraq db:migrate
1067
+ indraq server:health
1068
+ indraq server:deploy
1069
+ indraq docker:clean
1070
+ indraq secrets:check
1071
+ indraq diagnostics
1072
+ ```
1073
+
1074
+ These names are examples, not implemented commands yet.
1075
+
1076
+ The principle is:
1077
+
1078
+ ```text
1079
+ One IndraQ CLI
1080
+ ├── deployment operations
1081
+ ├── infrastructure operations
1082
+ ├── database operations
1083
+ ├── diagnostics
1084
+ ├── security helpers
1085
+ └── future engineering automation
1086
+ ```
1087
+
1088
+ ---
1089
+
1090
+ <p align="center">
1091
+ <img src="docs/assets/indraq-mark.png" alt="IndraQ" width="72" />
1092
+ </p>
1093
+
1094
+ <p align="center">
1095
+ <strong>Built by IndraQ Innovations for engineering operations.</strong><br/>
1096
+ Make repetitive engineering work predictable, visible, and difficult to misuse.
1097
+ </p>
1098
+
1099
+ ---
1100
+
1101
+ ## Windows command popup / command-name collision
1102
+
1103
+ If typing `indraq` opens **Choose an app** or produces no CLI output, Windows is resolving another file named `IndraQ` before npm's launcher. This happens before Node or this CLI starts, so application code cannot intercept it.
1104
+
1105
+ Run:
1106
+
1107
+ ```powershell
1108
+ where.exe indraq
1109
+ ```
1110
+
1111
+ The npm launcher should be the first result, normally `C:\Users\<you>\AppData\Roaming\npm\indraq.cmd`.
1112
+
1113
+ The published npm package is named `indraq_cli`, but the executable it installs is intentionally named `indraq`. Inspect any path listed before npm's `indraq` launcher. Do **not** delete an unfamiliar file blindly. If it is an old IndraQ test file, rename/remove it and open a new terminal. Then `indraq configure` and `indraq deploy:dev` should work normally.
1114
+
1115
+ ---
1116
+
1117
+ ## Publishing and npm organization management
1118
+
1119
+ This section is for IndraQ CLI maintainers. Normal users do **not** need these commands.
1120
+
1121
+ ### Package name and terminal command
1122
+
1123
+ The npm package name is:
1124
+
1125
+ ```text
1126
+ indraq_cli
1127
+ ```
1128
+
1129
+ Users install it with:
1130
+
1131
+ ```bash
1132
+ npm install -g indraq_cli
1133
+ ```
1134
+
1135
+ The installed terminal command is still:
1136
+
1137
+ ```bash
1138
+ indraq
1139
+ ```
1140
+
1141
+ The npm package name and the executable name do not have to be identical.
1142
+
1143
+ ### Before publishing a release
1144
+
1145
+ A freshly extracted source archive does not contain `node_modules`. Install the exact development dependencies first so the TypeScript compiler is available:
1146
+
1147
+ ```bash
1148
+ npm ci
1149
+ npm run build
1150
+ npm publish --dry-run
1151
+ ```
1152
+
1153
+ If `npm publish --dry-run` reports `tsc is not recognized`, `npm ci` was not run successfully in that source folder.
1154
+
1155
+ Then verify the account that will publish:
1156
+
1157
+ ```bash
1158
+ npm whoami
1159
+ ```
1160
+
1161
+ For a real release:
1162
+
1163
+ ```bash
1164
+ npm publish --access public
1165
+ ```
1166
+
1167
+ Unscoped npm packages such as `indraq_cli` are public.
1168
+
1169
+ ### Let the IndraQ npm organization manage the package
1170
+
1171
+ `indraq_cli` stays unscoped so users keep the simple install command `npm install -g indraq_cli`. After the first publish, an npm organization owner/package maintainer can grant an organization team access to this existing package.
1172
+
1173
+ In npm's website:
1174
+
1175
+ 1. Open the **indraq_innovations** organization.
1176
+ 2. Open **Teams**.
1177
+ 3. Open the team that should maintain the CLI (for example, `developers`).
1178
+ 4. Open **Packages**.
1179
+ 5. Choose **Add Existing Package**.
1180
+ 6. Select `indraq_cli`.
1181
+ 7. Give the team **read/write** access if that team should be able to publish future versions.
1182
+
1183
+ This gives the organization team management access without changing the public package name or install command.
1184
+
1185
+ ---
1186
+
1187
+ ## License
1188
+
1189
+ IndraQ CLI is released under the [MIT License](LICENSE). You may use, copy, modify, and distribute it under the terms of that license.
1190
+
1191
+ > IndraQ CLI is not affiliated with or endorsed by Jenkins, Docker, GitHub, or npm. Those names belong to their respective owners.