@pecot/workflow-mcp 0.0.0-stage → 5.0.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/.claude-plugin/plugin.json +8 -0
- package/LICENSE +21 -0
- package/README.md +126 -2
- package/bin/pecot-workflow-mcp.mjs +10 -0
- package/cli/dist/cli.d.ts +26 -0
- package/cli/dist/cli.js +222 -0
- package/cli/dist/commands/cell-table.d.ts +3 -0
- package/cli/dist/commands/cell-table.js +495 -0
- package/cli/dist/commands/command-binding.d.ts +26 -0
- package/cli/dist/commands/command-binding.js +266 -0
- package/cli/dist/commands/command-definition.d.ts +136 -0
- package/cli/dist/commands/command-definition.js +101 -0
- package/cli/dist/commands/command-help.d.ts +8 -0
- package/cli/dist/commands/command-help.js +173 -0
- package/cli/dist/commands/command-stop.d.ts +19 -0
- package/cli/dist/commands/command-stop.js +30 -0
- package/cli/dist/commands/dependabot.d.ts +3 -0
- package/cli/dist/commands/dependabot.js +165 -0
- package/cli/dist/commands/directory-option.d.ts +7 -0
- package/cli/dist/commands/directory-option.js +48 -0
- package/cli/dist/commands/failure.d.ts +13 -0
- package/cli/dist/commands/failure.js +33 -0
- package/cli/dist/commands/fuzzy.d.ts +7 -0
- package/cli/dist/commands/fuzzy.js +79 -0
- package/cli/dist/commands/github-client.d.ts +12 -0
- package/cli/dist/commands/github-client.js +23 -0
- package/cli/dist/commands/global-options.d.ts +25 -0
- package/cli/dist/commands/global-options.js +83 -0
- package/cli/dist/commands/help-layout.d.ts +40 -0
- package/cli/dist/commands/help-layout.js +117 -0
- package/cli/dist/commands/help.d.ts +8 -0
- package/cli/dist/commands/help.js +55 -0
- package/cli/dist/commands/input-schema.d.ts +14 -0
- package/cli/dist/commands/input-schema.js +56 -0
- package/cli/dist/commands/issue-board.d.ts +38 -0
- package/cli/dist/commands/issue-board.js +62 -0
- package/cli/dist/commands/issue-comment.d.ts +3 -0
- package/cli/dist/commands/issue-comment.js +196 -0
- package/cli/dist/commands/issue-create.d.ts +3 -0
- package/cli/dist/commands/issue-create.js +329 -0
- package/cli/dist/commands/issue-project.d.ts +3 -0
- package/cli/dist/commands/issue-project.js +176 -0
- package/cli/dist/commands/issue-quick.d.ts +3 -0
- package/cli/dist/commands/issue-quick.js +126 -0
- package/cli/dist/commands/issue-read.d.ts +3 -0
- package/cli/dist/commands/issue-read.js +80 -0
- package/cli/dist/commands/issue-shared.d.ts +159 -0
- package/cli/dist/commands/issue-shared.js +419 -0
- package/cli/dist/commands/issue.d.ts +4 -0
- package/cli/dist/commands/issue.js +15 -0
- package/cli/dist/commands/names.d.ts +9 -0
- package/cli/dist/commands/names.js +16 -0
- package/cli/dist/commands/output.d.ts +78 -0
- package/cli/dist/commands/output.js +187 -0
- package/cli/dist/commands/pr.d.ts +3 -0
- package/cli/dist/commands/pr.js +933 -0
- package/cli/dist/commands/project-info.d.ts +48 -0
- package/cli/dist/commands/project-info.js +181 -0
- package/cli/dist/commands/project-sync.d.ts +91 -0
- package/cli/dist/commands/project-sync.js +273 -0
- package/cli/dist/commands/project.d.ts +5 -0
- package/cli/dist/commands/project.js +677 -0
- package/cli/dist/commands/registry.d.ts +6 -0
- package/cli/dist/commands/registry.js +27 -0
- package/cli/dist/commands/release.d.ts +10 -0
- package/cli/dist/commands/release.js +414 -0
- package/cli/dist/commands/repository-display.d.ts +3 -0
- package/cli/dist/commands/repository-display.js +7 -0
- package/cli/dist/commands/repository-match.d.ts +14 -0
- package/cli/dist/commands/repository-match.js +33 -0
- package/cli/dist/commands/repository.d.ts +5 -0
- package/cli/dist/commands/repository.js +265 -0
- package/cli/dist/commands/rich-panel.d.ts +22 -0
- package/cli/dist/commands/rich-panel.js +295 -0
- package/cli/dist/commands/security.d.ts +3 -0
- package/cli/dist/commands/security.js +164 -0
- package/cli/dist/commands/session.d.ts +3 -0
- package/cli/dist/commands/session.js +161 -0
- package/cli/dist/commands/tracker-sync.d.ts +58 -0
- package/cli/dist/commands/tracker-sync.js +53 -0
- package/cli/dist/commands/usage-error.d.ts +47 -0
- package/cli/dist/commands/usage-error.js +72 -0
- package/cli/dist/commands/value-types.d.ts +46 -0
- package/cli/dist/commands/value-types.js +94 -0
- package/cli/dist/commands/work-target.d.ts +13 -0
- package/cli/dist/commands/work-target.js +41 -0
- package/cli/dist/commands/worktree.d.ts +3 -0
- package/cli/dist/commands/worktree.js +335 -0
- package/cli/dist/domain/api-error-detail.d.ts +10 -0
- package/cli/dist/domain/api-error-detail.js +25 -0
- package/cli/dist/domain/branch-name.d.ts +5 -0
- package/cli/dist/domain/branch-name.js +10 -0
- package/cli/dist/domain/changelog.d.ts +43 -0
- package/cli/dist/domain/changelog.js +107 -0
- package/cli/dist/domain/config.d.ts +215 -0
- package/cli/dist/domain/config.js +300 -0
- package/cli/dist/domain/dependabot-pull-requests.d.ts +82 -0
- package/cli/dist/domain/dependabot-pull-requests.js +338 -0
- package/cli/dist/domain/dependabot-source.d.ts +51 -0
- package/cli/dist/domain/dependabot-source.js +4 -0
- package/cli/dist/domain/dependabot.d.ts +47 -0
- package/cli/dist/domain/dependabot.js +88 -0
- package/cli/dist/domain/errors.d.ts +19 -0
- package/cli/dist/domain/errors.js +31 -0
- package/cli/dist/domain/field-options.d.ts +31 -0
- package/cli/dist/domain/field-options.js +44 -0
- package/cli/dist/domain/format.d.ts +47 -0
- package/cli/dist/domain/format.js +168 -0
- package/cli/dist/domain/frontmatter.d.ts +122 -0
- package/cli/dist/domain/frontmatter.js +264 -0
- package/cli/dist/domain/git-runner.d.ts +10 -0
- package/cli/dist/domain/git-runner.js +4 -0
- package/cli/dist/domain/git-url.d.ts +17 -0
- package/cli/dist/domain/git-url.js +30 -0
- package/cli/dist/domain/issue-kind.d.ts +16 -0
- package/cli/dist/domain/issue-kind.js +16 -0
- package/cli/dist/domain/issue-readout.d.ts +107 -0
- package/cli/dist/domain/issue-readout.js +4 -0
- package/cli/dist/domain/json-null.d.ts +2 -0
- package/cli/dist/domain/json-null.js +5 -0
- package/cli/dist/domain/json.d.ts +21 -0
- package/cli/dist/domain/json.js +47 -0
- package/cli/dist/domain/prerequisites.d.ts +32 -0
- package/cli/dist/domain/prerequisites.js +192 -0
- package/cli/dist/domain/pull-request.d.ts +134 -0
- package/cli/dist/domain/pull-request.js +232 -0
- package/cli/dist/domain/python-format.d.ts +105 -0
- package/cli/dist/domain/python-format.js +304 -0
- package/cli/dist/domain/readiness.d.ts +172 -0
- package/cli/dist/domain/readiness.js +280 -0
- package/cli/dist/domain/reference-parser.d.ts +49 -0
- package/cli/dist/domain/reference-parser.js +119 -0
- package/cli/dist/domain/release.d.ts +49 -0
- package/cli/dist/domain/release.js +72 -0
- package/cli/dist/domain/repository-policy.d.ts +32 -0
- package/cli/dist/domain/repository-policy.js +65 -0
- package/cli/dist/domain/repository-resolver.d.ts +57 -0
- package/cli/dist/domain/repository-resolver.js +119 -0
- package/cli/dist/domain/sections.d.ts +69 -0
- package/cli/dist/domain/sections.js +514 -0
- package/cli/dist/domain/security-alerts-source.d.ts +29 -0
- package/cli/dist/domain/security-alerts-source.js +4 -0
- package/cli/dist/domain/security-alerts.d.ts +52 -0
- package/cli/dist/domain/security-alerts.js +107 -0
- package/cli/dist/domain/security-tracker.d.ts +115 -0
- package/cli/dist/domain/security-tracker.js +353 -0
- package/cli/dist/domain/state.d.ts +29 -0
- package/cli/dist/domain/state.js +56 -0
- package/cli/dist/domain/tracker-body.d.ts +70 -0
- package/cli/dist/domain/tracker-body.js +65 -0
- package/cli/dist/domain/yaml-document.d.ts +5 -0
- package/cli/dist/domain/yaml-document.js +206 -0
- package/cli/dist/infra/authored-notes.d.ts +37 -0
- package/cli/dist/infra/authored-notes.js +66 -0
- package/cli/dist/infra/changelog-file.d.ts +19 -0
- package/cli/dist/infra/changelog-file.js +43 -0
- package/cli/dist/infra/child-stdin.d.ts +4 -0
- package/cli/dist/infra/child-stdin.js +8 -0
- package/cli/dist/infra/config-store.d.ts +49 -0
- package/cli/dist/infra/config-store.js +121 -0
- package/cli/dist/infra/diagnostics.d.ts +9 -0
- package/cli/dist/infra/diagnostics.js +2 -0
- package/cli/dist/infra/file-kind.d.ts +9 -0
- package/cli/dist/infra/file-kind.js +26 -0
- package/cli/dist/infra/frontmatter-file.d.ts +14 -0
- package/cli/dist/infra/frontmatter-file.js +30 -0
- package/cli/dist/infra/git.d.ts +74 -0
- package/cli/dist/infra/git.js +133 -0
- package/cli/dist/infra/github/auth.d.ts +60 -0
- package/cli/dist/infra/github/auth.js +158 -0
- package/cli/dist/infra/github/client.d.ts +173 -0
- package/cli/dist/infra/github/client.js +576 -0
- package/cli/dist/infra/github/dependabot-source.d.ts +13 -0
- package/cli/dist/infra/github/dependabot-source.js +33 -0
- package/cli/dist/infra/github/errors.d.ts +47 -0
- package/cli/dist/infra/github/errors.js +42 -0
- package/cli/dist/infra/github/index.d.ts +13 -0
- package/cli/dist/infra/github/index.js +19 -0
- package/cli/dist/infra/github/issues.d.ts +129 -0
- package/cli/dist/infra/github/issues.js +273 -0
- package/cli/dist/infra/github/payload.d.ts +44 -0
- package/cli/dist/infra/github/payload.js +80 -0
- package/cli/dist/infra/github/projects.d.ts +108 -0
- package/cli/dist/infra/github/projects.js +303 -0
- package/cli/dist/infra/github/pulls.d.ts +80 -0
- package/cli/dist/infra/github/pulls.js +161 -0
- package/cli/dist/infra/github/queries.d.ts +36 -0
- package/cli/dist/infra/github/queries.js +883 -0
- package/cli/dist/infra/github/readout.d.ts +18 -0
- package/cli/dist/infra/github/readout.js +156 -0
- package/cli/dist/infra/github/repos.d.ts +68 -0
- package/cli/dist/infra/github/repos.js +137 -0
- package/cli/dist/infra/github/rest-path.d.ts +14 -0
- package/cli/dist/infra/github/rest-path.js +31 -0
- package/cli/dist/infra/github/security-alerts-source.d.ts +15 -0
- package/cli/dist/infra/github/security-alerts-source.js +73 -0
- package/cli/dist/infra/gitignore-spec.d.ts +36 -0
- package/cli/dist/infra/gitignore-spec.js +235 -0
- package/cli/dist/infra/nx-scope.d.ts +51 -0
- package/cli/dist/infra/nx-scope.js +182 -0
- package/cli/dist/infra/os-error.d.ts +24 -0
- package/cli/dist/infra/os-error.js +38 -0
- package/cli/dist/infra/paths.d.ts +88 -0
- package/cli/dist/infra/paths.js +234 -0
- package/cli/dist/infra/state-store.d.ts +45 -0
- package/cli/dist/infra/state-store.js +118 -0
- package/cli/dist/infra/template-store.d.ts +15 -0
- package/cli/dist/infra/template-store.js +34 -0
- package/cli/dist/infra/text-file.d.ts +12 -0
- package/cli/dist/infra/text-file.js +33 -0
- package/cli/dist/infra/worktree-copy.d.ts +24 -0
- package/cli/dist/infra/worktree-copy.js +95 -0
- package/cli/dist/infra/worktree-links.d.ts +139 -0
- package/cli/dist/infra/worktree-links.js +433 -0
- package/cli/dist/infra/worktree-setup.d.ts +21 -0
- package/cli/dist/infra/worktree-setup.js +41 -0
- package/cli/dist/infra/worktree.d.ts +174 -0
- package/cli/dist/infra/worktree.js +567 -0
- package/cli/dist/mcp/result.d.ts +33 -0
- package/cli/dist/mcp/result.js +52 -0
- package/cli/dist/mcp/serve.d.ts +51 -0
- package/cli/dist/mcp/serve.js +183 -0
- package/cli/dist/mcp/server.d.ts +21 -0
- package/cli/dist/mcp/server.js +128 -0
- package/cli/dist/mcp/session-directory.d.ts +26 -0
- package/cli/dist/mcp/session-directory.js +84 -0
- package/cli/dist/package.json +1 -0
- package/cli/dist/version.d.ts +17 -0
- package/cli/dist/version.js +42 -0
- package/cli/templates/comment/merge-diff.md +34 -0
- package/cli/templates/comment/plan.md +181 -0
- package/cli/templates/comment/precede-notify.md +33 -0
- package/cli/templates/comment/review-findings.md +42 -0
- package/cli/templates/comment/review-resolution.md +48 -0
- package/cli/templates/issue/bug.md +63 -0
- package/cli/templates/issue/epic.md +54 -0
- package/cli/templates/issue/task-implement.md +67 -0
- package/cli/templates/issue/task.md +48 -0
- package/cli/templates/issue/tracker.md +48 -0
- package/cli/templates/pr/create.md +123 -0
- package/cli/templates/pr/release.md +56 -0
- package/hooks/lib/core/pecot-gitignore-ensure.sh +48 -0
- package/npm-shrinkwrap.json +83 -0
- package/package.json +22 -4
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { PecotError } from './errors.js';
|
|
2
|
+
import type { GitRunner } from './git-runner.js';
|
|
3
|
+
export interface RepositoryReference {
|
|
4
|
+
readonly owner: string;
|
|
5
|
+
readonly repository: string;
|
|
6
|
+
}
|
|
7
|
+
export type ResolveSource = 'explicit' | 'current-git';
|
|
8
|
+
/**
|
|
9
|
+
解決の結果。source が explicit のとき remoteName は undefined、current-git のとき remoteName は空でない文字列
|
|
10
|
+
*/
|
|
11
|
+
export interface ResolvedRepository {
|
|
12
|
+
readonly repository: RepositoryReference;
|
|
13
|
+
readonly source: ResolveSource;
|
|
14
|
+
readonly remoteName: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare class AmbiguousRepositoryError extends PecotError {
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
owner と repository の各セグメントを検証して作る。両方が不正なら 2 件を 1 つの例外にまとめる
|
|
20
|
+
*/
|
|
21
|
+
export declare function createRepositoryReference(owner: string, repository: string): RepositoryReference;
|
|
22
|
+
export declare function repositoryFullName(reference: RepositoryReference): string;
|
|
23
|
+
export declare function isSameRepository(left: RepositoryReference, right: RepositoryReference): boolean;
|
|
24
|
+
/**
|
|
25
|
+
`/` で分けてちょうど 2 つなら owner と repository を返し、違えば undefined。
|
|
26
|
+
中身は検証しない(`a/` や `/b` も通る)。検証は parseOwnerRepository の側
|
|
27
|
+
*/
|
|
28
|
+
export declare function splitOwnerRepository(raw: string): {
|
|
29
|
+
readonly owner: string;
|
|
30
|
+
readonly repository: string;
|
|
31
|
+
} | undefined;
|
|
32
|
+
/**
|
|
33
|
+
`owner/repo` 形式の文字列を分ける。形式が違えば InvalidValueError
|
|
34
|
+
*/
|
|
35
|
+
export declare function parseOwnerRepository(raw: string): RepositoryReference;
|
|
36
|
+
/**
|
|
37
|
+
source と remoteName の整合を検証して作る
|
|
38
|
+
*/
|
|
39
|
+
export declare function createResolvedRepository(resolved: ResolvedRepository): ResolvedRepository;
|
|
40
|
+
/**
|
|
41
|
+
remote 名の一覧から主の remote を選ぶ(origin、無ければ最初)。一覧が空なら undefined
|
|
42
|
+
*/
|
|
43
|
+
export declare function pickPrimaryRemote(remotes: readonly string[]): string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
現在の git の remote からリポジトリを取り出す。git の外・remote 無しは undefined。
|
|
46
|
+
URL の形式が不正なときは、InvalidValueError をそのまま伝える(バグ扱い)。
|
|
47
|
+
Python の `_detect_current_git_repo` と同じで、不正なら undefined を返す infra/git.ts の remoteRepository とは契約が違う
|
|
48
|
+
*/
|
|
49
|
+
export declare function detectCurrentGitRepository(git: GitRunner): {
|
|
50
|
+
readonly repository: RepositoryReference;
|
|
51
|
+
readonly remoteName: string;
|
|
52
|
+
} | undefined;
|
|
53
|
+
/**
|
|
54
|
+
リポジトリを解決する。明示値があれば git を呼ばずにそれを使う
|
|
55
|
+
*/
|
|
56
|
+
export declare function resolveRepository(explicit: string | undefined, git: GitRunner): ResolvedRepository;
|
|
57
|
+
//# sourceMappingURL=repository-resolver.d.ts.map
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// マルチリポ対応のリポジトリ解決。
|
|
2
|
+
//
|
|
3
|
+
// 決定木:
|
|
4
|
+
// 1. 明示値(--repo)があれば、それを owner/repo として使う(source=explicit)。
|
|
5
|
+
// 2. git のワークツリー内なら、origin の URL から取る(source=current-git)。
|
|
6
|
+
// origin が無ければ、先頭の remote を使う。
|
|
7
|
+
// 3. どちらも成り立たなければ、AmbiguousRepositoryError を投げる。
|
|
8
|
+
//
|
|
9
|
+
// 検証エラーの文は、Python の CLI の書式に揃える。
|
|
10
|
+
// 表題は元のクラス名(RepoRef・ResolvedRepo)を使う。
|
|
11
|
+
import { PecotError, InvalidValueError } from './errors.js';
|
|
12
|
+
import { parseRemoteUrl } from './git-url.js';
|
|
13
|
+
import { pythonStringRepr, ValidationFailure } from './python-format.js';
|
|
14
|
+
const SEGMENT_PATTERN = /^[\w.-]+$/u;
|
|
15
|
+
export class AmbiguousRepositoryError extends PecotError {
|
|
16
|
+
}
|
|
17
|
+
// `.` と `..` は、REST の URL に文字列で連結すると別のパスを指すので拒否する(Python は通していた)
|
|
18
|
+
function segmentIssue(field, value) {
|
|
19
|
+
if (value !== '.' && value !== '..' && SEGMENT_PATTERN.test(value))
|
|
20
|
+
return [];
|
|
21
|
+
return [{
|
|
22
|
+
type: 'value_error',
|
|
23
|
+
location: [field],
|
|
24
|
+
message: `Value error, invalid owner/repo segment: ${pythonStringRepr(value)} (allowed: [A-Za-z0-9_.-]+)`,
|
|
25
|
+
input: value,
|
|
26
|
+
}];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
owner と repository の各セグメントを検証して作る。両方が不正なら 2 件を 1 つの例外にまとめる
|
|
30
|
+
*/
|
|
31
|
+
export function createRepositoryReference(owner, repository) {
|
|
32
|
+
const issues = [...segmentIssue('owner', owner), ...segmentIssue('repo', repository)];
|
|
33
|
+
if (issues.length > 0)
|
|
34
|
+
throw new ValidationFailure('RepoRef', issues);
|
|
35
|
+
return Object.freeze({ owner, repository });
|
|
36
|
+
}
|
|
37
|
+
export function repositoryFullName(reference) {
|
|
38
|
+
return `${reference.owner}/${reference.repository}`;
|
|
39
|
+
}
|
|
40
|
+
export function isSameRepository(left, right) {
|
|
41
|
+
return repositoryFullName(left).toLowerCase() === repositoryFullName(right).toLowerCase();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
`/` で分けてちょうど 2 つなら owner と repository を返し、違えば undefined。
|
|
45
|
+
中身は検証しない(`a/` や `/b` も通る)。検証は parseOwnerRepository の側
|
|
46
|
+
*/
|
|
47
|
+
export function splitOwnerRepository(raw) {
|
|
48
|
+
const [owner, repository, ...rest] = raw.split('/');
|
|
49
|
+
return owner === undefined || repository === undefined || rest.length > 0 ? undefined : { owner, repository };
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
`owner/repo` 形式の文字列を分ける。形式が違えば InvalidValueError
|
|
53
|
+
*/
|
|
54
|
+
export function parseOwnerRepository(raw) {
|
|
55
|
+
const parts = splitOwnerRepository(raw);
|
|
56
|
+
if (parts === undefined) {
|
|
57
|
+
throw new InvalidValueError(`invalid owner/repo form: ${pythonStringRepr(raw)} (expected: 'owner/repo')`);
|
|
58
|
+
}
|
|
59
|
+
return createRepositoryReference(parts.owner, parts.repository);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
source と remoteName の整合を検証して作る
|
|
63
|
+
*/
|
|
64
|
+
export function createResolvedRepository(resolved) {
|
|
65
|
+
const input = {
|
|
66
|
+
repo: { owner: resolved.repository.owner, repo: resolved.repository.repository },
|
|
67
|
+
source: resolved.source,
|
|
68
|
+
remote_name: resolved.remoteName ?? 'None',
|
|
69
|
+
};
|
|
70
|
+
if (resolved.source === 'current-git' && (resolved.remoteName === undefined || resolved.remoteName === '')) {
|
|
71
|
+
throw new ValidationFailure('ResolvedRepo', [{ type: 'value_error', location: [], message: 'Value error, remote_name is required when source=CURRENT_GIT', input }]);
|
|
72
|
+
}
|
|
73
|
+
if (resolved.source === 'explicit' && resolved.remoteName !== undefined) {
|
|
74
|
+
throw new ValidationFailure('ResolvedRepo', [{ type: 'value_error', location: [], message: 'Value error, remote_name must be None when source=EXPLICIT', input }]);
|
|
75
|
+
}
|
|
76
|
+
return Object.freeze({ ...resolved });
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
remote 名の一覧から主の remote を選ぶ(origin、無ければ最初)。一覧が空なら undefined
|
|
80
|
+
*/
|
|
81
|
+
export function pickPrimaryRemote(remotes) {
|
|
82
|
+
return remotes.includes('origin') ? 'origin' : remotes[0];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
現在の git の remote からリポジトリを取り出す。git の外・remote 無しは undefined。
|
|
86
|
+
URL の形式が不正なときは、InvalidValueError をそのまま伝える(バグ扱い)。
|
|
87
|
+
Python の `_detect_current_git_repo` と同じで、不正なら undefined を返す infra/git.ts の remoteRepository とは契約が違う
|
|
88
|
+
*/
|
|
89
|
+
export function detectCurrentGitRepository(git) {
|
|
90
|
+
const inside = git(['rev-parse', '--is-inside-work-tree']);
|
|
91
|
+
if (inside.exitCode !== 0 || inside.stdout.trim() !== 'true')
|
|
92
|
+
return undefined;
|
|
93
|
+
const remotesResult = git(['remote']);
|
|
94
|
+
if (remotesResult.exitCode !== 0)
|
|
95
|
+
return undefined;
|
|
96
|
+
const remotes = remotesResult.stdout.split('\n').map(line => line.trim()).filter(line => line !== '');
|
|
97
|
+
const remoteName = pickPrimaryRemote(remotes);
|
|
98
|
+
if (remoteName === undefined)
|
|
99
|
+
return undefined;
|
|
100
|
+
const url = git(['remote', 'get-url', remoteName]);
|
|
101
|
+
if (url.exitCode !== 0)
|
|
102
|
+
return undefined;
|
|
103
|
+
const { owner, repository } = parseRemoteUrl(url.stdout.trim());
|
|
104
|
+
return { repository: createRepositoryReference(owner, repository), remoteName };
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
リポジトリを解決する。明示値があれば git を呼ばずにそれを使う
|
|
108
|
+
*/
|
|
109
|
+
export function resolveRepository(explicit, git) {
|
|
110
|
+
if (explicit !== undefined) {
|
|
111
|
+
return createResolvedRepository({ repository: parseOwnerRepository(explicit), source: 'explicit', remoteName: undefined });
|
|
112
|
+
}
|
|
113
|
+
const detected = detectCurrentGitRepository(git);
|
|
114
|
+
if (detected !== undefined) {
|
|
115
|
+
return createResolvedRepository({ repository: detected.repository, source: 'current-git', remoteName: detected.remoteName });
|
|
116
|
+
}
|
|
117
|
+
throw new AmbiguousRepositoryError('repository is ambiguous: pass --repo <owner/repo>');
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=repository-resolver.js.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export interface SectionHeading {
|
|
2
|
+
readonly level: number;
|
|
3
|
+
/**
|
|
4
|
+
見出しの文字列。em-dash サマリ込み(例: `Progress — <現在地を1行で>`)
|
|
5
|
+
*/
|
|
6
|
+
readonly name: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const SUMMARY_MAX_CHARS = 50;
|
|
9
|
+
export declare const PLAN_FOLD_SUMMARY = "<summary align=\"right\">\u8A73\u7D30\u306F\u3053\u3061\u3089</summary>";
|
|
10
|
+
export declare const FOLD_SUMMARY_BY_TEMPLATE: ReadonlyMap<string, string>;
|
|
11
|
+
/**
|
|
12
|
+
テンプレに無い `##` / `###` 見出しを拒否するテンプレ名と、拒否したときに添える案内文。
|
|
13
|
+
テンプレごとに閉じた見出しの集合を持たせる。
|
|
14
|
+
Python の `issue.py` の `_report_template_violations` は、この Map にテンプレ名があるときだけ 2 つの検証を掛ける。
|
|
15
|
+
掛ける検証は validateFoldBalance と validateClosedHeadings。コマンドを移すときは同じ条件にする
|
|
16
|
+
*/
|
|
17
|
+
export declare const CLOSED_HEADINGS_BY_TEMPLATE: ReadonlyMap<string, string>;
|
|
18
|
+
export declare const CHECKBOX_ERROR = "checkbox syntax (- [ ] / 1. [ ]) is not allowed";
|
|
19
|
+
export declare const HORIZONTAL_RULE_ERROR = "horizontal rules are not allowed";
|
|
20
|
+
export declare const EMOJI_ERROR = "emoji are not allowed";
|
|
21
|
+
export declare const SOFT_BREAK_ERROR = "a paragraph is broken across lines: GitHub shows line breaks as written, so write each paragraph on one line and separate paragraphs with a blank line";
|
|
22
|
+
export declare const SUMMARY_NOT_JAPANESE_ERROR = "the summary must be written in Japanese";
|
|
23
|
+
export declare const SUMMARY_MULTI_SENTENCE_ERROR = "the summary must be one sentence";
|
|
24
|
+
/**
|
|
25
|
+
テンプレートの内容から見出しセクションを抽出する(レベル情報付き)。
|
|
26
|
+
フロントマター(先頭の `---` と次の `---` の間)と、その後ろの先頭の HTML コメント(書き方ガイド)は読み飛ばし、`##`〜`######` で始まる行を拾う
|
|
27
|
+
*/
|
|
28
|
+
export declare function extractSectionsFromTemplate(template: string): readonly SectionHeading[];
|
|
29
|
+
/**
|
|
30
|
+
必須セクションの存在を確認する(見出しレベルも検証)。不足している見出しの表記を返す(例: `### Done — <summary>`)。
|
|
31
|
+
em-dash 付きの見出しは「ベース名 + em-dash + サマリ」の形があるかだけを見る。
|
|
32
|
+
サマリの規則(文字数・日本語・1 文)は validateHeadingSummaries が、未編集の `<...>` の残存は validateBodyStyle が見る(#962)。
|
|
33
|
+
それ以外の見出しはセクション名の前方一致をチェックする
|
|
34
|
+
*/
|
|
35
|
+
export declare function validateSections(body: string, requiredSections: readonly SectionHeading[]): readonly string[];
|
|
36
|
+
/**
|
|
37
|
+
em-dash 見出しのサマリが規則を満たすか確認し、違反の表記を返す。
|
|
38
|
+
規則は文字数・日本語・1 文である
|
|
39
|
+
(例: `## Verified — the summary must be written in Japanese`)。
|
|
40
|
+
見出し自体が無いものは validateSections が不足として返すため、ここでは扱わない
|
|
41
|
+
*/
|
|
42
|
+
export declare function validateHeadingSummaries(body: string, requiredSections: readonly SectionHeading[]): readonly string[];
|
|
43
|
+
export declare function validateBodyStyle(body: string): readonly string[];
|
|
44
|
+
/**
|
|
45
|
+
折りたたみ(`<details>`)の開閉が対応しているかを判定する。
|
|
46
|
+
コードフェンス・インラインコード・HTML コメントの中の `<details>` は折りたたみとして扱わない。
|
|
47
|
+
閉じられていない開きタグ、開きの無い閉じタグをエラーにする。折りたたみの外の文字数は見ない。
|
|
48
|
+
未閉じのコードフェンスは空リストを返す(validateBodyStyle が別に出す)
|
|
49
|
+
*/
|
|
50
|
+
export declare function validateFoldBalance(body: string): readonly string[];
|
|
51
|
+
/**
|
|
52
|
+
テンプレに無い `##` / `###` 見出しが本文に無いかを判定する。
|
|
53
|
+
`(level, 名前)` の組で比べる。名前は em-dash の前の部分で、サマリは見ない。
|
|
54
|
+
コードフェンス・インラインコード・HTML コメントの中の見出しは対象外で、`<details>` の中の見出しは対象にする。
|
|
55
|
+
h1 と h4 以下は縛らない。テンプレに無い見出しの表記を返す(例: `## Context`)。同じ見出しは 1 回だけ返す
|
|
56
|
+
*/
|
|
57
|
+
export declare function validateClosedHeadings(body: string, requiredSections: readonly SectionHeading[]): readonly string[];
|
|
58
|
+
/**
|
|
59
|
+
折りたたみの開閉部分(`<summary>`)が全て expected の形かを判定する。
|
|
60
|
+
コードフェンス・インラインコード・HTML コメントの中の `<summary>` は対象外。
|
|
61
|
+
開きタグの位置から expected と一字一句一致するかを見るため、属性・文言・閉じタグのどれが違っても違反になる
|
|
62
|
+
*/
|
|
63
|
+
export declare function validateFoldSummaries(body: string, expected: string): readonly string[];
|
|
64
|
+
/**
|
|
65
|
+
Summary 節に画像の参照(Markdown 記法か `<img`)があるか。フェンス・インラインコード・HTML コメントの中は数えない。
|
|
66
|
+
記法は網羅しない。取りこぼしは screenshot の理由で避けられる
|
|
67
|
+
*/
|
|
68
|
+
export declare function hasSummaryImage(body: string): boolean;
|
|
69
|
+
//# sourceMappingURL=sections.d.ts.map
|