Skip to content

Commit e2e5f37

Browse files
committed
Merge branch 'fix' - Add file path arguments to journey command
This merge adds the ability to specify file paths directly when running 'aditi journey', allowing users to target specific files or directories for processing without going through interactive selection. Features added: - Direct file/directory arguments for journey command - Wildcard support through shell expansion - Session state preservation for selected files - Backward compatibility with interactive mode Resolves #26
2 parents a1dbb36 + 2c075df commit e2e5f37

File tree

4 files changed

+360
-140
lines changed

4 files changed

+360
-140
lines changed

CLAUDE.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -312,23 +312,23 @@ A comprehensive test suite prevents Jekyll deployment failures:
312312
- ⚠️ Breaking changes: 1
313313
314314
### Latest Achievements
315+
- ✅ Add file path arguments to journey command for direct processing.
315316
- ✅ Implement automation plan for aditi rule creation from vale rules.
316317
- ✅ Entityreference rule now respects asciidoc subs attributes.
317318
- ✅ Implement single-source versioning.
318319
- ✅ Add intermediate recheck step and fix accurate fix counting in journey workflow.
319-
- ✅ Add vale configuration and update asciidocdita styles for improved validation.
320320
321321
### Development Focus
322-
- **Ci/Cd**: 94 commits
323-
- **Features**: 24 commits
322+
- **Ci/Cd**: 95 commits
323+
- **Features**: 25 commits
324324
- **Bug Fixes**: 18 commits
325-
- **Documentation**: 17 commits
325+
- **Documentation**: 16 commits
326326
- **Testing**: 14 commits
327327
328328
### Most Active Files
329-
- `docs/_data/recent_commits.yml`: 90 changes
330-
- `CLAUDE.md`: 67 changes
331-
- `src/aditi/commands/journey.py`: 19 changes
329+
- `docs/_data/recent_commits.yml`: 91 changes
330+
- `CLAUDE.md`: 68 changes
331+
- `src/aditi/commands/journey.py`: 20 changes
332332
<!-- /AUTO-GENERATED:RECENT -->
333333
334334
## Building and Publishing
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
---
2+
layout: post
3+
title: "Direct File Processing in Journey Command"
4+
date: 2025-08-25 21:51:56 -0400
5+
author: Rolfe DH
6+
tags: [features, journey, cli, workflow]
7+
summary: "The journey command now accepts file paths directly, enabling targeted processing of specific AsciiDoc files without interactive selection."
8+
---
9+
10+
## Streamlined Workflow with Direct File Arguments
11+
12+
We've just implemented a powerful enhancement to the `aditi journey` command that significantly improves workflow efficiency for users working with specific files or directories. You can now provide file paths directly on the command line, bypassing the interactive directory selection process entirely.
13+
14+
## The Problem It Solves
15+
16+
Previously, when users wanted to process specific files with `aditi journey`, they had to:
17+
1. Start the journey command
18+
2. Navigate through interactive prompts
19+
3. Select directories from a list
20+
4. Process all files in those directories
21+
22+
This was particularly cumbersome when working with a subset of files, such as all network-observability modules in a large documentation repository. Users expressed the need to target specific file patterns directly, similar to how they work with other command-line tools.
23+
24+
## The New Solution
25+
26+
Now you can specify exactly which files or directories to process right from the command line:
27+
28+
```bash
29+
# Process specific files
30+
aditi journey modules/network-observability-*.adoc
31+
32+
# Process a single file
33+
aditi journey modules/network-observability-cli.adoc
34+
35+
# Process an entire directory
36+
aditi journey modules/
37+
38+
# Mix files and directories
39+
aditi journey README.adoc modules/api/ docs/guides/*.adoc
40+
```
41+
42+
## How It Works
43+
44+
The enhanced journey command:
45+
46+
1. **Accepts file paths as arguments** - The CLI now accepts optional paths that can be files or directories
47+
2. **Validates inputs** - Ensures all provided paths exist and are readable
48+
3. **Handles wildcards** - Shell expansion works naturally with glob patterns
49+
4. **Preserves state** - Selected files are stored in the session for workflow continuity
50+
5. **Maintains compatibility** - When no paths are provided, the original interactive mode still works
51+
52+
## Technical Implementation
53+
54+
The implementation required changes across multiple components:
55+
56+
### CLI Layer
57+
Added path arguments with proper validation:
58+
```python
59+
paths: Optional[List[Path]] = typer.Argument(
60+
None,
61+
help="Paths to process (files or directories).",
62+
exists=True,
63+
file_okay=True,
64+
dir_okay=True,
65+
readable=True,
66+
)
67+
```
68+
69+
### Configuration Flow
70+
The `configure_repository` function now detects when paths are provided and processes them directly:
71+
- Individual `.adoc` files are collected
72+
- Directories are scanned for `.adoc` content
73+
- File counts are displayed for transparency
74+
- Selected files are stored in the session
75+
76+
### Rule Processing
77+
The `apply_rules_workflow` prioritizes command-line paths over configured directories, ensuring the user's explicit selections are honored throughout the entire journey.
78+
79+
## Use Cases
80+
81+
This feature is particularly valuable for:
82+
83+
### Targeted Module Updates
84+
When updating specific documentation modules:
85+
```bash
86+
aditi journey modules/authentication-*.adoc
87+
```
88+
89+
### Pre-commit Hooks
90+
Process only changed files before committing:
91+
```bash
92+
aditi journey $(git diff --name-only --cached '*.adoc')
93+
```
94+
95+
### Incremental Migration
96+
Work through large documentation sets file by file:
97+
```bash
98+
aditi journey docs/api/users.adoc
99+
# Review and commit
100+
aditi journey docs/api/products.adoc
101+
# Review and commit
102+
```
103+
104+
### Pattern-Based Processing
105+
Focus on specific documentation types:
106+
```bash
107+
aditi journey **/README.adoc
108+
aditi journey modules/*-procedure.adoc
109+
```
110+
111+
## Benefits
112+
113+
1. **Efficiency** - No need to navigate through prompts when you know what to process
114+
2. **Precision** - Target exactly the files you want to work on
115+
3. **Automation** - Easier to integrate into scripts and CI/CD pipelines
116+
4. **Flexibility** - Mix and match files and directories as needed
117+
5. **Speed** - Faster workflow for experienced users
118+
119+
## Backward Compatibility
120+
121+
The interactive mode remains fully functional. Simply run `aditi journey` without arguments to access the familiar guided experience with directory selection prompts.
122+
123+
## What's Next?
124+
125+
This enhancement opens up new possibilities for workflow automation. Future improvements could include:
126+
- Integration with git to automatically process changed files
127+
- Batch processing with different rule sets for different file patterns
128+
- Parallel processing for large file sets
129+
- Progress persistence for interrupted batch operations
130+
131+
## Try It Out
132+
133+
Update to the latest version of Aditi and start using direct file paths with the journey command:
134+
135+
```bash
136+
# Update Aditi
137+
pip install --upgrade aditi
138+
139+
# Process specific files
140+
aditi journey your/target/files/*.adoc
141+
```
142+
143+
This feature represents our commitment to making the DITA migration process as smooth and efficient as possible. By giving users more control over what gets processed, we're helping teams work more effectively with their documentation workflows.

src/aditi/cli.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,14 @@ def fix(
208208

209209
@app.command()
210210
def journey(
211+
paths: Optional[List[Path]] = typer.Argument(
212+
None,
213+
help="Paths to process (files or directories). If not specified, uses interactive selection.",
214+
exists=True,
215+
file_okay=True,
216+
dir_okay=True,
217+
readable=True,
218+
),
211219
dry_run: bool = typer.Option(
212220
False,
213221
"--dry-run",
@@ -239,7 +247,7 @@ def journey(
239247
Use --status to view current session progress.
240248
"""
241249
setup_logging(verbose)
242-
journey_command(dry_run=dry_run, clear=clear, status=status)
250+
journey_command(paths=paths, dry_run=dry_run, clear=clear, status=status)
243251

244252

245253
@app.command()

0 commit comments

Comments
 (0)