@cjhyy/code-shell-link 0.9.25 → 0.9.27
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/dist/catalog.js +13 -5
- package/dist/index.d.ts +1 -1
- package/dist/management-types.d.ts +97 -0
- package/package.json +1 -1
package/dist/catalog.js
CHANGED
|
@@ -27,7 +27,7 @@ export const LINK_PROVIDER_MANIFESTS = [
|
|
|
27
27
|
id: "github",
|
|
28
28
|
displayName: "GitHub",
|
|
29
29
|
category: "developer",
|
|
30
|
-
description: text("读取仓库、文件、Issue 和 Pull Request。", "Read repositories, files, issues, and pull requests."),
|
|
30
|
+
description: text("读取仓库、文件、Issue 和 Pull Request;可审批创建 Issue、设置当前账号的 Star。", "Read repositories, files, issues, and pull requests; approve issue creation and account Star changes."),
|
|
31
31
|
brandText: "GH",
|
|
32
32
|
icon: "github",
|
|
33
33
|
accent: "neutral",
|
|
@@ -37,26 +37,31 @@ export const LINK_PROVIDER_MANIFESTS = [
|
|
|
37
37
|
...localToken("fine-grained-pat", text("GitHub 登录 / Fine-grained PAT", "GitHub sign-in / fine-grained PAT"), "Fine-grained PAT", "github_pat_…", {
|
|
38
38
|
title: text("创建 Fine-grained PAT", "Create a fine-grained PAT"),
|
|
39
39
|
summary: text("适合只授权指定仓库;创建页面会预填当前 Link Actions 所需权限。", "Best for selected repositories; the creation page pre-fills permissions required by the current Link Actions."),
|
|
40
|
-
createCredentialUrl: "https://github.com/settings/personal-access-tokens/new?name=CodeShell+Link&description=Local+GitHub+connection+for+CodeShell&expires_in=90&contents=read&issues=write&pull_requests=read&metadata=read",
|
|
40
|
+
createCredentialUrl: "https://github.com/settings/personal-access-tokens/new?name=CodeShell+Link&description=Local+GitHub+connection+for+CodeShell&expires_in=90&contents=read&issues=write&pull_requests=read&metadata=read&starring=write",
|
|
41
41
|
docsUrl: "https://docs.github.com/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens",
|
|
42
42
|
permissions: [
|
|
43
43
|
{ id: "contents", label: "Contents: read", level: "required" },
|
|
44
44
|
{ id: "issues", label: "Issues: write", level: "required" },
|
|
45
45
|
{ id: "pull_requests", label: "Pull requests: read", level: "required" },
|
|
46
46
|
{ id: "metadata", label: "Metadata: read", level: "required" },
|
|
47
|
+
{
|
|
48
|
+
id: "starring",
|
|
49
|
+
label: "Starring: write (account; Star / Unstar)",
|
|
50
|
+
level: "required",
|
|
51
|
+
},
|
|
47
52
|
],
|
|
48
53
|
steps: [
|
|
49
54
|
text("选择资源所有者和允许 CodeShell 访问的仓库。", "Choose the resource owner and repositories CodeShell may access."),
|
|
50
55
|
text("确认预填权限,设置有效期并生成 Token。", "Review the pre-filled permissions, set an expiry, and generate the token."),
|
|
51
56
|
text("复制 Token,回到这里粘贴并验证。", "Copy the token, return here, and verify it."),
|
|
52
57
|
],
|
|
53
|
-
note: text("Token
|
|
58
|
+
note: text("Star / Unstar 另需账号级 Starring: write;这是修改当前账号收藏的权限。已有连接需明确重新连接,刷新不会扩大权限。Token 只显示一次。", "Star / Unstar needs account-level Starring: write, which modifies this account’s stars. Explicitly reconnect existing bindings; refreshing never expands grants. The token is shown once."),
|
|
54
59
|
}),
|
|
55
60
|
browserAuth: {
|
|
56
61
|
kind: "browser-oauth",
|
|
57
62
|
flow: "device-code",
|
|
58
63
|
displayName: text("在浏览器登录 GitHub", "Sign in to GitHub in your browser"),
|
|
59
|
-
summary: text("无需安装 gh。CodeShell
|
|
64
|
+
summary: text("无需安装 gh。CodeShell 显示一次性验证码;Star 功能还需 GitHub App 的 Starring 用户写权限及明确重新连接。", "No gh installation required. CodeShell shows a one-time code. Star actions additionally need GitHub App Starring user write permission and an explicit reconnect."),
|
|
60
65
|
docsUrl: "https://docs.github.com/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-user-access-token-for-a-github-app#using-the-device-flow-to-generate-a-user-access-token",
|
|
61
66
|
privacyNote: text("授权页由 GitHub 托管;密码不经过 CodeShell。授权结果仅加密保存在当前设备。", "GitHub hosts the authorization page, so your password never passes through CodeShell. The resulting credential is encrypted only on this device."),
|
|
62
67
|
},
|
|
@@ -64,7 +69,7 @@ export const LINK_PROVIDER_MANIFESTS = [
|
|
|
64
69
|
kind: "cli-session",
|
|
65
70
|
command: "gh",
|
|
66
71
|
displayName: text("使用 GitHub CLI 登录", "Sign in with GitHub CLI"),
|
|
67
|
-
summary: text("
|
|
72
|
+
summary: text("复用本机 GitHub CLI 会话,不复制或保存 Token。CLI Actions 只读;创建 Issue 和设置 Star 请明确连接 PAT、浏览器 OAuth 或远程 Link。", "Reuse this device’s GitHub CLI session without copying or storing its token. CLI Actions are read-only; explicitly connect PAT, browser OAuth or remote Link for issue creation and Star changes."),
|
|
68
73
|
installUrl: "https://cli.github.com/",
|
|
69
74
|
privacyNote: text("Link 仅保存一条本地绑定记录;每次 Action 都由 gh 执行。断开 Link 不会退出 gh。", "Link stores only a local binding; every Action runs through gh. Disconnecting Link does not sign gh out."),
|
|
70
75
|
},
|
|
@@ -73,6 +78,9 @@ export const LINK_PROVIDER_MANIFESTS = [
|
|
|
73
78
|
],
|
|
74
79
|
actionIds: [
|
|
75
80
|
"list_repositories",
|
|
81
|
+
"get_repository",
|
|
82
|
+
"get_starred",
|
|
83
|
+
"set_starred",
|
|
76
84
|
"get_readme",
|
|
77
85
|
"get_file",
|
|
78
86
|
"list_issues",
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { LINK_PROVIDER_MANIFESTS, getLinkProviderManifest, localizeLinkText } from "./catalog.js";
|
|
2
2
|
export type { LinkAuthGuide, LinkAuthKind, LinkConnectionMethodManifest, LinkCliSessionAuth, LinkExecutionRuntime, LinkLocalizedText, LinkMethodAvailability, LinkPermissionGuide, LinkPermissionLevel, LinkProviderAccent, LinkProviderCategory, LinkProviderIcon, LinkProviderManifest, LinkSecretLocation, } from "./types.js";
|
|
3
|
-
export type { LinkProviderView, LinkAuthorization, LinkConnectionInput, LinkErrorCode, LinkSnapshot, MaskedLinkConnection, TokenConnectionInput, } from "./management-types.js";
|
|
3
|
+
export type { LinkProviderView, LinkAuthMode, LinkAuthorization, LinkAuthorizationInput, LinkAuthorizationResponse, LinkAuthorizationStep, LinkCredentialFieldView, LinkResourceGroupView, LinkConnectionInput, LinkErrorCode, LinkSnapshot, MaskedLinkConnection, TokenConnectionInput, } from "./management-types.js";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { LinkProviderManifest } from "./types.js";
|
|
2
2
|
export type LinkProviderView = LinkProviderManifest & {
|
|
3
|
+
/** Host-verified capabilities, distinct from short-lived authorization steps. */
|
|
4
|
+
authModes?: LinkAuthMode[];
|
|
3
5
|
tokenLabel: string;
|
|
4
6
|
tokenPlaceholder: string;
|
|
5
7
|
actions: Array<{
|
|
@@ -15,6 +17,91 @@ export type LinkProviderView = LinkProviderManifest & {
|
|
|
15
17
|
configurationCode?: "client_id_missing";
|
|
16
18
|
};
|
|
17
19
|
};
|
|
20
|
+
export interface LinkAuthMode {
|
|
21
|
+
id: string;
|
|
22
|
+
methodId: string;
|
|
23
|
+
kind: "credential-input" | "local-session" | "device-code" | "redirect" | "qr-code";
|
|
24
|
+
label: string;
|
|
25
|
+
preferred?: boolean;
|
|
26
|
+
available: boolean;
|
|
27
|
+
unavailableReason?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface LinkCredentialFieldView {
|
|
30
|
+
id: string;
|
|
31
|
+
label: string;
|
|
32
|
+
secret: boolean;
|
|
33
|
+
required: boolean;
|
|
34
|
+
placeholder?: string;
|
|
35
|
+
maxLength?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface LinkResourceGroupView {
|
|
38
|
+
id: string;
|
|
39
|
+
label: string;
|
|
40
|
+
items: Array<{
|
|
41
|
+
id: string;
|
|
42
|
+
label: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
}>;
|
|
45
|
+
minSelected?: number;
|
|
46
|
+
maxSelected?: number;
|
|
47
|
+
truncated?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/** Only the current interaction is exposed; protocol credentials stay in their Host. */
|
|
50
|
+
export type LinkAuthorizationStep = {
|
|
51
|
+
id: string;
|
|
52
|
+
expiresAt: string;
|
|
53
|
+
} & ({
|
|
54
|
+
kind: "redirect";
|
|
55
|
+
authorizationUrl: string;
|
|
56
|
+
} | {
|
|
57
|
+
kind: "device-code";
|
|
58
|
+
userCode: string;
|
|
59
|
+
verificationUri: string;
|
|
60
|
+
verificationUriComplete?: string;
|
|
61
|
+
} | {
|
|
62
|
+
kind: "qr-code";
|
|
63
|
+
qr?: {
|
|
64
|
+
payload: string;
|
|
65
|
+
challengeExpiresAt: string;
|
|
66
|
+
instructions: string[];
|
|
67
|
+
};
|
|
68
|
+
phase: "awaiting-scan" | "awaiting-confirmation" | "expired";
|
|
69
|
+
canRefresh: boolean;
|
|
70
|
+
} | {
|
|
71
|
+
kind: "credential-input";
|
|
72
|
+
purpose: "credential" | "verification-code" | "second-factor";
|
|
73
|
+
fields: LinkCredentialFieldView[];
|
|
74
|
+
} | {
|
|
75
|
+
kind: "local-session";
|
|
76
|
+
session: {
|
|
77
|
+
installed: boolean;
|
|
78
|
+
authenticated: boolean;
|
|
79
|
+
account?: string;
|
|
80
|
+
message?: string;
|
|
81
|
+
canLogin?: boolean;
|
|
82
|
+
canInstall?: boolean;
|
|
83
|
+
};
|
|
84
|
+
} | {
|
|
85
|
+
kind: "consent";
|
|
86
|
+
account: {
|
|
87
|
+
id?: string;
|
|
88
|
+
label: string;
|
|
89
|
+
};
|
|
90
|
+
permissions: Array<{
|
|
91
|
+
id: string;
|
|
92
|
+
label: string;
|
|
93
|
+
description?: string;
|
|
94
|
+
required?: boolean;
|
|
95
|
+
}>;
|
|
96
|
+
resourceGroups: LinkResourceGroupView[];
|
|
97
|
+
} | {
|
|
98
|
+
kind: "processing";
|
|
99
|
+
});
|
|
100
|
+
export interface LinkAuthorizationResponse {
|
|
101
|
+
stepId: string;
|
|
102
|
+
operation: "submit" | "detect-session" | "login-session" | "bind-session" | "confirm" | "refresh-qr";
|
|
103
|
+
input?: Record<string, string | string[] | boolean>;
|
|
104
|
+
}
|
|
18
105
|
export interface MaskedLinkConnection {
|
|
19
106
|
id: string;
|
|
20
107
|
providerId: string;
|
|
@@ -43,6 +130,9 @@ export interface LinkSnapshot {
|
|
|
43
130
|
cliBinding: boolean;
|
|
44
131
|
deviceAuth: boolean;
|
|
45
132
|
remoteAuth?: boolean;
|
|
133
|
+
authorizationSteps?: 1;
|
|
134
|
+
/** Same-origin launch tickets complete in the original owner without browser cookies. */
|
|
135
|
+
browserHandoff?: 1;
|
|
46
136
|
};
|
|
47
137
|
remoteServer?: {
|
|
48
138
|
issuer: string;
|
|
@@ -62,11 +152,18 @@ export interface LinkConnectionInput {
|
|
|
62
152
|
export interface TokenConnectionInput extends LinkConnectionInput {
|
|
63
153
|
token: string;
|
|
64
154
|
}
|
|
155
|
+
export interface LinkAuthorizationInput extends LinkConnectionInput {
|
|
156
|
+
authModeId: string;
|
|
157
|
+
}
|
|
65
158
|
export type LinkErrorCode = "invalid_request" | "login_required" | "not_found" | "read_only" | "conflict" | "busy" | "provider_rejected" | "cli_unavailable" | "authorization_failed" | "authorization_expired" | "cancelled" | "unavailable";
|
|
66
159
|
export interface LinkAuthorization {
|
|
67
160
|
id: string;
|
|
68
161
|
providerId: string;
|
|
69
162
|
state: "pending" | "connected" | "failed" | "cancelled";
|
|
163
|
+
methodId?: string;
|
|
164
|
+
authModeId?: string;
|
|
165
|
+
expiresAt?: string;
|
|
166
|
+
step?: LinkAuthorizationStep;
|
|
70
167
|
prompt?: {
|
|
71
168
|
userCode: string;
|
|
72
169
|
verificationUri: string;
|