← Catalog

pi-question-tool

Interactive question and questionnaire tools for the pi coding agent — ask the user single or multiple questions with option lists and free-text input via custom TUI.

Package

Install

Install with PiG

pig install npm:pi-question-tool

Install with Pi

pi install npm:pi-question-tool
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./extensions"
  ]
}

README

Written by the package's publisher, shown as published in version 0.1.1 (README.md). PiG does not review it.

pi-question-tool

npm · source

Interactive question and questionnaire tools for the pi coding agent.

Adds two tools the model can call when it needs structured input from you:

  • question — ask a single question with a list of options (plus a free-text "Type something." fallback).
  • questionnaire — ask one or more questions. A single question shows a plain option list; multiple questions show a tab bar for navigating between them, then a summary submit screen.

Each tool renders a full-screen custom TUI. Answers are returned to the model as tool results, so the agent can act on your choices.

The implementation is adapted from the official pi extension examples (question.ts and questionnaire.ts) and bundled as an installable pi package.

Install

pi install npm:pi-question-tool

Or add it manually to ~/.pi/agent/settings.json:

{
  "packages": ["npm:pi-question-tool"]
}

To try it without installing:

git clone https://github.com/SakikoTogawa233/pi-question-tool.git
pi -e ./pi-question-tool/extensions/index.ts

Tools

question

Ask one question and let the user pick an option (or type a free-text answer).

Parameters:

FieldTypeDescription
questionstringThe question to ask
optionsArray<{ label, description? }>Options to choose from

The option list always ends with a Type something. entry so the user can answer outside the offered options. Keys: ↑↓ navigate · Enter select · Esc cancel (back from the editor, or cancel the whole question).

questionnaire

Ask one or more questions.

Parameters:

FieldTypeDescription
questionsArray<Question>Questions to ask

Each Question:

FieldTypeDescription
idstringUnique identifier for this question
labelstring?Short tab label (defaults to Q1, Q2, …)
promptstringThe full question text
optionsArray<{ value, label, description? }>Available options
allowOtherboolean?Allow the Type something. option (default true)

For a single question it behaves like question. For multiple questions a tab bar appears at the top with a Submit tab. Keys: Tab/←→ navigate questions · ↑↓ select an option · Enter confirm · Esc cancel. Selecting an option auto-advances to the next question; the Submit tab lists every answer and requires all questions answered before submitting.

Result details

Both tools attach a structured details object to the tool result in addition to the human-readable content, so other extensions or renderers can inspect the answers:

  • question → { question, options: string[], answer: string | null, wasCustom? }
  • questionnaire → { questions, answers: Array<{ id, value, label, wasCustom, index? }>, cancelled }

Develop

No build step — pi loads TypeScript extensions directly.

npm install         # dev deps (typescript, pi types, pi-tui types)
npm run typecheck   # tsc --noEmit
pi -e ./extensions/index.ts   # run pi with your working copy

CI/CD

.github/workflows/release.yml publishes to npm on a v* tag push using the NPM_TOKEN repository secret, and publishes a canary prerelease on every push to main. .github/workflows/ci.yml runs the typecheck on every push and pull request.

Requirements

  • pi coding agent (tested with >= 0.83)
  • Node 20+ (pi's own requirement)
  • An interactive TTY (the tools require TUI mode; in print/RPC/JSON mode they return an error result instead of prompting)

License

MIT