@moda-ai/cli 1.55.8 → 1.55.10
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/README.md +1 -1
- package/dist/{cli-mx9r1689.js → cli-0qnghzg4.js} +1 -1
- package/dist/{cli-tw8jj190.js → cli-4f0p8erk.js} +1 -1
- package/dist/{cli-fhfdnvh4.js → cli-7s48d6ty.js} +2 -2
- package/dist/{cli-a0adscdx.js → cli-d3c95kks.js} +8 -8
- package/dist/{cli-j125g80g.js → cli-v27q5dvh.js} +785 -25
- package/dist/cli.js +45 -246
- package/dist/{harness-kpskdj9x.js → harness-0tnqw849.js} +2 -2
- package/dist/{harness-github-actions-t4m8q3wn.js → harness-github-actions-wpkr7jjr.js} +2 -2
- package/dist/{index-zdbe66yn.js → index-jqexf7kn.js} +13 -22
- package/dist/prompt-source-mcp.js +3 -3
- package/dist/{provision-parsn3xg.js → provision-5pkn25hh.js} +3 -3
- package/package.json +7 -7
- package/skills/integration/index.json +2 -2
- package/skills/moda-cli/SKILL.md +4 -4
- package/hooks/moda-snapshot.sh +0 -41
package/dist/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
runPromptsCommand,
|
|
9
9
|
runSkillsCommand,
|
|
10
10
|
runStatusCommand
|
|
11
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-d3c95kks.js";
|
|
12
12
|
import"./cli-mm48br00.js";
|
|
13
13
|
import {
|
|
14
14
|
ApiError,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
terminalStyles,
|
|
40
40
|
unknownSignalsSubcommandError,
|
|
41
41
|
validateHarnessReport
|
|
42
|
-
} from "./cli-
|
|
42
|
+
} from "./cli-v27q5dvh.js";
|
|
43
43
|
import"./cli-ssfq84k5.js";
|
|
44
44
|
import {
|
|
45
45
|
authFetch,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
loadAuthSession,
|
|
49
49
|
login,
|
|
50
50
|
revokeCliSessionToken
|
|
51
|
-
} from "./cli-
|
|
51
|
+
} from "./cli-4f0p8erk.js";
|
|
52
52
|
import {
|
|
53
53
|
AGENT_ERROR_CODES,
|
|
54
54
|
CliAccessError,
|
|
@@ -68,7 +68,6 @@ import {
|
|
|
68
68
|
VERSION,
|
|
69
69
|
agentEnvelopeFits,
|
|
70
70
|
agentMaxOutputBytes,
|
|
71
|
-
assertValidProfileName,
|
|
72
71
|
clearStoredApiKeyCredentials,
|
|
73
72
|
createCliOutput,
|
|
74
73
|
createCommandContext,
|
|
@@ -101,9 +100,8 @@ import {
|
|
|
101
100
|
setActiveProfile,
|
|
102
101
|
upsertProfile,
|
|
103
102
|
validateConfig,
|
|
104
|
-
wasOutputCancelled
|
|
105
|
-
|
|
106
|
-
} from "./cli-mx9r1689.js";
|
|
103
|
+
wasOutputCancelled
|
|
104
|
+
} from "./cli-0qnghzg4.js";
|
|
107
105
|
import {
|
|
108
106
|
__require
|
|
109
107
|
} from "./cli-0v6na3yp.js";
|
|
@@ -4946,124 +4944,6 @@ async function probeApiKey(key, options = {}) {
|
|
|
4946
4944
|
return { outcome: "live" };
|
|
4947
4945
|
}
|
|
4948
4946
|
|
|
4949
|
-
// src/keys.ts
|
|
4950
|
-
import { createHash as createHash2 } from "node:crypto";
|
|
4951
|
-
import { existsSync as existsSync3, readFileSync as readFileSync4 } from "node:fs";
|
|
4952
|
-
import { join as join3 } from "node:path";
|
|
4953
|
-
function keySecretRef(profile, keyId) {
|
|
4954
|
-
assertValidProfileName(profile);
|
|
4955
|
-
assertSafeKeyId(keyId);
|
|
4956
|
-
return `file:secrets/api-keys/${profile}/${keyId}.json`;
|
|
4957
|
-
}
|
|
4958
|
-
function createLocalKeyDescriptor(input) {
|
|
4959
|
-
assertValidProfileName(input.profile);
|
|
4960
|
-
const now = input.now ?? new Date;
|
|
4961
|
-
const id = stableKeyId(input.profile, input.name, now);
|
|
4962
|
-
return {
|
|
4963
|
-
id,
|
|
4964
|
-
profile: input.profile,
|
|
4965
|
-
name: input.name,
|
|
4966
|
-
purpose: input.purpose ?? "data_api",
|
|
4967
|
-
environment: input.environment,
|
|
4968
|
-
tenant_id: input.tenant_id,
|
|
4969
|
-
workspace_id: input.workspace_id,
|
|
4970
|
-
secret_ref: input.secret_ref ?? keySecretRef(input.profile, id),
|
|
4971
|
-
status: "active",
|
|
4972
|
-
created_at: now.toISOString()
|
|
4973
|
-
};
|
|
4974
|
-
}
|
|
4975
|
-
function validateKeyDescriptor(descriptor) {
|
|
4976
|
-
assertValidProfileName(descriptor.profile);
|
|
4977
|
-
assertSafeKeyId(descriptor.id);
|
|
4978
|
-
if (!descriptor.name.trim()) {
|
|
4979
|
-
throw new Error("Key name is required.");
|
|
4980
|
-
}
|
|
4981
|
-
if (descriptor.status !== "active" && descriptor.status !== "rotating" && descriptor.status !== "revoked") {
|
|
4982
|
-
throw new Error(`Invalid key status '${descriptor.status}'.`);
|
|
4983
|
-
}
|
|
4984
|
-
if (descriptor.purpose !== "data_api" && descriptor.purpose !== "ingest" && descriptor.purpose !== "automation") {
|
|
4985
|
-
throw new Error(`Invalid key purpose '${descriptor.purpose}'.`);
|
|
4986
|
-
}
|
|
4987
|
-
if (descriptor.environment !== "local" && descriptor.environment !== "dev" && descriptor.environment !== "staging" && descriptor.environment !== "prod") {
|
|
4988
|
-
throw new Error(`Invalid key environment '${descriptor.environment}'.`);
|
|
4989
|
-
}
|
|
4990
|
-
if (!descriptor.secret_ref.startsWith("file:")) {
|
|
4991
|
-
throw new Error("Local key descriptors must point to a file: secret ref.");
|
|
4992
|
-
}
|
|
4993
|
-
}
|
|
4994
|
-
function writeLocalApiKeySecret(descriptor, apiKey, options = {}) {
|
|
4995
|
-
validateKeyDescriptor(descriptor);
|
|
4996
|
-
if (!apiKey.trim()) {
|
|
4997
|
-
throw new Error("API key value is required.");
|
|
4998
|
-
}
|
|
4999
|
-
const path = secretFilePathFromRef(descriptor.secret_ref, options);
|
|
5000
|
-
if (!path) {
|
|
5001
|
-
throw new Error(`Unsupported key secret reference: ${descriptor.secret_ref}`);
|
|
5002
|
-
}
|
|
5003
|
-
writeSecretJsonFile(path, {
|
|
5004
|
-
value: apiKey,
|
|
5005
|
-
key_id: descriptor.id,
|
|
5006
|
-
profile: descriptor.profile,
|
|
5007
|
-
purpose: descriptor.purpose,
|
|
5008
|
-
created_at: descriptor.created_at
|
|
5009
|
-
});
|
|
5010
|
-
return path;
|
|
5011
|
-
}
|
|
5012
|
-
function keyDescriptorStorePath(options = {}) {
|
|
5013
|
-
return join3(getModaPaths(options).dir, "keys.json");
|
|
5014
|
-
}
|
|
5015
|
-
function loadLocalKeyDescriptors(options = {}) {
|
|
5016
|
-
const path = keyDescriptorStorePath(options);
|
|
5017
|
-
try {
|
|
5018
|
-
if (!existsSync3(path))
|
|
5019
|
-
return [];
|
|
5020
|
-
const parsed = JSON.parse(readFileSync4(path, "utf8"));
|
|
5021
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
5022
|
-
return [];
|
|
5023
|
-
}
|
|
5024
|
-
const keys = parsed.keys;
|
|
5025
|
-
if (!Array.isArray(keys))
|
|
5026
|
-
return [];
|
|
5027
|
-
return keys.filter((key) => {
|
|
5028
|
-
try {
|
|
5029
|
-
validateKeyDescriptor(key);
|
|
5030
|
-
return true;
|
|
5031
|
-
} catch {
|
|
5032
|
-
return false;
|
|
5033
|
-
}
|
|
5034
|
-
});
|
|
5035
|
-
} catch {
|
|
5036
|
-
return [];
|
|
5037
|
-
}
|
|
5038
|
-
}
|
|
5039
|
-
function saveLocalKeyDescriptors(keys, options = {}) {
|
|
5040
|
-
for (const key of keys)
|
|
5041
|
-
validateKeyDescriptor(key);
|
|
5042
|
-
writeSecretJsonFile(keyDescriptorStorePath(options), {
|
|
5043
|
-
version: 1,
|
|
5044
|
-
keys
|
|
5045
|
-
});
|
|
5046
|
-
}
|
|
5047
|
-
function upsertLocalKeyDescriptor(descriptor, options = {}) {
|
|
5048
|
-
validateKeyDescriptor(descriptor);
|
|
5049
|
-
const keys = loadLocalKeyDescriptors(options);
|
|
5050
|
-
const next = [
|
|
5051
|
-
...keys.filter((key) => key.id !== descriptor.id),
|
|
5052
|
-
descriptor
|
|
5053
|
-
].sort((a, b) => a.created_at.localeCompare(b.created_at));
|
|
5054
|
-
saveLocalKeyDescriptors(next, options);
|
|
5055
|
-
return next;
|
|
5056
|
-
}
|
|
5057
|
-
function stableKeyId(profile, name, now) {
|
|
5058
|
-
const hash = createHash2("sha256").update(`${profile}\x00${name}\x00${now.toISOString()}`).digest("hex").slice(0, 12);
|
|
5059
|
-
return `key_${hash}`;
|
|
5060
|
-
}
|
|
5061
|
-
function assertSafeKeyId(keyId) {
|
|
5062
|
-
if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(keyId)) {
|
|
5063
|
-
throw new Error(`Invalid key id '${keyId}'. Use letters, numbers, dots, dashes, or underscores.`);
|
|
5064
|
-
}
|
|
5065
|
-
}
|
|
5066
|
-
|
|
5067
4947
|
// src/profile-commands.ts
|
|
5068
4948
|
var ONLINE_PROBE_TIMEOUT_MS = 5000;
|
|
5069
4949
|
function subcommand(context) {
|
|
@@ -5459,62 +5339,14 @@ async function runConfigCommand(context) {
|
|
|
5459
5339
|
});
|
|
5460
5340
|
return { exitCode: 0 };
|
|
5461
5341
|
}
|
|
5462
|
-
var KEYS_LOCAL_ONLY_NOTE = "moda keys manages local key descriptors in ~/.moda only; it does not list or change your tenant's server-side API keys (see Settings → Ingestion keys in the dashboard).";
|
|
5463
|
-
async function runKeysCommand(context) {
|
|
5464
|
-
switch (subcommand(context)) {
|
|
5465
|
-
case "list": {
|
|
5466
|
-
const profile = context.profile ?? (context.env.MODA_PROFILE?.trim() || undefined) ?? loadProfileConfig({ env: context.env }).active_profile;
|
|
5467
|
-
const keys = loadLocalKeyDescriptors({ env: context.env }).filter((key) => !profile || key.profile === profile);
|
|
5468
|
-
context.output.writeData({
|
|
5469
|
-
scope: "local_descriptors",
|
|
5470
|
-
profile,
|
|
5471
|
-
keys
|
|
5472
|
-
}, {
|
|
5473
|
-
warnings: [KEYS_LOCAL_ONLY_NOTE]
|
|
5474
|
-
});
|
|
5475
|
-
return { exitCode: 0 };
|
|
5476
|
-
}
|
|
5477
|
-
case "create": {
|
|
5478
|
-
const active = getActiveProfile({ profile: context.profile, env: context.env });
|
|
5479
|
-
const name = flag(context, "name") ?? `${active.name}-${Date.now()}`;
|
|
5480
|
-
const descriptor = createLocalKeyDescriptor({
|
|
5481
|
-
profile: active.name,
|
|
5482
|
-
environment: active.environment,
|
|
5483
|
-
name,
|
|
5484
|
-
purpose: "data_api",
|
|
5485
|
-
tenant_id: active.tenant_id,
|
|
5486
|
-
workspace_id: active.workspace_id
|
|
5487
|
-
});
|
|
5488
|
-
const value = flag(context, "value");
|
|
5489
|
-
const secretPath = value ? writeLocalApiKeySecret(descriptor, value, { env: context.env }) : undefined;
|
|
5490
|
-
upsertLocalKeyDescriptor(descriptor, { env: context.env });
|
|
5491
|
-
context.output.writeData({
|
|
5492
|
-
key: descriptor,
|
|
5493
|
-
secret_path: secretPath,
|
|
5494
|
-
scope: "local_descriptors"
|
|
5495
|
-
}, {
|
|
5496
|
-
warnings: [KEYS_LOCAL_ONLY_NOTE]
|
|
5497
|
-
});
|
|
5498
|
-
return { exitCode: 0 };
|
|
5499
|
-
}
|
|
5500
|
-
case "rotate":
|
|
5501
|
-
case "revoke": {
|
|
5502
|
-
const action = subcommand(context);
|
|
5503
|
-
const keyId = requirePositional(context, 1, `Usage: moda keys ${action} <key_id>`);
|
|
5504
|
-
throw new CliInputError(`moda keys ${action} is not supported: the CLI cannot ${action} server-side API keys (${keyId} was not changed).`, "Manage API keys in the dashboard at Settings → Ingestion keys.");
|
|
5505
|
-
}
|
|
5506
|
-
default:
|
|
5507
|
-
throw unknownSubcommandError("keys", subcommand(context), ["list", "create", "rotate", "revoke"]);
|
|
5508
|
-
}
|
|
5509
|
-
}
|
|
5510
5342
|
|
|
5511
5343
|
// src/agent.ts
|
|
5512
|
-
import { existsSync as
|
|
5513
|
-
import { join as
|
|
5344
|
+
import { existsSync as existsSync3, readFileSync as readFileSync4, statSync as statSync2 } from "node:fs";
|
|
5345
|
+
import { join as join3, relative as relative2, resolve as resolve3 } from "node:path";
|
|
5514
5346
|
var MODA_DIR = ".moda";
|
|
5515
|
-
var HARNESS_PATH =
|
|
5516
|
-
var HARNESS_REPORT_MARKDOWN_PATH =
|
|
5517
|
-
var HARNESS_SUMMARY_PATH =
|
|
5347
|
+
var HARNESS_PATH = join3(MODA_DIR, "harness.json");
|
|
5348
|
+
var HARNESS_REPORT_MARKDOWN_PATH = join3(MODA_DIR, "HARNESS_REPORT.md");
|
|
5349
|
+
var HARNESS_SUMMARY_PATH = join3(MODA_DIR, "HARNESS.md");
|
|
5518
5350
|
async function runAgentCommand(context) {
|
|
5519
5351
|
const subcommand2 = context.positionals[0] ?? "context";
|
|
5520
5352
|
switch (subcommand2) {
|
|
@@ -5558,22 +5390,6 @@ async function runAgentCommand(context) {
|
|
|
5558
5390
|
});
|
|
5559
5391
|
return { exitCode: 0 };
|
|
5560
5392
|
}
|
|
5561
|
-
case "ask": {
|
|
5562
|
-
const loaded = await buildAgentContext(context);
|
|
5563
|
-
const question = context.positionals.slice(1).join(" ").trim() || context.flags.question;
|
|
5564
|
-
context.output.writeData({
|
|
5565
|
-
schemaVersion: "agent_ask.v0.1",
|
|
5566
|
-
generatedAt: loaded.payload.generatedAt,
|
|
5567
|
-
question: question || null,
|
|
5568
|
-
answer: "Moda CLI can provide local harness context today. Cloud intelligence for free-form production questions belongs to the future Moda Ask layer.",
|
|
5569
|
-
recommendedActions: loaded.payload.recommendedActions,
|
|
5570
|
-
nextCommands: loaded.payload.nextCommands,
|
|
5571
|
-
evidenceRefs: loaded.payload.evidenceRefs
|
|
5572
|
-
}, agentWriteOptions(loaded, {
|
|
5573
|
-
summary: "Returned local Moda context and next commands for the requested agent question."
|
|
5574
|
-
}));
|
|
5575
|
-
return { exitCode: 0 };
|
|
5576
|
-
}
|
|
5577
5393
|
default:
|
|
5578
5394
|
throw new CliInputError(`Unknown agent subcommand '${subcommand2}'`, "Usage: moda agent context|next-action|evidence (for production issues use moda investigate)");
|
|
5579
5395
|
}
|
|
@@ -5618,7 +5434,7 @@ async function buildAgentContext(context) {
|
|
|
5618
5434
|
},
|
|
5619
5435
|
report: reportState.state,
|
|
5620
5436
|
sync: syncState ? {
|
|
5621
|
-
path:
|
|
5437
|
+
path: join3(MODA_DIR, "sync-state.json"),
|
|
5622
5438
|
exists: true,
|
|
5623
5439
|
source: syncState.source,
|
|
5624
5440
|
updatedAt: syncState.updatedAt,
|
|
@@ -5626,7 +5442,7 @@ async function buildAgentContext(context) {
|
|
|
5626
5442
|
remoteHarnessId: syncState.remote.harnessId,
|
|
5627
5443
|
remoteVersionId: syncState.remote.versionId
|
|
5628
5444
|
} : {
|
|
5629
|
-
path:
|
|
5445
|
+
path: join3(MODA_DIR, "sync-state.json"),
|
|
5630
5446
|
exists: false
|
|
5631
5447
|
}
|
|
5632
5448
|
},
|
|
@@ -5676,18 +5492,18 @@ function summarizeAgentContext(payload, noun) {
|
|
|
5676
5492
|
return `Local Moda ${noun} is healthy with ${agents} runtime agent(s).`;
|
|
5677
5493
|
}
|
|
5678
5494
|
function readHarnessGraphIfPresent(cwd) {
|
|
5679
|
-
const path =
|
|
5680
|
-
if (!
|
|
5495
|
+
const path = join3(cwd, HARNESS_PATH);
|
|
5496
|
+
if (!existsSync3(path))
|
|
5681
5497
|
return;
|
|
5682
5498
|
try {
|
|
5683
|
-
return JSON.parse(
|
|
5499
|
+
return JSON.parse(readFileSync4(path, "utf8"));
|
|
5684
5500
|
} catch {
|
|
5685
5501
|
return;
|
|
5686
5502
|
}
|
|
5687
5503
|
}
|
|
5688
5504
|
function readHarnessReportState(cwd) {
|
|
5689
|
-
const path =
|
|
5690
|
-
if (!
|
|
5505
|
+
const path = join3(cwd, HARNESS_REPORT_PATH);
|
|
5506
|
+
if (!existsSync3(path)) {
|
|
5691
5507
|
return {
|
|
5692
5508
|
state: {
|
|
5693
5509
|
path: HARNESS_REPORT_PATH,
|
|
@@ -5731,11 +5547,11 @@ function readHarnessReportState(cwd) {
|
|
|
5731
5547
|
}
|
|
5732
5548
|
}
|
|
5733
5549
|
function readApproval(cwd) {
|
|
5734
|
-
const path =
|
|
5735
|
-
if (!
|
|
5550
|
+
const path = join3(cwd, HARNESS_REPORT_APPROVAL_PATH);
|
|
5551
|
+
if (!existsSync3(path))
|
|
5736
5552
|
return;
|
|
5737
5553
|
try {
|
|
5738
|
-
return JSON.parse(
|
|
5554
|
+
return JSON.parse(readFileSync4(path, "utf8"));
|
|
5739
5555
|
} catch {
|
|
5740
5556
|
return;
|
|
5741
5557
|
}
|
|
@@ -5811,9 +5627,9 @@ function existingArtifacts(cwd) {
|
|
|
5811
5627
|
[HARNESS_REPORT_PATH, "harness_report", "Cited harness analyst report."],
|
|
5812
5628
|
[HARNESS_REPORT_MARKDOWN_PATH, "harness_report_markdown", "Human-readable harness analyst report."],
|
|
5813
5629
|
[HARNESS_SUMMARY_PATH, "harness_summary", "Human-readable harness graph summary."],
|
|
5814
|
-
[
|
|
5815
|
-
[
|
|
5816
|
-
].flatMap(([path, kind, description]) =>
|
|
5630
|
+
[join3(MODA_DIR, "sync-state.json"), "sync_state", "Last local harness sync state."],
|
|
5631
|
+
[join3(MODA_DIR, "prompts.yml"), "prompt_manifest", "Local prompt discovery manifest."]
|
|
5632
|
+
].flatMap(([path, kind, description]) => existsSync3(join3(cwd, path)) ? [{ path, kind, description }] : []);
|
|
5817
5633
|
}
|
|
5818
5634
|
function expandEvidenceRef(ref, loaded, cwd) {
|
|
5819
5635
|
if (ref.startsWith("doctor:")) {
|
|
@@ -5894,9 +5710,9 @@ function readCitationExcerpt(cwd, citation) {
|
|
|
5894
5710
|
if (!citation.path || citation.type !== "file" && citation.type !== "generated_doc")
|
|
5895
5711
|
return citation.excerpt;
|
|
5896
5712
|
const absolute = safeResolve(cwd, citation.path);
|
|
5897
|
-
if (!absolute || !
|
|
5713
|
+
if (!absolute || !existsSync3(absolute))
|
|
5898
5714
|
return citation.excerpt;
|
|
5899
|
-
const text =
|
|
5715
|
+
const text = readFileSync4(absolute, "utf8");
|
|
5900
5716
|
if (citation.line && citation.line > 0) {
|
|
5901
5717
|
return text.split(/\r?\n/)[citation.line - 1] ?? citation.excerpt;
|
|
5902
5718
|
}
|
|
@@ -5907,13 +5723,13 @@ function readModaArtifact(cwd, artifactPath) {
|
|
|
5907
5723
|
throw new CliInputError(`Artifact '${artifactPath}' is outside .moda and cannot be expanded directly.`, "Use a citation evidence ref for source-file evidence.");
|
|
5908
5724
|
}
|
|
5909
5725
|
const absolute = safeResolve(cwd, artifactPath);
|
|
5910
|
-
if (!absolute || !
|
|
5726
|
+
if (!absolute || !existsSync3(absolute))
|
|
5911
5727
|
throw missingEvidence(`artifact:${artifactPath}`);
|
|
5912
5728
|
const size = statSync2(absolute).size;
|
|
5913
5729
|
return {
|
|
5914
5730
|
path: artifactPath,
|
|
5915
5731
|
bytes: size,
|
|
5916
|
-
text:
|
|
5732
|
+
text: readFileSync4(absolute, "utf8")
|
|
5917
5733
|
};
|
|
5918
5734
|
}
|
|
5919
5735
|
function safeResolve(cwd, path) {
|
|
@@ -5951,8 +5767,8 @@ function purposeForCommand(command) {
|
|
|
5951
5767
|
}
|
|
5952
5768
|
|
|
5953
5769
|
// src/production-intelligence.ts
|
|
5954
|
-
import { existsSync as
|
|
5955
|
-
import { join as
|
|
5770
|
+
import { existsSync as existsSync4, readFileSync as readFileSync5 } from "node:fs";
|
|
5771
|
+
import { join as join4 } from "node:path";
|
|
5956
5772
|
|
|
5957
5773
|
// src/ask-stream.ts
|
|
5958
5774
|
class AskStreamError extends Error {
|
|
@@ -7465,12 +7281,12 @@ function loadHarnessHints(cwd) {
|
|
|
7465
7281
|
skillPaths: new Map,
|
|
7466
7282
|
entrypointPaths: []
|
|
7467
7283
|
};
|
|
7468
|
-
const harnessPath =
|
|
7469
|
-
if (!
|
|
7284
|
+
const harnessPath = join4(cwd, ".moda", "harness.json");
|
|
7285
|
+
if (!existsSync4(harnessPath))
|
|
7470
7286
|
return hints;
|
|
7471
7287
|
hints.reportPath = ".moda/harness.json";
|
|
7472
7288
|
try {
|
|
7473
|
-
const parsed = JSON.parse(
|
|
7289
|
+
const parsed = JSON.parse(readFileSync5(harnessPath, "utf8"));
|
|
7474
7290
|
const graph = asRecord(parsed);
|
|
7475
7291
|
const artifacts = Array.isArray(graph?.artifacts) ? graph.artifacts : [];
|
|
7476
7292
|
for (const item of artifacts) {
|
|
@@ -7498,11 +7314,11 @@ function loadHarnessHints(cwd) {
|
|
|
7498
7314
|
return hints;
|
|
7499
7315
|
}
|
|
7500
7316
|
function localHarnessSummary(cwd) {
|
|
7501
|
-
const path =
|
|
7502
|
-
if (!
|
|
7317
|
+
const path = join4(cwd, ".moda", "harness.json");
|
|
7318
|
+
if (!existsSync4(path))
|
|
7503
7319
|
return null;
|
|
7504
7320
|
try {
|
|
7505
|
-
const parsed = JSON.parse(
|
|
7321
|
+
const parsed = JSON.parse(readFileSync5(path, "utf8"));
|
|
7506
7322
|
return {
|
|
7507
7323
|
harnessId: parsed.harnessId,
|
|
7508
7324
|
graphHash: parsed.graphHash,
|
|
@@ -7513,16 +7329,16 @@ function localHarnessSummary(cwd) {
|
|
|
7513
7329
|
}
|
|
7514
7330
|
}
|
|
7515
7331
|
function localSyncBrief(cwd, relativePath, label) {
|
|
7516
|
-
const path =
|
|
7517
|
-
if (!
|
|
7332
|
+
const path = join4(cwd, relativePath);
|
|
7333
|
+
if (!existsSync4(path)) {
|
|
7518
7334
|
return { status: "missing", summary: `${label} state not found`, path: relativePath };
|
|
7519
7335
|
}
|
|
7520
7336
|
return { status: "present", summary: `${label} state exists locally`, path: relativePath };
|
|
7521
7337
|
}
|
|
7522
7338
|
function localSkillBrief(cwd) {
|
|
7523
|
-
const claudeSkill =
|
|
7524
|
-
const cursorRules =
|
|
7525
|
-
if (
|
|
7339
|
+
const claudeSkill = join4(cwd, ".claude", "skills");
|
|
7340
|
+
const cursorRules = join4(cwd, ".cursor", "rules");
|
|
7341
|
+
if (existsSync4(claudeSkill) || existsSync4(cursorRules)) {
|
|
7526
7342
|
return { status: "present", summary: "Local agent skill/rule directory exists" };
|
|
7527
7343
|
}
|
|
7528
7344
|
return { status: "missing", summary: "No local agent skill/rule directory found" };
|
|
@@ -7960,7 +7776,6 @@ var RAW_BOOLEAN_FLAGS = new Set([
|
|
|
7960
7776
|
"no-clustering",
|
|
7961
7777
|
"no-analyze",
|
|
7962
7778
|
"improve-candidates",
|
|
7963
|
-
"hook-stdin",
|
|
7964
7779
|
"auto-generate",
|
|
7965
7780
|
"allow-no-agents",
|
|
7966
7781
|
"allow-any-model",
|
|
@@ -8099,8 +7914,6 @@ Commands:
|
|
|
8099
7914
|
profiles use <name> Switch active Moda profile
|
|
8100
7915
|
profiles create <name> Create or update a local Moda profile
|
|
8101
7916
|
profiles doctor [name] Validate a local Moda profile
|
|
8102
|
-
keys list List local key descriptors (not server-side API keys)
|
|
8103
|
-
keys create Create a local key descriptor
|
|
8104
7917
|
config show Show resolved Moda config
|
|
8105
7918
|
harness analyze Produce a cited structured harness report
|
|
8106
7919
|
harness pull Fetch a server-side analyze run (status, or result when done)
|
|
@@ -8291,7 +8104,7 @@ False-positive flags (moda false-positive <kind> <target>):
|
|
|
8291
8104
|
tool <conversation_id> One failing tool call; needs --tool and --tool-use-id (or --msg-index); audit only
|
|
8292
8105
|
laziness <conversation_id> Laziness on that trace; audit only
|
|
8293
8106
|
hallucination <conversation_id> Hallucinations on that trace; audit only
|
|
8294
|
-
custom-signal <signal_id> A hit on that trace (--conversation-id); saved as does_not_fit
|
|
8107
|
+
custom-signal <signal_id> A hit on that trace (--conversation-id); saved as does_not_fit, a labelled counterexample for the signal
|
|
8295
8108
|
|
|
8296
8109
|
Problem-linear-file flags (needs Linear connected: Integrations -> Linear):
|
|
8297
8110
|
--issue=ENG-123|URL Link an existing Linear issue instead of filing a new one
|
|
@@ -9245,7 +9058,7 @@ function normalizeBooleanFlags(target) {
|
|
|
9245
9058
|
}
|
|
9246
9059
|
return error;
|
|
9247
9060
|
}
|
|
9248
|
-
var PROFILE_MANAGING_COMMANDS = new Set(["profiles", "auth", "init", "provision", "status", "config", "
|
|
9061
|
+
var PROFILE_MANAGING_COMMANDS = new Set(["profiles", "auth", "init", "provision", "status", "config", "manifest", "agent", "doctor"]);
|
|
9249
9062
|
async function runProblemsRemainder(flags, context) {
|
|
9250
9063
|
const params = parseCommandFlags(ProblemsRemainderSchema, flagsToArgs(flags), "problems remainder");
|
|
9251
9064
|
const query2 = new URLSearchParams;
|
|
@@ -10492,8 +10305,6 @@ function initArtifactKind(file) {
|
|
|
10492
10305
|
return "prompt_manifest";
|
|
10493
10306
|
if (file.includes("workflow"))
|
|
10494
10307
|
return "ci_workflow";
|
|
10495
|
-
if (file.startsWith("~/"))
|
|
10496
|
-
return "agent_hook_config";
|
|
10497
10308
|
return "init_artifact";
|
|
10498
10309
|
}
|
|
10499
10310
|
var dataApiDefaults = {
|
|
@@ -10516,7 +10327,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
10516
10327
|
resetApiRequestCountBeforeRun: true,
|
|
10517
10328
|
telemetry: "result",
|
|
10518
10329
|
handler: async (context) => {
|
|
10519
|
-
const { runInit } = await import("./index-
|
|
10330
|
+
const { runInit } = await import("./index-jqexf7kn.js");
|
|
10520
10331
|
if (context.outputMode === "agent-stream") {
|
|
10521
10332
|
context.output.writeEvent({
|
|
10522
10333
|
event: "started",
|
|
@@ -10557,7 +10368,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
10557
10368
|
resetApiRequestCountBeforeRun: true,
|
|
10558
10369
|
telemetry: "result-and-error",
|
|
10559
10370
|
handler: async (context) => {
|
|
10560
|
-
const { runProvision } = await import("./provision-
|
|
10371
|
+
const { runProvision } = await import("./provision-5pkn25hh.js");
|
|
10561
10372
|
return runProvision(context, {
|
|
10562
10373
|
resumeCommand: buildResumeCommand("provision", context.rawFlags)
|
|
10563
10374
|
});
|
|
@@ -10731,18 +10542,6 @@ var commandRegistry = createCommandRegistry([
|
|
|
10731
10542
|
telemetry: "none",
|
|
10732
10543
|
handler: runConfigCommand
|
|
10733
10544
|
},
|
|
10734
|
-
{
|
|
10735
|
-
name: "keys",
|
|
10736
|
-
description: "Local key descriptors in ~/.moda only (not your server-side API keys; manage those in the dashboard)",
|
|
10737
|
-
examples: ["moda keys list", "moda keys create --name=local-dev"],
|
|
10738
|
-
auth: "none",
|
|
10739
|
-
outputModes: ["human", "json", "agent"],
|
|
10740
|
-
mutability: "write",
|
|
10741
|
-
validateConfigBeforeRun: false,
|
|
10742
|
-
resetApiRequestCountBeforeRun: false,
|
|
10743
|
-
telemetry: "none",
|
|
10744
|
-
handler: runKeysCommand
|
|
10745
|
-
},
|
|
10746
10545
|
{
|
|
10747
10546
|
name: "harness",
|
|
10748
10547
|
description: "Analyze, validate, approve, sync, delete, and explain the local multi-agent harness graph; register it for Replay Environments",
|
|
@@ -11242,7 +11041,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
11242
11041
|
}),
|
|
11243
11042
|
legacyCommand({
|
|
11244
11043
|
name: "step-scores",
|
|
11245
|
-
description: "
|
|
11044
|
+
description: "Step scores for a trace (per-segment curves, first bad step, rollup)",
|
|
11246
11045
|
examples: ["moda step-scores <conversation_id>"],
|
|
11247
11046
|
hidden: true,
|
|
11248
11047
|
...dataApiDefaults
|
|
@@ -42,8 +42,8 @@ import {
|
|
|
42
42
|
writeHarnessAnalyzeResult,
|
|
43
43
|
writeHarnessArtifacts,
|
|
44
44
|
writeHumanProgress
|
|
45
|
-
} from "./cli-
|
|
46
|
-
import"./cli-
|
|
45
|
+
} from "./cli-v27q5dvh.js";
|
|
46
|
+
import"./cli-0qnghzg4.js";
|
|
47
47
|
import"./cli-0v6na3yp.js";
|
|
48
48
|
export {
|
|
49
49
|
writeHumanProgress,
|
|
@@ -3,9 +3,10 @@ import {
|
|
|
3
3
|
initPrompts,
|
|
4
4
|
runPromptSync,
|
|
5
5
|
runSkillSync
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-d3c95kks.js";
|
|
7
7
|
import"./cli-mm48br00.js";
|
|
8
8
|
import {
|
|
9
|
+
canonicalText,
|
|
9
10
|
codingAgentDisplayName,
|
|
10
11
|
describeCodingAgentEvent,
|
|
11
12
|
describeSyncIdentity,
|
|
@@ -23,7 +24,7 @@ import {
|
|
|
23
24
|
runHarnessCommand,
|
|
24
25
|
startRemoteAnalyze,
|
|
25
26
|
stripAnsi
|
|
26
|
-
} from "./cli-
|
|
27
|
+
} from "./cli-v27q5dvh.js";
|
|
27
28
|
import {
|
|
28
29
|
bundledSkillsDir,
|
|
29
30
|
installIntegrationSkill,
|
|
@@ -35,14 +36,14 @@ import {
|
|
|
35
36
|
} from "./cli-ssfq84k5.js";
|
|
36
37
|
import {
|
|
37
38
|
selectTenantAndCreateKey
|
|
38
|
-
} from "./cli-
|
|
39
|
+
} from "./cli-7s48d6ty.js";
|
|
39
40
|
import {
|
|
40
41
|
ConnectCodeError,
|
|
41
42
|
connectWithCode,
|
|
42
43
|
loadAuthSession,
|
|
43
44
|
loadToken,
|
|
44
45
|
login
|
|
45
|
-
} from "./cli-
|
|
46
|
+
} from "./cli-4f0p8erk.js";
|
|
46
47
|
import {
|
|
47
48
|
CliAuthError,
|
|
48
49
|
CliInputError,
|
|
@@ -51,7 +52,7 @@ import {
|
|
|
51
52
|
recordApiRequest,
|
|
52
53
|
resolveIngestUrl,
|
|
53
54
|
resolveModaBaseUrl
|
|
54
|
-
} from "./cli-
|
|
55
|
+
} from "./cli-0qnghzg4.js";
|
|
55
56
|
import"./cli-0v6na3yp.js";
|
|
56
57
|
|
|
57
58
|
// src/init/index.ts
|
|
@@ -841,9 +842,11 @@ function renderSdkIntegrationPrompt(opts) {
|
|
|
841
842
|
""
|
|
842
843
|
] : [];
|
|
843
844
|
return [
|
|
845
|
+
canonicalText("init_prompt_line"),
|
|
846
|
+
"",
|
|
844
847
|
"You are running inside `moda init` as a one-shot SDK integration task. The user has",
|
|
845
848
|
"approved letting you install packages and edit source files in THIS repository to add",
|
|
846
|
-
"Moda
|
|
849
|
+
"the Moda SDK. Do the integration now — do not just describe it.",
|
|
847
850
|
"",
|
|
848
851
|
...SAFETY_RULES,
|
|
849
852
|
"",
|
|
@@ -1748,7 +1751,6 @@ async function runInit(flags, options = {}) {
|
|
|
1748
1751
|
let setupPlan = [];
|
|
1749
1752
|
const renderPlan = () => {
|
|
1750
1753
|
setupPlan = buildSetupPlan({
|
|
1751
|
-
installHooks: false,
|
|
1752
1754
|
integrateSdk,
|
|
1753
1755
|
configureCiCd,
|
|
1754
1756
|
configureAutosync,
|
|
@@ -1858,7 +1860,7 @@ async function runInit(flags, options = {}) {
|
|
|
1858
1860
|
board ??= new InitProgressBoard;
|
|
1859
1861
|
return board;
|
|
1860
1862
|
};
|
|
1861
|
-
const validationFailure = () => new CliInputError("Moda Analyst produced a harness report that did not pass validation.", "Review .moda/harness-report-validation.json, then rerun `moda init --local --analyst=claude|cursor|codex` or `moda harness analyze --analyst=local-scan --summary`.");
|
|
1863
|
+
const validationFailure = () => new CliInputError("Moda Analyst produced a harness report that did not pass validation.", "Review .moda/harness-report-validation.json, then rerun `moda init --local --analyst=claude|cursor|codex` or `moda harness analyze --analyst=local-scan --summary --experimental`.");
|
|
1862
1864
|
let harnessPhase = { id: "harness", title: "Harness discovery", status: "completed" };
|
|
1863
1865
|
let harnessDeferred = false;
|
|
1864
1866
|
let harnessSkipped = false;
|
|
@@ -1888,7 +1890,7 @@ async function runInit(flags, options = {}) {
|
|
|
1888
1890
|
} : undefined;
|
|
1889
1891
|
if (signals && harnessLooksIncomplete(signals)) {
|
|
1890
1892
|
const names = [...signals.frameworks, ...signals.providers].join(", ");
|
|
1891
|
-
const retryCommand = remote ? "moda harness analyze --remote --summary --experimental" : "moda harness analyze --analyst=claude|cursor|codex --summary";
|
|
1893
|
+
const retryCommand = remote ? "moda harness analyze --remote --summary --experimental" : "moda harness analyze --analyst=claude|cursor|codex --summary --experimental";
|
|
1892
1894
|
warn(renderInitNote(`Harness discovery found 0 runtime agents, but this repo has LLM framework signals (${names}). ` + "Discovery likely failed, so the result was NOT approved or synced.", "warning"));
|
|
1893
1895
|
warn(` Retry with \`${retryCommand}\`, then \`moda harness approve --yes && moda harness sync --from-report\`.`);
|
|
1894
1896
|
emit("harness", "Harness discovery found 0 agents despite LLM framework signals; sync withheld.", "warning");
|
|
@@ -2009,7 +2011,6 @@ Harness analysis keeps running on Moda. Resume anytime with \`${HARNESS_PULL_REC
|
|
|
2009
2011
|
}
|
|
2010
2012
|
emit("apply", "Applying approved setup changes.");
|
|
2011
2013
|
const laneBoard = startBoard();
|
|
2012
|
-
const ingestCodingAgentTraces = false;
|
|
2013
2014
|
const agents = detectAgents();
|
|
2014
2015
|
laneBoard?.startLane("agent-skills", "Agent skills");
|
|
2015
2016
|
if (agents.length > 0) {
|
|
@@ -2090,7 +2091,6 @@ Harness analysis keeps running on Moda. Resume anytime with \`${HARNESS_PULL_REC
|
|
|
2090
2091
|
} else {
|
|
2091
2092
|
markApplied(setupPlan, "sdk", "User skipped SDK integration.");
|
|
2092
2093
|
}
|
|
2093
|
-
markApplied(setupPlan, "hooks", ingestCodingAgentTraces ? undefined : "Coding-agent trace capture is temporarily unavailable.");
|
|
2094
2094
|
markApplied(setupPlan, "prompts");
|
|
2095
2095
|
markApplied(setupPlan, "skills");
|
|
2096
2096
|
if (remote && pollPromise && remoteRunId) {
|
|
@@ -2211,16 +2211,7 @@ function buildSetupPlan(options) {
|
|
|
2211
2211
|
".moda/harness.json",
|
|
2212
2212
|
".moda/HARNESS.md"
|
|
2213
2213
|
],
|
|
2214
|
-
command: options.remote ? "moda harness analyze --remote --summary && moda harness approve --yes && moda harness sync --from-report" : "moda harness analyze --analyst=auto --summary && moda harness approve --yes && moda harness sync --from-report"
|
|
2215
|
-
},
|
|
2216
|
-
{
|
|
2217
|
-
category: "hooks",
|
|
2218
|
-
title: "Install coding-agent trace hooks",
|
|
2219
|
-
status: options.installHooks ? "planned" : "skipped",
|
|
2220
|
-
approved: options.installHooks,
|
|
2221
|
-
files: ["~/.claude/settings.json", "~/.codex/hooks.json", "~/.cursor/hooks.json"],
|
|
2222
|
-
command: "moda hooks install --agent=all",
|
|
2223
|
-
reason: options.installHooks ? undefined : "Coding-agent trace capture is temporarily unavailable."
|
|
2214
|
+
command: options.remote ? "moda harness analyze --remote --summary --experimental && moda harness approve --yes && moda harness sync --from-report" : "moda harness analyze --analyst=auto --summary --experimental && moda harness approve --yes && moda harness sync --from-report"
|
|
2224
2215
|
},
|
|
2225
2216
|
{
|
|
2226
2217
|
category: "prompts",
|
|
@@ -2271,7 +2262,7 @@ function buildSetupPlan(options) {
|
|
|
2271
2262
|
status: options.configureHarnessRescan ? "planned" : "manual",
|
|
2272
2263
|
approved: options.configureHarnessRescan,
|
|
2273
2264
|
files: [".github/workflows/moda-harness-rescan.yml"],
|
|
2274
|
-
command: "moda harness analyze --remote --yes && moda harness approve --yes && moda harness sync --from-report",
|
|
2265
|
+
command: "moda harness analyze --remote --yes --experimental && moda harness approve --yes && moda harness sync --from-report",
|
|
2275
2266
|
reason: options.configureHarnessRescan ? undefined : "No harness rescan workflow is written until it is explicitly approved (--harness-rescan)."
|
|
2276
2267
|
},
|
|
2277
2268
|
{
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
inspectCodeSelectors,
|
|
6
6
|
inspectPythonSelectors,
|
|
7
7
|
safePromptEvidencePath
|
|
8
|
-
} from "./cli-
|
|
9
|
-
import"./cli-
|
|
8
|
+
} from "./cli-v27q5dvh.js";
|
|
9
|
+
import"./cli-0qnghzg4.js";
|
|
10
10
|
import {
|
|
11
11
|
__commonJS,
|
|
12
12
|
__toESM
|
|
@@ -9258,7 +9258,7 @@ class StdioServerTransport {
|
|
|
9258
9258
|
}
|
|
9259
9259
|
|
|
9260
9260
|
// src/prompt-analyst-tools.ts
|
|
9261
|
-
import {
|
|
9261
|
+
import { resolve } from "node:path";
|
|
9262
9262
|
function safeRoot(rootDir) {
|
|
9263
9263
|
const root = resolve(rootDir);
|
|
9264
9264
|
return root;
|