npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pi-ask-tool-extension

v0.2.2

Published

Ask tool extension for pi with tabbed questioning and inline note editing

Readme

Pi Ask Tool Extension

An extension for the Pi coding agent that adds a structured ask tool with interactive, tab-based questioning and inline note editing.

ask({
  questions: [
    {
      id: "auth",
      question: "Which authentication model should we use?",
      options: [{ label: "JWT" }, { label: "Session" }],
      recommended: 1
    }
  ]
})

Why

When an agent needs a decision from you, free-form prompts are slow and inconsistent. This extension provides:

  • Structured options with clear IDs and deterministic outputs
  • Single + multi-select in one tool
  • Tab-based multi-question flow with a final submit review tab
  • Inline note editing (no large UI pane shifts)
  • Automatic Other (type your own) handling

Install

From npm

pi install npm:pi-ask-tool-extension

From git

pi install git:github.com/devkade/pi-ask-tool@main
# or pin a tag
pi install git:github.com/devkade/[email protected]

Local development run

pi -e ./src/index.ts

Quick Start

Single question (single-select)

ask({
  questions: [
    {
      id: "auth",
      question: "Which auth approach?",
      options: [{ label: "JWT" }, { label: "Session" }],
      recommended: 1
    }
  ]
})

Result example:

User answers:
auth: Session

Answer context:
Question 1 (auth)
Prompt: Which auth approach?
Options:
  1. JWT
  2. Session
Response:
  Selected: Session

Single question (multi-select)

ask({
  questions: [
    {
      id: "features",
      question: "Which features should be enabled?",
      options: [{ label: "Logging" }, { label: "Metrics" }, { label: "Tracing" }],
      multi: true
    }
  ]
})

Result example:

User answers:
features: [Logging, Metrics]

Answer context:
Question 1 (features)
Prompt: Which features should be enabled?
Options:
  1. Logging
  2. Metrics
  3. Tracing
Response:
  Selected: [Logging, Metrics]

Multi-question (tab flow)

ask({
  questions: [
    {
      id: "auth",
      question: "Which auth approach?",
      options: [{ label: "JWT" }, { label: "Session" }]
    },
    {
      id: "cache",
      question: "Which cache strategy?",
      options: [{ label: "Redis" }, { label: "None" }]
    }
  ]
})

Result example:

User answers:
auth: Session
cache: Redis

Answer context:
Question 1 (auth)
Prompt: Which auth approach?
Options:
  1. JWT
  2. Session
Response:
  Selected: Session

Question 2 (cache)
Prompt: Which cache strategy?
Options:
  1. Redis
  2. None
Response:
  Selected: Redis

Interaction Model

| Flow | UI style | Submit behavior | |---|---|---| | Single + multi: false | one-question picker | Enter submits immediately | | Single + multi: true | tab UI (Question + Submit) | Submit tab confirms | | Multiple questions (mixed allowed) | tab UI (Q1..Qn + Submit) | Submit tab confirms all |

Inline Notes (Minimal UI Transitions)

Press Tab on any option to edit a note inline on that same row.

  • Display format: Option — note: ...
  • Editing cursor:
  • Notes are sanitized for inline display (line breaks/control chars)
  • Narrow-width rendering keeps the edit cursor visible

For Other, a note is required to become valid.

Keyboard Shortcuts

  • ↑ / ↓: move between options
  • ← / →: switch question tabs
  • Enter: select/toggle or submit (on Submit tab)
  • Tab: start/stop inline note editing
  • Esc: cancel flow

Tool Schema

{
  questions: [
    {
      id: string,
      question: string,
      options: [{ label: string }],
      multi?: boolean,
      recommended?: number // 0-indexed
    }
  ]
}

Do not include an Other option in options. The UI injects it automatically.

Development

npm install
npm run check

npm run check runs:

  • TypeScript checks (npm run typecheck)
  • Test suite with coverage (npm run test:coverage)
  • Coverage gate (npm run coverage:check)

Coverage gate defaults (override via env vars in CI if needed):

  • Overall: lines >= 38%, functions >= 80%
  • src/index.ts: lines >= 95%, functions >= 100%
  • src/ask-logic.ts: lines >= 95%, functions >= 100%
  • src/ask-inline-note.ts: lines >= 80%, functions >= 70%

Project Structure

  • src/index.ts - extension entrypoint, tool registration, and orchestration
  • src/ask-logic.ts - selection/result mapping helpers
  • src/ask-inline-ui.ts - single-question UI
  • src/ask-tabs-ui.ts - tabbed multi-question UI
  • src/ask-inline-note.ts - inline note rendering helper
  • test/*.test.ts - logic + UI mapping + integration coverage