Skip to content

Add documentation for prompt types and validators#341

Merged
shibayan merged 1 commit intomasterfrom
add-docs
Mar 31, 2026
Merged

Add documentation for prompt types and validators#341
shibayan merged 1 commit intomasterfrom
add-docs

Conversation

@shibayan
Copy link
Copy Markdown
Owner

  • Created package.json for VitePress documentation setup.
  • Added documentation for various prompt types:
    • Bind: Model-based prompts using data annotations.
    • Confirm: Yes/No confirmation prompts.
    • Input: Generic input prompts with type conversion.
    • List: Interactive multi-item input prompts.
    • MultiSelect: Multiple item selection using checkboxes.
    • Password: Masked input for passwords.
    • Select: Single item selection from a list.
  • Added icon.png for documentation branding.
  • Created validators.md to document built-in and custom validators.

- Created `package.json` for VitePress documentation setup.
- Added documentation for various prompt types:
  - `Bind`: Model-based prompts using data annotations.
  - `Confirm`: Yes/No confirmation prompts.
  - `Input`: Generic input prompts with type conversion.
  - `List`: Interactive multi-item input prompts.
  - `MultiSelect`: Multiple item selection using checkboxes.
  - `Password`: Masked input for passwords.
  - `Select`: Single item selection from a list.
- Added `icon.png` for documentation branding.
- Created `validators.md` to document built-in and custom validators.
@shibayan shibayan requested a review from Copilot March 31, 2026 15:57
@shibayan shibayan self-assigned this Mar 31, 2026
@shibayan shibayan added the documentation Improvements or additions to documentation label Mar 31, 2026
@shibayan shibayan merged commit 96352e0 into master Mar 31, 2026
7 checks passed
@shibayan shibayan deleted the add-docs branch March 31, 2026 16:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a VitePress-based documentation site for Sharprompt, including pages covering supported prompt types and validation, plus GitHub Pages deployment automation.

Changes:

  • Introduces a VitePress docs site (docs/) with prompt-type and validator reference pages.
  • Adds GitHub Pages workflow to build and deploy docs from the docs/ directory.
  • Adds docs branding assets (icon) and basic theme customization.

Reviewed changes

Copilot reviewed 17 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
docs/package.json Defines the VitePress tooling/scripts for building the docs site.
docs/package-lock.json Locks VitePress/Vite dependencies for reproducible docs builds.
docs/.vitepress/config.mts Configures site metadata, base path, nav/sidebar, and favicon/logo.
docs/.vitepress/theme/index.ts Enables theme customization by importing custom CSS.
docs/.vitepress/theme/custom.css Adds brand colors and hero styling for the docs site.
docs/index.md Adds the home/landing page content and hero configuration.
docs/getting-started.md Adds installation and quick start guide content.
docs/configuration.md Documents global configuration options and behaviors.
docs/advanced.md Documents advanced features like enum support, unicode, pagination, etc.
docs/validators.md Documents built-in validators and how to author custom validators.
docs/prompt-types/*.md Adds per-prompt reference pages (Input/Confirm/Password/Select/MultiSelect/List/Bind).
docs/public/icon.png Adds a docs-site icon used for branding/favicon/logo.
.github/workflows/docs.yml Adds CI workflow to build and deploy docs to GitHub Pages.
.gitignore Ignores VitePress build output and cache directories.
Files not reviewed (1)
  • docs/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version-file: docs/package.json
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actions/setup-node is configured with node-version-file: docs/package.json, but that file doesn't define an engines.node field (it only has a volta section). setup-node typically reads Node version from .nvmrc/.node-version or package.json#engines.node, so this is likely to fail or pick an unintended Node version, which can break the docs build (Vite/VitePress have Node minimums). Consider either adding an engines.node entry, adding a .nvmrc/.node-version file and pointing node-version-file to it, or setting node-version explicitly in the workflow.

Suggested change
node-version-file: docs/package.json
node-version: 20

Copilot uses AI. Check for mistakes.
base: '/Sharprompt/',
cleanUrls: true,
head: [
['link', { rel: 'icon', href: '/Sharprompt/icon.png' }]
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The head favicon URL is hard-coded as /Sharprompt/icon.png while base is already set to /Sharprompt/. VitePress typically applies base to absolute asset URLs, so this can result in a doubled path (e.g., /Sharprompt/Sharprompt/icon.png) and a broken favicon. Use /icon.png here (or construct the path using the configured base) to keep it consistent with themeConfig.logo and the home hero image.

Suggested change
['link', { rel: 'icon', href: '/Sharprompt/icon.png' }]
['link', { rel: 'icon', href: '/icon.png' }]

Copilot uses AI. Check for mistakes.

## Cancellation Support

By default, pressing `Ctrl+C` returns the default value. You can change this behavior to throw an exception:
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cancellation behavior described here doesn't match the current implementation. DefaultConsoleDriver invokes the cancellation callback on Ctrl+C, and FormBase.CancellationHandler() calls Environment.Exit(1) unless Prompt.ThrowExceptionOnCancel is true. The docs currently say Ctrl+C returns the default value, but it actually terminates the process by default.

Suggested change
By default, pressing `Ctrl+C` returns the default value. You can change this behavior to throw an exception:
By default, pressing `Ctrl+C` cancels the prompt and terminates the process (for example with exit code `1`). You can change this behavior to throw an exception instead of exiting:

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants