Commit Graph

11 Commits

Author SHA1 Message Date
刘焱 f248ed9d04 fix(output): 表头取所有行字段并集并固定核心列顺序
printSliceTable 原先只从第一行取表头,导致列时有时无;改为取所有行并集。新增 protected/last_commit/commit_time 到优先表头,固定分支核心列顺序。
2026-06-10 11:28:45 +08:00
s2_cc f9efae89a3 docs: add comprehensive Chinese comments and mark bug fixes (P1-P4)
CI / test (push) Failing after 2m6s Details
- Add detailed Chinese comments across all shortcut modules explaining
  parameter mappings (CLI→API field names), batch processing patterns,
  and design decisions
- Mark P1 Bug#1: issue +create --label not written to request body
- Mark P1 Bug#2: hardcoded 'master' replaced with GetDefaultBranch()
- Mark P1 Bug#3: +diff and +files deduplicated into +version-diff
- Add P2 parameter annotations for sort/filter/milestone fields
- Add P4 improvement notes for HTTP error suggestions
- Reorder ProcessBatch function for better readability
2026-06-10 10:13:45 +08:00
刘焱 612deddb57 fix(output): 本地构造的 map slice 也渲染为表格,不再显示 [N items]
根因:findLargestSlice 只识别 []interface{},而 wiki +list 等本地
构造数据的命令用 Go 原生类型 []map[string]string。这类列表不被
识别为可表格化的列表,于是在单对象详情视图里被 formatValue 折叠
成 '[2 items]',用户看不到实际页面名。

修复(防御性,覆盖所有类似命令):
- findLargestSlice 用 reflect 处理任意元素为 map 的 slice,
  经 normalizeMap 归一化为 map[string]interface{}
- formatValue 的 map 分支也调用 normalizeMap,使原生 map 同样摘要
- 新增 normalizeMap 辅助函数

回归测试 TestPrintTable_NativeMapStringSlice 验证 []map[string]string
渲染为表格而非 [N items]。
2026-06-08 20:39:36 +08:00
刘焱 fb051af813 feat(output): 单对象详情渲染为可读的层级表格,不再回退 JSON
之前含嵌套 map 的单对象详情(如 tag +view、repo +info)会回退到
JSON 输出,难以阅读。

改进 printMapTable 为详情视图:
- 顶层字段按 collectKeys 排序(id/name/status 等关键字段在前)
- 嵌套 map 用 └ 缩进递归展开子字段,深层嵌套也清晰展示
- 长值(URL/sha/message)仍截断,保持终端宽度友好

移除 hasOnlyNestedMaps 回退逻辑(dead code)。新增测试
TestPrintTable_NestedMapRendersAsDetailTable 验证嵌套 map 渲染为
表格而非 JSON,且子字段被展开。
2026-06-08 20:35:25 +08:00
刘焱 295eda5a4e feat(output): improve table readability — truncate values, limit columns, summarize nested maps 2026-06-08 19:44:22 +08:00
刘焱 25ee6cc5fb feat(output): render nested list data as table instead of falling back to JSON
When envelope.Data is a map containing a list of objects (e.g. tag +list
returns {tags: [...], total_count}), printTable previously fell back to
JSON because the map had complex values. Now it scans the map for the
largest []interface{} of map[string]interface{} and renders that list
via printSliceTable, so users see a table again.

- Add findLargestSlice helper to pick the largest table-renderable slice
- Add hasOnlyNestedMaps to distinguish scalar-only maps from nested-map maps
- Keep JSON fallback for genuinely nested (non-list) structures
- Add formatter_test.go covering all 5 branches of printTable
2026-06-08 19:32:06 +08:00
s2_cc 9f479a27db feat: optimize existing commands (P1-P4)
P1 Bug fixes:
- Fix issue +create --label not being sent to API
- Replace hardcoded "master" default branch with dynamic API query
- Add GetDefaultBranch() helper (common/types.go)

P2 Complete missing command parameters (10 items, 39 new flags):
- issue +list: --milestone, --assignee, --label, --keyword, --sort, --sort-direction
- issue +update: --milestone, --assignee, --label, --priority (expanded validation)
- issue +close: --comment (post journal on close)
- pr +list: --keyword, --milestone, --tag, --reviewer, --assignee, --sort, --sort-direction
- pr +create: --priority, --assignee, --milestone, --label (multi-label support)
- pr +merge: validate --method values, add --title, --body
- ci +builds: --status, --branch, --event, --since, --until
- search +repos: --language, --sort, --order
- search +users: --sort, --order
- release +list: --prerelease-only, --latest (client-side filtering)

P3 Batch operations (9 new commands with generic batch framework):
- Add common/batch.go: BatchSummary, CollectNumbers, ProcessBatch, CSV parsing
- Add common/confirm.go: ConfirmAction with --yes skip
- issue +batch-update: native batch_update API with ID mapping
- issue +batch-destroy: native batch_destroy API
- Refactor issue +batch-close to use common batch utilities
- pr +batch-close, pr +batch-merge
- collaborator +batch-add, +batch-remove, +batch-role
- branch +batch-delete, +batch-protect

P4 Help docs, confirm prompts, and error messages:
- Add Long description and Example to all 18 command groups
- Add confirmation prompt to destructive operations (repo/branch/release delete, ci stop)
- Improve HTTP error messages with contextual hints (401/403/404/422/500)
- Replace hardcoded Chinese strings with English in release +delete
2026-06-04 10:45:32 +08:00
刘焱 2ddad05646 feat: add color detection and CJK width support for cross-platform terminals 2026-06-02 08:57:52 +08:00
刘焱 44b184723e feat: add user account settings shortcuts and OAuth2 authentication 2026-06-02 08:57:52 +08:00
刘焱 b64a5104a8 feat: improve cross-platform compatibility and expand API shortcut coverage
Cross-platform improvements:
- Config/credential paths now use platform-aware directories:
  Windows (%APPDATA%), macOS (~/Library/Application Support),
  Linux (XDG_CONFIG_HOME) instead of hardcoded ~/.config
- npm install script: add retry (3x), HTTP proxy support (HTTP_PROXY/HTTPS_PROXY),
  download progress indicator, Windows tar fallback extraction
- Makefile: add cross-build (6 platforms), checksums (SHA256), lint targets
- Release workflow: auto-detect Go version from go.mod, upload SHA256 checksums

New API shortcut groups (36 sub-commands across 7 domains):
- collaborator: +list, +add, +remove, +change-role
- tag: +list, +view, +delete
- milestone: +list, +create, +view, +update, +delete, +close
- file: +get, +readme, +create, +update, +delete, +tree, +blob
- commit: +list, +view, +diff, +blame, +compare
- label: +list, +create, +update, +delete, +priorities, +statuses, +authors, +assigners
- sshkey: +list, +create, +delete

Total shortcut commands increased from ~50 to ~86 (+72% coverage).
2026-05-28 15:11:25 +08:00
wbtiger e892370de8 init gitlink-cli 2026-04-17 10:01:30 +08:00