docopslab-dev 0.1.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.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.adoc +904 -0
  4. data/assets/config-packs/actionlint/base.yml +13 -0
  5. data/assets/config-packs/actionlint/project.yml +13 -0
  6. data/assets/config-packs/htmlproofer/base.yml +27 -0
  7. data/assets/config-packs/htmlproofer/project.yml +25 -0
  8. data/assets/config-packs/rubocop/base.yml +130 -0
  9. data/assets/config-packs/rubocop/project.yml +8 -0
  10. data/assets/config-packs/shellcheck/base.shellcheckrc +14 -0
  11. data/assets/config-packs/subtxt/ai-asciidoc-antipatterns.sub.txt +11 -0
  12. data/assets/config-packs/vale/asciidoc/ExplicitSectionIDs.yml +8 -0
  13. data/assets/config-packs/vale/asciidoc/ExtraLineBeforeLevel1.yml +7 -0
  14. data/assets/config-packs/vale/asciidoc/OneSentencePerLine.yml +8 -0
  15. data/assets/config-packs/vale/asciidoc/PreferSourceBlocks.yml +8 -0
  16. data/assets/config-packs/vale/asciidoc/ProperAdmonitions.yml +8 -0
  17. data/assets/config-packs/vale/asciidoc/ProperDLs.yml +7 -0
  18. data/assets/config-packs/vale/asciidoc/UncleanListStart.yml +8 -0
  19. data/assets/config-packs/vale/authoring/ButParagraph.yml +8 -0
  20. data/assets/config-packs/vale/authoring/ExNotEg.yml +8 -0
  21. data/assets/config-packs/vale/authoring/LiteralTerms.yml +20 -0
  22. data/assets/config-packs/vale/authoring/Spelling.yml +679 -0
  23. data/assets/config-packs/vale/base.ini +38 -0
  24. data/assets/config-packs/vale/config/scripts/ExplicitSectionIDs.tengo +56 -0
  25. data/assets/config-packs/vale/config/scripts/ExtraLineBeforeLevel1.tengo +121 -0
  26. data/assets/config-packs/vale/config/scripts/OneSentencePerLine.tengo +53 -0
  27. data/assets/config-packs/vale/project.ini +5 -0
  28. data/assets/hooks/pre-commit +63 -0
  29. data/assets/hooks/pre-push +72 -0
  30. data/assets/scripts/adoc_section_ids.rb +50 -0
  31. data/assets/scripts/build-common.sh +193 -0
  32. data/assets/scripts/build-docker.sh +64 -0
  33. data/assets/scripts/build.sh +56 -0
  34. data/assets/scripts/parse_jekyll_asciidoc_logs.rb +467 -0
  35. data/assets/templates/Gemfile +7 -0
  36. data/assets/templates/Rakefile +3 -0
  37. data/assets/templates/gitignore +69 -0
  38. data/assets/templates/jekyll-asciidoc-fix.prompt.yml +17 -0
  39. data/assets/templates/spellcheck.prompt.yml +16 -0
  40. data/docopslab-dev.gemspec +56 -0
  41. data/docs/agent/AGENTS.md +229 -0
  42. data/docs/agent/index.md +80 -0
  43. data/docs/agent/missions/conduct-release.md +224 -0
  44. data/docs/agent/missions/setup-new-project.md +250 -0
  45. data/docs/agent/roles/devops-release-engineer.md +152 -0
  46. data/docs/agent/roles/docops-engineer.md +193 -0
  47. data/docs/agent/roles/planner-architect.md +74 -0
  48. data/docs/agent/roles/product-engineer.md +153 -0
  49. data/docs/agent/roles/product-manager.md +130 -0
  50. data/docs/agent/roles/project-manager.md +139 -0
  51. data/docs/agent/roles/qa-testing-engineer.md +115 -0
  52. data/docs/agent/roles/tech-docs-manager.md +143 -0
  53. data/docs/agent/roles/tech-writer.md +163 -0
  54. data/docs/agent/skills/asciidoc.md +609 -0
  55. data/docs/agent/skills/code-commenting.md +347 -0
  56. data/docs/agent/skills/fix-broken-links.md +309 -0
  57. data/docs/agent/skills/fix-jekyll-asciidoc-build-errors.md +23 -0
  58. data/docs/agent/skills/fix-spelling-issues.md +13 -0
  59. data/docs/agent/skills/git.md +170 -0
  60. data/docs/agent/skills/github-issues.md +135 -0
  61. data/docs/agent/skills/product-release-rollback-and-patching.md +71 -0
  62. data/docs/agent/skills/rake-cli-dev.md +57 -0
  63. data/docs/agent/skills/readme-driven-dev.md +13 -0
  64. data/docs/agent/skills/release-history.md +29 -0
  65. data/docs/agent/skills/ruby.md +192 -0
  66. data/docs/agent/skills/schemagraphy-sgyml.md +18 -0
  67. data/docs/agent/skills/tests-running.md +25 -0
  68. data/docs/agent/skills/tests-writing.md +45 -0
  69. data/docs/agent/skills/write-the-docs.md +54 -0
  70. data/docs/agent/topics/common-project-paths.md +117 -0
  71. data/docs/agent/topics/dev-tooling-usage.md +202 -0
  72. data/docs/agent/topics/devops-ci-cd.md +55 -0
  73. data/docs/agent/topics/product-docs-deployment.md +25 -0
  74. data/lib/docopslab/dev/auto_fix_asciidoc.rb +46 -0
  75. data/lib/docopslab/dev/checkers.rb +108 -0
  76. data/lib/docopslab/dev/config_manager.rb +241 -0
  77. data/lib/docopslab/dev/file_utils.rb +140 -0
  78. data/lib/docopslab/dev/git_hooks.rb +140 -0
  79. data/lib/docopslab/dev/help.rb +121 -0
  80. data/lib/docopslab/dev/initializer.rb +95 -0
  81. data/lib/docopslab/dev/linters.rb +451 -0
  82. data/lib/docopslab/dev/log_parser.rb +31 -0
  83. data/lib/docopslab/dev/paths.rb +46 -0
  84. data/lib/docopslab/dev/script_manager.rb +136 -0
  85. data/lib/docopslab/dev/spell_check.rb +194 -0
  86. data/lib/docopslab/dev/sync_ops.rb +468 -0
  87. data/lib/docopslab/dev/tasks.rb +440 -0
  88. data/lib/docopslab/dev/tool_execution.rb +68 -0
  89. data/lib/docopslab/dev/version.rb +8 -0
  90. data/lib/docopslab/dev.rb +392 -0
  91. data/specs/data/default-manifest.yml +64 -0
  92. data/specs/data/manifest-schema.yaml +63 -0
  93. data/specs/data/tasks-def.yml +321 -0
  94. data/specs/data/tools.yml +60 -0
  95. metadata +362 -0
