-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmise.toml
More file actions
240 lines (194 loc) · 7.34 KB
/
Copy pathmise.toml
File metadata and controls
240 lines (194 loc) · 7.34 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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# =============================================================================
# mise Configuration for ExFig
# =============================================================================
# This file defines project tools, tasks, and environment variables.
#
# Bootstrap Binary Version Management:
# ------------------------------------
# The mise version for this project is embedded in ./bin/mise bootstrap binary.
# NO global mise installation required - ./bin/mise is self-contained!
#
# To update mise version:
# 1. Regenerate bootstrap: mise generate bootstrap > ./bin/mise
# 2. Make executable: chmod +x ./bin/mise
# =============================================================================
[settings]
experimental = true
legacy_version_file = false
# =============================================================================
# Git Hooks (native git mechanism via core.hooksPath)
# =============================================================================
# Hooks are stored in .githooks/ directory (tracked in repo)
# Auto-configures on directory entry via hooks.enter
[hooks]
enter = """
git config core.hooksPath .githooks 2>/dev/null || true
"""
# =============================================================================
# Tools
# =============================================================================
[tools]
# --- Swift Development ---
swiftformat = "0.60.1" # Swift code formatting
swiftlint = "0.63.2" # Swift linting
xcsift = "1.2.0" # xcodebuild output filtering
# --- Documentation & Formatting ---
dprint = "0.53.1" # MD/JSON/YAML formatting (Rust, fast)
# --- Git & CI ---
hk = "1.39.0" # Git hooks manager
actionlint = "1.7.11" # GitHub Actions linting
git-cliff = "2.12.0" # Changelog generation
# --- Configuration ---
pkl = "0.31.1" # Configuration language (for hk.pkl)
# --- CLI Spec ---
usage = "3.2.0" # CLI spec → shell completions, docs, man pages
# =============================================================================
# Tasks
# =============================================================================
[tasks.build]
description = "Build the Swift package (debug)"
run = "swift build 2>&1 | xcsift"
[tasks."build:release"]
description = "Build the Swift package (release)"
run = "swift build --configuration release 2>&1 | xcsift"
[tasks.test]
description = "Run all tests (parallel)"
run = "swift build --build-tests 2>&1 | xcsift && swift test --skip-build --parallel 2>&1 | xcsift"
[tasks."test:filter"]
description = "Run tests with filter (usage: mise run test:filter ExFigTests)"
run = "swift test --parallel --filter {{arg(name='filter')}} 2>&1 | xcsift"
[tasks."test:file"]
description = "Run tests for a specific file (usage: mise run test:file Tests/SVGKitTests/SVGParserTests.swift)"
run = """
#!/bin/bash
TEST_CLASS=$(basename "{{arg(name='file')}}" .swift)
swift test --parallel --filter "$TEST_CLASS" 2>&1 | xcsift
"""
[tasks.lint]
description = "Run SwiftLint and actionlint"
run = """
swiftlint lint --strict Sources Tests 2>&1 | xcsift
actionlint
"""
[tasks."format:swift"]
description = "Format Swift code"
run = "swiftformat Sources Tests"
[tasks."format-check:swift"]
description = "Check code formatting (CI)"
run = "swiftformat Sources Tests --lint"
[tasks."format:md"]
description = "Format markdown files"
run = "dprint fmt"
[tasks."format-check:md"]
description = "Check markdown formatting (CI)"
run = "dprint check"
[tasks.format]
description = "Format all files (Swift + Markdown)"
run = "hk fix --all 2>&1 | grep -E '^(✔|✗|hk )' || true"
[tasks.format-check]
description = "Check all formatting (CI)"
run = """
set -o pipefail
hk check --all 2>&1 | grep -E '^(✔|✗|hk )'
"""
[tasks.setup]
description = "Show git hooks status"
run = "echo 'Git hooks:' && git config core.hooksPath && ls -la .githooks/"
[tasks.pre-commit]
description = "Run all pre-commit checks"
run = """
set -o pipefail
hk check --all 2>&1 | grep -E '^(✔|✗|hk )'
"""
[tasks.docs]
description = "Generate DocC documentation"
run = """
swift package --allow-writing-to-directory docs \
generate-documentation --target ExFigCLI \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path exfig \
--enable-experimental-code-block-annotations \
--output-path docs
echo '<script>window.location.href += "/documentation/exfigcli"</script>' > docs/index.html
"""
[tasks."docs:preview"]
description = "Generate and preview DocC documentation"
run = """
swift package --disable-sandbox preview-documentation --target ExFigCLI
"""
[tasks.clean]
description = "Clean build artifacts"
run = "swift package clean && rm -rf .build"
[tasks."clean:all"]
description = "Clean all caches (SPM, DerivedData, build)"
run = """
#!/bin/bash
echo "Cleaning SPM caches..."
rm -rf ~/Library/Caches/org.swift.swiftpm
rm -rf ~/Library/org.swift.swiftpm
rm -rf ~/.swiftpm
rm -rf .build
rm -f Package.resolved
swift package purge-cache 2>/dev/null || true
echo "Cleaning DerivedData..."
rm -rf ~/Library/Developer/Xcode/DerivedData
echo "✓ All caches cleaned"
"""
[tasks.changelog]
description = "Generate CHANGELOG.md from git history"
run = "git-cliff -o CHANGELOG.md"
[tasks."changelog:unreleased"]
description = "Preview unreleased changes"
run = "git-cliff --unreleased"
[tasks."codegen:pkl"]
description = "Regenerate Swift types from PKL schemas (requires pkl 0.31+)"
run = """
#!/bin/bash
set -euo pipefail
OUTPUT_DIR="Sources/ExFigConfig/Generated"
SCHEMAS_DIR="Sources/ExFigCLI/Resources/Schemas"
# Generate to temp dir first — avoids losing files if pkl run fails
TEMP_DIR=$(mktemp -d)
trap 'rm -rf "$TEMP_DIR"' EXIT
pkl run \
--project-dir "$SCHEMAS_DIR" \
"@pkl.swift/gen.pkl" \
--generator-settings "$SCHEMAS_DIR/generator-settings.pkl" \
"$SCHEMAS_DIR/ExFig.pkl" \
"$SCHEMAS_DIR/Common.pkl" \
"$SCHEMAS_DIR/Figma.pkl" \
"$SCHEMAS_DIR/iOS.pkl" \
"$SCHEMAS_DIR/Android.pkl" \
"$SCHEMAS_DIR/Flutter.pkl" \
"$SCHEMAS_DIR/Web.pkl" \
"$SCHEMAS_DIR/Lint.pkl" \
-o "$TEMP_DIR/"
# Only replace files on success
rm -f "$OUTPUT_DIR"/*.pkl.swift
mv "$TEMP_DIR"/*.pkl.swift "$OUTPUT_DIR/"
echo "✓ Generated $(ls -1 "$OUTPUT_DIR"/*.pkl.swift | wc -l | tr -d ' ') files in $OUTPUT_DIR/"
"""
[tasks.coverage]
description = "Run tests, show coverage report, and update README badge"
run = "./Scripts/coverage.sh --run-tests --update-badge"
# =============================================================================
# Shell Completions & CLI Docs (via Usage spec)
# =============================================================================
[tasks."completions:bash"]
description = "Generate bash completions from usage spec"
run = "usage generate completion bash exfig -f exfig.usage.kdl"
[tasks."completions:zsh"]
description = "Generate zsh completions from usage spec"
run = "usage generate completion zsh exfig -f exfig.usage.kdl"
[tasks."completions:fish"]
description = "Generate fish completions from usage spec"
run = "usage generate completion fish exfig -f exfig.usage.kdl"
[tasks."docs:cli-reference"]
description = "Generate CLI reference docs from usage spec"
run = "usage generate markdown -f exfig.usage.kdl --out-file docs/cli-reference.md"
[tasks."generate:llms"]
description = "Generate llms.txt and llms-full.txt from documentation sources"
run = "bash Scripts/generate-llms.sh"
sources = ["README.md", "Sources/ExFigCLI/ExFig.docc/**/*.md", "docs/*.md", "CONFIG.md"]
outputs = ["llms.txt", "llms-full.txt"]