Skip to content

Commit b838c4e

Browse files
themr0cclaude
andcommitted
RHIDP-12779: Add CQA #0 directory structure check and remove old scripts
- Create cqa-00-directory-structure.sh (replaces align-title-directories.sh) with cqa-lib integration, --fix/--format support, SARIF output - Delete align-title-directories.sh and list-all-included-files-starting-from.sh (functionality integrated into cqa-lib.sh cqa_collect_files) - Add cqa-00-directory-structure.sh as second entry in cqa.sh - Update skill files, checklist, and CLAUDE.md references (19 checks) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent df1bad4 commit b838c4e

10 files changed

Lines changed: 794 additions & 1031 deletions

.claude/CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## CQA Compliance
44

5-
When editing `.adoc` files, ALWAYS run the relevant CQA scripts to validate and fix changes before considering the task done. Run all 17 checks at once with `build/scripts/cqa.sh`, or run individual scripts. All share a common interface via `build/scripts/cqa-lib.sh`:
5+
When editing `.adoc` files, ALWAYS run the relevant CQA scripts to validate and fix changes before considering the task done. Run all 19 checks at once with `build/scripts/cqa.sh`, or run individual scripts. All share a common interface via `build/scripts/cqa-lib.sh`:
66

77
```bash
88
# Report issues for a title

.claude/cqa-checklist.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ Output markers: `[AUTOFIX]` (auto-fixable), `[MANUAL]` (needs human), `[FIXED]`
4343
- [ ] No orphaned images
4444
- [ ] Delete orphans: `./build/scripts/cqa-00-orphaned-modules.sh --fix`
4545

46+
- [ ] **CQA #0: Directory structure**
47+
```bash
48+
./build/scripts/cqa-00-directory-structure.sh [--fix]
49+
```
50+
- [ ] All directories follow `<category>_<context>` naming
51+
- [ ] Fix misnamed dirs: `./build/scripts/cqa-00-directory-structure.sh --fix`
52+
4653
- [ ] **Resources current** - [Update all resources](skills/update-all-resources.md)
4754
```bash
4855
./build/scripts/update-cqa-resources.sh
@@ -275,7 +282,7 @@ Output markers: `[AUTOFIX]` (auto-fixable), `[MANUAL]` (needs human), `[FIXED]`
275282
- Vale DITA: 0 errors, X acceptable warnings
276283
- Vale style: 0 errors, 0 warnings
277284
- Build: successful
278-
- All 17 CQA requirements met
285+
- All 19 CQA requirements met
279286
- Idempotency verified
280287
281288
## Changes Made

.claude/skills/align-title-directories.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ All directories follow `<category>_<context>` naming:
99
```
1010
titles/<category>_<context>/master.adoc
1111
assemblies/<category>_<context>/ # owned by one title
12+
assemblies/<category>_shared/ # shared within a category
1213
assemblies/shared/ # shared across categories
1314
modules/<category>_<context>/ # owned by one title
15+
modules/<category>_shared/ # shared within a category
1416
modules/shared/ # shared across categories
1517
images/<category>_<context>/ # owned by one title
1618
images/shared/ # shared across categories
@@ -29,12 +31,12 @@ The `:context:` value is derived automatically from the `:title:` attribute in m
2931
## Script Usage
3032

3133
```bash
32-
./build/scripts/align-title-directories.sh --list # show all titles
33-
./build/scripts/align-title-directories.sh --all # dry-run all titles
34-
./build/scripts/align-title-directories.sh --all --exec # execute all titles
35-
./build/scripts/align-title-directories.sh <title-dir> # dry-run single title
36-
./build/scripts/align-title-directories.sh --exec <title-dir> # execute single title
37-
./build/scripts/align-title-directories.sh --exec <title-dir> <new-context> # explicit context
34+
./build/scripts/cqa-00-directory-structure.sh # report misnamed dirs (full repo)
35+
./build/scripts/cqa-00-directory-structure.sh --fix # execute renames (full repo)
36+
./build/scripts/cqa-00-directory-structure.sh <title-dir> # report single title
37+
./build/scripts/cqa-00-directory-structure.sh --fix <title-dir> # execute single title
38+
./build/scripts/cqa-00-directory-structure.sh --fix <title-dir> <context> # explicit context
39+
./build/scripts/cqa-00-directory-structure.sh --format json # SARIF output
3840
```
3941

4042
## Script Phases
@@ -73,11 +75,11 @@ For each title, follow this checklist in order:
7375

7476
1. **Preview changes** (dry-run):
7577
```bash
76-
./build/scripts/align-title-directories.sh titles/<old-dir>
78+
./build/scripts/cqa-00-directory-structure.sh titles/<old-dir>
7779
```
7880
2. **Execute**:
7981
```bash
80-
./build/scripts/align-title-directories.sh --exec titles/<old-dir>
82+
./build/scripts/cqa-00-directory-structure.sh --fix titles/<old-dir>
8183
```
8284
3. **If single assembly**: Inline assembly content into master.adoc without adding a second level heading, then delete the assembly file
8385
4. **Verify** `[id="{context}"]` and `= {title}` are present in master.adoc
@@ -102,4 +104,4 @@ For each title, follow this checklist in order:
102104

103105
- Do NOT commit this skill file or memory changes
104106
- Build using `./build/scripts/build-ccutil.sh` and fix errors before committing
105-
- The `--all` mode is idempotent: running it again on an already-aligned repo produces no changes
107+
- The full repo mode is idempotent: running it again on an already-aligned repo produces no changes

.claude/skills/cqa-main-workflow.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CQA 2.1 Main Workflow
22

3-
Execute all 18 CQA requirements in optimal order. Each links to detailed skill with commands, criteria, and fixes.
3+
Execute all 19 CQA requirements in optimal order. Each links to detailed skill with commands, criteria, and fixes.
44

55
**CRITICAL EXECUTION RULES:**
66
1. **Run skills in the exact order listed** - The sequence is optimized to minimize conflicts
@@ -23,7 +23,7 @@ Execute all 18 CQA requirements in optimal order. Each links to detailed skill w
2323

2424
## Unified Script Interface
2525

26-
Run all 18 CQA checks in workflow order with `cqa.sh`:
26+
Run all 19 CQA checks in workflow order with `cqa.sh`:
2727

2828
```bash
2929
# Run all checks for a title
@@ -55,6 +55,7 @@ Or run individual scripts (all share a common interface via `cqa-lib.sh`):
5555
**For each requirement below:** Run validation/fixes until no new changes occur. **For the entire sequence:** Re-run all requirements until the full workflow is stable.
5656

