@pecot/workflow-mcp 0.0.0-stage → 6.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 +184 -2
- package/bin/pecot-workflow-mcp.mjs +10 -0
- package/cli/dist/cli.d.ts +26 -0
- package/cli/dist/cli.js +227 -0
- package/cli/dist/commands/board-add.d.ts +3 -0
- package/cli/dist/commands/board-add.js +59 -0
- package/cli/dist/commands/board-judgment.d.ts +60 -0
- package/cli/dist/commands/board-judgment.js +144 -0
- package/cli/dist/commands/board-move.d.ts +3 -0
- package/cli/dist/commands/board-move.js +57 -0
- package/cli/dist/commands/board-readiness.d.ts +34 -0
- package/cli/dist/commands/board-readiness.js +108 -0
- package/cli/dist/commands/board-show.d.ts +3 -0
- package/cli/dist/commands/board-show.js +72 -0
- package/cli/dist/commands/board-sync.d.ts +3 -0
- package/cli/dist/commands/board-sync.js +111 -0
- package/cli/dist/commands/board-view.d.ts +62 -0
- package/cli/dist/commands/board-view.js +191 -0
- package/cli/dist/commands/board.d.ts +3 -0
- package/cli/dist/commands/board.js +12 -0
- package/cli/dist/commands/branch.d.ts +3 -0
- package/cli/dist/commands/branch.js +100 -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 +270 -0
- package/cli/dist/commands/command-definition.d.ts +150 -0
- package/cli/dist/commands/command-definition.js +105 -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-hint.d.ts +5 -0
- package/cli/dist/commands/command-hint.js +13 -0
- package/cli/dist/commands/command-stop.d.ts +21 -0
- package/cli/dist/commands/command-stop.js +31 -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-kind.d.ts +3 -0
- package/cli/dist/commands/failure-kind.js +34 -0
- package/cli/dist/commands/failure.d.ts +19 -0
- package/cli/dist/commands/failure.js +59 -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 +16 -0
- package/cli/dist/commands/github-client.js +33 -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 +50 -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 +71 -0
- package/cli/dist/commands/issue-board.js +122 -0
- package/cli/dist/commands/issue-comment.d.ts +3 -0
- package/cli/dist/commands/issue-comment.js +215 -0
- package/cli/dist/commands/issue-create.d.ts +3 -0
- package/cli/dist/commands/issue-create.js +786 -0
- package/cli/dist/commands/issue-dependency.d.ts +3 -0
- package/cli/dist/commands/issue-dependency.js +282 -0
- package/cli/dist/commands/issue-readiness.d.ts +94 -0
- package/cli/dist/commands/issue-readiness.js +218 -0
- package/cli/dist/commands/issue-reopen.d.ts +3 -0
- package/cli/dist/commands/issue-reopen.js +115 -0
- package/cli/dist/commands/issue-shared.d.ts +172 -0
- package/cli/dist/commands/issue-shared.js +426 -0
- package/cli/dist/commands/issue-show.d.ts +3 -0
- package/cli/dist/commands/issue-show.js +169 -0
- package/cli/dist/commands/issue.d.ts +3 -0
- package/cli/dist/commands/issue.js +13 -0
- package/cli/dist/commands/names.d.ts +42 -0
- package/cli/dist/commands/names.js +78 -0
- package/cli/dist/commands/output.d.ts +90 -0
- package/cli/dist/commands/output.js +194 -0
- package/cli/dist/commands/pr-waiting.d.ts +20 -0
- package/cli/dist/commands/pr-waiting.js +106 -0
- package/cli/dist/commands/pr.d.ts +22 -0
- package/cli/dist/commands/pr.js +852 -0
- package/cli/dist/commands/project-sync.d.ts +92 -0
- package/cli/dist/commands/project-sync.js +282 -0
- package/cli/dist/commands/project.d.ts +6 -0
- package/cli/dist/commands/project.js +714 -0
- package/cli/dist/commands/registry.d.ts +6 -0
- package/cli/dist/commands/registry.js +30 -0
- package/cli/dist/commands/release.d.ts +10 -0
- package/cli/dist/commands/release.js +353 -0
- package/cli/dist/commands/renamed-commands.d.ts +26 -0
- package/cli/dist/commands/renamed-commands.js +53 -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 +34 -0
- package/cli/dist/commands/rich-panel.d.ts +22 -0
- package/cli/dist/commands/rich-panel.js +295 -0
- package/cli/dist/commands/session-finish.d.ts +3 -0
- package/cli/dist/commands/session-finish.js +267 -0
- package/cli/dist/commands/session-start.d.ts +3 -0
- package/cli/dist/commands/session-start.js +236 -0
- package/cli/dist/commands/session.d.ts +6 -0
- package/cli/dist/commands/session.js +214 -0
- package/cli/dist/commands/tracker-sync-dependabot.d.ts +7 -0
- package/cli/dist/commands/tracker-sync-dependabot.js +156 -0
- package/cli/dist/commands/tracker-sync-security.d.ts +7 -0
- package/cli/dist/commands/tracker-sync-security.js +153 -0
- package/cli/dist/commands/tracker-sync.d.ts +65 -0
- package/cli/dist/commands/tracker-sync.js +50 -0
- package/cli/dist/commands/tracker.d.ts +3 -0
- package/cli/dist/commands/tracker.js +18 -0
- package/cli/dist/commands/usage-error.d.ts +51 -0
- package/cli/dist/commands/usage-error.js +78 -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 +22 -0
- package/cli/dist/commands/work-target.js +82 -0
- package/cli/dist/commands/worktree.d.ts +3 -0
- package/cli/dist/commands/worktree.js +339 -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/batch-plan.d.ts +73 -0
- package/cli/dist/domain/batch-plan.js +114 -0
- package/cli/dist/domain/blocked-by-change.d.ts +99 -0
- package/cli/dist/domain/blocked-by-change.js +101 -0
- package/cli/dist/domain/board-move.d.ts +90 -0
- package/cli/dist/domain/board-move.js +92 -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/command-hint.d.ts +85 -0
- package/cli/dist/domain/command-hint.js +148 -0
- package/cli/dist/domain/config.d.ts +219 -0
- package/cli/dist/domain/config.js +310 -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 +24 -0
- package/cli/dist/domain/errors.js +36 -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 +94 -0
- package/cli/dist/domain/format.js +234 -0
- package/cli/dist/domain/frontmatter.d.ts +137 -0
- package/cli/dist/domain/frontmatter.js +290 -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-order.d.ts +55 -0
- package/cli/dist/domain/issue-order.js +65 -0
- package/cli/dist/domain/issue-readout.d.ts +143 -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 +201 -0
- package/cli/dist/domain/pull-request.js +281 -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 +199 -0
- package/cli/dist/domain/readiness.js +391 -0
- package/cli/dist/domain/reference-parser.d.ts +51 -0
- package/cli/dist/domain/reference-parser.js +123 -0
- package/cli/dist/domain/release.d.ts +53 -0
- package/cli/dist/domain/release.js +65 -0
- package/cli/dist/domain/repository-policy.d.ts +38 -0
- package/cli/dist/domain/repository-policy.js +66 -0
- package/cli/dist/domain/repository-resolver.d.ts +57 -0
- package/cli/dist/domain/repository-resolver.js +122 -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 +59 -0
- package/cli/dist/domain/state.js +95 -0
- package/cli/dist/domain/tracker-body.d.ts +70 -0
- package/cli/dist/domain/tracker-body.js +65 -0
- package/cli/dist/domain/work-start.d.ts +34 -0
- package/cli/dist/domain/work-start.js +49 -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 +72 -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 +53 -0
- package/cli/dist/infra/config-store.js +134 -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 +86 -0
- package/cli/dist/infra/git.js +145 -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 +178 -0
- package/cli/dist/infra/github/client.js +579 -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 +65 -0
- package/cli/dist/infra/github/errors.js +64 -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 +165 -0
- package/cli/dist/infra/github/issues.js +428 -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 +143 -0
- package/cli/dist/infra/github/projects.js +384 -0
- package/cli/dist/infra/github/pulls.d.ts +104 -0
- package/cli/dist/infra/github/pulls.js +217 -0
- package/cli/dist/infra/github/queries.d.ts +44 -0
- package/cli/dist/infra/github/queries.js +1031 -0
- package/cli/dist/infra/github/readout.d.ts +22 -0
- package/cli/dist/infra/github/readout.js +167 -0
- package/cli/dist/infra/github/repos.d.ts +86 -0
- package/cli/dist/infra/github/repos.js +168 -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 +54 -0
- package/cli/dist/infra/state-store.js +130 -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 +142 -0
- package/cli/dist/infra/worktree-links.js +440 -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 +185 -0
- package/cli/dist/infra/worktree.js +584 -0
- package/cli/dist/mcp/result.d.ts +61 -0
- package/cli/dist/mcp/result.js +96 -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 +142 -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 +195 -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 +74 -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/cli/templates/workflow/pecot-board-sync.yml +84 -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,6 @@
|
|
|
1
|
+
import type { CommandDefinition } from './command-definition.js';
|
|
2
|
+
export { defineCommand, toolNameOf } from './command-definition.js';
|
|
3
|
+
export type { CommandDefinition, CommandIo, PreparedCommand } from './command-definition.js';
|
|
4
|
+
export declare const COMMANDS: readonly CommandDefinition[];
|
|
5
|
+
export declare function findCommand(path: readonly string[], commands?: readonly CommandDefinition[]): CommandDefinition | undefined;
|
|
6
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// コマンド定義の一覧。CLI と MCP の両方がこの一覧から作られる。
|
|
2
|
+
// 各コマンドは defineCommand() で定義して、グループのファイルの一覧に足す。定義の型と defineCommand は command-definition.ts にあり、ここから再公開する。
|
|
3
|
+
import { BOARD_COMMANDS } from './board.js';
|
|
4
|
+
import { BRANCH_COMMANDS } from './branch.js';
|
|
5
|
+
import { registerCommandHints } from './command-hint.js';
|
|
6
|
+
import { ISSUE_COMMANDS } from './issue.js';
|
|
7
|
+
import { PR_COMMANDS } from './pr.js';
|
|
8
|
+
import { PROJECT_COMMANDS } from './project.js';
|
|
9
|
+
import { RELEASE_COMMANDS } from './release.js';
|
|
10
|
+
import { SESSION_COMMANDS } from './session.js';
|
|
11
|
+
import { TRACKER_COMMANDS } from './tracker.js';
|
|
12
|
+
import { WORKTREE_COMMANDS } from './worktree.js';
|
|
13
|
+
export { defineCommand, toolNameOf } from './command-definition.js';
|
|
14
|
+
// 並びは help の一覧の順で、names.ts の COMMAND_GROUPS の順に合わせる
|
|
15
|
+
export const COMMANDS = [
|
|
16
|
+
...PROJECT_COMMANDS,
|
|
17
|
+
...BOARD_COMMANDS,
|
|
18
|
+
...ISSUE_COMMANDS,
|
|
19
|
+
...SESSION_COMMANDS,
|
|
20
|
+
...PR_COMMANDS,
|
|
21
|
+
...RELEASE_COMMANDS,
|
|
22
|
+
...TRACKER_COMMANDS,
|
|
23
|
+
...WORKTREE_COMMANDS,
|
|
24
|
+
...BRANCH_COMMANDS,
|
|
25
|
+
];
|
|
26
|
+
registerCommandHints(COMMANDS);
|
|
27
|
+
export function findCommand(path, commands = COMMANDS) {
|
|
28
|
+
return commands.find(command => command.path.join(' ') === path.join(' '));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RepositoryReference } from '../domain/repository-resolver.js';
|
|
2
|
+
import type { Output } from './output.js';
|
|
3
|
+
import type { CommandDefinition } from './command-definition.js';
|
|
4
|
+
/**
|
|
5
|
+
順は採用済みの --repo、グローバルの --repo、主の remote。決められないと error の行を出して終了コード 1 で止める。
|
|
6
|
+
remote は process.cwd() から読む
|
|
7
|
+
*/
|
|
8
|
+
export declare function requireReleaseTargetRepository(adopted: RepositoryReference | undefined, explicit: string | undefined, out: Readonly<Output>): RepositoryReference;
|
|
9
|
+
export declare const RELEASE_COMMANDS: readonly CommandDefinition[];
|
|
10
|
+
//# sourceMappingURL=release.d.ts.map
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
// release check・create・merge。移す元は cli/commands/release.py。
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { describeApiError } from '../domain/api-error-detail.js';
|
|
5
|
+
import { ChangelogFileNotFoundError, InvalidVersionError, validateSemver } from '../domain/changelog.js';
|
|
6
|
+
import { effectiveReleaseType, findPackage, findRepository, getDevelopBranch, getReleaseBranch } from '../domain/config.js';
|
|
7
|
+
import { DependabotAlertError, fetchDependabotAlertStatus } from '../domain/dependabot.js';
|
|
8
|
+
import { PecotError } from '../domain/errors.js';
|
|
9
|
+
import { pythonStringRepr } from '../domain/python-format.js';
|
|
10
|
+
import { parsePullRequestReference, ReferenceParseError } from '../domain/reference-parser.js';
|
|
11
|
+
import { ReleaseError, runPreflight } from '../domain/release.js';
|
|
12
|
+
import { splitOwnerRepository } from '../domain/repository-resolver.js';
|
|
13
|
+
import { fetchCodeScanningStatus, fetchSecretScanningStatus, SecurityAlertError } from '../domain/security-alerts.js';
|
|
14
|
+
import { extractReleaseNotesFromFile, readChangelogIfExists, resolveChangelogPath } from '../infra/changelog-file.js';
|
|
15
|
+
import { loadActiveConfig } from '../infra/config-store.js';
|
|
16
|
+
import { gitRunnerFor, gitToplevel, primaryRemoteName, primaryRemoteRepository } from '../infra/git.js';
|
|
17
|
+
import { TransportFailure } from '../infra/github/client.js';
|
|
18
|
+
import { createDependabotSource } from '../infra/github/dependabot-source.js';
|
|
19
|
+
import { GitHubAPIError, GitHubNotFoundError } from '../infra/github/errors.js';
|
|
20
|
+
import { createScanAlertSource } from '../infra/github/security-alerts-source.js';
|
|
21
|
+
import { commandHint, hinted, inputHint, inputNameHint, placeholder } from './command-hint.js';
|
|
22
|
+
import { NO_ACTIVE_PROJECT, stopWith } from './command-stop.js';
|
|
23
|
+
import { kindOfFailure } from './failure.js';
|
|
24
|
+
import { createGitHubClient, makeClient } from './github-client.js';
|
|
25
|
+
import { createOutput } from './output.js';
|
|
26
|
+
import { CommandExit, defineCommand } from './command-definition.js';
|
|
27
|
+
import { requireRepositoryMatch } from './repository-match.js';
|
|
28
|
+
import { USAGE_EXIT_CODE } from './usage-error.js';
|
|
29
|
+
const CHECK_PATH = ['release', 'check'];
|
|
30
|
+
/**
|
|
31
|
+
順は採用済みの --repo、グローバルの --repo、主の remote。決められないと error の行を出して終了コード 1 で止める。
|
|
32
|
+
remote は process.cwd() から読む
|
|
33
|
+
*/
|
|
34
|
+
export function requireReleaseTargetRepository(adopted, explicit, out) {
|
|
35
|
+
if (adopted !== undefined)
|
|
36
|
+
return adopted;
|
|
37
|
+
if (explicit !== undefined) {
|
|
38
|
+
return splitOwnerRepository(explicit) ?? stopWith(out, hinted `invalid ${inputNameHint(CHECK_PATH, 'repo')} format: ${pythonStringRepr(explicit)}\nspecify it as owner/repo`, 'invalid-input');
|
|
39
|
+
}
|
|
40
|
+
const remote = primaryRemoteRepository(process.cwd()) ?? stopWith(out, 'could not read the repository from the git remote', 'git-unresolved');
|
|
41
|
+
return { owner: remote.owner, repository: remote.repository };
|
|
42
|
+
}
|
|
43
|
+
// 4 つの場合(packages の有無と --package の有無)を分ける。矛盾があれば error の行を出して止める
|
|
44
|
+
function resolvePackageContext(out, repositoryConfig, packageName, gitRoot, owner, repository) {
|
|
45
|
+
const packages = repositoryConfig?.packages ?? [];
|
|
46
|
+
if (repositoryConfig !== undefined && packages.length > 0) {
|
|
47
|
+
const names = packages.map(item => item.name).join(', ');
|
|
48
|
+
if (packageName === undefined)
|
|
49
|
+
stopWith(out, hinted `${owner}/${repository} is a monorepo\nspecify ${inputNameHint(['release', 'check'], 'package')} (available: ${names})`, 'invalid-input');
|
|
50
|
+
const found = findPackage(repositoryConfig, packageName) ?? stopWith(out, `package '${packageName}' is not registered in ${owner}/${repository}\navailable: ${names}`, 'invalid-input');
|
|
51
|
+
return { changelogPath: path.isAbsolute(found.changelog) ? found.changelog : path.join(gitRoot, found.changelog), tagPrefix: found.name };
|
|
52
|
+
}
|
|
53
|
+
if (packageName !== undefined)
|
|
54
|
+
stopWith(out, `${owner}/${repository} has no packages configured\n--package can only be used in a monorepo`, 'invalid-input');
|
|
55
|
+
return { changelogPath: resolveChangelogPath(gitRoot, repositoryConfig?.changelog_file), tagPrefix: undefined };
|
|
56
|
+
}
|
|
57
|
+
function requireBranchSetting(out, branch, kind, owner, repository) {
|
|
58
|
+
return branch === undefined || branch === '' ? stopWith(out, hinted `${kind}_branch is not set for ${owner}/${repository}\nset it with: ${commandHint(['project', 'link'], { repo: `${owner}/${repository}`, [`${kind}_branch`]: placeholder('branch') })}`, 'repo-setting-missing') : branch;
|
|
59
|
+
}
|
|
60
|
+
function loadReleaseContext(out, adopted, explicit, packageName, options = {}) {
|
|
61
|
+
const cwd = process.cwd();
|
|
62
|
+
const gitRoot = gitToplevel({ cwd }) ?? stopWith(out, 'could not find the root directory of the git repository', 'git-unresolved');
|
|
63
|
+
const { owner, repository } = requireReleaseTargetRepository(adopted, explicit, out);
|
|
64
|
+
const config = loadActiveConfig() ?? stopWith(out, NO_ACTIVE_PROJECT, 'no-active-project');
|
|
65
|
+
const repositoryConfig = findRepository(config, owner, repository);
|
|
66
|
+
if (repositoryConfig !== undefined && options.nxAlertsOnly === true && effectiveReleaseType(repositoryConfig) === 'nx') {
|
|
67
|
+
if (packageName !== undefined || options.version !== undefined) {
|
|
68
|
+
stopWith(out, hinted `the version argument and ${inputNameHint(CHECK_PATH, 'package')} cannot be used when release_type is nx\nrun it without arguments (Nx Release decides the version)`, 'invalid-input');
|
|
69
|
+
}
|
|
70
|
+
return { config, owner, repository, repositoryConfig, changelogPath: resolveChangelogPath(gitRoot, repositoryConfig.changelog_file), tagPrefix: undefined };
|
|
71
|
+
}
|
|
72
|
+
return { config, owner, repository, repositoryConfig, ...resolvePackageContext(out, repositoryConfig, packageName, gitRoot, owner, repository) };
|
|
73
|
+
}
|
|
74
|
+
function alertLabel(number, packageName, severity) {
|
|
75
|
+
const detail = [packageName, severity].filter(value => value !== undefined && value !== '').join(', ');
|
|
76
|
+
return detail === '' ? `#${String(number)}` : `#${String(number)} (${detail})`;
|
|
77
|
+
}
|
|
78
|
+
// 理由は 1 行目だけを使い、末尾の句点を落とす
|
|
79
|
+
function warnAlertsUnavailable(out, reason) {
|
|
80
|
+
const [first = ''] = reason.trim().split(/\r\n|[\n\r]/u, 1);
|
|
81
|
+
out.warning(`could not check Dependabot alerts. The release is not blocked.\nreason: ${first.trim().replace(/\.+$/u, '').trimEnd()}`);
|
|
82
|
+
}
|
|
83
|
+
// open の Dependabot alert は警告だけで、リリースを止めない
|
|
84
|
+
async function checkDependabotAlerts(out, config, owner, repository) {
|
|
85
|
+
let status;
|
|
86
|
+
try {
|
|
87
|
+
const client = createGitHubClient(out, config.host);
|
|
88
|
+
status = await fetchDependabotAlertStatus(createDependabotSource(client), config.host, owner, repository);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
if (error instanceof DependabotAlertError) {
|
|
92
|
+
warnAlertsUnavailable(out, error.message);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (error instanceof GitHubAPIError) {
|
|
96
|
+
warnAlertsUnavailable(out, error.message);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
if (!status.enabled) {
|
|
102
|
+
out.done({ verb: 'skip', target: 'Dependabot alerts (feature disabled)', aside: true });
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (status.openCount === 0) {
|
|
106
|
+
out.count('open Dependabot alerts', 0);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const severity = status.maxSeverity === undefined ? '' : ` (highest severity: ${status.maxSeverity})`;
|
|
110
|
+
const listing = status.openAlerts.map(alert => `\n${alertLabel(alert.number, alert.package, alert.severity)}`).join('');
|
|
111
|
+
const noun = status.openCount === 1 ? 'alert' : 'alerts';
|
|
112
|
+
out.warning(`${String(status.openCount)} open Dependabot ${noun}${severity}. The release is not blocked.${listing}\n→ ${status.alertsUrl}`);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
code scanning・secret scanning の open の alert があれば、false を返す。機能が無効のリポジトリは通る
|
|
116
|
+
*/
|
|
117
|
+
async function isScanningPassed(out, name, fetchStatus) {
|
|
118
|
+
let status;
|
|
119
|
+
try {
|
|
120
|
+
status = await fetchStatus();
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
if (!(error instanceof SecurityAlertError))
|
|
124
|
+
throw error;
|
|
125
|
+
out.error(`could not check ${name}: ${error.message}`);
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
if (!status.enabled) {
|
|
129
|
+
out.done({ verb: 'skip', target: `${name} (feature disabled)`, aside: true });
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
if (status.openCount === 0) {
|
|
133
|
+
out.count(`open ${name} alerts`, 0);
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
const listing = status.openNumbers.map(number => `\n#${String(number)}`).join('');
|
|
137
|
+
out.error(`${name} has ${String(status.openCount)} open ${status.openCount === 1 ? 'alert' : 'alerts'}${listing}\n→ ${status.alertsUrl}\nclose them (fixed, or dismissed with a reason) and run again`);
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
3 種を確かめる。1 つが失敗しても残りを続け、最後に成否を返す
|
|
142
|
+
*/
|
|
143
|
+
async function areAlertsPassed(out, config, owner, repository) {
|
|
144
|
+
const checks = [
|
|
145
|
+
async () => {
|
|
146
|
+
await checkDependabotAlerts(out, config, owner, repository);
|
|
147
|
+
return true;
|
|
148
|
+
},
|
|
149
|
+
async () => await isScanningPassed(out, 'code scanning', async () => await fetchCodeScanningStatus(createScanAlertSource(createGitHubClient(out, config.host)), config.host, owner, repository)),
|
|
150
|
+
async () => await isScanningPassed(out, 'secret scanning', async () => await fetchSecretScanningStatus(createScanAlertSource(createGitHubClient(out, config.host)), config.host, owner, repository)),
|
|
151
|
+
];
|
|
152
|
+
let isPassed = true;
|
|
153
|
+
for (const check of checks) {
|
|
154
|
+
try {
|
|
155
|
+
if (!await check())
|
|
156
|
+
isPassed = false;
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
if (!(error instanceof PecotError) && !(error instanceof TransportFailure))
|
|
160
|
+
throw error;
|
|
161
|
+
out.error(`could not check alerts: ${error.message}`);
|
|
162
|
+
isPassed = false;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return isPassed;
|
|
166
|
+
}
|
|
167
|
+
const releaseCheckCommand = defineCommand({
|
|
168
|
+
path: CHECK_PATH,
|
|
169
|
+
description: 'Run the pre-release checks; for an nx repository only the alerts are checked',
|
|
170
|
+
input: z.object({
|
|
171
|
+
version: z.string().optional().describe('Release version (detected from the CHANGELOG when omitted)'),
|
|
172
|
+
package: z.string().optional().describe('Package name in a monorepo (required for repositories with packages configured)'),
|
|
173
|
+
}),
|
|
174
|
+
positional: ['version'],
|
|
175
|
+
interactive: false,
|
|
176
|
+
run: async (input, io) => {
|
|
177
|
+
const adopted = requireRepositoryMatch('warn', input.repo, io, process.cwd());
|
|
178
|
+
const out = createOutput(false, io);
|
|
179
|
+
const cwd = process.cwd();
|
|
180
|
+
const context = loadReleaseContext(out, adopted, input.repo, input.package, { version: input.version, nxAlertsOnly: true });
|
|
181
|
+
const { config, owner, repository } = context;
|
|
182
|
+
const isAlertsPassed = await areAlertsPassed(out, config, owner, repository);
|
|
183
|
+
if (!isAlertsPassed)
|
|
184
|
+
throw new CommandExit(1, 'preflight-failed');
|
|
185
|
+
if (context.repositoryConfig !== undefined && effectiveReleaseType(context.repositoryConfig) === 'nx')
|
|
186
|
+
return 0;
|
|
187
|
+
const developBranch = requireBranchSetting(out, getDevelopBranch(config, owner, repository), 'develop', owner, repository);
|
|
188
|
+
const releaseBranch = requireBranchSetting(out, getReleaseBranch(config, owner, repository), 'release', owner, repository);
|
|
189
|
+
const remote = primaryRemoteName(cwd) ?? 'origin';
|
|
190
|
+
try {
|
|
191
|
+
const client = createGitHubClient(out, config.host);
|
|
192
|
+
const result = await runPreflight({
|
|
193
|
+
changelogPath: context.changelogPath,
|
|
194
|
+
changelogContent: readChangelogIfExists(context.changelogPath),
|
|
195
|
+
developBranch,
|
|
196
|
+
releaseBranch,
|
|
197
|
+
version: input.version,
|
|
198
|
+
tagPrefix: context.tagPrefix,
|
|
199
|
+
remote,
|
|
200
|
+
}, gitRunnerFor(cwd), async (base, head) => await client.countCommitsAhead(owner, repository, base, head));
|
|
201
|
+
out.count(`commits to release (${remote}/${result.developBranch} -> ${remote}/${result.releaseBranch})`, result.diffCount);
|
|
202
|
+
out.data(`version: ${result.version}\ntag: ${result.tagName}\n\n${result.releaseNotes}`);
|
|
203
|
+
return 0;
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
if (error instanceof GitHubAPIError || error instanceof TransportFailure) {
|
|
207
|
+
return stopWith(out, `could not count the commits from ${releaseBranch} to ${developBranch}: ${error.message}`, kindOfFailure(error));
|
|
208
|
+
}
|
|
209
|
+
if (!(error instanceof ReleaseError))
|
|
210
|
+
throw error;
|
|
211
|
+
return stopWith(out, error.message, 'preflight-failed');
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
});
|
|
215
|
+
const releaseCreateCommand = defineCommand({
|
|
216
|
+
path: ['release', 'create'],
|
|
217
|
+
description: 'Create a GitHub release and its tag (the release notes come from the CHANGELOG)',
|
|
218
|
+
input: z.object({
|
|
219
|
+
version: z.string().describe('Release version (for example 0.6.1)'),
|
|
220
|
+
dry_run: z.boolean().default(false).describe('Show what would happen without changing anything'),
|
|
221
|
+
package: z.string().optional().describe('Package name in a monorepo (required for repositories with packages configured)'),
|
|
222
|
+
}),
|
|
223
|
+
positional: ['version'],
|
|
224
|
+
interactive: false,
|
|
225
|
+
run: async (input, io) => {
|
|
226
|
+
const adopted = requireRepositoryMatch('warn', input.repo, io, process.cwd());
|
|
227
|
+
const out = createOutput(input.dry_run, io);
|
|
228
|
+
try {
|
|
229
|
+
validateSemver(input.version);
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
if (!(error instanceof InvalidVersionError))
|
|
233
|
+
throw error;
|
|
234
|
+
return stopWith(out, error.message, 'invalid-input');
|
|
235
|
+
}
|
|
236
|
+
const context = loadReleaseContext(out, adopted, input.repo, input.package);
|
|
237
|
+
const { config, owner, repository, tagPrefix } = context;
|
|
238
|
+
let releaseNotes;
|
|
239
|
+
try {
|
|
240
|
+
releaseNotes = extractReleaseNotesFromFile(context.changelogPath, input.version);
|
|
241
|
+
}
|
|
242
|
+
catch (error) {
|
|
243
|
+
if (!(error instanceof PecotError) && !(error instanceof ChangelogFileNotFoundError))
|
|
244
|
+
throw error;
|
|
245
|
+
return stopWith(out, error.message, 'preflight-failed');
|
|
246
|
+
}
|
|
247
|
+
const releaseBranch = requireBranchSetting(out, getReleaseBranch(config, owner, repository), 'release', owner, repository);
|
|
248
|
+
const tagName = tagPrefix === undefined ? `v${input.version}` : `${tagPrefix}-v${input.version}`;
|
|
249
|
+
const releaseName = tagPrefix === undefined ? tagName : `${tagPrefix} v${input.version}`;
|
|
250
|
+
const operation = { verb: 'create', target: `release ${tagName} on ${releaseBranch}` };
|
|
251
|
+
if (input.dry_run) {
|
|
252
|
+
out.planned(operation);
|
|
253
|
+
out.data(releaseNotes);
|
|
254
|
+
return 0;
|
|
255
|
+
}
|
|
256
|
+
const client = makeClient(out, config);
|
|
257
|
+
try {
|
|
258
|
+
const result = await client.createRelease(owner, repository, tagName, releaseName, releaseNotes, { targetCommitish: releaseBranch });
|
|
259
|
+
out.done(operation);
|
|
260
|
+
const url = result['html_url'];
|
|
261
|
+
out.data(typeof url === 'string' ? url : '');
|
|
262
|
+
return 0;
|
|
263
|
+
}
|
|
264
|
+
catch (error) {
|
|
265
|
+
if (!(error instanceof GitHubAPIError))
|
|
266
|
+
throw error;
|
|
267
|
+
return stopWith(out, `could not create release ${tagName} in ${owner}/${repository}: ${describeApiError(error)}`, kindOfFailure(error));
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
const releaseMergeCommand = defineCommand({
|
|
272
|
+
path: ['release', 'merge'],
|
|
273
|
+
description: 'Merge a release PR with a regular merge',
|
|
274
|
+
input: z.object({
|
|
275
|
+
pr_ref: z.string().describe('PR reference (owner/repo/123)'),
|
|
276
|
+
dry_run: z.boolean().default(false).describe('Show what would happen without merging'),
|
|
277
|
+
delete_branch: z.boolean().default(false).describe('Delete the branch after merging'),
|
|
278
|
+
admin: z.boolean().default(false).describe('Merge with admin rights (skip the mergeability check)'),
|
|
279
|
+
}),
|
|
280
|
+
positional: ['pr_ref'],
|
|
281
|
+
shortFlags: { dry_run: '-n', delete_branch: '-d' },
|
|
282
|
+
interactive: false,
|
|
283
|
+
run: async (input, io) => {
|
|
284
|
+
requireRepositoryMatch('reject', input.repo, io, process.cwd());
|
|
285
|
+
const out = createOutput(input.dry_run, io);
|
|
286
|
+
const config = loadActiveConfig() ?? stopWith(out, NO_ACTIVE_PROJECT, 'no-active-project');
|
|
287
|
+
let reference;
|
|
288
|
+
try {
|
|
289
|
+
reference = parsePullRequestReference(input.pr_ref);
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
if (!(error instanceof ReferenceParseError))
|
|
293
|
+
throw error;
|
|
294
|
+
return stopWith(out, error.message, 'invalid-input', USAGE_EXIT_CODE);
|
|
295
|
+
}
|
|
296
|
+
const { owner, repository } = reference.repository;
|
|
297
|
+
const number = reference.number;
|
|
298
|
+
const pullRequestName = `${owner}/${repository}/${String(number)}`;
|
|
299
|
+
let client;
|
|
300
|
+
let pullRequest;
|
|
301
|
+
try {
|
|
302
|
+
client = createGitHubClient(out, config.host);
|
|
303
|
+
pullRequest = await client.getPullRequestSlim(owner, repository, number);
|
|
304
|
+
}
|
|
305
|
+
catch (error) {
|
|
306
|
+
if (error instanceof GitHubNotFoundError)
|
|
307
|
+
return stopWith(out, `PR ${pullRequestName} not found`, 'github-not-found');
|
|
308
|
+
if (!(error instanceof GitHubAPIError))
|
|
309
|
+
throw error;
|
|
310
|
+
return stopWith(out, `could not read PR ${pullRequestName}: ${describeApiError(error)}`, kindOfFailure(error));
|
|
311
|
+
}
|
|
312
|
+
if (pullRequest.state === 'MERGED')
|
|
313
|
+
stopWith(out, `PR #${String(number)} is already merged`, 'pr-state');
|
|
314
|
+
else if (pullRequest.state === 'CLOSED')
|
|
315
|
+
stopWith(out, `PR #${String(number)} is closed`, 'pr-state');
|
|
316
|
+
if (pullRequest.mergeable === 'CONFLICTING' && !input.admin) {
|
|
317
|
+
stopWith(out, hinted `PR #${String(number)} has conflicts that must be resolved\nto try a forced merge, add ${inputHint(['release', 'merge'], 'admin')}`, 'pr-state');
|
|
318
|
+
}
|
|
319
|
+
const releaseBranch = requireBranchSetting(out, getReleaseBranch(config, owner, repository), 'release', owner, repository);
|
|
320
|
+
if (pullRequest.base_ref !== releaseBranch) {
|
|
321
|
+
stopWith(out, `the base branch of PR #${String(number)} does not match release_branch\nbase: ${pullRequest.base_ref}\nrelease_branch: ${releaseBranch}`, 'pr-state');
|
|
322
|
+
}
|
|
323
|
+
const headBranch = pullRequest.head_ref;
|
|
324
|
+
const operation = { verb: 'merge', target: `PR ${pullRequestName} (${headBranch} -> ${pullRequest.base_ref}, merge commit)` };
|
|
325
|
+
if (input.dry_run) {
|
|
326
|
+
out.planned(operation);
|
|
327
|
+
return 0;
|
|
328
|
+
}
|
|
329
|
+
try {
|
|
330
|
+
await client.mergePullRequest(owner, repository, number, 'merge');
|
|
331
|
+
}
|
|
332
|
+
catch (error) {
|
|
333
|
+
if (!(error instanceof GitHubAPIError))
|
|
334
|
+
throw error;
|
|
335
|
+
return stopWith(out, `could not merge PR ${pullRequestName}: ${describeApiError(error)}`, kindOfFailure(error));
|
|
336
|
+
}
|
|
337
|
+
out.done(operation);
|
|
338
|
+
if (input.delete_branch) {
|
|
339
|
+
try {
|
|
340
|
+
await client.deleteBranch(owner, repository, headBranch);
|
|
341
|
+
out.done({ verb: 'delete', target: `remote branch ${headBranch} in ${owner}/${repository}` });
|
|
342
|
+
}
|
|
343
|
+
catch (error) {
|
|
344
|
+
if (!(error instanceof GitHubAPIError))
|
|
345
|
+
throw error;
|
|
346
|
+
out.warning(`deleting remote branch ${headBranch} failed: ${describeApiError(error)}`);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return 0;
|
|
350
|
+
},
|
|
351
|
+
});
|
|
352
|
+
export const RELEASE_COMMANDS = [releaseCheckCommand, releaseCreateCommand, releaseMergeCommand];
|
|
353
|
+
//# sourceMappingURL=release.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
古い名前から新しい名前への表。キーは main のコマンド名で、値は今の名前
|
|
3
|
+
*/
|
|
4
|
+
export declare const RENAMED_COMMANDS: ReadonlyMap<string, string>;
|
|
5
|
+
/**
|
|
6
|
+
解決が止まった path の古い名前と新しい名前。`dependabot` のように 1 語目で止まったときは、その語で始まる古い名前を返す。無ければ undefined
|
|
7
|
+
*/
|
|
8
|
+
export declare function findRenamedCommand(path: readonly string[]): readonly [string, string] | undefined;
|
|
9
|
+
/**
|
|
10
|
+
古い入力名。command はコマンド名、oldName は古い入力名、newName は今の入力名
|
|
11
|
+
*/
|
|
12
|
+
export interface RenamedInput {
|
|
13
|
+
readonly command: string;
|
|
14
|
+
readonly oldName: string;
|
|
15
|
+
readonly newName: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const RENAMED_INPUTS: readonly RenamedInput[];
|
|
18
|
+
/**
|
|
19
|
+
path のコマンドの古い入力名 name の、今の入力名。無ければ undefined
|
|
20
|
+
*/
|
|
21
|
+
export declare function findRenamedInput(path: readonly string[], name: string): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
誤りの文に添える、古い名前から今の名前への案内
|
|
24
|
+
*/
|
|
25
|
+
export declare function renamedInputNote(oldName: string, newName: string): string;
|
|
26
|
+
//# sourceMappingURL=renamed-commands.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// #412・#428 で変えた main の古いコマンド名と入力名。CLI と MCP が案内に使い、skills のテストが古い名前を拾うのに使う。次の major で消す
|
|
2
|
+
/**
|
|
3
|
+
古い名前から新しい名前への表。キーは main のコマンド名で、値は今の名前
|
|
4
|
+
*/
|
|
5
|
+
export const RENAMED_COMMANDS = new Map([
|
|
6
|
+
['add-to-project', 'board add'],
|
|
7
|
+
['update-issue-status', 'board move'],
|
|
8
|
+
['create-branch', 'session start'],
|
|
9
|
+
['delete-branch', 'branch delete'],
|
|
10
|
+
['dependabot sync', 'tracker sync dependabot'],
|
|
11
|
+
['security sync', 'tracker sync security'],
|
|
12
|
+
['project info', 'board show'],
|
|
13
|
+
['project set-repo', 'project link'],
|
|
14
|
+
['project set-aggregation-repo', 'project set aggregation_repo'],
|
|
15
|
+
['project unset-aggregation-repo', 'project unset aggregation_repo'],
|
|
16
|
+
['project show-aggregation-repo', 'project get aggregation_repo'],
|
|
17
|
+
['issue read', 'issue show'],
|
|
18
|
+
['pr read', 'pr show'],
|
|
19
|
+
['pr preflight', 'pr check'],
|
|
20
|
+
['pr cleanup', 'session finish'],
|
|
21
|
+
['release preflight', 'release check'],
|
|
22
|
+
['session status', 'session show'],
|
|
23
|
+
['issue quick', 'issue create --freeform'],
|
|
24
|
+
]);
|
|
25
|
+
/**
|
|
26
|
+
解決が止まった path の古い名前と新しい名前。`dependabot` のように 1 語目で止まったときは、その語で始まる古い名前を返す。無ければ undefined
|
|
27
|
+
*/
|
|
28
|
+
export function findRenamedCommand(path) {
|
|
29
|
+
const prefix = path.join(' ');
|
|
30
|
+
return [...RENAMED_COMMANDS].find(([oldName]) => oldName === prefix || oldName.startsWith(`${prefix} `));
|
|
31
|
+
}
|
|
32
|
+
export const RENAMED_INPUTS = [
|
|
33
|
+
{ command: 'issue comment', oldName: 'issue', newName: 'issue_ref' },
|
|
34
|
+
{ command: 'session restore', oldName: 'issue', newName: 'issue_ref' },
|
|
35
|
+
{ command: 'branch delete', oldName: 'repo_ref', newName: 'repo' },
|
|
36
|
+
{ command: 'project link', oldName: 'owner_repo', newName: 'repo' },
|
|
37
|
+
{ command: 'session start', oldName: 'branch_name', newName: 'branch' },
|
|
38
|
+
{ command: 'issue create', oldName: 'plan', newName: 'dry_run' },
|
|
39
|
+
];
|
|
40
|
+
/**
|
|
41
|
+
path のコマンドの古い入力名 name の、今の入力名。無ければ undefined
|
|
42
|
+
*/
|
|
43
|
+
export function findRenamedInput(path, name) {
|
|
44
|
+
const command = path.join(' ');
|
|
45
|
+
return RENAMED_INPUTS.find(entry => entry.command === command && entry.oldName === name)?.newName;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
誤りの文に添える、古い名前から今の名前への案内
|
|
49
|
+
*/
|
|
50
|
+
export function renamedInputNote(oldName, newName) {
|
|
51
|
+
return ` ('${oldName}' was renamed to '${newName}')`;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=renamed-commands.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// `--show-repo` の出力。解決したリポジトリと解決元の 2 行。
|
|
2
|
+
import { repositoryFullName } from '../domain/repository-resolver.js';
|
|
3
|
+
export function formatResolvedRepository(resolved) {
|
|
4
|
+
const source = resolved.source === 'explicit' ? 'explicit' : `current-git (${resolved.remoteName ?? ''})`;
|
|
5
|
+
return `resolved: ${repositoryFullName(resolved.repository)}\nsource: ${source}\n`;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=repository-display.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PolicyMode } from '../domain/repository-policy.js';
|
|
2
|
+
import type { RepositoryReference, ResolvedRepository } from '../domain/repository-resolver.js';
|
|
3
|
+
import type { CommandIo } from './command-definition.js';
|
|
4
|
+
/**
|
|
5
|
+
今の git remote からリポジトリを解決する。git の外・remote 無しは undefined
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveCurrentRepository(cwd: string): ResolvedRepository | undefined;
|
|
8
|
+
/**
|
|
9
|
+
`--repo` と今の git remote を方針(reject か warn)に従って比べる。
|
|
10
|
+
続けてよいなら、明示値から採ったリポジトリ(`--repo` が無ければ undefined)を返す。
|
|
11
|
+
止めるときは、stderr に行を書いて CommandExit(1) を投げる。warn の警告は stderr に書いて続ける
|
|
12
|
+
*/
|
|
13
|
+
export declare function requireRepositoryMatch(mode: PolicyMode, explicit: string | undefined, io: Readonly<CommandIo>, cwd: string): RepositoryReference | undefined;
|
|
14
|
+
//# sourceMappingURL=repository-match.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// グローバルの `--repo` と、今の git remote のリポジトリの食い違いを扱う(Python の `require_repo_match`)。
|
|
2
|
+
// 判定は domain/repository-policy.ts の applyRepositoryPolicy に任せ、ここは git の解決と行の出力、止めるときの終了コードだけを行う。
|
|
3
|
+
import { formatHinted } from '../domain/command-hint.js';
|
|
4
|
+
import { applyRepositoryPolicy } from '../domain/repository-policy.js';
|
|
5
|
+
import { AmbiguousRepositoryError, resolveRepository } from '../domain/repository-resolver.js';
|
|
6
|
+
import { gitRunnerFor } from '../infra/git.js';
|
|
7
|
+
import { CommandExit } from './command-definition.js';
|
|
8
|
+
/**
|
|
9
|
+
今の git remote からリポジトリを解決する。git の外・remote 無しは undefined
|
|
10
|
+
*/
|
|
11
|
+
export function resolveCurrentRepository(cwd) {
|
|
12
|
+
try {
|
|
13
|
+
return resolveRepository(undefined, gitRunnerFor(cwd));
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
if (error instanceof AmbiguousRepositoryError)
|
|
17
|
+
return undefined;
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
`--repo` と今の git remote を方針(reject か warn)に従って比べる。
|
|
23
|
+
続けてよいなら、明示値から採ったリポジトリ(`--repo` が無ければ undefined)を返す。
|
|
24
|
+
止めるときは、stderr に行を書いて CommandExit(1) を投げる。warn の警告は stderr に書いて続ける
|
|
25
|
+
*/
|
|
26
|
+
export function requireRepositoryMatch(mode, explicit, io, cwd) {
|
|
27
|
+
const outcome = applyRepositoryPolicy({ explicit, resolved: resolveCurrentRepository(cwd), mode });
|
|
28
|
+
for (const line of outcome.stderr)
|
|
29
|
+
io.stderr(`${formatHinted(line, io.surface ?? 'cli')}\n`);
|
|
30
|
+
if (outcome.kind === 'exit')
|
|
31
|
+
throw new CommandExit(outcome.exitCode, outcome.failure);
|
|
32
|
+
return outcome.adopted;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=repository-match.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
端末のセル数
|
|
3
|
+
*/
|
|
4
|
+
export declare function cellLength(text: string): number;
|
|
5
|
+
/**
|
|
6
|
+
幅に収まるように折り返した行を返す。短い行を空白で埋めはしない。
|
|
7
|
+
入力の改行はそのまま行の区切りにする。長すぎる語は幅の単位で折る
|
|
8
|
+
*/
|
|
9
|
+
export declare function wrapText(text: string, width: number): readonly string[];
|
|
10
|
+
/**
|
|
11
|
+
行を幅のセル数まで空白で埋める
|
|
12
|
+
*/
|
|
13
|
+
export declare function padCells(line: string, width: number): string;
|
|
14
|
+
/**
|
|
15
|
+
枠の幅。typer と rich に合わせた順で決める。TERMINAL_WIDTH、COLUMNS、端末の幅、無ければ 80
|
|
16
|
+
*/
|
|
17
|
+
export declare function outputWidth(environment: Readonly<Record<string, string | undefined>>, terminalColumns: number | undefined): number;
|
|
18
|
+
/**
|
|
19
|
+
枠付きの表示。本文は幅に合わせて折り返す。末尾は改行で終わる
|
|
20
|
+
*/
|
|
21
|
+
export declare function renderPanel(title: string, body: string, width: number): string;
|
|
22
|
+
//# sourceMappingURL=rich-panel.d.ts.map
|