← Catalog

@that-yolanda/pi-questionnaire

Interactive single/multi-question UI tool for PI coding agent.

Package

Install

Install with PiG

pig install npm:@that-yolanda/pi-questionnaire

Install with Pi

pi install npm:@that-yolanda/pi-questionnaire
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": [
    "./index.ts"
  ]
}

README

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

questionnaire

Interactive questionnaire tool for PI coding agent. Supports single and multiple questions with single-select and multi-select modes.

Usage

Register as a tool — the AI calls questionnaire with a list of questions:

{
  "questions": [
    {
      "id": "framework",
      "label": "Framework",
      "prompt": "Which framework do you prefer?",
      "options": [
        { "value": "react", "label": "React" },
        { "value": "vue", "label": "Vue" },
        { "value": "svelte", "label": "Svelte" }
      ]
    },
    {
      "id": "features",
      "label": "Features",
      "prompt": "Which features do you need?",
      "multiSelect": true,
      "options": [
        { "value": "auth", "label": "Authentication" },
        { "value": "db", "label": "Database" },
        { "value": "api", "label": "API layer" }
      ]
    }
  ]
}

Parameters

FieldTypeDefaultDescription
idstringrequiredUnique identifier
labelstringQ1, Q2...Short tab label (multi-question mode)
promptstringrequiredFull question text
optionsarrayrequiredAvailable choices
allowOtherbooleantrueShow "Type something" option
multiSelectbooleanfalseAllow multiple selections

Modes

  • Single question: Simple vertical option list. Enter selects and advances immediately.
  • Multiple questions: Tab bar navigation between questions + Submit tab. All questions must be answered before submitting.

Single-select (default)

  • ↑↓ navigate, Enter select, Esc cancel

Multi-select (multiSelect: true)

  • ↑↓ navigate, Space toggle (☑/☐), Enter confirm selection, Esc cancel

Custom input (allowOther: true)

Both modes support a "Type something." option that opens an inline text editor. In multi-select mode, custom inputs accumulate and are displayed with a → prefix.

Architecture

Single-file extension (index.ts) built with @earendil-works/pi-tui:

  • State machine: handleInput() routes key events based on inputMode, currentTab, and multiSelect flags
  • Rendering: render() produces styled text lines using theme.fg()/theme.bg()
  • Editor: Uses Editor component from pi-tui for custom text input with autocomplete
  • Result: Returns QuestionnaireResult with answers[] and cancelled flag

Key data structures

Question → { id, prompt, options[], allowOther, multiSelect }
Answer   → { id, value, label, wasCustom, index?, selections? }

Multi-select answers include a selections[] array instead of a single value.

Testing

TUI-heavy code — exempt from unit testing per project conventions.

Changelog

See CHANGELOG.md.