Commit Graph

163 Commits

Author SHA1 Message Date
刘焱 c2eb3c8f1a fix(newcomer-skill): 修复 label 命令 Bug,加入状态过滤与幂等去重 2026-06-15 20:57:11 +08:00
刘焱 bb0ef89450 fix(compliance-skill): 修复 DB 连接串正则与跨文件一致性(C1/I1/I2/I3/I4/M2) 2026-06-15 20:45:45 +08:00
刘焱 ef2aa17c8e docs(compliance-skill): 新增端到端合规检查示例 2026-06-15 20:25:44 +08:00
刘焱 f071f456fa docs(compliance-skill): REFERENCE 增补敏感信息扫描章节 2026-06-15 20:25:20 +08:00
刘焱 a6e174da88 feat(compliance-skill): 新增敏感信息扫描工作流与报告整合 2026-06-15 20:24:26 +08:00
刘焱 34a0dc0d78 docs(plans): GitLink Skills 丰富与完善实现计划
11 个任务(10 静态 + 1 真实验证),compliance→newcomer→README→全局验证顺序。
每步含完整内容与可执行验证命令,已自检(规格覆盖/占位符/类型一致)。
2026-06-15 20:17:48 +08:00
刘焱 a147812e60 docs(specs): GitLink Skills 丰富与完善设计规格
聚焦子任务二标记完成的 2 个技能:
- gitlink-compliance:补敏感信息扫描工作流 + examples
- gitlink-newcomer-guide:修 label 命令 Bug + REFERENCE + 幂等去重

决策 A=混合扫描(api+git),决策 B=标记串+journal 去重。
验证=先静态后真实。
2026-06-15 20:04:45 +08:00
刘焱 75a8ed235a fix(collaborator): 修复 change-role/batch-role 请求体
CI / test (push) Failing after 39m6s Details
forgeplus change_role 要求顶层 {user_id: 整数, role: Manager},原先嵌套 {user:{user_id:用户名, role_name:admin}} 导致未找到用户。改为经协作者列表解析用户名到数字 ID,role 映射 admin/write/read 到 Manager/Developer/Reporter。
2026-06-10 11:28:45 +08:00
刘焱 e9f36c29fb fix(branch): 修复保护分支接口路径与列表输出
protect/unprotect/batch-protect 走无 /v1 的老接口(DELETE /api/:owner/:repo/protected_branches/:name),原先漏或误加 /v1 均导致 404;branch +list 投影到核心列 name/protected/last_commit/commit_time,避免字段过多导致表格不稳定。
2026-06-10 11:28:45 +08:00
刘焱 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
刘焱 d12ce0fb57 fix(interactive): 命令面板选中带可选参数的命令也弹出表单
CI / test (push) Failing after 2m4s Details
根因:updatePalette 只在有缺失的 Required flag 时才弹参数表单。但很多
命令的参数是'至少一个'关系(如 branch +batch-protect 的 --names/--from
二选一),无法单独标记 Required,导致 missingRequiredFlags 返回空,
表单被跳过,命令直接执行后报 'no branch names provided'。

修复:把表单触发条件从'有缺失必填参数'改为'命令有任何 flag'。这样
选中任何带参数的命令都弹表单,用户能填可选参数(留空即跳过)。
无 flag 的命令(如 wiki +list、repo +recommend)仍直接执行。

回归测试 TestPaletteSelectionOpensFormForOptionalFlags 验证模拟的
batch-protect(全可选参数)选中后进入 stateForm 而非直接执行。
2026-06-08 21:01:04 +08:00
刘焱 c7a2ca3685 fix(file): 移除 +tree 无效的 --recursive flag
GitLink 的 /git/trees/:sha 端点实测不支持 recursive 参数(无论传
true/false、sha 用分支名还是 commit,都报'Recursive不包含于列表中')。
移除 --recursive flag 避免误导,更新 help 说明改用 +entries --path 逐层
展开子目录。
2026-06-08 20:52:21 +08:00
刘焱 386e3c92b8 fix(file): 修复文件管理命令的端点和参数问题
经实测 Gitlink/gitlink-cli 与自有 fork 仓库,file 组存在多处问题:

1. +get 端点错误:原 /files?filepath= 返回整个仓库文件列表而非
   指定文件。改为用 /entries 取目录再按文件名提取单文件元信息
   (GitLink 无'按路径取原始内容'端点,需配合 +blob --sha 取内容)

2. +tree recursive bug:传 recursive=false 被 API 拒绝
   ('Recursive不包含于列')。改为仅当用户显式 --recursive 时才传参

3. +create/+update/+delete 缺必需参数:
   - 补 --new-branch(保护分支场景下创建新分支)
   - +update/+delete 的 --sha 改为必填并加中文错误提示
   - 校验 branch 或 new_branch 至少一个

4. 移除 +replace:端点 /replace_file 返回'接口方法异常'(废弃),
   功能与 +create/+update 重复

新增 pathDir/pathBase/findEntryByName 辅助函数。实测 +create
--new-branch 在自有 fork 成功创建文件。
2026-06-08 20:46:09 +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
刘焱 c345b5af5d fix(tag): tag +view 改用列表过滤,GitLink 无单标签 API 端点
根因:GitLink API 文档(Repositories 章节)只有'仓库标签列表'
(GET /api/:owner/:repo/tags.json),没有'获取单个标签'端点。
原 tag +view 调用的 /v1/{owner}/{repo}/tags/{name} 是不存在的端点,
落到 web 路由返回'标签不存在'错误。

