@agilemonster/mcp-server 1.0.15 → 1.0.21

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.
@@ -0,0 +1,144 @@
1
+ import { BoundProfile, DeployMethod, DeployProfile } from './deploy-profile.js';
2
+ import { PendingVerification } from './deploy-memory.js';
3
+ /**
4
+ * Runs a project's deployment and proves it worked.
5
+ *
6
+ * Differences from the previous inline pipeline:
7
+ * - commits ONLY the files the agent changed (never `git add -A`, which swept up unrelated work and local API keys),
8
+ * - never blocks the event loop, so the worker heartbeat stays alive during long builds,
9
+ * - classifies failures, heals the ones it can (Docker not running, remote moved ahead, flaky network)
10
+ * and falls back to the next-best route when the chosen one plainly does not apply,
11
+ * - treats a still-running CI pipeline as "pending" to be re-checked later instead of a failure,
12
+ * - only lets an unreachable URL fail the deploy when a human told us that URL (guesses are informational),
13
+ * - records every outcome in the project's deployment memory.
14
+ */
15
+ export interface DeployRequest {
16
+ projectPath: string;
17
+ title: string;
18
+ cardId: string;
19
+ /** Project-relative paths the agent modified. Only these are committed. */
20
+ files?: string[];
21
+ /** The human asked for a (re)deploy even though there is nothing new to commit. */
22
+ redeploy?: boolean;
23
+ bound?: BoundProfile | null;
24
+ /** A deploy route the human just gave us for this card. */
25
+ override?: {
26
+ method: DeployMethod;
27
+ command?: string | null;
28
+ } | null;
29
+ ciWaitMs?: number;
30
+ }
31
+ export interface DeployResult {
32
+ ok: boolean;
33
+ /** Pushed and triggered, but the pipeline had not finished when we stopped waiting. */
34
+ pending: boolean;
35
+ /** The change was saved/pushed, but no deployment could be confirmed (never reported as "Deployed"). */
36
+ unverified: boolean;
37
+ method: DeployMethod;
38
+ command: string | null;
39
+ commitHash: string;
40
+ fullSha: string;
41
+ branch: string;
42
+ deployedNote: string;
43
+ errorDetail: string;
44
+ errorKind: string | null;
45
+ hint: string;
46
+ actions: string[];
47
+ healed: string[];
48
+ profile: DeployProfile;
49
+ pendingVerification?: PendingVerification;
50
+ }
51
+ export interface FailureClass {
52
+ kind: string;
53
+ hint: string;
54
+ healable: boolean;
55
+ }
56
+ export declare function classifyFailure(text: string): FailureClass;
57
+ export interface DeployDirective {
58
+ retry: boolean;
59
+ method: DeployMethod | null;
60
+ command: string | null;
61
+ liveUrl: string | null;
62
+ }
63
+ /**
64
+ * Parse a human reply to a "deployment failed / may I deploy with X?" question.
65
+ * Returns null when the comment is not about deploying (it is then ordinary feedback on the code).
66
+ */
67
+ export declare function parseDeployDirective(text: string): DeployDirective | null;
68
+ /** Agent-modified paths that are safe to commit: inside the project, and never local config that carries secrets. */
69
+ export declare function committablePaths(projectPath: string, files: string[]): string[];
70
+ /**
71
+ * Keep Agile Monster's local files (which contain the personal API key) out of every commit, by anyone,
72
+ * via the repository's `info/exclude` — a per-clone ignore list that is itself never committed.
73
+ * Works for worktrees and for a bound folder that is a sub-directory of a larger repository.
74
+ */
75
+ export declare function ensureLocalGitExcludes(projectPath: string): void;
76
+ export interface CiRun {
77
+ databaseId?: number;
78
+ status: string;
79
+ conclusion: string | null;
80
+ name?: string;
81
+ workflowName?: string;
82
+ url?: string;
83
+ event?: string;
84
+ createdAt?: string;
85
+ }
86
+ export interface CiVerdict {
87
+ verdict: 'success' | 'failure' | 'pending' | 'none' | 'no_deploy_run';
88
+ failed?: CiRun;
89
+ reason?: string;
90
+ warnings: string[];
91
+ url?: string;
92
+ }
93
+ /**
94
+ * Decide what a commit's workflow runs say about the DEPLOYMENT.
95
+ * A failing lint/test workflow does not mean the deploy failed (unless the deploy is chained behind it),
96
+ * a deploy that has not finished is "pending", and a run cancelled by a newer one is neither success nor failure.
97
+ *
98
+ * `deployNames` may hold workflow names and/or workflow file paths (GitHub reports a workflow without a
99
+ * `name:` by its path).
100
+ */
101
+ export declare function judgeCiRuns(runs: CiRun[], deployNames: string[], chainedDeploy?: boolean): CiVerdict;
102
+ /** Names GitHub may report for a workflow: its `name:`, or its path when it has none. */
103
+ export declare function workflowMatchNames(workflows: Array<{
104
+ name: string;
105
+ file: string;
106
+ }>): string[];
107
+ /** Re-check a commit's runs once (used both inline and for deferred verification on later pulses). */
108
+ export declare function checkCiOnce(cwd: string, sha: string, deployNames: string[], chained: boolean): Promise<CiVerdict & {
109
+ ghError?: string;
110
+ logTail?: string;
111
+ }>;
112
+ export interface ComposePsEntry {
113
+ Service?: string;
114
+ Name?: string;
115
+ State?: string;
116
+ Health?: string;
117
+ ExitCode?: number;
118
+ ID?: string;
119
+ Publishers?: Array<{
120
+ PublishedPort?: number;
121
+ TargetPort?: number;
122
+ }> | null;
123
+ }
124
+ /** `docker compose ps --format json` prints either one JSON array or one object per line, depending on the version. */
125
+ export declare function parseComposePsJson(text: string): ComposePsEntry[];
126
+ export declare function evaluateComposePs(entries: ComposePsEntry[]): {
127
+ ok: boolean;
128
+ settling: boolean;
129
+ bad: ComposePsEntry[];
130
+ running: number;
131
+ };
132
+ export interface ComposeRefreshPlan {
133
+ /** Services built from a directory containing a changed file: rebuild + recreate. */
134
+ rebuild: string[];
135
+ /** Services that bind-mount a changed file (no image rebuild needed): restart. */
136
+ restart: string[];
137
+ /** Could not map the change to specific services: refresh the whole stack. */
138
+ all: boolean;
139
+ }
140
+ /** Map changed files to the Compose services that must be rebuilt or restarted (from `docker compose config --format json`). */
141
+ export declare function planComposeRefresh(config: any, composeDir: string, changedAbs: string[]): ComposeRefreshPlan;
142
+ export declare function runDeployment(req: DeployRequest): Promise<DeployResult>;
143
+ /** Plain-English failure message for the card, including how to answer so the next attempt can succeed. */
144
+ export declare function describeFailureForHuman(res: DeployResult): string;