5757
- [ ] **CQA #0:** Orphaned modules — `cqa-00-orphaned-modules.sh` — Find/delete unreferenced files
58+
- [ ] **CQA #0:** Directory structure — `cqa-00-directory-structure.sh` — Verify `<category>_<context>` naming
5859
- [ ] Resources current. [Update all resources](update-all-resources.md)
5960
- [ ] **CQA #3:** [Content is modularized](cqa-03-content-is-modularized.md) - Modular structure, correct metadata/prefixes
6061
- [ ] **CQA #13:** [Correct content type](cqa-13-information-is-conveyed-using-the-correct-content.md) - Content matches declared type

.claude/skills/get-title-files.md

Lines changed: 13 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -10,64 +10,28 @@ Many CQA requirements need to validate or process ALL files that make up a docum
1010
- All modules included by those assemblies
1111
- Recursively, all nested includes
1212

13-
This helper provides a dedicated script to extract that complete file list for use in CQA validation commands.
13+
This functionality is integrated into `cqa-lib.sh` via `cqa_collect_files()`.
1414

15-
## Script
15+
## Usage
1616

17-
**Location:** [build/scripts/list-all-included-files-starting-from.sh](../../build/scripts/list-all-included-files-starting-from.sh)
18-
19-
**Usage:**
20-
```bash
21-
./build/scripts/list-all-included-files-starting-from.sh titles/<title-name>/master.adoc
22-
```
23-
24-
**Output:** Space-separated list of all files (master.adoc + all recursively included files) on a single line
25-
26-
**How it works:**
17+
All CQA scripts automatically use `cqa_collect_files()` when processing a title. The function:
2718
1. Starts from the specified file (e.g., master.adoc)
2819
2. Recursively extracts all `include::` statements
29-
3. Resolves relative paths (../) correctly
30-
4. Avoids infinite loops by tracking processed files
31-
5. Returns sorted, deduplicated list on a single line
32-
33-
## Example Usage
34-
35-
**For titles/install-rhdh-osd-gcp/master.adoc:**
20+
3. Resolves relative paths correctly
21+
4. Deduplicates by realpath (handles symlinks)
22+
5. Stores results in `_CQA_COLLECTED_FILES` array
3623

3724
```bash
38-
./build/scripts/list-all-included-files-starting-from.sh titles/install-rhdh-osd-gcp/master.adoc
39-
```
40-
41-
**Example output:**
42-
```
43-
/path/to/artifacts/attributes.adoc /path/to/modules/install-rhdh-osd-gcp/proc-install-product-on-osd-short-on-gcp-short-using-the-helm-chart.adoc /path/to/modules/install-rhdh-osd-gcp/proc-install-product-on-osd-short-on-gcp-short-using-the-operator.adoc titles/install-rhdh-osd-gcp/master.adoc
25+
# In a CQA script (after sourcing cqa-lib.sh):
26+
cqa_collect_files "$target"
27+
for file in "${_CQA_COLLECTED_FILES[@]}"; do
28+
# process each file
29+
done
4430
```
4531

46-
## Using with Vale
47-
48-
**Vale DITA validation on title files:**
49-
```bash
50-
vale --config .vale-dita-only.ini \
51-
$(./build/scripts/list-all-included-files-starting-from.sh titles/<title-name>/master.adoc)
52-
```
53-
54-
**Vale style validation on title files:**
55-
```bash
56-
vale --config .vale.ini \
57-
$(./build/scripts/list-all-included-files-starting-from.sh titles/<title-name>/master.adoc)
58-
```
59-
60-
## Notes
61-
62-
- Recursively follows all `include::` statements
63-
- Handles relative paths (../) and absolute paths correctly
64-
- Avoids infinite loops by tracking already-processed files
65-
- Returns sorted, deduplicated list
66-
- Works with attribute substitution in include paths (dynamically resolves {platform-id}, {context}, etc.)
67-
68-
## When to Use
32+
## When Used
6933

70-
Use this helper for CQA requirements that need to validate all title content:
34+
Used by CQA requirements that validate all title content:
7135
- CQA #1: Vale DITA validation
7236
- CQA #8: Short description content
7337
- CQA #9: Short description format

0 commit comments

Comments
 (0)