Commit Graph

11 Commits (claude/shell-script-linter-YcINf)

Author SHA1 Message Date
Jason Stirnaman f7bb8b8204
chore(scripts): JS style fix (#6780) 2026-02-04 17:07:14 -06:00
Jason Stirnaman b204de8ffe
chore: improve docs-cli with unified flag syntax and YAML config (#6778)
* chore(instruction): Add content-editing skill documentation workflow
guide

* Phase 1: Add CLI configuration system

- Add config-loader.js with .env support and smart repo detection
- Add config/.env.example template (no real values)
- Add config/README.md with comprehensive configuration docs
- Configuration uses generic flags (DOCS_ENTERPRISE_ACCESS) not private repo names
- All .env files already gitignored via existing .gitignore pattern

Validation:
 Config loads and finds docs-v2 repo automatically
 Defaults work without .env file (hasEnterpriseAccess=false)
 .env files properly gitignored

* Phase 2: Migrate libraries with security fix and quick wins

**Shared Libraries Added:**
- content-utils.js - Shared content detection and management
- api-auditor.js - API documentation auditing (WITH SECURITY FIX)
- api-audit-reporter.js - API audit report generation
- api-parser.js - Parse API definitions from code
- api-request-parser.js - Parse API request/response specs
- api-doc-scanner.js - Scan documentation for API coverage
- telegraf-auditor.js - Telegraf plugin auditing
- telegraf-audit-reporter.js - Telegraf audit reports
- version-utils.js (NEW) - Version normalization utilities

**SECURITY FIX APPLIED:**
 Removed: hardcoded 'https://github.com/influxdata/influxdb_pro.git'
 Removed: directory name 'influxdb-pro-clone'
 Added: Uses process.env.INFLUXDB_PRO_REPO_URL from config
 Added: Clear error message if not configured
 Added: Generic directory name 'enterprise-clone'

**Quick Wins Added:**
1. Version normalization (version-utils.js)
   - Handles v3.9, 3.9, v3.9.0, 3.9.0 automatically
   - Suggests matching tags when version not found

2. Enhanced path discovery (config-loader.js)
   - Searches parent directories (up to 3 levels)
   - Finds sibling repositories automatically

3. Progress indicators (deferred to Phase 3)
   - Will add ora package with commands

Validation:
 grep shows NO 'influxdb_pro' or 'influxdb-pro' references
 api-auditor.js uses process.env.INFLUXDB_PRO_REPO_URL
 All library files import successfully

* Phase 3: Add new commands

**Commands Added:**
- audit.js - API and Telegraf documentation auditing
- release-notes.js - Generate release notes from git commits
- add-placeholders.js - Add placeholder syntax to code blocks (moved from scripts/)

**Changes:**
- Created scripts/docs-cli/commands/ directory
- Wrapped add-placeholders.js for CLI router compatibility
- Updated package.json: docs:add-placeholders script path
- Added CLI-MIGRATION-DESIGN.md documentation

**Command Structure:**
All commands export default async function for unified CLI router:
  export default async function commandName({ args, command }) { ... }

Validation:
 All three command files present in commands/
 add-placeholders.js has export wrapper
 package.json points to new location

* Phase 4: Update existing commands (create, edit)

**Commands Updated:**
- Moved docs-create.js → commands/create.js
- Moved docs-edit.js → commands/edit.js

**Changes:**
Both commands now:
- Located in commands/ directory for consistency
- Use unified CLI structure (export default async function)
- Maintain findDocsV2Root() for portability
- Can be called via router or directly

**Files Removed:**
- scripts/docs-cli/docs-create.js (moved to commands/)
- scripts/docs-cli/docs-edit.js (moved to commands/)

Validation:
 Old files removed
 New files in commands/ directory
 Git detected as rename (preserves history)
 Both have proper export wrappers for CLI router

* Phase 5: Update router with dynamic command loading

**Router Updated:**
- Replaced basic router with enhanced version from docs-tooling
- Dynamic command loading from ./commands/ directory
- Comprehensive help with all commands listed
- Better error handling with DEBUG mode support
- Version flag (--version) support

**Changes:**
- Updated help text for docs-v2 (was docs-tooling)
- Added add-placeholders command to help
- Fixed configuration path references
- Updated GitHub URL to docs-v2

**Features:**
- Handles --help, --version, unknown commands
- Shows usage on error
- DEBUG env var for stack traces
- Clean error messages for missing commands

Validation:
 docs --help shows all 5 commands
 Help text references correct paths
 Router loads commands dynamically
 Error handling works correctly

* Fix: Correct package.json path for --version flag

The router was looking in scripts/package.json instead of repo root.
Updated to go up two levels: docs-cli -> scripts -> repo root

Test: npx docs --version now works correctly

* feat: Enhance docs CLI with placeholders alias and update documentation

- Add command alias support to router (placeholders -> add-placeholders)
- Update docs-cli-workflow SKILL.md with all 5 CLI commands
- Update content-editing SKILL.md quick reference with new commands
- Create consolidated influxdb3-tech-writer agent for all v3 products
- Document tech-writer agent consolidation recommendation

* chore(claude): Consolidate tech-writer agents:

1. **influxdb3-tech-writer** (consolidated) - Handles ALL InfluxDB 3
products
   - InfluxDB 3 Core (self-hosted, open source)
   - InfluxDB 3 Enterprise (self-hosted, licensed)
   - InfluxDB 3 Cloud Dedicated (managed, dedicated)
   - InfluxDB 3 Cloud Serverless (managed, serverless)
   - InfluxDB 3 Clustered (Kubernetes)

2. **influxdb1-tech-writer** (unchanged) - Handles InfluxDB v1 legacy
products
   - InfluxDB v1 OSS
   - InfluxDB v1 Enterprise
   - Chronograf, Kapacitor

* fix: Fix CLI import paths and add npm run scripts

- Fix create.js imports: content-scaffolding, file-operations, url-parser
  now correctly reference ../../lib/ (scripts/lib/)
- Fix edit.js import: url-parser now references ../../lib/
- Fix create.js REPO_ROOT: change const to let for reassignment
- Update package.json with all docs:* npm scripts routing through unified CLI
- Improve error handling: distinguish unknown commands from runtime errors

* fix: Fix remaining dynamic import paths in create.js, add integration tests

- Fix dynamic imports in create.js (lines 487, 1286) using wrong paths
- Add cli-integration.test.js that catches import/module errors by
  actually executing commands, not just testing --help
- Tests verify commands load and run without ERR_MODULE_NOT_FOUND
- Update run-tests.sh to include integration tests

This would have caught the import path errors that broke 'docs create'.

* fix: Fix argument parsing for CLI router, improve integration tests

- create.js: Pass args from router to parseArgs() instead of re-reading
  process.argv (which includes 'create' as first positional)
- add-placeholders.js: Refactor to defer argument parsing to main()
  instead of parsing at module load time
- cli-integration.test.js: Stricter tests that check exit codes and
  error patterns, not just import errors
- Tests now verify commands actually execute successfully, catching
  runtime errors that --help tests would miss

* fix: Fix .tmp directory location and worktree detection

- findDocsV2Root(): Fix package.json name check (@influxdata/docs-site)
- findDocsV2Root(): Prioritize cwd walk-up over env var to find worktrees
- create.js: Change path constants to let for proper reassignment
- .tmp now correctly created in repo root, not scripts/docs-cli/

* chore(docs-cli): Handle piping in create command with helpful errors and
skips

* refactor(docs-cli): unify flag syntax and improve configuration

- Separate --products (product keys) from --repos (paths/URLs) in
  release-notes and audit commands
- Use consistent <positional> --flags syntax across commands
- Replace INFLUXDB_PRO with INFLUXDB_ENTERPRISE naming
- Move config from .env to YAML format (~/.influxdata-docs/docs-cli.yml)
- Output release notes to .tmp/release-notes/ (gitignored)
- Add integration tests for new flag syntax
- Update help text to reflect unified CLI usage

* chore: remove deprecated release-notes script and configs

- Remove helper-scripts/common/generate-release-notes.js (migrated to unified CLI)
- Remove orphaned config files (influxdb-v1.json, influxdb-v2.json, etc.)
- Update workflows to reference unified CLI (docs release-notes)
- Update helper-scripts READMEs to remove deprecated documentation

* feat(docs-cli): add path support to --products flag

Add a unified product-resolver module that accepts content paths
(e.g., /influxdb3/core) in addition to product keys (influxdb3_core)
for the --products flag across all docs CLI commands.

Changes:
- Add lib/product-resolver.js for path-to-key resolution
- Update audit command: remove positional args, use --products/--repos
- Update release-notes: add path support, enforce mutual exclusion
- Update create: add path support via resolveProducts()
- Update main CLI help text with new syntax examples
- Add 30 unit tests for product-resolver module
- Update integration tests for new audit syntax

BREAKING CHANGE: audit command no longer accepts positional arguments.
Use `docs audit --products influxdb3_core` instead of `docs audit core`.

* Update skills and commands for new docs CLI syntax

- Update content-editing skill with new --products flag syntax
  - Document path-to-key resolution (e.g., /influxdb3/core -> influxdb3_core)
  - Update Quick Reference table with correct command examples

- Update docs-cli-workflow skill
  - Add examples showing both product keys and content paths
  - Document mutual exclusion between --products and --repos
  - Update audit command syntax (removed positional arguments)

- Replace enhance-release-notes.md with prepare-release-notes.md
  - New command documents docs release-notes CLI usage
  - Includes examples with --products and --repos flags

* feat(github): add Copilot instructions management and DRY refactor

- Add copilot-instructions-agent.md for creating/managing Copilot instructions
- DRY refactor of copilot-instructions.md (485→240 lines, 50% reduction)
- Update all pattern-specific instructions to reference Claude skills
- Add comprehensive cross-references between Copilot and Claude resources
- Document unified docs CLI with non-blocking defaults
- Add COPILOT-INSTRUCTIONS-UPDATE.md summary document

Key improvements:
- Single source of truth (Claude skills) with focused Copilot summaries
- Concise, scannable instructions with links to detailed resources
- Consistent structure across all instruction files
- Better guidance on when to use CLI tools vs direct editing

* refactor(docs-cli): fix unused code and env var naming

Address PR feedback from Copilot code review:

- Rename INFLUXDB_ENTERPRISE_REPO_URL to INFLUXDB3_ENTERPRISE_REPO_URL
  for consistency with InfluxDB 3 naming conventions
- Fix misleading error message to point to correct config location
- Remove unused detectEnterpriseEndpoints import from api-auditor.js
- Remove unused endpointParams variable from api-auditor.js
- Remove unused auditType variable in audit.js loop
- Remove unused assertDeepEquals function from product-resolver tests
2026-02-04 16:44:35 -06:00
Jason Stirnaman bd6f7481b0
Dar 588 plugins (#6718)
* fix(influxdb3): source comments

* docs(influxdb3): fix plugin path handling and improve Get Started clarity

Fixes issues with plugin filename resolution and improves progressive
disclosure in the processing engine Get Started guide.

- Update `--plugin` flag to `--path` (current CLI syntax)
- Clarify plugin filename must be provided without relative/absolute paths
- Add note explaining path resolution relative to `--plugin-dir`
- Document single-file vs multi-file plugin path requirements
- Link to detailed multi-file plugin structure documentation

- Add "Before you begin" section listing required setup steps
- Add prerequisites to table of contents
- Improve progressive disclosure by front-loading essentials

- Update trigger type from "Data write" to "WAL rows" (consistent with `influxdb3 create trigger --help`) with WAL link
- Replace `--plugin` with `--path` in trigger creation example
- Fix syntax error in enable trigger example (missing backslash)
- Clarify plugin example as "data write (WAL) plugin"
- Update code comments for clarity and remove outdated notes
- Specify "wal_rows trigger specification" terminology

- Specify testing "process_writes (WAL) plugin" for clarity
- Reference multiple test commands, not just wal_plugin
- Add link to schedule_plugin test command
- Clarify that PLUGIN_FILENAME should be filename only

- Prevents path resolution errors users encountered
- Aligns documentation with current CLI behavior
- Improves Get Started guide readability and flow
- Reduces confusion about plugin file handling

Closes #588

* docs(influxdb3): Docker Compose optional plugin directory
- Added inline comments to Docker Compose examples: `# Optional: only
  needed for processing engine plugins`
- Appears for both `--plugin-dir` flag and volume mount
- Helps users understand they can skip this if not using plugins
- Better progressive disclosure - users see it's optional without
  needing separate explanation

* docs(influxdb3): Replace --plugin-filename with --path
- Uses `--path` for plugins, replacing deprecated `--plugin-filename`
- Replaces "Data write" with "WAL rows" to be consistent with CLI help
  docs

* Update content/shared/influxdb3-get-started/processing-engine.md

* fix(deps): add missing yarn.lock updates for puppeteer

The puppeteer dependency was added to package.json in commit 784956a31
but yarn.lock was not updated, causing CI failures with --frozen-lockfile.

* chore(deps): upgrade puppeteer to 24.35.0

- Upgrade puppeteer from 23.11.1 to 24.35.0
- Fix deprecated page.waitForTimeout() - replaced with Promise/setTimeout
- Fix deprecated headless: 'new' - now just uses headless boolean

The 'new' headless mode is now the default in Puppeteer 24.
2026-01-14 18:17:14 -06:00
Jason Stirnaman 784956a31c
feat: add Puppeteer integration for AI agent development (#6736)
Add Puppeteer utilities and scripts to enable AI agents to interactively
test and debug the documentation site during development.

Dependencies: puppeteer, pixelmatch, pngjs
Scripts: debug:browser, debug:screenshot, debug:inspect
Tools: 20+ helper functions, example scripts, comprehensive documentation

Enables AI agents to visually debug pages, test components, monitor
performance, and detect issues during development.

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-14 17:26:27 -06:00
Jason Stirnaman 925a26e580
fix(cli): Make docs edit non-blocking and reorganize CLI code (#6721)
* 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>
2026-01-13 21:47:09 -06:00
Jason Stirnaman cb37ee2574
fix: tab names in generated Markdown (#6698)
- maintains semantic flow of tab labels and code-tab labels with their
  tab contents
- formats labels in bold to avoid breaking heading level semantics
- wraps tabbed content in begin/end comments to denote options
2026-01-06 09:57:47 -06:00
Jason Stirnaman 4cb455b1ae
feat(ci): add incremental builds and shared content-utils (#6582)
- Incremental Markdown build for PRs, full build for production
- Shared content-utils library for:
  - Mapping shared content to consuming pages (Markdown generation, Cypress)
  - Listing changed content pages (committed, uncommitted, staged)
  - Extracting source frontmatter (docs edit)
- Fix CSS parsing warnings with JSDOM VirtualConsole
- Remove unused imports and variables
2025-12-01 19:45:42 -05:00
Jason Stirnaman 2dd1956a18
fix(ci): add --public-dir argument to build-llm-markdown.js (#6581)
CircleCI builds Hugo to workspace/public, but the markdown generator
was hardcoded to look in public/. Added --public-dir argument:

- Default: public (for local dev and staging)
- CI: --public-dir workspace/public

Staging deployment (deploy-staging.sh) uses default public/ and
continues to work unchanged.
2025-12-01 13:19:01 -06:00
Jason Stirnaman c2093c8212
Feature: Generate documentation in LLM-friendly Markdown (#6555)
* feat(llms): LLM-friendly Markdown, ChatGPT and Claude links.

This enables LLM-friendly documentation for entire sections,
allowing users to copy complete documentation sections with a single click.

Lambda@Edge now generates .md files on-demand with:
- Evaluated Hugo shortcodes
- Proper YAML frontmatter with product metadata
- Clean markdown without UI elements
- Section aggregation (parent + children in single file)

The llms.txt files are now generated automatically during build from
content structure and product metadata in data/products.yml, eliminating
the need for hardcoded files and ensuring maintainability.

**Testing**:
- Automated markdown generation in test setup via cy.exec()
- Implement dynamic content validation that extracts HTML content and
  verifies it appears in markdown version

**Documentation**:
Documents LLM-friendly markdown generation

**Details**:
Add gzip decompression for S3 HTML files in Lambda markdown generator

HTML files stored in S3 are gzip-compressed but the Lambda was attempting
to parse compressed data as UTF-8, causing JSDOM to fail to find article
elements. This resulted in 404 errors for .md and .section.md requests.

- Add zlib gunzip decompression in s3-utils.js fetchHtmlFromS3()
- Detect gzip via ContentEncoding header or magic bytes (0x1f 0x8b)
- Add configurable DEBUG constant for verbose logging
- Add debug logging for buffer sizes and decompression in both files

The decompression adds ~1-5ms per request but is necessary to parse
HTML correctly. CloudFront caching minimizes Lambda invocations.

Await async markdown conversion functions

The convertToMarkdown and convertSectionToMarkdown functions are async
but weren't being awaited, causing the Lambda to return a Promise object
instead of a string. This resulted in CloudFront validation errors:
"The body is not a string, is not an object, or exceeds the maximum size"

**Troubleshooting**:

- Set DEBUG for troubleshooting in lambda

* feat(llms): Add build-time LLM-friendly Markdown generation

Implements static Markdown generation during Hugo build.

**Key Features:**
- Two-phase generation: HTML→MD (memory-bounded), MD→sections (fast)
- Automatic redirect detection via file size check (skips Hugo aliases)
- Product detection using compiled TypeScript product-mappings module
- Token estimation for LLM context planning (4 chars/token heuristic)
- YAML serialization with description sanitization

**Performance:**
- ~105 seconds for 5,000 pages + 500 sections
- ~300MB peak memory (safe for 2GB CircleCI environment)
- 23 files/sec conversion rate with controlled concurrency

**Configuration Parameters:**
- MIN_HTML_SIZE_BYTES (default: 1024) - Skip files below threshold
- CHARS_PER_TOKEN (default: 4) - Token estimation ratio
- Concurrency: 10 workers (CI), 20 workers (local)

**Output:**
- Single pages: public/*/index.md (with frontmatter + content)
- Section bundles: public/*/index.section.md (aggregated child pages)

**Files Changed:**
- scripts/build-llm-markdown.js (new) - Main build script
- scripts/lib/markdown-converter.cjs (renamed from .js) - Core conversion
- scripts/html-to-markdown.js - Updated import path
- package.json - Updated exports for .cjs module

Related: Replaces Lambda@Edge on-demand generation (5s response time)
with build-time static generation for production deployment.

feat(deploy): Add staging deployment workflow and update CI

Integrates LLM markdown generation into deployment workflows with
a complete staging deployment solution.

**CircleCI Updates:**
- Switch from legacy html-to-markdown.js to optimized build:md
- 2x performance improvement (105s vs 200s+ for 5000 pages)
- Better memory management (300MB vs variable)
- Enables section bundle generation (index.section.md files)

**Staging Deployment:**
- New scripts/deploy-staging.sh for local staging deploys
- Complete workflow: Hugo build → markdown gen → S3 upload
- Environment variable driven configuration
- Optional step skipping for faster iteration
- CloudFront cache invalidation support

**NPM Scripts:**
- Added deploy:staging command for convenience
- Wraps deploy-staging.sh script

**Documentation:**
- Updated DOCS-DEPLOYING.md with comprehensive guide
- Merged staging/production workflows with Lambda@Edge docs
- Build-time generation now primary, Lambda@Edge fallback
- Troubleshooting section with common issues
- Environment variable reference
- Performance metrics and optimization tips

**Benefits:**
- Manual staging validation before production
- Consistent markdown generation across environments
- Faster CI builds with optimized script
- Better error handling and progress reporting
- Section aggregation for improved LLM context

**Usage:**
```bash
export STAGING_BUCKET="test2.docs.influxdata.com"
export AWS_REGION="us-east-1"
export STAGING_CF_DISTRIBUTION_ID="E1XXXXXXXXXX"

yarn deploy:staging
```

Related: Completes build-time markdown generation implementation

refactor: Remove Lambda@Edge implementation

Build-time markdown generation has replaced Lambda@Edge on-demand
generation as the primary method. Removed Lambda code and updated
documentation to focus on build-time generation and testing.

Removed:
- deploy/llm-markdown/ directory (Lambda@Edge code)
- Lambda@Edge section from DOCS-DEPLOYING.md

Added:
- Testing and Validation section in DOCS-DEPLOYING.md
- Focus on build-time generation workflow

* feat: Add Rust HTML-to-Markdown prototype

Implements core markdown-converter.cjs functions in Rust for performance comparison.

Performance results:
- Rust: ~257 files/sec (10× faster)
- JavaScript: ~25 files/sec average

Recommendation: Keep JavaScript for now, implement incremental builds first.
Rust migration provides 10× speedup but requires 3-4 weeks integration effort.

Files:
- Cargo.toml: Rust dependencies (html2md, scraper, serde_yaml, clap)
- src/main.rs: Core conversion logic + CLI benchmark tool
- benchmark-comparison.js: Side-by-side performance testing
- README.md: Comprehensive findings and recommendations

* fix(ui): improve dropdown positioning on viewport resize

- Ensure dropdown stays within viewport bounds (min 8px padding)
- Reposition dropdown on window resize and scroll events
- Clean up event listeners when dropdown closes

* chore(deps): add remark and unified packages for markdown processing

Add remark-parse, remark-frontmatter, remark-gfm, and unified for
enhanced markdown processing capabilities.

* fix(edge): add return to prevent trailing-slash redirect for valid extensions

Without the return statement, the Lambda@Edge function would continue
executing after the callback, eventually hitting the trailing-slash
redirect logic. This caused .md files to redirect to URLs with trailing
slashes, which returned 404 from S3.

* fix(md): add built-in product mappings and full URL support

- Add URL_PATTERN_MAP and PRODUCT_NAME_MAP constants directly in the
  CommonJS module (ESM product-mappings.js cannot be require()'d)
- Update generateFrontmatter() to accept baseUrl parameter and construct
  full URLs for the frontmatter url field
- Update generateSectionFrontmatter() similarly for section pages
- Update all call sites to pass baseUrl parameter

This fixes empty product fields and relative URLs in generated markdown
frontmatter when served via Lambda@Edge.

* feat(md): add environment flag for base URL control

Add -e, --env flag to html-to-markdown.js to control the base URL
in generated markdown frontmatter. This matches Hugo's -e flag behavior
and allows generating markdown with staging or production URLs.

Also update build-llm-markdown.js with similar environment support.

* feat(md): add Rust markdown converter and improve validation

- Add Rust-based HTML-to-Markdown converter with NAPI-RS bindings
- Update Cypress markdown validation tests
- Update deploy-staging.sh with force upload flag

* deploy-staging.sh:
  - Defaults STAGING_URL to https://test2.docs.influxdata.com
  if not set
  - Exports it so yarn build:md -e staging can use it
  - Displays it in the summary

* Delete scripts/prototypes/rust-markdown/benchmark-comparison.js

* Delete scripts/prototypes directory

* fix(llms): Include full URL for section page Markdown and list of child pages

* feat(llms): clarify format selector text for AI use case

Update button and dropdown text to make the AI/LLM purpose clearer:
- Button: "Copy page for AI" / "Copy section for AI"
- Sublabel: "Clean Markdown optimized for AI assistants"
- Section sublabel: "{N} pages combined as clean Markdown for AI assistants"

Cypress tests updated and passing (13/13).

---------

Co-authored-by: Scott Anderson <scott@influxdata.com>
2025-12-01 12:32:28 -06:00
Jason Stirnaman e8a48e3482
chore(docs): Redesign docs CLI tools for creating and editing content, add content/create.md tutorial page for the How to creat… (#6506)
* chore(docs): Add content/create.md tutorial page for the How to create your own documentation tutorial

chore(scripts): docs:create and docs:edit scripts for content creation and editing

Major improvements to docs:create UX for both Claude Code and external tool integration:

**New `docs` CLI command:**
- Add scripts/docs-cli.js - main CLI with subcommand routing
- Add bin field to package.json for `docs` command
- Usage: `docs create` and `docs edit` (cleaner than yarn commands)

**Smart piping detection:**
- Auto-detect when stdout is piped (\!process.stdout.isTTY)
- When piping: automatically output prompt text (no flag needed)
- When interactive: output prompt file path
- --print-prompt flag now optional (auto-enabled when piping)

**Specify products:**
- simplify link following behavior - treat relative paths as local files, all HTTP/HTTPS as external
- stdin now requires --products flag with product keys
- --products now accepts keys from products.yml (influxdb3_core, telegraf, etc.)

Examples:
  --products influxdb3_core
  --products influxdb3_core,influxdb3_enterprise
  --products telegraf

**Usage examples:**
  # Inside Claude Code - automatic execution
  docs create drafts/new-feature.md

  # Pipe to external AI - prompt auto-detected
  docs create FILE --products X | claude -p
  docs create FILE --products X | copilot -p

  # Pipe from stdin
  echo 'content' | docs create --products X | claude -p

Benefits:
- Cleaner syntax (no yarn --silent needed)
- No manual --print-prompt flag when piping
- Consistent with industry tools (git, npm, etc.)
- Backward compatible with yarn commands

WIP: docs:create usage examples

- Redesign of the docs CLI tools for creating and editing content
- Cleaner interface works better for piping output to agents and downstream utilities
- Updates README.md and other authoring docs

This repository includes a `docs` CLI tool for common documentation workflows:

```sh
npx docs create drafts/new-feature.md --products influxdb3_core

npx docs edit https://docs.influxdata.com/influxdb3/core/admin/

npx docs placeholders content/influxdb3/core/admin/upgrade.md

npx docs --help
```

**Run test cases:**

```sh
npx docs test
```

* Update content/create.md

* Update content/create.md

* Update content/create.md

* Update content/create.md

* Update scripts/templates/chatgpt-prompt.md

* Update DOCS-SHORTCODES.md
2025-11-03 10:18:15 -06:00
Jason Stirnaman 56b459659d
Jts agentsmd (#6486)
* feat(docs): add content scaffolding system with AI-powered analysis

Add yarn docs:create command for intelligent content scaffolding:

- Phase 1: Script analyzes draft and repository structure
- Phase 2: Claude command generates file structure and frontmatter
- Phase 3: Script creates files from proposal

New files:
- scripts/docs-create.js: Main orchestration script
- scripts/lib/content-scaffolding.js: Core scaffolding logic
- scripts/lib/file-operations.js: File I/O utilities
- .claude/commands/scaffold-content.md: Claude analysis command

Features:
- Intelligent product detection (Core, Enterprise, Cloud, etc.)
- Generates complete frontmatter
- Dry-run and interactive confirmation modes

Usage:
  yarn docs:create --from path/to/draft.md
  /scaffold-content
  yarn docs:create --execute

* chore(scripts): docs:create and docs:edit scripts for content creation and editing
2025-10-28 07:20:13 -05:00