data/README.adoc ADDED
@@ -0,0 +1,904 @@
1
+ = DocOps Lab Dev Tooling
2
+ :toc: macro
3
+ :toclevels: 2
4
+ // tag::globals[]
5
+ :vale_off: pass:[<!-- vale off -->]
6
+ :vale_on: pass:[<!-- vale on -->]
7
+ :docopslab_hub_url: https://github.com/DocOps
8
+ :docopslab_lab_hub_base_url: {docopslab_hub_url}/lab
9
+ :project_manifest_path: .config/docopslab-dev.yml
10
+ // end::globals[]
11
+
12
+ Internal development tooling for working on DocOps Lab codebases.
13
+
14
+ // tag::docopsbox[]
15
+ [IMPORTANT]
16
+ ====
17
+ The environment described and provided here is _not_ optimized for DocOps Lab _applications_ used in third-party projects.
18
+ For your own applications of DocOps Labs products like ReleaseHx and Issuer, see link:https://github.com/DocOps/box[DocOps Box] for a full-featured docs-focused workspace, runtime, and production environment.
19
+ ====
20
+ // end::docopsbox[]
21
+
22
+ toc::[]
23
+
24
+ [NOTE]
25
+ This codebase is nested within the link:https://github.com/DocOps/lab[DocOps Lab monorepo (`DocOps/lab`)] at `gems/docopslab-dev/` as it is closely tied to the documentation and development resources centralized there.
26
+
27
+
28
+ [[purpose]]
29
+ == Purpose
30
+ // tag::purpose[]
31
+ The `docopslab-dev` gem provides centralized configuration management, linting, and development workflows across DocOps Lab repositories.
32
+
33
+ This gem mainly provides `Rakefile` extensions and common assets like scripts, configuration files, styles packages, and git hooks.
34
+ // end::purpose[]
35
+
36
+
37
+ [[features]]
38
+ == Features
39
+ // tag::features[]
40
+ Focused development tooling::
41
+ Centralized code quality, analysis, and linting tools (RuboCop, Vale, ShellCheck, etc.)
42
+
43
+ Unified Rake tasks::
44
+ Consistent `labdev:*` tasks across all repos
45
+
46
+ Scripts management::
47
+ Common scripts synchronized across projects
48
+
49
+ Config pack synchronization::
50
+ Centralized configuration management for all development tools
51
+
52
+ Git hooks management::
53
+ Automated pre-commit linting and validation with interactive updates
54
+
55
+ Docker image::
56
+ Completely containerized docopslab-dev environment without local installation
57
+ // end::features[]
58
+
59
+
60
+ [[setup]]
61
+ == Setup
62
+ // tag::setup[]
63
+ If this is _your first time using_ `docopslab-dev` on a given workstation, you will need to ensure the <<prerequisites,prerequisites>> are met.
64
+
65
+ If you have the prerequisites and are just getting started with _a given DocOps Lab project_, you should be ready after <<init-sync>>.
66
+
67
+ If you are initializing `docopslab-dev` in an new project, you will also need to initialize the environment.
68
+
69
+ [[prerequisites]]
70
+ === Prerequisites
71
+ // tag::prerequisites[]
72
+ There are three ways to prepare the necessary dependencies and runtimes.
73
+
74
+ If you are already a Ruby user, Option 1 is likely for you.
75
+ Otherwise, Option 2 is strongly recommended, at least for getting started quickly.
76
+
77
+ [[setup-native]]
78
+ === Option 1: Native Installations
79
+
80
+ Ruby & Bundler::
81
+ * Ruby 3.2+ with Bundler installed natively
82
+ * `gem 'docopslab-dev' in `Gemfile`
83
+ * All Ruby gems managed via `bundle install`
84
+
85
+ Vale::
86
+ * `brew install vale` (macOS)
87
+ * `apt install vale` (Ubuntu/Debian)
88
+ * `dnf install vale` (Fedora)
89
+ * If not installed, `vale` operations will fallback to Docker execution
90
+
91
+ Asciidoctor (to support Vale)::
92
+ * installed globally
93
+ ** `gem install asciidoctor` or
94
+ ** `npm i -g asciidoctor` or
95
+ ** natively installed through your system's package manager
96
+ * Test with `asciidoctor --version`
97
+
98
+ ShellCheck::
99
+ * `brew install shellcheck` (macOS)
100
+ * `apt install shellcheck` (Ubuntu/Debian)
101
+ * `dnf install shellcheck` (Fedora)
102
+ * If not installed, `shellcheck` operations will fallback to Docker execution
103
+
104
+ actionlint::
105
+ * `brew install actionlint` (macOS)`
106
+ * `go install github.com/rhysd/actionlint/cmd/actionlint@latest` (Go 1.16 or later)
107
+ * Otherwise see link:https://github.com/rhysd/actionlint/blob/v1.7.7/docs/install.md[install guide].
108
+ * If not installed, `actionlint` operations will fallback to Docker execution
109
+
110
+ [[setup-docker-only]]
111
+ === Option 2: Full Docker Environment
112
+
113
+ * All tools available, via `docopslab/dev` image
114
+ * No native Ruby installation required
115
+ * You'll need Docker installed::
116
+ // tag::docker-installs[]
117
+ ** link:https://docs.docker.com/desktop/setup/install/mac-install/[Docker Desktop on MacOs]
118
+ ** link:https://docs.docker.com/desktop/features/wsl/[Docker Desktop with WSL2 on Windows]
119
+ ** link:https://docs.docker.com/engine/install/[Docker Engine on Linux]
120
+ // end::docker-installs[]
121
+ * Install with `docker pull docopslab/dev`
122
+
123
+ The `docopslab/dev` image provides a complete development environment with Ruby, Vale, and all linting tools pre-installed.
124
+
125
+ Add an alias to your shell profile (`~/.bashrc`, `~/.zshrc`, etc.) to make Docker usage easier:
126
+
127
+ [source,bash]
128
+ ----
129
+ alias lab-dev='docker run -it --rm -v "$(pwd):/workspace" docopslab/dev'
130
+ ----
131
+
132
+ Now `lab-dev` replaces the full Docker command and causes insertion of `bundle exec` for `rake` or `labdev:` commands.
133
+
134
+ [[setup-ruby-docker]]
135
+ === Option 3: Ruby with Docker fallback
136
+
137
+ * Ruby & Bundler + `Gemfile` as in <<setup-native,Option 1>>
138
+ * Vale and other non-Ruby services run via Docker if not installed locally as in <<setup-docker-only,Option 2>>
139
+ * All `labdev:` rake tasks that use non-Ruby dependencies will attempt native execution first, then fall back to Docker if the tool is not found or is found to be the wrong version.
140
+ // end::prerequisites[]
141
+
142
+ [[initialize-sync]]
143
+ === Initialize or Sync
144
+
145
+ Once <<prerequisites,dependencies are installed>>, the development environment _may_ need to be initialized and _must_ be synced, between your local instance and source assets.
146
+
147
+ Assuming you are not initializing a new project, you can skip to <<environment-synchronization>>.
148
+
149
+ [[project-initialization]]
150
+ === Project Initialization
151
+
152
+ If you are introducing `docopslab-dev` to an existing project, you first need to integrate and initialize it.
153
+
154
+ . Add `docopslab-dev` to the project's `Gemfile`.
155
+ +
156
+ [source,ruby]
157
+ ----
158
+ group :development do
159
+ gem 'docopslab-dev'
160
+ end
161
+ ----
162
+
163
+ . Install the gem.
164
+ +
165
+ [.prompt]
166
+ bundle install
167
+
168
+ . Add `require 'docopslab/dev'` to the top of the project's `Rakefile`.
169
+ +
170
+ [NOTE]
171
+ A project lacking any configuration files can now be initialized.
172
+
173
+ . Use `bundle exec rake labdev:check` to ensure the project environment is aligned.
174
+
175
+ . Initialize the development environment
176
+ +
177
+ [.prompt]
178
+ bundle exec rake labdev:init:all
179
+
180
+ The `init` task creates `{project_manifest_path}` and default project configs for all tools.
181
+ This file should be Git tracked for the project.
182
+
183
+ Initialization also performs environment synchronization.
184
+
185
+ [[environment-synchronization]]
186
+ === Environment Synchronization
187
+
188
+ This process is part of the `init` operation, but on its own it ensures local configs and assets are up to date with their source templates.
189
+
190
+ .Install the dependencies (if not done already)
191
+ [.prompt]
192
+ bundle install
193
+
194
+ .Sync configuration files
195
+ [.prompt]
196
+ bundle exec rake labdev:sync:all
197
+ // end::setup[]
198
+
199
+
200
+ [[using]]
201
+ == Using the Library
202
+ // tag::usage[]
203
+ // tag::standard-usage[]
204
+ This gem mainly supplies rake tasks for performing common development operations across unified configurations and sub-libraries.
205
+
206
+ [[standard-usage]]
207
+ === Standard Usage
208
+
209
+ .Run all linters
210
+ [.prompt]
211
+ bundle exec rake labdev:lint:all
212
+
213
+ .Auto-fix safe issues
214
+ [.prompt]
215
+ bundle exec rake labdev:heal
216
+
217
+ // end::standard-usage[]
218
+
219
+ [[docker-usage]]
220
+ === Docker Usage
221
+
222
+ The container runs with a base command of `/bin/bash` in interactive mode.
223
+ Any command you pass it will assume you are starting at a normal prompt, with the exception of `rake`, which will always convert to `bundle exec rake`.
224
+
225
+ Other Ruby commands will either need an explicit `lab-dev bundle exec` or may run without Bundler, like `asciidoctor` (globally installed for Vale availability) and `bundle` itself.
226
+ Non-Ruby commands like `vale` and `shellcheck` are immediately available.
227
+
228
+ .First time in a DocOps Lab project
229
+ [.prompt]
230
+ lab-dev rake labdev:sync:all
231
+
232
+ .Regular development workflow
233
+ lab-dev rake labdev:sync:all
234
+ lab-dev rake labdev:lint:all
235
+ lab-dev rake labdev:heal
236
+
237
+ .Irregular commands
238
+ lab-dev vale --config .config/vale.ini README.adoc
239
+ lab-dev bundle exec rubocop --config .config/rubocop.yml --only Style/StringLiterals
240
+ lab-dev asciidoctor -o tmp/docs.html README.adoc
241
+
242
+ .Interactive shell for debugging
243
+ [.prompt]
244
+ lab-dev
245
+
246
+ [NOTE]
247
+ ====
248
+ The Docker container persists gems on the host machine in the local `.bundle/` path for performance.
249
+ All tools use the host project's Gemfile for version consistency.
250
+ ====
251
+
252
+ [TIP]
253
+ ====
254
+ Make sure container-managed paths are not tracked in Git.
255
+ Add `.config/.vendor/` and `.bundle/` to `.gitignore`.
256
+ ====
257
+ // end::usage[]
258
+
259
+ See <<more-example-commands>> for additional common commands.
260
+
261
+ [[handy-devlab-tasks]]
262
+ === Handy `devlab` Tasks
263
+
264
+ .Lint only for AsciiDoc syntax issues
265
+ [.prompt]
266
+ bundle exec rake labdev:lint:adoc
267
+
268
+ .Lint only for prose/text issues
269
+ [.prompt]
270
+ bundle exec rake labdev:lint:text
271
+
272
+ .Lint for both text and markup issues
273
+ [.prompt]
274
+ bundle exec rake labdev:lint:docs
275
+
276
+ .Generate a spellcheck report
277
+ [.prompt]
278
+ bundle exec rake labdev:lint:spellcheck
279
+
280
+
281
+ [[configuration]]
282
+ == Configuration
283
+
284
+ The `docopslab-dev` gem itself is configured with a manifest file.
285
+ This manifest declares which tools are active and their integration settings.
286
+
287
+ Individual configs are maintained for all supported tools in each project codebase.
288
+
289
+ [[manifest-configuration]]
290
+ === Manifest Configuration
291
+ // tag::manifest-config[]
292
+ Initialization automatically creates `{project_manifest_path}`, which you can edit, or you can create it manually.
293
+
294
+ ifndef::site-gen-jekyll[]
295
+ See `specs/data/default-manifest.yml` for the default manifest structure.
296
+ endif::[]
297
+ ifdef::site-gen-jekyll[]
298
+ [source,yaml]
299
+ ----
300
+ include::specs/data/default-manifest.yml[]
301
+ ----
302
+ endif::[]
303
+
304
+ [[properties-ref]]
305
+ ==== Properties Reference
306
+
307
+ `tools`::
308
+ (Array) List of tool configurations to enable and manage.
309
+ Each entry may/must include:
310
+
311
+ `tool`:::
312
+ (Slug) Name of the tool, ex:, `rubocop`, `vale`, `htmlproofer`, `actionlint`, `shellcheck`.
313
+
314
+ `enabled`:::
315
+ (Boolean) Whether to enable this tool's tasks and git hooks.
316
+
317
+ `files`:::
318
+ List of files to init or sync for the tool.
319
+
320
+ `source`::::
321
+ Path within the gem where the base config is located, e.g., `config-packs/rubocop/base.yml`.
322
+
323
+ `target`::::
324
+ Path in the project where the file should be synced, e.g., `.config/.vendor/docopslab/rubocop.yml`.
325
+
326
+ `paths`:::
327
+ Repo=specific paths to include or exclude in linting operations for this tool.
328
+
329
+ `lint`::::
330
+ (Array) List of paths or glob patterns to lint with this tool.
331
+
332
+ `skip`::::
333
+ (Array) List of paths or glob patterns to exclude from linting with this tool.
334
+
335
+ `exts`::::
336
+ (Array) List of file extensions to include in linting with this tool.
337
+
338
+ `git_tracked_only`::::
339
+ (Boolean) Whether to limit linting to only Git-tracked files.
340
+
341
+
342
+ `docs`::
343
+ (Array) List of documentation files to sync from the gem to the target project.
344
+ Each entry includes:
345
+
346
+ `source`:::
347
+ (String) Source path relative to `lib/docopslab/` in the gem.
348
+ Supports glob patterns (e.g., `docs/agent/*.md`) or specific files.
349
+
350
+ `target`:::
351
+ (String) Target path relative to the project root.
352
+ Can be a directory (e.g., `_docs/`) or specific file path (e.g., `AGENTS.md`).
353
+
354
+ `synced`:::
355
+ (Boolean) Whether to update existing files on sync.
356
+ +
357
+ * `true` - Always overwrite on sync (keeps docs current with gem updates)
358
+ * `false` - Create once, preserve user customizations
359
+
360
+ [[documentation-syncing-examples]]
361
+ ==== Documentation Syncing Examples
362
+
363
+ .Customizable template (create once, allow modifications)
364
+ [source,yaml]
365
+ ----
366
+ docs:
367
+ - source: docs/AGENTS.md
368
+ target: AGENTS.md
369
+ synced: false
370
+ ----
371
+
372
+ .Auto-synced agent guides (keep current)
373
+ [source,yaml]
374
+ ----
375
+ docs:
376
+ - source: docs/agent/*.md
377
+ target: .docopslab-dev/agent/
378
+ synced: true
379
+ ----
380
+
381
+ .Mixed strategy (glob + specific override)
382
+ [source,yaml]
383
+ ----
384
+ docs:
385
+ - source: docs/agent/*.md
386
+ target: _docs/
387
+ synced: true
388
+ - source: docs/agent/ruby.md
389
+ target: _docs/styles/ruby-custom.md
390
+ synced: false
391
+ ----
392
+
393
+ // end::manifest-config[]
394
+
395
+ [[standardized-tooling-configs]]
396
+ === Standardized Tooling Configs
397
+
398
+ Configuration files follow a consistent inheritance pattern where project configs inherit from centrally managed base configs.
399
+
400
+ [[rubocop]]
401
+ ==== RuboCop
402
+ // tag::config-rubocop[]
403
+ Ruby code style and quality checking.
404
+
405
+ Base config:: `.config/.vendor/docopslab/rubocop.yml`
406
+ Project config:: `.config/rubocop.yml` (inherits via `inherit_from`)
407
+ Sync command:: `bundle exec rake labdev:sync:configs`
408
+
409
+ The base configuration provides DocOps Lab Ruby style standards.
410
+ Your project config can override any rule while maintaining consistency with the broader ecosystem.
411
+ // end::config-rubocop[]
412
+
413
+ [[vale]]
414
+ ==== Vale
415
+ // tag::config-vale[]
416
+ Linting for documentation quality and consistency, both AsciiDoc markup syntax and prose quality/correctness.
417
+
418
+ This tool provides a custom styles package and a modified configuration system, enabling multi-file merging.
419
+
420
+ Base config:: `.config/.vendor/docopslab/vale.ini` (from source)
421
+ Project config:: `.config/vale.local.ini` (inherits via `BasedOnStyles`)
422
+ Ephemeral config:: `.config/vale.ini` (merged from base and target)
423
+ Sync command:: `bundle exec rake labdev:sync:vale`
424
+
425
+ [[vale-consumer-mode]]
426
+ ===== Consumer Mode (Other Projects)
427
+
428
+ For all other projects, the gem works in a standard package consumption mode:
429
+
430
+ * The project's `vale.ini` should list all desired packages, including a URL to the stable, published `DocOpsLabStyles.zip`.
431
+ * The `labdev:sync:styles` task simply runs `vale sync` in the proper context, downloading all listed packages into a local `.vale/styles` directory.
432
+
433
+ [TIP]
434
+ The `labdev:sync:vale` task updates both the base config and the styles package.
435
+
436
+ The `.config/vale.ini` for consumer projects (based on the gem's template) should look like this:
437
+
438
+ [source,ini]
439
+ ----
440
+ # CONSUMER MODE CONFIG
441
+
442
+ StylesPath = .vale/styles
443
+
444
+ # List all packages, including the URL to the central DocOpsLabStyles package.
445
+ # TODO: Update with the real URL.
446
+ Packages = RedHat, proselint, write-good, https://example.com/path/to/DocOpsLabStyles.zip
447
+
448
+ [*.adoc]
449
+ BasedOnStyles = RedHat, DocOpsLab-Authoring, DocOpsLab-AsciiDoc
450
+ ----
451
+
452
+ This dual-mode system provides a robust workflow for both developing and consuming the centralized Vale styles.
453
+
454
+ [NOTE]
455
+ For full Vale configuration settings ("`keys`") reference, see link:https://vale.sh/docs/configuration[the Vale documentation].
456
+
457
+ // end::config-vale[]
458
+
459
+ [[htmlproofer]]
460
+ ==== HTMLProofer
461
+ // tag::config-htmlproofer[]
462
+ HTML validation for Jekyll sites and documentation builds.
463
+
464
+ Base config:: `.config/.vendor/docopslab/htmlproofer.yml`
465
+ Project config:: `.config/htmlproofer.yml`
466
+ Sync command:: `bundle exec rake labdev:sync:configs`
467
+ Enable in manifest:: Add `htmlproofer` tool with `enabled: true`
468
+
469
+ HTMLProofer validates links, images, and HTML structure in built sites.
470
+ Only enabled for projects that generate HTML output (Jekyll sites, etc.).
471
+
472
+ ifndef::site-gen-jekyll[]
473
+ Default base config is in `gems/docopslab-dev/assets/config-packs/htmlproofer/base.yml`.
474
+ endif::[]
475
+ ifdef::site-gen-jekyll[]
476
+ .Base HTMLProofer Configuration
477
+ [source,yaml]
478
+ ----
479
+ include::assets/config-packs/htmlproofer/base.yml[]
480
+ ----
481
+ endif::[]
482
+
483
+ [NOTE]
484
+ For full HTMLProofer configuration options, see link:https://github.com/gjtorikian/html-proofer[the official docs].
485
+
486
+ // end::config-htmlproofer[]
487
+
488
+ [[common-scripts]]
489
+ === Common vs Local Scripts
490
+
491
+ The `labdev:run:script` task exists to execute auxiliary scripting in a proper environment, simplifying the most common developer commands.
492
+
493
+ Upstream (centrally authored) scripts are synced to `scripts/.vendor/docopslab/` and can be executed with local override priority via `bundle exec rake 'labdev:run:script[script_name]'`.
494
+
495
+ [NOTE]
496
+ There is no local configuration of or manifest control over these scripts as there is with configs.
497
+
498
+ Local overrides are placed at `scripts/` and take precedence over upstream versions of scripts with their same filename.
499
+
500
+ To execute, use `bundle exec rake labdev:run:script[script_name]`, where `script_name` is `script_name.sh` or `script_name`.
501
+ Use `bundle exec rake 'labdev:run:script[script_name,--option1 value --option]` to add options to the standard script execution.
502
+
503
+ To extend an upstream script, source or execute the upstream script from within the same-named local script, using its relative path.
504
+
505
+ Use complete script names including extensions for non-Bash scripts.
506
+
507
+ See <<assets-scripts>> for more.
508
+
509
+ [[documentation-syncing]]
510
+ === Documentation Syncing
511
+
512
+ The gem packages agent instruction documentation that can be synced to target projects.
513
+
514
+ [[available-documentation]]
515
+ ==== Available Documentation
516
+
517
+ AGENTS.md template::
518
+ A comprehensive template for creating project-specific AI agent orientation files.
519
+ Includes placeholders for project details, architecture, and development patterns.
520
+
521
+ Agent guides::
522
+ Specific instruction files for AI agents working with common tools and patterns.
523
+ For instance:
524
+
525
+ * `agent/git.md`
526
+ * `agent/ruby.md`
527
+ * `agent/fix-spelling-issues.md`
528
+
529
+ // tag::sync-behavior[]
530
+ [[sync-behavior]]
531
+ ==== Sync Behavior
532
+
533
+ The `synced:` flag in the manifest (`{project_manifest_path}`) controls update behavior:
534
+
535
+ `synced: true`::
536
+ *Always updates* +
537
+ File is overwritten on each sync.
538
+ Use for reference documentation that should stay current with gem updates.
539
+
540
+ `synced: false`::
541
+ *Create once, preserve customizations* +
542
+ Existing files are not overwritten unless `force` is used.
543
+ Use for templates that are manually customized to the local project.
544
+
545
+ [TIP]
546
+ Be sure to add synced files to `.gitignore` and to track all locally modified files in Git.
547
+
548
+ .Default source, target, and syncing states for agent docs
549
+ [source,yaml]
550
+ ----
551
+ - source: docs/agent/AGENTS.md
552
+ target: AGENTS.md
553
+ synced: false
554
+ - source: docs/agent/*.md
555
+ target: .agent/
556
+ synced: true
557
+ ----
558
+
559
+ // end::sync-behavior[]
560
+
561
+ [[target-path-selection]]
562
+ ==== Target Path Selection
563
+
564
+ Documentation can be synced to different locations based on project structure:
565
+
566
+ .To project root
567
+ [source,yaml]
568
+ ----
569
+ - source: docs/AGENTS.md
570
+ target: AGENTS.md
571
+ ----
572
+
573
+ .To existing `_docs/` directory
574
+ [source,yaml]
575
+ ----
576
+ - source: docs/agent/*.md
577
+ target: _docs/agent/
578
+ ----
579
+
580
+ .To vendor path (if no `_docs/`)
581
+ [source,yaml]
582
+ ----
583
+ - source: docs/agent/*.md
584
+ target: .docopslab-dev/agent/
585
+ ----
586
+
587
+ [[pattern-matching]]
588
+ ==== Pattern Matching
589
+
590
+ Glob patterns allow bulk operations:
591
+
592
+ .All markdown files
593
+ [source,yaml]
594
+ ----
595
+ - source: docs/agent/*.md
596
+ target: _docs/
597
+ synced: true
598
+ ----
599
+
600
+ .Specific file override
601
+ [source,yaml]
602
+ ----
603
+ - source: docs/agent/ruby.md
604
+ target: _docs/styles/ruby-custom.md
605
+ synced: false
606
+ - source: docs/agent/*.md
607
+ target: _docs/
608
+ synced: true
609
+ ----
610
+
611
+ Result: Most files auto-sync to `_docs/`, but `ruby.md` also copied to custom path and preserved.
612
+
613
+ [[syncing-documentation]]
614
+ ==== Syncing Documentation
615
+
616
+ Your docs are probably already initialized as part of the basic `labdev:init` task, but if you _only_ want the docs, there's a task for that.
617
+
618
+ .Initialize the docsets
619
+ [.prompt]
620
+ bundle exec rake labdev:init:docs
621
+
622
+ Docs will be kept in sync by the general `labdev:sync` command, but you may always update the docs alone.
623
+
624
+ .Sync docs explicitly (respects `synced:` flags)
625
+ [.prompt]
626
+ bundle exec rake labdev:sync:docs
627
+
628
+
629
+ // tag::workflow[]
630
+ [[available-tasks]]
631
+ == Tasks and Workflow
632
+
633
+ [.prompt]
634
+ bundle exec rake --tasks | grep labdev:
635
+
636
+ [TIP]
637
+ ====
638
+ To hide the `labdev:` tasks from the standard `rake --tasks` output for an integrated project, use:
639
+
640
+ [.prompt]
641
+ bundle exec rake --tasks | grep -v labdev:
642
+ ====
643
+
644
+ [[workflow]]
645
+ === Typical Workflow
646
+
647
+ This tool is for working on DocOps Lab projects or possibly unrelated projects that wish to follow our methodology.
648
+ A typical workflow might look as follows.
649
+
650
+ .Normal development
651
+ git add .
652
+ git commit -m "Add new feature"
653
+ +
654
+ This should yield warnings and errors if active linters find issues.
655
+
656
+ . Auto-fix what you can.
657
+ +
658
+ bundle exec rake labdev:heal
659
+
660
+ . Review the changes.
661
+ +
662
+ git diff
663
+
664
+ . Commit the fixes.
665
+ +
666
+ git add -A
667
+ git commit -m "Auto-fix linting issues"
668
+
669
+ . Handle any remaining manual fixes.
670
+ +
671
+ bundle exec rake labdev:lint:all
672
+
673
+ . Fix remaining issues manually.
674
+ +
675
+ git add -A
676
+ git commit -m "Fix remaining linting issues"
677
+
678
+ . Try pushing.
679
+ +
680
+ git push
681
+ +
682
+ If all blocking issues are cleared, the push should succeed.
683
+ Otherwise, more cleanup is needed.
684
+
685
+ [TIP]
686
+ ====
687
+ Bypass the pre-push gates (usually to test or demo the failure at origin):
688
+
689
+ git push --no-verify
690
+ ====
691
+
692
+ // end::workflow[]
693
+
694
+
695
+ // tag::customization[]
696
+ [[customization]]
697
+ == Customization
698
+
699
+ Override settings by editing the project configs:
700
+
701
+ * `{project_manifest_path}`
702
+ * `.config/rubocop.yml`
703
+ * `.config/vale.ini`
704
+ * `.config/htmlproofer.yml`
705
+ * `.config/actionlint.yml`
706
+ * `.config/shellcheckrc`
707
+
708
+ Your configurations will inherit from the base configurations and source libraries as sourced in the Git-ignored `.config/.vendor/docopslab/` path.
709
+
710
+ [[local-overrides]]
711
+ === Local Overrides
712
+
713
+ Projects using `docopslab-dev` will have a configuration structure like the following:
714
+
715
+ [source,tree]
716
+ ----
717
+ config/
718
+ ├── docopslab-dev.yml # Project manifest (tracked)
719
+ ├── actionlint.yml # Project config (tracked; inherits from base)
720
+ ├── htmlproofer.local.yml # Project config (tracked; inherits from base)
721
+ ├── htmlproofer.yml # Generated config (untracked)
722
+ ├── rubocop.yml # Project config (tracked; inherits from base)
723
+ ├── shellcheckrc # ShellCheck config (tracked)
724
+ ├── vale.ini # Generated active config (untracked)
725
+ ├── vale.local.ini # Project config (tracked; inherits from base)
726
+ ├── .vendor/ # Base configs (untracked; synced)
727
+ │ └── docopslab/
728
+ │ ├── htmlproofer.yml # Centrally managed base
729
+ │ ├── rubocop.yml # Centrally managed base
730
+ │ └── vale.ini # Centrally managed base
731
+ scripts/ # Project override scripts
732
+ └── .vendor/ # Centrally managed scripts
733
+ .github/workflows/ # CI/CD workflows (tracked)
734
+ env.docopslab # Environment variables (git tracked)
735
+ env.private # Environment variables (git ignored)
736
+ ----
737
+ // end::customization[]
738
+
739
+ // tag::usage[]
740
+ // tag::standard-usage[]
741
+ [[override-commands]]
742
+ === Override Commands
743
+
744
+ Most executions of the packaged tools are handled through Rake tasks, but you can always run them directly, especially to pass arguments not built into the tasks.
745
+
746
+ RuboCop::
747
+ +
748
+ bundle exec rubocop --config .config/rubocop.yml [options]
749
+ bundle exec rubocop --config .config/rubocop.yml --auto-correct-all
750
+ bundle exec rubocop --config .config/rubocop.yml --only Style/StringLiterals
751
+
752
+ Vale::
753
+ +
754
+ vale --config=.config/vale.ini [options] [files]
755
+ vale --config=.config/vale.ini README.adoc
756
+ vale --config=.config/vale.ini --minAlertLevel=error .
757
+
758
+ HTMLProofer::
759
+ +
760
+ bundle exec htmlproofer --ignore-urls "/www.github.com/,/foo.com/" ./_site
761
+
762
+ [[more-example-commands]]
763
+ === More Example Commands
764
+
765
+ .Lint specific Ruby file with specific rule
766
+ [.prompt]
767
+ bundle exec rake 'labdev:lint:ruby[lib/myfile.rb,Style/StringLiterals]'
768
+
769
+ .Lint all AsciiDoc files for a specific Vale rule
770
+ [.prompt]
771
+ bundle exec rake 'labdev:lint:adoc[,DocOpsLab-Authoring.ExNotEg]'
772
+
773
+ .Lint specific shell script
774
+ [.prompt]
775
+ bundle exec rake 'labdev:lint:bash[scripts/docksh]'
776
+
777
+ .Lint specific file with Vale (text mode)
778
+ [.prompt]
779
+ bundle exec rake 'labdev:lint:text[_docs/myfile.adoc]'
780
+
781
+ .Show a specific lint rule profile
782
+ [.prompt]
783
+ bundle exec rake 'labdev:show:rule[vale,RedHat]'
784
+
785
+ // end::standard-usage[]
786
+ // end::usage[]
787
+
788
+
789
+ [[assets]]
790
+ == Other Assets
791
+
792
+ Linters are the main feature of this gem, but it also handles other shared assets.
793
+
794
+ [[assets-scripts]]
795
+ === Managed Scripts
796
+
797
+ .List available scripts
798
+ [.prompt]
799
+ bundle exec rake labdev:show:scripts
800
+
801
+ Unlike other `labdev:run` tasks, `labdev:run:script` requires a `script_name` of an existing local or an upstream-sourced script stored in the `scripts/.vendor/` path and maintained as part of the link:{docopslab_lab_hub_base_url}[DocOps/lab project].
802
+
803
+ They are superseded by a script of the same name in the local `scripts/` directory, if present.
804
+ (See >><common-scripts>> for more.)
805
+
806
+ [[git-hooks]]
807
+ === Git Hooks
808
+
809
+ The gem provides git hooks with a developer-oriented strategy:
810
+
811
+ *Pre-commit* (Advisory):
812
+
813
+ * Quick syntax validation on staged files
814
+ * Config sync status check
815
+ * Non-blocking - encourages frequent commits
816
+
817
+ *Pre-push* (Quality Gate):
818
+
819
+ * Comprehensive linting with `labdev:lint:all`
820
+ * Blocks problematic code from reaching CI
821
+ * Provides clear fix workflow instructions
822
+
823
+ .Show hook status
824
+ [.prompt]
825
+ bundle exec rake labdev:show:hooks
826
+
827
+ .Install/update hooks
828
+ [.prompt]
829
+ bundle exec rake labdev:sync:hooks
830
+
831
+ Bypass (extraordinary use): `git push --no-verify`
832
+
833
+
834
+ [[development]]
835
+ == Development
836
+
837
+ This gem is developed within the link:{docopslab_lab_hub_base_url}[DocOps Lab monorepo] at `/gems/docopslab-dev/`.
838
+
839
+ [[strategy]]
840
+ === Strategy and Aims
841
+
842
+ In addition to centralized configuration, script, docs, and hooks management, the gem aims to cover:
843
+
844
+ * Central documentation build tooling (probably to spin off as `docopslab-docs` gem)
845
+ * RSpec test framework management and templates
846
+ * Security analysis (Brakeman, Bundler Audit)
847
+ * Dependency management (Dependabot)
848
+ * More CI/CD workflow templates
849
+ * Generative AI agent templates and MCP infrastructure
850
+ * Linting of SGYML YAML files
851
+ * Linting of AsciiDoc/Markdown content stored in YAML files
852
+
853
+ Contributions in these directions are welcome.
854
+
855
+ [[making-changes]]
856
+ === Making Changes
857
+
858
+ . Edit files in `lib/`, `config-packs/`, or `hooks/`.
859
+ . Test with lab repo as consumer.
860
+ . Update version in `lib/docopslab/dev/version.rb`.
861
+ . Update this README with new features.
862
+
863
+ [[vale-dev-mode]]
864
+ === Running Vale in Development Mode
865
+
866
+ When running within the `DocOps/lab` monorepo, the `labdev:sync:styles` task operates in a special development mode:
867
+
868
+ * It copies the local, custom styles (e.g., `DocOpsLab-Authoring`, `DocOpsLab-AsciiDoc`) directly from the gem's source (`gems/docopslab-dev/assets/config-packs/vale/`) into your project's `.config/.vendor/vale/styles/` directory.
869
+ * It also runs `vale sync` to download any remote packages like `RedHat` or `proselint` into that same directory.
870
+ * This allows you to edit the custom styles in the gem and see your changes immediately when you run the linter.
871
+
872
+ The `.config/vale.ini` for this mode should use the project's local defaults for `.config/vale.local.ini`.:
873
+
874
+ [[implementation]]
875
+ === Implementation Notes
876
+
877
+
878
+
879
+ [[build-artifacts]]
880
+ === Building docopslab-dev Artifacts
881
+
882
+ To build the gem package:
883
+
884
+ [.prompt]
885
+ bundle exec rake gemdo:build_gem
886
+
887
+ To build the `docopslab/dev` Docker image:
888
+
889
+ [.prompt]
890
+ bundle exec rake gemdo:build_docker
891
+
892
+
893
+ [[legal]]
894
+ == Legal
895
+
896
+ Functional code and data files released under MIT License.
897
+
898
+ Documentation released under Creative Commons Attribution 4.0 International (CC BY 4.0).
899
+
900
+ [[bom]]
901
+ === Bill of Materials
902
+
903
+ No externally sourced content or code is contained in this project.
904
+ All third-party dependencies are permissively licensed and are downloaded independently, never provided by DocOps Lab.