* REAL-WORLD TESTING ────────────────── BEFORE FIX: ─────────── ❌ Agent runs: docs edit <url> ❌ Editor spawns and blocks ❌ Agent hangs for 30+ seconds ❌ Workflow times out or fails ❌ Manual intervention required AFTER FIX: ────────── ✅ Agent runs: docs edit <url> ✅ Editor spawns detached ✅ CLI exits in <1 second ✅ Agent continues processing ✅ Workflow completes successfully ✅ No manual intervention needed ISSUE #21: ✅ RESOLVED ─────────────────────── The docs edit command now: • Works perfectly in automated workflows • Doesn't hang AI agents or scripts • Exits immediately by default • Supports blocking mode via --wait flag • Handles both URL formats • Provides clear feedback • Has comprehensive documentation DEPLOYMENT STATUS: ✅ READY ──────────────────────────── All tests pass: ✓ Unit tests (7/7) ✓ CLI tests ✓ Real-world agent workflow ✓ Coverage Gap issue processing ✓ URL format support ✓ Non-blocking verification ✓ Blocking mode verification Scenario: AI agent processes GitHub Coverage Gap issues Issues: #6702, Results: • Fetched issues from GitHub ✅ • Used docs edit to locate files ✅ • Identified missing docs (Coverage Gaps) ✅ • Found existing docs ✅ • No hangs, no timeouts ✅ • Total time: 2 seconds for 3 issues ✅ * refactor(cli): move docs CLI to dedicated scripts/docs-cli directory - Organize all CLI tools and tests in scripts/docs-cli/ - Update package.json bin and script paths - Update setup-local-bin.js to point to new location - Fix import paths in docs-edit.js and docs-create.js - Update SKILL.md with new features (--wait, --editor, path support) - Update ISSUE-21-FIX-README.md with new structure - Add comprehensive README.md for docs-cli directory - All tests passing, non-blocking behavior verified Closes #21 * feat(cli): add non-blocking editor support to docs create - Add --open flag to open created files in editor - Add --wait flag for blocking mode (use with --open) - Add --editor flag for explicit editor selection - Uses same editor resolution and process management as docs edit - Non-blocking by default to prevent agent hanging - Update all documentation with new examples - Maintains backwards compatibility (--open is optional) This completes the non-blocking implementation across both docs edit and docs create commands. * docs: update Copilot instructions with complete CLI tool reference - Add docs create --open to Quick Reference table - Document both create and edit commands comprehensively - Add editor configuration section (shared between commands) - Update content.instructions.md with CLI workflow examples - Add NON-BLOCKING-IMPLEMENTATION-COMPLETE.md summary document - Clarify non-blocking behavior for AI agents * chore: remove ephemeral documentation files Remove temporary documentation files used during development: - CLAUDE-docs-tooling-issue21.md - IMPLEMENTATION-SUMMARY.md - ISSUE-21-FIX-README.md - NON-BLOCKING-IMPLEMENTATION-COMPLETE.md - TEST-RESULTS.md All relevant documentation has been integrated into: - README.md - scripts/docs-cli/README.md - .github/copilot-instructions.md - .github/instructions/content.instructions.md - .claude/skills/docs-cli-workflow/SKILL.md * Fix url-parser.js broken import by moving to shared library location (#6727) * Initial plan * refactor: move url-parser.js to shared library location and fix imports Co-authored-by: jstirnaman <212227+jstirnaman@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jstirnaman <212227+jstirnaman@users.noreply.github.com> * Update scripts/docs-cli/__tests__/process-manager.test.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update scripts/docs-cli/__tests__/editor-resolver.test.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| __tests__ | ||
| lib | ||
| README.md | ||
| docs-cli.js | ||
| docs-create.js | ||
| docs-edit.js | ||
README.md
Documentation CLI Tools
This directory contains command-line tools for working with the InfluxData documentation repository.
Structure
scripts/docs-cli/
├── README.md # This file
├── docs-cli.js # Main CLI entry point
├── docs-edit.js # Edit existing documentation
├── docs-create.js # Create new documentation
├── lib/ # CLI-specific modules
│ ├── editor-resolver.js # Smart editor selection
│ ├── process-manager.js # Process spawning (detached/attached)
│ └── url-parser.js # URL parsing utilities
└── __tests__/ # Unit tests
├── editor-resolver.test.js # Editor resolution tests
├── process-manager.test.js # Process management tests
└── run-tests.sh # Test runner script
Installation
The docs command is automatically configured when you run:
yarn install
This creates a symlink in node_modules/.bin/docs pointing to docs-cli.js.
Commands
docs edit - Edit Existing Documentation
Opens documentation files in your preferred editor. Non-blocking by default (agent-friendly).
Usage
# Quick edit (exits immediately, editor in background)
docs edit <url-or-path>
docs edit https://docs.influxdata.com/influxdb3/core/admin/
docs edit /influxdb3/core/admin/
# Interactive edit (waits for editor to close)
docs edit <url-or-path> --wait
# List files without opening
docs edit <url-or-path> --list
# Use specific editor
docs edit <url-or-path> --editor nano
Options
--list- List files without opening editor--wait- Wait for editor to close (blocking mode)--editor <command>- Use specific editor (e.g.,vim,nano,code --wait)
Editor Configuration
The CLI selects an editor in this priority order:
--editorflagDOCS_EDITORenvironment variableVISUALenvironment variableEDITORenvironment variable- System default (vim, nano, etc.)
Examples:
# Set editor for all commands
export EDITOR=vim
# Set editor specifically for docs CLI
export DOCS_EDITOR=nano
# Use VS Code with built-in wait flag
export DOCS_EDITOR="code --wait"
docs create - Create New Documentation
Scaffolds new documentation pages with proper frontmatter and structure.
Usage
# Create from draft file
docs create <draft-path> --products <product-key>
# Create at specific URL location
docs create --url <url> --from-draft <draft-path>
# Create and open files in editor (non-blocking)
docs create <draft-path> --products <product-key> --open
# Create and open files, wait for editor (blocking)
docs create <draft-path> --products <product-key> --open --wait
# Use specific editor
docs create <draft-path> --products <product-key> --open --editor nano
Options
--open- Open created files in editor after creation (non-blocking by default)--wait- Wait for editor to close (use with--open)--editor <command>- Use specific editor (e.g.,vim,nano,code --wait)--products <keys>- Comma-separated product keys--url <url>- Documentation URL for new content location--dry-run- Show what would be created without creating files--yes- Skip confirmation prompt
See docs create --help for full options.
Editor Configuration
The --open flag uses the same editor resolution as docs edit:
--editorflagDOCS_EDITORenvironment variableVISUALenvironment variableEDITORenvironment variable- System default (vim, nano, etc.)
Examples:
# Set editor for docs CLI
export DOCS_EDITOR=nano
# Create and open in one command
docs create drafts/feature.md --products influxdb3_core --open
# Create, open, and wait
docs create drafts/feature.md --products influxdb3_core --open --wait
docs placeholders - Add Placeholder Syntax
Adds placeholder syntax to code blocks for interactive examples.
docs placeholders <file-path>
Testing
Run All Tests
bash scripts/docs-cli/__tests__/run-tests.sh
Run Individual Tests
node scripts/docs-cli/__tests__/editor-resolver.test.js
node scripts/docs-cli/__tests__/process-manager.test.js
Manual Verification
# Test non-blocking mode (should exit immediately)
time docs edit /influxdb3/core/admin/ --editor echo
# Test blocking mode (should wait)
time docs edit /influxdb3/core/admin/ --wait --editor echo
# Test list mode
docs edit /influxdb3/core/admin/ --list
Implementation Details
Non-Blocking by Default
The docs edit command spawns the editor as a detached process and exits immediately. This prevents AI agents and automation scripts from hanging indefinitely.
Key modules:
lib/editor-resolver.js- Resolves the editor command from multiple sourceslib/process-manager.js- Spawns processes in detached (non-blocking) or attached (blocking) mode
URL Parsing
The CLI supports both full URLs and path-only formats:
# Both of these work:
docs edit https://docs.influxdata.com/influxdb3/core/admin/
docs edit /influxdb3/core/admin/
The lib/url-parser.js module handles URL parsing and maps documentation URLs to source files in the repository.
Shared Content Detection
When a page uses shared content (via the source frontmatter field), the CLI identifies both:
- The frontmatter file (defines page metadata)
- The shared source file (contains actual content)
Both files are opened for editing.
Issue #21 Fix
This directory structure was created as part of fixing issue #21, where the docs edit command caused agents to hang waiting for the editor.
Changes:
- Made non-blocking the default behavior
- Added
--waitflag for interactive editing - Added
--editorflag for explicit editor selection - Improved editor resolution with multiple fallbacks
- Organized CLI code into dedicated directory
Documentation:
- ISSUE-21-FIX-README.md - Implementation overview
- IMPLEMENTATION-SUMMARY.md - Detailed implementation
- TEST-RESULTS.md - Test verification
Contributing
When modifying these tools:
- Update tests in
__tests__/ - Run the test suite:
bash scripts/docs-cli/__tests__/run-tests.sh - Update this README if adding new commands or features
- Test both blocking and non-blocking modes
- Verify editor resolution works correctly
Help
For command-specific help:
docs --help
docs edit --help
docs create --help
For general documentation contribution guidelines, see DOCS-CONTRIBUTING.md.