Skip to content

Commit 18b8a85

Browse files
committed
docs: Update README with correct CLI tool instructions and PowerShell examples
- Add clear CLI tool behavior explanation (can run from any directory) - Add complete PowerShell examples for all commands - Document path resolution (relative to script directory, not CWD) - Add multiple usage options (from script dir, from project root, absolute paths) - Remove duplicate examples and consolidate instructions
1 parent 98491b9 commit 18b8a85

File tree

1 file changed

+122
-31
lines changed

1 file changed

+122
-31
lines changed

tools/ai-markmap-agent/README.md

Lines changed: 122 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,18 @@ The output will be saved to:
244244
If you want to translate a specific English file:
245245

246246
**Important**:
247+
- **CLI Tool**: Can be run from **any directory** - relative paths are resolved relative to the script directory
247248
- **Default output location**: When using `--output`, files are saved to the specified path
248249
- **Auto-detection**: Without `--output`, files are saved to `docs/mindmaps/` (configured in `config.yaml`)
249250
- **Version history**: The main pipeline also saves to `outputs/versions/v1/` for tracking, but `translate_only.py` only saves to the final location
250251

251252
**Working with `docs/mindmaps/` directory:**
252253

254+
**Option 1: From Script Directory (Recommended)**
255+
253256
**Unix/macOS:**
254257
```bash
255-
# Navigate to the script directory first
258+
# Navigate to the script directory
256259
cd tools/ai-markmap-agent
257260

258261
# Translate a specific file (auto-detects output to docs/mindmaps/)
@@ -272,7 +275,7 @@ python translate_only.py \
272275

273276
**Windows PowerShell:**
274277
```powershell
275-
# Navigate to the script directory first
278+
# Navigate to the script directory
276279
cd tools\ai-markmap-agent
277280
278281
# Translate a specific file (auto-detects output to docs\mindmaps\)
@@ -290,26 +293,60 @@ python translate_only.py `
290293
--html
291294
```
292295

293-
**From Project Root (Alternative):**
296+
**Option 2: From Project Root (CLI Tool Mode)**
297+
298+
**Unix/macOS:**
294299
```bash
295-
# Unix/macOS - from project root
300+
# From project root - relative paths resolved relative to script directory
296301
python tools/ai-markmap-agent/translate_only.py \
297302
--input docs/mindmaps/neetcode_ontology_agent_evolved_en.md \
298303
--output docs/mindmaps/neetcode_ontology_agent_evolved_zh-TW.md
304+
305+
# With HTML generation
306+
python tools/ai-markmap-agent/translate_only.py \
307+
--input docs/mindmaps/neetcode_ontology_agent_evolved_en.md \
308+
--output docs/mindmaps/neetcode_ontology_agent_evolved_zh-TW.md \
309+
--html
299310
```
300311

