dsh-github-flow 0.3.0 → 0.4.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/README.en.md +220 -143
- package/README.md +202 -124
- package/docs/UPGRADE-NOTES.md +14 -8
- package/docs/architecture.md +111 -129
- package/lib/api/routes-actions.js +117 -0
- package/lib/api/routes-overview.js +94 -2
- package/lib/cache.d.ts +4 -0
- package/lib/cache.js +14 -0
- package/lib/client.d.ts +13 -1
- package/lib/client.js +2906 -2475
- package/lib/executor/git-parser.d.ts +25 -0
- package/lib/executor/git-parser.js +143 -0
- package/lib/executor/platform-guide.d.ts +14 -0
- package/lib/executor/platform-guide.js +40 -0
- package/lib/executor/process-utils.d.ts +51 -0
- package/lib/executor/process-utils.js +162 -0
- package/lib/executor/version-utils.d.ts +12 -0
- package/lib/executor/version-utils.js +27 -0
- package/lib/executor.d.ts +45 -48
- package/lib/executor.js +184 -353
- package/lib/git-watcher.d.ts +36 -0
- package/lib/git-watcher.js +91 -0
- package/lib/main.js +10 -0
- package/lib/renderers/cache.d.ts +8 -0
- package/lib/renderers/cache.js +66 -0
- package/lib/renderers/common.d.ts +24 -0
- package/lib/renderers/common.js +88 -0
- package/lib/renderers/gist.d.ts +15 -0
- package/lib/renderers/gist.js +99 -0
- package/lib/renderers/issue.d.ts +4 -0
- package/lib/renderers/issue.js +70 -0
- package/lib/renderers/label.d.ts +4 -0
- package/lib/renderers/label.js +48 -0
- package/lib/renderers/markdown.d.ts +15 -32
- package/lib/renderers/markdown.js +15 -624
- package/lib/renderers/pr.d.ts +4 -0
- package/lib/renderers/pr.js +107 -0
- package/lib/renderers/release.d.ts +4 -0
- package/lib/renderers/release.js +74 -0
- package/lib/renderers/repo.d.ts +4 -0
- package/lib/renderers/repo.js +149 -0
- package/lib/renderers/ruleset.d.ts +4 -0
- package/lib/renderers/ruleset.js +74 -0
- package/lib/renderers/run.d.ts +4 -0
- package/lib/renderers/run.js +79 -0
- package/lib/renderers/skill.d.ts +4 -0
- package/lib/renderers/skill.js +61 -0
- package/lib/renderers/status.d.ts +23 -0
- package/lib/renderers/status.js +124 -0
- package/lib/tools/cache.d.ts +64 -0
- package/lib/tools/cache.js +186 -0
- package/lib/tools/gist.d.ts +155 -0
- package/lib/tools/gist.js +190 -0
- package/lib/tools/help.js +107 -6
- package/lib/tools/image-utils.d.ts +8 -0
- package/lib/tools/image-utils.js +34 -0
- package/lib/tools/issue.d.ts +8 -1
- package/lib/tools/issue.js +26 -4
- package/lib/tools/label.d.ts +80 -0
- package/lib/tools/label.js +237 -0
- package/lib/tools/pr.d.ts +8 -0
- package/lib/tools/pr.js +48 -3
- package/lib/tools/ruleset.d.ts +80 -0
- package/lib/tools/ruleset.js +177 -0
- package/lib/tools/status.d.ts +39 -0
- package/lib/tools/status.js +53 -0
- package/lib/types.d.ts +39 -0
- package/lib/ui/auth-guide-card.d.ts +4 -0
- package/lib/ui/auth-guide-card.js +161 -0
- package/lib/ui/branch-selector.d.ts +10 -0
- package/lib/ui/branch-selector.js +163 -0
- package/lib/ui/commit-modal.d.ts +8 -0
- package/lib/ui/commit-modal.js +89 -0
- package/lib/ui/icons.d.ts +7 -0
- package/lib/ui/icons.js +53 -0
- package/lib/ui/network-banner.d.ts +10 -0
- package/lib/ui/network-banner.js +54 -0
- package/lib/ui/storage.d.ts +26 -0
- package/lib/ui/storage.js +134 -0
- package/lib/ui/styles.d.ts +6 -0
- package/lib/ui/styles.js +1285 -0
- package/lib/ui/sync-settings-modal.d.ts +11 -0
- package/lib/ui/sync-settings-modal.js +350 -0
- package/lib/ui/sync-status-badge.d.ts +8 -0
- package/lib/ui/sync-status-badge.js +64 -0
- package/lib/ui/upgrade-card.d.ts +7 -0
- package/lib/ui/upgrade-card.js +197 -0
- package/lib/ui/utils.d.ts +10 -0
- package/lib/ui/utils.js +66 -0
- package/lib/ui/workspace-panel.d.ts +4 -0
- package/lib/ui/workspace-panel.js +464 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { sanitizeCell } from './common.js';
|
|
2
|
+
/**
|
|
3
|
+
* 解析 gh status 的输出,提取待办 Issue、待办 PR、评审请求、提及与近期动态
|
|
4
|
+
*/
|
|
5
|
+
export function parseStatusOutput(output) {
|
|
6
|
+
const trimmed = (output || '').trim();
|
|
7
|
+
const report = {
|
|
8
|
+
assignedIssues: [],
|
|
9
|
+
assignedPrs: [],
|
|
10
|
+
reviewRequests: [],
|
|
11
|
+
mentions: [],
|
|
12
|
+
activity: [],
|
|
13
|
+
rawText: trimmed,
|
|
14
|
+
};
|
|
15
|
+
if (!trimmed)
|
|
16
|
+
return report;
|
|
17
|
+
const lines = trimmed.split(/[\r\n]+/);
|
|
18
|
+
let currentSection = null;
|
|
19
|
+
for (const line of lines) {
|
|
20
|
+
const rawLine = line.trim();
|
|
21
|
+
if (!rawLine)
|
|
22
|
+
continue;
|
|
23
|
+
// 检查是否包含版块头
|
|
24
|
+
if (/Assigned Issues/i.test(rawLine)) {
|
|
25
|
+
currentSection = 'assignedIssues';
|
|
26
|
+
// 如果同一行有双列分割
|
|
27
|
+
if (/Assigned Pull Requests/i.test(rawLine)) {
|
|
28
|
+
// 双列行,仅做标记
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (/Assigned Pull Requests/i.test(rawLine)) {
|
|
34
|
+
currentSection = 'assignedPrs';
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (/Review Requests/i.test(rawLine)) {
|
|
38
|
+
currentSection = 'reviewRequests';
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (/Mentions/i.test(rawLine)) {
|
|
42
|
+
currentSection = 'mentions';
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (/Repository Activity/i.test(rawLine)) {
|
|
46
|
+
currentSection = 'activity';
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
// 过滤空状态占位符
|
|
50
|
+
if (rawLine.includes('Nothing here') || rawLine.includes('^_^')) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
// 处理行内容(支持制表符或双列分隔)
|
|
54
|
+
const cleanSegments = rawLine
|
|
55
|
+
.split('│')
|
|
56
|
+
.map((s) => s.trim())
|
|
57
|
+
.filter((s) => s && !s.includes('Nothing here') && !s.includes('^_^'));
|
|
58
|
+
for (const segment of cleanSegments) {
|
|
59
|
+
if (!segment)
|
|
60
|
+
continue;
|
|
61
|
+
// 尝试匹配制表符或 "repo#123\tdesc\tdetail"
|
|
62
|
+
const tabParts = segment.split('\t').map((p) => p.trim());
|
|
63
|
+
const itemMatch = tabParts[0].match(/^([^#\s]+)#(\d+)/);
|
|
64
|
+
const item = {
|
|
65
|
+
raw: segment,
|
|
66
|
+
};
|
|
67
|
+
if (itemMatch) {
|
|
68
|
+
item.repo = itemMatch[1];
|
|
69
|
+
item.number = itemMatch[2];
|
|
70
|
+
item.title = tabParts[1] || '';
|
|
71
|
+
item.detail = tabParts[2] || '';
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
item.detail = segment;
|
|
75
|
+
}
|
|
76
|
+
if (currentSection && report[currentSection]) {
|
|
77
|
+
report[currentSection].push(item);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
// 未匹配版块默认归入 activity
|
|
81
|
+
report.activity.push(item);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return report;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Status 领域渲染器:负责用户跨仓待办大盘的 Markdown 格式化
|
|
89
|
+
*/
|
|
90
|
+
export function renderStatusMarkdown(args, value) {
|
|
91
|
+
if (!value)
|
|
92
|
+
return '无返回内容';
|
|
93
|
+
const report = value.parsed || parseStatusOutput(value.rawText || value.output || '');
|
|
94
|
+
const renderSection = (title, icon, items, emptyText) => {
|
|
95
|
+
if (!items || items.length === 0) {
|
|
96
|
+
return `#### ${icon} ${title}\n*${emptyText}*\n`;
|
|
97
|
+
}
|
|
98
|
+
const rows = items.map((it) => {
|
|
99
|
+
const repoRef = it.repo && it.number ? `\`${it.repo}#${it.number}\`` : '-';
|
|
100
|
+
const titleText = sanitizeCell(it.title || it.raw, 40);
|
|
101
|
+
const detailText = sanitizeCell(it.detail, 40);
|
|
102
|
+
return `| ${repoRef} | ${titleText} | ${detailText} |`;
|
|
103
|
+
});
|
|
104
|
+
return [
|
|
105
|
+
`#### ${icon} ${title} (${items.length})\n`,
|
|
106
|
+
'| 仓库 & 编号 | 标题 / 动作 | 详情 / 摘要 |',
|
|
107
|
+
'| :--- | :--- | :--- |',
|
|
108
|
+
...rows,
|
|
109
|
+
'',
|
|
110
|
+
].join('\n');
|
|
111
|
+
};
|
|
112
|
+
const sections = [
|
|
113
|
+
renderSection('指派给我的 Issue (Assigned Issues)', '📌', report.assignedIssues, '🟢 暂无分配给你的未决 Issue'),
|
|
114
|
+
renderSection('指派给我的 PR (Assigned Pull Requests)', '🔀', report.assignedPrs, '🟢 暂无分配给你的未决 PR'),
|
|
115
|
+
renderSection('等待我评审的 PR (Review Requests)', '👀', report.reviewRequests, '🟢 暂无待你评审的 PR'),
|
|
116
|
+
renderSection('提及我的动态 (Mentions)', '🔔', report.mentions, '🟢 暂无与你相关的近期提及'),
|
|
117
|
+
renderSection('订阅仓库近期动态 (Repository Activity)', '⚡', report.activity, '暂无近期仓库动态'),
|
|
118
|
+
];
|
|
119
|
+
return [
|
|
120
|
+
'### 🧭 GitHub 个人待办与跨仓动态聚合看板\n',
|
|
121
|
+
...sections,
|
|
122
|
+
'> 💡 **待办操作建议**: 可通过 `github_issue(action: \'view\')` 或 `github_pr(action: \'checkout\')` 快速检视对应议题并展开工作。',
|
|
123
|
+
].join('\n');
|
|
124
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { GhExecutor } from '../executor.js';
|
|
2
|
+
export declare function createCacheTool(executor: GhExecutor): {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
parameters: {
|
|
6
|
+
type: string;
|
|
7
|
+
properties: {
|
|
8
|
+
action: {
|
|
9
|
+
type: string;
|
|
10
|
+
enum: string[];
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
repo: {
|
|
14
|
+
type: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
cache_id: {
|
|
18
|
+
type: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
key: {
|
|
22
|
+
type: string;
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
ref: {
|
|
26
|
+
type: string;
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
limit: {
|
|
30
|
+
type: string;
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
sort: {
|
|
34
|
+
type: string;
|
|
35
|
+
enum: string[];
|
|
36
|
+
description: string;
|
|
37
|
+
};
|
|
38
|
+
order: {
|
|
39
|
+
type: string;
|
|
40
|
+
enum: string[];
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
all: {
|
|
44
|
+
type: string;
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
confirm: {
|
|
48
|
+
type: string;
|
|
49
|
+
description: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
required: string[];
|
|
53
|
+
};
|
|
54
|
+
output: {
|
|
55
|
+
schema: {
|
|
56
|
+
type: string;
|
|
57
|
+
};
|
|
58
|
+
render(args: any, value: any): {
|
|
59
|
+
type: string;
|
|
60
|
+
text: string;
|
|
61
|
+
}[];
|
|
62
|
+
};
|
|
63
|
+
execute(args: any, execContext: any): Promise<Record<string, any>>;
|
|
64
|
+
};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { renderCacheMarkdown } from '../renderers/markdown.js';
|
|
2
|
+
function normalizeOutput(data) {
|
|
3
|
+
if (data && typeof data === 'object' && !Array.isArray(data)) {
|
|
4
|
+
return data;
|
|
5
|
+
}
|
|
6
|
+
if (Array.isArray(data)) {
|
|
7
|
+
return { items: data, count: data.length };
|
|
8
|
+
}
|
|
9
|
+
return { result: data !== undefined && data !== null ? data : '' };
|
|
10
|
+
}
|
|
11
|
+
export function createCacheTool(executor) {
|
|
12
|
+
return {
|
|
13
|
+
name: 'github_cache',
|
|
14
|
+
description: '管理 GitHub Actions 构建缓存 (Caches):查看缓存列表与占用容量、按 ID 或 Key 删除指定缓存、以及全量清空仓库缓存。全量清空不可逆,需 confirm: true。',
|
|
15
|
+
parameters: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
action: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
enum: ['list', 'delete'],
|
|
21
|
+
description: 'Cache 操作类型。list 查看缓存列表与体积、delete 删除缓存。',
|
|
22
|
+
},
|
|
23
|
+
repo: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: '目标仓库 [owner/repo],留空则识别当前工作区仓库。',
|
|
26
|
+
},
|
|
27
|
+
cache_id: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
description: '缓存数字 ID(delete 动作指定单条缓存删除时使用)。',
|
|
30
|
+
},
|
|
31
|
+
key: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
description: '缓存 Key 键名前缀或完整键名(list 动作过滤检索,或 delete 动作按键删除时使用)。',
|
|
34
|
+
},
|
|
35
|
+
ref: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
description: '分支或 PR Git Ref(如 "refs/heads/main" 或 "refs/pull/42/merge",用于过滤或定向删除)。',
|
|
38
|
+
},
|
|
39
|
+
limit: {
|
|
40
|
+
type: 'number',
|
|
41
|
+
description: '返回缓存数量上限(list 动作使用,默认 30)。',
|
|
42
|
+
},
|
|
43
|
+
sort: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
enum: ['created_at', 'last_accessed_at', 'size_in_bytes'],
|
|
46
|
+
description: '排序字段(list 动作使用,默认 last_accessed_at)。',
|
|
47
|
+
},
|
|
48
|
+
order: {
|
|
49
|
+
type: 'string',
|
|
50
|
+
enum: ['asc', 'desc'],
|
|
51
|
+
description: '排序方向(list 动作使用,默认 desc)。',
|
|
52
|
+
},
|
|
53
|
+
all: {
|
|
54
|
+
type: 'boolean',
|
|
55
|
+
description: '是否清空仓库全部缓存(delete 动作使用,高危操作,必需配合 confirm: true)。',
|
|
56
|
+
},
|
|
57
|
+
confirm: {
|
|
58
|
+
type: 'boolean',
|
|
59
|
+
description: '高危破坏性操作确认标志(delete 当 all: true 时必需)。未传 true 时输出影响评估报告并拦截。',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
required: ['action'],
|
|
63
|
+
},
|
|
64
|
+
output: {
|
|
65
|
+
schema: { type: 'object' },
|
|
66
|
+
render(args, value) {
|
|
67
|
+
return [{ type: 'text', text: renderCacheMarkdown(args, value) }];
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
async execute(args, execContext) {
|
|
71
|
+
const cwd = execContext?.cwd || process.cwd();
|
|
72
|
+
const sessionId = execContext?.sessionId || execContext?.session?.id || process.env.DSH_SESSION_ID;
|
|
73
|
+
let repoTarget = args.repo;
|
|
74
|
+
if (!repoTarget) {
|
|
75
|
+
const meta = await executor.getRepoMetadata(cwd, sessionId);
|
|
76
|
+
if (meta?.nameWithOwner) {
|
|
77
|
+
repoTarget = meta.nameWithOwner;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (!repoTarget) {
|
|
81
|
+
throw new Error('未能自动识别当前工作区关联的 GitHub 仓库。请通过 `repo` 参数显式指定目标仓库 [owner/repo](例如: "ItQianChen/dsh-github-flow"),或在当前工作区目录下关联 Git 远程仓库。');
|
|
82
|
+
}
|
|
83
|
+
const repoArgs = ['-R', repoTarget];
|
|
84
|
+
const runOpts = { cwd, sessionId };
|
|
85
|
+
switch (args.action) {
|
|
86
|
+
case 'list': {
|
|
87
|
+
const listCmd = [
|
|
88
|
+
'cache',
|
|
89
|
+
'list',
|
|
90
|
+
...repoArgs,
|
|
91
|
+
'--json',
|
|
92
|
+
'createdAt,id,key,lastAccessedAt,ref,sizeInBytes,version',
|
|
93
|
+
];
|
|
94
|
+
const limit = typeof args.limit === 'number' && args.limit > 0 ? args.limit : 30;
|
|
95
|
+
listCmd.push('-L', String(limit));
|
|
96
|
+
if (args.key) {
|
|
97
|
+
listCmd.push('-k', String(args.key));
|
|
98
|
+
}
|
|
99
|
+
if (args.ref) {
|
|
100
|
+
listCmd.push('-r', String(args.ref));
|
|
101
|
+
}
|
|
102
|
+
if (args.sort) {
|
|
103
|
+
listCmd.push('--sort', args.sort);
|
|
104
|
+
}
|
|
105
|
+
if (args.order) {
|
|
106
|
+
listCmd.push('--order', args.order);
|
|
107
|
+
}
|
|
108
|
+
const res = await executor.run(listCmd, runOpts);
|
|
109
|
+
if (!res.ok)
|
|
110
|
+
throw new Error(res.error);
|
|
111
|
+
let rawData = res.data;
|
|
112
|
+
if (!rawData && typeof res.rawOutput === 'string') {
|
|
113
|
+
try {
|
|
114
|
+
rawData = JSON.parse(res.rawOutput);
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
rawData = [];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return normalizeOutput(rawData || []);
|
|
121
|
+
}
|
|
122
|
+
case 'delete': {
|
|
123
|
+
// 1. 全量清空分支
|
|
124
|
+
if (args.all === true) {
|
|
125
|
+
if (args.confirm !== true) {
|
|
126
|
+
return {
|
|
127
|
+
status: 'AWAITING_CONFIRMATION',
|
|
128
|
+
action: 'delete',
|
|
129
|
+
all: true,
|
|
130
|
+
repo: repoTarget,
|
|
131
|
+
warning: `⚠️ 高危破坏性操作:即将清空仓库 ${repoTarget} 的所有 GitHub Actions 构建缓存`,
|
|
132
|
+
impact: `清空缓存不可逆,会导致后续流水线构建无法复用依赖与构建产物,显著增加 CI 运行耗时。`,
|
|
133
|
+
requiredAction: `如确认彻底清空,请在参数中附加 \`confirm: true\` 重新调用。示例:\`github_cache(action: 'delete', all: true, confirm: true)\``,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const delCmd = ['cache', 'delete', '--all', '--succeed-on-no-caches', ...repoArgs];
|
|
137
|
+
if (args.ref) {
|
|
138
|
+
delCmd.push('-r', String(args.ref));
|
|
139
|
+
}
|
|
140
|
+
const res = await executor.run(delCmd, runOpts);
|
|
141
|
+
if (!res.ok)
|
|
142
|
+
throw new Error(res.error);
|
|
143
|
+
return {
|
|
144
|
+
success: true,
|
|
145
|
+
all: true,
|
|
146
|
+
message: `🗑️ 成功清空仓库 ${repoTarget} 的 Actions 构建缓存` + (args.ref ? ` (Ref: ${args.ref})` : ''),
|
|
147
|
+
detail: res.rawOutput || '',
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
// 2. 按 cache_id 删除
|
|
151
|
+
if (args.cache_id !== undefined && args.cache_id !== null && String(args.cache_id).trim() !== '') {
|
|
152
|
+
const delCmd = ['cache', 'delete', String(args.cache_id), ...repoArgs];
|
|
153
|
+
const res = await executor.run(delCmd, runOpts);
|
|
154
|
+
if (!res.ok)
|
|
155
|
+
throw new Error(res.error);
|
|
156
|
+
return {
|
|
157
|
+
success: true,
|
|
158
|
+
cache_id: String(args.cache_id),
|
|
159
|
+
message: `🗑️ 成功删除仓库 ${repoTarget} 中 ID 为 "${args.cache_id}" 的 Actions 缓存`,
|
|
160
|
+
detail: res.rawOutput || '',
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
// 3. 按 key 删除
|
|
164
|
+
if (args.key !== undefined && args.key !== null && String(args.key).trim() !== '') {
|
|
165
|
+
const delCmd = ['cache', 'delete', String(args.key), ...repoArgs];
|
|
166
|
+
if (args.ref) {
|
|
167
|
+
delCmd.push('-r', String(args.ref));
|
|
168
|
+
}
|
|
169
|
+
const res = await executor.run(delCmd, runOpts);
|
|
170
|
+
if (!res.ok)
|
|
171
|
+
throw new Error(res.error);
|
|
172
|
+
return {
|
|
173
|
+
success: true,
|
|
174
|
+
key: String(args.key),
|
|
175
|
+
message: `🗑️ 成功删除仓库 ${repoTarget} 中 Key 为 "${args.key}" 的 Actions 缓存` + (args.ref ? ` (Ref: ${args.ref})` : ''),
|
|
176
|
+
detail: res.rawOutput || '',
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
throw new Error('删除缓存时必须指定 `cache_id`、`key` 或 `all: true`(全量删除需配合 confirm: true)。');
|
|
180
|
+
}
|
|
181
|
+
default:
|
|
182
|
+
throw new Error(`不支持的 cache 操作: "${args.action}"。可选值: list, delete。`);
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { GhExecutor } from '../executor.js';
|
|
2
|
+
export declare function createGistTool(executor: GhExecutor): {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
parameters: {
|
|
6
|
+
type: string;
|
|
7
|
+
properties: {
|
|
8
|
+
action: {
|
|
9
|
+
type: string;
|
|
10
|
+
enum: string[];
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
gist_id: {
|
|
14
|
+
type: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
filename: {
|
|
18
|
+
type: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
files: {
|
|
22
|
+
type: string;
|
|
23
|
+
items: {
|
|
24
|
+
type: string;
|
|
25
|
+
};
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
content: {
|
|
29
|
+
type: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
description: {
|
|
33
|
+
type: string;
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
public: {
|
|
37
|
+
type: string;
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
filter: {
|
|
41
|
+
type: string;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
limit: {
|
|
45
|
+
type: string;
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
confirm: {
|
|
49
|
+
type: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
required: string[];
|
|
54
|
+
};
|
|
55
|
+
output: {
|
|
56
|
+
schema: {
|
|
57
|
+
type: string;
|
|
58
|
+
};
|
|
59
|
+
render(args: any, value: any): {
|
|
60
|
+
type: string;
|
|
61
|
+
text: string;
|
|
62
|
+
}[];
|
|
63
|
+
};
|
|
64
|
+
execute(args: any, execContext: any): Promise<{
|
|
65
|
+
items: import("../renderers/gist.js").ParsedGistSummary[];
|
|
66
|
+
count: number;
|
|
67
|
+
rawText: string;
|
|
68
|
+
filename?: undefined;
|
|
69
|
+
content?: undefined;
|
|
70
|
+
url?: undefined;
|
|
71
|
+
public?: undefined;
|
|
72
|
+
description?: undefined;
|
|
73
|
+
success?: undefined;
|
|
74
|
+
message?: undefined;
|
|
75
|
+
detail?: undefined;
|
|
76
|
+
status?: undefined;
|
|
77
|
+
action?: undefined;
|
|
78
|
+
gist_id?: undefined;
|
|
79
|
+
warning?: undefined;
|
|
80
|
+
impact?: undefined;
|
|
81
|
+
requiredAction?: undefined;
|
|
82
|
+
} | {
|
|
83
|
+
items?: undefined;
|
|
84
|
+
count?: undefined;
|
|
85
|
+
rawText?: undefined;
|
|
86
|
+
gist_id: string;
|
|
87
|
+
filename: any;
|
|
88
|
+
content: string;
|
|
89
|
+
url?: undefined;
|
|
90
|
+
public?: undefined;
|
|
91
|
+
description?: undefined;
|
|
92
|
+
success?: undefined;
|
|
93
|
+
message?: undefined;
|
|
94
|
+
detail?: undefined;
|
|
95
|
+
status?: undefined;
|
|
96
|
+
action?: undefined;
|
|
97
|
+
warning?: undefined;
|
|
98
|
+
impact?: undefined;
|
|
99
|
+
requiredAction?: undefined;
|
|
100
|
+
} | {
|
|
101
|
+
items?: undefined;
|
|
102
|
+
count?: undefined;
|
|
103
|
+
rawText?: undefined;
|
|
104
|
+
filename?: undefined;
|
|
105
|
+
content?: undefined;
|
|
106
|
+
success: boolean;
|
|
107
|
+
url: string;
|
|
108
|
+
gist_id: string;
|
|
109
|
+
public: boolean;
|
|
110
|
+
description: any;
|
|
111
|
+
message: string;
|
|
112
|
+
detail?: undefined;
|
|
113
|
+
status?: undefined;
|
|
114
|
+
action?: undefined;
|
|
115
|
+
warning?: undefined;
|
|
116
|
+
impact?: undefined;
|
|
117
|
+
requiredAction?: undefined;
|
|
118
|
+
} | {
|
|
119
|
+
items?: undefined;
|
|
120
|
+
count?: undefined;
|
|
121
|
+
rawText?: undefined;
|
|
122
|
+
filename?: undefined;
|
|
123
|
+
content?: undefined;
|
|
124
|
+
url?: undefined;
|
|
125
|
+
public?: undefined;
|
|
126
|
+
description?: undefined;
|
|
127
|
+
success: boolean;
|
|
128
|
+
gist_id: string;
|
|
129
|
+
message: string;
|
|
130
|
+
detail: string;
|
|
131
|
+
status?: undefined;
|
|
132
|
+
action?: undefined;
|
|
133
|
+
warning?: undefined;
|
|
134
|
+
impact?: undefined;
|
|
135
|
+
requiredAction?: undefined;
|
|
136
|
+
} | {
|
|
137
|
+
items?: undefined;
|
|
138
|
+
count?: undefined;
|
|
139
|
+
rawText?: undefined;
|
|
140
|
+
filename?: undefined;
|
|
141
|
+
content?: undefined;
|
|
142
|
+
url?: undefined;
|
|
143
|
+
public?: undefined;
|
|
144
|
+
description?: undefined;
|
|
145
|
+
success?: undefined;
|
|
146
|
+
message?: undefined;
|
|
147
|
+
detail?: undefined;
|
|
148
|
+
status: string;
|
|
149
|
+
action: string;
|
|
150
|
+
gist_id: string;
|
|
151
|
+
warning: string;
|
|
152
|
+
impact: string;
|
|
153
|
+
requiredAction: string;
|
|
154
|
+
}>;
|
|
155
|
+
};
|