@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.
Files changed (118) hide show
  1. package/dist/cli-c4se7a5d.js +762 -0
  2. package/dist/cli-mnqa4rp6.js +1563 -0
  3. package/dist/cli-stmjdgvy.js +2842 -0
  4. package/dist/cli-y55bgg14.js +6980 -0
  5. package/dist/cli-ysegdrm5.js +286 -0
  6. package/dist/cli.js +4779 -1159
  7. package/dist/harness-github-actions-7t3cncnt.js +95 -0
  8. package/dist/index-4ser01zr.js +2769 -0
  9. package/dist/provision-hm1ppwj6.js +74 -0
  10. package/package.json +3 -2
  11. package/skills/integration/index.json +2 -2
  12. package/dist/agent-schemas.d.ts +0 -3
  13. package/dist/agent-schemas.js +0 -358
  14. package/dist/agent.d.ts +0 -5
  15. package/dist/agent.js +0 -477
  16. package/dist/analyst-tui.d.ts +0 -81
  17. package/dist/analyst-tui.js +0 -314
  18. package/dist/api-client.d.ts +0 -46
  19. package/dist/api-client.js +0 -120
  20. package/dist/ask-stream.d.ts +0 -146
  21. package/dist/ask-stream.js +0 -473
  22. package/dist/auth-storage.d.ts +0 -35
  23. package/dist/auth-storage.js +0 -159
  24. package/dist/auth.d.ts +0 -50
  25. package/dist/auth.js +0 -694
  26. package/dist/cli-session.d.ts +0 -26
  27. package/dist/cli-session.js +0 -169
  28. package/dist/cli.d.ts +0 -44
  29. package/dist/command-context.d.ts +0 -62
  30. package/dist/command-context.js +0 -57
  31. package/dist/command-registry.d.ts +0 -22
  32. package/dist/command-registry.js +0 -15
  33. package/dist/config.d.ts +0 -60
  34. package/dist/config.js +0 -110
  35. package/dist/doctor.d.ts +0 -79
  36. package/dist/doctor.js +0 -1182
  37. package/dist/errors.d.ts +0 -50
  38. package/dist/errors.js +0 -64
  39. package/dist/exit-funnel.d.ts +0 -14
  40. package/dist/exit-funnel.js +0 -53
  41. package/dist/harness-artifact-bodies.d.ts +0 -28
  42. package/dist/harness-artifact-bodies.js +0 -276
  43. package/dist/harness-candidates.d.ts +0 -77
  44. package/dist/harness-candidates.js +0 -482
  45. package/dist/harness-remote.d.ts +0 -135
  46. package/dist/harness-remote.js +0 -540
  47. package/dist/harness-report.d.ts +0 -145
  48. package/dist/harness-report.js +0 -1579
  49. package/dist/harness-sync-limits.d.ts +0 -8
  50. package/dist/harness-sync-limits.js +0 -21
  51. package/dist/harness.d.ts +0 -463
  52. package/dist/harness.js +0 -4009
  53. package/dist/init/index.d.ts +0 -78
  54. package/dist/init/index.js +0 -1442
  55. package/dist/init/mcp.d.ts +0 -2
  56. package/dist/init/mcp.js +0 -27
  57. package/dist/init/progress-board.d.ts +0 -80
  58. package/dist/init/progress-board.js +0 -225
  59. package/dist/init/rules.d.ts +0 -6
  60. package/dist/init/rules.js +0 -171
  61. package/dist/init/sdk-catalog.d.ts +0 -10
  62. package/dist/init/sdk-catalog.js +0 -80
  63. package/dist/init/sdk-guide.d.ts +0 -19
  64. package/dist/init/sdk-guide.js +0 -185
  65. package/dist/init/sdk-integration.d.ts +0 -53
  66. package/dist/init/sdk-integration.js +0 -835
  67. package/dist/init/sdk-protocol.d.ts +0 -135
  68. package/dist/init/sdk-protocol.js +0 -152
  69. package/dist/init/sdk-verification.d.ts +0 -27
  70. package/dist/init/sdk-verification.js +0 -123
  71. package/dist/init/tenant.d.ts +0 -67
  72. package/dist/init/tenant.js +0 -421
  73. package/dist/intelligence-schema.d.ts +0 -349
  74. package/dist/intelligence-schema.js +0 -174
  75. package/dist/keys.d.ts +0 -47
  76. package/dist/keys.js +0 -136
  77. package/dist/manifest.d.ts +0 -5
  78. package/dist/manifest.js +0 -114
  79. package/dist/markdown-terminal.d.ts +0 -49
  80. package/dist/markdown-terminal.js +0 -212
  81. package/dist/output.d.ts +0 -191
  82. package/dist/output.js +0 -624
  83. package/dist/production-intelligence.d.ts +0 -175
  84. package/dist/production-intelligence.js +0 -1430
  85. package/dist/profile-commands.d.ts +0 -10
  86. package/dist/profile-commands.js +0 -342
  87. package/dist/profiles.d.ts +0 -112
  88. package/dist/profiles.js +0 -573
  89. package/dist/prompts-ab.d.ts +0 -71
  90. package/dist/prompts-ab.js +0 -313
  91. package/dist/prompts-propose.d.ts +0 -15
  92. package/dist/prompts-propose.js +0 -212
  93. package/dist/prompts.d.ts +0 -58
  94. package/dist/prompts.js +0 -418
  95. package/dist/provision.d.ts +0 -28
  96. package/dist/provision.js +0 -104
  97. package/dist/redact.d.ts +0 -2
  98. package/dist/redact.js +0 -90
  99. package/dist/schemas.d.ts +0 -225
  100. package/dist/schemas.js +0 -126
  101. package/dist/skills-bundled.d.ts +0 -35
  102. package/dist/skills-bundled.js +0 -157
  103. package/dist/skills-manifest.d.ts +0 -33
  104. package/dist/skills-manifest.js +0 -244
  105. package/dist/skills.d.ts +0 -57
  106. package/dist/skills.js +0 -783
  107. package/dist/sync.d.ts +0 -5
  108. package/dist/sync.js +0 -36
  109. package/dist/telemetry.d.ts +0 -56
  110. package/dist/telemetry.js +0 -167
  111. package/dist/transforms.d.ts +0 -25
  112. package/dist/transforms.js +0 -102
  113. package/dist/tui.d.ts +0 -48
  114. package/dist/tui.js +0 -393
  115. package/dist/update-check.d.ts +0 -31
  116. package/dist/update-check.js +0 -141
  117. package/dist/workspace.d.ts +0 -12
  118. package/dist/workspace.js +0 -1294
