From 1c9fcbb73ba761d0cd9cefab2a6a6832a36b82bf Mon Sep 17 00:00:00 2001 From: Brian Madison Date: Fri, 31 Oct 2025 16:51:25 -0500 Subject: [PATCH] shard doc uses npx command --- src/core/tools/shard-doc.xml | 51 ++++++------------------------------ 1 file changed, 8 insertions(+), 43 deletions(-) diff --git a/src/core/tools/shard-doc.xml b/src/core/tools/shard-doc.xml index 3a6ab307..e5e892c0 100644 --- a/src/core/tools/shard-doc.xml +++ b/src/core/tools/shard-doc.xml @@ -12,28 +12,18 @@ - This task ONLY supports automated sharding via @kayvan/markdown-tree-parser - The tool automatically handles: section splitting, heading level adjustment, code block detection, index generation - All markdown formatting is preserved during sharding + Uses `npx @kayvan/markdown-tree-parser` to automatically shard documents by level 2 headings and generate an index - - Check if @kayvan/markdown-tree-parser is installed globally - Run: npm list -g @kayvan/markdown-tree-parser - Inform user that tool needs to be installed - Run: npm install -g @kayvan/markdown-tree-parser - HALT with error message about npm/node requirements - - - + Ask user for the source document path if not provided already Verify file exists and is accessible Verify file is markdown format (.md extension) HALT with error message - + Determine default destination: same location as source file, folder named after source file without .md extension Example: /path/to/architecture.md → /path/to/architecture/ Ask user for the destination folder path ([y] to confirm use of default: [suggested-path], else enter a new path) @@ -44,21 +34,21 @@ HALT with error message - + Inform user that sharding is beginning - Execute command: md-tree explode [source-document] [destination-folder] + Execute command: `npx @kayvan/markdown-tree-parser [source-document] [destination-folder]` Capture command output and any errors HALT and display error to user - + Check that destination folder contains sharded files Verify index.md was created in destination folder Count the number of files created HALT with error message - + Display completion report to user including: - Source document path and name - Destination folder path @@ -70,31 +60,6 @@ - HALT if @kayvan/markdown-tree-parser cannot be installed - HALT if Node.js or npm is not available - HALT if source document does not exist or is inaccessible - HALT if source document is not markdown format (.md) - HALT if destination folder cannot be created - HALT if user does not have write permissions to destination - HALT if md-tree explode command fails - HALT if no output files were created + HALT if npx command fails or produces no output files - - - @kayvan/markdown-tree-parser - md-tree explode [source-document] [destination-folder] - npm install -g @kayvan/markdown-tree-parser - - Node.js installed - npm package manager - Global npm installation permissions - - - Automatic section splitting by level 2 headings - Automatic heading level adjustment - Handles edge cases (code blocks, diagrams) - Generates navigable index.md - Preserves all markdown formatting - - \ No newline at end of file