GitLabgitlab-org

cli

main
ply5 git calls211 ms97 KiB2 cachedprotocol v2
252 lines8.5 KiBRaw
1# Lefthook configuration
2# See https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
3#
4# To install: lefthook install
5# To skip: LEFTHOOK=0 git commit/push
6# To install tools: make bootstrap
8pre-commit:
9 parallel: true
10 commands:
11 # Format and lint Go code with auto-fix (includes gofumpt and goimports)
12 go-lint-fix:
13 tags: backend lint style
14 glob: "*.go"
15 run: |
16 if ! command -v golangci-lint > /dev/null 2>&1; then
17 echo "⚠️ golangci-lint not found. Run 'make bootstrap' to install tools."
18 echo " Skipping Go formatting and linting check..."
19 exit 0
20 fi
21 # Get unique package directories from staged files
22 packages=$(echo {staged_files} | xargs -n1 dirname | sort -u | xargs -I {} echo "./{}")
23 if [ -n "$packages" ]; then
24 golangci-lint run --fix $packages
25 fi
26 stage_fixed: true
28 # Flag comments whose wording is already carried by the code beside them.
29 # Gated at full token coverage, where the comment adds nothing a reader
30 # cannot get from the line itself; lower thresholds are for reporting, not
31 # gating, because they need human judgement.
32 comment-overlap:
33 tags: backend lint style
34 glob: "*.go"
35 run: |
36 if ! command -v go > /dev/null 2>&1; then
37 echo "⚠️ go not found. Skipping comment overlap check..."
38 exit 0
39 fi
40 go run ./scripts/comment-overlap -threshold 1.0 -max-findings 0 {staged_files}
42 # Lint shell scripts
43 shellcheck:
44 tags: shell lint
45 glob: "*.sh"
46 run: |
47 if ! command -v shellcheck > /dev/null 2>&1; then
48 echo "⚠️ shellcheck not found. Run 'make bootstrap' to install tools."
49 echo " Skipping shell script linting..."
50 exit 0
51 fi
52 shellcheck {staged_files}
54 # Fix markdown formatting issues
55 markdownlint-fix:
56 tags: docs style
57 glob: "*.md"
58 run: |
59 if ! command -v markdownlint-cli2 > /dev/null 2>&1; then
60 echo "⚠️ markdownlint-cli2 not found. Run 'make bootstrap' to install tools."
61 echo " Skipping markdown auto-fix..."
62 exit 0
63 fi
64 markdownlint-cli2 --fix {staged_files}
65 git add {staged_files}
66 stage_fixed: true
68 # Fail fast if any skill source can't be loaded — covers a missing
69 # SKILL.md, unparseable frontmatter, an empty `name` or `description`,
70 # a directory mismatch in bundled assets, or a malformed remote
71 # registry entry. Full Agent Skills spec compliance
72 # (https://agentskills.io/specification) is hand-reviewed in MRs,
73 # not enforced here.
74 validate-skills:
75 tags: backend skills
76 glob: "internal/commands/skills/**"
77 run: |
78 if ! command -v go > /dev/null 2>&1; then
79 echo "⚠️ go not found. Skipping skills validation..."
80 exit 0
81 fi
82 go test ./internal/commands/skills/...
84 # Check if documentation needs regeneration
85 check-docs:
86 tags: docs
87 glob:
88 - "internal/commands/**/*.go"
89 - "cmd/gen-docs/*.go"
90 - "cmd/gen-docs/**/*.go"
91 - "README.md"
92 run: |
93 echo "Checking if documentation needs regeneration..."
94 make gen-docs > /dev/null 2>&1
95 if git diff --quiet docs/ README.md; then
96 echo "✔ Documentation is up to date."
97 exit 0
98 else
99 echo ""
100 echo "✖ ERROR: Documentation changes detected!"
101 echo ""
102 echo "Command files were modified and documentation is out of sync."
103 echo "The documentation has been regenerated for you."
104 echo ""
105 echo "Next steps:"
106 echo " 1. Review the changes in docs/ and README.md"
107 echo " 2. Stage the changes: git add docs/ README.md"
108 echo " 3. Commit again"
109 echo ""
110 exit 1
111 fi
113commit-msg:
114 commands:
115 # Validate commit message format using conventional commits
116 commitlint:
117 run: |
118 if ! command -v node > /dev/null 2>&1; then
119 echo "⚠️ node not found. Commit message validation requires Node.js."
120 echo " Skipping commit message validation..."
121 exit 0
122 fi
123 # Install commitlint dependencies if not already installed
124 if [ ! -d "scripts/commit-lint/node_modules" ]; then
125 echo "Installing commitlint dependencies (one-time setup)..."
126 cd scripts/commit-lint && npm install
127 else
128 cd scripts/commit-lint
129 fi
130 npx commitlint --config .commitlintrc.js --edit {1}
132pre-push:
133 parallel: true
134 commands:
135 # Build the project
136 build:
137 tags: backend
138 run: make build
140 # Lint Go code (only changes vs main)
141 go-lint:
142 tags: backend lint
143 run: |
144 if ! command -v golangci-lint > /dev/null 2>&1; then
145 echo "⚠️ golangci-lint not found. Run 'make bootstrap' to install tools."
146 echo " Skipping Go linting..."
147 exit 0
148 fi
149 golangci-lint run --new-from-rev=origin/main
151 # Run unit tests on changed packages and their reverse dependencies
152 go-test:
153 tags: backend test
154 run: make test-changed
156 # Report how much of the push is comment rather than code. Advisory: the
157 # repo distribution has no natural cutoff, so the number is context for
158 # the author rather than a pass/fail line.
159 comment-ratio:
160 tags: backend lint style
161 glob: "*.go"
162 run: |
163 if ! command -v go > /dev/null 2>&1; then
164 echo "⚠️ go not found. Skipping comment ratio report..."
165 exit 0
166 fi
167 go run ./scripts/comment-ratio -base origin/main
169 # Forbid //go:embed of .md files as help text; use heredoc.Doc instead
170 check-embed:
171 tags: backend lint
172 glob: "internal/**/*.go"
173 run: make check-embed
175 # Forbid cobra.ExactArgs(0); use cobra.NoArgs instead
176 check-args:
177 tags: backend lint
178 glob: "{internal,cmd}/**/*.go"
179 run: make check-args
181 # Check generated docs and Go code. Chained into one command because both
182 # mutate the working tree and check git diff — running them in parallel
183 # would cause false positives.
184 check-generated:
185 tags: backend docs
186 run: |
187 # Skip if no command files changed vs origin/main
188 if git diff --quiet origin/main -- internal/commands/ cmd/gen-docs/ README.md; then
189 echo "✔ No command changes detected. Skipping doc generation check."
190 exit 0
191 fi
193 make gen-docs > /dev/null 2>&1
194 if ! git diff --quiet docs/ README.md; then
195 echo "✖ Generated docs, navigation, or README command list are out of date. Run 'make gen-docs', then commit."
196 exit 1
197 fi
198 echo "✔ Documentation is up to date."
199 make generate > /dev/null 2>&1
200 if ! git diff --quiet; then
201 echo "✖ Generated Go code is out of date. Run 'make generate' and commit."
202 exit 1
203 fi
204 echo "✔ Generated code is up to date."
206 # Lint markdown files
207 markdownlint:
208 tags: docs lint
209 glob: "*.md"
210 run: |
211 if ! command -v markdownlint-cli2 > /dev/null 2>&1; then
212 echo "⚠️ markdownlint-cli2 not found. Run 'make bootstrap' to install tools."
213 echo " Skipping markdown linting..."
214 exit 0
215 fi
216 markdownlint-cli2 {push_files}
218 # Lint markdown tables and other rules that rumdl enforces
219 rumdl:
220 tags: docs lint
221 glob: "*.md"
222 run: |
223 if ! command -v rumdl > /dev/null 2>&1; then
224 echo "⚠️ rumdl not found. Run 'make bootstrap' to install tools."
225 echo " Skipping rumdl linting..."
226 exit 0
227 fi
228 rumdl check --config docs/.rumdl/rumdl.toml {push_files}
230 # Check prose style
231 vale:
232 tags: docs prose
233 glob: "docs/**/*.md"
234 run: |
235 if ! command -v vale > /dev/null 2>&1; then
236 echo "⚠️ vale not found. Run 'make bootstrap' to install tools."
237 echo " Skipping prose checking..."
238 exit 0
239 fi
240 vale --minAlertLevel error {push_files}
242 # Check links in documentation (can be slow)
243 lychee:
244 tags: docs links
245 glob: "*.md"
246 run: |
247 if ! command -v lychee > /dev/null 2>&1; then
248 echo "⚠️ lychee not found. Run 'make bootstrap' to install tools."
249 echo " Skipping link checking..."
250 exit 0
251 fi
252 lychee --offline --include-fragments {push_files}
Diagnostics5 git calls · 211 ms
CallStatusSizeTime0211 ms
discover200185 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=185
git.server.agent=git/2.56.g1891de4-Linux
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch server-option object-format
git.server.fetch=shallow wait-for-done filter
git.protocol.version=2
git.pkt.frames=9
git.pkt.data=7
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=185
git.pkt.payload.max=35
ls-refs20058 KiB3 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
git.response.bytes=59849
git.response.cache=UPDATING
git.response.duration_ms=3
git.protocol.version=2
git.pkt.frames=731
git.pkt.data=730
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=59849
git.pkt.payload.max=143
git.ls_refs.count=730
git.ls_refs.head=refs/heads/main
fetchcombine:blob:none+tree:2 · deepen 12004.2 KiB · hit4 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=4
git.response.bytes=4273
git.response.cache=HIT
git.response.duration_ms=4
git.fetch.filter=combine:blob:none+tree:2
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
git.fetch.haves.count=0
git.fetch.deepen=1
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=7
git.pkt.data=5
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=4273
git.pkt.payload.max=4173
git.sideband.band1.bytes=4173
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=11
git.pack.bytes=4173
git.fetch.wide.objects=11
git.fetch.wide.extra_bytes=3930
git.fetch.wide.blobs=0
fetchtree:0 · deepen 1020032 KiB · hit4 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=4
git.response.bytes=32926
git.response.cache=HIT
git.response.duration_ms=4
git.fetch.filter=tree:0
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=22
git.pkt.data=20
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=32926
git.pkt.payload.max=32046
git.sideband.band1.bytes=32046
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=80
git.pack.bytes=32046
git.pack.ofs_delta=36
git.pack.ref_delta=0
git.pack.chain.max=2
git.pack.trailer=cb0bad5d7ffc514895d8b21c4dd470327f90bc91
git.pack.full=44
Open pack map
fetch2002.4 KiB204 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=204
git.response.bytes=2442
git.response.cache=MISS
git.response.duration_ms=204
git.fetch.wants=848c86f407ac5c51768697dacbb51548e2fb441b
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=2442
git.pkt.payload.max=2415
git.sideband.band1.bytes=2415
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://gitlab.com/gitlab-org/cli
Ref
refs/heads/main
Commit
0dd7574dce9e385c5c30540e6c15657adc6bdce9
cf-ray
a5e13298a976a9fe
Request
5c1fc5ab…
Protocol
v2 · sha1
Agent
git/2.56.g1891de4-Linux
Filter
advertised
Fetch
shallow wait-for-done filter
Capabilities
agent ls-refs fetch server-option object-format