Commit Graph

23 Commits

Author SHA1 Message Date
wbtiger afc3b5773a Merge pull request 'feat(output): 全局 --query/-q 点分路径输出字段提取(零依赖,对标 gh --jq)' (#342) from Taoyouce/gitlink-cli:feat/output-query into master 2026-07-14 22:24:53 +08:00
wbtiger 7ef01a97c1 Merge pull request '新增 shell 自动补全命令' (#134) from Mengz/gitlink-cli:mengz/shell-completion into master 2026-07-14 22:23:07 +08:00
wbtiger 6148be40da fix(api): restore resolveAPIPath after MSYS2 merge conflict resolution
The merge of PR #406 (MSYS2 path fix) via --theirs accidentally
dropped the resolveAPIPath function added by PR #254. This commit
restores the :owner/:repo placeholder and --var template resolution
while keeping the MSYS2 path restoration as the first step.
2026-07-14 22:03:17 +08:00
wbtiger 7d706f4e4c Merge pull request #406: fix(api): 修复 Windows Git Bash 下 API 路径被 MSYS2 污染导致 404
# Conflicts:
#	cmd/api/api.go
2026-07-14 21:57:33 +08:00
wbtiger 0c272d7209 Merge pull request 'feat(cli): 根命令支持 --version 标志' (#340) from Taoyouce/gitlink-cli:feat/root-version-flag into master 2026-07-14 20:44:25 +08:00
chroe bf9ecc4ba2 docs(api): add MSYS2 path fix doc; extract restoreAPIPath for testability
- 新增命令帮助文档 doc/changes/api-msys2-path.md(问题/根因/修复/影响/测试)。
- 将 runAPI 内联的路径还原逻辑抽成纯函数 restoreAPIPath,便于单元测试;
  并修正一个边界缺陷:路径含多个已知前缀时(如 /api/v1/users)改为取
  最早出现的位置,避免误截到 /v1/。
- 新增表驱动 TestRestoreAPIPath 覆盖:正常路径不变、v1/v2/api 污染还原、
  无已知前缀保留、空路径。
2026-07-09 22:27:52 +08:00
chroe b0424aa6d8 fix(api): restore API path polluted by MSYS2/Git Bash on Windows
在 Windows Git Bash (MSYS2) 环境下,gitlink-cli api GET /v1/owner/repo
的路径参数会被 MSYS2 自动改写为类似
C:/Program Files/Git/v1/owner/repo 的 Windows 路径(MSYS2 把 /v1
当成 Unix 路径转换为 Git 安装目录),导致 API 调用 404。

修复:在 runAPI 中检测路径首部是否为盘符(^[A-Za-z]:/),
若是则按常见 API 前缀(/v1/ /v2/ /api/ /users/ /projects/)
定位并还原原始 API 路径。

影响所有 Windows Git Bash 用户,跨平台兼容性修复。
2026-07-09 21:41:29 +08:00
Mengz 5c16a4a70e feat: 新增 shell 自动补全命令 2026-07-07 14:52:28 +08:00
laurencewannamaker 4913cf5319 fix(output): 全局提取 flag 改名 --jq,避免与 api 子命令 --query(查询参数)语义冲突
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-07-05 23:26:07 +00:00
laurencewannamaker 497bd6a071 feat(output): 全局 --query/-q 点分路径输出字段提取(零依赖,对标 gh --jq)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-07-05 23:22:03 +00:00
laurencewannamaker f402dce051 feat(cli): 根命令支持 --version(复用 i18n version 文案)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-07-05 22:38:46 +00:00
luwanzhou 81d30d6741 fix(api): resolve :owner/:repo and --var placeholders in single calls
gitlink-cli api <METHOD> <PATH> 单次调用此前直接发送原始路径,不替换
REST 风格的 :owner/:repo 占位符——导致该命令自身的 Example
(api POST /:owner/:repo/issues)以及依赖该写法的 Skill/文档无法使用。

- 新增 resolveAPIPath:先按 --var 渲染 {{var}} 模板(复用批处理模板引擎),
  再用 context.ResolveOwnerRepo(--owner/--repo → git remote,与所有 shortcut
  一致)替换 :owner/:repo,最后补全前导 /。
- :owner/:repo 正则用 \b 边界避免误伤 :owner_id;ReplaceAllLiteralString
  避免 owner/repo 中的 $ 被当作正则替换引用。
- 不含占位符且无 --var 的调用行为不变。
- 更新命令 Example;新增单元测试(占位符解析、单次 --var 渲染、缺失变量报错)。

修复 Issue: api 命令单次调用不替换 :owner/:repo 占位符。
2026-06-15 12:36:58 +08:00
wbtiger 723e698db4 Merge pull request '新增 Raw API 批处理执行器' (#124) from Mengz/gitlink-cli:mengz/api-batch-runner into master 2026-06-08 02:24:14 +08:00
wbtiger 03a9d7a942 Merge pull request '修复认证凭据 fallback 配置目录不一致' (#133) from Mengz/gitlink-cli:mengz/auth-config-dir-fallback into master 2026-06-08 02:23:06 +08:00
Mengz d6321e7af5 fix: 统一认证凭据 fallback 配置目录 2026-06-06 18:42:50 +08:00
Mengz dec10afaeb feat: 新增 CLI 自诊断命令 2026-06-06 18:11:45 +08:00
Mengz 35e50a1828 feat: 新增 Raw API 批处理执行器 2026-06-06 11:55:20 +08:00
whzy 37dfd2e2e2 feat(i18n): add CLI localization foundation 2026-06-01 17:33:10 +08:00
wbtiger 0170b5b063 test: add comprehensive test coverage across all packages (88.5% → 90.3%)
Add 18 new test files covering formatter, envelope, config, auth,
client, context, register, and all shortcut group packages.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-31 15:41:54 +08:00
wbtiger f7263cc466 chore: add golangci-lint config and fix lint issues
- Add .golangci.yml with 8 essential linters (errcheck, govet,
  ineffassign, staticcheck, unused, errorlint, gosec, misspell)
- Fix real bugs: errors.As, %w wrapping, nil map check, dead code,
  unnecessary conversion, unused parameters
- Add `make lint` target, include it in `make check` pipeline
- Update pre-commit hook to run lint step

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-31 00:37:45 +08:00
wbtiger 4631b81e5c style: fix gofmt alignment in root.go and register.go 2026-05-29 23:59:40 +08:00
wbtiger 898b7f59d1 feat: add milestone, compare, pr reopen shortcuts and api enhancements (#45)
- milestone shortcuts: list, create, view, update, delete, close, reopen
- compare shortcuts: view, files (compare branches/tags/commits)
- pr +reopen: reopen closed pull requests
- api: add --body-file and --body-stdin for reading JSON from file/stdin
- comprehensive tests for all new shortcuts

Co-authored-by: wangyue111 <wangyue111>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-27 00:44:39 +08:00
wbtiger e892370de8 init gitlink-cli 2026-04-17 10:01:30 +08:00