dsh-github-repo-search 0.0.0-stage → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ZhaoDezhang9998
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,97 @@
1
- # Temporary Holding Version
1
+ # dsh-github-repo-search
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![Open Plugin Market](https://img.shields.io/endpoint?url=https%3A%2F%2Fdshopen.org%2Fbadge%2Fdsh-github-repo-search.json%3Flang%3Den)](https://dshopen.org/plugins/dsh-github-repo-search/)
4
+
5
+ 让智能体直接检索 GitHub,而不是凭记忆编。你说「搜一下漫剧相关的开源项目」,它真的去查,带星标、语言、许可证、最近推送和链接回来;结果还会落到右侧栏面板,可以回看、收藏、并排对比。
6
+
7
+ ## 为什么装这个
8
+
9
+ 模型不知道 GitHub 上**现在**有什么。它不知道某个项目存不存在、还在不在维护、有没有人提过同样的需求。以下是它答不上来、但这个插件能查的:
10
+
11
+ | 你的问题 | 走哪个工具 |
12
+ | --- | --- |
13
+ | 有没有现成的漫剧创作 skill? | `github_search_repos` |
14
+ | 这个方向最近在火什么? | `github_trending` |
15
+ | 这个库还能用吗、多久没更新了? | `github_repo` |
16
+ | 这个功能有人实现过吗? | `github_search_code` |
17
+ | 这个 bug 是不是已知的? | `github_search_issues` |
18
+
19
+ 搜索结果按关键词分组进面板,**翻页**能看到第 1000 条以内的全部结果。
20
+
21
+ ## 六个工具
22
+
23
+ | 工具 | 作用 |
24
+ | --- | --- |
25
+ | `github_search_repos` | 检索仓库。支持 `language:` `stars:>500` `topic:llm` `pushed:>2026-01-01` 等全部 GitHub 限定词,可排序、可翻页 |
26
+ | `github_trending` | 近期活跃的热门仓库。GitHub 无公开 trending API,用「最近推送 + 星标」推导,输出里会注明 |
27
+ | `github_search_code` | 搜代码内容。找某个 API 的真实用法、某个函数有没有实现。需登录 |
28
+ | `github_search_issues` | 搜 issue 与 PR。判断需求是否已有人提、bug 是否已知、项目多活跃 |
29
+ | `github_repo` | 读单个仓库:元信息、语言构成、最新 Release、README。接受 `owner/name`、URL、`…/tree/main` |
30
+ | `github_rate` | 查配额,模型据此决定省不省着用 |
31
+
32
+ ## 侧边栏面板
33
+
34
+ 会话头部右上角的放大镜(左侧栏底部也有入口)打开右侧栏面板:
35
+
36
+ - **仓库** — 本次会话搜过的仓库,按关键词分组;点卡片展开语言构成、Release、README
37
+ - **代码** — 命中的文件路径,点击直达 GitHub
38
+ - **议题** — issue/PR 列表,带 open/closed 与评论数
39
+ - **收藏** — 星标标记的仓库,跨会话保留
40
+ - **对比** — 挑 2–3 个候选并排比星标、语言、许可证、最近推送、Fork、归档状态
41
+
42
+ 支持按星标/最近/名称重排,列表里可一键复制仓库名或 `git clone` 命令。
43
+
44
+ 面板是**只读回看**,不发起搜索——检索由对话驱动,面板负责让你翻查刚才搜到了什么。
45
+
46
+ ## 安装
47
+
48
+ ```bash
49
+ dsh plugin --profile <你的 profile> add dsh-github-repo-search
50
+ ```
51
+
52
+ 也可以在 DSH 里 **Plugins → 添加插件** 选本目录。装完重启,在新会话里直接说人话即可。
53
+
54
+ ## 配额
55
+
56
+ | 接口 | 匿名 | 带 token |
57
+ | --- | --- | --- |
58
+ | core(`github_repo` / `github_rate`) | 60 次/小时 | 5000 次/小时 |
59
+ | search(仓库 / 议题) | 10 次/小时 | 30 次/分钟 |
60
+ | code search | **必须登录** | 10 次/分钟 |
61
+
62
+ **强烈建议配 token**:匿名状态下搜索只有 10 次/小时,且代码搜索完全不可用。
63
+
64
+ token 从 **DSH 密钥库**读取,优先级 `GITHUB_TOKEN` → `GH_TOKEN` → `DSH_GITHUB_TOKEN`;密钥库没有时回落到进程环境变量。每次请求重新解析,存完立即生效、无需重启。
65
+
66
+ 存法一:DSH 设置页 → 模型/凭据,添加名为 `GITHUB_TOKEN` 的密钥。
67
+
68
+ 存法二:写 `~/.dsh/.credentials.yaml` 的 `refs`:
69
+
70
+ ```yaml
71
+ version: 1
72
+ refs:
73
+ GITHUB_TOKEN: ghp_xxx
74
+ ```
75
+
76
+ ## 配置
77
+
78
+ `cordis.patch.yml`:
79
+
80
+ | 字段 | 默认 | 说明 |
81
+ | --- | --- | --- |
82
+ | `apiBase` | `https://api.github.com` | GitHub Enterprise 换自己的地址 |
83
+ | `maxResults` | `30` | 单次返回条数(1–100) |
84
+ | `maxReadmeChars` | `8000` | README 截断字符数 |
85
+ | `timeoutMs` | `20000` | 单次请求超时 |
86
+ | `trustedHosts` | `[]` | 除 github.com / api.github.com 外,额外允许接收 token 的主机 |
87
+
88
+ ## 设计取舍
89
+
90
+ - **只读**:不写 GitHub、不登录、不调用 `gh`、不注册任何 `webServer` 路由。
91
+ - **凭据范围受控**:因为 `apiBase` 可配置,token 只发往 `github.com`、`api.github.com` 与你显式列入 `trustedHosts` 的主机,其余一律按匿名请求。
92
+ - **检索由对话驱动**:面板不内置搜索框。Web 端调用宿主能力需要 Typert 生成的 Remote 命名空间,第三方插件无法接入;对话检索更贴合实际用法。
93
+ - **短期缓存**:相同请求 60 秒内复用结果,并合并并发重复请求,避免模型重复调用撞配额。只缓存成功结果。
94
+
95
+ ## 许可
96
+
97
+ MIT