docopslab-dev 0.2.0 → 0.3.0
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/README.adoc +42 -11
- data/docopslab-dev.gemspec +2 -2
- data/lib/docopslab/dev/docker_aware.rb +40 -0
- data/lib/docopslab/dev/initializer.rb +21 -7
- data/lib/docopslab/dev/library.rb +14 -1
- data/lib/docopslab/dev/linters.rb +10 -3
- data/lib/docopslab/dev/version.rb +1 -1
- data/lib/docopslab/dev.rb +2 -1
- data/specs/data/default-manifest.yml +8 -0
- metadata +4 -38
- data/docs/agent/index.md +0 -76
- data/docs/agent/misc/bash-styles.md +0 -470
- data/docs/agent/missions/conduct-release.md +0 -298
- data/docs/agent/missions/setup-new-project.md +0 -344
- data/docs/agent/roles/devops-release-engineer.md +0 -195
- data/docs/agent/roles/docops-engineer.md +0 -257
- data/docs/agent/roles/planner-architect.md +0 -96
- data/docs/agent/roles/product-engineer.md +0 -201
- data/docs/agent/roles/product-manager.md +0 -163
- data/docs/agent/roles/project-manager.md +0 -175
- data/docs/agent/roles/qa-testing-engineer.md +0 -149
- data/docs/agent/roles/tech-docs-manager.md +0 -189
- data/docs/agent/roles/tech-writer.md +0 -217
- data/docs/agent/skills/asciidoc.md +0 -436
- data/docs/agent/skills/bash-cli-dev.md +0 -135
- data/docs/agent/skills/code-commenting.md +0 -384
- data/docs/agent/skills/fix-broken-links.md +0 -354
- data/docs/agent/skills/fix-jekyll-asciidoc-build-errors.md +0 -14
- data/docs/agent/skills/fix-spelling-issues.md +0 -10
- data/docs/agent/skills/git.md +0 -205
- data/docs/agent/skills/github-issues.md +0 -174
- data/docs/agent/skills/product-release-rollback-and-patching.md +0 -71
- data/docs/agent/skills/rake-cli-dev.md +0 -57
- data/docs/agent/skills/readme-driven-dev.md +0 -14
- data/docs/agent/skills/release-history.md +0 -23
- data/docs/agent/skills/ruby.md +0 -203
- data/docs/agent/skills/schemagraphy-sgyml.md +0 -21
- data/docs/agent/skills/tests-running.md +0 -33
- data/docs/agent/skills/tests-writing.md +0 -68
- data/docs/agent/skills/write-the-docs.md +0 -116
- data/docs/agent/topics/common-project-paths.md +0 -169
- data/docs/agent/topics/dev-tooling-usage.md +0 -195
- data/docs/agent/topics/devops-ci-cd.md +0 -57
- data/docs/agent/topics/product-docs-deployment.md +0 -31
- data/docs/library-readme.adoc +0 -39
|
@@ -1,436 +0,0 @@
|
|
|
1
|
-
# AI Agent’s Guide to Writing in AsciiDoc
|
|
2
|
-
|
|
3
|
-
This document is intended for AI agents operating within a DocOps Lab environment.
|
|
4
|
-
|
|
5
|
-
Original sources for this document include:
|
|
6
|
-
|
|
7
|
-
<!-- detect the origin url based on the slug (origin) -->
|
|
8
|
-
- [Documentation Style Guide](/docs/asciidoc-styles/)
|
|
9
|
-
|
|
10
|
-
If you learn nothing else form this guide, learn this: DocOps Lab is an AsciiDoc shop, and we _do not_ author in Markdown; we instead try to model excellent AsciiDoc authoring and syntax.
|
|
11
|
-
|
|
12
|
-
Table of Contents
|
|
13
|
-
|
|
14
|
-
- Avoid Slop Syntax
|
|
15
|
-
- Automated Style Enforcement
|
|
16
|
-
- General AsciiDoc Syntax Guidelines
|
|
17
|
-
- DocOps Lab Specific Syntax Guidelines
|
|
18
|
-
- Inline Syntax
|
|
19
|
-
- Inline Semantics
|
|
20
|
-
- Syntax Preferences
|
|
21
|
-
- Block Syntax
|
|
22
|
-
- Block Semantics
|
|
23
|
-
- Use Delimited Blocks
|
|
24
|
-
- Example Blocks
|
|
25
|
-
- Attribute Formatting
|
|
26
|
-
- Vale Configuration and Usage
|
|
27
|
-
- Consumer Mode (Other Projects)
|
|
28
|
-
|
|
29
|
-
## Avoid Slop Syntax
|
|
30
|
-
|
|
31
|
-
The biggest mistake AI agents make when writing AsciiDoc syntax is that they slip into Markdown.
|
|
32
|
-
|
|
33
|
-
**DO NOT use Markdown** syntax or conventions when generating AsciiDoc markup.
|
|
34
|
-
|
|
35
|
-
Use AsciiDoc description-list markup instead of bulleted lists when topical or parameterized information is to be conveyed.
|
|
36
|
-
|
|
37
|
-
DO use DLs
|
|
38
|
-
|
|
39
|
-
```asciidoc
|
|
40
|
-
some topic or term::
|
|
41
|
-
The description of that term, possibly as a complete sentence or paragraph with a period.
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
DO NOT use arbitrarily formatted lists
|
|
45
|
-
|
|
46
|
-
```asciidoc
|
|
47
|
-
* *This kind of thing*: Followed by more information, is non-semantic.
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Definition DO NOT do it in Markdown
|
|
51
|
-
|
|
52
|
-
```markdown
|
|
53
|
-
- **That awful double-asterisk notation** : Followed by a colon outside the bolding (no!) and then the "description". Just don't.
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
You will almost NEVER be asked to author in Markdown, except when leaving notes to yourself, in which case your unfortunate bias towards Markdown is acceptable.
|
|
57
|
-
|
|
58
|
-
DocOps Lab is an AsciiDoc shop. With a few exceptions, all technical documentation is sourced in AsciiDoc format using a particular (standards-compliant) syntax style.
|
|
59
|
-
|
|
60
|
-
Structured/reference documentation is typically stored in YAML-formatted files, often with AsciiDoc-formatted text blocks.
|
|
61
|
-
|
|
62
|
-
Some documentation in DocOps Lab projects is written in Markdown format, such as documents intended for AI consumption (such as for agent orientation/instruction or for RAG retrieval).
|
|
63
|
-
|
|
64
|
-
## Automated Style Enforcement
|
|
65
|
-
|
|
66
|
-
DocOps Lab projects using the `docopslab-dev` tool automatically enforce documentation style guidelines. This is done using [**Vale**](https://vale.sh), a prose and source-syntax linter.
|
|
67
|
-
|
|
68
|
-
To check documentation style:
|
|
69
|
-
|
|
70
|
-
Check prose for style issues
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
bundle exec rake labdev:lint:text
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Check for AsciiDoc markup syntax issues
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
bundle exec rake labdev:lint:adoc
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Check both syntax markup _and_ prose
|
|
83
|
-
|
|
84
|
-
```
|
|
85
|
-
bundle exec rake labdev:lint:docs
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
DocOps Lab maintains a general-audience style guide in the AYL DocStack project repository and website. That guide is reproduced here.
|
|
89
|
-
|
|
90
|
-
## General AsciiDoc Syntax Guidelines
|
|
91
|
-
|
|
92
|
-
DocOps Lab documentation largely follows the conventions outlined in the [Recommended Practices](https://asciidoctor.org/docs/asciidoc-recommended-practices/) and[Writer’s Guide](https://asciidoctor.org/docs/asciidoc-writers-guide/) documents maintained by the Asciidoctor project.
|
|
93
|
-
|
|
94
|
-
Reinforcements and exceptions:
|
|
95
|
-
|
|
96
|
-
- Use `.adoc` extensions _execpt_ for Liquid templates used to render AsciiDoc files, which use `.asciidoc`.
|
|
97
|
-
|
|
98
|
-
- Use one sentence per line formatting.
|
|
99
|
-
|
|
100
|
-
- Use ATX-style titles and section headings.
|
|
101
|
-
|
|
102
|
-
- For DRYness, use attributes for common URLs and paths (see Attribute Formatting).
|
|
103
|
-
|
|
104
|
-
## DocOps Lab Specific Syntax Guidelines
|
|
105
|
-
|
|
106
|
-
## Inline Syntax
|
|
107
|
-
|
|
108
|
-
### Inline Semantics
|
|
109
|
-
|
|
110
|
-
The main purpose of inline semantics is to provide a clear indication of the role of the text to the reader — including artificial readers.
|
|
111
|
-
|
|
112
|
-
We can convey semantics by way of:
|
|
113
|
-
|
|
114
|
-
- declaration by element, role, or class
|
|
115
|
-
|
|
116
|
-
- text style based on declaration
|
|
117
|
-
|
|
118
|
-
- browser effects based on declaration and additional data
|
|
119
|
-
|
|
120
|
-
We use the following inline semantic coding in DocOps Lab publications.
|
|
121
|
-
|
|
122
|
-
### Syntax Preferences
|
|
123
|
-
|
|
124
|
-
Use inline semantics liberally, even if you only insert the heavier syntax on a second or third pass.
|
|
125
|
-
|
|
126
|
-
Formatting with simple `*`, `_`, and ``` characters on first drafting makes lots of sense — or even missing some of these altogether until the second pass.
|
|
127
|
-
|
|
128
|
-
But before you merge new text documents into your codebase, add role-based inline semantics wherever they are supported.
|
|
129
|
-
|
|
130
|
-
Let the reader know and make use of special text, most importantly any **verbatim inline text**.
|
|
131
|
-
|
|
132
|
-
Even if you are not ready to add such fine-grained tests to your pipeline, consider the value of having all your commands for a given runtime app labeled ahead of time (such as `.app-ruby`), and the advantage to the reader, as well.
|
|
133
|
-
|
|
134
|
-
## Block Syntax
|
|
135
|
-
|
|
136
|
-
### Block Semantics
|
|
137
|
-
|
|
138
|
-
Use semantic indicators deliberately.
|
|
139
|
-
|
|
140
|
-
The more you assert about a block of text you are writing, the better the placement and content of that block will be.
|
|
141
|
-
|
|
142
|
-
Semantic assertions reside in the source markup, which may convey means of interpreting that same data visually in the output, as an indication to the reader.
|
|
143
|
-
|
|
144
|
-
For instance, _warning_ admonitions should only deliver warning content, and the user should clearly see that a warning is interrupting the flow of the content in which it appears.
|
|
145
|
-
|
|
146
|
-
```asciidoc
|
|
147
|
-
[WARNING]
|
|
148
|
-
====
|
|
149
|
-
Avoid misusing or overusing admonition blocks.
|
|
150
|
-
====
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
Semantic notations in our source remind us to treat the content properly.
|
|
154
|
-
|
|
155
|
-
```asciidoc
|
|
156
|
-
[WARNING]
|
|
157
|
-
====
|
|
158
|
-
Avoid misusing or overusing admonition blocks.
|
|
159
|
-
This will be hypocritically violated throughout this guide.
|
|
160
|
-
====
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
True as it may be, the second sentence in that admonition should be removed from the block. It can either be its own block, or it can be allowed to fade into the surrounding content.
|
|
164
|
-
|
|
165
|
-
Sometimes the entire admonition may end up deserving this treatment.
|
|
166
|
-
|
|
167
|
-
### Use Delimited Blocks
|
|
168
|
-
|
|
169
|
-
Generally, use explicit boundary lines to wrap significant blocks, rather than relying on other syntax cues to establish the “type” of block is intended. These lines are called [_linewise delimiters_](https://docs.asciidoctor.org/asciidoc/latest/blocks/delimited/#linewise-delimiters).
|
|
170
|
-
|
|
171
|
-
For example, use the following syntax to wrap the contents of an admonition block:
|
|
172
|
-
|
|
173
|
-
Example 1. Example admonition block syntax with linewise delimiter
|
|
174
|
-
|
|
175
|
-
```asciidoc
|
|
176
|
-
[NOTE]
|
|
177
|
-
====
|
|
178
|
-
The content of an admonition block should be sandwiched between `====` lines.
|
|
179
|
-
Use one-sentence-per-line even in admonitions.
|
|
180
|
-
====
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
The standard linewise delimiters for various AsciiDoc blocks are as follows:
|
|
184
|
-
|
|
185
|
-
<table>
|
|
186
|
-
<tr>
|
|
187
|
-
<td class="hdlist1">
|
|
188
|
-
<code>====</code>
|
|
189
|
-
</td>
|
|
190
|
-
<td class="hdlist2">
|
|
191
|
-
<p>For <em>admonitions</em> and <em>examples</em></p>
|
|
192
|
-
</td>
|
|
193
|
-
</tr>
|
|
194
|
-
<tr>
|
|
195
|
-
<td class="hdlist1">
|
|
196
|
-
<code>----</code>
|
|
197
|
-
</td>
|
|
198
|
-
<td class="hdlist2">
|
|
199
|
-
<p>For code listing (verbatim) blocks</p>
|
|
200
|
-
</td>
|
|
201
|
-
</tr>
|
|
202
|
-
<tr>
|
|
203
|
-
<td class="hdlist1">
|
|
204
|
-
<code>....</code>
|
|
205
|
-
</td>
|
|
206
|
-
<td class="hdlist2">
|
|
207
|
-
<p>For literal (verbatim) blocks</p>
|
|
208
|
-
</td>
|
|
209
|
-
</tr>
|
|
210
|
-
<tr>
|
|
211
|
-
<td class="hdlist1">
|
|
212
|
-
<code> **** </code>
|
|
213
|
-
</td>
|
|
214
|
-
<td class="hdlist2">
|
|
215
|
-
<p>For sidebar blocks</p>
|
|
216
|
-
</td>
|
|
217
|
-
</tr>
|
|
218
|
-
<tr>
|
|
219
|
-
<td class="hdlist1">
|
|
220
|
-
<code>|===</code>
|
|
221
|
-
</td>
|
|
222
|
-
<td class="hdlist2">
|
|
223
|
-
<p>For tables</p>
|
|
224
|
-
</td>
|
|
225
|
-
</tr>
|
|
226
|
-
<tr>
|
|
227
|
-
<td class="hdlist1">
|
|
228
|
-
<code> ____ </code>
|
|
229
|
-
</td>
|
|
230
|
-
<td class="hdlist2">
|
|
231
|
-
<p>For quote blocks</p>
|
|
232
|
-
</td>
|
|
233
|
-
</tr>
|
|
234
|
-
<tr>
|
|
235
|
-
<td class="hdlist1">
|
|
236
|
-
<code>++++</code>
|
|
237
|
-
</td>
|
|
238
|
-
<td class="hdlist2">
|
|
239
|
-
<p>For raw/passthrough blocks</p>
|
|
240
|
-
</td>
|
|
241
|
-
</tr>
|
|
242
|
-
<tr>
|
|
243
|
-
<td class="hdlist1">
|
|
244
|
-
<code>--</code>
|
|
245
|
-
</td>
|
|
246
|
-
<td class="hdlist2">
|
|
247
|
-
<p>For open blocks</p>
|
|
248
|
-
</td>
|
|
249
|
-
</tr>
|
|
250
|
-
</table>
|
|
251
|
-
|
|
252
|
-
For code listings, literals, or really any block that might contain text that could be confused with the delimiter, vary the length by using a greater number of delimiter characters on the _outer_ block.
|
|
253
|
-
|
|
254
|
-
Example “example” block containing an admonition block
|
|
255
|
-
|
|
256
|
-
```asciidoc
|
|
257
|
-
[example]
|
|
258
|
-
========
|
|
259
|
-
[NOTE]
|
|
260
|
-
====
|
|
261
|
-
This is an example block containing an admonition block.
|
|
262
|
-
====
|
|
263
|
-
========
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
#### Exception: Brief admonitions
|
|
267
|
-
|
|
268
|
-
Some blocks do not require delimiters. In cases of _repeated_, _nearly identical_ blocks, containing just one line of content, you can use the _single-line_ syntax where it is available.
|
|
269
|
-
|
|
270
|
-
Example single-line admonition block syntax
|
|
271
|
-
|
|
272
|
-
```asciidoc
|
|
273
|
-
NOTE: This is a single-line admonition block.
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
<dl>
|
|
277
|
-
<dt class="hdlist1">Exception to this exception</dt>
|
|
278
|
-
<dd>
|
|
279
|
-
We do not recommend the same-line syntax for admonition blocks other than `NOTE` and `TIP`. For `IMPORTANT`, `CAUTION`, and `WARNING`, use at least the 2-line syntax, if not explicit delimiters.
|
|
280
|
-
|
|
281
|
-
```asciidoc
|
|
282
|
-
[IMPORTANT]
|
|
283
|
-
This is a critical notice, but it's not warning you of danger.
|
|
284
|
-
```
|
|
285
|
-
</dd>
|
|
286
|
-
</dl>
|
|
287
|
-
|
|
288
|
-
#### Exception: Single-line terminal commands
|
|
289
|
-
|
|
290
|
-
Another common case is 1-line terminal commands, for which this guide recommends using a literal block with a `prompt` role added.
|
|
291
|
-
|
|
292
|
-
```asciidoc
|
|
293
|
-
[.prompt]
|
|
294
|
-
echo "Hello, world!"
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
The single preceding space notation affirms the use of a literal block for any consecutive lines of content preceded by a single space. For multi-line terminal commands/output, use the `….` syntax to distinguish the block.
|
|
298
|
-
|
|
299
|
-
#### Exception to the exceptions
|
|
300
|
-
|
|
301
|
-
Whenever additional options must be set for a block, such as a title or role, use the linewise delimiter syntax — even in one-liner cases.
|
|
302
|
-
|
|
303
|
-
```asciidoc
|
|
304
|
-
[.prompt,subs="+attributes"]
|
|
305
|
-
....
|
|
306
|
-
echo "Hello, {what}!"
|
|
307
|
-
....
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
### Example Blocks
|
|
311
|
-
|
|
312
|
-
Use example blocks liberally. If something fits the description of being an example — especially if the words “example” or “sample” are used in the title, caption, or surrounding text referring to a given block of _anything_… then **wrap it in an example block**.
|
|
313
|
-
|
|
314
|
-
Instances of the following block types may commonly be instances of examples, and just as commonly they may not be.
|
|
315
|
-
|
|
316
|
-
- figures (diagrams, illustrations, screenshots)
|
|
317
|
-
|
|
318
|
-
- tables
|
|
319
|
-
|
|
320
|
-
- code listings
|
|
321
|
-
|
|
322
|
-
- literal blocks (sample prompts, logs, etc)
|
|
323
|
-
|
|
324
|
-
- rich-text snippets (rendered results, a user story, etc)
|
|
325
|
-
|
|
326
|
-
Whenever any such instances _are examples_, prepend and append them with example blocks, and prefer to title them at the exampple-block level rather than the inner-content level.
|
|
327
|
-
|
|
328
|
-
Example of a code block treated as an example
|
|
329
|
-
|
|
330
|
-
```asciidoc
|
|
331
|
-
:example-caption: Example
|
|
332
|
-
|
|
333
|
-
.require statement in Ruby
|
|
334
|
-
====
|
|
335
|
-
[source,ruby]
|
|
336
|
-
----
|
|
337
|
-
require 'jekyll'
|
|
338
|
-
----
|
|
339
|
-
====
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
### Attribute Formatting
|
|
343
|
-
|
|
344
|
-
AsciiDoc attributes are often used to store reusable matter. In certain contexts, attributes should follow a formatting convention that makes them easier to name and recall.
|
|
345
|
-
|
|
346
|
-
For a complete guidance on attribute naming and usage, see [DocOps Lab AsciiDoc Attributes Naming and Usage](/docs/asciidoc-attributes/).
|
|
347
|
-
|
|
348
|
-
#### URL Attributes
|
|
349
|
-
|
|
350
|
-
Format URL-storing attributes like so:
|
|
351
|
-
|
|
352
|
-
```asciidoc
|
|
353
|
-
:syntax_area_descriptive-slug_form:
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
Where:
|
|
357
|
-
|
|
358
|
-
- `syntax_` is one of
|
|
359
|
-
|
|
360
|
-
- `area_` is a component or category like `docs_` or `pages_`, mainly to ensure unique slugs across divisions
|
|
361
|
-
|
|
362
|
-
- `form` is the way the resource is presented:
|
|
363
|
-
|
|
364
|
-
Examples
|
|
365
|
-
|
|
366
|
-
```asciidoc
|
|
367
|
-
:docopslab_src_www_url: https://github.com/DocOps
|
|
368
|
-
:href_docopslab_aylstack_url: {docopslab_src_www_url}/aylstack/
|
|
369
|
-
:href_docopslab_aylstack_link: link:{href_docopslab_aylstack_url}[AYL DocStack]
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
## Vale Configuration and Usage
|
|
373
|
-
|
|
374
|
-
Vale configuration and styles are managed in coordination with the link:`docopslab-dev` gem.
|
|
375
|
-
|
|
376
|
-
Our implementation of Vale allows for local project overrides while maintaining a centralized database of styles.
|
|
377
|
-
|
|
378
|
-
Linting for documentation quality and consistency, both AsciiDoc markup syntax and prose quality/correctness.
|
|
379
|
-
|
|
380
|
-
This tool provides a custom styles package and a modified configuration system, enabling multi-file merging.
|
|
381
|
-
|
|
382
|
-
<dl>
|
|
383
|
-
<dt class="hdlist1">Base config</dt>
|
|
384
|
-
<dd>
|
|
385
|
-
`.config/.vendor/docopslab/vale.ini` (from source)
|
|
386
|
-
</dd>
|
|
387
|
-
<dt class="hdlist1">Project config</dt>
|
|
388
|
-
<dd>
|
|
389
|
-
`.config/vale.local.ini` (inherits via `BasedOnStyles`)
|
|
390
|
-
</dd>
|
|
391
|
-
<dt class="hdlist1">Ephemeral config</dt>
|
|
392
|
-
<dd>
|
|
393
|
-
`.config/vale.ini` (merged from base and target)
|
|
394
|
-
</dd>
|
|
395
|
-
<dt class="hdlist1">Sync command</dt>
|
|
396
|
-
<dd>
|
|
397
|
-
`bundle exec rake labdev:sync:vale`
|
|
398
|
-
</dd>
|
|
399
|
-
</dl>
|
|
400
|
-
|
|
401
|
-
## Consumer Mode (Other Projects)
|
|
402
|
-
|
|
403
|
-
For all other projects, the gem works in a standard package consumption mode:
|
|
404
|
-
|
|
405
|
-
- The project’s `vale.ini` should list all desired packages, including a URL to the stable, published `DocOpsLabStyles.zip`.
|
|
406
|
-
|
|
407
|
-
- The `labdev:sync:styles` task simply runs `vale sync` in the proper context, downloading all listed packages into a local `.vale/styles` directory.
|
|
408
|
-
|
|
409
|
-
> **TIP:** The `labdev:sync:vale` task updates both the base config and the style packages.
|
|
410
|
-
|
|
411
|
-
A project’s `.config/vale.local.ini` should look something like the one for this repository (DocOps/lab).
|
|
412
|
-
|
|
413
|
-
A snippet from DocOps/lab’s `.config/vale.local.ini`
|
|
414
|
-
|
|
415
|
-
```ini
|
|
416
|
-
MinAlertLevel = warning
|
|
417
|
-
StylesPath = .vendor/vale/styles
|
|
418
|
-
|
|
419
|
-
[asciidoctor]
|
|
420
|
-
missing-attribute = drop
|
|
421
|
-
safe = unsafe
|
|
422
|
-
experimental = YES
|
|
423
|
-
|
|
424
|
-
[_blog/*.adoc]
|
|
425
|
-
DocOpsLab-AsciiDoc.ExplicitSectionIDs = NO
|
|
426
|
-
|
|
427
|
-
[_docs/agent/**/*.adoc]
|
|
428
|
-
DocOpsLab-AsciiDoc.ExplicitSectionIDs = NO
|
|
429
|
-
DocOpsLab-AsciiDoc.ExtraLineBeforeLevel1 = NO
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
This dual-mode system provides a robust workflow for both developing and consuming the centralized Vale styles.
|
|
433
|
-
|
|
434
|
-
> **NOTE:** For full Vale configuration settings (“keys”) reference, see the [official Vale documentation](https://vale.sh/docs/vale-ini).
|
|
435
|
-
> **NOTE:** For information on managing DocOps Lab’s Vale styles, see [the `docopslab-dev` gem README](https://github.com/DocOps/lab/blob/main/gems/docopslab-dev/README.adoc).
|
|
436
|
-
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
# Bash CLI Development for Agents
|
|
2
|
-
|
|
3
|
-
This document is intended for AI agents operating within a DocOps Lab environment.
|
|
4
|
-
|
|
5
|
-
> **TIP:** Use this guide in combination with the general Bash coding skill.
|
|
6
|
-
|
|
7
|
-
Table of Contents
|
|
8
|
-
|
|
9
|
-
- Bash CLIs
|
|
10
|
-
- Bash CLI Model
|
|
11
|
-
- General CLI Principles
|
|
12
|
-
- When NOT to Use a CLI
|
|
13
|
-
- Semantic CLI Namespaces
|
|
14
|
-
- General CLI Conventions
|
|
15
|
-
|
|
16
|
-
## Bash CLIs
|
|
17
|
-
|
|
18
|
-
Bash scripts are often used for simple CLIs that wrap around more complex operations. Most repo-wide chores that do not require specialized Ruby-based tools like Asciidoctor or other gems are handled with Bash scripts (The significant exception to this are multi-repo libraries like the [DocOps Lab Devtool](/docs/lab-dev-setup/).)
|
|
19
|
-
|
|
20
|
-
The one truly major Bash CLI we maintain is `docksh`, our Docker shell utility for launching properly configured containers for development, testing, and deployment (sourced in `box`).
|
|
21
|
-
|
|
22
|
-
### Bash CLI Model
|
|
23
|
-
|
|
24
|
-
Base CLIs are relatively open ended. Developers should consider how the script might change, but unless it is intended to be elaborate from the start, there is not much reason to fuss over complicated structures.
|
|
25
|
-
|
|
26
|
-
> **TIP:** See [DocOps Lab Bash Coding Guide](/docs/bash-styles/) for details about implementing Bash CLIs.
|
|
27
|
-
|
|
28
|
-
Let’s examine our typical Bash script CLI structure:
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
./bashscript.sh [arguments] [options]
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
If a Bash script is likely to eventually need to encompass multiple arguments or options, consider making it a Rake task and invoking Ruby scripts, instead.
|
|
35
|
-
|
|
36
|
-
## General CLI Principles
|
|
37
|
-
|
|
38
|
-
Most of our user-facing applications are Ruby gems, and most of those are intended to be used via three primary interfaces:
|
|
39
|
-
|
|
40
|
-
1. An application specific, openly designed CLI utility.
|
|
41
|
-
|
|
42
|
-
2. An application configuration file.
|
|
43
|
-
|
|
44
|
-
3. Subject-matter content or domain-specific data of some kind.
|
|
45
|
-
|
|
46
|
-
By way of these three interfaces, users can operate the application in a way that is optimized for their particular use case.
|
|
47
|
-
|
|
48
|
-
CLIs should allow for runtime configuration overrides and even runtime content/data overrides. But most of all they should focus on conveniently putting power in users' hands.
|
|
49
|
-
|
|
50
|
-
This means leaving the CLI model open to the task at hand, but it also means adhering to some conventions that apply generally to both Ruby and Bash CLIs.
|
|
51
|
-
|
|
52
|
-
### When NOT to Use a CLI
|
|
53
|
-
|
|
54
|
-
Even when an application offers a mature, well-designed CLI, there are times when either an application programming interface (API) or a domain-specific language (DSL) is preferable. Typically we want to keep complicated shell commands out of core products and CI/CD pipelines, in favor of native or RESTful APIs or else config-driven or DSL-driven utilities.
|
|
55
|
-
|
|
56
|
-
### Semantic CLI Namespaces
|
|
57
|
-
|
|
58
|
-
When designing CLIs, consider the namespaces of the elements we use: subcommands, arguments, and options/flags.
|
|
59
|
-
|
|
60
|
-
Subcommands should be verbs or nouns that declare operations or contexts. At each position, these elements should be organizable into meaningful categories.
|
|
61
|
-
|
|
62
|
-
Arguments should be meaningful nouns that represent the primary _subject or subjects_ of the command.
|
|
63
|
-
|
|
64
|
-
### General CLI Conventions
|
|
65
|
-
|
|
66
|
-
The definitive reference on CLI design is the [CLI Guidelines](https://clig.dev/) project.
|
|
67
|
-
|
|
68
|
-
#### Option format
|
|
69
|
-
|
|
70
|
-
<dl>
|
|
71
|
-
<dt class="hdlist1">Use spaces rather than `=` to assign values to options.</dt>
|
|
72
|
-
<dd>
|
|
73
|
-
Flag forms such as `--option-name value` are preferred over `--option-name=value`.
|
|
74
|
-
</dd>
|
|
75
|
-
<dt class="hdlist1">Provide long- and short- form flag aliases for common options.</dt>
|
|
76
|
-
<dd>
|
|
77
|
-
For ex: `-h` and `--help`, `-c` and `--config`.
|
|
78
|
-
</dd>
|
|
79
|
-
<dt class="hdlist1">Use `--no-` prefix for negated boolean flags when applicable.</dt>
|
|
80
|
-
<dd>
|
|
81
|
-
For ex: `--no-cache` to disable caching.
|
|
82
|
-
</dd>
|
|
83
|
-
</dl>
|
|
84
|
-
|
|
85
|
-
#### Command structure
|
|
86
|
-
|
|
87
|
-
<dl>
|
|
88
|
-
<dt class="hdlist1">Use subcommand only with apps that perform categorically diverse operations,</dt>
|
|
89
|
-
<dd>
|
|
90
|
-
Prefer flag combinations when possible. Subcommands signal a shift in execution context, and thus they can be greatly helpful when needed. Otherwise, reserve the first argument slot for something a meaningful arbitrary argument.
|
|
91
|
-
|
|
92
|
-
A CLI with very handy subcommands
|
|
93
|
-
|
|
94
|
-
```
|
|
95
|
-
git fetch
|
|
96
|
-
git commmit
|
|
97
|
-
git merge
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
No subcommand needed
|
|
101
|
-
|
|
102
|
-
```
|
|
103
|
-
rhx 1.2.1 --config test-config.yml --mapping apis/jira.yml --verbose --fetch --yaml
|
|
104
|
-
rhx 1.2.1 --config test-config.yml --html
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
And yes, of course you can combine fixed subcommands with arbitrary arguments.
|
|
108
|
-
|
|
109
|
-
```
|
|
110
|
-
git diff README.adoc
|
|
111
|
-
```
|
|
112
|
-
</dd>
|
|
113
|
-
<dt class="hdlist1">Avoid using Unix-style argument structures.</dt>
|
|
114
|
-
<dd>
|
|
115
|
-
Arbitrary arguments should come _before_ options, even if that is counter-intuitive. Typically in our apps, users are modifying commands that get executed on the same target, so if the target is an arbitrary file path or version number, it should closely follow the command as an early argument.
|
|
116
|
-
|
|
117
|
-
Preferred argument order
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
cliname targetfile --option1 value1 --option2 value2 --verbose --force
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
This structure lets users more conveniently change the parts of the command-line that will need more frequent changing.
|
|
124
|
-
</dd>
|
|
125
|
-
<dt class="hdlist1">Accommodate Unix-style CLIs by adding named options for every arbitrary argument supported.</dt>
|
|
126
|
-
<dd>
|
|
127
|
-
The trick is to enable those cases where the subject path or code _is_ what gets changed most often.
|
|
128
|
-
|
|
129
|
-
```
|
|
130
|
-
rhx --yaml --version 1.2.6
|
|
131
|
-
rhx --yaml --version 1.3.1
|
|
132
|
-
```
|
|
133
|
-
</dd>
|
|
134
|
-
</dl>
|
|
135
|
-
|