312+
**Windows PowerShell:**
301313
```powershell
302-
# Windows PowerShell - from project root
314+
# From project root - relative paths resolved relative to script directory
303315
python tools\ai-markmap-agent\translate_only.py `
304316
--input docs\mindmaps\neetcode_ontology_agent_evolved_en.md `
305317
--output docs\mindmaps\neetcode_ontology_agent_evolved_zh-TW.md
318+
319+
# With HTML generation
320+
python tools\ai-markmap-agent\translate_only.py `
321+
--input docs\mindmaps\neetcode_ontology_agent_evolved_en.md `
322+
--output docs\mindmaps\neetcode_ontology_agent_evolved_zh-TW.md `
323+
--html
324+
```
325+
326+
**Option 3: Using Absolute Paths**
327+
328+
**Unix/macOS:**
329+
```bash
330+
# From any directory using absolute paths
331+
python /path/to/neetcode/tools/ai-markmap-agent/translate_only.py \
332+
--input /path/to/neetcode/docs/mindmaps/neetcode_ontology_agent_evolved_en.md \
333+
--output /path/to/neetcode/docs/mindmaps/neetcode_ontology_agent_evolved_zh-TW.md
334+
```
335+
336+
**Windows PowerShell:**
337+
```powershell
338+
# From any directory using absolute paths
339+
python C:\Developer\program\python\neetcode\tools\ai-markmap-agent\translate_only.py `
340+
--input C:\Developer\program\python\neetcode\docs\mindmaps\neetcode_ontology_agent_evolved_en.md `
341+
--output C:\Developer\program\python\neetcode\docs\mindmaps\neetcode_ontology_agent_evolved_zh-TW.md
306342
```
307343

308344
**Note on Output Locations:**
309345
- **Version History** (main pipeline only): `tools/ai-markmap-agent/outputs/versions/v1/` (for tracking changes)
310346
- **Final Output** (translate_only.py): `docs/mindmaps/` (for actual use)
311347
- When using `--output`, the file is saved to the specified path
312348
- When not using `--output`, it auto-detects based on config (saves to `docs/mindmaps/`)
349+
- **Path Resolution**: Relative paths are always resolved relative to the script directory (`tools/ai-markmap-agent/`), not the current working directory
313350
**Method 3: Translate and Generate HTML in One Step**
314351

315352
```bash
@@ -349,10 +386,16 @@ python translate_only.py --model gpt-4o
349386

350387
For converting Markdown files to HTML without running the full pipeline:
351388

352-
**Important**: Run from `tools/ai-markmap-agent/` directory, or use absolute paths.
389+
**Important**:
390+
- **CLI Tool**: Can be run from **any directory** - relative paths are resolved relative to the script directory
391+
- Supports both relative and absolute paths
392+
- Template paths are resolved relative to the script directory
353393

354394
**Basic Usage:**
355395

396+
**Option 1: From Script Directory**
397+
398+
**Unix/macOS:**
356399
```bash
357400
# Navigate to script directory
358401
cd tools/ai-markmap-agent
@@ -370,10 +413,53 @@ python convert_to_html.py input.md -t "My Mind Map"
370413
python convert_to_html.py input.md --template templates/custom.html
371414
```
372415

416+
**Windows PowerShell:**
417+
```powershell
418+
# Navigate to script directory
419+
cd tools\ai-markmap-agent
420+
421+
# Basic conversion (output: input.html in same directory)
422+
python convert_to_html.py input.md
423+
424+
# Specify output file
425+
python convert_to_html.py input.md -o output.html
426+
427+
# Custom title
428+
python convert_to_html.py input.md -t "My Mind Map"
429+
430+
# Use custom template
431+
python convert_to_html.py input.md --template templates\custom.html
432+
```
433+
434+
**Option 2: From Project Root (CLI Tool Mode)**
435+
436+
**Unix/macOS:**
437+
```bash
438+
# From project root - relative paths resolved relative to script directory
439+
python tools/ai-markmap-agent/convert_to_html.py \
440+
docs/mindmaps/neetcode_ontology_agent_evolved_en.md \
441+
-o docs/pages/mindmaps/neetcode_ontology_agent_evolved_en.html \
442+
-t "NeetCode Agent Evolved Mindmap (EN)"
443+
```
444+
445+
**Windows PowerShell:**
446+
```powershell
447+
# From project root - relative paths resolved relative to script directory
448+
python tools\ai-markmap-agent\convert_to_html.py `
449+
docs\mindmaps\neetcode_ontology_agent_evolved_en.md `
450+
-o docs\pages\mindmaps\neetcode_ontology_agent_evolved_en.html `
451+
-t "NeetCode Agent Evolved Mindmap (EN)"
452+
```
453+
373454
**Working with `docs/mindmaps/` directory:**
374455

456+
**Option 1: From Script Directory**
457+
458+
**Unix/macOS:**
375459
```bash
376-
# From tools/ai-markmap-agent/ directory
460+
# Navigate to the tool directory
461+
cd tools/ai-markmap-agent
462+
377463
# Convert English version
378464
python convert_to_html.py \
379465
../../docs/mindmaps/neetcode_ontology_agent_evolved_en.md \
@@ -388,9 +474,10 @@ python convert_to_html.py \
388474
```
389475

390476
**Windows PowerShell:**
391-
392477
```powershell
393-
# From tools\ai-markmap-agent\ directory
478+
# Navigate to the tool directory
479+
cd tools\ai-markmap-agent
480+
394481
# Convert English version
395482
python convert_to_html.py `
396483
..\..\docs\mindmaps\neetcode_ontology_agent_evolved_en.md `
@@ -404,14 +491,34 @@ python convert_to_html.py `
404491
-t "NeetCode Agent Evolved Mindmap (繁體中文)"
405492
```
406493

