-
Notifications
You must be signed in to change notification settings - Fork 0
Build DevOps Cheat-Sheets CLI with Easy Content Management #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build DevOps Cheat-Sheets CLI with Easy Content Management #1
Conversation
Transform static cheatsheets into an interactive, searchable system with focus on making content addition effortless (under 10 seconds). New features: - cs CLI tool with quick add, search, and interactive browsing - Quick capture: cs quick "command" - 2 seconds to save - Standard add with metadata (description, tags, categories) - Interactive add mode with guided prompts - History capture from shell - Template system for new sections (tool, k8s, simple) - Search and browse functionality - Git sync integration - Personal directory for private commands (gitignored) - Auto-categorization based on command prefix Installation: - One-line installer: ./install.sh - Example configuration file - Shell completion and aliases support Templates: - tool.md: Full tool documentation structure - k8s.md: Kubernetes resource template - simple.md: Minimal template The goal is to make adding commands as natural as running them. If it takes more than 10 seconds, the system has failed.
Add robust CI/CD pipeline to ensure code quality before merging to main: **Workflows Added:** 1. **CI Tests** (.github/workflows/ci.yml) - Tests all cs commands (help, index, quick, add, search, list, stats, new) - Validates shell script syntax with shellcheck - Verifies installation process - Checks search index creation and content - Validates templates and configuration files - Tests markdown files are not empty 2. **Quality Checks** (.github/workflows/quality.yml) - Markdown linting with markdownlint - Shell script quality checks with shellcheck - File structure validation - Documentation completeness checks - Security scanning for hardcoded secrets - Verifies .gitignore patterns 3. **Multi-Platform Tests** (.github/workflows/multi-platform.yml) - Tests on Ubuntu and macOS - Tests installation process - Tests with different shells (bash, zsh, sh) - Integration test simulating real user workflow - Verifies cross-platform compatibility 4. **PR Validation** (.github/workflows/pr-check.yml) - Runs all tests on pull requests - Creates PR summary with test results - Additional security and documentation checks - Validates PR title follows conventional commits **Test Script** (test.sh) - Comprehensive local test suite - Can be run locally or in CI - Tests 17 different aspects - Color-coded output for easy reading - Automatic cleanup of test files **README Updates** - Added CI status badges - Shows build status for all workflows - Added MIT license badge All workflows run on: - Pull requests to main branch - Pushes to main branch This ensures high quality and prevents broken code from being merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
cs
Outdated
| # Index all markdown files | ||
| find "$CS_ROOT" -name "*.md" -type f ! -path "*/.git/*" ! -path "*/node_modules/*" | while read -r file; do | ||
| # Extract commands and descriptions | ||
| grep -E '^\|[[:space:]]*`' "$file" 2>/dev/null | while read -r line; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prevent init_index from exiting when no commands found
The script runs with set -euo pipefail, so the grep pipeline used when indexing markdown files aborts the entire CLI whenever a file has no command table rows. In this repository that means cs index (and any command that rebuilds the index, such as cs quick during install) prints “Building search index…” and then exits with a non‑zero status before creating .cs_index. Guard the grep/awk pipelines or tolerate exit status 1 so files without matches don’t terminate the process.
Useful? React with 👍 / 👎.
Simplified init_index function to avoid hanging caused by nested while loops and pipes creating subshells. The function now: - Returns proper exit codes (0 on success) - Doesn't hang in CI environment - Uses simpler pipe structures Note: Index building needs further optimization for entry count, but no longer blocks CI pipeline.
Continues work on init_index to avoid hanging. Function now: - Uses find -exec to avoid subshell issues - Returns exit code 0 - Doesn't hang in CI Index building still needs work for proper content extraction. Will be improved in follow-up commit.
Rewrote init_index function to use awk-based processing which: - Extracts commands from markdown tables correctly - Processes code blocks properly - Avoids shell escaping issues that caused low entry counts - Uses helper script approach to avoid complex quoting Results: - Now indexes 1250+ entries (was only 4) - No longer hangs in CI - Returns proper exit codes - Passes CI validation (requires min 10 entries) This fixes the failing CI test: 'Test search index content'
Fixed issues in pr-check.yml workflow: - Use grep -o + wc -l instead of grep -c to avoid format issues - Add tr -d ' ' to remove extra whitespace from wc output - Handle empty results with default values - Add proper variable quoting - Handle non-PR context gracefully This resolves: - 'integer expression expected' errors - 'Invalid format' errors in GitHub Actions output - Issues with parsing test results All 17 tests pass successfully.
No description provided.