修复:tag +view 改为先调用 tags 列表端点,再用 findTagByName
按名称过滤出目标标签。找不到时返回明确的中文错误。

新增 findTagByName 辅助函数及 4 个单元测试覆盖:
找到/未找到/nil envelope/无 tags key。
2026-06-08 20:30:47 +08:00
刘焱 c192b26da8 docs(repo): 子命令描述和注释中文化 2026-06-08 19:59:27 +08:00
刘焱 5a5db6d298 docs(pr): 子命令描述和注释中文化 2026-06-08 19:59:25 +08:00
刘焱 d20b3b09e1 docs(issue): 子命令描述和注释中文化 2026-06-08 19:59:22 +08:00
刘焱 0ff97fd213 docs(attachment): 子命令描述和注释中文化 2026-06-08 19:58:57 +08:00
刘焱 f5f1a34310 docs(dataset): 子命令描述和注释中文化 2026-06-08 19:58:54 +08:00
刘焱 a8be1a8100 docs(template): 子命令描述和注释中文化 2026-06-08 19:58:48 +08:00
刘焱 46eff83ef5 docs(ci): 子命令描述和注释中文化 2026-06-08 19:58:43 +08:00
刘焱 01e4515cb9 docs(search): 子命令描述和注释中文化 2026-06-08 19:58:36 +08:00
刘焱 fd647b7e75 docs(org): 子命令描述和注释中文化 2026-06-08 19:58:32 +08:00
刘焱 5c8cc3462c docs(util): 子命令描述和注释中文化 2026-06-08 19:58:30 +08:00
刘焱 a31b8e5b11 docs(sshkey): 子命令描述和注释中文化 2026-06-08 19:58:24 +08:00
刘焱 7fa93cb3c1 docs(label): 子命令描述和注释中文化 2026-06-08 19:58:20 +08:00
刘焱 68e7994d08 docs(commit): 子命令描述和注释中文化 2026-06-08 19:58:17 +08:00
刘焱 81cfcfb3e4 docs(file): 子命令描述和注释中文化 2026-06-08 19:58:09 +08:00
刘焱 596fb81a55 docs(milestone): 子命令描述和注释中文化 2026-06-08 19:56:30 +08:00
刘焱 84aae8554b docs(release): 子命令描述和注释中文化 2026-06-08 19:56:26 +08:00
刘焱 be152b9fa1 docs(collaborator): 子命令描述和注释中文化 2026-06-08 19:56:25 +08:00
刘焱 5c9e24c725 docs(tag): 子命令描述和注释中文化 2026-06-08 19:56:24 +08:00
刘焱 59240d18c5 docs(branch): 子命令描述和注释中文化 2026-06-08 19:56:23 +08:00
刘焱 799af5f3cf docs(wiki): 子命令描述和注释中文化 2026-06-08 19:56:21 +08:00
刘焱 cafde7d2f4 docs(user): 子命令描述和注释中文化 2026-06-08 19:56:18 +08:00
刘焱 2aa1b2ffe4 docs(snippet): 子命令描述和注释中文化 2026-06-08 19:56:17 +08:00
刘焱 bc12b43fc0 docs(webhook): 子命令描述和注释中文化 2026-06-08 19:56:15 +08:00
刘焱 30f16b9613 feat(interactive): 默认使用 table 格式输出,提升可读性 2026-06-08 19:53:20 +08:00
刘焱 461b28e6c8 test(interactive): smoke-test all registered commands execute without panic 2026-06-08 19:50:50 +08:00
刘焱 d66c88ecca feat(interactive): add scrollable viewport for long command output 2026-06-08 19:48:17 +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
刘焱 f1dc2f8bc9 docs(shortcuts): 给每个命令组添加中文注释和中文描述
GetAllShortcuts 每个命令组加中文行内注释,说明该组用途;
GetDescriptions 描述改为中文,使交互式命令面板直接显示中文。
2026-06-08 19:18:46 +08:00
刘焱 b2136559bf fix(interactive): initialize RuntimeContext via NewRuntimeContext to prevent nil-Client panic
Selecting a command showed no output because Execute built the
RuntimeContext as a bare struct literal (&RuntimeContext{Args: args}),
leaving Client == nil. Any command calling ctx.CallAPI then panicked with
a nil pointer dereference inside the executor goroutine; the panic aborted
the goroutine before w.Close()/stdout restore, so the execResultMsg never
fired and the REPL hung silently.

Fix: use common.NewRuntimeContext(args) (initializes Client/Format/Owner/Repo,
matching runner.go), and wrap s.Run in safeRun() so a panic converts to an
error and stdout is always restored.

Adds regression tests: nil-Client assertion, panic-safe stdout restore, and
an end-to-end test that runs the real repo +list shortcut and asserts
Execute never returns (empty output, nil error).
2026-06-08 19:16:40 +08:00
刘焱 16787b8f8c fix(interactive): trigger command palette immediately on '/' keypress
Previously the palette only opened after pressing Enter because the trigger
logic lived in the KeyEnter branch. The spec requires '/' to open the palette
immediately. Now KeyRunes with '/' as the first character of an empty input
switches to statePalette right away, carrying any trailing characters (e.g.
'/iss') as the initial search query.

Adds regression tests covering: immediate '/', '/' with query, and ordinary
text staying in input state.
2026-06-08 19:09:02 +08:00
刘焱 2596d1dc70 fix(interactive): correct Esc behavior and direct-exec for optional flags 2026-06-08 18:59:00 +08:00
刘焱 65a4e60d6d feat(interactive): add REPL with command palette, form, and cobra entry 2026-06-08 18:52:23 +08:00