@urateam/cli 0.1.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/dist/__tests__/cli-integration.test.d.ts +2 -0
- package/dist/__tests__/cli-integration.test.d.ts.map +1 -0
- package/dist/__tests__/cli-integration.test.js +91 -0
- package/dist/__tests__/cli-integration.test.js.map +1 -0
- package/dist/__tests__/config.test.d.ts +2 -0
- package/dist/__tests__/config.test.d.ts.map +1 -0
- package/dist/__tests__/config.test.js +92 -0
- package/dist/__tests__/config.test.js.map +1 -0
- package/dist/__tests__/run.test.d.ts +2 -0
- package/dist/__tests__/run.test.d.ts.map +1 -0
- package/dist/__tests__/run.test.js +297 -0
- package/dist/__tests__/run.test.js.map +1 -0
- package/dist/__tests__/webhook.test.d.ts +2 -0
- package/dist/__tests__/webhook.test.d.ts.map +1 -0
- package/dist/__tests__/webhook.test.js +142 -0
- package/dist/__tests__/webhook.test.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +44 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/dev.d.ts +3 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +73 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/migrate.d.ts +3 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +119 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/run.d.ts +28 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +283 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/start.d.ts +3 -0
- package/dist/commands/start.d.ts.map +1 -0
- package/dist/commands/start.js +196 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/webhook.d.ts +3 -0
- package/dist/commands/webhook.d.ts.map +1 -0
- package/dist/commands/webhook.js +34 -0
- package/dist/commands/webhook.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
2
|
+
import { writeFileSync, unlinkSync } from "fs";
|
|
3
|
+
import { tmpdir } from "os";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
import { createHmac } from "crypto";
|
|
6
|
+
import { webhookCommand } from "../commands/webhook.js";
|
|
7
|
+
const SAMPLE_PAYLOAD = {
|
|
8
|
+
action: "update",
|
|
9
|
+
type: "Issue",
|
|
10
|
+
data: {
|
|
11
|
+
id: "issue-uuid-123",
|
|
12
|
+
identifier: "LIN-42",
|
|
13
|
+
title: "Add user search",
|
|
14
|
+
state: { id: "state-uuid", name: "Todo" },
|
|
15
|
+
teamId: "team-frontend",
|
|
16
|
+
labels: [{ name: "auto-implement" }],
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
describe("lag webhook", () => {
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
+
let exitSpy;
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
let logSpy;
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
+
let errorSpy;
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
+
let fetchMock;
|
|
28
|
+
let tmpFile;
|
|
29
|
+
let payloadStr;
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
exitSpy = vi.spyOn(process, "exit").mockImplementation((() => { }));
|
|
32
|
+
logSpy = vi.spyOn(console, "log").mockImplementation(() => { });
|
|
33
|
+
errorSpy = vi.spyOn(console, "error").mockImplementation(() => { });
|
|
34
|
+
// Write a temp fixture file — no live network access needed
|
|
35
|
+
payloadStr = JSON.stringify(SAMPLE_PAYLOAD);
|
|
36
|
+
tmpFile = join(tmpdir(), `webhook-cli-test-${Date.now()}.json`);
|
|
37
|
+
writeFileSync(tmpFile, payloadStr);
|
|
38
|
+
// Mock global fetch so no real HTTP request is made
|
|
39
|
+
fetchMock = vi.fn().mockResolvedValue({
|
|
40
|
+
status: 200,
|
|
41
|
+
json: vi.fn().mockResolvedValue({ ok: true }),
|
|
42
|
+
});
|
|
43
|
+
vi.stubGlobal("fetch", fetchMock);
|
|
44
|
+
});
|
|
45
|
+
afterEach(() => {
|
|
46
|
+
vi.restoreAllMocks();
|
|
47
|
+
vi.unstubAllGlobals();
|
|
48
|
+
try {
|
|
49
|
+
unlinkSync(tmpFile);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// ignore cleanup errors
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
it("sends a POST request to the local webhook endpoint", async () => {
|
|
56
|
+
await webhookCommand.parseAsync([
|
|
57
|
+
"node",
|
|
58
|
+
"ura",
|
|
59
|
+
"--file",
|
|
60
|
+
tmpFile,
|
|
61
|
+
"--port",
|
|
62
|
+
"3000",
|
|
63
|
+
"--secret",
|
|
64
|
+
"dev-secret",
|
|
65
|
+
]);
|
|
66
|
+
expect(fetchMock).toHaveBeenCalledOnce();
|
|
67
|
+
const [url, init] = fetchMock.mock.calls[0];
|
|
68
|
+
expect(url).toBe("http://localhost:3000/webhooks/linear");
|
|
69
|
+
expect(init.method).toBe("POST");
|
|
70
|
+
expect(init.headers["Content-Type"]).toBe("application/json");
|
|
71
|
+
expect(init.body).toBe(payloadStr);
|
|
72
|
+
});
|
|
73
|
+
it("signs the payload with HMAC-SHA256 using the provided secret", async () => {
|
|
74
|
+
const secret = "my-test-secret";
|
|
75
|
+
const expectedSignature = createHmac("sha256", secret)
|
|
76
|
+
.update(payloadStr)
|
|
77
|
+
.digest("hex");
|
|
78
|
+
await webhookCommand.parseAsync([
|
|
79
|
+
"node",
|
|
80
|
+
"ura",
|
|
81
|
+
"--file",
|
|
82
|
+
tmpFile,
|
|
83
|
+
"--port",
|
|
84
|
+
"3000",
|
|
85
|
+
"--secret",
|
|
86
|
+
secret,
|
|
87
|
+
]);
|
|
88
|
+
const [, init] = fetchMock.mock.calls[0];
|
|
89
|
+
expect(init.headers["Linear-Signature"]).toBe(expectedSignature);
|
|
90
|
+
// SHA-256 hex digest is always 64 characters
|
|
91
|
+
expect(init.headers["Linear-Signature"]).toHaveLength(64);
|
|
92
|
+
});
|
|
93
|
+
it("logs the server response on success", async () => {
|
|
94
|
+
await webhookCommand.parseAsync([
|
|
95
|
+
"node",
|
|
96
|
+
"ura",
|
|
97
|
+
"--file",
|
|
98
|
+
tmpFile,
|
|
99
|
+
]);
|
|
100
|
+
expect(logSpy).toHaveBeenCalledWith(expect.stringContaining("Response (200)"), expect.any(String));
|
|
101
|
+
expect(exitSpy).not.toHaveBeenCalled();
|
|
102
|
+
});
|
|
103
|
+
it("uses the default dev-secret when no secret is provided", async () => {
|
|
104
|
+
const expectedSignature = createHmac("sha256", "dev-secret")
|
|
105
|
+
.update(payloadStr)
|
|
106
|
+
.digest("hex");
|
|
107
|
+
await webhookCommand.parseAsync([
|
|
108
|
+
"node",
|
|
109
|
+
"ura",
|
|
110
|
+
"--file",
|
|
111
|
+
tmpFile,
|
|
112
|
+
]);
|
|
113
|
+
const [, init] = fetchMock.mock.calls[0];
|
|
114
|
+
expect(init.headers["Linear-Signature"]).toBe(expectedSignature);
|
|
115
|
+
});
|
|
116
|
+
it("logs a helpful error and lag dev hint when the server is unreachable", async () => {
|
|
117
|
+
fetchMock.mockRejectedValue(new Error("connect ECONNREFUSED 127.0.0.1:3000"));
|
|
118
|
+
await webhookCommand.parseAsync([
|
|
119
|
+
"node",
|
|
120
|
+
"ura",
|
|
121
|
+
"--file",
|
|
122
|
+
tmpFile,
|
|
123
|
+
]);
|
|
124
|
+
expect(errorSpy).toHaveBeenCalledWith(expect.stringContaining("Failed to send webhook"), expect.any(Error));
|
|
125
|
+
expect(errorSpy).toHaveBeenCalledWith(expect.stringContaining("lag dev"));
|
|
126
|
+
// Should NOT call process.exit — webhook failure is non-fatal
|
|
127
|
+
expect(exitSpy).not.toHaveBeenCalled();
|
|
128
|
+
});
|
|
129
|
+
it("sends to custom port when --port is specified", async () => {
|
|
130
|
+
await webhookCommand.parseAsync([
|
|
131
|
+
"node",
|
|
132
|
+
"ura",
|
|
133
|
+
"--file",
|
|
134
|
+
tmpFile,
|
|
135
|
+
"--port",
|
|
136
|
+
"9000",
|
|
137
|
+
]);
|
|
138
|
+
const [url] = fetchMock.mock.calls[0];
|
|
139
|
+
expect(url).toBe("http://localhost:9000/webhooks/linear");
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
//# sourceMappingURL=webhook.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook.test.js","sourceRoot":"","sources":["../../src/__tests__/webhook.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,cAAc,GAAG;IACrB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE;QACJ,EAAE,EAAE,gBAAgB;QACpB,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,iBAAiB;QACxB,KAAK,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE;QACzC,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,gBAAgB,EA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,0 +1,44 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
export const configCommand = new Command("config")
|
|
3
|
+
.description("Validate pipeline and repo configurations")
|
|
4
|
+
.argument("[action]", "Action to perform", "validate")
|
|
5
|
+
.option("--pipeline <path>", "Pipeline config file path", "./pipeline.config.ts")
|
|
6
|
+
.option("--repos <path>", "Repo config file path", "./repos.config.ts")
|
|
7
|
+
.action(async (action, options) => {
|
|
8
|
+
if (action !== "validate") {
|
|
9
|
+
console.error(`Unknown action: ${action}. Use "validate".`);
|
|
10
|
+
process.exit(1);
|
|
11
|
+
}
|
|
12
|
+
console.log("Validating configurations...");
|
|
13
|
+
try {
|
|
14
|
+
const { validatePipelineConfigs, validateRepoConfigs, defaultConfigs } = await import("@urateam/core");
|
|
15
|
+
// Try loading custom configs, fall back to defaults
|
|
16
|
+
let pipelineConfigs;
|
|
17
|
+
try {
|
|
18
|
+
const module = await import(options.pipeline);
|
|
19
|
+
pipelineConfigs = validatePipelineConfigs(module.default ?? module);
|
|
20
|
+
console.log(`Pipeline config loaded from ${options.pipeline}`);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
pipelineConfigs = defaultConfigs;
|
|
24
|
+
console.log(`No custom pipeline config found, using defaults`);
|
|
25
|
+
}
|
|
26
|
+
console.log(` Pipelines: ${Object.keys(pipelineConfigs).join(", ")}`);
|
|
27
|
+
// Try loading repo configs
|
|
28
|
+
try {
|
|
29
|
+
const module = await import(options.repos);
|
|
30
|
+
const repoConfigs = validateRepoConfigs(module.default ?? module);
|
|
31
|
+
console.log(`Repo config loaded from ${options.repos}`);
|
|
32
|
+
console.log(` Repos: ${Object.keys(repoConfigs).join(", ")}`);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
console.log(`No repo config found at ${options.repos}`);
|
|
36
|
+
}
|
|
37
|
+
console.log("\nConfiguration is valid.");
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
console.error(`Validation failed:`, e);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,2CAA2C,CAAC;KACxD,QAAQ,CAAC,UAAU,EAAE,mBAAmB,EAAE,UAAU,CAAC;KACrD,MAAM,CAAC,mBAAmB,EAAE,2BAA2B,EAAE,sBAAsB,CAAC;KAChF,MAAM,CAAC,gBAAgB,EAAE,uBAAuB,EAAE,mBAAmB,CAAC;KACtE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;IAChC,IAAI,MAAM,KAAK,UAAU,EAAE,CAAC;QAC1B,OAAO,CAAC,KAAK,CAAC,mBAAmB,MAAM,mBAAmB,CAAC,CAAC;QAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;IAE5C,IAAI,CAAC;QACH,MAAM,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC;QAEvG,oDAAoD;QACpD,IAAI,eAAe,CAAC;QACpB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC9C,eAAe,GAAG,uBAAuB,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,CAAC;YACpE,OAAO,CAAC,GAAG,CAAC,+BAA+B,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjE,CAAC;QAAC,MAAM,CAAC;YACP,eAAe,GAAG,cAAc,CAAC;YACjC,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;QACjE,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,iBAAiB,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAExE,2BAA2B;QAC3B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC3C,MAAM,WAAW,GAAG,mBAAmB,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,CAAC;YAClE,OAAO,CAAC,GAAG,CAAC,2BAA2B,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;YACxD,OAAO,CAAC,GAAG,CAAC,aAAa,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,GAAG,CAAC,2BAA2B,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IAC3C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC;QACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,eAAO,MAAM,UAAU,SAiFnB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
export const devCommand = new Command("dev")
|
|
3
|
+
.description("Start local development server (webhook + dashboard)")
|
|
4
|
+
.option("--port <port>", "Webhook server port", "3000")
|
|
5
|
+
.option("--dashboard-port <port>", "Dashboard port", "3001")
|
|
6
|
+
.action(async (options) => {
|
|
7
|
+
const { createApp, defaultConfigs } = await import("@urateam/core");
|
|
8
|
+
const { createDashboard } = await import("@urateam/dashboard");
|
|
9
|
+
const dashboardUser = process.env.DASHBOARD_USER;
|
|
10
|
+
const dashboardPass = process.env.DASHBOARD_PASSWORD;
|
|
11
|
+
const dashboardAuth = dashboardUser && dashboardPass
|
|
12
|
+
? { username: dashboardUser, password: dashboardPass }
|
|
13
|
+
: undefined;
|
|
14
|
+
// Build repoConfigs from env: REPO_TEAM_ID, REPO_URL, REPO_DEFAULT_BRANCH, etc.
|
|
15
|
+
const repoConfigs = {};
|
|
16
|
+
if (process.env.REPO_TEAM_ID && process.env.REPO_URL) {
|
|
17
|
+
const repoEntry = {
|
|
18
|
+
url: process.env.REPO_URL,
|
|
19
|
+
defaultBranch: process.env.REPO_DEFAULT_BRANCH ?? "main",
|
|
20
|
+
testCommand: process.env.REPO_TEST_CMD ?? "pnpm test",
|
|
21
|
+
buildCommand: process.env.REPO_BUILD_CMD ?? "pnpm build",
|
|
22
|
+
};
|
|
23
|
+
if (process.env.GITHUB_WEBHOOK_SECRET) {
|
|
24
|
+
repoEntry.githubFeedback = {
|
|
25
|
+
autoTrigger: process.env.GITHUB_FEEDBACK_AUTO_TRIGGER !== "false",
|
|
26
|
+
triggerKeyword: process.env.GITHUB_FEEDBACK_TRIGGER_KEYWORD,
|
|
27
|
+
allowedReviewers: process.env.GITHUB_FEEDBACK_ALLOWED_REVIEWERS
|
|
28
|
+
? process.env.GITHUB_FEEDBACK_ALLOWED_REVIEWERS.split(",").filter(Boolean)
|
|
29
|
+
: undefined,
|
|
30
|
+
botLogins: process.env.GITHUB_FEEDBACK_BOT_LOGINS
|
|
31
|
+
? process.env.GITHUB_FEEDBACK_BOT_LOGINS.split(",").filter(Boolean)
|
|
32
|
+
: undefined,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
repoConfigs[process.env.REPO_TEAM_ID] = repoEntry;
|
|
36
|
+
}
|
|
37
|
+
const config = {
|
|
38
|
+
webhookSecret: process.env.LINEAR_WEBHOOK_SECRET ?? "dev-secret",
|
|
39
|
+
linearApiKey: process.env.LINEAR_API_KEY ?? "",
|
|
40
|
+
pipelineConfigs: defaultConfigs,
|
|
41
|
+
repoConfigs,
|
|
42
|
+
slackWebhookUrl: process.env.SLACK_WEBHOOK_URL,
|
|
43
|
+
discordWebhookUrl: process.env.DISCORD_WEBHOOK_URL,
|
|
44
|
+
agentRunDir: process.env.AGENT_RUN_DIR ?? "/tmp/agent-runs",
|
|
45
|
+
repoCloneDir: process.env.REPO_CLONE_DIR ?? "/tmp/agent-repos",
|
|
46
|
+
githubWebhookSecret: process.env.GITHUB_WEBHOOK_SECRET,
|
|
47
|
+
};
|
|
48
|
+
const { app, db } = await createApp(config);
|
|
49
|
+
const dashboardApp = createDashboard({
|
|
50
|
+
db,
|
|
51
|
+
pipelineConfigs: config.pipelineConfigs,
|
|
52
|
+
repoConfigs: config.repoConfigs,
|
|
53
|
+
auth: dashboardAuth,
|
|
54
|
+
});
|
|
55
|
+
const { serve } = await import("@hono/node-server");
|
|
56
|
+
const port = parseInt(options.port, 10);
|
|
57
|
+
const dashboardPort = parseInt(options.dashboardPort, 10);
|
|
58
|
+
console.log(`Linear Agent Framework — Local Dev Mode`);
|
|
59
|
+
console.log(`Webhook server: http://localhost:${port}`);
|
|
60
|
+
console.log(`Health check: http://localhost:${port}/health`);
|
|
61
|
+
console.log(`Dashboard: http://localhost:${dashboardPort}`);
|
|
62
|
+
if (dashboardAuth) {
|
|
63
|
+
console.log(`Dashboard auth: enabled (DASHBOARD_USER set)`);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
console.warn(`Dashboard auth: NOT configured — dashboard is blocked (set DASHBOARD_USER + DASHBOARD_PASSWORD)`);
|
|
67
|
+
}
|
|
68
|
+
console.log(`\nPipelines loaded: ${Object.keys(config.pipelineConfigs).join(", ")}`);
|
|
69
|
+
console.log(`\nUse ngrok or similar to expose webhook endpoint to Linear.`);
|
|
70
|
+
serve({ fetch: app.fetch, port });
|
|
71
|
+
serve({ fetch: dashboardApp.fetch, port: dashboardPort });
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC;KACzC,WAAW,CAAC,sDAAsD,CAAC;KACnE,MAAM,CAAC,eAAe,EAAE,qBAAqB,EAAE,MAAM,CAAC;KACtD,MAAM,CAAC,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,CAAC;KAC3D,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxB,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC;IACpE,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAE/D,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IACjD,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;IACrD,MAAM,aAAa,GACjB,aAAa,IAAI,aAAa;QAC5B,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE;QACtD,CAAC,CAAC,SAAS,CAAC;IAEhB,gFAAgF;IAChF,MAAM,WAAW,GAAuD,EAAE,CAAC;IAC3E,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,C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;IACrF,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC;IAE5E,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC;AAC5D,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../src/commands/migrate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0CpC,eAAO,MAAM,cAAc,SAyGvB,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import Database from "better-sqlite3";
|
|
3
|
+
import postgres from "postgres";
|
|
4
|
+
import { runMigrationsSqlite, runMigrationsPostgres, getMigrationStatusSqlite, getMigrationStatusPostgres, } from "@urateam/core";
|
|
5
|
+
function detectDriver(connectionString) {
|
|
6
|
+
if (connectionString.startsWith("postgres://") ||
|
|
7
|
+
connectionString.startsWith("postgresql://")) {
|
|
8
|
+
return "postgres";
|
|
9
|
+
}
|
|
10
|
+
return "sqlite";
|
|
11
|
+
}
|
|
12
|
+
function printStatus(statuses) {
|
|
13
|
+
if (statuses.length === 0) {
|
|
14
|
+
console.log("No migration files found.");
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const pending = statuses.filter((s) => !s.applied);
|
|
18
|
+
const applied = statuses.filter((s) => s.applied);
|
|
19
|
+
console.log(`\nMigration status (${applied.length} applied, ${pending.length} pending):\n`);
|
|
20
|
+
for (const s of statuses) {
|
|
21
|
+
const marker = s.applied ? "✓" : "○";
|
|
22
|
+
const dateStr = s.appliedAt
|
|
23
|
+
? ` [applied ${s.appliedAt.toISOString()}]`
|
|
24
|
+
: " [pending]";
|
|
25
|
+
console.log(` ${marker} ${s.name}${dateStr}`);
|
|
26
|
+
}
|
|
27
|
+
console.log();
|
|
28
|
+
}
|
|
29
|
+
export const migrateCommand = new Command("migrate")
|
|
30
|
+
.description("Manage database migrations")
|
|
31
|
+
.option("--db <url>", "Database connection string (default: DATABASE_URL env var)")
|
|
32
|
+
.addCommand(new Command("status")
|
|
33
|
+
.description("Show which migrations have been applied and which are pending")
|
|
34
|
+
.option("--db <url>", "Database connection string")
|
|
35
|
+
.action(async (opts) => {
|
|
36
|
+
const url = opts.db ?? process.env.DATABASE_URL;
|
|
37
|
+
if (!url) {
|
|
38
|
+
console.error("Error: provide --db <url> or set DATABASE_URL environment variable.");
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
const driver = detectDriver(url);
|
|
42
|
+
try {
|
|
43
|
+
let statuses;
|
|
44
|
+
if (driver === "postgres") {
|
|
45
|
+
const client = postgres(url);
|
|
46
|
+
statuses = await getMigrationStatusPostgres(client);
|
|
47
|
+
await client.end();
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const db = new Database(url);
|
|
51
|
+
statuses = getMigrationStatusSqlite(db);
|
|
52
|
+
db.close();
|
|
53
|
+
}
|
|
54
|
+
printStatus(statuses);
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
}))
|
|
61
|
+
.addCommand(new Command("run")
|
|
62
|
+
.description("Apply all pending migrations")
|
|
63
|
+
.option("--db <url>", "Database connection string")
|
|
64
|
+
.action(async (opts) => {
|
|
65
|
+
const url = opts.db ?? process.env.DATABASE_URL;
|
|
66
|
+
if (!url) {
|
|
67
|
+
console.error("Error: provide --db <url> or set DATABASE_URL environment variable.");
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
const driver = detectDriver(url);
|
|
71
|
+
console.log(`Running migrations against ${driver} database...`);
|
|
72
|
+
try {
|
|
73
|
+
if (driver === "postgres") {
|
|
74
|
+
const client = postgres(url);
|
|
75
|
+
// Show status before
|
|
76
|
+
const before = await getMigrationStatusPostgres(client);
|
|
77
|
+
const pending = before.filter((s) => !s.applied);
|
|
78
|
+
if (pending.length === 0) {
|
|
79
|
+
console.log("All migrations already applied. Nothing to do.");
|
|
80
|
+
await client.end();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
console.log(`Applying ${pending.length} pending migration(s)...`);
|
|
84
|
+
for (const m of pending) {
|
|
85
|
+
console.log(` → ${m.name}`);
|
|
86
|
+
}
|
|
87
|
+
await runMigrationsPostgres(client);
|
|
88
|
+
console.log("Done.");
|
|
89
|
+
await client.end();
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const db = new Database(url);
|
|
93
|
+
// Show status before
|
|
94
|
+
const before = getMigrationStatusSqlite(db);
|
|
95
|
+
const pending = before.filter((s) => !s.applied);
|
|
96
|
+
if (pending.length === 0) {
|
|
97
|
+
console.log("All migrations already applied. Nothing to do.");
|
|
98
|
+
db.close();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
console.log(`Applying ${pending.length} pending migration(s)...`);
|
|
102
|
+
for (const m of pending) {
|
|
103
|
+
console.log(` → ${m.name}`);
|
|
104
|
+
}
|
|
105
|
+
runMigrationsSqlite(db);
|
|
106
|
+
console.log("Done.");
|
|
107
|
+
db.close();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
console.error(`Migration failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
}))
|
|
115
|
+
.action(async function () {
|
|
116
|
+
// Default action: show help when called without subcommand
|
|
117
|
+
this.help();
|
|
118
|
+
});
|
|
119
|
+
//# sourceMappingURL=migrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../src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AK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CACxE,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CACL;KACA,MAAM,CAAC,KAAK;IACX,2DAA2D;IAC3D,IAAI,CAAC,IAAI,EAAE,CAAC;AACd,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import type { PipelineConfig, RepoConfig, Notifier } from "@urateam/core";
|
|
3
|
+
/**
|
|
4
|
+
* Loads a pipeline config module and returns the record of pipeline configs.
|
|
5
|
+
* Supports both `export const pipelines = ...` and `export default ...`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function loadPipelineConfigModule(filePath: string): Promise<Record<string, unknown>>;
|
|
8
|
+
/**
|
|
9
|
+
* Loads a repos config module and returns the record of repo configs.
|
|
10
|
+
* Supports both `export const repos = ...` and `export default ...`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function loadRepoConfigModule(filePath: string): Promise<Record<string, unknown>>;
|
|
13
|
+
/**
|
|
14
|
+
* Returns a copy of `config` with `stages` filtered to only include `stage`.
|
|
15
|
+
* Throws if `stage` is not present in the pipeline's stages.
|
|
16
|
+
*/
|
|
17
|
+
export declare function filterPipelineToStage(config: PipelineConfig, stage: string): PipelineConfig;
|
|
18
|
+
/**
|
|
19
|
+
* Resolves which repo config to use.
|
|
20
|
+
* Prefers a match by teamId, falls back to the first entry.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveRepoConfig(repoConfigs: Record<string, RepoConfig>, teamId: string): RepoConfig | null;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a simple console-based notifier for local runs.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createConsoleNotifier(): Notifier;
|
|
27
|
+
export declare const runCommand: Command;
|
|
28
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,QAAQ,EAKT,MAAM,eAAe,CAAC;AAOvB;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAIlC;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAIlC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,MAAM,GACZ,cAAc,CAOhB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EACvC,MAAM,EAAE,MAAM,GACb,UAAU,GAAG,IAAI,CAKnB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,QAAQ,CA4ChD;AAMD,eAAO,MAAM,UAAU,SA4PnB,CAAC"}
|