@moda-ai/cli 1.22.2 → 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.
@@ -1,10 +1,12 @@
1
+ import {
2
+ authFetch,
3
+ getCachedLoginContext
4
+ } from "./cli-c4se7a5d.js";
1
5
  import {
2
6
  CliAccessError,
3
7
  CliInputError,
4
8
  CliInputRequiredError,
5
- authFetch,
6
9
  embeddedTenantIdFromApiKey,
7
- getCachedLoginContext,
8
10
  getModaDir,
9
11
  loadCliConfig,
10
12
  resolveApiKeyFromActiveProfile,
@@ -13,7 +15,7 @@ import {
13
15
  resolveTenantIdFromActiveProfile,
14
16
  saveCliConfig,
15
17
  writeSecretJsonFile
16
- } from "./cli-pwbvtes8.js";
18
+ } from "./cli-mnqa4rp6.js";
17
19
 
18
20
  // src/init/tenant.ts
19
21
  import { randomUUID } from "node:crypto";
package/dist/cli.js CHANGED
@@ -1,9 +1,15 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ buildDoctorReport,
4
+ runDoctorCommand,
5
+ runPromptsCommand,
6
+ runSkillsCommand,
7
+ runStatusCommand
8
+ } from "./cli-stmjdgvy.js";
2
9
  import {
3
10
  ApiError,
4
11
  HARNESS_REPORT_APPROVAL_PATH,
5
12
  HARNESS_REPORT_PATH,
6
- buildDoctorReport,
7
13
  callControlAPI,
8
14
  callDataAPI,
9
15
  getApiRequestCount,
@@ -14,17 +20,21 @@ import {
14
20
  readHarnessSyncState,
15
21
  renderMarkdownForTerminal,
16
22
  resetApiRequestCount,
17
- runDoctorCommand,
18
23
  runHarnessCommand,
19
- runPromptsCommand,
20
- runSkillsCommand,
21
- runStatusCommand,
22
24
  shouldColorTerminalOutput,
23
25
  stripAnsi,
24
26
  summarizeHarness,
25
27
  terminalStyles,
26
28
  validateHarnessReport
27
- } from "./cli-g8qs2tj9.js";
29
+ } from "./cli-y55bgg14.js";
30
+ import {
31
+ authFetch,
32
+ clearAuthSession,
33
+ isAuthSessionValid,
34
+ loadAuthSession,
35
+ login,
36
+ revokeCliSessionToken
37
+ } from "./cli-c4se7a5d.js";
28
38
  import {
29
39
  AGENT_ERROR_CODES,
30
40
  CliAccessError,
@@ -43,8 +53,6 @@ import {
43
53
  VERSION,
44
54
  __require,
45
55
  assertValidProfileName,
46
- authFetch,
47
- clearAuthSession,
48
56
  clearStoredApiKeyCredentials,
49
57
  createCliOutput,
50
58
  createCommandContext,
@@ -53,11 +61,8 @@ import {
53
61
  getModaDir,
54
62
  getModaPaths,
55
63
  isApiLikeError,
56
- isAuthSessionValid,
57
64
  isNetworkLikeError,
58
- loadAuthSession,
59
65
  loadProfileConfig,
60
- login,
61
66
  resolveApiKey,
62
67
  resolveApiKeyFromActiveProfile,
63
68
  resolveIngestUrl,
@@ -65,7 +70,6 @@ import {
65
70
  resolveOutputMode,
66
71
  resolveSecretReference,
67
72
  resolveTenantId,
68
- revokeCliSessionToken,
69
73
  safeWriteStderr,
70
74
  safeWriteStdout,
71
75
  secretFilePathFromRef,
@@ -74,7 +78,7 @@ import {
74
78
  validateConfig,
75
79
  wasOutputCancelled,
76
80
  writeSecretJsonFile
77
- } from "./cli-pwbvtes8.js";
81
+ } from "./cli-mnqa4rp6.js";
78
82
 
79
83
  // src/cli.ts
80
84
  import { z as z2 } from "zod";
@@ -4436,7 +4440,7 @@ var commandRegistry = createCommandRegistry([
4436
4440
  resetApiRequestCountBeforeRun: true,
4437
4441
  telemetry: "result",
4438
4442
  handler: async (context) => {
4439
- const { runInit } = await import("./index-6h0nc1r5.js");
4443
+ const { runInit } = await import("./index-4ser01zr.js");
4440
4444
  if (context.outputMode === "agent-stream") {
4441
4445
  context.output.writeEvent({
4442
4446
  event: "started",
@@ -4477,7 +4481,7 @@ var commandRegistry = createCommandRegistry([
4477
4481
  resetApiRequestCountBeforeRun: true,
4478
4482
  telemetry: "result-and-error",
4479
4483
  handler: async (context) => {
4480
- const { runProvision } = await import("./provision-j5gq8cvx.js");
4484
+ const { runProvision } = await import("./provision-hm1ppwj6.js");
4481
4485
  return runProvision(context, {
4482
4486
  resumeCommand: buildResumeCommand("provision", context.rawFlags)
4483
4487
  });
@@ -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
+ };
@@ -2,17 +2,22 @@ import {
2
2
  SKILL_SOURCE_INTEGRATION_BUNDLED,
3
3
  buildDoctorReport,
4
4
  claudeSkillToCursorRule,
5
+ detectAgents,
6
+ initPrompts,
7
+ installRules,
8
+ readSkillsManifest,
9
+ runPromptSync,
10
+ runSkillSync,
11
+ upsertSkillManifestRecord
12
+ } from "./cli-stmjdgvy.js";
13
+ import {
5
14
  codingAgentDisplayName,
6
15
  describeCodingAgentEvent,
7
16
  describeSyncIdentity,
8
17
  describeSyncTenantLabel,
9
- detectAgents,
10
18
  detectAvailableCodingAgents,
11
- initPrompts,
12
- installRules,
13
19
  isDeterministicLocalAnalyst,
14
20
  pollRemoteAnalyzeUntilDone,
15
- readSkillsManifest,
16
21
  renderInitBanner,
17
22
  renderInitComplete,
18
23
  renderInitNote,
@@ -20,25 +25,24 @@ import {
20
25
  renderInitStep,
21
26
  runCodingAgent,
22
27
  runHarnessCommand,
23
- runPromptSync,
24
- runSkillSync,
25
28
  startRemoteAnalyze,
26
- stripAnsi,
27
- upsertSkillManifestRecord
28
- } from "./cli-g8qs2tj9.js";
29
+ stripAnsi
30
+ } from "./cli-y55bgg14.js";
29
31
  import {
30
32
  selectTenantAndCreateKey
31
- } from "./cli-qszcpda3.js";
33
+ } from "./cli-ysegdrm5.js";
34
+ import {
35
+ loadToken,
36
+ login
37
+ } from "./cli-c4se7a5d.js";
32
38
  import {
33
39
  CliAuthError,
34
40
  CliInputError,
35
41
  VERSION,
36
42
  createCommandContext,
37
- loadToken,
38
- login,
39
43
  resolveIngestUrl,
40
44
  resolveModaBaseUrl
41
- } from "./cli-pwbvtes8.js";
45
+ } from "./cli-mnqa4rp6.js";
42
46
 
43
47
  // src/init/index.ts
44
48
  import { existsSync as existsSync6, mkdirSync as mkdirSync5, readdirSync as readdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "node:fs";
@@ -1,13 +1,15 @@
1
1
  import {
2
2
  selectTenantAndCreateKey
3
- } from "./cli-qszcpda3.js";
3
+ } from "./cli-ysegdrm5.js";
4
+ import {
5
+ loadAuthSession
6
+ } from "./cli-c4se7a5d.js";
4
7
  import {
5
8
  CliAuthError,
6
- loadAuthSession,
7
9
  resolveIngestUrl,
8
10
  resolveModaBaseUrl,
9
11
  stringOption
10
- } from "./cli-pwbvtes8.js";
12
+ } from "./cli-mnqa4rp6.js";
11
13
 
12
14
  // src/provision.ts
13
15
  async function runProvision(context, options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moda-ai/cli",
3
- "version": "1.22.2",
3
+ "version": "1.23.0",
4
4
  "description": "CLI for Moda - AI agent analytics and observability",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema_version": "moda.skill_index.v1",
3
- "bundled_at": "2026-07-22T22:34:35.167Z",
4
- "cli_version": "1.22.2",
3
+ "bundled_at": "2026-07-23T01:54:40.228Z",
4
+ "cli_version": "1.23.0",
5
5
  "skills": [
6
6
  {
7
7
  "id": "integration-node-anthropic",