dsh-git-branch-manage 1.0.7 → 1.0.8

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/lib/wire.d.ts CHANGED
@@ -57,6 +57,23 @@ export declare const ROUTE_COMMIT_FILES = "/plugin/git-worktree/commit-files";
57
57
  export declare const ROUTE_TAG = "/plugin/git-worktree/tag";
58
58
  /** POST ROUTE_PREFIX/tag-push — push ONE existing local tag to its remote. */
59
59
  export declare const ROUTE_TAG_PUSH = "/plugin/git-worktree/tag-push";
60
+ /** POST ROUTE_PREFIX/credentials — the global per-host credentials, secrets
61
+ * masked (the stored secret never leaves the host). */
62
+ export declare const ROUTE_CREDENTIALS = "/plugin/git-worktree/credentials";
63
+ /** POST ROUTE_PREFIX/credentials-save — create or update one host credential. */
64
+ export declare const ROUTE_CREDENTIALS_SAVE = "/plugin/git-worktree/credentials-save";
65
+ /** POST ROUTE_PREFIX/credentials-delete — forget one host credential. */
66
+ export declare const ROUTE_CREDENTIALS_DELETE = "/plugin/git-worktree/credentials-delete";
67
+ /** POST ROUTE_PREFIX/credentials-oauth-start — begin a browser sign-in for
68
+ * one host (GitHub device flow); answers the one-time user code. */
69
+ export declare const ROUTE_CREDENTIALS_OAUTH_START = "/plugin/git-worktree/credentials-oauth-start";
70
+ /** POST ROUTE_PREFIX/credentials-oauth-poll — poll a started browser sign-in;
71
+ * stores the token and answers the fresh masked list once the user approves. */
72
+ export declare const ROUTE_CREDENTIALS_OAUTH_POLL = "/plugin/git-worktree/credentials-oauth-poll";
73
+ /** POST ROUTE_PREFIX/remotes — the repository's configured remotes. */
74
+ export declare const ROUTE_REMOTES = "/plugin/git-worktree/remotes";
75
+ /** POST ROUTE_PREFIX/remote — add, re-point or remove ONE remote. */
76
+ export declare const ROUTE_REMOTE = "/plugin/git-worktree/remote";
60
77
  /** POST ROUTE_PREFIX/ai-commit-message — one-shot LLM commit message from
61
78
  * the staged diff (mounted only where the host provides the llm service). */
62
79
  export declare const ROUTE_AI_COMMIT_MESSAGE = "/plugin/git-worktree/ai-commit-message";
@@ -570,3 +587,118 @@ export interface AiCommitMessageResult {
570
587
  /** The generated commit message (subject, optionally followed by a body). */
571
588
  message: string;
572
589
  }
590
+ /** Hosts whose browser sign-in the credential dialog offers. Mirrors the
591
+ * host-side device-flow support (`src/oauth.ts`); a shared constant keeps the
592
+ * browser list from drifting away from what the host can actually do. */
593
+ export declare const BROWSER_SIGN_IN_HOSTS: readonly string[];
594
+ /** How a stored credential's secret is meant to be used. */
595
+ export type CredentialMethod = 'token' | 'password';
596
+ /** One credential row as the browser sees it: the secret is masked. */
597
+ export interface CredentialEntryView {
598
+ /** Normalized remote host the credential belongs to. */
599
+ host: string;
600
+ username: string;
601
+ method: CredentialMethod;
602
+ /** Epoch millis of the last save. */
603
+ updatedAt: number;
604
+ /** Masked tail (`****abcd`) — never the secret itself. */
605
+ secretMask: string;
606
+ }
607
+ /** POST credentials response body. */
608
+ export interface CredentialsResult {
609
+ credentials: CredentialEntryView[];
610
+ }
611
+ /** POST credentials-save request body. */
612
+ export interface CredentialSaveBody {
613
+ /** Remote host, bare or pasted as a full remote URL (normalized host-side). */
614
+ host: string;
615
+ username: string;
616
+ method: CredentialMethod;
617
+ /** Token or password. Omitted/blank on an EXISTING host keeps the stored
618
+ * secret; a new host requires it. */
619
+ secret?: string;
620
+ }
621
+ /** POST credentials-save response body: the updated masked list. */
622
+ export type CredentialSaveResult = CredentialsResult;
623
+ /** POST credentials-delete request body. */
624
+ export interface CredentialDeleteBody {
625
+ host: string;
626
+ }
627
+ /** POST credentials-delete response body: the updated masked list. */
628
+ export type CredentialDeleteResult = CredentialsResult;
629
+ /** POST credentials-oauth-start request body. */
630
+ export interface CredentialOAuthStartBody {
631
+ /** Remote host whose browser sign-in to start (must support device flow). */
632
+ host: string;
633
+ }
634
+ /** POST credentials-oauth-start response body: what the dialog shows/opens. */
635
+ export interface CredentialOAuthStartResult {
636
+ /** The short code to type on the verification page. */
637
+ userCode: string;
638
+ /** Verification page without the code. */
639
+ verificationUri: string;
640
+ /** Verification page with the code pre-filled, when the host returns one. */
641
+ verificationUriComplete?: string;
642
+ /** Polling credential for {@link CredentialOAuthPollBody}. */
643
+ deviceCode: string;
644
+ /** Minimum seconds between polls. */
645
+ intervalSeconds: number;
646
+ /** Seconds until the grant expires. */
647
+ expiresInSeconds: number;
648
+ }
649
+ /** POST credentials-oauth-poll request body. */
650
+ export interface CredentialOAuthPollBody {
651
+ /** The host whose sign-in is being polled. */
652
+ host: string;
653
+ /** The grant's `deviceCode` from the start call. */
654
+ deviceCode: string;
655
+ }
656
+ /** POST credentials-oauth-poll response body: still waiting, or the fresh list
657
+ * once the token was stored (the token itself never crosses the wire). */
658
+ export type CredentialOAuthPollResult = {
659
+ status: 'pending';
660
+ }
661
+ /** GitHub asked the client to back off; the dialog doubles its interval. */
662
+ | {
663
+ status: 'slow_down';
664
+ }
665
+ /** The endpoint was unreachable for this poll; the grant is still valid, so
666
+ * the dialog keeps polling and only gives up after repeated failures. */
667
+ | {
668
+ status: 'network';
669
+ message: string;
670
+ } | {
671
+ status: 'done';
672
+ credentials: CredentialEntryView[];
673
+ };
674
+ /** One configured remote. */
675
+ export interface RemoteEntry {
676
+ name: string;
677
+ /** URL `git fetch` uses. */
678
+ fetchUrl: string;
679
+ /** URL `git push` uses (equals fetchUrl unless a push URL is set apart). */
680
+ pushUrl: string;
681
+ }
682
+ /** POST remotes response body. */
683
+ export interface RemotesResult {
684
+ remotes: RemoteEntry[];
685
+ }
686
+ /** POST remotes request body. */
687
+ export interface RemotesBody {
688
+ /** Any directory inside the repository (remotes are repository-wide). */
689
+ repoPath: string;
690
+ }
691
+ /** The mutation one /remote call performs. */
692
+ export type RemoteAction = 'add' | 'set-url' | 'remove';
693
+ /** POST remote request body. */
694
+ export interface RemoteMutationBody {
695
+ /** Any directory inside the repository (remotes are repository-wide). */
696
+ repoPath: string;
697
+ action: RemoteAction;
698
+ /** The remote name (validated host-side). */
699
+ name: string;
700
+ /** The new URL; required for `add` and `set-url`, absent for `remove`. */
701
+ url?: string;
702
+ }
703
+ /** POST remote response body: the repository's remotes after the change. */
704
+ export type RemoteMutationResult = RemotesResult;
package/lib/wire.js CHANGED
@@ -57,6 +57,23 @@ export const ROUTE_COMMIT_FILES = `${ROUTE_PREFIX}/commit-files`;
57
57
  export const ROUTE_TAG = `${ROUTE_PREFIX}/tag`;
