|
1 | 1 | # Ailly Prompt Workflow |
2 | 2 |
|
3 | | -This project provides three scripts to **generate** Ailly prompts, **run** them, **parse** the results, and **update** a DocGen instance. |
4 | | - |
5 | | -## Overview |
6 | | - |
7 | | -1. **Generate** Ailly prompts from DocGen snippets (`make_prompts.py`). |
8 | | -2. **Run** the Ailly CLI on the generated prompts (`npx @ailly/cli`). |
9 | | -3. **Parse** the Ailly outputs into structured JSON (`parse_json_files.py`). |
10 | | -4. **Update** your DocGen project with the parsed results (`update_doc_gen.py`). |
11 | | - |
12 | | ---- |
13 | | - |
14 | | -## Prerequisites |
15 | | - |
16 | | -- Python 3.8+ |
17 | | -- Node.js & npm (for `npx`) |
| 3 | +This project automates the process of generating, running, parsing, and applying [Ailly](https://www.npmjs.com/package/@ailly/cli) prompt outputs to an AWS DocGen project. It combines all steps into one streamlined command using a single Python script. |
18 | 4 |
|
19 | 5 | --- |
20 | 6 |
|
21 | | -## Step 1: Generate Ailly prompts |
22 | | - |
23 | | -Use `make_prompts.py` to create a directory of Markdown files and a `.aillyrc` configuration file. |
| 7 | +## 📦 Overview |
24 | 8 |
|
25 | | -```bash |
26 | | -python make_prompts.py \ |
27 | | - --doc-gen-root /path/to/your/docgen/project \ |
28 | | - --system-prompts "You are a helpful assistant..." \ |
29 | | - --out .ailly_prompts |
30 | | -``` |
| 9 | +This tool: |
| 10 | +1. **Generates** Ailly prompts from DocGen snippets. |
| 11 | +2. **Runs** Ailly CLI to get enhanced metadata. |
| 12 | +3. **Parses** Ailly responses into structured JSON. |
| 13 | +4. **Updates** your DocGen examples with the new metadata. |
31 | 14 |
|
32 | | -**Arguments:** |
33 | | -- `--doc-gen-root`: Path to your DocGen project root. |
34 | | -- `--system-prompts`: One or more system prompts, either as strings or file paths. |
35 | | -- `--out`: (Optional) Output directory. Defaults to `.ailly_prompts`. |
| 15 | +All of this is done with one command. |
36 | 16 |
|
37 | 17 | --- |
38 | 18 |
|
39 | | -## Step 2: Run Ailly CLI |
| 19 | +## ✅ Prerequisites |
40 | 20 |
|
41 | | -Run Ailly on the generated prompts: |
42 | | - |
43 | | -```bash |
44 | | -npx @ailly/cli --root .ailly_prompts |
45 | | -``` |
46 | | - |
47 | | -This will create `{file}.ailly.md` output files in the `.ailly_prompts` directory (or whatever output directory you specified). |
| 21 | +- Python 3.8+ |
| 22 | +- Node.js and npm (for `npx`) |
| 23 | +- A DocGen project directory |
48 | 24 |
|
49 | 25 | --- |
50 | 26 |
|
51 | | -## Step 3: Parse Ailly output |
| 27 | +## 🚀 Usage |
52 | 28 |
|
53 | | -Parse the `{name}.ailly.md` files into JSON using `parse_json_files.py`: |
| 29 | +From your project root, run: |
54 | 30 |
|
55 | 31 | ```bash |
56 | | -python parse_json_files.py .ailly_prompts/*.ailly.md --out example_updates.json |
| 32 | +python -m aws_doc_sdk_examples_tools.agent.bin.main \ |
| 33 | + /path/to/your/docgen/project \ |
| 34 | + --system-prompts path/to/system_prompt.txt |
57 | 35 | ``` |
58 | 36 |
|
59 | | -**Arguments:** |
60 | | -- Positional: List of files to parse (e.g., `*.ailly.md`). |
61 | | -- `--out`: (Optional) Path for the JSON output. Defaults to `out.json`. |
| 37 | +### 🔧 Arguments |
| 38 | + |
| 39 | +Run `python -m aws_doc_sdk_examples_tools.agent.bin.main --help` for more info. |
62 | 40 |
|
63 | 41 | --- |
64 | 42 |
|
65 | | -## Step 4: Update DocGen with Ailly results |
| 43 | +## 🗂 What This Does |
66 | 44 |
|
67 | | -Use `update_doc_gen.py` to load the parsed data back into your `DocGen` project: |
| 45 | +Under the hood, this script: |
68 | 46 |
|
69 | | -```bash |
70 | | -python update_doc_gen.py \ |
71 | | - --doc-gen-root /path/to/your/docgen/project \ |
72 | | - --updates-path example_updates.json |
73 | | -``` |
| 47 | +1. Creates a directory `.ailly_iam_policy` containing: |
| 48 | + - One Markdown file per snippet. |
| 49 | + - A `.aillyrc` configuration file. |
74 | 50 |
|
75 | | -**Arguments:** |
76 | | -- `--doc-gen-root`: Path to the root of your DocGen project. |
77 | | -- `--updates-path`: JSON file generated in Step 3 (default: `example_updates.json`). |
| 51 | +2. Runs `npx @ailly/cli` to generate `.ailly.md` outputs. |
78 | 52 |
|
79 | | -This will update the `title`, `title_abbrev`, and `synopsis` fields in the corresponding DocGen examples. |
| 53 | +3. Parses the Ailly `.ailly.md` files into a single `iam_updates.json` file. |
| 54 | + |
| 55 | +4. Updates each matching `Example` in the DocGen instance with: |
| 56 | + - `title` |
| 57 | + - `title_abbrev` |
| 58 | + - `synopsis` |
80 | 59 |
|
81 | 60 | --- |
82 | 61 |
|
83 | | -## Example Full Workflow |
| 62 | +## 💡 Example |
84 | 63 |
|
85 | 64 | ```bash |
86 | | -# Step 1: Generate prompts |
87 | | -python make_prompts.py \ |
88 | | - --doc-gen-root ~/projects/aws-docgen-root \ |
89 | | - --system-prompts system_prompt.txt \ |
90 | | - --out .ailly_prompts |
91 | | - |
92 | | -# Step 2: Run Ailly |
93 | | -npx @ailly/cli --root .ailly_prompts |
94 | | - |
95 | | -# Step 3: Parse results |
96 | | -python parse_json_files.py .ailly_prompts/*.ailly.md --out example_updates.json |
97 | | - |
98 | | -# Step 4: Update DocGen |
99 | | -python update_doc_gen.py \ |
100 | | - --doc-gen-root ~/projects/aws-docgen-root \ |
101 | | - --updates-path example_updates.json |
| 65 | +python -m aws_doc_sdk_examples_tools.agent.bin.main \ |
| 66 | + ~/projects/AWSIAMPolicyExampleReservoir \ |
| 67 | + --system-prompts prompts/system_prompt.txt |
102 | 68 | ``` |
| 69 | + |
| 70 | +This will: |
| 71 | +- Write prompts and config to `.ailly_iam_policy/` |
| 72 | +- Run Ailly and capture results |
| 73 | +- Parse and save output as `.ailly_iam_policy/iam_updates.json` |
| 74 | +- Apply updates to your DocGen examples |
0 commit comments