fastaxi 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fastaxi-0.1.0/.github/workflows/docs.yml +42 -0
- fastaxi-0.1.0/.github/workflows/publish.yml +22 -0
- fastaxi-0.1.0/.gitignore +13 -0
- fastaxi-0.1.0/.pre-commit-config.yaml +10 -0
- fastaxi-0.1.0/.python-version +1 -0
- fastaxi-0.1.0/CHANGELOG.md +90 -0
- fastaxi-0.1.0/LICENSE.md +21 -0
- fastaxi-0.1.0/PKG-INFO +122 -0
- fastaxi-0.1.0/README.md +86 -0
- fastaxi-0.1.0/docs/building-axis.md +383 -0
- fastaxi-0.1.0/docs/coding-agents.md +87 -0
- fastaxi-0.1.0/docs/development.md +31 -0
- fastaxi-0.1.0/docs/index.md +47 -0
- fastaxi-0.1.0/docs/quickstart.md +367 -0
- fastaxi-0.1.0/docs/reference.md +45 -0
- fastaxi-0.1.0/docs/testing.md +42 -0
- fastaxi-0.1.0/docs/tools.md +58 -0
- fastaxi-0.1.0/examples/pyproject.toml +19 -0
- fastaxi-0.1.0/examples/skills/todo-axi/SKILL.md +89 -0
- fastaxi-0.1.0/examples/todo_axi/__init__.py +0 -0
- fastaxi-0.1.0/examples/todo_axi/__main__.py +9 -0
- fastaxi-0.1.0/examples/todo_axi/cli.py +96 -0
- fastaxi-0.1.0/examples/todo_axi/models.py +46 -0
- fastaxi-0.1.0/examples/todo_axi/store.py +109 -0
- fastaxi-0.1.0/examples/uv.lock +344 -0
- fastaxi-0.1.0/mkdocs.yml +62 -0
- fastaxi-0.1.0/pyproject.toml +92 -0
- fastaxi-0.1.0/src/fastaxi/__init__.py +21 -0
- fastaxi-0.1.0/src/fastaxi/_typing.py +252 -0
- fastaxi-0.1.0/src/fastaxi/axi.py +728 -0
- fastaxi-0.1.0/src/fastaxi/errors.py +57 -0
- fastaxi-0.1.0/src/fastaxi/help.py +242 -0
- fastaxi-0.1.0/src/fastaxi/markers.py +141 -0
- fastaxi-0.1.0/src/fastaxi/output.py +256 -0
- fastaxi-0.1.0/src/fastaxi/params.py +204 -0
- fastaxi-0.1.0/src/fastaxi/parsing.py +292 -0
- fastaxi-0.1.0/src/fastaxi/py.typed +0 -0
- fastaxi-0.1.0/src/fastaxi/rendering.py +241 -0
- fastaxi-0.1.0/src/fastaxi/response.py +115 -0
- fastaxi-0.1.0/src/fastaxi/setup/__init__.py +3 -0
- fastaxi-0.1.0/src/fastaxi/setup/_managed.py +111 -0
- fastaxi-0.1.0/src/fastaxi/setup/commands.py +175 -0
- fastaxi-0.1.0/src/fastaxi/setup/hooks.py +551 -0
- fastaxi-0.1.0/src/fastaxi/setup/skill.py +222 -0
- fastaxi-0.1.0/src/fastaxi/tools.py +330 -0
- fastaxi-0.1.0/tests/conftest.py +14 -0
- fastaxi-0.1.0/tests/examples/test_todo_axi.py +260 -0
- fastaxi-0.1.0/tests/fastaxi/setup/test_commands.py +89 -0
- fastaxi-0.1.0/tests/fastaxi/setup/test_hooks.py +240 -0
- fastaxi-0.1.0/tests/fastaxi/setup/test_skill.py +162 -0
- fastaxi-0.1.0/tests/fastaxi/test_axi.py +301 -0
- fastaxi-0.1.0/tests/fastaxi/test_output.py +157 -0
- fastaxi-0.1.0/tests/fastaxi/test_params.py +56 -0
- fastaxi-0.1.0/tests/fastaxi/test_rendering.py +142 -0
- fastaxi-0.1.0/tests/fastaxi/test_response.py +166 -0
- fastaxi-0.1.0/tests/fastaxi/test_tools.py +230 -0
- fastaxi-0.1.0/uv.lock +1552 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
pages: write
|
|
12
|
+
id-token: write
|
|
13
|
+
|
|
14
|
+
# One deployment at a time; let an in-progress one finish.
|
|
15
|
+
concurrency:
|
|
16
|
+
group: pages
|
|
17
|
+
cancel-in-progress: false
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
build:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
- uses: astral-sh/setup-uv@v6
|
|
25
|
+
- run: uv sync --group docs
|
|
26
|
+
# --strict turns broken links and bad references into errors
|
|
27
|
+
- run: uv run mkdocs build --strict
|
|
28
|
+
- uses: actions/upload-pages-artifact@v3
|
|
29
|
+
with:
|
|
30
|
+
path: site
|
|
31
|
+
|
|
32
|
+
deploy:
|
|
33
|
+
# pull requests only check that the site builds
|
|
34
|
+
if: github.event_name != 'pull_request'
|
|
35
|
+
needs: build
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
environment:
|
|
38
|
+
name: github-pages
|
|
39
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
40
|
+
steps:
|
|
41
|
+
- id: deployment
|
|
42
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
environment:
|
|
14
|
+
name: pypi-publish
|
|
15
|
+
url: https://pypi.org/p/fastaxi
|
|
16
|
+
permissions:
|
|
17
|
+
id-token: write
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
- uses: astral-sh/setup-uv@v6
|
|
21
|
+
- run: uv build --no-sources
|
|
22
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
fastaxi-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
3
|
+
# Keep in step with the ruff version in uv.lock.
|
|
4
|
+
rev: v0.17.6
|
|
5
|
+
hooks:
|
|
6
|
+
- id: ruff-format
|
|
7
|
+
- repo: https://github.com/asottile/add-trailing-comma
|
|
8
|
+
rev: v4.0.0
|
|
9
|
+
hooks:
|
|
10
|
+
- id: add-trailing-comma
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] — 2025-11-28
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
#### Core framework
|
|
13
|
+
- `AXI` class — the primary builder for AXI-compliant CLIs from typed Python functions and Pydantic models.
|
|
14
|
+
- `Command` / `Group` types — represent individual commands and command groupings within an application tree.
|
|
15
|
+
- `Result` dataclass — captures command execution results (return value, exit code, stdout/stderr).
|
|
16
|
+
- Automatic argument parsing from function signatures and Pydantic model fields.
|
|
17
|
+
- Support for scalar types: `str`, `int`, `float`, `bool`, `Decimal`, `date`, `datetime`, `time`, `timedelta`, `UUID`, `Path`.
|
|
18
|
+
- Enum support via Pydantic `EnumTypeHandler`.
|
|
19
|
+
- Custom type annotation (`CustomAnnotation`) for integrating arbitrary Pydantic validators and field constraints.
|
|
20
|
+
- Literal types with TOON rendering when only one variant exists.
|
|
21
|
+
|
|
22
|
+
#### Markers & annotations
|
|
23
|
+
- `Default` marker — marks a field for inclusion in compact/default output modes.
|
|
24
|
+
- `Flag` marker — creates a CLI flag from a boolean-typed parameter.
|
|
25
|
+
- `Arg` marker — adds metadata (e.g. hidden flags) to parameters.
|
|
26
|
+
- `Truncate` marker — sets per-field truncation limits for verbose mode.
|
|
27
|
+
- `Hidden` alias — shorthand for `Arg(hidden=True)`.
|
|
28
|
+
- `Response` dataclass — wraps structured return values with optional extras like error info and next steps.
|
|
29
|
+
- `data_annotation` helper — attaches response extras as a type hint.
|
|
30
|
+
|
|
31
|
+
#### Error handling
|
|
32
|
+
- `AxiError` base exception — expected failures rendered on stdout with exit code 1 by default. Includes `message`, `hint`, `help` (actionable suggestions), and arbitrary extra keys. Supports custom exit codes.
|
|
33
|
+
- `DefinitionError` — raised during AXI construction when command definitions are invalid (missing docstrings, type mismatches, missing required args, etc.).
|
|
34
|
+
- `UsageError` — raised at parse time for malformed CLI usage; includes self-healing help messages.
|
|
35
|
+
- `did_you_mean` utility — fuzzy-matches misspelled flags or subcommands.
|
|
36
|
+
|
|
37
|
+
#### Output & rendering
|
|
38
|
+
- Multi-format output: **TOON** (default, agent-friendly table-of-named-values), **CSV**, **JSON**, **Markdown**.
|
|
39
|
+
- Three output levels: **compact** (defaults-only columns), **fields** (user-selected columns via `--fields`), **verbose** (all fields).
|
|
40
|
+
- Auto-escapes values containing whitespace or delimiters.
|
|
41
|
+
- Built-in totals display (`count: N of M total`).
|
|
42
|
+
- Next-step hints injected into output (e.g. `help[1]: fastaxi list --status open`).
|
|
43
|
+
- Empty-state guidance returned when queries produce no results.
|
|
44
|
+
- Consistent formatting across all output paths with deterministic key ordering.
|
|
45
|
+
|
|
46
|
+
#### Help system
|
|
47
|
+
- Docstring parser — extracts summary, description, and per-parameter help text from Google-style docstrings using the `griffe` library.
|
|
48
|
+
- `--help` / `-h` — displays formatted command-level help with section headers (Description, Args, Examples, Hidden).
|
|
49
|
+
- `--version` / `-v` / `-V` — prints `<name>: <version>` via package metadata.
|
|
50
|
+
- Group-level help lists available subcommands.
|
|
51
|
+
- Binary display shows the tool name and version for top-level invocation.
|
|
52
|
+
|
|
53
|
+
#### Agent integration
|
|
54
|
+
- `app.tools()` — exposes each AXI command as a plain Python function that agent frameworks can consume directly. Compatible with **PydanticAI**, **LangChain**, and the **OpenAI Agents SDK**.
|
|
55
|
+
- `tool_spec(fn)` — produces raw JSON schemas (name, description, parameters) for tool integration.
|
|
56
|
+
- Session hooks for coding agents: automatically runs the AXI's home view when sessions start in **Claude Code**, **Codex**, and **OpenCode**.
|
|
57
|
+
- Agent Skills generation — auto-generates `SKILL.md` files from AXI help text. Supports custom skill text with frontmatter. Replaces `{bin}`, `{usage}`, and `{commands}` placeholders. Managed copies tracked so they're never overwritten unintentionally.
|
|
58
|
+
|
|
59
|
+
#### Application lifecycle
|
|
60
|
+
- `AXI.run(args=None, stdin=None)` — main CLI entry point that dispatches commands, handles errors gracefully, and returns appropriate exit codes.
|
|
61
|
+
- `AXI.run_async(...)` — async-compatible variant of run.
|
|
62
|
+
- Graceful shutdown on `KeyboardInterrupt` (exit code 130).
|
|
63
|
+
- Warnings shown for missing group docstrings at build time.
|
|
64
|
+
|
|
65
|
+
#### Rendering engine
|
|
66
|
+
- Smart multi-line value rendering that preserves newlines while keeping column alignment.
|
|
67
|
+
- Truncation with overflow indicator for verbose-mode field limits.
|
|
68
|
+
- Properly handles `None`, empty strings, and edge-case whitespace-only values.
|
|
69
|
+
|
|
70
|
+
#### Installation & setup
|
|
71
|
+
- `app.setup(scope="user" | "project")` — one-command installation of session hooks and Agent Skills into agent configuration directories. Idempotent with managed-file markers.
|
|
72
|
+
- `app.remove_setup()` — cleanly uninstalls everything fastaxi installed (hooks + skills).
|
|
73
|
+
- `app.list_setup_status()` / `app.check_setup_status()` — query current hook/skill status.
|
|
74
|
+
|
|
75
|
+
### Examples & documentation
|
|
76
|
+
- **Todo AXI example** — a complete, runnable todo-tracking CLI demonstrating every major feature: paginated lists, filtering, detail views, creation, marking complete, deletion, and search. Lives in `examples/todo_axi/`.
|
|
77
|
+
- **Agent Skills** — pre-built `SKILL.md` files for the Todo AXI, configured for Claude Code and Codex.
|
|
78
|
+
- **MkDocs documentation** — hosted at `nerd-smith.github.io/fastaxi`. Sections include: Quickstart, Building AXIs, Connecting to Coding Agents, Agent Framework Tools, API Reference, and Development guide.
|
|
79
|
+
- **GitHub Actions workflows**: Docs CI/deploy to GitHub Pages on push to `main`; Publish to PyPI on production release.
|
|
80
|
+
|
|
81
|
+
### Tooling & development
|
|
82
|
+
- **Hatchling** as the build backend.
|
|
83
|
+
- **uv** for dependency management and reproducible builds (with `uv.lock`).
|
|
84
|
+
- **Ruff** for linting (`D1` docstring enforcement, `TID252` absolute imports). Ban on relative parent imports.
|
|
85
|
+
- **basedpyright** with strict type-checking enabled.
|
|
86
|
+
- **pytest** with coverage measurement (`--cov`, branch tracking).
|
|
87
|
+
- **pre-commit** hooks configured.
|
|
88
|
+
- Python 3.10+ required.
|
|
89
|
+
|
|
90
|
+
[0.1.0]: https://github.com/nerd-smith/fastaxi/releases/tag/v0.1.0
|
fastaxi-0.1.0/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Sebastián Ramírez
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
fastaxi-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: fastaxi
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Build AXI (Agent eXperience Interface) CLIs from typed Python functions
|
|
5
|
+
Project-URL: Homepage, https://github.com/nerd-smith/fastaxi
|
|
6
|
+
Author-email: Nerd Smith <32527006+nerd-smith@users.noreply.github.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE.md
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Environment :: Web Environment
|
|
11
|
+
Classifier: Framework :: Pydantic
|
|
12
|
+
Classifier: Framework :: Pydantic :: 2
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Information Technology
|
|
15
|
+
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
25
|
+
Classifier: Topic :: Internet
|
|
26
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
27
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
28
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
29
|
+
Classifier: Topic :: Software Development
|
|
30
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
31
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
32
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
33
|
+
Classifier: Typing :: Typed
|
|
34
|
+
Requires-Python: >=3.10
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# fastaxi
|
|
38
|
+
|
|
39
|
+
Build [AXI](https://axi.md) (Agent eXperience Interface) command-line tools from typed Python
|
|
40
|
+
functions.
|
|
41
|
+
|
|
42
|
+
**Documentation: [nerd-smith.github.io/fastaxi](https://nerd-smith.github.io/fastaxi/)**
|
|
43
|
+
|
|
44
|
+
AXI is a set of principles for CLIs that AI agents use: compact output, a few fields by
|
|
45
|
+
default, totals and next-step hints, explicit empty states, structured errors and a live home
|
|
46
|
+
view. With fastaxi you write ordinary functions that return Pydantic models, and it takes care
|
|
47
|
+
of all of that. The same commands can also be handed to agent frameworks (PydanticAI,
|
|
48
|
+
LangChain, the OpenAI Agents SDK, ...) as tools.
|
|
49
|
+
|
|
50
|
+
## Install
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
uv add fastaxi
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
fastaxi needs Python 3.10 or later.
|
|
57
|
+
|
|
58
|
+
## Example
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from typing import Annotated
|
|
62
|
+
|
|
63
|
+
from pydantic import BaseModel
|
|
64
|
+
|
|
65
|
+
from fastaxi import AXI, Default
|
|
66
|
+
|
|
67
|
+
app = AXI("todo-axi", description="Track todos for the current project")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class Todo(BaseModel):
|
|
71
|
+
id: Annotated[int, Default] # shown in lists by default
|
|
72
|
+
title: Annotated[str, Default]
|
|
73
|
+
status: Annotated[str, Default]
|
|
74
|
+
assignee: str | None = None # available with --fields
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@app.command(name="list", next_steps=["{bin} view <id>"])
|
|
78
|
+
def list_todos(status: str = "open") -> list[Todo]:
|
|
79
|
+
"""List todos.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
status: Filter by status.
|
|
83
|
+
"""
|
|
84
|
+
return db.query(status)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
$ todo-axi list
|
|
89
|
+
id,title,status
|
|
90
|
+
41,Fix login redirect,open
|
|
91
|
+
42,"Write docs, examples",open
|
|
92
|
+
count: 2 of 2 total
|
|
93
|
+
help[1]: todo-axi view <id>
|
|
94
|
+
|
|
95
|
+
$ todo-axi list --state done
|
|
96
|
+
error: unknown flag --state
|
|
97
|
+
hint: did you mean --status?
|
|
98
|
+
flags[3]: "--status","--fields","--format"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
A complete version lives in [examples/todo_axi](examples/todo_axi).
|
|
102
|
+
|
|
103
|
+
## Learn more
|
|
104
|
+
|
|
105
|
+
- [Quickstart](https://nerd-smith.github.io/fastaxi/quickstart/): a complete small tool, and
|
|
106
|
+
how to run it.
|
|
107
|
+
- [Building AXIs](https://nerd-smith.github.io/fastaxi/building-axis/): return types, output,
|
|
108
|
+
flags, errors and help text.
|
|
109
|
+
- [Connecting to coding agents](https://nerd-smith.github.io/fastaxi/coding-agents/): session
|
|
110
|
+
hooks and Agent Skills for Claude Code, Codex and OpenCode.
|
|
111
|
+
- [Agent-framework tools](https://nerd-smith.github.io/fastaxi/tools/): the same commands as
|
|
112
|
+
PydanticAI, LangChain or OpenAI Agents SDK tools.
|
|
113
|
+
- [API reference](https://nerd-smith.github.io/fastaxi/reference/)
|
|
114
|
+
|
|
115
|
+
## Development
|
|
116
|
+
|
|
117
|
+
See [Development](https://nerd-smith.github.io/fastaxi/development/) for setup, tests and
|
|
118
|
+
conventions. To preview the docs locally:
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
uv run --group docs mkdocs serve
|
|
122
|
+
```
|
fastaxi-0.1.0/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# fastaxi
|
|
2
|
+
|
|
3
|
+
Build [AXI](https://axi.md) (Agent eXperience Interface) command-line tools from typed Python
|
|
4
|
+
functions.
|
|
5
|
+
|
|
6
|
+
**Documentation: [nerd-smith.github.io/fastaxi](https://nerd-smith.github.io/fastaxi/)**
|
|
7
|
+
|
|
8
|
+
AXI is a set of principles for CLIs that AI agents use: compact output, a few fields by
|
|
9
|
+
default, totals and next-step hints, explicit empty states, structured errors and a live home
|
|
10
|
+
view. With fastaxi you write ordinary functions that return Pydantic models, and it takes care
|
|
11
|
+
of all of that. The same commands can also be handed to agent frameworks (PydanticAI,
|
|
12
|
+
LangChain, the OpenAI Agents SDK, ...) as tools.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
uv add fastaxi
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
fastaxi needs Python 3.10 or later.
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from typing import Annotated
|
|
26
|
+
|
|
27
|
+
from pydantic import BaseModel
|
|
28
|
+
|
|
29
|
+
from fastaxi import AXI, Default
|
|
30
|
+
|
|
31
|
+
app = AXI("todo-axi", description="Track todos for the current project")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class Todo(BaseModel):
|
|
35
|
+
id: Annotated[int, Default] # shown in lists by default
|
|
36
|
+
title: Annotated[str, Default]
|
|
37
|
+
status: Annotated[str, Default]
|
|
38
|
+
assignee: str | None = None # available with --fields
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@app.command(name="list", next_steps=["{bin} view <id>"])
|
|
42
|
+
def list_todos(status: str = "open") -> list[Todo]:
|
|
43
|
+
"""List todos.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
status: Filter by status.
|
|
47
|
+
"""
|
|
48
|
+
return db.query(status)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
$ todo-axi list
|
|
53
|
+
id,title,status
|
|
54
|
+
41,Fix login redirect,open
|
|
55
|
+
42,"Write docs, examples",open
|
|
56
|
+
count: 2 of 2 total
|
|
57
|
+
help[1]: todo-axi view <id>
|
|
58
|
+
|
|
59
|
+
$ todo-axi list --state done
|
|
60
|
+
error: unknown flag --state
|
|
61
|
+
hint: did you mean --status?
|
|
62
|
+
flags[3]: "--status","--fields","--format"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
A complete version lives in [examples/todo_axi](examples/todo_axi).
|
|
66
|
+
|
|
67
|
+
## Learn more
|
|
68
|
+
|
|
69
|
+
- [Quickstart](https://nerd-smith.github.io/fastaxi/quickstart/): a complete small tool, and
|
|
70
|
+
how to run it.
|
|
71
|
+
- [Building AXIs](https://nerd-smith.github.io/fastaxi/building-axis/): return types, output,
|
|
72
|
+
flags, errors and help text.
|
|
73
|
+
- [Connecting to coding agents](https://nerd-smith.github.io/fastaxi/coding-agents/): session
|
|
74
|
+
hooks and Agent Skills for Claude Code, Codex and OpenCode.
|
|
75
|
+
- [Agent-framework tools](https://nerd-smith.github.io/fastaxi/tools/): the same commands as
|
|
76
|
+
PydanticAI, LangChain or OpenAI Agents SDK tools.
|
|
77
|
+
- [API reference](https://nerd-smith.github.io/fastaxi/reference/)
|
|
78
|
+
|
|
79
|
+
## Development
|
|
80
|
+
|
|
81
|
+
See [Development](https://nerd-smith.github.io/fastaxi/development/) for setup, tests and
|
|
82
|
+
conventions. To preview the docs locally:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
uv run --group docs mkdocs serve
|
|
86
|
+
```
|