Add comprehensive project shortcuts system
- Create config/projects.nix for project definitions with templates - Add scripts/templates/ with basic, content, and research workflows - Create universal project-launcher.sh for template execution - Integrate project system into zsh with dynamic alias generation - Generate projects.json config file for shell script consumption - Update README.md with project shortcuts documentation Projects supported: - blog: Personal blog (content workflow) - mdshortcut: Research project (research workflow) - nix-config: Nix configuration (basic workflow) Usage: proj, blog, mdshortcut, nix-config commands 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
539ba9fef7
commit
af7b855faf
7 changed files with 260 additions and 3 deletions
64
scripts/project-launcher.sh
Executable file
64
scripts/project-launcher.sh
Executable file
|
|
@ -0,0 +1,64 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Universal project launcher - reads project config and launches appropriate template
|
||||
# Usage: project-launcher.sh PROJECT_NAME
|
||||
|
||||
PROJECT_NAME="$1"
|
||||
CONFIG_DIR="$(dirname "$0")/../config"
|
||||
PROJECTS_JSON="$CONFIG_DIR/projects.json"
|
||||
TEMPLATES_DIR="$(dirname "$0")/templates"
|
||||
|
||||
if [ -z "$PROJECT_NAME" ]; then
|
||||
echo "Available projects:"
|
||||
if [ -f "$PROJECTS_JSON" ]; then
|
||||
jq -r '.projects | keys[]' "$PROJECTS_JSON" 2>/dev/null || echo "No projects configured"
|
||||
else
|
||||
echo "No projects configured - run 'home-manager switch' to generate config"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$PROJECTS_JSON" ]; then
|
||||
echo "Error: Projects configuration not found. Run 'home-manager switch' to generate config."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract project configuration
|
||||
PROJECT_CONFIG=$(jq -r ".projects.\"$PROJECT_NAME\"" "$PROJECTS_JSON" 2>/dev/null)
|
||||
if [ "$PROJECT_CONFIG" = "null" ]; then
|
||||
echo "Error: Project '$PROJECT_NAME' not found."
|
||||
echo "Available projects:"
|
||||
jq -r '.projects | keys[]' "$PROJECTS_JSON" 2>/dev/null
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TEMPLATE=$(echo "$PROJECT_CONFIG" | jq -r '.template')
|
||||
SESSION_NAME=$(echo "$PROJECT_CONFIG" | jq -r '.name')
|
||||
CODE_PATH=$(echo "$PROJECT_CONFIG" | jq -r '.codePath')
|
||||
CONTENT_PATH=$(echo "$PROJECT_CONFIG" | jq -r '.contentPath // empty')
|
||||
PAPER_PATH=$(echo "$PROJECT_CONFIG" | jq -r '.paperPath // empty')
|
||||
|
||||
# Launch appropriate template
|
||||
case "$TEMPLATE" in
|
||||
"basic")
|
||||
exec "$TEMPLATES_DIR/basic.sh" "$SESSION_NAME" "$CODE_PATH"
|
||||
;;
|
||||
"content")
|
||||
if [ -z "$CONTENT_PATH" ]; then
|
||||
echo "Error: Content template requires contentPath"
|
||||
exit 1
|
||||
fi
|
||||
exec "$TEMPLATES_DIR/content.sh" "$SESSION_NAME" "$CODE_PATH" "$CONTENT_PATH"
|
||||
;;
|
||||
"research")
|
||||
if [ -z "$PAPER_PATH" ]; then
|
||||
echo "Error: Research template requires paperPath"
|
||||
exit 1
|
||||
fi
|
||||
exec "$TEMPLATES_DIR/research.sh" "$SESSION_NAME" "$CODE_PATH" "$PAPER_PATH"
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown template '$TEMPLATE'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Loading…
Add table
Add a link
Reference in a new issue