| Files | Last commit | Last update |
|---|---|---|
refactor: extract roundTripFunc to pkg/testutil Replace 17 duplicate roundTripFunc type definitions across test files with a single shared RoundTripFunc in pkg/testutil. - Add pkg/testutil/roundtrip.go with RoundTripFunc type and NewRoundTripFunc() - Update 18 test files to use testutil.NewRoundTripFunc() - All 1214 tests pass, build succeeds Refs #347 Co-Authored-By: Claude <noreply@anthropic.com> | 4 months ago | |
!361 merge refactor/decode-api-error into main refactor(api): extract decodeAPIError helper, eliminate 6x error decoding duplication Created-by: luojiyin87 Commit-by: luojiyin Merged-by: aflyingto Description: ## 变更内容 - 新增 decodeAPIError(respBody, statusCode, status) error 方法,统一 API 错误解码逻辑 - 替换 6 个方法中的重复错误解码块:REST、RawREST、GetText、PostForm、PatchForm、UploadAsset - 新增 7 个单元测试覆盖所有错误字段组合 ## 问题 api/client.go 中错误解码逻辑(检查 Message/ErrorMessage/ErrorName/ErrorCodeName)被复制粘贴 6 次,修改时容易遗漏。 ## 修改文件 | 文件 | 改动 | |------|------| | api/client.go | +decodeAPIError 方法,替换 6 处重复块 | | api/client_test.go | +7 个 TestDecodeAPIError 用例 | ## 测试 - go build ./... ✅ - go test ./api/... (225 passed) ✅ - go vet ./api/... ✅ close [#421](https://gitcode.com/gitcode-cli/cli/issues/421) See merge request: gitcode-cli/cli!361 | 3 months ago | |
!361 merge refactor/decode-api-error into main refactor(api): extract decodeAPIError helper, eliminate 6x error decoding duplication Created-by: luojiyin87 Commit-by: luojiyin Merged-by: aflyingto Description: ## 变更内容 - 新增 decodeAPIError(respBody, statusCode, status) error 方法,统一 API 错误解码逻辑 - 替换 6 个方法中的重复错误解码块:REST、RawREST、GetText、PostForm、PatchForm、UploadAsset - 新增 7 个单元测试覆盖所有错误字段组合 ## 问题 api/client.go 中错误解码逻辑(检查 Message/ErrorMessage/ErrorName/ErrorCodeName)被复制粘贴 6 次,修改时容易遗漏。 ## 修改文件 | 文件 | 改动 | |------|------| | api/client.go | +decodeAPIError 方法,替换 6 处重复块 | | api/client_test.go | +7 个 TestDecodeAPIError 用例 | ## 测试 - go build ./... ✅ - go test ./api/... (225 passed) ✅ - go vet ./api/... ✅ close [#421](https://gitcode.com/gitcode-cli/cli/issues/421) See merge request: gitcode-cli/cli!361 | 3 months ago | |
fix: propagate errors in FlexibleNumber.Int() and retry body read - api/flexible.go: Int() now returns (int, error) instead of silently returning 0 on parse failure. Added MustInt() convenience method. - api/retry.go: Check io.ReadAll error in RoundTrip() and return it instead of silently proceeding with empty body on read failure. Ref: Issue #408 Co-Authored-By: Claude <noreply@anthropic.com> | 4 months ago | |
fix(api): add FlexibleNumber type for tolerant issue number parsing GitCode API may return issue number as int in some endpoints. Add FlexibleNumber that decodes both string and int JSON values, always storing as string for backward compatibility. - api/flexible.go: FlexibleNumber with UnmarshalJSON/MarshalJSON - api/flexible_test.go: 9 test cases for int/string/null - api/queries_issue.go: Issue.Number changed to FlexibleNumber - Update call sites for string conversion Refs #271 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> | 4 months ago | |
fix(api): HTTP client security hardening (CheckRedirect, debug log sanitization, UploadToURL body truncation) Closes #398 - api/http_client.go: SafeCheckRedirect (max 10 hops, strip Authorization on cross-host) applied to all client constructors as defense-in-depth - api/retry.go: sanitizeError unwraps url.Error so debug logs no longer leak full endpoint URLs - api/client.go: UploadToURL error response body truncated to 512 bytes to avoid server-side internal detail leakage - tests: SafeCheckRedirect (same/cross host, max redirects), sanitizeError (url.Error/plain/nil inner), UploadToURL truncation | 3 months ago | |
fix(api): HTTP client security hardening (CheckRedirect, debug log sanitization, UploadToURL body truncation) Closes #398 - api/http_client.go: SafeCheckRedirect (max 10 hops, strip Authorization on cross-host) applied to all client constructors as defense-in-depth - api/retry.go: sanitizeError unwraps url.Error so debug logs no longer leak full endpoint URLs - api/client.go: UploadToURL error response body truncated to 512 bytes to avoid server-side internal detail leakage - tests: SafeCheckRedirect (same/cross host, max redirects), sanitizeError (url.Error/plain/nil inner), UploadToURL truncation | 3 months ago | |
fix(issue): submit assignee usernames Refs #473 Co-Authored-By: OpenAI Codex <noreply@openai.com> | 3 months ago | |
fix: fallback issue label replacement for slash labels Refs #150 | 6 months ago | |
fix(actions): address Round 1 review — json index + test rewrite + content-type Address Round 1 independent review findings (PR #505): Blocker fixes: - D1: Move actions workflow run from read-only --json index to write-path --json index (it's a POST write command) - T4: Rewrite TestRunRunSecretScan to go through NewCmdRun + SetArgs + Execute end-to-end (was manually replicating RunE logic with unreachable t.Fatal) Should-fix: - C1: Remove redundant Content-Type header (RawREST sets it automatically when body != nil), aligns with ValidateActionsWorkflow 6/6 command tests pass. Refs gitcode-cli/cli#509 | 2 months ago | |
feat(actions): add gc actions workflow run — trigger workflow dispatch Add a new actions workflow run subcommand that triggers a workflow_dispatch run via POST /api/v8/repos/{owner}/{repo}/ actions/workflows/{workflow_id}/dispatches. Features: - Accept workflow ID or filename (e.g. ci.yml) - --ref flag (required): branch or tag name - -f/--field: custom inputs in key=value format, repeatable - --json: output {workflow_id, workflow_run_id} - Secret scan on field values API additions in queries_actions.go: - DispatchWorkflowRequest/Response types - DispatchActionsWorkflow function (RawREST POST v8) 8 tests (6 command + 2 API) cover: flag validation, success, JSON output, no-ref error, API error, secret scan rejection, v8 path construction, assertNoAccessTokenQuery, error handling. Refs gitcode-cli/cli#509 | 2 months ago | |
fix(api): cover fmt.Sprintf + owner-only escape sites (4 missed) | 2 months ago | |
feat: cover issue 246 CLI gaps Co-authored-by: aflyingto<wupengfei10@huawei.com> | 5 months ago | |
feat(pr): support editing and deleting PR comments Add gc pr comment edit and gc pr comment delete subcommands. - API: Add DeletePRComment function (DELETE /repos/{owner}/{repo}/pulls/comments/{id}) - Commands: gc pr comment edit <id> --body, gc pr comment delete <id> [--yes] - Tests: API auth header tests, coverage tests, command-level unit tests - Docs: Update COMMANDS.md with new subcommand documentation Refs #296 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> | 4 months ago | |
fix(api): replace hand-written itoa/itoa64 with strconv | 2 months ago | |
test(discussions): assert repo comment order param + 404→exit3 test + docs -R wording (review P1/P2) 评审 P1:①TestListRepoDiscussionCommentsBuildsPathAndParams 未断言 order=time_desc query → 补 gotQuery 断言;②4 个 comment/reply 无 404→exit3 单测 → 补 org comments list 404→ExitNotFound。P2:project comments docs -R 写「必填」不准(ResolveRepo 可省略)→ 改「可省略自动推断」与 list/view 一致。 | 2 months ago | |
fix(api): replace hand-written itoa/itoa64 with strconv | 2 months ago | |
fix(issue-242): add ListIssueCommentsAll pagination for complete comment lists Add auto-paginating ListIssueCommentsAll following ListRepoIssuesAll pattern. Update comments command to fetch all pages with Limit truncation. Update view command to fetch all comments via paginated helper. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> | 5 months ago | |
feat(label): add gc label edit command Refs #525 | 2 months ago | |
test(issue-238): 补充 label API 测试覆盖 - 新增 TestCreateLabel_SlashLabel 验证 QueryEscape - 新增 TestUpdateLabel_NormalLabel 保持测试对称性 - 新增 TestRemoveLabelFromIssue_NormalLabel 保持测试对称性 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> | 6 months ago | |
fix(pr): address Round 1 review — string body + query params + tests Address Round 1 independent review findings (PR #502): Blocker fixes: - C1: Change AssigneeRequest/ReviewerRequest/TesterRequest from []string to string (comma-separated) to match api-doc schema (type: string, not array) - C2: RemovePRAssignees now uses query parameter (?assignees=u1,u2) instead of request body (api-doc says DELETE assignees has no standard request body definition) - C3: Add omitempty to ReviewerRequest.Add and TesterRequest.Add to prevent remove path from sending add:false - T1: Add TestEditRunAddAssignee, TestEditRunAddReviewerAndTester, TestEditRunRemoveAssignee (verify POST/DELETE methods called) - T2: Add TestHasAssigneeChanges (4 scenarios) 13/13 tests pass. Refs gitcode-cli/cli#541 | 2 months ago | |
fix(api): replace hand-written itoa/itoa64 with strconv | 2 months ago | |
fix(repo): address Round 1 review — remove dead code + docs fixes Address Round 1 independent review findings (PR #501): Reviewer C1/T1 (P0, PRSettings struct mismatch) is a false positive: verified via real API call that GET /pull_request_settings returns flat structure (all 24 fields at top level), NOT nested merge_request_setting. Real command output confirms: merge_method=merge, all 24 keys present. Valid fixes applied: - C7: Remove dead code (var _ = url.PathEscape) + unnecessary net/url import - D1: Add exit code 2 to pr-settings view docs (cobra.NoArgs → usage error) - D2: Fix docs to say '主要设置' not '全部 24 项' for human-readable output (--json still outputs all 24 fields) 9/9 tests pass. Refs gitcode-cli/cli#532 | 2 months ago | |
feat(release): add gc release delete-asset command Refs #528 | 2 months ago | |
fix(release): preserve error chain in fmtError via Unwrap | 2 months ago | |
feat(repo): add gc repo archive/unarchive commands Refs #523 | 2 months ago | |
fix: guard state-changing write commands | 6 months ago | |
fix(search): address Round 1 review — refactor SearchIssues + limit validation + types Address Round 1 independent review findings (PR #498): Blocker fixes: - C3: Refactor SearchIssues to take Repo/State in SearchOptions struct instead of separate parameters, eliminating manual URL &-concatenation edge case (buildSearchQuery handles all params via queryBuilder.Set) - C1: SearchIssueResult.Number changed from interface{} to FlexibleNumber (aligns with existing Issue.Number type) - D1: Add --limit/--page to search issues docs (was missing) Should-fix: - C4: Add --limit/--page validation to all three subcommands (aligns with repo branch list pattern) - C5: SearchRepoResult.Status changed from interface{} to string (api-doc confirms it is always string) - D2: Add exit code 2 (parameter error) to all three search docs 14/14 tests pass. Refs gitcode-cli/cli#518 | 2 months ago | |
feat: add SSH key management commands | 2 months ago | |
test: strengthen SSH key deletion coverage | 2 months ago | |
fix(user): address Round 1 review — re-read after update + json index + secret test Address Round 1 independent review findings (PR #497): Blocker fixes: - C1: UpdateUser now re-reads CurrentUser after PATCH to return complete User object (PATCH response uses nickname/description while User struct uses name/bio; re-reading via GET /user gets the full canonical object) - D1: Add user view to --json read-only commands index - D1: Add user edit to --json write-path commands index - T2/S2: Add TestEditRunSecretScanRejection test (verifies secret in --bio is rejected before HTTP request is made) Doc fixes: - D2/D3: Add ExitAuth(4) to user view and user edit exit codes 13/13 tests pass (12 original + 1 secret scan rejection). Refs gitcode-cli/cli#540 | 2 months ago | |
fix(api): replace hand-written itoa/itoa64 with strconv | 2 months ago | |
fix(api): replace hand-written itoa/itoa64 with strconv | 2 months ago | |
security(api): url.PathEscape owner/repo in all path concatenation | 2 months ago | |
fix(api): cover P0 missed sites + add escape/injection tests | 2 months ago | |
fix: retry nil-panic regression + add missing tests + update stale dates (review feedback) First-round review findings: - Code F1: MaxRetries==0 + non-rewindable body → nil panic (regression); fix: drop MaxRetries>0 guard so non-rewindable bodies always skip retry - Test F1: add TestStatusRunServerErrorReturnsGenericErrorNotAuthError (500 → ExitError, not ExitAuth) - Test F2: add TestRetrySkipsNonRewindableBody (verifies callCount==1) - Docs F2: update stale last-updated dates in security.md and pr-workflow.md Refs #425 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> | 3 months ago | |
fix: retry nil-panic regression + add missing tests + update stale dates (review feedback) First-round review findings: - Code F1: MaxRetries==0 + non-rewindable body → nil panic (regression); fix: drop MaxRetries>0 guard so non-rewindable bodies always skip retry - Test F1: add TestStatusRunServerErrorReturnsGenericErrorNotAuthError (500 → ExitError, not ExitAuth) - Test F2: add TestRetrySkipsNonRewindableBody (verifies callCount==1) - Docs F2: update stale last-updated dates in security.md and pr-workflow.md Refs #425 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> | 3 months ago | |
security(api): sanitizeLogMessage redacts tokens in debug logger | 2 months ago | |
test(api): add P1 sanitize cases (uppercase/overlap/empty) | 2 months ago | |
chore: fix end-of-file-fixer and gofmt issues exposed by LF normalization Apply end-of-file-fixer (newline at EOF) and gofmt formatting fixes to files that were previously masked by CRLF/LF line-ending noise. Closes #300 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> | 4 months ago | |
chore: fix end-of-file-fixer and gofmt issues exposed by LF normalization Apply end-of-file-fixer (newline at EOF) and gofmt formatting fixes to files that were previously masked by CRLF/LF line-ending noise. Closes #300 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> | 4 months ago |
| Files | Last commit | Last update |
|---|---|---|
| 4 months ago | ||
| 3 months ago | ||
| 3 months ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 3 months ago | ||
| 3 months ago | ||
| 3 months ago | ||
| 6 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 5 months ago | ||
| 4 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 5 months ago | ||
| 2 months ago | ||
| 6 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 6 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 3 months ago | ||
| 3 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 4 months ago | ||
| 4 months ago |