58
58
  /** POST ROUTE_PREFIX/tag-push — push ONE existing local tag to its remote. */
59
59
  export const ROUTE_TAG_PUSH = `${ROUTE_PREFIX}/tag-push`;
60
+ /** POST ROUTE_PREFIX/credentials — the global per-host credentials, secrets
61
+ * masked (the stored secret never leaves the host). */
62
+ export const ROUTE_CREDENTIALS = `${ROUTE_PREFIX}/credentials`;
63
+ /** POST ROUTE_PREFIX/credentials-save — create or update one host credential. */
64
+ export const ROUTE_CREDENTIALS_SAVE = `${ROUTE_PREFIX}/credentials-save`;
65
+ /** POST ROUTE_PREFIX/credentials-delete — forget one host credential. */
66
+ export const ROUTE_CREDENTIALS_DELETE = `${ROUTE_PREFIX}/credentials-delete`;
67
+ /** POST ROUTE_PREFIX/credentials-oauth-start — begin a browser sign-in for
68
+ * one host (GitHub device flow); answers the one-time user code. */
69
+ export const ROUTE_CREDENTIALS_OAUTH_START = `${ROUTE_PREFIX}/credentials-oauth-start`;
70
+ /** POST ROUTE_PREFIX/credentials-oauth-poll — poll a started browser sign-in;
71
+ * stores the token and answers the fresh masked list once the user approves. */
72
+ export const ROUTE_CREDENTIALS_OAUTH_POLL = `${ROUTE_PREFIX}/credentials-oauth-poll`;
73
+ /** POST ROUTE_PREFIX/remotes — the repository's configured remotes. */
74
+ export const ROUTE_REMOTES = `${ROUTE_PREFIX}/remotes`;
75
+ /** POST ROUTE_PREFIX/remote — add, re-point or remove ONE remote. */
76
+ export const ROUTE_REMOTE = `${ROUTE_PREFIX}/remote`;
60
77
  /** POST ROUTE_PREFIX/ai-commit-message — one-shot LLM commit message from
61
78
  * the staged diff (mounted only where the host provides the llm service). */
62
79
  export const ROUTE_AI_COMMIT_MESSAGE = `${ROUTE_PREFIX}/ai-commit-message`;
@@ -64,3 +81,7 @@ export const ROUTE_AI_COMMIT_MESSAGE = `${ROUTE_PREFIX}/ai-commit-message`;
64
81
  * bodies and the client caps its input at the same value, so the two ends
65
82
  * can never disagree. */
66
83
  export const COMMIT_MESSAGE_LIMIT = 2000;
84
+ /** Hosts whose browser sign-in the credential dialog offers. Mirrors the
85
+ * host-side device-flow support (`src/oauth.ts`); a shared constant keeps the
86
+ * browser list from drifting away from what the host can actually do. */
87
+ export const BROWSER_SIGN_IN_HOSTS = ['github.com'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-git-branch-manage",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "提供 git 分支与 worktree 管理:输入框工具栏显示当前分支、可原地切换;支持 IDEA 风格分支选择器、远程分支检出、右键操作菜单(新建/重命名/删除/复制)、推送与更新当前分支,以及把分支隔离到独立 worktree 工作区,并管理其创建与删除。",
5
5
  "keywords": [
6
6
  "dsh",