@smwb/onreel-git-mcp 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.md +87 -1
- package/dist/git/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.js +3 -3
- package/dist/tracker/github-pull.lib.d.ts +2 -0
- package/dist/tracker/gitlab-pull.lib.d.ts +2 -0
- package/dist/tracker/index.d.ts +6 -0
- package/dist/tracker/index.js +713 -57
- package/dist/tracker/index.js.map +1 -1
- package/dist/tracker/mapping.const.d.ts +9 -0
- package/dist/tracker/pull.lib.d.ts +4 -0
- package/dist/tracker/pull.schema.d.ts +63 -0
- package/dist/tracker/pull.types.d.ts +74 -0
- package/dist/tracker/sourcecraft-pull.lib.d.ts +2 -0
- package/dist/tracker/tracker.types.d.ts +3 -0
- package/dist/worktree/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IssuePriority, IssueStatusCategory } from '../contract/contract.types.ts';
|
|
2
|
+
import type { PullRequestStatusCategory } from './pull.schema.ts';
|
|
2
3
|
/** SourceCraft: системные статусы. На паузе — ещё не закончено, но и не в работе: `open`. */
|
|
3
4
|
export declare const SOURCECRAFT_STATUSES: Readonly<Record<string, IssueStatusCategory>>;
|
|
4
5
|
/** Категория → слаг статуса SourceCraft при переводе задачи. */
|
|
@@ -26,3 +27,11 @@ export declare const GITHUB_IN_PROGRESS_LABEL = "in progress";
|
|
|
26
27
|
/** Метки GitHub для приоритета: `priority: <имя>`. */
|
|
27
28
|
export declare const GITHUB_PRIORITY_LABELS: Readonly<Record<string, IssuePriority>>;
|
|
28
29
|
export declare const ALL_STATUSES: readonly IssueStatusCategory[];
|
|
30
|
+
/** GitLab: state MR → категория; черновик — поле draft открытого MR. locked — слияние идёт, MR ещё открыт. */
|
|
31
|
+
export declare const GITLAB_MERGE_REQUEST_STATES: Readonly<Record<string, PullRequestStatusCategory>>;
|
|
32
|
+
/** GitLab: префикс заголовка, которым адаптер делает MR черновиком. */
|
|
33
|
+
export declare const GITLAB_DRAFT_PREFIX = "Draft: ";
|
|
34
|
+
/** GitLab: все формы префикса черновика, которые снимаются при переводе в open. */
|
|
35
|
+
export declare const GITLAB_DRAFT_PATTERN: RegExp;
|
|
36
|
+
/** SourceCraft: состояния PR. merging — слияние идёт, PR ещё открыт; discarded — закрыт без слияния. */
|
|
37
|
+
export declare const SOURCECRAFT_PULL_STATUSES: Readonly<Record<string, PullRequestStatusCategory>>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PullRequestAdapter } from './pull.types.ts';
|
|
2
|
+
import type { AdapterContext, TrackerDefinition } from './tracker.types.ts';
|
|
3
|
+
/** Адаптер PR трекера (D-005); трекер без раздела pulls — TrackerError('unsupported', 'Трекер <title> не ведёт pull request-ы.'). */
|
|
4
|
+
export declare function pullRequestAdapterOf(definition: TrackerDefinition, context: AdapterContext): PullRequestAdapter;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Категория состояния PR единой модели (D-005); своё имя трекер отдаёт в status.name. */
|
|
3
|
+
export declare const pullRequestStatusCategorySchema: z.ZodEnum<{
|
|
4
|
+
closed: "closed";
|
|
5
|
+
draft: "draft";
|
|
6
|
+
merged: "merged";
|
|
7
|
+
open: "open";
|
|
8
|
+
}>;
|
|
9
|
+
export declare const pullRequestFilterSchema: z.ZodEnum<{
|
|
10
|
+
author: "author";
|
|
11
|
+
createdAfter: "createdAfter";
|
|
12
|
+
createdBefore: "createdBefore";
|
|
13
|
+
labels: "labels";
|
|
14
|
+
search: "search";
|
|
15
|
+
source: "source";
|
|
16
|
+
status: "status";
|
|
17
|
+
target: "target";
|
|
18
|
+
updatedAfter: "updatedAfter";
|
|
19
|
+
updatedBefore: "updatedBefore";
|
|
20
|
+
}>;
|
|
21
|
+
export declare const pullRequestSortFieldSchema: z.ZodEnum<{
|
|
22
|
+
created: "created";
|
|
23
|
+
title: "title";
|
|
24
|
+
updated: "updated";
|
|
25
|
+
}>;
|
|
26
|
+
export declare const mergeMethodSchema: z.ZodEnum<{
|
|
27
|
+
merge: "merge";
|
|
28
|
+
rebase: "rebase";
|
|
29
|
+
squash: "squash";
|
|
30
|
+
}>;
|
|
31
|
+
export declare const pullRequestSchema: z.ZodObject<{
|
|
32
|
+
key: z.ZodString;
|
|
33
|
+
title: z.ZodString;
|
|
34
|
+
description: z.ZodOptional<z.ZodString>;
|
|
35
|
+
status: z.ZodObject<{
|
|
36
|
+
category: z.ZodEnum<{
|
|
37
|
+
closed: "closed";
|
|
38
|
+
draft: "draft";
|
|
39
|
+
merged: "merged";
|
|
40
|
+
open: "open";
|
|
41
|
+
}>;
|
|
42
|
+
name: z.ZodString;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
author: z.ZodOptional<z.ZodString>;
|
|
45
|
+
source: z.ZodString;
|
|
46
|
+
target: z.ZodString;
|
|
47
|
+
headSha: z.ZodOptional<z.ZodString>;
|
|
48
|
+
labels: z.ZodArray<z.ZodString>;
|
|
49
|
+
reviewers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
50
|
+
links: z.ZodArray<z.ZodObject<{
|
|
51
|
+
url: z.ZodString;
|
|
52
|
+
title: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, z.core.$strip>>;
|
|
54
|
+
createdAt: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
updatedAt: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
mergedAt: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
closedAt: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
export type PullRequestStatusCategory = z.infer<typeof pullRequestStatusCategorySchema>;
|
|
60
|
+
export type PullRequestFilter = z.infer<typeof pullRequestFilterSchema>;
|
|
61
|
+
export type PullRequestSortField = z.infer<typeof pullRequestSortFieldSchema>;
|
|
62
|
+
export type MergeMethod = z.infer<typeof mergeMethodSchema>;
|
|
63
|
+
export type PullRequest = z.infer<typeof pullRequestSchema>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { IssueComment } from '../contract/contract.types.ts';
|
|
2
|
+
import type { MergeMethod, PullRequest, PullRequestFilter, PullRequestSortField, PullRequestStatusCategory } from './pull.schema.ts';
|
|
3
|
+
import type { AdapterContext, CommentCapabilities, CommentQuery, ListCapabilities, ListSort, PageQuery, TrackerPage } from './tracker.types.ts';
|
|
4
|
+
export type PullRequestQuery = PageQuery & {
|
|
5
|
+
status?: readonly PullRequestStatusCategory[] | undefined;
|
|
6
|
+
author?: string | undefined;
|
|
7
|
+
/** Ветка-источник и целевая ветка — имя без refs/heads/. */
|
|
8
|
+
source?: string | undefined;
|
|
9
|
+
target?: string | undefined;
|
|
10
|
+
labels?: readonly string[] | undefined;
|
|
11
|
+
search?: string | undefined;
|
|
12
|
+
createdAfter?: number | undefined;
|
|
13
|
+
createdBefore?: number | undefined;
|
|
14
|
+
updatedAfter?: number | undefined;
|
|
15
|
+
updatedBefore?: number | undefined;
|
|
16
|
+
sort?: ListSort<PullRequestSortField> | undefined;
|
|
17
|
+
};
|
|
18
|
+
export type NewPullRequestInput = {
|
|
19
|
+
title: string;
|
|
20
|
+
source: string;
|
|
21
|
+
target: string;
|
|
22
|
+
description?: string | undefined;
|
|
23
|
+
/** Черновиком; по умолчанию — открытый PR. */
|
|
24
|
+
draft?: boolean | undefined;
|
|
25
|
+
};
|
|
26
|
+
export type PullRequestPatchInput = {
|
|
27
|
+
title?: string | undefined;
|
|
28
|
+
description?: string | undefined;
|
|
29
|
+
target?: string | undefined;
|
|
30
|
+
/** open — переоткрыть или снять черновик, draft — в черновик, closed — закрыть без слияния; merged — только merge(). */
|
|
31
|
+
status?: Exclude<PullRequestStatusCategory, 'merged'> | undefined;
|
|
32
|
+
};
|
|
33
|
+
export type MergeInput = {
|
|
34
|
+
/** Нет — способ по настройке репозитория; GitHub без неё шлёт merge, GitLab при 'merge' применяет squash-настройку MR/проекта. */
|
|
35
|
+
method?: MergeMethod | undefined;
|
|
36
|
+
/** Голова источника, которую видел вызывающий: другая — отказ conflict. GitHub и GitLab сверяют её сервером
|
|
37
|
+
* (атомарно, нужен полный sha); у SourceCraft сверка на клиенте — лучшее старание, push между чтением и
|
|
38
|
+
* слиянием ей не отсекается; штатный sha — полный, в нижнем регистре. */
|
|
39
|
+
headSha?: string | undefined;
|
|
40
|
+
/** Сообщение коммита слияния; первая строка — заголовок. */
|
|
41
|
+
message?: string | undefined;
|
|
42
|
+
/** Удалить ветку-источник после слияния. */
|
|
43
|
+
deleteSource?: boolean | undefined;
|
|
44
|
+
};
|
|
45
|
+
export type PullRequestAdapter = {
|
|
46
|
+
list(query: PullRequestQuery): Promise<TrackerPage<PullRequest>>;
|
|
47
|
+
get(key: string): Promise<PullRequest>;
|
|
48
|
+
create(input: NewPullRequestInput): Promise<PullRequest>;
|
|
49
|
+
update(key: string, patch: PullRequestPatchInput): Promise<PullRequest>;
|
|
50
|
+
/** Слияние; у SourceCraft асинхронное — вернётся PR с категорией open (status.name 'open' или 'merging') до
|
|
51
|
+
* завершения операции, либо уже merged; операция, отклонённая трекером (failed/cancel), — отказ conflict. */
|
|
52
|
+
merge(key: string, input: MergeInput): Promise<PullRequest>;
|
|
53
|
+
comments(key: string, query: CommentQuery): Promise<TrackerPage<IssueComment>>;
|
|
54
|
+
comment(key: string, body: string): Promise<IssueComment>;
|
|
55
|
+
};
|
|
56
|
+
export type PullRequestCapabilities = {
|
|
57
|
+
list: ListCapabilities<PullRequestFilter, PullRequestSortField>;
|
|
58
|
+
comments: CommentCapabilities;
|
|
59
|
+
create: boolean;
|
|
60
|
+
createDraft: boolean;
|
|
61
|
+
/** Поля, которые меняет update. */
|
|
62
|
+
update: readonly ('title' | 'description' | 'target')[];
|
|
63
|
+
/** Категории, в которые переводит update({ status }). */
|
|
64
|
+
statuses: readonly Exclude<PullRequestStatusCategory, 'merged'>[];
|
|
65
|
+
comment: boolean;
|
|
66
|
+
/** Способы слияния; пусто — merge не поддерживается. */
|
|
67
|
+
merge: readonly MergeMethod[];
|
|
68
|
+
deleteSourceOnMerge: boolean;
|
|
69
|
+
};
|
|
70
|
+
/** Раздел pulls определения трекера (D-005): на том же подключении, что и задачи. */
|
|
71
|
+
export type PullRequestDefinition = {
|
|
72
|
+
capabilities: PullRequestCapabilities;
|
|
73
|
+
create(context: AdapterContext): PullRequestAdapter;
|
|
74
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Issue, IssueComment, IssuePriority, IssueStatusCategory, TrackerDescriptor } from '../contract/contract.types.ts';
|
|
2
2
|
import type { LocalIssueStore } from '../kernel/store.types.ts';
|
|
3
|
+
import type { PullRequestDefinition } from './pull.types.ts';
|
|
3
4
|
import type { CommentFilter, IssueFilter, IssueSortField } from './tracker.const.ts';
|
|
4
5
|
export type TrackerFetch = (input: string, init?: {
|
|
5
6
|
method?: string;
|
|
@@ -113,6 +114,8 @@ export type TrackerDefinition = {
|
|
|
113
114
|
create(context: AdapterContext): TrackerAdapter;
|
|
114
115
|
/** Фильтры и сортировка задач и комментариев; нет — LEGACY_ISSUE_CAPABILITIES. */
|
|
115
116
|
issues?: IssueCapabilities | undefined;
|
|
117
|
+
/** Pull request-ы на том же подключении (D-005); нет — трекер их не ведёт. */
|
|
118
|
+
pulls?: PullRequestDefinition | undefined;
|
|
116
119
|
};
|
|
117
120
|
export type TrackerFailure = 'failed' | 'unknown_issue' | 'invalid_request' | 'not_found' | 'unsupported' | 'conflict' | 'rate_limited';
|
|
118
121
|
export type JsonRequest = {
|
package/dist/worktree/index.js
CHANGED
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
trashRoot
|
|
14
14
|
} from "../chunk-C6PHNSDC.js";
|
|
15
15
|
import "../chunk-3YP22YLA.js";
|
|
16
|
-
import "../chunk-4ZGRXIVA.js";
|
|
17
16
|
import "../chunk-L7CPE2SO.js";
|
|
17
|
+
import "../chunk-4ZGRXIVA.js";
|
|
18
18
|
|
|
19
19
|
// src/worktree/lifecycle.const.ts
|
|
20
20
|
var WORKTREE_RECONCILE_INTERVAL_MS = 3e4;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smwb/onreel-git-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Библиотека модулей, выделенных из onreel: git-операции и безопасные пути, список файлов worktree, жизненный цикл worktree против порта WorktreeStore, адаптеры трекеров GitHub/GitLab/Jira/SourceCraft/локального и MCP-сервер на stdio",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"git",
|