@moda-ai/cli 1.22.1 → 1.23.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/cli-c4se7a5d.js +762 -0
- package/dist/cli-mnqa4rp6.js +1563 -0
- package/dist/cli-stmjdgvy.js +2842 -0
- package/dist/cli-y55bgg14.js +6980 -0
- package/dist/cli-ysegdrm5.js +286 -0
- package/dist/cli.js +4779 -1159
- package/dist/harness-github-actions-7t3cncnt.js +95 -0
- package/dist/index-4ser01zr.js +2769 -0
- package/dist/provision-hm1ppwj6.js +74 -0
- package/package.json +3 -2
- package/skills/integration/index.json +2 -2
- package/dist/agent-schemas.d.ts +0 -3
- package/dist/agent-schemas.js +0 -358
- package/dist/agent.d.ts +0 -5
- package/dist/agent.js +0 -477
- package/dist/analyst-tui.d.ts +0 -81
- package/dist/analyst-tui.js +0 -314
- package/dist/api-client.d.ts +0 -46
- package/dist/api-client.js +0 -120
- package/dist/ask-stream.d.ts +0 -146
- package/dist/ask-stream.js +0 -473
- package/dist/auth-storage.d.ts +0 -35
- package/dist/auth-storage.js +0 -159
- package/dist/auth.d.ts +0 -50
- package/dist/auth.js +0 -694
- package/dist/cli-session.d.ts +0 -26
- package/dist/cli-session.js +0 -169
- package/dist/cli.d.ts +0 -44
- package/dist/command-context.d.ts +0 -62
- package/dist/command-context.js +0 -57
- package/dist/command-registry.d.ts +0 -22
- package/dist/command-registry.js +0 -15
- package/dist/config.d.ts +0 -60
- package/dist/config.js +0 -110
- package/dist/doctor.d.ts +0 -79
- package/dist/doctor.js +0 -1182
- package/dist/errors.d.ts +0 -50
- package/dist/errors.js +0 -64
- package/dist/exit-funnel.d.ts +0 -14
- package/dist/exit-funnel.js +0 -53
- package/dist/harness-artifact-bodies.d.ts +0 -28
- package/dist/harness-artifact-bodies.js +0 -276
- package/dist/harness-candidates.d.ts +0 -77
- package/dist/harness-candidates.js +0 -482
- package/dist/harness-remote.d.ts +0 -135
- package/dist/harness-remote.js +0 -540
- package/dist/harness-report.d.ts +0 -145
- package/dist/harness-report.js +0 -1579
- package/dist/harness-sync-limits.d.ts +0 -8
- package/dist/harness-sync-limits.js +0 -21
- package/dist/harness.d.ts +0 -463
- package/dist/harness.js +0 -4009
- package/dist/init/index.d.ts +0 -78
- package/dist/init/index.js +0 -1442
- package/dist/init/mcp.d.ts +0 -2
- package/dist/init/mcp.js +0 -27
- package/dist/init/progress-board.d.ts +0 -80
- package/dist/init/progress-board.js +0 -225
- package/dist/init/rules.d.ts +0 -6
- package/dist/init/rules.js +0 -171
- package/dist/init/sdk-catalog.d.ts +0 -10
- package/dist/init/sdk-catalog.js +0 -80
- package/dist/init/sdk-guide.d.ts +0 -19
- package/dist/init/sdk-guide.js +0 -185
- package/dist/init/sdk-integration.d.ts +0 -53
- package/dist/init/sdk-integration.js +0 -835
- package/dist/init/sdk-protocol.d.ts +0 -135
- package/dist/init/sdk-protocol.js +0 -152
- package/dist/init/sdk-verification.d.ts +0 -27
- package/dist/init/sdk-verification.js +0 -123
- package/dist/init/tenant.d.ts +0 -67
- package/dist/init/tenant.js +0 -421
- package/dist/intelligence-schema.d.ts +0 -349
- package/dist/intelligence-schema.js +0 -174
- package/dist/keys.d.ts +0 -47
- package/dist/keys.js +0 -136
- package/dist/manifest.d.ts +0 -5
- package/dist/manifest.js +0 -114
- package/dist/markdown-terminal.d.ts +0 -49
- package/dist/markdown-terminal.js +0 -212
- package/dist/output.d.ts +0 -191
- package/dist/output.js +0 -624
- package/dist/production-intelligence.d.ts +0 -175
- package/dist/production-intelligence.js +0 -1430
- package/dist/profile-commands.d.ts +0 -10
- package/dist/profile-commands.js +0 -342
- package/dist/profiles.d.ts +0 -112
- package/dist/profiles.js +0 -573
- package/dist/prompts-ab.d.ts +0 -71
- package/dist/prompts-ab.js +0 -313
- package/dist/prompts-propose.d.ts +0 -15
- package/dist/prompts-propose.js +0 -212
- package/dist/prompts.d.ts +0 -58
- package/dist/prompts.js +0 -418
- package/dist/provision.d.ts +0 -28
- package/dist/provision.js +0 -104
- package/dist/redact.d.ts +0 -2
- package/dist/redact.js +0 -90
- package/dist/schemas.d.ts +0 -225
- package/dist/schemas.js +0 -126
- package/dist/skills-bundled.d.ts +0 -35
- package/dist/skills-bundled.js +0 -157
- package/dist/skills-manifest.d.ts +0 -33
- package/dist/skills-manifest.js +0 -244
- package/dist/skills.d.ts +0 -57
- package/dist/skills.js +0 -783
- package/dist/sync.d.ts +0 -5
- package/dist/sync.js +0 -36
- package/dist/telemetry.d.ts +0 -56
- package/dist/telemetry.js +0 -167
- package/dist/transforms.d.ts +0 -25
- package/dist/transforms.js +0 -102
- package/dist/tui.d.ts +0 -48
- package/dist/tui.js +0 -393
- package/dist/update-check.d.ts +0 -31
- package/dist/update-check.js +0 -141
- package/dist/workspace.d.ts +0 -12
- package/dist/workspace.js +0 -1294
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildSourceSnapshot
|
|
3
|
+
} from "./cli-y55bgg14.js";
|
|
4
|
+
import"./cli-mnqa4rp6.js";
|
|
5
|
+
|
|
6
|
+
// src/harness-github-actions.ts
|
|
7
|
+
var DEFAULT_MODA_GITHUB_URL = "https://moda-github.modas.workers.dev";
|
|
8
|
+
var DEFAULT_GHA_AUDIENCE = "https://moda.dev/github-actions";
|
|
9
|
+
|
|
10
|
+
class GithubActionsAnalyzeError extends Error {
|
|
11
|
+
}
|
|
12
|
+
async function requestOidcToken(env, audience, fetchImpl) {
|
|
13
|
+
const requestUrl = env.ACTIONS_ID_TOKEN_REQUEST_URL;
|
|
14
|
+
const requestToken = env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;
|
|
15
|
+
if (!requestUrl || !requestToken) {
|
|
16
|
+
throw new GithubActionsAnalyzeError("GitHub Actions OIDC is unavailable. Ensure the workflow sets `permissions: id-token: write`.");
|
|
17
|
+
}
|
|
18
|
+
const url = `${requestUrl}${requestUrl.includes("?") ? "&" : "?"}audience=${encodeURIComponent(audience)}`;
|
|
19
|
+
const response = await fetchImpl(url, { headers: { Authorization: `Bearer ${requestToken}` } });
|
|
20
|
+
if (!response.ok) {
|
|
21
|
+
throw new GithubActionsAnalyzeError(`Failed to obtain GitHub OIDC token (${response.status}).`);
|
|
22
|
+
}
|
|
23
|
+
const body = await response.json();
|
|
24
|
+
if (!body.value)
|
|
25
|
+
throw new GithubActionsAnalyzeError("GitHub OIDC token response was empty.");
|
|
26
|
+
return body.value;
|
|
27
|
+
}
|
|
28
|
+
async function runGithubActionsAnalyze(rootDir, deps = {}) {
|
|
29
|
+
const env = deps.env ?? process.env;
|
|
30
|
+
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
31
|
+
const buildSnapshot = deps.buildSnapshot ?? buildSourceSnapshot;
|
|
32
|
+
const sleep = deps.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
33
|
+
const base = (env.MODA_GITHUB_URL || DEFAULT_MODA_GITHUB_URL).replace(/\/+$/, "");
|
|
34
|
+
const audience = env.MODA_GHA_AUDIENCE || DEFAULT_GHA_AUDIENCE;
|
|
35
|
+
const oidcToken = await requestOidcToken(env, audience, fetchImpl);
|
|
36
|
+
const exchangeRes = await fetchImpl(`${base}/gha/exchange`, {
|
|
37
|
+
method: "POST",
|
|
38
|
+
headers: { "Content-Type": "application/json" },
|
|
39
|
+
body: JSON.stringify({ oidcToken })
|
|
40
|
+
});
|
|
41
|
+
if (!exchangeRes.ok) {
|
|
42
|
+
throw new GithubActionsAnalyzeError(`Moda OIDC exchange failed (${exchangeRes.status}).`);
|
|
43
|
+
}
|
|
44
|
+
const exchange = await exchangeRes.json();
|
|
45
|
+
const authHeader = { Authorization: `Bearer ${exchange.token}`, "Content-Type": "application/json" };
|
|
46
|
+
const snapshot = buildSnapshot(rootDir);
|
|
47
|
+
const analyzeRes = await fetchImpl(`${base}/gha/analyze`, {
|
|
48
|
+
method: "POST",
|
|
49
|
+
headers: authHeader,
|
|
50
|
+
body: JSON.stringify({ snapshot })
|
|
51
|
+
});
|
|
52
|
+
if (!analyzeRes.ok) {
|
|
53
|
+
throw new GithubActionsAnalyzeError(`Hosted analysis submission failed (${analyzeRes.status}).`);
|
|
54
|
+
}
|
|
55
|
+
const { analysisRunId } = await analyzeRes.json();
|
|
56
|
+
const maxAttempts = deps.maxPollAttempts ?? 60;
|
|
57
|
+
const intervalMs = deps.pollIntervalMs ?? 15000;
|
|
58
|
+
let status = "running";
|
|
59
|
+
let report;
|
|
60
|
+
let validation;
|
|
61
|
+
for (let attempt = 0;attempt < maxAttempts; attempt += 1) {
|
|
62
|
+
const pollRes = await fetchImpl(`${base}/gha/analyze/${encodeURIComponent(analysisRunId)}`, { headers: { Authorization: authHeader.Authorization } });
|
|
63
|
+
if (!pollRes.ok)
|
|
64
|
+
throw new GithubActionsAnalyzeError(`Hosted analysis poll failed (${pollRes.status}).`);
|
|
65
|
+
const polled = await pollRes.json();
|
|
66
|
+
status = polled.status;
|
|
67
|
+
report = polled.report;
|
|
68
|
+
validation = polled.validation;
|
|
69
|
+
if (status === "completed" || status === "failed")
|
|
70
|
+
break;
|
|
71
|
+
await sleep(intervalMs);
|
|
72
|
+
}
|
|
73
|
+
const validationPassed = Boolean(report?.graph) && (validation?.valid === true || validation?.status === "pass");
|
|
74
|
+
if (status === "completed" && report && deps.writeReport) {
|
|
75
|
+
await deps.writeReport(report);
|
|
76
|
+
}
|
|
77
|
+
let synced = false;
|
|
78
|
+
if (status === "completed" && validationPassed && exchange.capabilities.includes("sync") && report) {
|
|
79
|
+
const syncRes = await fetchImpl(`${base}/gha/sync`, {
|
|
80
|
+
method: "POST",
|
|
81
|
+
headers: authHeader,
|
|
82
|
+
body: JSON.stringify({ analysisRunId })
|
|
83
|
+
});
|
|
84
|
+
if (!syncRes.ok)
|
|
85
|
+
throw new GithubActionsAnalyzeError(`Harness sync failed (${syncRes.status}).`);
|
|
86
|
+
synced = true;
|
|
87
|
+
}
|
|
88
|
+
return { analysisRunId, status, synced, capabilities: exchange.capabilities, validationPassed };
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
runGithubActionsAnalyze,
|
|
92
|
+
GithubActionsAnalyzeError,
|
|
93
|
+
DEFAULT_MODA_GITHUB_URL,
|
|
94
|
+
DEFAULT_GHA_AUDIENCE
|
|
95
|
+
};
|