Commit 22e17a6
authored
feat(cli): Add interactive prompts for commands (#5170)
This PR improves the CLI's user experience by introducing an interactive
mode for the `create`, `dryrun`, `deploy`, and `init` commands.
When a user runs one of these commands without providing all the
required arguments, the CLI will now launch an interactive prompt to
guide them through the missing options. This makes the CLI easier to
use, as it no longer requires users to memorize all command-line
arguments.
The interactive prompts are built using `inquirer` to provide a
user-friendly selection list for known values (like function types or
environments).
The interactive mode is enabled by default and can be disabled with the
`--no-interactive` flag or by setting the `CI` environment variable,
ensuring backward compatibility and scriptability.
Fixes NAN-4237
Testing:
1. Run `npm install` to add the new `inquirer` dependency.
2. Run `nango create` without any arguments. Verify that you are
prompted to select a function type, integration, and provide a name.
3. Run `nango dryrun` without any arguments. Verify that you are
prompted to select an environment, a function, and a connection.
4. Run `nango deploy` without an environment. Verify that you are
prompted to select one.
5. Run `nango init` without a path. Verify that you are prompted to
enter one.
6. Run any of the above commands with the `--no-interactive` flag to
confirm that the prompts are skipped and the command fails due to
missing arguments.
<!-- Summary by @propel-code-bot -->
---
A shared Ensure utility now orchestrates the interactive prompts,
translating missing-argument errors into actionable guidance while
preserving non-interactive execution when required.
<details>
<summary><strong>Affected Areas</strong></summary>
• packages/cli/lib/index.ts
• packages/cli/lib/services/interactive.service.ts
• packages/cli/lib/services/ensure.service.ts
• packages/cli/lib/services/function-create.service.ts
• packages/cli/lib/types.ts
• packages/cli/lib/services/sdk.ts
• packages/cli/lib/utils/errors.ts
• packages/cli/tsconfig.json
• packages/cli/package.json
• docs/reference/cli.mdx
• package-lock.json
</details>
---
*This summary was automatically generated by @propel-code-bot*1 parent 93c334c commit 22e17a6
File tree
13 files changed
+1183
-49
lines changed- docs/reference
- packages/cli
- lib
- services
- utils
13 files changed
+1183
-49
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
56 | 100 | | |
57 | 101 | | |
58 | 102 | | |
| |||
61 | 105 | | |
62 | 106 | | |
63 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
64 | 111 | | |
65 | 112 | | |
66 | 113 | | |
| |||
85 | 132 | | |
86 | 133 | | |
87 | 134 | | |
88 | | - | |
| |||
0 commit comments