@moda-ai/cli 1.31.1 → 1.32.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.
@@ -8,7 +8,7 @@ import {
8
8
  saveProfileConfig,
9
9
  secretFilePathFromRef,
10
10
  writeSecretJsonFile
11
- } from "./cli-59yacef3.js";
11
+ } from "./cli-drabjmaj.js";
12
12
 
13
13
  // src/auth-storage.ts
14
14
  import { existsSync, readFileSync, rmSync } from "node:fs";
package/dist/cli.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  runPromptsCommand,
9
9
  runSkillsCommand,
10
10
  runStatusCommand
11
- } from "./cli-j3rr0nh7.js";
11
+ } from "./cli-w22qhyk4.js";
12
12
  import {
13
13
  ApiError,
14
14
  HARNESS_REPORT_APPROVAL_PATH,
@@ -29,7 +29,7 @@ import {
29
29
  summarizeHarness,
30
30
  terminalStyles,
31
31
  validateHarnessReport
32
- } from "./cli-p3271yp2.js";
32
+ } from "./cli-bh8gxmm8.js";
33
33
  import {
34
34
  authFetch,
35
35
  clearAuthSession,
@@ -37,7 +37,7 @@ import {
37
37
  loadAuthSession,
38
38
  login,
39
39
  revokeCliSessionToken
40
- } from "./cli-9xw5bq1j.js";
40
+ } from "./cli-yz99t7n8.js";
41
41
  import {
42
42
  AGENT_ERROR_CODES,
43
43
  CliAccessError,
@@ -84,7 +84,7 @@ import {
84
84
  validateConfig,
85
85
  wasOutputCancelled,
86
86
  writeSecretJsonFile
87
- } from "./cli-59yacef3.js";
87
+ } from "./cli-drabjmaj.js";
88
88
 
89
89
  // src/cli.ts
90
90
  import { z as z2 } from "zod";
@@ -5394,7 +5394,7 @@ Commands:
5394
5394
  prompts init Create .moda/prompts.yml
5395
5395
  prompts status Show local prompt changes
5396
5396
  prompts diff Show local prompt changes
5397
- prompts sync Upload changed prompt versions
5397
+ prompts sync Analyze prompt sources and upload versions
5398
5398
  prompts sync --watch Upload again when prompt files change
5399
5399
  prompts promote <key> Move a dev/staging/prod label
5400
5400
  prompts ab Run a judged prompt A/B replay experiment
@@ -5538,6 +5538,7 @@ Init flags:
5538
5538
  --analyst-model=MODEL Model for the claude analyst (default: sonnet;
5539
5539
  "default" = the claude CLI's own default;
5540
5540
  env: MODA_HARNESS_ANALYST_MODEL)
5541
+ --assist=none Disable agent fallback for prompt discovery
5541
5542
  --concern=topology|tools|prompts|evals
5542
5543
  Harness analyze: restrict the pass to one
5543
5544
  concern (whole repo, one report scope); an
@@ -5597,7 +5598,7 @@ Examples:
5597
5598
  moda --agent doctor
5598
5599
  moda agent context
5599
5600
  moda agent next-action
5600
- moda agent evidence doctor:harness_report_approved_synced
5601
+ moda agent evidence doctor:api_key_resolves
5601
5602
  moda investigate
5602
5603
  moda failures
5603
5604
  moda ask "what should I fix first?"