407-
**From Project Root (Alternative):**
494+
**Option 2: From Project Root (CLI Tool Mode)**
408495

496+
**Unix/macOS:**
409497
```bash
410-
# From project root directory
498+
# From project root - relative paths resolved relative to script directory
411499
python tools/ai-markmap-agent/convert_to_html.py \
412500
docs/mindmaps/neetcode_ontology_agent_evolved_en.md \
413501
-o docs/pages/mindmaps/neetcode_ontology_agent_evolved_en.html \
414502
-t "NeetCode Agent Evolved Mindmap (EN)"
503+
504+
python tools/ai-markmap-agent/convert_to_html.py \
505+
docs/mindmaps/neetcode_ontology_agent_evolved_zh-TW.md \
506+
-o docs/pages/mindmaps/neetcode_ontology_agent_evolved_zh-TW.html \
507+
-t "NeetCode Agent Evolved Mindmap (繁體中文)"
508+
```
509+
510+
**Windows PowerShell:**
511+
```powershell
512+
# From project root - relative paths resolved relative to script directory
513+
python tools\ai-markmap-agent\convert_to_html.py `
514+
docs\mindmaps\neetcode_ontology_agent_evolved_en.md `
515+
-o docs\pages\mindmaps\neetcode_ontology_agent_evolved_en.html `
516+
-t "NeetCode Agent Evolved Mindmap (EN)"
517+
518+
python tools\ai-markmap-agent\convert_to_html.py `
519+
docs\mindmaps\neetcode_ontology_agent_evolved_zh-TW.md `
520+
-o docs\pages\mindmaps\neetcode_ontology_agent_evolved_zh-TW.html `
521+
-t "NeetCode Agent Evolved Mindmap (繁體中文)"
415522
```
416523

417524
This tool is **completely independent** of the main pipeline and only requires:
@@ -420,26 +527,10 @@ This tool is **completely independent** of the main pipeline and only requires:
420527

421528
It can be used to convert any Markmap Markdown file to interactive HTML.
422529

423-
#### Example: Converting Mindmaps to HTML
424-
425-
Convert Markdown files from `docs/mindmaps/` to HTML files in `docs/pages/mindmaps/`:
426-
427-
```bash
428-
# Navigate to the tool directory
429-
cd tools/ai-markmap-agent
430-
431-
# Convert English version
432-
python convert_to_html.py \
433-
../../docs/mindmaps/neetcode_ontology_agent_evolved_en.md \
434-
-o ../../docs/pages/mindmaps/neetcode_ontology_agent_evolved_en.html \
435-
-t "NeetCode Agent Evolved Mindmap (EN)"
436-
437-
# Convert Traditional Chinese version
438-
python convert_to_html.py \
439-
../../docs/mindmaps/neetcode_ontology_agent_evolved_zh-TW.md \
440-
-o ../../docs/pages/mindmaps/neetcode_ontology_agent_evolved_zh-TW.html \
441-
-t "NeetCode Agent Evolved Mindmap (繁體中文)"
442-
```
530+
**Note on Path Resolution:**
531+
- Relative paths are always resolved relative to the script directory (`tools/ai-markmap-agent/`), not the current working directory
532+
- This allows the tools to work as CLI tools from any directory
533+
- Absolute paths work as expected
443534

444535
**Windows PowerShell:**
445536
```powershell

0 commit comments

Comments
 (0)