aia 1.0.0.pre.alpha → 1.0.0.pre.beta
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.
- checksums.yaml +4 -4
- data/.version +1 -1
- data/CHANGELOG.md +55 -0
- data/README.md +5 -3
- data/docs/cli-reference.md +0 -10
- data/examples/00_setup_aia.sh +128 -0
- data/examples/01_basic_usage.sh +23 -0
- data/examples/02_frontmatter.sh +33 -0
- data/examples/03_shell_integration.sh +55 -0
- data/examples/04_erb_templating.sh +56 -0
- data/examples/05_shell_then_erb.sh +38 -0
- data/examples/06_prompt_chaining.sh +59 -0
- data/examples/07_pipeline.sh +46 -0
- data/examples/08_context_files.sh +43 -0
- data/examples/09_roles.sh +67 -0
- data/examples/10_stdin_piping.sh +49 -0
- data/examples/11_multi_model.sh +75 -0
- data/examples/12_token_usage.sh +61 -0
- data/examples/13_cost_tracking.sh +68 -0
- data/examples/14_output_file.sh +91 -0
- data/examples/15_parameters.sh +68 -0
- data/examples/16_directives.sh +113 -0
- data/examples/17_require_and_conditionals.sh +68 -0
- data/examples/18_tools.sh +53 -0
- data/examples/19_local_tools.sh +34 -0
- data/examples/20_mcp_servers.sh +102 -0
- data/examples/21_executable_prompts.sh +78 -0
- data/examples/22_chat_mode.sh +227 -0
- data/examples/README.md +161 -86
- data/examples/aia_config.yml +22 -0
- data/examples/aia_config_with_mcp.yml +21 -0
- data/examples/common.sh +20 -0
- data/examples/context/project_goals.md +6 -0
- data/examples/context/tech_stack.md +7 -0
- data/examples/directives/timestamp_directive.rb +22 -0
- data/examples/mcp/filesystem.json +9 -0
- data/examples/prompts_dir/analyze.md +2 -0
- data/examples/prompts_dir/brainstorm.md +2 -0
- data/examples/prompts_dir/conditional.md +17 -0
- data/examples/prompts_dir/creative.md +4 -0
- data/examples/prompts_dir/erbinfo.md +5 -0
- data/examples/prompts_dir/erbinfo_raw.md +8 -0
- data/examples/prompts_dir/evaluate.md +2 -0
- data/examples/prompts_dir/explain_joke.md +1 -0
- data/examples/prompts_dir/explain_recursion.md +1 -0
- data/examples/prompts_dir/fun_fact +3 -0
- data/examples/prompts_dir/greeting.md +8 -0
- data/examples/prompts_dir/greeting_required.md +7 -0
- data/examples/prompts_dir/hello.md +1 -0
- data/examples/prompts_dir/includes/ruby_facts.md +4 -0
- data/examples/prompts_dir/limerick.md +1 -0
- data/examples/prompts_dir/list_with_mcp.md +3 -0
- data/examples/prompts_dir/pick_best.md +2 -0
- data/examples/prompts_dir/project_summary +12 -0
- data/examples/prompts_dir/quiz_with_include.md +6 -0
- data/examples/prompts_dir/require_demo.md +5 -0
- data/examples/prompts_dir/roles/formal.md +3 -0
- data/examples/prompts_dir/roles/pirate.md +3 -0
- data/examples/prompts_dir/shell_then_erb.md +6 -0
- data/examples/prompts_dir/sort_compare.md +2 -0
- data/examples/prompts_dir/summarize_context.md +2 -0
- data/examples/prompts_dir/sysinfo.md +5 -0
- data/examples/prompts_dir/sysinfo_raw.md +8 -0
- data/examples/prompts_dir/tagline.md +1 -0
- data/examples/prompts_dir/tell_joke.md +1 -0
- data/examples/prompts_dir/tell_joke_with_next.md +4 -0
- data/examples/prompts_dir/use_local_tool.md +8 -0
- data/examples/prompts_dir/use_tools.md +8 -0
- data/examples/prompts_dir/weather.md +2 -0
- data/examples/prompts_dir/whats_new.md +2 -0
- data/examples/prompts_dir/with_timestamp.md +5 -0
- data/examples/tools/word_count_tool.rb +30 -0
- data/lib/aia/adapter/chat_execution.rb +240 -0
- data/lib/aia/adapter/error_handler.rb +68 -0
- data/lib/aia/adapter/gem_activator.rb +57 -0
- data/lib/aia/adapter/mcp_connector.rb +303 -0
- data/lib/aia/adapter/modality_handlers.rb +159 -0
- data/lib/aia/adapter/model_registry.rb +81 -0
- data/lib/aia/adapter/multi_model_chat.rb +218 -0
- data/lib/aia/adapter/provider_configurator.rb +59 -0
- data/lib/aia/adapter/tool_filter.rb +64 -0
- data/lib/aia/adapter/tool_loader.rb +98 -0
- data/lib/aia/config/cli_parser.rb +0 -3
- data/lib/aia/config/validator.rb +3 -50
- data/lib/aia/config.rb +116 -16
- data/lib/aia/directives/execution_directives.rb +3 -14
- data/lib/aia/directives/utility_directives.rb +0 -23
- data/lib/aia/directives/web_and_file_directives.rb +12 -3
- data/lib/aia/prompt_handler.rb +10 -0
- data/lib/aia/ruby_llm_adapter.rb +27 -1343
- data/lib/aia/session.rb +22 -14
- data/lib/aia/ui_presenter.rb +8 -17
- metadata +80 -26
- data/examples/directives/ask.rb +0 -21
- data/examples/headlines +0 -30
- data/examples/tools/edit_file.rb +0 -28
- data/examples/tools/incomplete/calculator_tool.rb +0 -70
- data/examples/tools/incomplete/composite_analysis_tool.rb +0 -89
- data/examples/tools/incomplete/data_science_kit.rb +0 -128
- data/examples/tools/incomplete/database_query_tool.rb +0 -100
- data/examples/tools/incomplete/devops_toolkit.rb +0 -112
- data/examples/tools/incomplete/error_handling_tool.rb +0 -109
- data/examples/tools/incomplete/pdf_page_reader.rb +0 -32
- data/examples/tools/incomplete/secure_tool_template.rb +0 -117
- data/examples/tools/incomplete/weather_tool.rb +0 -110
- data/examples/tools/incomplete/workflow_manager_tool.rb +0 -145
- data/examples/tools/list_files.rb +0 -20
- data/examples/tools/mcp/README.md +0 -1
- data/examples/tools/mcp/github_mcp_server.json +0 -11
- data/examples/tools/mcp/github_mcp_server.rb +0 -41
- data/examples/tools/mcp/imcp.json +0 -7
- data/examples/tools/mcp/imcp.rb +0 -15
- data/examples/tools/read_file.rb +0 -18
- data/examples/tools/run_shell_command.rb +0 -35
- data/lib/aia/topic_context.rb +0 -125
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '068690ce0bebc601d0867f4dc98778a6fc1335d41dc742f483b2d1b911118051'
|
|
4
|
+
data.tar.gz: 9dfcb29be5b606fa29176e29105dde5a9f25f35c671b155ec8a35dd0ece8bd95
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 179f47094d2c80f04d7d649122bd11492e12924bdf8f955873de67ffa4fe08047b655ac1e63e9024fe21eb807c6d500d724f15ef66b45b6d9ac3aa88cd1a405e
|
|
7
|
+
data.tar.gz: 46da1ec94f9a19b358868c3b148699b0158427b0d2b63d9a81fd9507a64868542823a2be9c0b4c5be6a17bff4a8f87f413714a67433d544b1931403eb2accd56
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.0-
|
|
1
|
+
1.0.0-beta
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,59 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
## [1.0.0-beta] - 2026-02-10
|
|
3
|
+
|
|
4
|
+
### Breaking Changes
|
|
5
|
+
- **Removed `--exec` / `-x` CLI Option**: Shebang auto-detection fully replaces the legacy `--exec` flag
|
|
6
|
+
- Prompt files with `#!/usr/bin/env aia ...` on the first line are auto-detected and processed as executable prompts
|
|
7
|
+
- Removed `executable_prompt` and `executable_prompt_file` config attributes
|
|
8
|
+
- Removed legacy code path in validator and session
|
|
9
|
+
- **Removed deprecated `next` and `pipeline` directives**: These utility directive methods have been removed
|
|
10
|
+
- `next` and `pipeline` are now handled exclusively via CLI flags and front matter
|
|
11
|
+
- Removed `next` and `next=` methods from `AIA::Config`
|
|
12
|
+
- **Upgraded to prompt_manager gem v1.0.2**: Directive system now uses PM::Directive base class hierarchy
|
|
13
|
+
- AIA directives inherit from `AIA::Directive < PM::Directive`
|
|
14
|
+
- Directive registration uses centralized `PM::Directive.directive_subclasses`
|
|
15
|
+
|
|
16
|
+
### New Features
|
|
17
|
+
- **`/skill` and `/skills` Directives**: Access Claude Code skills from within AIA
|
|
18
|
+
- `/skills` lists all available skills from `~/.claude/skills/`
|
|
19
|
+
- `/skill <name>` includes a specific skill's context into the conversation
|
|
20
|
+
- **`model` Accessor on RubyLLMAdapter**: Added `model` method for programmatic access to the current model
|
|
21
|
+
- **Comprehensive Examples Directory**: 23 progressive demo scripts (00–22) covering all AIA features
|
|
22
|
+
- Demos 00–05: Setup, basic usage, front matter, shell integration, ERB, shell+ERB
|
|
23
|
+
- Demos 06–07: Prompt chaining and pipelines
|
|
24
|
+
- Demos 08–10: Context files, roles, STDIN piping
|
|
25
|
+
- Demos 11–13: Multi-model comparison, token usage, cost tracking
|
|
26
|
+
- Demos 14–15: Output files and prompt parameters
|
|
27
|
+
- Demo 16: Directives (built-in `include` and custom directive creation)
|
|
28
|
+
- Demos 17–20: Require/conditionals, tools, local tools, MCP servers
|
|
29
|
+
- Demo 21: Executable prompts (shebang auto-detection, frontmatter+ERB, STDIN piping)
|
|
30
|
+
- Demo 22: Interactive chat mode (pure chat, prompt+chat, pipeline+chat, directives, live session)
|
|
31
|
+
- All demos use isolated `aia_config.yml` via `-c` flag for reproducible runs
|
|
32
|
+
- `common.sh` clears all `AIA_*` environment variables to prevent leakage
|
|
33
|
+
|
|
34
|
+
### Improvements
|
|
35
|
+
- **Directive Processor Refactoring**: Simplified directive detection and prefix handling
|
|
36
|
+
- Improved directive prefix and method name validation
|
|
37
|
+
- Streamlined directive processing logic
|
|
38
|
+
- **Enhanced Prompt Handler**: Added pipeline override logging and logger method
|
|
39
|
+
- **Error Handling Module**: Added `lib/aia/errors.rb` for centralized exception management
|
|
40
|
+
- **Test Coverage Improvements**: Added SimpleCov prelude, CLI parser tests, and enhanced Ollama adapter tests
|
|
41
|
+
|
|
42
|
+
### Documentation
|
|
43
|
+
- **Examples README**: Comprehensive guide with prerequisites, API key configuration, and per-demo documentation links to https://madbomber.github.io/aia/
|
|
44
|
+
- **Main README**: Added examples directory reference in "Examples & Tips" section; rewrote executable prompts section for shebang auto-detection
|
|
45
|
+
- **CLI Reference**: Removed `--exec` section; updated executable prompt documentation
|
|
46
|
+
- **Directives Reference**: Added `/skill` and `/skills` directive documentation
|
|
47
|
+
- **Model Directive**: Updated with detailed usage examples
|
|
48
|
+
|
|
49
|
+
### Technical Changes
|
|
50
|
+
- Bumped version from 0.11.1 to 1.0.0-beta
|
|
51
|
+
- Updated prompt_manager dependency to v1.0.2
|
|
52
|
+
- Updated json gem to 2.18.1
|
|
53
|
+
- Simplified directive registry (`lib/aia/directives/registry.rb`)
|
|
54
|
+
- Enhanced PromptHandler with expanded prompt processing logic (326+ lines added)
|
|
55
|
+
- Added `lib/aia/errors.rb` error handling module
|
|
56
|
+
|
|
2
57
|
## [0.11.1] - 2026-02-03
|
|
3
58
|
|
|
4
59
|
### New Features
|
data/README.md
CHANGED
|
@@ -1210,6 +1210,8 @@ The above examples show the shared_tools being used within an interactive chat s
|
|
|
1210
1210
|
|
|
1211
1211
|
## Examples & Tips
|
|
1212
1212
|
|
|
1213
|
+
For a hands-on introduction, see the [examples/](examples/) directory. It contains 20 progressive demo scripts that walk through AIA's batch mode features — from basic prompts through pipelines, multi-model comparison, tools, and MCP servers. Each script is self-contained and runnable with a local Ollama model.
|
|
1214
|
+
|
|
1213
1215
|
### Practical Examples
|
|
1214
1216
|
|
|
1215
1217
|
#### Code Review Prompt
|
|
@@ -1276,15 +1278,15 @@ aia --chat -m gpt-4o-mini,gpt-3.5-turbo --consensus
|
|
|
1276
1278
|
|
|
1277
1279
|
### Executable Prompts
|
|
1278
1280
|
|
|
1279
|
-
|
|
1281
|
+
AIA auto-detects executable prompts by their shebang line (`#!`). Just add a shebang, make the file executable with `chmod +x`, and run it directly. No special flag is needed.
|
|
1280
1282
|
|
|
1281
|
-
|
|
1283
|
+
The option `--no-output` directs the output from the LLM to STDOUT so executable prompts can be good citizens on the *nix command line, receiving piped input via STDIN and sending output to STDOUT.
|
|
1282
1284
|
|
|
1283
1285
|
Create executable prompts:
|
|
1284
1286
|
|
|
1285
1287
|
**weather_report** (make executable with `chmod +x`):
|
|
1286
1288
|
```bash
|
|
1287
|
-
#!/usr/bin/env aia run --no-output
|
|
1289
|
+
#!/usr/bin/env aia run --no-output
|
|
1288
1290
|
# Get current storm activity for the east and south coast of the US
|
|
1289
1291
|
|
|
1290
1292
|
Summarize the tropical storm outlook fpr the Atlantic, Caribbean Sea and Gulf of America.
|
data/docs/cli-reference.md
CHANGED
|
@@ -397,16 +397,6 @@ aia --pipeline "analysis,summary,report" my_data
|
|
|
397
397
|
aia -p "review,optimize,test" my_code.py
|
|
398
398
|
```
|
|
399
399
|
|
|
400
|
-
### `-x, --[no-]exec`
|
|
401
|
-
Designate an executable prompt file.
|
|
402
|
-
|
|
403
|
-
```bash
|
|
404
|
-
# Treat prompt as executable
|
|
405
|
-
aia --exec my_script_prompt
|
|
406
|
-
|
|
407
|
-
# Treat as regular prompt (default)
|
|
408
|
-
aia --no-exec my_script_prompt
|
|
409
|
-
```
|
|
410
400
|
|
|
411
401
|
### `--system-prompt PROMPT_ID`
|
|
412
402
|
System prompt ID to use for chat sessions.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# examples/00_setup_aia.sh
|
|
3
|
+
#
|
|
4
|
+
# Sets up the environment for running AIA example demos.
|
|
5
|
+
# Run this script first before any other example script.
|
|
6
|
+
#
|
|
7
|
+
# What it does:
|
|
8
|
+
# 1. Verifies aia is installed
|
|
9
|
+
# 2. Verifies ollama is installed and running
|
|
10
|
+
# 3. Pulls the qwen3 model (good tool-calling support)
|
|
11
|
+
# 4. Verifies examples/prompts_dir exists
|
|
12
|
+
# 5. Writes examples/aia_config.yml for use with -c flag
|
|
13
|
+
#
|
|
14
|
+
# Each demo script sources common.sh which clears AIA_* env vars
|
|
15
|
+
# and sets CONFIG=aia_config.yml for clean, isolated runs.
|
|
16
|
+
#
|
|
17
|
+
# Usage:
|
|
18
|
+
# cd examples
|
|
19
|
+
# bash 00_setup_aia.sh
|
|
20
|
+
|
|
21
|
+
set -euo pipefail
|
|
22
|
+
|
|
23
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
24
|
+
PROMPTS_DIR="${SCRIPT_DIR}/prompts_dir"
|
|
25
|
+
CONFIG_FILE="${SCRIPT_DIR}/aia_config.yml"
|
|
26
|
+
|
|
27
|
+
# The model to use for demos. qwen3 is Ollama's reference model
|
|
28
|
+
# for tool calling and has strong instruction-following ability.
|
|
29
|
+
DEMO_MODEL="qwen3"
|
|
30
|
+
|
|
31
|
+
echo "=== AIA Examples Setup ==="
|
|
32
|
+
echo
|
|
33
|
+
|
|
34
|
+
# --- Step 1: Check that aia is installed ---
|
|
35
|
+
|
|
36
|
+
if ! command -v aia &> /dev/null; then
|
|
37
|
+
echo "ERROR: 'aia' is not installed."
|
|
38
|
+
echo " Install with: gem install aia"
|
|
39
|
+
exit 1
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
AIA_VERSION=$(aia --version 2>/dev/null || echo "unknown")
|
|
43
|
+
echo "[ok] aia is installed (v${AIA_VERSION})"
|
|
44
|
+
|
|
45
|
+
# --- Step 2: Check that ollama is installed and running ---
|
|
46
|
+
|
|
47
|
+
if ! command -v ollama &> /dev/null; then
|
|
48
|
+
echo "ERROR: 'ollama' is not installed."
|
|
49
|
+
echo " Install from: https://ollama.com"
|
|
50
|
+
echo " macOS: brew install ollama"
|
|
51
|
+
exit 1
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
echo "[ok] ollama is installed"
|
|
55
|
+
|
|
56
|
+
# Check if ollama is serving
|
|
57
|
+
OLLAMA_BASE="${OLLAMA_API_BASE:-http://localhost:11434}"
|
|
58
|
+
|
|
59
|
+
if ! curl -s "${OLLAMA_BASE}/api/tags" > /dev/null 2>&1; then
|
|
60
|
+
echo "WARNING: ollama does not appear to be running."
|
|
61
|
+
echo " Start it with: ollama serve"
|
|
62
|
+
echo " Then re-run this script."
|
|
63
|
+
exit 1
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
echo "[ok] ollama is running at ${OLLAMA_BASE}"
|
|
67
|
+
|
|
68
|
+
# --- Step 3: Pull the demo model ---
|
|
69
|
+
|
|
70
|
+
echo
|
|
71
|
+
echo "Checking for model: ${DEMO_MODEL} ..."
|
|
72
|
+
|
|
73
|
+
if ollama list 2>/dev/null | grep -q "^${DEMO_MODEL}"; then
|
|
74
|
+
echo "[ok] ${DEMO_MODEL} is already available"
|
|
75
|
+
else
|
|
76
|
+
echo "Pulling ${DEMO_MODEL} (this may take a few minutes on first run) ..."
|
|
77
|
+
ollama pull "${DEMO_MODEL}"
|
|
78
|
+
echo "[ok] ${DEMO_MODEL} pulled successfully"
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
# --- Step 4: Verify prompts directory ---
|
|
82
|
+
|
|
83
|
+
echo
|
|
84
|
+
if [ -d "${PROMPTS_DIR}" ]; then
|
|
85
|
+
echo "[ok] prompts_dir exists at ${PROMPTS_DIR}"
|
|
86
|
+
else
|
|
87
|
+
mkdir -p "${PROMPTS_DIR}"
|
|
88
|
+
echo "[ok] created prompts_dir at ${PROMPTS_DIR}"
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
# --- Step 5: Write the config file ---
|
|
92
|
+
|
|
93
|
+
cat > "${CONFIG_FILE}" <<EOF
|
|
94
|
+
# AIA configuration for example demos
|
|
95
|
+
# Used by all demo scripts via: aia -c aia_config.yml ...
|
|
96
|
+
#
|
|
97
|
+
# This file is loaded with the -c / --config-file flag.
|
|
98
|
+
# It replaces the user's personal config (~/.config/aia/aia.yml),
|
|
99
|
+
# starting from bundled defaults + these values only.
|
|
100
|
+
# CLI flags passed directly to aia still take precedence.
|
|
101
|
+
#
|
|
102
|
+
# NOTE: Relative paths resolve against the directory where aia is invoked.
|
|
103
|
+
# Run demo scripts from the examples/ directory.
|
|
104
|
+
|
|
105
|
+
prompts:
|
|
106
|
+
dir: ./prompts_dir
|
|
107
|
+
|
|
108
|
+
models:
|
|
109
|
+
- name: ollama/${DEMO_MODEL}
|
|
110
|
+
|
|
111
|
+
output:
|
|
112
|
+
file: ~
|
|
113
|
+
|
|
114
|
+
flags:
|
|
115
|
+
chat: false
|
|
116
|
+
EOF
|
|
117
|
+
|
|
118
|
+
echo "[ok] wrote ${CONFIG_FILE}"
|
|
119
|
+
|
|
120
|
+
# --- Done ---
|
|
121
|
+
|
|
122
|
+
echo
|
|
123
|
+
echo "=== Setup Complete ==="
|
|
124
|
+
echo
|
|
125
|
+
echo "All demo scripts use:"
|
|
126
|
+
echo " aia -c aia_config.yml ..."
|
|
127
|
+
echo " Model: ollama/${DEMO_MODEL}"
|
|
128
|
+
echo " Prompts dir: ${PROMPTS_DIR}"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# examples/01_basic_usage.sh
|
|
3
|
+
#
|
|
4
|
+
# Demonstrates the simplest use of aia: sending a prompt to a model
|
|
5
|
+
# and printing the response.
|
|
6
|
+
#
|
|
7
|
+
# Prerequisites: Run 00_setup_aia.sh first.
|
|
8
|
+
# Usage: cd examples && bash 01_basic_usage.sh
|
|
9
|
+
|
|
10
|
+
set -euo pipefail
|
|
11
|
+
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
|
12
|
+
|
|
13
|
+
echo "=== Demo 01: Basic Usage ==="
|
|
14
|
+
echo
|
|
15
|
+
echo "The prompt file prompts_dir/hello.md contains:"
|
|
16
|
+
echo "==="
|
|
17
|
+
cat prompts_dir/hello.md
|
|
18
|
+
echo "==="
|
|
19
|
+
echo
|
|
20
|
+
echo "Running: aia -c ${CONFIG} --no-output hello"
|
|
21
|
+
echo
|
|
22
|
+
|
|
23
|
+
aia -c "${CONFIG}" --no-output hello
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# examples/02_frontmatter.sh
|
|
3
|
+
#
|
|
4
|
+
# Demonstrates YAML front matter in prompt files.
|
|
5
|
+
# Front matter lets you embed configuration directly in the prompt,
|
|
6
|
+
# such as temperature, model, top_p, and more.
|
|
7
|
+
#
|
|
8
|
+
# Prerequisites: Run 00_setup_aia.sh first.
|
|
9
|
+
# Usage: cd examples && bash 02_frontmatter.sh
|
|
10
|
+
|
|
11
|
+
set -euo pipefail
|
|
12
|
+
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
|
13
|
+
|
|
14
|
+
echo "=== Demo 02: YAML Front Matter ==="
|
|
15
|
+
echo
|
|
16
|
+
echo "Prompt files can include a YAML front matter block between"
|
|
17
|
+
echo "--- delimiters. AIA applies these settings before sending"
|
|
18
|
+
echo "the prompt to the model."
|
|
19
|
+
echo
|
|
20
|
+
echo "Supported root-level shorthands:"
|
|
21
|
+
echo " model, temperature, top_p, next, pipeline, shell, erb"
|
|
22
|
+
echo
|
|
23
|
+
echo "The prompt file prompts_dir/creative.md contains:"
|
|
24
|
+
echo "==="
|
|
25
|
+
cat prompts_dir/creative.md
|
|
26
|
+
echo "==="
|
|
27
|
+
echo
|
|
28
|
+
echo "The 'temperature: 0.9' setting makes the response more creative."
|
|
29
|
+
echo
|
|
30
|
+
echo "Running: aia -c ${CONFIG} --no-output creative"
|
|
31
|
+
echo
|
|
32
|
+
|
|
33
|
+
aia -c "${CONFIG}" --no-output creative
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# examples/03_shell_integration.sh
|
|
3
|
+
#
|
|
4
|
+
# Demonstrates shell integration in prompts.
|
|
5
|
+
# By default, $(command) is executed and replaced with its output
|
|
6
|
+
# before the prompt is sent to the model. You can disable this
|
|
7
|
+
# with 'shell: false' in the YAML front matter.
|
|
8
|
+
#
|
|
9
|
+
# Prerequisites: Run 00_setup_aia.sh first.
|
|
10
|
+
# Usage: cd examples && bash 03_shell_integration.sh
|
|
11
|
+
|
|
12
|
+
set -euo pipefail
|
|
13
|
+
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
|
14
|
+
|
|
15
|
+
echo "=== Demo 03: Shell Integration ==="
|
|
16
|
+
echo
|
|
17
|
+
echo "AIA expands \$(command) and \$ENVAR in prompts before sending"
|
|
18
|
+
echo "them to the model. This lets prompts include live system data."
|
|
19
|
+
echo
|
|
20
|
+
|
|
21
|
+
# --- Part 1: shell expansion ON (default) ---
|
|
22
|
+
|
|
23
|
+
echo "--- Part 1: Shell expansion ON (default) ---"
|
|
24
|
+
echo
|
|
25
|
+
echo "The prompt file prompts_dir/sysinfo.md contains:"
|
|
26
|
+
echo "==="
|
|
27
|
+
cat prompts_dir/sysinfo.md
|
|
28
|
+
echo "==="
|
|
29
|
+
echo
|
|
30
|
+
echo "The \$(command) references will be replaced with real values."
|
|
31
|
+
echo
|
|
32
|
+
echo "Running: aia -c ${CONFIG} --no-output sysinfo"
|
|
33
|
+
echo
|
|
34
|
+
|
|
35
|
+
aia -c "${CONFIG}" --no-output sysinfo
|
|
36
|
+
|
|
37
|
+
echo
|
|
38
|
+
echo
|
|
39
|
+
|
|
40
|
+
# --- Part 2: shell expansion OFF via front matter ---
|
|
41
|
+
|
|
42
|
+
echo "--- Part 2: Shell expansion OFF (shell: false) ---"
|
|
43
|
+
echo
|
|
44
|
+
echo "The prompt file prompts_dir/sysinfo_raw.md contains:"
|
|
45
|
+
echo "==="
|
|
46
|
+
cat prompts_dir/sysinfo_raw.md
|
|
47
|
+
echo "==="
|
|
48
|
+
echo
|
|
49
|
+
echo "With 'shell: false' in the front matter, the \$(command)"
|
|
50
|
+
echo "references are sent to the model as literal text."
|
|
51
|
+
echo
|
|
52
|
+
echo "Running: aia -c ${CONFIG} --no-output sysinfo_raw"
|
|
53
|
+
echo
|
|
54
|
+
|
|
55
|
+
aia -c "${CONFIG}" --no-output sysinfo_raw
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# examples/04_erb_templating.sh
|
|
3
|
+
#
|
|
4
|
+
# Demonstrates ERB templating in prompts.
|
|
5
|
+
# By default, <%= expression %> is evaluated as Ruby and replaced
|
|
6
|
+
# with the result before the prompt is sent to the model. You can
|
|
7
|
+
# disable this with 'erb: false' in the YAML front matter.
|
|
8
|
+
#
|
|
9
|
+
# Prerequisites: Run 00_setup_aia.sh first.
|
|
10
|
+
# Usage: cd examples && bash 04_erb_templating.sh
|
|
11
|
+
|
|
12
|
+
set -euo pipefail
|
|
13
|
+
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
|
14
|
+
|
|
15
|
+
echo "=== Demo 04: ERB Templating ==="
|
|
16
|
+
echo
|
|
17
|
+
echo "AIA processes <%= expression %> tags as Ruby (ERB) before"
|
|
18
|
+
echo "sending prompts to the model. This gives prompts access to"
|
|
19
|
+
echo "the full Ruby language."
|
|
20
|
+
echo
|
|
21
|
+
|
|
22
|
+
# --- Part 1: ERB processing ON (default) ---
|
|
23
|
+
|
|
24
|
+
echo "--- Part 1: ERB processing ON (default) ---"
|
|
25
|
+
echo
|
|
26
|
+
echo "The prompt file prompts_dir/erbinfo.md contains:"
|
|
27
|
+
echo "==="
|
|
28
|
+
cat prompts_dir/erbinfo.md
|
|
29
|
+
echo "==="
|
|
30
|
+
echo
|
|
31
|
+
echo "The <%= %> tags will be evaluated and replaced with real values."
|
|
32
|
+
echo
|
|
33
|
+
echo "Running: aia -c ${CONFIG} --no-output erbinfo"
|
|
34
|
+
echo
|
|
35
|
+
|
|
36
|
+
aia -c "${CONFIG}" --no-output erbinfo
|
|
37
|
+
|
|
38
|
+
echo
|
|
39
|
+
echo
|
|
40
|
+
|
|
41
|
+
# --- Part 2: ERB processing OFF via front matter ---
|
|
42
|
+
|
|
43
|
+
echo "--- Part 2: ERB processing OFF (erb: false) ---"
|
|
44
|
+
echo
|
|
45
|
+
echo "The prompt file prompts_dir/erbinfo_raw.md contains:"
|
|
46
|
+
echo "==="
|
|
47
|
+
cat prompts_dir/erbinfo_raw.md
|
|
48
|
+
echo "==="
|
|
49
|
+
echo
|
|
50
|
+
echo "With 'erb: false' in the front matter, the <%= %> tags"
|
|
51
|
+
echo "are sent to the model as literal text."
|
|
52
|
+
echo
|
|
53
|
+
echo "Running: aia -c ${CONFIG} --no-output erbinfo_raw"
|
|
54
|
+
echo
|
|
55
|
+
|
|
56
|
+
aia -c "${CONFIG}" --no-output erbinfo_raw
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# examples/05_shell_then_erb.sh
|
|
3
|
+
#
|
|
4
|
+
# Demonstrates that shell expansion runs BEFORE ERB processing.
|
|
5
|
+
# This means $(command) and $ENVAR are replaced with their values
|
|
6
|
+
# first, and then ERB evaluates the result as Ruby.
|
|
7
|
+
#
|
|
8
|
+
# This ordering lets you use shell output inside Ruby expressions.
|
|
9
|
+
#
|
|
10
|
+
# Prerequisites: Run 00_setup_aia.sh first.
|
|
11
|
+
# Usage: cd examples && bash 05_shell_then_erb.sh
|
|
12
|
+
|
|
13
|
+
set -euo pipefail
|
|
14
|
+
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
|
15
|
+
|
|
16
|
+
echo "=== Demo 05: Shell Runs Before ERB ==="
|
|
17
|
+
echo
|
|
18
|
+
echo "AIA processes prompts in this order:"
|
|
19
|
+
echo " 1. Shell: \$(command) and \$ENVAR are expanded"
|
|
20
|
+
echo " 2. ERB: <%= expression %> is evaluated as Ruby"
|
|
21
|
+
echo
|
|
22
|
+
echo "This means shell output becomes part of the Ruby expression"
|
|
23
|
+
echo "that ERB then evaluates."
|
|
24
|
+
echo
|
|
25
|
+
echo "The prompt file prompts_dir/shell_then_erb.md contains:"
|
|
26
|
+
echo "==="
|
|
27
|
+
cat prompts_dir/shell_then_erb.md
|
|
28
|
+
echo "==="
|
|
29
|
+
echo
|
|
30
|
+
echo "For example:"
|
|
31
|
+
echo " <%= \"\$(uname -s)\".downcase %>"
|
|
32
|
+
echo " Step 1 (shell): <%= \"Darwin\".downcase %>"
|
|
33
|
+
echo " Step 2 (ERB): darwin"
|
|
34
|
+
echo
|
|
35
|
+
echo "Running: aia -c ${CONFIG} --no-output shell_then_erb"
|
|
36
|
+
echo
|
|
37
|
+
|
|
38
|
+
aia -c "${CONFIG}" --no-output shell_then_erb
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# examples/06_prompt_chaining.sh
|
|
3
|
+
#
|
|
4
|
+
# Demonstrates prompt chaining with --next and the 'next:' front
|
|
5
|
+
# matter key. The first prompt's response becomes context for
|
|
6
|
+
# the second prompt.
|
|
7
|
+
#
|
|
8
|
+
# Prerequisites: Run 00_setup_aia.sh first.
|
|
9
|
+
# Usage: cd examples && bash 06_prompt_chaining.sh
|
|
10
|
+
|
|
11
|
+
set -euo pipefail
|
|
12
|
+
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
|
13
|
+
|
|
14
|
+
echo "=== Demo 06: Prompt Chaining ==="
|
|
15
|
+
echo
|
|
16
|
+
echo "AIA can chain prompts so the output of the first becomes"
|
|
17
|
+
echo "context for the second. Two ways to do this:"
|
|
18
|
+
echo " 1. CLI: --next prompt_id"
|
|
19
|
+
echo " 2. Front matter: next: prompt_id"
|
|
20
|
+
echo
|
|
21
|
+
|
|
22
|
+
# --- Part 1: --next via CLI ---
|
|
23
|
+
|
|
24
|
+
echo "--- Part 1: Chaining with --next CLI flag ---"
|
|
25
|
+
echo
|
|
26
|
+
echo "The prompt file prompts_dir/tell_joke.md contains:"
|
|
27
|
+
echo "==="
|
|
28
|
+
cat prompts_dir/tell_joke.md
|
|
29
|
+
echo "==="
|
|
30
|
+
echo
|
|
31
|
+
echo "The prompt file prompts_dir/explain_joke.md contains:"
|
|
32
|
+
echo "==="
|
|
33
|
+
cat prompts_dir/explain_joke.md
|
|
34
|
+
echo "==="
|
|
35
|
+
echo
|
|
36
|
+
echo "Running: aia -c ${CONFIG} --no-output --next explain_joke tell_joke"
|
|
37
|
+
echo
|
|
38
|
+
|
|
39
|
+
aia -c "${CONFIG}" --no-output --next explain_joke tell_joke
|
|
40
|
+
|
|
41
|
+
echo
|
|
42
|
+
echo
|
|
43
|
+
|
|
44
|
+
# --- Part 2: next: in front matter ---
|
|
45
|
+
|
|
46
|
+
echo "--- Part 2: Chaining with 'next:' in front matter ---"
|
|
47
|
+
echo
|
|
48
|
+
echo "The prompt file prompts_dir/tell_joke_with_next.md contains:"
|
|
49
|
+
echo "==="
|
|
50
|
+
cat prompts_dir/tell_joke_with_next.md
|
|
51
|
+
echo "==="
|
|
52
|
+
echo
|
|
53
|
+
echo "The 'next: explain_joke' front matter does the same thing"
|
|
54
|
+
echo "as --next but is embedded in the prompt file itself."
|
|
55
|
+
echo
|
|
56
|
+
echo "Running: aia -c ${CONFIG} --no-output tell_joke_with_next"
|
|
57
|
+
echo
|
|
58
|
+
|
|
59
|
+
aia -c "${CONFIG}" --no-output tell_joke_with_next
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# examples/07_pipeline.sh
|
|
3
|
+
#
|
|
4
|
+
# Demonstrates a prompt pipeline — a sequence of prompts where
|
|
5
|
+
# each step's response becomes context for the next.
|
|
6
|
+
#
|
|
7
|
+
# The --pipeline flag accepts comma-separated prompt IDs.
|
|
8
|
+
# The first prompt ID is the main argument; the rest go in --pipeline.
|
|
9
|
+
#
|
|
10
|
+
# NOTE: The same chain could be embedded in the first prompt's
|
|
11
|
+
# front matter instead:
|
|
12
|
+
# ---
|
|
13
|
+
# pipeline: evaluate, pick_best, tagline
|
|
14
|
+
# ---
|
|
15
|
+
#
|
|
16
|
+
# Prerequisites: Run 00_setup_aia.sh first.
|
|
17
|
+
# Usage: cd examples && bash 07_pipeline.sh
|
|
18
|
+
|
|
19
|
+
set -euo pipefail
|
|
20
|
+
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
|
21
|
+
|
|
22
|
+
echo "=== Demo 07: Prompt Pipeline ==="
|
|
23
|
+
echo
|
|
24
|
+
echo "A pipeline chains multiple prompts in sequence. Each prompt's"
|
|
25
|
+
echo "response becomes context for the next. This is useful for"
|
|
26
|
+
echo "multi-step reasoning and refinement workflows."
|
|
27
|
+
echo
|
|
28
|
+
echo "This demo runs a 4-step pipeline:"
|
|
29
|
+
echo " 1. brainstorm — generate five gem names"
|
|
30
|
+
echo " 2. evaluate — rate each name 1-5"
|
|
31
|
+
echo " 3. pick_best — choose the winner"
|
|
32
|
+
echo " 4. tagline — write a tagline for it"
|
|
33
|
+
echo
|
|
34
|
+
|
|
35
|
+
echo "The prompt files:"
|
|
36
|
+
echo
|
|
37
|
+
for p in brainstorm evaluate pick_best tagline; do
|
|
38
|
+
echo "--- prompts_dir/${p}.md ---"
|
|
39
|
+
cat "prompts_dir/${p}.md"
|
|
40
|
+
done
|
|
41
|
+
echo
|
|
42
|
+
|
|
43
|
+
echo "Running: aia -c ${CONFIG} --no-output --pipeline evaluate,pick_best,tagline brainstorm"
|
|
44
|
+
echo
|
|
45
|
+
|
|
46
|
+
aia -c "${CONFIG}" --no-output --pipeline evaluate,pick_best,tagline brainstorm
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# examples/08_context_files.sh
|
|
3
|
+
#
|
|
4
|
+
# Demonstrates the --context-files option, which attaches the
|
|
5
|
+
# contents of one or more files to the prompt so the model can
|
|
6
|
+
# reference them in its response.
|
|
7
|
+
#
|
|
8
|
+
# Context files are listed as positional arguments after the
|
|
9
|
+
# prompt ID:
|
|
10
|
+
# aia PROMPT_ID FILE1 FILE2 ...
|
|
11
|
+
#
|
|
12
|
+
# Prerequisites: Run 00_setup_aia.sh first.
|
|
13
|
+
# Usage: cd examples && bash 08_context_files.sh
|
|
14
|
+
|
|
15
|
+
set -euo pipefail
|
|
16
|
+
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
|
17
|
+
|
|
18
|
+
echo "=== Demo 08: Context Files ==="
|
|
19
|
+
echo
|
|
20
|
+
echo "Context files let you attach file contents to a prompt so"
|
|
21
|
+
echo "the model can read and reference them. List the files after"
|
|
22
|
+
echo "the prompt ID on the command line."
|
|
23
|
+
echo
|
|
24
|
+
|
|
25
|
+
echo "The prompt file prompts_dir/summarize_context.md contains:"
|
|
26
|
+
echo "==="
|
|
27
|
+
cat prompts_dir/summarize_context.md
|
|
28
|
+
echo "==="
|
|
29
|
+
echo
|
|
30
|
+
|
|
31
|
+
echo "We will attach two context files:"
|
|
32
|
+
echo
|
|
33
|
+
echo "--- context/project_goals.md ---"
|
|
34
|
+
cat context/project_goals.md
|
|
35
|
+
echo
|
|
36
|
+
echo "--- context/tech_stack.md ---"
|
|
37
|
+
cat context/tech_stack.md
|
|
38
|
+
echo
|
|
39
|
+
|
|
40
|
+
echo "Running: aia -c ${CONFIG} --no-output summarize_context context/project_goals.md context/tech_stack.md"
|
|
41
|
+
echo
|
|
42
|
+
|
|
43
|
+
aia -c "${CONFIG}" --no-output summarize_context context/project_goals.md context/tech_stack.md
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# examples/09_roles.sh
|
|
3
|
+
#
|
|
4
|
+
# Demonstrates the --role option, which prepends a role prompt
|
|
5
|
+
# to the main prompt. Roles live as .md files in the roles/
|
|
6
|
+
# subdirectory under the prompts directory.
|
|
7
|
+
#
|
|
8
|
+
# Prerequisites: Run 00_setup_aia.sh first.
|
|
9
|
+
# Usage: cd examples && bash 09_roles.sh
|
|
10
|
+
|
|
11
|
+
set -euo pipefail
|
|
12
|
+
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
|
13
|
+
|
|
14
|
+
echo "=== Demo 09: Roles ==="
|
|
15
|
+
echo
|
|
16
|
+
echo "Roles are reusable system prompts stored as .md files in"
|
|
17
|
+
echo "the roles/ subdirectory of your prompts directory. Use"
|
|
18
|
+
echo "--role ROLE_ID to prepend a role to any prompt."
|
|
19
|
+
echo
|
|
20
|
+
|
|
21
|
+
echo "The prompt file prompts_dir/weather.md contains:"
|
|
22
|
+
echo "==="
|
|
23
|
+
cat prompts_dir/weather.md
|
|
24
|
+
echo "==="
|
|
25
|
+
echo
|
|
26
|
+
|
|
27
|
+
echo "Available roles:"
|
|
28
|
+
echo
|
|
29
|
+
for role in prompts_dir/roles/*.md; do
|
|
30
|
+
name=$(basename "$role" .md)
|
|
31
|
+
echo "--- roles/${name}.md ---"
|
|
32
|
+
cat "$role"
|
|
33
|
+
done
|
|
34
|
+
echo
|
|
35
|
+
|
|
36
|
+
# --- Part 1: No role (baseline) ---
|
|
37
|
+
|
|
38
|
+
echo "--- Part 1: No role (baseline) ---"
|
|
39
|
+
echo
|
|
40
|
+
echo "Running: aia -c ${CONFIG} --no-output weather"
|
|
41
|
+
echo
|
|
42
|
+
|
|
43
|
+
aia -c "${CONFIG}" --no-output weather
|
|
44
|
+
|
|
45
|
+
echo
|
|
46
|
+
echo
|
|
47
|
+
|
|
48
|
+
# --- Part 2: Pirate role ---
|
|
49
|
+
|
|
50
|
+
echo "--- Part 2: With --role pirate ---"
|
|
51
|
+
echo
|
|
52
|
+
echo "Running: aia -c ${CONFIG} --no-output --role pirate weather"
|
|
53
|
+
echo
|
|
54
|
+
|
|
55
|
+
aia -c "${CONFIG}" --no-output --role pirate weather
|
|
56
|
+
|
|
57
|
+
echo
|
|
58
|
+
echo
|
|
59
|
+
|
|
60
|
+
# --- Part 3: Formal butler role ---
|
|
61
|
+
|
|
62
|
+
echo "--- Part 3: With --role formal ---"
|
|
63
|
+
echo
|
|
64
|
+
echo "Running: aia -c ${CONFIG} --no-output --role formal weather"
|
|
65
|
+
echo
|
|
66
|
+
|
|
67
|
+
aia -c "${CONFIG}" --no-output --role formal weather
|