@@ -6579,7 +6580,7 @@ var commandRegistry = createCommandRegistry([
6579
6580
  resetApiRequestCountBeforeRun: true,
6580
6581
  telemetry: "result",
6581
6582
  handler: async (context) => {
6582
- const { runInit } = await import("./index-4enh6fq6.js");
6583
+ const { runInit } = await import("./index-tbrrfhhf.js");
6583
6584
  if (context.outputMode === "agent-stream") {
6584
6585
  context.output.writeEvent({
6585
6586
  event: "started",
@@ -6620,7 +6621,7 @@ var commandRegistry = createCommandRegistry([
6620
6621
  resetApiRequestCountBeforeRun: true,
6621
6622
  telemetry: "result-and-error",
6622
6623
  handler: async (context) => {
6623
- const { runProvision } = await import("./provision-r0cq3g2v.js");
6624
+ const { runProvision } = await import("./provision-d242y9qd.js");
6624
6625
  return runProvision(context, {
6625
6626
  resumeCommand: buildResumeCommand("provision", context.rawFlags)
6626
6627
  });
@@ -6822,7 +6823,7 @@ var commandRegistry = createCommandRegistry([
6822
6823
  "moda agent context",
6823
6824
  "moda agent investigate",
6824
6825
  "moda agent next-action",
6825
- "moda agent evidence doctor:harness_report_approved_synced"
6826
+ "moda agent evidence doctor:api_key_resolves"
6826
6827
  ],
6827
6828
  auth: "none",
6828
6829
  outputModes: ["agent", "agent-stream", "json"],
@@ -7054,8 +7055,8 @@ var commandRegistry = createCommandRegistry([
7054
7055
  {
7055
7056
  name: "init",
7056
7057
  description: "Create .moda/prompts.yml in the current directory (never overwrites)",
7057
- usage: "moda prompts init",
7058
- flags: [],
7058
+ usage: "moda prompts init [--from-harness=<report>]",
7059
+ flags: [{ name: "--from-harness=<report>", description: "Register verified source mappings from a harness report; source files stay in place." }],
7059
7060
  examples: ["moda prompts init", "cd /path/to/project && moda prompts init"]
7060
7061
  },
7061
7062
  {
@@ -7072,10 +7073,15 @@ var commandRegistry = createCommandRegistry([
7072
7073
  },
7073
7074
  {
7074
7075
  name: "sync",
7075
- description: "Upload changed prompt versions to Moda Cloud",
7076
- usage: "moda prompts sync [--watch] [--dry-run]",
7076
+ description: "Analyze prompt sources and upload verified versions to Moda Cloud",
7077
+ usage: "moda prompts sync [--analyst=local-scan|claude|codex|cursor|auto] [--no-analyze] [--from-harness=<report>] [--watch] [--dry-run]",
7077
7078
  flags: [
7078
- { name: "--watch", description: "Re-upload whenever a prompt file changes." },
7079
+ { name: "--analyst=local-scan|claude|codex|cursor|auto", description: "Prompt discovery analyst; defaults to deterministic local-scan. Other values enable bounded agent fallback." },
7080
+ { name: "--assist=none", description: "Disable agent fallback, including with an explicit analyst." },
7081
+ { name: "--no-analyze", description: "Skip discovery and sync only configured sources." },
7082
+ { name: "--from-harness=<report>", description: "Read and register harness prompt source mappings before sync." },
7083
+ { name: "--allow-untrack", description: "Explicitly remove missing keys from local tracking; registry history remains." },
7084
+ { name: "--watch", description: "Analyze before syncing; re-upload when mapped prompt files change." },
7079
7085
  { name: "--dry-run", description: "Show what would be uploaded without writing." }
7080
7086
  ],
7081
7087
  examples: ["moda prompts sync", "moda prompts sync --dry-run"]
@@ -0,0 +1,91 @@
1
+ import {
2
+ CONCERN_CANDIDATE_KINDS,
3
+ HARNESS_ANALYZE_CONCERNS,
4
+ SEED_CANDIDATE_KIND_LABELS,
5
+ analystEventProgress,
6
+ analyzeHarnessPrompts,
7
+ assertHarnessGraphSyncQuality,
8
+ buildSourceSnapshot,
9
+ codingAgentDisplayName,
10
+ computeDeterministicFloor,
11
+ deriveRelationshipsFromGraph,
12
+ describeCodingAgentEvent,
13
+ describeSyncIdentity,
14
+ describeSyncTenantLabel,
15
+ detectAvailableCodingAgents,
16
+ emitWrittenArtifacts,
17
+ findFresherHarnessReports,
18
+ graphForSync,
19
+ inventoryFiles,
20
+ isDeterministicLocalAnalyst,
21
+ isRetryableExternalAnalystFailure,
22
+ mergeDeterministicArtifacts,
23
+ numericEnv,
24
+ numericEnvAllowZero,
25
+ promptNameFromPath,
26
+ readHarnessSyncState,
27
+ renderAnalystCandidateLines,
28
+ renderAnalystSeedLines,
29
+ renderExternalHarnessAnalystPrompt,
30
+ repairExternalAnalystReport,
31
+ resolveAnalystModel,
32
+ resolveHarnessAnalyzeConcern,
33
+ runCodingAgent,
34
+ runHarnessCommand,
35
+ scanHarness,
36
+ sleep,
37
+ stableId,
38
+ summarizeHarness,
39
+ summarizeInvalidAnalystReport,
40
+ titleFromId,
41
+ truncateText,
42
+ writeHarnessAnalyzeResult,
43
+ writeHarnessArtifacts,
44
+ writeHumanProgress
45
+ } from "./cli-bh8gxmm8.js";
46
+ import"./cli-drabjmaj.js";
47
+ export {
48
+ writeHumanProgress,
49
+ writeHarnessArtifacts,
50
+ writeHarnessAnalyzeResult,
51
+ truncateText,
52
+ titleFromId,
53
+ summarizeInvalidAnalystReport,
54
+ summarizeHarness,
55
+ stableId,
56
+ sleep,
57
+ scanHarness,
58
+ runHarnessCommand,
59
+ runCodingAgent,
60
+ resolveHarnessAnalyzeConcern,
61
+ resolveAnalystModel,
62
+ repairExternalAnalystReport,
63
+ renderExternalHarnessAnalystPrompt,
64
+ renderAnalystSeedLines,
65
+ renderAnalystCandidateLines,
66
+ readHarnessSyncState,
67
+ promptNameFromPath,
68
+ numericEnvAllowZero,
69
+ numericEnv,
70
+ mergeDeterministicArtifacts,
71
+ isRetryableExternalAnalystFailure,
72
+ isDeterministicLocalAnalyst,
73
+ inventoryFiles,
74
+ graphForSync,
75
+ findFresherHarnessReports,
76
+ emitWrittenArtifacts,
77
+ detectAvailableCodingAgents,
78
+ describeSyncTenantLabel,
79
+ describeSyncIdentity,
80
+ describeCodingAgentEvent,
81
+ deriveRelationshipsFromGraph,
82
+ computeDeterministicFloor,
83
+ codingAgentDisplayName,
84
+ buildSourceSnapshot,
85
+ assertHarnessGraphSyncQuality,
86
+ analyzeHarnessPrompts,
87
+ analystEventProgress,
88
+ SEED_CANDIDATE_KIND_LABELS,
89
+ HARNESS_ANALYZE_CONCERNS,
90
+ CONCERN_CANDIDATE_KINDS
91
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  buildSourceSnapshot
3
- } from "./cli-p3271yp2.js";
4
- import"./cli-59yacef3.js";
3
+ } from "./cli-bh8gxmm8.js";
4
+ import"./cli-drabjmaj.js";
5
5
 
6
6
  // src/harness-github-actions.ts
7
7
  var DEFAULT_MODA_GITHUB_URL = "https://moda-github.modas.workers.dev";
@@ -10,7 +10,7 @@ import {
10
10
  runPromptSync,
11
11
  runSkillSync,
12
12
  upsertSkillManifestRecord
13
- } from "./cli-j3rr0nh7.js";
13
+ } from "./cli-w22qhyk4.js";
14
14
  import {
15
15
  codingAgentDisplayName,
16
16
  describeCodingAgentEvent,
@@ -28,14 +28,14 @@ import {
28
28
  runHarnessCommand,
29
29
  startRemoteAnalyze,
30
30
  stripAnsi
31
- } from "./cli-p3271yp2.js";
31
+ } from "./cli-bh8gxmm8.js";
32
32
  import {
33
33
  selectTenantAndCreateKey
34
- } from "./cli-pq6rte0w.js";
34
+ } from "./cli-scjxgaba.js";
35
35
  import {
36
36
  loadToken,
37
37
  login
38
- } from "./cli-9xw5bq1j.js";
38
+ } from "./cli-yz99t7n8.js";
39
39
  import {
40
40
  CliAuthError,
41
41
  CliInputError,
@@ -43,7 +43,7 @@ import {
43
43
  createCommandContext,
44
44
  resolveIngestUrl,
45
45
  resolveModaBaseUrl
46
- } from "./cli-59yacef3.js";
46
+ } from "./cli-drabjmaj.js";
47
47
 
48
48
  // src/init/index.ts
49
49
  import { existsSync as existsSync6, mkdirSync as mkdirSync5, readdirSync as readdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "node:fs";
@@ -2025,7 +2025,15 @@ Harness analysis keeps running on Moda. Resume anytime with \`${HARNESS_PULL_REC
2025
2025
  await initPrompts({ silent: true });
2026
2026
  laneBoard?.startLane("prompts", "Prompts", { detail: "Created or verified .moda/prompts.yml" });
2027
2027
  try {
2028
- const promptSync = await runPromptSync({}, { profile });
2028
+ const reportPath = join6(process.cwd(), ".moda/harness-report.json");
2029
+ let sourceReport;
2030
+ if (existsSync6(reportPath)) {
2031
+ const report = JSON.parse(readFileSync5(reportPath, "utf8"));
2032
+ const prompts = report?.graph?.artifacts?.filter((item) => item.type === "prompt") ?? [];
2033
+ if (prompts.length)
2034
+ sourceReport = reportPath;
2035
+ }
2036
+ const promptSync = await runPromptSync(sourceReport ? { "from-harness": sourceReport } : {}, { profile });
2029
2037
  laneBoard?.complete("prompts", promptSync.synced.length > 0 ? `${promptSync.synced.length} prompt(s) synced` : "manifest ready (no prompt files to sync yet)");
2030
2038
  } catch (err) {
2031
2039
  const message = err instanceof Error ? err.message : String(err);
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  selectTenantAndCreateKey
3
- } from "./cli-pq6rte0w.js";
3
+ } from "./cli-scjxgaba.js";
4
4
  import {
5
5
  loadAuthSession
6
- } from "./cli-9xw5bq1j.js";
6
+ } from "./cli-yz99t7n8.js";
7
7
  import {
8
8
  CliAuthError,
9
9
  resolveIngestUrl,
10
10
  resolveModaBaseUrl,
11
11
  stringOption
12
- } from "./cli-59yacef3.js";
12
+ } from "./cli-drabjmaj.js";
13
13
 
14
14
  // src/provision.ts
15
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.31.1",
3
+ "version": "1.32.0",
4
4
  "description": "CLI for Moda - AI agent analytics and observability",
5
5
  "type": "module",
6
6
  "bin": {
@@ -48,7 +48,9 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@inquirer/prompts": "^8.4.1",
51
+ "fast-glob": "^3.3.3",
51
52
  "open": "^11.0.0",
53
+ "yaml": "^2.9.1",
52
54
  "zod": "^3.24.1"
53
55
  },
54
56
  "devDependencies": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema_version": "moda.skill_index.v1",
3
- "bundled_at": "2026-09-15T20:51:36.329Z",
4
- "cli_version": "1.31.1",
3
+ "bundled_at": "2026-09-18T05:32:32.364Z",
4
+ "cli_version": "1.32.0",
5
5
  "skills": [
6
6
  {
7
7
  "id": "integration-cloudflare-think",
@@ -63,30 +63,33 @@ runtime termination does not have durable archival guarantees.
63
63
 
64
64
  ## 4. Ingest reusable prompts when requested
65
65
 
66
- Find the source prompt (`getSystemPrompt` or context configuration). Inline
67
- TypeScript is not discovered by `moda prompts`. Extract the reusable
68
- definition into a supported `.prompt.json` file and have the original hook
69
- read it. Run `moda prompts init` then `moda prompts sync`; require the
70
- expected definition to be present. Import `.moda/prompts.lock.json` at
71
- build time and pass its `{ key, promptId, versionId }` entry as `prompt`.
72
- Re-sync changed definitions before building.
73
-
74
- Use the CLI's actual JSON fields, for example:
75
-
76
- ```json
77
- {
78
- "key": "task-agent.system",
79
- "name": "Task agent system prompt",
80
- "systemPrompt": "The exact existing getSystemPrompt text goes here."
81
- }
66
+ Find the source prompt (`getSystemPrompt` or context configuration), preserving
67
+ its current location and assembly logic. With a CLI supporting source selectors:
68
+
69
+ ```bash
70
+ moda harness analyze --experimental --concern=prompts --analyst=local-scan
71
+ moda prompts init --from-harness=.moda/harness-report.json
72
+ moda prompts sync --dry-run
82
73
  ```
83
74
 
84
- Existing JSON definitions with a plain-text `template` are also accepted;
85
- the CLI maps that text to registered content without rewriting the file.
86
- Keep the application's existing prompt field and have `getSystemPrompt` read
87
- that same definition so runtime and registry cannot drift.
88
- Check the sync payload includes the actual text; a lock entry or
89
- version ID alone does not prove that a nonempty definition was registered.
75
+ Inspect each mapping and dry-run definition. Resolve missing sources with explicit
76
+ `.moda/prompts.yml` `sources` entries (stable `key`, repository-relative `path`,
77
+ `selector.symbol` or JSON/YAML `selector.pointer`). For unresolved code, an
78
+ installed coding agent can investigate via `--analyst=claude|codex|cursor`;
79
+ source resolution must still verify its mappings. Never substitute agent-written
80
+ prompt text or relocate inline code merely to satisfy discovery.
81
+
82
+ Static definitions can register as text/messages; runtime joins, conditions, and
83
+ functions register as builders with source/dependency fingerprints. Preserve
84
+ incomplete dependency coverage in the result. Do not replay builder source as
85
+ instructions. If the installed CLI lacks source selectors, report the release
86
+ prerequisite instead of rewriting the application's prompt construction.
87
+
88
+ Run `moda prompts sync` only after the expected definitions are present. Import
89
+ `.moda/prompts.lock.json` at build time and pass the matching
90
+ `{ key, promptId, versionId }` entry as `prompt`. Re-sync changed definitions before
91
+ building. Verify registered content/kind; a version ID alone does not prove that
92
+ the correct definition was registered.
90
93
 
91
94
  Keep memory and variable substitutions separate from reusable template
92
95
  versions. Think adds instructions/tools: verify actual system instructions