Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Options:

Commands:
generate [options] Generate API docs
interactive Launch guided CLI wizard
help [command] display help for command
```

Expand All @@ -72,17 +71,6 @@ Options:
-h, --help display help for command
```

### `interactive`

```
Usage: @node-core/doc-kit interactive [options]

Launch guided CLI wizard

Options:
-h, --help display help for command
```

## Examples

### Legacy
Expand Down
40 changes: 1 addition & 39 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface Command {

Each command consists of:

- **name**: The command name used in the CLI (e.g., `generate`, `interactive`)
- **name**: The command name used in the CLI (e.g., `generate`)
- **description**: A short description shown in help text
- **options**: An object mapping option names to their definitions
- **action**: The async function that executes when the command is run
Expand Down Expand Up @@ -57,12 +57,10 @@ Add your command to the exports in `bin/commands/index.mjs`:

```javascript
import generate from './generate.mjs';
import interactive from './interactive.mjs';
import myCommand from './my-command.mjs'; // Add this

export default [
generate,
interactive,
myCommand, // Add this
];
```
Expand All @@ -79,7 +77,6 @@ Options define the flags and parameters your command accepts. Each option has:
interface Option {
flags: string[]; // CLI flags (e.g., ['-i', '--input <value>'])
desc: string; // Description for help text
prompt?: PromptConfig; // Interactive mode configuration
}
```

Expand Down Expand Up @@ -186,38 +183,3 @@ prompt: {
],
}
```

## Interactive Prompts

The `interactive` command automatically uses the `prompt` configuration from your options. When users run:

```bash
doc-kit interactive
```

They'll be prompted to select a command, then guided through all required options.

### Prompt Configuration

- **message**: Question to ask the user
- **type**: Input type (`text`, `confirm`, `select`, `multiselect`)
- **required**: Whether the field must have a value
- **initialValue**: Default value
- **variadic**: Whether multiple values can be entered (for `text` type)
- **options**: Choices for `select`/`multiselect` types

### Making Options Interactive-Friendly

Always provide helpful messages and sensible defaults:

```javascript
threads: {
flags: ['-p', '--threads <number>'],
desc: 'Number of threads to use (minimum: 1)',
prompt: {
type: 'text',
message: 'How many threads to allow',
initialValue: String(cpus().length), // Smart default
},
},
```
Loading