-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskfile.yml
More file actions
197 lines (169 loc) · 5.57 KB
/
Taskfile.yml
File metadata and controls
197 lines (169 loc) · 5.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
version: "3"
vars:
PROJECT_NAME: claudefiles
tasks:
default:
desc: Show available tasks
cmds:
- task --list
silent: true
# Markdown linting tasks
lint:md:
desc: Lint all markdown files and check links
silent: true
cmds:
- echo "=== Checking markdown formatting ==="
- npx markdownlint --config ~/.markdownlint.json '**/*.md' --ignore node_modules
- echo ""
- echo "=== Checking links ==="
- find . -name "*.md" -not -path "./node_modules/*" -print0 | xargs -0 npx markdown-link-check --quiet 2>/dev/null || true
lint:md:uncommitted:
desc: Lint all uncommitted markdown files (modified, staged, and untracked)
silent: true
preconditions:
- sh: git rev-parse --git-dir 2>/dev/null
msg: "Not in a git repository"
cmds:
- |
# Collect all uncommitted markdown files
# Using a simpler approach that handles spaces properly
# Get all modified, staged, and untracked markdown files
FILES=$(
{
git diff --name-only --diff-filter=ACMR '*.md' 2>/dev/null || true
git diff --cached --name-only --diff-filter=ACMR '*.md' 2>/dev/null || true
git ls-files --others --exclude-standard '*.md' 2>/dev/null || true
} | sort -u
)
if [ -z "$FILES" ]; then
echo "✅ No uncommitted markdown files to check"
exit 0
fi
echo "Checking uncommitted markdown files:"
echo "$FILES" | sed 's/^/ • /'
echo ""
echo "=== Checking formatting ==="
# Handle files with spaces using proper quoting
if [ -n "$FILES" ]; then
echo "$FILES" | xargs -I {} npx markdownlint --config ~/.markdownlint.json "{}"
fi
echo ""
echo "=== Checking links ==="
if [ -n "$FILES" ]; then
echo "$FILES" | xargs -I {} npx markdown-link-check --quiet "{}" 2>/dev/null || true
fi
lint:md:fix:
desc: Auto-fix markdown issues in all files
silent: true
cmds:
- npx markdownlint --fix --config ~/.markdownlint.json '**/*.md' --ignore node_modules
- echo "✅ Auto-fix complete. Run 'task lint:md' to verify remaining issues."
lint:md:fix:uncommitted:
desc: Auto-fix markdown issues in all uncommitted files (modified, staged, and untracked)
silent: true
preconditions:
- sh: git rev-parse --git-dir 2>/dev/null
msg: "Not in a git repository"
cmds:
- |
# Collect all uncommitted markdown files
# Using a simpler approach that handles spaces properly
# Get all modified, staged, and untracked markdown files
FILES=$(
{
git diff --name-only --diff-filter=ACMR '*.md' 2>/dev/null || true
git diff --cached --name-only --diff-filter=ACMR '*.md' 2>/dev/null || true
git ls-files --others --exclude-standard '*.md' 2>/dev/null || true
} | sort -u
)
if [ -z "$FILES" ]; then
echo "✅ No uncommitted markdown files to fix"
exit 0
fi
echo "Auto-fixing uncommitted markdown files:"
echo "$FILES" | sed 's/^/ • /'
echo ""
# Handle files with spaces using xargs -I
if [ -n "$FILES" ]; then
echo "$FILES" | xargs -I {} npx markdownlint --fix --config ~/.markdownlint.json "{}"
fi
echo ""
echo "✅ Auto-fix complete. Run 'task lint:md:uncommitted' to verify remaining issues."
# Alias tasks for convenience
lint:
desc: Lint all markdown files (alias for lint:md)
cmds:
- task: lint:md
fix:
desc: Auto-fix markdown issues in all files (alias for lint:md:fix)
cmds:
- task: lint:md:fix
# Git-related utilities
status:
desc: Show git status
silent: true
cmds:
- git status --short
status:md:
desc: Show uncommitted markdown files
silent: true
cmds:
- |
git status --porcelain | while IFS= read -r line; do
filename="${line:3}"
# Strip quotes if present
[[ "$filename" == \"*\" ]] && filename="${filename:1:-1}"
# Check for .md extension
if [[ "$filename" == *.md ]]; then
echo "$filename"
fi
done
git:analyze:
desc: Analyze git changes for commit planning
silent: true
cmds:
- echo "=== Git Status ==="
- git status --short --branch
- echo ""
- echo "=== Staged Changes ==="
- git diff --cached --stat
- git diff --cached --name-status
- echo ""
- echo "=== Unstaged Changes ==="
- git diff --stat
- git diff --name-status
- echo ""
- echo "=== Untracked Files ==="
- git ls-files --others --exclude-standard
diff:
desc: Show uncommitted changes
cmds:
- git diff
# Cleanup tasks
clean:
desc: Clean temporary files
cmds:
- rm -f *.log
- rm -f .DS_Store
- find . -name "*.swp" -delete 2>/dev/null || true
- find . -name "*~" -delete 2>/dev/null || true
- echo "✅ Cleaned temporary files"
# Installation tasks
install:tools:
desc: Install required tools
cmds:
- |
echo "Installing required tools..."
# Note: markdownlint is used via npx, no global install needed
echo "✓ markdownlint will be run via npx"
echo ""
echo "✅ All tools installed successfully"
# Check tasks
check:
desc: Run all checks (markdown linting)
cmds:
- task: lint:md
check:uncommitted:
desc: Check only uncommitted files
cmds:
- task: lint:md:uncommitted