agent-smith-cli 0.3.1__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.
- agent_smith_cli-0.3.1/LICENSE +21 -0
- agent_smith_cli-0.3.1/PKG-INFO +303 -0
- agent_smith_cli-0.3.1/README.md +282 -0
- agent_smith_cli-0.3.1/pyproject.toml +126 -0
- agent_smith_cli-0.3.1/pyproject.toml.orig +116 -0
- agent_smith_cli-0.3.1/src/agent_smith/__init__.py +1 -0
- agent_smith_cli-0.3.1/src/agent_smith/__main__.py +37 -0
- agent_smith_cli-0.3.1/src/agent_smith/adapters/__init__.py +1 -0
- agent_smith_cli-0.3.1/src/agent_smith/adapters/adr.py +27 -0
- agent_smith_cli-0.3.1/src/agent_smith/adapters/cli.py +58 -0
- agent_smith_cli-0.3.1/src/agent_smith/adapters/configuration.py +186 -0
- agent_smith_cli-0.3.1/src/agent_smith/adapters/filesystem.py +33 -0
- agent_smith_cli-0.3.1/src/agent_smith/adapters/just_help.py +45 -0
- agent_smith_cli-0.3.1/src/agent_smith/adapters/markdown.py +35 -0
- agent_smith_cli-0.3.1/src/agent_smith/adapters/mise.py +44 -0
- agent_smith_cli-0.3.1/src/agent_smith/adapters/process.py +30 -0
- agent_smith_cli-0.3.1/src/agent_smith/application/__init__.py +1 -0
- agent_smith_cli-0.3.1/src/agent_smith/application/generation.py +109 -0
- agent_smith_cli-0.3.1/src/agent_smith/application/ports.py +98 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mehdi-H
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-smith-cli
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: Build agent instructions from your project's sources.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
8
|
+
Classifier: Environment :: Console
|
|
9
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Requires-Dist: markdown-it-py>=4,<5
|
|
16
|
+
Requires-Dist: tomli>=2 ; python_full_version < '3.11'
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Project-URL: Repository, https://github.com/Mehdi-H/agent-smith
|
|
19
|
+
Project-URL: Issues, https://github.com/Mehdi-H/agent-smith/issues
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# Agent Smith 🕶️
|
|
23
|
+
|
|
24
|
+
[](https://github.com/Mehdi-H/agent-smith/actions/workflows/release.yml?query=branch%3Amain)
|
|
25
|
+
[](pyproject.toml)
|
|
26
|
+
[](LICENSE)
|
|
27
|
+
|
|
28
|
+
*Smith* your AGENTS.md file 🕶️
|
|
29
|
+
|
|
30
|
+
Build agent instructions from your project's sources !
|
|
31
|
+
|
|
32
|
+
Treat your agent instructions as **living documentation**: regenerate them from
|
|
33
|
+
the sources you maintain as your project evolves.
|
|
34
|
+
|
|
35
|
+
Run `agent-smith` at your project root to generate **`AGENTS.md`** from your
|
|
36
|
+
README overview, your mise tool declarations, documented just commands,
|
|
37
|
+
architecture decision filenames and optional custom extractors
|
|
38
|
+
|
|
39
|
+
Forget `/init` skill, the output is _deterministic_, repeatable Markdown, you stay in control
|
|
40
|
+
|
|
41
|
+
## Demo
|
|
42
|
+
|
|
43
|
+
> [!NOTE]
|
|
44
|
+
> The CLI is a development preview. Built-in overview, tech-stack, command and ADR
|
|
45
|
+
> sections are available; no package release has been published yet.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+

|
|
49
|
+
|
|
50
|
+
## Install
|
|
51
|
+
|
|
52
|
+
The PyPI distribution is named **`agent-smith-cli`**; the executable remains
|
|
53
|
+
`agent-smith`. The name `agent-smith` was already taken on PyPI.
|
|
54
|
+
|
|
55
|
+
Agent Smith supports Python 3.10–3.14. No release is available on PyPI yet:
|
|
56
|
+
start from a checkout of this version of the repository and install the CLI
|
|
57
|
+
from its root directory with uv:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
uv tool install .
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
This installs the command in an isolated environment.
|
|
64
|
+
|
|
65
|
+
> [!TIP]
|
|
66
|
+
> If uv reports that its tool directory is missing from your PATH, run
|
|
67
|
+
> `uv tool update-shell` and restart your terminal.
|
|
68
|
+
|
|
69
|
+
Alternatively, install with pip in an activated Python virtual environment:
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
python -m pip install .
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Run and verify
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
agent-smith --version
|
|
79
|
+
agent-smith --help
|
|
80
|
+
agent-smith
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
> [!TIP]
|
|
84
|
+
> To confirm installation, check that `--version` prints the installed Agent Smith version
|
|
85
|
+
> and `--help` displays the available options. Both should exit successfully.
|
|
86
|
+
|
|
87
|
+
Run the command **from the root of the project you want to document**. It creates
|
|
88
|
+
or replaces `AGENTS.md` in that directory. Successful generation is silent;
|
|
89
|
+
open the file to verify the result. No configuration is needed when you follow
|
|
90
|
+
the conventions below.
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
agent-smith
|
|
94
|
+
cat AGENTS.md
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Use `agent-smith --output instructions.md` to choose another output filename.
|
|
98
|
+
The document has an H1 containing its filename, an H2 for each section and a
|
|
99
|
+
quoted footer identifying the command that produced that section.
|
|
100
|
+
|
|
101
|
+
## Conventions
|
|
102
|
+
|
|
103
|
+
### Overview: a README.md at the project root
|
|
104
|
+
|
|
105
|
+
Place a `README.md` at the root with a top-level H1 followed by a nonempty
|
|
106
|
+
introduction. Agent Smith copies the Markdown between that H1 and the first
|
|
107
|
+
following H2 into **Overview**. No extraction script is required.
|
|
108
|
+
|
|
109
|
+
```markdown
|
|
110
|
+
# My project
|
|
111
|
+
|
|
112
|
+
Describe what the project does and why someone would use it.
|
|
113
|
+
|
|
114
|
+
## Installation
|
|
115
|
+
|
|
116
|
+
This section is outside the extracted overview.
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The first H2 ends the overview; if there is no H2, extraction continues to the
|
|
120
|
+
end of the file. Badges, links and GitHub alerts in the introduction are kept.
|
|
121
|
+
An absent README, a missing H1 or an empty introduction produces an error.
|
|
122
|
+
Use `--no-overview` to disable this section.
|
|
123
|
+
|
|
124
|
+
### Main tech stack: declared tools in a root mise.toml
|
|
125
|
+
|
|
126
|
+
Put a `mise.toml` at your project root with a nonempty `[tools]` table:
|
|
127
|
+
|
|
128
|
+
```toml
|
|
129
|
+
[tools]
|
|
130
|
+
python = ["3.14", "3.10"]
|
|
131
|
+
uv = "latest"
|
|
132
|
+
node = { version = "lts", postinstall = "corepack enable" }
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Agent Smith automatically adds:
|
|
136
|
+
|
|
137
|
+
```markdown
|
|
138
|
+
## Main tech stack
|
|
139
|
+
|
|
140
|
+
- `python` — `3.14`, `3.10`
|
|
141
|
+
- `uv` — `latest`
|
|
142
|
+
- `node` — `lts`
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Tool names (including backend prefixes) and declared versions stay in file order.
|
|
146
|
+
Strings, arrays of versions, and tables with a string `version` are supported,
|
|
147
|
+
including arrays of those tables. Installation options are ignored. Agent Smith
|
|
148
|
+
reads TOML directly: mise need not be installed, no hooks or templates execute,
|
|
149
|
+
and aliases such as `latest` remain literal. It does not resolve installed versions,
|
|
150
|
+
merge global/local configuration, or inspect other files such as `.python-version`.
|
|
151
|
+
|
|
152
|
+
With no root `mise.toml`, this section is omitted. Use `--no-tech-stack` or
|
|
153
|
+
`[tech_stack].enabled = false` to disable it. In the tool's configuration, `source`
|
|
154
|
+
selects another TOML file and `title` changes the heading. An explicit
|
|
155
|
+
`enabled = true` requires that source to exist. Invalid TOML, an empty `[tools]`
|
|
156
|
+
table or an unsupported version declaration fails generation and preserves the
|
|
157
|
+
existing document. The footer names the exact `agent-smith` invocation.
|
|
158
|
+
|
|
159
|
+
### Available commands: a documented, grouped justfile at the project root
|
|
160
|
+
|
|
161
|
+
Document your project's practices in a root `justfile` (also detected as
|
|
162
|
+
`Justfile` or `.justfile`). Give each recipe a descriptive comment and a group,
|
|
163
|
+
and provide a `help` recipe that prints the standard `just --list` output:
|
|
164
|
+
|
|
165
|
+
```just
|
|
166
|
+
# List the project's available commands.
|
|
167
|
+
[group("Help")]
|
|
168
|
+
help:
|
|
169
|
+
@just --list
|
|
170
|
+
|
|
171
|
+
# Check modified files for whitespace errors.
|
|
172
|
+
[group("Quality")]
|
|
173
|
+
check-whitespace:
|
|
174
|
+
git diff --check
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
[Install just](https://just.systems/man/en/installation.html) and make sure
|
|
178
|
+
`just help` works from the project root. Agent Smith automatically runs that
|
|
179
|
+
command and converts its output to **Available commands**: Markdown lists under
|
|
180
|
+
group subheadings, preserving recipe order, parameters and descriptions.
|
|
181
|
+
For the example above, the section contains:
|
|
182
|
+
|
|
183
|
+
```markdown
|
|
184
|
+
## Available commands
|
|
185
|
+
|
|
186
|
+
### Help
|
|
187
|
+
|
|
188
|
+
- `just help` — List the project's available commands.
|
|
189
|
+
|
|
190
|
+
### Quality
|
|
191
|
+
|
|
192
|
+
- `just check-whitespace` — Check modified files for whitespace errors.
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
The section ends with a footer naming `just help`. Listed recipes are not
|
|
196
|
+
executed; only the help recipe runs. With no root justfile, this section is
|
|
197
|
+
omitted and just is not required. Use `--no-available-commands` to disable it.
|
|
198
|
+
If help fails or does not produce the supported list format, generation fails
|
|
199
|
+
and the existing `AGENTS.md` is preserved. Custom help formats can be supplied
|
|
200
|
+
as Markdown through a custom section instead.
|
|
201
|
+
|
|
202
|
+
### Architecture decisions: an ADR directory declared in .adr-dir
|
|
203
|
+
|
|
204
|
+
Use [adr-tools](https://github.com/npryce/adr-tools) and a root `.adr-dir` containing
|
|
205
|
+
the path to your decisions directory, for example `docs/adr`. When that file exists,
|
|
206
|
+
Agent Smith runs `adr list` and adds a compact index:
|
|
207
|
+
|
|
208
|
+
```markdown
|
|
209
|
+
## Architecture decisions
|
|
210
|
+
|
|
211
|
+
Directory: `docs/adr`
|
|
212
|
+
|
|
213
|
+
- `0001-record-architecture-decisions`
|
|
214
|
+
- `0002-use-python`
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
The directory appears once, using the content of `.adr-dir`. Each bullet contains
|
|
218
|
+
only a filename without its final `.md` extension: numbers, hyphens and ordering
|
|
219
|
+
from `adr list` are preserved. ADR contents and their Markdown headings are never
|
|
220
|
+
read. Use meaningful filenames so the index conveys decisions without loading
|
|
221
|
+
individual records. All records listed by adr-tools are included; their status
|
|
222
|
+
is not inferred from their filenames.
|
|
223
|
+
|
|
224
|
+
The footer names `adr list`. The command must be installed and runnable from the
|
|
225
|
+
project root, and its listed paths must match `.adr-dir`. With no `.adr-dir`, this
|
|
226
|
+
section is omitted. Empty or invalid metadata, a failed command or unsupported
|
|
227
|
+
output fails generation while preserving the existing document.
|
|
228
|
+
|
|
229
|
+
Use `--no-architecture-decisions` or `[architecture_decisions].enabled = false`
|
|
230
|
+
to disable this built-in, and `title` to rename its heading. Setting `enabled = true`
|
|
231
|
+
explicitly requires `.adr-dir` even if it was not detected automatically.
|
|
232
|
+
|
|
233
|
+
## Configure sections
|
|
234
|
+
|
|
235
|
+
An optional root `agent-smith.toml` customizes built-in sections and adds custom
|
|
236
|
+
extractors. For example, to enable the four built-ins and append tracked files:
|
|
237
|
+
|
|
238
|
+
```toml
|
|
239
|
+
output = "AGENTS.md"
|
|
240
|
+
|
|
241
|
+
[overview]
|
|
242
|
+
enabled = true
|
|
243
|
+
source = "README.md"
|
|
244
|
+
title = "Overview"
|
|
245
|
+
|
|
246
|
+
[available_commands]
|
|
247
|
+
enabled = true
|
|
248
|
+
title = "Available commands"
|
|
249
|
+
command = "just help"
|
|
250
|
+
|
|
251
|
+
[tech_stack]
|
|
252
|
+
enabled = true
|
|
253
|
+
source = "mise.toml"
|
|
254
|
+
title = "Main tech stack"
|
|
255
|
+
|
|
256
|
+
[architecture_decisions]
|
|
257
|
+
enabled = true
|
|
258
|
+
title = "Architecture decisions"
|
|
259
|
+
|
|
260
|
+
[[sections]]
|
|
261
|
+
title = "Tracked files"
|
|
262
|
+
command = "git ls-files"
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Each custom section uses its command's UTF-8 stdout as Markdown, followed by a
|
|
266
|
+
footer with the exact command. Sections appear in configuration order after the
|
|
267
|
+
built-in overview, main tech stack, available commands and architecture decisions. Set `[available_commands].enabled = false`
|
|
268
|
+
to disable command discovery, or change its `command` to another source of
|
|
269
|
+
standard just list output, such as `just --list`. Explicit `enabled = true`
|
|
270
|
+
requires the command to work even if no root justfile was detected.
|
|
271
|
+
|
|
272
|
+
To replace the overview with your own extractor:
|
|
273
|
+
|
|
274
|
+
```toml
|
|
275
|
+
[overview]
|
|
276
|
+
enabled = false
|
|
277
|
+
|
|
278
|
+
[[sections]]
|
|
279
|
+
title = "Overview"
|
|
280
|
+
command = "./scripts/my-overview.sh"
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Supply your own script for that command. You can also disable the built-in with
|
|
284
|
+
`--no-overview`, and select another configuration with `--config path/to/config.toml`.
|
|
285
|
+
`--output` takes precedence over configuration. Paths and command working
|
|
286
|
+
directories are relative to where you invoke the CLI, including with `--config`.
|
|
287
|
+
The output's parent directory must exist.
|
|
288
|
+
|
|
289
|
+
> [!WARNING]
|
|
290
|
+
> The help recipe and custom commands run with your permissions. Only generate
|
|
291
|
+
> documents from trusted projects and configurations. If extraction or writing fails, Agent Smith preserves
|
|
292
|
+
> the existing output file; side effects of custom scripts are not rolled back.
|
|
293
|
+
|
|
294
|
+
> [!NOTE]
|
|
295
|
+
> Identical configuration and extractor outputs produce identical Markdown.
|
|
296
|
+
> Variable command output, such as timestamps, remains variable. Extraction
|
|
297
|
+
> preserves relative links and does not copy reference definitions from outside
|
|
298
|
+
> the overview. No Markdown formatter is applied.
|
|
299
|
+
|
|
300
|
+
## Contributing
|
|
301
|
+
|
|
302
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for repository setup, development commands, commit
|
|
303
|
+
conventions and just-in-time architecture decisions. The license is [MIT](LICENSE).
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
# Agent Smith 🕶️
|
|
2
|
+
|
|
3
|
+
[](https://github.com/Mehdi-H/agent-smith/actions/workflows/release.yml?query=branch%3Amain)
|
|
4
|
+
[](pyproject.toml)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
*Smith* your AGENTS.md file 🕶️
|
|
8
|
+
|
|
9
|
+
Build agent instructions from your project's sources !
|
|
10
|
+
|
|
11
|
+
Treat your agent instructions as **living documentation**: regenerate them from
|
|
12
|
+
the sources you maintain as your project evolves.
|
|
13
|
+
|
|
14
|
+
Run `agent-smith` at your project root to generate **`AGENTS.md`** from your
|
|
15
|
+
README overview, your mise tool declarations, documented just commands,
|
|
16
|
+
architecture decision filenames and optional custom extractors
|
|
17
|
+
|
|
18
|
+
Forget `/init` skill, the output is _deterministic_, repeatable Markdown, you stay in control
|
|
19
|
+
|
|
20
|
+
## Demo
|
|
21
|
+
|
|
22
|
+
> [!NOTE]
|
|
23
|
+
> The CLI is a development preview. Built-in overview, tech-stack, command and ADR
|
|
24
|
+
> sections are available; no package release has been published yet.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
The PyPI distribution is named **`agent-smith-cli`**; the executable remains
|
|
32
|
+
`agent-smith`. The name `agent-smith` was already taken on PyPI.
|
|
33
|
+
|
|
34
|
+
Agent Smith supports Python 3.10–3.14. No release is available on PyPI yet:
|
|
35
|
+
start from a checkout of this version of the repository and install the CLI
|
|
36
|
+
from its root directory with uv:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
uv tool install .
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This installs the command in an isolated environment.
|
|
43
|
+
|
|
44
|
+
> [!TIP]
|
|
45
|
+
> If uv reports that its tool directory is missing from your PATH, run
|
|
46
|
+
> `uv tool update-shell` and restart your terminal.
|
|
47
|
+
|
|
48
|
+
Alternatively, install with pip in an activated Python virtual environment:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
python -m pip install .
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Run and verify
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
agent-smith --version
|
|
58
|
+
agent-smith --help
|
|
59
|
+
agent-smith
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
> [!TIP]
|
|
63
|
+
> To confirm installation, check that `--version` prints the installed Agent Smith version
|
|
64
|
+
> and `--help` displays the available options. Both should exit successfully.
|
|
65
|
+
|
|
66
|
+
Run the command **from the root of the project you want to document**. It creates
|
|
67
|
+
or replaces `AGENTS.md` in that directory. Successful generation is silent;
|
|
68
|
+
open the file to verify the result. No configuration is needed when you follow
|
|
69
|
+
the conventions below.
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
agent-smith
|
|
73
|
+
cat AGENTS.md
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Use `agent-smith --output instructions.md` to choose another output filename.
|
|
77
|
+
The document has an H1 containing its filename, an H2 for each section and a
|
|
78
|
+
quoted footer identifying the command that produced that section.
|
|
79
|
+
|
|
80
|
+
## Conventions
|
|
81
|
+
|
|
82
|
+
### Overview: a README.md at the project root
|
|
83
|
+
|
|
84
|
+
Place a `README.md` at the root with a top-level H1 followed by a nonempty
|
|
85
|
+
introduction. Agent Smith copies the Markdown between that H1 and the first
|
|
86
|
+
following H2 into **Overview**. No extraction script is required.
|
|
87
|
+
|
|
88
|
+
```markdown
|
|
89
|
+
# My project
|
|
90
|
+
|
|
91
|
+
Describe what the project does and why someone would use it.
|
|
92
|
+
|
|
93
|
+
## Installation
|
|
94
|
+
|
|
95
|
+
This section is outside the extracted overview.
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The first H2 ends the overview; if there is no H2, extraction continues to the
|
|
99
|
+
end of the file. Badges, links and GitHub alerts in the introduction are kept.
|
|
100
|
+
An absent README, a missing H1 or an empty introduction produces an error.
|
|
101
|
+
Use `--no-overview` to disable this section.
|
|
102
|
+
|
|
103
|
+
### Main tech stack: declared tools in a root mise.toml
|
|
104
|
+
|
|
105
|
+
Put a `mise.toml` at your project root with a nonempty `[tools]` table:
|
|
106
|
+
|
|
107
|
+
```toml
|
|
108
|
+
[tools]
|
|
109
|
+
python = ["3.14", "3.10"]
|
|
110
|
+
uv = "latest"
|
|
111
|
+
node = { version = "lts", postinstall = "corepack enable" }
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Agent Smith automatically adds:
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
## Main tech stack
|
|
118
|
+
|
|
119
|
+
- `python` — `3.14`, `3.10`
|
|
120
|
+
- `uv` — `latest`
|
|
121
|
+
- `node` — `lts`
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Tool names (including backend prefixes) and declared versions stay in file order.
|
|
125
|
+
Strings, arrays of versions, and tables with a string `version` are supported,
|
|
126
|
+
including arrays of those tables. Installation options are ignored. Agent Smith
|
|
127
|
+
reads TOML directly: mise need not be installed, no hooks or templates execute,
|
|
128
|
+
and aliases such as `latest` remain literal. It does not resolve installed versions,
|
|
129
|
+
merge global/local configuration, or inspect other files such as `.python-version`.
|
|
130
|
+
|
|
131
|
+
With no root `mise.toml`, this section is omitted. Use `--no-tech-stack` or
|
|
132
|
+
`[tech_stack].enabled = false` to disable it. In the tool's configuration, `source`
|
|
133
|
+
selects another TOML file and `title` changes the heading. An explicit
|
|
134
|
+
`enabled = true` requires that source to exist. Invalid TOML, an empty `[tools]`
|
|
135
|
+
table or an unsupported version declaration fails generation and preserves the
|
|
136
|
+
existing document. The footer names the exact `agent-smith` invocation.
|
|
137
|
+
|
|
138
|
+
### Available commands: a documented, grouped justfile at the project root
|
|
139
|
+
|
|
140
|
+
Document your project's practices in a root `justfile` (also detected as
|
|
141
|
+
`Justfile` or `.justfile`). Give each recipe a descriptive comment and a group,
|
|
142
|
+
and provide a `help` recipe that prints the standard `just --list` output:
|
|
143
|
+
|
|
144
|
+
```just
|
|
145
|
+
# List the project's available commands.
|
|
146
|
+
[group("Help")]
|
|
147
|
+
help:
|
|
148
|
+
@just --list
|
|
149
|
+
|
|
150
|
+
# Check modified files for whitespace errors.
|
|
151
|
+
[group("Quality")]
|
|
152
|
+
check-whitespace:
|
|
153
|
+
git diff --check
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
[Install just](https://just.systems/man/en/installation.html) and make sure
|
|
157
|
+
`just help` works from the project root. Agent Smith automatically runs that
|
|
158
|
+
command and converts its output to **Available commands**: Markdown lists under
|
|
159
|
+
group subheadings, preserving recipe order, parameters and descriptions.
|
|
160
|
+
For the example above, the section contains:
|
|
161
|
+
|
|
162
|
+
```markdown
|
|
163
|
+
## Available commands
|
|
164
|
+
|
|
165
|
+
### Help
|
|
166
|
+
|
|
167
|
+
- `just help` — List the project's available commands.
|
|
168
|
+
|
|
169
|
+
### Quality
|
|
170
|
+
|
|
171
|
+
- `just check-whitespace` — Check modified files for whitespace errors.
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
The section ends with a footer naming `just help`. Listed recipes are not
|
|
175
|
+
executed; only the help recipe runs. With no root justfile, this section is
|
|
176
|
+
omitted and just is not required. Use `--no-available-commands` to disable it.
|
|
177
|
+
If help fails or does not produce the supported list format, generation fails
|
|
178
|
+
and the existing `AGENTS.md` is preserved. Custom help formats can be supplied
|
|
179
|
+
as Markdown through a custom section instead.
|
|
180
|
+
|
|
181
|
+
### Architecture decisions: an ADR directory declared in .adr-dir
|
|
182
|
+
|
|
183
|
+
Use [adr-tools](https://github.com/npryce/adr-tools) and a root `.adr-dir` containing
|
|
184
|
+
the path to your decisions directory, for example `docs/adr`. When that file exists,
|
|
185
|
+
Agent Smith runs `adr list` and adds a compact index:
|
|
186
|
+
|
|
187
|
+
```markdown
|
|
188
|
+
## Architecture decisions
|
|
189
|
+
|
|
190
|
+
Directory: `docs/adr`
|
|
191
|
+
|
|
192
|
+
- `0001-record-architecture-decisions`
|
|
193
|
+
- `0002-use-python`
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
The directory appears once, using the content of `.adr-dir`. Each bullet contains
|
|
197
|
+
only a filename without its final `.md` extension: numbers, hyphens and ordering
|
|
198
|
+
from `adr list` are preserved. ADR contents and their Markdown headings are never
|
|
199
|
+
read. Use meaningful filenames so the index conveys decisions without loading
|
|
200
|
+
individual records. All records listed by adr-tools are included; their status
|
|
201
|
+
is not inferred from their filenames.
|
|
202
|
+
|
|
203
|
+
The footer names `adr list`. The command must be installed and runnable from the
|
|
204
|
+
project root, and its listed paths must match `.adr-dir`. With no `.adr-dir`, this
|
|
205
|
+
section is omitted. Empty or invalid metadata, a failed command or unsupported
|
|
206
|
+
output fails generation while preserving the existing document.
|
|
207
|
+
|
|
208
|
+
Use `--no-architecture-decisions` or `[architecture_decisions].enabled = false`
|
|
209
|
+
to disable this built-in, and `title` to rename its heading. Setting `enabled = true`
|
|
210
|
+
explicitly requires `.adr-dir` even if it was not detected automatically.
|
|
211
|
+
|
|
212
|
+
## Configure sections
|
|
213
|
+
|
|
214
|
+
An optional root `agent-smith.toml` customizes built-in sections and adds custom
|
|
215
|
+
extractors. For example, to enable the four built-ins and append tracked files:
|
|
216
|
+
|
|
217
|
+
```toml
|
|
218
|
+
output = "AGENTS.md"
|
|
219
|
+
|
|
220
|
+
[overview]
|
|
221
|
+
enabled = true
|
|
222
|
+
source = "README.md"
|
|
223
|
+
title = "Overview"
|
|
224
|
+
|
|
225
|
+
[available_commands]
|
|
226
|
+
enabled = true
|
|
227
|
+
title = "Available commands"
|
|
228
|
+
command = "just help"
|
|
229
|
+
|
|
230
|
+
[tech_stack]
|
|
231
|
+
enabled = true
|
|
232
|
+
source = "mise.toml"
|
|
233
|
+
title = "Main tech stack"
|
|
234
|
+
|
|
235
|
+
[architecture_decisions]
|
|
236
|
+
enabled = true
|
|
237
|
+
title = "Architecture decisions"
|
|
238
|
+
|
|
239
|
+
[[sections]]
|
|
240
|
+
title = "Tracked files"
|
|
241
|
+
command = "git ls-files"
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Each custom section uses its command's UTF-8 stdout as Markdown, followed by a
|
|
245
|
+
footer with the exact command. Sections appear in configuration order after the
|
|
246
|
+
built-in overview, main tech stack, available commands and architecture decisions. Set `[available_commands].enabled = false`
|
|
247
|
+
to disable command discovery, or change its `command` to another source of
|
|
248
|
+
standard just list output, such as `just --list`. Explicit `enabled = true`
|
|
249
|
+
requires the command to work even if no root justfile was detected.
|
|
250
|
+
|
|
251
|
+
To replace the overview with your own extractor:
|
|
252
|
+
|
|
253
|
+
```toml
|
|
254
|
+
[overview]
|
|
255
|
+
enabled = false
|
|
256
|
+
|
|
257
|
+
[[sections]]
|
|
258
|
+
title = "Overview"
|
|
259
|
+
command = "./scripts/my-overview.sh"
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Supply your own script for that command. You can also disable the built-in with
|
|
263
|
+
`--no-overview`, and select another configuration with `--config path/to/config.toml`.
|
|
264
|
+
`--output` takes precedence over configuration. Paths and command working
|
|
265
|
+
directories are relative to where you invoke the CLI, including with `--config`.
|
|
266
|
+
The output's parent directory must exist.
|
|
267
|
+
|
|
268
|
+
> [!WARNING]
|
|
269
|
+
> The help recipe and custom commands run with your permissions. Only generate
|
|
270
|
+
> documents from trusted projects and configurations. If extraction or writing fails, Agent Smith preserves
|
|
271
|
+
> the existing output file; side effects of custom scripts are not rolled back.
|
|
272
|
+
|
|
273
|
+
> [!NOTE]
|
|
274
|
+
> Identical configuration and extractor outputs produce identical Markdown.
|
|
275
|
+
> Variable command output, such as timestamps, remains variable. Extraction
|
|
276
|
+
> preserves relative links and does not copy reference definitions from outside
|
|
277
|
+
> the overview. No Markdown formatter is applied.
|
|
278
|
+
|
|
279
|
+
## Contributing
|
|
280
|
+
|
|
281
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for repository setup, development commands, commit
|
|
282
|
+
conventions and just-in-time architecture decisions. The license is [MIT](LICENSE).
|