Skip to content

Commit 15525f1

Browse files
committed
Refactor autodocs script and update README with usage examples
- Simplified documentation generation in autodocs - Added basic usage examples to README for context, apply-md, and git-context scripts - Removed unnecessary scripts from autodocs processing - Updated LLM model to claude-3.7-sonnet - Improved context extraction and documentation update workflow
1 parent caad0f9 commit 15525f1

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ Here's a detailed overview of each script in poorcoder:
7676
Extracts relevant code context from your project to send to a web-based LLM.
7777

7878
```bash
79+
# Basic usage with specific files
80+
./context file1.js file2.js
81+
7982
# Copy context directly to clipboard (macOS)
8083
./context --include="src/*.js" --exclude="*.test.js" | pbcopy
8184

@@ -93,6 +96,9 @@ Extracts relevant code context from your project to send to a web-based LLM.
9396
Extracts code blocks from markdown (typically LLM responses) and applies changes to your filesystem.
9497

9598
```bash
99+
# Basic usage with markdown input
100+
cat response.md | ./apply-md
101+
96102
# Paste LLM response from clipboard (macOS)
97103
pbpaste | ./apply-md --dry-run --verbose
98104

@@ -107,6 +113,9 @@ pbpaste | ./apply-md --create-missing
107113
Generates git-related context to help LLMs create meaningful commit messages.
108114

109115
```bash
116+
# Basic usage
117+
./git-context
118+
110119
# Generate context, then use with API-based LLM via CLI tool
111120
git commit -am "$(./git-context | llm -m openrouter/anthropic/claude-3.5-haiku)" -e
112121
```

autodocs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
# autodocs - Automatically update documentation for scripts
44
# Updates individual doc files and README.md based on script content
55

6+
set -ex
7+
68
# Get script directory (works even when called from other directories)
79
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
10+
MODEL=openrouter/anthropic/claude-3.7-sonnet
811

912
# Ensure all commands run from the script's directory
1013
cd "$SCRIPT_DIR"
1114

1215
# List of scripts to process
13-
SCRIPTS=("apply-md" "autocommit" "context" "git-context")
16+
SCRIPTS=(apply-md" "context" "git-context")
1417
1518
echo "Updating documentation files..."
1619
@@ -21,13 +24,9 @@ for script in "${SCRIPTS[@]}"; do
2124
2225
# Define the doc path
2326
DOC_PATH="docs/${script}.md"
24-
25-
# Create the command that will generate the updated documentation
26-
CMD="./context \"$script\" | llm -m openrouter/anthropic/claude-3.5-haiku \"Update the markdown documentation for this script.\" | ./apply-md --create-missing"
27-
28-
# Print and execute the command
29-
echo "$ $CMD"
30-
eval "$CMD"
27+
28+
./context "$DOC_PATH" "$script" --no-prompt --no-ls-files > tmp-context.md
29+
cat tmp-context.md | llm -m "$MODEL" -s "Fix $DOC_PATH to match script. Output it verbatim and nothing else. DO NOT MODIFY ANYTHING ELSE. Do not wrap into \`\`\` code block." | tee "$DOC_PATH"
3130
3231
echo "Updated $DOC_PATH"
3332
echo ""
@@ -39,12 +38,9 @@ done
3938
# Update README.md based on all doc files
4039
echo "Updating README.md..."
4140
42-
# Command to generate updated README.md content
43-
README_CMD="./context \"docs/*.md\" | llm -m openrouter/anthropic/claude-3.5-haiku \"Generate a comprehensive README.md for this collection of scripts based on their documentation.\" | ./apply-md"
44-
45-
# Print and execute the command
46-
echo "$ $README_CMD"
47-
eval "$README_CMD"
41+
./context README.md "docs/*.md" --no-ls-files > tmp-context.md
42+
cat tmp-context.md | llm -m "$MODEL" "Fix README.md to match individual scripts documentation. Output whole file verbatim and nothing else. DO NOT MODIFY ANYTHING ELSE. Do not wrap into \`\`\` code block." | tee README.md
4843
4944
echo "Documentation update complete!"
45+
rm tmp-context.md
5046
exit 0

0 commit comments

Comments
 (0)