chore: prepare package for automated releases

This commit is contained in:
Erik Kotsiuba
2026-04-19 13:39:32 +02:00
parent 884c5fcf0d
commit c5f74a911e
9 changed files with 2025 additions and 134 deletions
+38
View File
@@ -0,0 +1,38 @@
name: CI
on:
pull_request:
push:
branches:
- main
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.33.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.19.0
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Biome CI
run: pnpm check:ci
- name: Typecheck
run: pnpm typecheck
- name: Test
run: pnpm test
+49
View File
@@ -0,0 +1,49 @@
name: Release
on:
push:
branches:
- main
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.33.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.19.0
cache: pnpm
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Validate
run: |
pnpm check:ci
pnpm typecheck
pnpm test
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true
run: pnpm exec semantic-release
+5
View File
@@ -0,0 +1,5 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is driven by semantic-release.
+74
View File
@@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and maintainers pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes
- Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
- The use of sexualized language or imagery, and sexual attention or advances of
any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address,
without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Project maintainers are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project maintainer through GitHub issues or the
repository contact methods that may be added later.
All complaints will be reviewed and investigated promptly and fairly.
All project maintainers are obligated to respect the privacy and security of the
reporter of any incident.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
[homepage]: https://www.contributor-covenant.org
+73
View File
@@ -0,0 +1,73 @@
# Contributing
Thanks for contributing to `@eko24ive/pi-ask`.
## Development setup
Requirements:
- Node.js `22.19.0`
- pnpm `10.33.0`
Install dependencies:
```bash
pnpm install
```
Run the extension locally:
```bash
pi -e ./src/index.ts
```
## Validation
Before opening a pull request, run:
```bash
pnpm format
pnpm typecheck
pnpm test
```
You can also run the repo-wide check:
```bash
pnpm check
```
## Commit messages
This repo uses conventional commits and semantic-release.
Recommended flow:
```bash
pnpm commit
```
Examples:
- `feat: add preview question footer hint`
- `fix: preserve option notes when toggling selection`
- `docs: clarify npm install flow`
Conventional commit types matter because releases are generated automatically from commit history.
## Scope of changes
Please keep changes focused:
- state logic in plain TypeScript modules
- pi/TUI wiring thin
- tests updated when behavior changes materially
- docs updated when public behavior or usage changes materially
## Pull requests
A good pull request should include:
- a clear summary of the change
- tests for behavior changes
- docs updates when user-facing behavior changes
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 eko24ive
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+67 -97
View File
@@ -1,90 +1,45 @@
# pi-ask # @eko24ive/pi-ask
`pi-ask` is a **pi.dev extension** that adds an interactive `ask_user` clarification tool. `@eko24ive/pi-ask` is a **pi package** that adds an interactive `ask_user` clarification tool.
It lets an agent pause, ask structured questions in a terminal UI, and continue with normalized answers instead of guessing. It lets an agent pause, ask structured questions in a terminal UI, and continue with normalized answers instead of guessing.
## Project layout ## Install
- `src/` — TypeScript extension implementation
- `tests/` — behavior-focused tests
- `docs/` — small docs set for contract and architecture
## Getting started
### Requirements
- Node.js `22.19.0`
- pnpm `10.33.0`
The repo also includes `.nvmrc` and `.node-version` pinned to the same Node.js version.
### Load the extension in pi
Run pi with the extension entrypoint:
```bash ```bash
pi -e ./src/index.ts pi install npm:@eko24ive/pi-ask
``` ```
Load it dynamically with the `-e` flag. You can also install from git:
### Install dependencies
```bash ```bash
pnpm install pi install git:github.com/eko24ive/pi-ask
``` ```
### Run tests ## Use
```bash After installation, the package registers one tool: `ask_user`.
pnpm test
```
### Commit workflow
This repo uses `lefthook` together with Commitizen and conventional commitlint.
Recommended flow:
```bash
pnpm commit
```
That opens the Commitizen prompt using `cz-conventional-changelog`.
The git hooks also validate commit messages through `commitlint`.
### Biome / typecheck
```bash
pnpm format
pnpm lint
pnpm check
pnpm typecheck
```
### Zed
This repo includes project-local Zed settings at:
- `.zed/settings.json`
They are set up to:
- format TypeScript, JSON, and JSONC files with `pnpm exec biome format --stdin-file-path {buffer_path}`
- format on save
- keep newline / trailing whitespace behavior aligned with the repo settings
Note: some Zed settings such as global extension auto-install and autosave are not valid in project-local `.zed/settings.json`, so they are intentionally not included here.
## Tool
The extension registers one tool: `ask_user`.
Use it when the agent needs structured clarification before proceeding. Use it when the agent needs structured clarification before proceeding.
Use `type: "preview"` when an option needs a dedicated preview pane. Use `type: "preview"` when an option needs a dedicated preview pane.
### Input shape ### Example agent instruction
```text
When requirements are ambiguous or user preferences materially affect implementation,
call `ask_user` instead of guessing.
Ask 1-3 concise questions.
Use short tab labels.
Prefer 2-4 options per question.
Include descriptions for each option.
Use `type: "single"` unless multiple options can genuinely apply.
Use `type: "multi"` only when the user may need to select several answers.
Use `type: "preview"` when an option needs a preview panel.
After answers are returned, continue the task using those answers explicitly.
```
## Tool input
`ask_user` accepts: `ask_user` accepts:
@@ -97,7 +52,7 @@ Use `type: "preview"` when an option needs a dedicated preview pane.
label?: string, label?: string,
prompt: string, prompt: string,
type?: "single" | "multi" | "preview", type?: "single" | "multi" | "preview",
required?: boolean, // metadata only; submit is never blocked required?: boolean,
options: [ options: [
{ {
value: string, value: string,
@@ -181,8 +136,8 @@ The returned `details.answers[questionId]` object may include:
labels: string[] labels: string[]
indices: number[] indices: number[]
customText?: string customText?: string
note?: string // question-level note note?: string
optionNotes?: Record<string, string> // selected options only optionNotes?: Record<string, string>
} }
``` ```
@@ -197,32 +152,53 @@ Behavior:
- while editing a note or free-form answer, `Up` / `Down` save the draft and move navigation instead of being trapped by the editor - while editing a note or free-form answer, `Up` / `Down` save the draft and move navigation instead of being trapped by the editor
- `Space` toggles the active option on single-select questions too, but does not auto-advance - `Space` toggles the active option on single-select questions too, but does not auto-advance
## Example agent instruction ## Local development
You can give the agent an instruction like this to encourage proper `ask_user` usage: ### Requirements
```text - Node.js `22.19.0`
When requirements are ambiguous or user preferences materially affect implementation, - pnpm `10.33.0`
call `ask_user` instead of guessing.
Ask 1-3 concise questions. The repo also includes `.nvmrc` and `.node-version` pinned to the same Node.js version.
Use short tab labels.
Prefer 2-4 options per question. ### Run locally in pi
Include descriptions for each option.
Use `type: "single"` unless multiple options can genuinely apply. ```bash
Use `type: "multi"` only when the user may need to select several answers. pi -e ./src/index.ts
Use `type: "preview"` when an option needs a preview panel.
After answers are returned, continue the task using those answers explicitly.
``` ```
### Example request to the agent ### Install dependencies
```text ```bash
Before implementing, clarify my preferences with `ask_user` if needed. pnpm install
For example, ask about framework choice, styling approach, and testing strictness.
Do not guess if those choices would change the implementation.
``` ```
### Development commands
```bash
pnpm format
pnpm lint
pnpm check
pnpm typecheck
pnpm test
```
### Commit workflow
This repo uses `lefthook`, Commitizen, conventional commitlint, and semantic-release.
Recommended flow:
```bash
pnpm commit
```
## Project layout
- `src/` — TypeScript extension implementation
- `tests/` — behavior-focused tests
- `docs/` — small docs set for contract and architecture
## Documentation ## Documentation
Docs stay intentionally small: Docs stay intentionally small:
@@ -230,9 +206,3 @@ Docs stay intentionally small:
- `docs/README.md` — index - `docs/README.md` — index
- `docs/contract.md` — external behavior - `docs/contract.md` — external behavior
- `docs/architecture.md` — module boundaries and invariants - `docs/architecture.md` — module boundaries and invariants
Implementation detail should stay in the code and tests.
## Status
Implemented in TypeScript with behavior-focused test coverage.
+89 -18
View File
@@ -1,21 +1,31 @@
{ {
"dependencies": { "name": "@eko24ive/pi-ask",
"@mariozechner/pi-coding-agent": "0.67.3", "version": "0.0.0-development",
"@mariozechner/pi-tui": "0.67.3", "description": "Pi package that adds an interactive ask_user clarification tool.",
"@sinclair/typebox": "0.34.49" "license": "MIT",
"type": "module",
"repository": {
"type": "git",
"url": "git+https://github.com/eko24ive/pi-ask.git"
}, },
"devDependencies": { "homepage": "https://github.com/eko24ive/pi-ask#readme",
"@biomejs/biome": "2.4.12", "bugs": {
"@commitlint/cli": "^19.8.1", "url": "https://github.com/eko24ive/pi-ask/issues"
"@commitlint/config-conventional": "^19.8.1",
"@types/node": "25.6.0",
"commitizen": "^4.3.1",
"cz-conventional-changelog": "^3.3.0",
"lefthook": "^2.1.6",
"typescript": "6.0.2",
"ultracite": "7.6.0"
}, },
"name": "pi-ask", "keywords": [
"pi-package",
"pi",
"pi-coding-agent",
"ask_user",
"clarification",
"terminal-ui"
],
"files": [
"src/",
"README.md",
"LICENSE",
"CHANGELOG.md"
],
"scripts": { "scripts": {
"test": "node --test tests/*.test.ts", "test": "node --test tests/*.test.ts",
"typecheck": "tsc -p tsconfig.json", "typecheck": "tsc -p tsconfig.json",
@@ -26,10 +36,71 @@
"fix": "ultracite fix", "fix": "ultracite fix",
"prepare": "lefthook install", "prepare": "lefthook install",
"commit": "cz", "commit": "cz",
"commitlint": "commitlint" "commitlint": "commitlint",
"release": "semantic-release"
},
"pi": {
"extensions": [
"./src/index.ts"
]
},
"publishConfig": {
"access": "public",
"provenance": true
},
"release": {
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
"@semantic-release/npm",
"@semantic-release/github",
[
"@semantic-release/git",
{
"assets": [
"package.json",
"CHANGELOG.md"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
},
"peerDependencies": {
"@mariozechner/pi-coding-agent": "*",
"@mariozechner/pi-tui": "*",
"@sinclair/typebox": "*"
},
"devDependencies": {
"@biomejs/biome": "2.4.12",
"@commitlint/cli": "^19.8.1",
"@commitlint/config-conventional": "^19.8.1",
"@mariozechner/pi-coding-agent": "0.67.3",
"@mariozechner/pi-tui": "0.67.3",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^13.0.1",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^11.0.6",
"@semantic-release/npm": "^12.0.2",
"@semantic-release/release-notes-generator": "^14.1.0",
"@sinclair/typebox": "0.34.49",
"@types/node": "25.6.0",
"commitizen": "^4.3.1",
"cz-conventional-changelog": "^3.3.0",
"lefthook": "^2.1.6",
"semantic-release": "^24.2.9",
"typescript": "6.0.2",
"ultracite": "7.6.0"
}, },
"type": "module",
"private": true,
"engines": { "engines": {
"node": "22.19.x", "node": "22.19.x",
"pnpm": "10.33.0" "pnpm": "10.33.0"
+1609 -19
View File
File diff suppressed because it is too large Load Diff