@@ -1,185 +0,0 @@
1
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
- import { dirname, join } from 'node:path';
3
- import { readBundledIndex } from '../skills-bundled.js';
4
- import { renderCatalogListing } from './sdk-catalog.js';
5
- export const SDK_GUIDE_PATH = '.moda/SDK_INTEGRATION.md';
6
- /**
7
- * Write the human/agent-readable fallback guide (.moda/SDK_INTEGRATION.md).
8
- * Used when automatic SDK integration did not complete successfully.
9
- */
10
- export function writeSdkIntegrationGuide(cwd = process.cwd()) {
11
- const relativePath = SDK_GUIDE_PATH;
12
- const absolutePath = join(cwd, relativePath);
13
- const content = renderSdkIntegrationGuideContent();
14
- mkdirSync(dirname(absolutePath), { recursive: true });
15
- writeFileSync(absolutePath, content);
16
- return relativePath;
17
- }
18
- export function renderSdkIntegrationGuideContent() {
19
- const index = readBundledIndex();
20
- const catalogSection = index
21
- ? [
22
- '## Available integration skills',
23
- '',
24
- renderCatalogListing(index),
25
- '',
26
- 'During `moda init`, Moda materializes these skills into a temporary catalog for your',
27
- 'coding agent. To integrate by hand, read the matching skill inside the installed CLI',
28
- 'package (`.../@moda-ai/cli/skills/integration/<id>/SKILL.md`), re-run `moda init` with',
29
- 'a coding agent CLI installed, or follow https://docs.moda.dev/ingestion.',
30
- '',
31
- ]
32
- : [
33
- '## Available integration skills',
34
- '',
35
- '_The bundled skill index is unavailable in this install; use the generic steps below',
36
- 'and https://docs.moda.dev/ingestion for stack-specific guidance._',
37
- '',
38
- ];
39
- return [
40
- '# Moda SDK Integration Guide',
41
- '',
42
- 'Generated by `moda init`. **The SDK integration was not applied automatically.**',
43
- 'This checklist gets you there by hand or with your coding agent.',
44
- '',
45
- ...catalogSection,
46
- '## 1. Install the SDK',
47
- '',
48
- 'Install the Moda SDK for your stack with **your** package manager. If a catalog skill',
49
- 'above matches your repo, use its exact package name and install command.',
50
- '',
51
- 'Examples (adapt to your stack):',
52
- '',
53
- 'Node.js / TypeScript:',
54
- '',
55
- '```bash',
56
- 'npm install moda-ai # or: bun add / pnpm add / yarn add',
57
- '```',
58
- '',
59
- 'Python:',
60
- '',
61
- '```bash',
62
- 'pip install moda-ai # or: uv add / poetry add',
63
- '```',
64
- '',
65
- 'Do not paste `MODA_API_KEY` into source or `.env` files. Keep it in your deployment',
66
- 'environment, secret manager, or local shell.',
67
- '',
68
- '## 2. Initialize Moda before LLM clients',
69
- '',
70
- 'Initialize before any LLM client is created.',
71
- '',
72
- 'Node.js / TypeScript (example):',
73
- '',
74
- '```ts',
75
- "import { Moda } from 'moda-ai';",
76
- '',
77
- 'await Moda.init(process.env.MODA_API_KEY!);',
78
- '```',
79
- '',
80
- 'Python (example):',
81
- '',
82
- '```python',
83
- 'import os',
84
- '',
85
- 'import moda',
86
- '',
87
- 'moda.init(os.environ["MODA_API_KEY"])',
88
- '```',
89
- '',
90
- '## 3. Set conversation and user context',
91
- '',
92
- 'Set a stable conversation id before each LLM call, and a user id when one user can be',
93
- 'identified. For concurrent request handlers, use scoped context helpers from the SDK',
94
- 'instead of setting global context across overlapping requests.',
95
- '',
96
- 'Node.js / TypeScript (example):',
97
- '',
98
- '```ts',
99
- 'Moda.conversationId = sessionId;',
100
- 'Moda.userId = userId;',
101
- '```',
102
- '',
103
- 'Python (example):',
104
- '',
105
- '```python',
106
- 'moda.conversation_id = session_id',
107
- 'moda.user_id = user_id',
108
- '```',
109
- '',
110
- '## 4. Flush before exit',
111
- '',
112
- 'Node.js / TypeScript: `await Moda.flush();` — Python: `moda.flush()`.',
113
- '',
114
- '## 5. Validate',
115
- '',
116
- 'Tenant health (does not prove this integration by itself):',
117
- '',
118
- '```bash',
119
- 'moda doctor --online --json',
120
- '```',
121
- '',
122
- 'Exact-trace confirmation: send one request through your app with a known conversation id,',
123
- 'then run `moda audit <that-id>` — you should see your llm span(s).',
124
- '',
125
- ].join('\n');
126
- }
127
- /** Read optional harness discovery context from `.moda/harness.json`. */
128
- export function readRuntimeSummary(cwd) {
129
- const empty = {
130
- runtimeAgents: 0,
131
- agentFamilies: 0,
132
- frameworks: [],
133
- providers: [],
134
- runtimeAgentNames: [],
135
- };
136
- const path = join(cwd, '.moda', 'harness.json');
137
- if (!existsSync(path))
138
- return empty;
139
- try {
140
- const parsed = JSON.parse(readFileSync(path, 'utf8'));
141
- if (!isRecord(parsed))
142
- return empty;
143
- const runtimeAgents = Array.isArray(parsed.runtimeAgents) ? parsed.runtimeAgents : [];
144
- const agentFamilies = Array.isArray(parsed.agentFamilies) ? parsed.agentFamilies : [];
145
- const frameworks = Array.isArray(parsed.agentFrameworks) ? parsed.agentFrameworks : [];
146
- const providers = Array.isArray(parsed.modelProviders) ? parsed.modelProviders : [];
147
- return {
148
- runtimeAgents: runtimeAgents.length,
149
- agentFamilies: agentFamilies.length,
150
- runtimeAgentNames: runtimeAgents
151
- .map((agent) => isRecord(agent) && typeof agent.name === 'string' ? agent.name : undefined)
152
- .filter((name) => Boolean(name)),
153
- frameworks: frameworks
154
- .map((framework) => isRecord(framework) && typeof framework.name === 'string' ? framework.name : undefined)
155
- .filter((name) => Boolean(name)),
156
- providers: providers
157
- .map((provider) => isRecord(provider) && typeof provider.name === 'string' ? provider.name : undefined)
158
- .filter((name) => Boolean(name)),
159
- };
160
- }
161
- catch {
162
- return empty;
163
- }
164
- }
165
- export function renderRuntimeSummaryBlock(summary) {
166
- const runtimeNames = summary.runtimeAgentNames.slice(0, 8);
167
- const lines = [
168
- `- Runtime agents: ${summary.runtimeAgents}`,
169
- `- Agent families: ${summary.agentFamilies}`,
170
- ];
171
- if (summary.frameworks.length > 0) {
172
- lines.push(`- Frameworks: ${summary.frameworks.join(', ')}`);
173
- }
174
- if (summary.providers.length > 0) {
175
- lines.push(`- Providers: ${summary.providers.join(', ')}`);
176
- }
177
- if (runtimeNames.length > 0) {
178
- lines.push(`- Runtime agent names: ${runtimeNames.join(', ')}`);
179
- }
180
- return lines.join('\n');
181
- }
182
- function isRecord(value) {
183
- return typeof value === 'object' && value !== null && !Array.isArray(value);
184
- }
185
- //# sourceMappingURL=sdk-guide.js.map
@@ -1,53 +0,0 @@
1
- import { type CodingAgentAdapter, type CodingAgentEvent, runCodingAgent } from '../harness.js';
2
- import { type SdkAgentResult } from './sdk-protocol.js';
3
- import { verifyExactTrace, type VerificationEvidence } from './sdk-verification.js';
4
- import { readRuntimeSummary } from './sdk-guide.js';
5
- export { describeCodingAgentEvent } from '../harness.js';
6
- export type SdkIntegrationStatus = 'integrated_verified' | 'needs_human_input' | 'repository_checks_failed' | 'smoke_execution_failed' | 'telemetry_not_observed' | 'nothing_to_integrate' | 'agent_failed' | 'agent_unavailable' | 'cancelled';
7
- export interface SdkIntegrationOutcome {
8
- status: SdkIntegrationStatus;
9
- adapter?: CodingAgentAdapter;
10
- verification_id?: string;
11
- verification?: VerificationEvidence;
12
- agent_result?: SdkAgentResult;
13
- repair_attempts: number;
14
- security_findings?: string[];
15
- installed_skill_ids?: string[];
16
- detail?: string;
17
- }
18
- export interface SdkIntegrationOptions {
19
- cwd?: string;
20
- adapter?: CodingAgentAdapter;
21
- human?: boolean;
22
- onProgress?: (message: string) => void;
23
- onEvent?: (event: CodingAgentEvent) => void;
24
- onPhase?: (phase: 'investigating' | 'verifying' | 'repairing', message: string) => void;
25
- apiKey?: string;
26
- ingestUrl?: string;
27
- maxRepairAttempts?: number;
28
- verifyTimeoutMs?: number;
29
- runAgent?: typeof runCodingAgent;
30
- verify?: typeof verifyExactTrace;
31
- fetchAudit?: (id: string) => Promise<unknown>;
32
- }
33
- type RepairableClassification = 'telemetry_not_observed' | 'repository_checks_failed' | 'smoke_execution_failed' | 'protocol_violation' | 'failed';
34
- export declare function runSdkIntegration(options?: SdkIntegrationOptions): Promise<SdkIntegrationOutcome>;
35
- export interface SdkIntegrationPromptOptions {
36
- catalogDir: string;
37
- catalogListing: string;
38
- verificationId: string;
39
- harnessSummary?: ReturnType<typeof readRuntimeSummary>;
40
- }
41
- export declare function renderSdkIntegrationPrompt(opts: SdkIntegrationPromptOptions): string;
42
- export interface SdkRepairPromptOptions extends SdkIntegrationPromptOptions {
43
- attempt: number;
44
- maxAttempts: number;
45
- classification: RepairableClassification;
46
- previousResult?: SdkAgentResult;
47
- verification?: VerificationEvidence;
48
- securityFindings?: string[];
49
- }
50
- export declare function renderSdkRepairPrompt(opts: SdkRepairPromptOptions): string;
51
- export declare function parseGitDeltaPaths(deltaLines: string[]): string[];
52
- export declare function redactSecretText(text: string, apiKey?: string): string;
53
- //# sourceMappingURL=sdk-integration.d.ts.map