@brain-toolkit/issue-forge 0.0.0-stage → 0.1.1
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/CHANGELOG.md +34 -0
- package/LICENSE +15 -0
- package/README.md +42 -2
- package/dist/GithubAppClient-CPCXnpDO.d.ts +103 -0
- package/dist/chunk-MQ7IDBIZ.js +4 -0
- package/dist/chunk-MQ7IDBIZ.js.map +1 -0
- package/dist/feedback/index.cjs +44 -0
- package/dist/feedback/index.cjs.map +1 -0
- package/dist/feedback/index.d.ts +236 -0
- package/dist/feedback/index.js +44 -0
- package/dist/feedback/index.js.map +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +148 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +59 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { F as ForgeIssueCreateInputType, a as ForgeIssueCreatedType, b as ForgeIssueRefType, c as ForgeAssetUploadInputType, d as ForgeAssetUploadedType, I as IssueWebhookVerifyResultType, G as GithubAppClient, e as GithubAppAuthConfigType, f as IssueForgeTokenCacheInterface } from './GithubAppClient-CPCXnpDO.js';
|
|
2
|
+
export { h as GithubAppClientOptionsType, i as GithubAppRequestType, g as IssueForgeError } from './GithubAppClient-CPCXnpDO.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Forge 无关的 Issue 网关(形态 B:实例已绑定鉴权 / 目标仓,方法不再传 config)。
|
|
6
|
+
*/
|
|
7
|
+
type ForgeIssueCommentType = {
|
|
8
|
+
readonly body: string;
|
|
9
|
+
};
|
|
10
|
+
interface IssueForgeGatewayInterface {
|
|
11
|
+
createIssue(input: ForgeIssueCreateInputType): Promise<ForgeIssueCreatedType>;
|
|
12
|
+
createComment(issue: ForgeIssueRefType, body: string): Promise<void>;
|
|
13
|
+
/** 列出 Issue 评论(用于截图评论幂等:按 body 是否已含 raw URL) */
|
|
14
|
+
listComments(issue: ForgeIssueRefType): Promise<readonly ForgeIssueCommentType[]>;
|
|
15
|
+
/**
|
|
16
|
+
* 可选:上传可供 Issue 引用的资源。未实现时调用方应跳过附件同步。
|
|
17
|
+
*/
|
|
18
|
+
uploadAsset?(input: ForgeAssetUploadInputType): Promise<ForgeAssetUploadedType>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 仓库文本读 / 分支初始化 / 文件上传(读 Issue 模板、截图落仓等)。
|
|
23
|
+
* 形态 B:实例已绑定鉴权与目标仓。
|
|
24
|
+
*/
|
|
25
|
+
type IssueForgeRepoFileType = {
|
|
26
|
+
readonly path: string;
|
|
27
|
+
readonly content: string;
|
|
28
|
+
};
|
|
29
|
+
type IssueForgeRepoFileUploadInputType = {
|
|
30
|
+
readonly path: string;
|
|
31
|
+
readonly contentBase64: string;
|
|
32
|
+
readonly branch: string;
|
|
33
|
+
readonly message: string;
|
|
34
|
+
};
|
|
35
|
+
type IssueForgeRepoFileUploadedType = {
|
|
36
|
+
readonly url: string;
|
|
37
|
+
};
|
|
38
|
+
interface IssueForgeRepoContentInterface {
|
|
39
|
+
readTextFile(path: string): Promise<string | null>;
|
|
40
|
+
/**
|
|
41
|
+
* 指定分支上是否已有该路径文件(HEAD GET contents;404 为 false)。
|
|
42
|
+
*/
|
|
43
|
+
hasFile(path: string, branch: string): Promise<boolean>;
|
|
44
|
+
ensureBranch(branch: string, initialFile: IssueForgeRepoFileType): Promise<void>;
|
|
45
|
+
uploadFile(input: IssueForgeRepoFileUploadInputType): Promise<IssueForgeRepoFileUploadedType>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Webhook 签名校验(secret 在构造时绑定)。
|
|
50
|
+
*/
|
|
51
|
+
interface IssueWebhookVerifierInterface {
|
|
52
|
+
verify(rawBody: string, signatureHeader: string | null): Promise<IssueWebhookVerifyResultType>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* GitHub App 仓库内容网关(形态 B:构造时绑定 auth/config)。
|
|
57
|
+
*/
|
|
58
|
+
declare class GithubAppRepoContentGateway implements IssueForgeRepoContentInterface {
|
|
59
|
+
protected readonly client: GithubAppClient;
|
|
60
|
+
protected readonly config: GithubAppAuthConfigType;
|
|
61
|
+
constructor(client: GithubAppClient, config: GithubAppAuthConfigType);
|
|
62
|
+
/**
|
|
63
|
+
* @override
|
|
64
|
+
*/
|
|
65
|
+
readTextFile(path: string): Promise<string | null>;
|
|
66
|
+
/**
|
|
67
|
+
* @override
|
|
68
|
+
*/
|
|
69
|
+
hasFile(path: string, branch: string): Promise<boolean>;
|
|
70
|
+
/**
|
|
71
|
+
* @override
|
|
72
|
+
*/
|
|
73
|
+
ensureBranch(branch: string, initialFile: IssueForgeRepoFileType): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* @override
|
|
76
|
+
*/
|
|
77
|
+
uploadFile(input: IssueForgeRepoFileUploadInputType): Promise<IssueForgeRepoFileUploadedType>;
|
|
78
|
+
protected readExisting(input: IssueForgeRepoFileUploadInputType): Promise<IssueForgeRepoFileUploadedType>;
|
|
79
|
+
protected postForSha(stage: string, path: string, body: unknown): Promise<string>;
|
|
80
|
+
protected requireHtmlUrl(value: unknown, response: Response): string;
|
|
81
|
+
protected contentsPath(path: string): string;
|
|
82
|
+
protected encodePath(path: string): string;
|
|
83
|
+
protected repoPath(): string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* GitHub App Issue 网关(形态 B:构造时绑定 auth/config)。
|
|
88
|
+
*/
|
|
89
|
+
declare class GithubAppIssueForgeGateway implements IssueForgeGatewayInterface {
|
|
90
|
+
protected readonly client: GithubAppClient;
|
|
91
|
+
protected readonly config: GithubAppAuthConfigType;
|
|
92
|
+
protected readonly assets: GithubAppRepoContentGateway;
|
|
93
|
+
constructor(client: GithubAppClient, config: GithubAppAuthConfigType);
|
|
94
|
+
/**
|
|
95
|
+
* @override
|
|
96
|
+
*/
|
|
97
|
+
createIssue(input: ForgeIssueCreateInputType): Promise<ForgeIssueCreatedType>;
|
|
98
|
+
/**
|
|
99
|
+
* @override
|
|
100
|
+
*/
|
|
101
|
+
createComment(issue: ForgeIssueRefType, body: string): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* @override
|
|
104
|
+
*/
|
|
105
|
+
listComments(issue: ForgeIssueRefType): Promise<readonly ForgeIssueCommentType[]>;
|
|
106
|
+
/**
|
|
107
|
+
* @override
|
|
108
|
+
*/
|
|
109
|
+
uploadAsset(input: ForgeAssetUploadInputType): Promise<ForgeAssetUploadedType>;
|
|
110
|
+
protected postIssue(input: ForgeIssueCreateInputType, labels: readonly string[]): Promise<Response>;
|
|
111
|
+
protected readCreated(response: Response): Promise<ForgeIssueCreatedType>;
|
|
112
|
+
protected repoPath(): string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* GitHub Webhook HMAC-SHA256 验签(形态 B:构造时绑定 secret)。
|
|
117
|
+
*/
|
|
118
|
+
declare class GithubWebhookVerifier implements IssueWebhookVerifierInterface {
|
|
119
|
+
protected readonly secret: string;
|
|
120
|
+
constructor(secret: string);
|
|
121
|
+
/**
|
|
122
|
+
* @override
|
|
123
|
+
*/
|
|
124
|
+
verify(rawBody: string, signatureHeader: string | null): Promise<IssueWebhookVerifyResultType>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
type CreateGithubAppClientOptionsType = {
|
|
128
|
+
readonly cache: IssueForgeTokenCacheInterface;
|
|
129
|
+
readonly userAgent?: string;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* 创建可复用的 GitHub App HTTP 客户端(多仓可共用,按次传 config)。
|
|
133
|
+
*/
|
|
134
|
+
declare function createGithubAppClient(options: CreateGithubAppClientOptionsType): GithubAppClient;
|
|
135
|
+
/**
|
|
136
|
+
* 绑定 config 的 Issue 网关(形态 B)。
|
|
137
|
+
*/
|
|
138
|
+
declare function createGithubAppIssueForge(client: GithubAppClient, config: GithubAppAuthConfigType): IssueForgeGatewayInterface;
|
|
139
|
+
/**
|
|
140
|
+
* 绑定 config 的仓库内容网关(形态 B)。
|
|
141
|
+
*/
|
|
142
|
+
declare function createGithubAppRepoContent(client: GithubAppClient, config: GithubAppAuthConfigType): IssueForgeRepoContentInterface;
|
|
143
|
+
/**
|
|
144
|
+
* 绑定 webhook secret 的验签器(形态 B)。
|
|
145
|
+
*/
|
|
146
|
+
declare function createGithubWebhookVerifier(secret: string): IssueWebhookVerifierInterface;
|
|
147
|
+
|
|
148
|
+
export { type CreateGithubAppClientOptionsType, ForgeAssetUploadInputType, ForgeAssetUploadedType, type ForgeIssueCommentType, ForgeIssueCreateInputType, ForgeIssueCreatedType, ForgeIssueRefType, GithubAppAuthConfigType, GithubAppClient, GithubAppIssueForgeGateway, GithubAppRepoContentGateway, GithubWebhookVerifier, type IssueForgeGatewayInterface, type IssueForgeRepoContentInterface, type IssueForgeRepoFileType, type IssueForgeRepoFileUploadInputType, type IssueForgeRepoFileUploadedType, IssueForgeTokenCacheInterface, type IssueWebhookVerifierInterface, IssueWebhookVerifyResultType, createGithubAppClient, createGithubAppIssueForge, createGithubAppRepoContent, createGithubWebhookVerifier };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e,b as t,c as o,d as p,e as r,f as s,g as u,h as i,i as a}from"./chunk-MQ7IDBIZ.js";export{t as GithubAppClient,p as GithubAppIssueForgeGateway,o as GithubAppRepoContentGateway,r as GithubWebhookVerifier,e as IssueForgeError,s as createGithubAppClient,u as createGithubAppIssueForge,i as createGithubAppRepoContent,a as createGithubWebhookVerifier};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brain-toolkit/issue-forge",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": false,
|
|
6
|
+
"description": "Forge-agnostic Issue gateway + optional feedback→Issue sync engines; GitHub App first",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
"./package.json": "./package.json",
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"require": "./dist/index.cjs",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./feedback": {
|
|
19
|
+
"types": "./dist/feedback/index.d.ts",
|
|
20
|
+
"import": "./dist/feedback/index.js",
|
|
21
|
+
"require": "./dist/feedback/index.cjs",
|
|
22
|
+
"default": "./dist/feedback/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"package.json",
|
|
28
|
+
"README.md",
|
|
29
|
+
"CHANGELOG.md"
|
|
30
|
+
],
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+https://github.com/qlover/brain-toolkit.git",
|
|
34
|
+
"directory": "packages/issue-forge"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/qlover/brain-toolkit#readme",
|
|
37
|
+
"author": "qlover",
|
|
38
|
+
"license": "ISC",
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"jsonwebtoken": "^9.0.2"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/jsonwebtoken": "^9.0.10",
|
|
44
|
+
"tsup": "^8.4.0",
|
|
45
|
+
"vitest": "^3.2.4"
|
|
46
|
+
},
|
|
47
|
+
"keywords": [
|
|
48
|
+
"github-app",
|
|
49
|
+
"issue",
|
|
50
|
+
"forge",
|
|
51
|
+
"webhook",
|
|
52
|
+
"feedback"
|
|
53
|
+
],
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"access": "public"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "tsup",
|
|
59
|
+
"type-check": "tsc --build",
|
|
60
|
+
"test": "vitest run --config vitest.config.ts"
|
|
61
|
+
}
|
|
6
62
|
}
|