@pagopa/dx-cli 0.24.0 → 0.25.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.
Files changed (32) hide show
  1. package/README.md +14 -0
  2. package/bin/index.js +13 -3
  3. package/dist/adapters/azure/cloud-account-service.js +169 -92
  4. package/dist/adapters/azure/locations.d.ts +5 -1
  5. package/dist/adapters/azure/locations.js +1 -1
  6. package/dist/adapters/azure-monitor/instrumentation.d.ts +26 -0
  7. package/dist/adapters/azure-monitor/instrumentation.js +84 -0
  8. package/dist/adapters/azure-monitor/telemetry.d.ts +19 -0
  9. package/dist/adapters/azure-monitor/telemetry.js +28 -0
  10. package/dist/adapters/commander/commands/add.d.ts +32 -7
  11. package/dist/adapters/commander/commands/add.js +197 -15
  12. package/dist/adapters/commander/commands/doctor.js +4 -1
  13. package/dist/adapters/commander/commands/init.js +64 -15
  14. package/dist/adapters/github/github-repo.js +20 -2
  15. package/dist/adapters/octokit/index.d.ts +12 -0
  16. package/dist/adapters/octokit/index.js +26 -2
  17. package/dist/adapters/plop/actions/setup-pnpm.js +5 -1
  18. package/dist/adapters/plop/actions/sync-repository-environments.d.ts +15 -0
  19. package/dist/adapters/plop/actions/sync-repository-environments.js +98 -0
  20. package/dist/adapters/plop/generators/environment/actions.js +4 -1
  21. package/dist/adapters/plop/generators/environment/index.d.ts +3 -3
  22. package/dist/adapters/plop/generators/environment/index.js +6 -3
  23. package/dist/adapters/plop/generators/environment/prompts.d.ts +38 -0
  24. package/dist/adapters/plop/generators/environment/prompts.js +236 -91
  25. package/dist/adapters/plop/index.d.ts +3 -3
  26. package/dist/adapters/plop/index.js +5 -5
  27. package/dist/domain/authorization.js +4 -4
  28. package/dist/domain/environment.d.ts +6 -1
  29. package/dist/domain/environment.js +1 -1
  30. package/dist/index.js +132 -8
  31. package/package.json +24 -16
  32. package/templates/environment/workflow/_release-terraform-apply-bootstrapper-{{env.name}}.yaml.hbs +145 -2
package/README.md CHANGED
@@ -66,6 +66,20 @@ npm run build
66
66
  node ./apps/cli/bin/index.js --help
67
67
  ```
68
68
 
69
+ ## 🔐 Authentication
70
+
71
+ The CLI requires GitHub authentication for every command **except** `--version`
72
+ and `--help`. Authenticate using one of the following (checked in this order):
73
+
74
+ 1. The `GH_TOKEN` environment variable
75
+ 2. The `GITHUB_TOKEN` environment variable
76
+ 3. The [GitHub CLI](https://cli.github.com/) — run `gh auth login`
77
+
78
+ If no credential is found, the CLI exits with an error asking you to log in.
79
+
80
+ > Telemetry is emitted only for members of the `pagopa` GitHub organization;
81
+ > all other users can use the CLI normally with telemetry disabled.
82
+
69
83
  ## 🛠️ Usage
70
84
 
71
85
  ### Available Commands
package/bin/index.js CHANGED
@@ -1,6 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { runCli } from "../dist/index.js";
4
- import packageJson from "../package.json" with { type: "json" };
3
+ // The instrumentation module must be loaded first so that the OpenTelemetry
4
+ // module hook (import-in-the-middle) is registered before any of the CLI's
5
+ // modules are imported. Static imports are always hoisted before code runs, so
6
+ // sequential dynamic imports are the only way to guarantee this load order.
7
+ await import("../dist/adapters/azure-monitor/instrumentation.js");
5
8
 
6
- runCli(packageJson.version).catch((error) => console.error(error.message));
9
+ const { runCli } = await import("../dist/index.js");
10
+ const { default: packageJson } = await import("../package.json", {
11
+ with: { type: "json" },
12
+ });
13
+
14
+ await runCli(packageJson.version).catch((error) =>
15
+ console.error(error.message),
16
+ );