@moda-ai/cli 1.22.1 → 1.22.2

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 (115) hide show
  1. package/dist/cli-g8qs2tj9.js +9777 -0
  2. package/dist/cli-pwbvtes8.js +2312 -0
  3. package/dist/cli-qszcpda3.js +284 -0
  4. package/dist/cli.js +4775 -1159
  5. package/dist/index-6h0nc1r5.js +2765 -0
  6. package/dist/provision-j5gq8cvx.js +72 -0
  7. package/package.json +3 -2
  8. package/skills/integration/index.json +2 -2
  9. package/dist/agent-schemas.d.ts +0 -3
  10. package/dist/agent-schemas.js +0 -358
  11. package/dist/agent.d.ts +0 -5
  12. package/dist/agent.js +0 -477
  13. package/dist/analyst-tui.d.ts +0 -81
  14. package/dist/analyst-tui.js +0 -314
  15. package/dist/api-client.d.ts +0 -46
  16. package/dist/api-client.js +0 -120
  17. package/dist/ask-stream.d.ts +0 -146
  18. package/dist/ask-stream.js +0 -473
  19. package/dist/auth-storage.d.ts +0 -35
  20. package/dist/auth-storage.js +0 -159
  21. package/dist/auth.d.ts +0 -50
  22. package/dist/auth.js +0 -694
  23. package/dist/cli-session.d.ts +0 -26
  24. package/dist/cli-session.js +0 -169
  25. package/dist/cli.d.ts +0 -44
  26. package/dist/command-context.d.ts +0 -62
  27. package/dist/command-context.js +0 -57
  28. package/dist/command-registry.d.ts +0 -22
  29. package/dist/command-registry.js +0 -15
  30. package/dist/config.d.ts +0 -60
  31. package/dist/config.js +0 -110
  32. package/dist/doctor.d.ts +0 -79
  33. package/dist/doctor.js +0 -1182
  34. package/dist/errors.d.ts +0 -50
  35. package/dist/errors.js +0 -64
  36. package/dist/exit-funnel.d.ts +0 -14
  37. package/dist/exit-funnel.js +0 -53
  38. package/dist/harness-artifact-bodies.d.ts +0 -28
  39. package/dist/harness-artifact-bodies.js +0 -276
  40. package/dist/harness-candidates.d.ts +0 -77
  41. package/dist/harness-candidates.js +0 -482
  42. package/dist/harness-remote.d.ts +0 -135
  43. package/dist/harness-remote.js +0 -540
  44. package/dist/harness-report.d.ts +0 -145
  45. package/dist/harness-report.js +0 -1579
  46. package/dist/harness-sync-limits.d.ts +0 -8
  47. package/dist/harness-sync-limits.js +0 -21
  48. package/dist/harness.d.ts +0 -463
  49. package/dist/harness.js +0 -4009
  50. package/dist/init/index.d.ts +0 -78
  51. package/dist/init/index.js +0 -1442
  52. package/dist/init/mcp.d.ts +0 -2
  53. package/dist/init/mcp.js +0 -27
  54. package/dist/init/progress-board.d.ts +0 -80
  55. package/dist/init/progress-board.js +0 -225
  56. package/dist/init/rules.d.ts +0 -6
  57. package/dist/init/rules.js +0 -171
  58. package/dist/init/sdk-catalog.d.ts +0 -10
  59. package/dist/init/sdk-catalog.js +0 -80
  60. package/dist/init/sdk-guide.d.ts +0 -19
  61. package/dist/init/sdk-guide.js +0 -185
  62. package/dist/init/sdk-integration.d.ts +0 -53
  63. package/dist/init/sdk-integration.js +0 -835
  64. package/dist/init/sdk-protocol.d.ts +0 -135
  65. package/dist/init/sdk-protocol.js +0 -152
  66. package/dist/init/sdk-verification.d.ts +0 -27
  67. package/dist/init/sdk-verification.js +0 -123
  68. package/dist/init/tenant.d.ts +0 -67
  69. package/dist/init/tenant.js +0 -421
  70. package/dist/intelligence-schema.d.ts +0 -349
  71. package/dist/intelligence-schema.js +0 -174
  72. package/dist/keys.d.ts +0 -47
  73. package/dist/keys.js +0 -136
  74. package/dist/manifest.d.ts +0 -5
  75. package/dist/manifest.js +0 -114
  76. package/dist/markdown-terminal.d.ts +0 -49
  77. package/dist/markdown-terminal.js +0 -212
  78. package/dist/output.d.ts +0 -191
  79. package/dist/output.js +0 -624
  80. package/dist/production-intelligence.d.ts +0 -175
  81. package/dist/production-intelligence.js +0 -1430
  82. package/dist/profile-commands.d.ts +0 -10
  83. package/dist/profile-commands.js +0 -342
  84. package/dist/profiles.d.ts +0 -112
  85. package/dist/profiles.js +0 -573
  86. package/dist/prompts-ab.d.ts +0 -71
  87. package/dist/prompts-ab.js +0 -313
  88. package/dist/prompts-propose.d.ts +0 -15
  89. package/dist/prompts-propose.js +0 -212
  90. package/dist/prompts.d.ts +0 -58
  91. package/dist/prompts.js +0 -418
  92. package/dist/provision.d.ts +0 -28
  93. package/dist/provision.js +0 -104
  94. package/dist/redact.d.ts +0 -2
  95. package/dist/redact.js +0 -90
  96. package/dist/schemas.d.ts +0 -225
  97. package/dist/schemas.js +0 -126
  98. package/dist/skills-bundled.d.ts +0 -35
  99. package/dist/skills-bundled.js +0 -157
  100. package/dist/skills-manifest.d.ts +0 -33
  101. package/dist/skills-manifest.js +0 -244
  102. package/dist/skills.d.ts +0 -57
  103. package/dist/skills.js +0 -783
  104. package/dist/sync.d.ts +0 -5
  105. package/dist/sync.js +0 -36
  106. package/dist/telemetry.d.ts +0 -56
  107. package/dist/telemetry.js +0 -167
  108. package/dist/transforms.d.ts +0 -25
  109. package/dist/transforms.js +0 -102
  110. package/dist/tui.d.ts +0 -48
  111. package/dist/tui.js +0 -393
  112. package/dist/update-check.d.ts +0 -31
  113. package/dist/update-check.js +0 -141
  114. package/dist/workspace.d.ts +0 -12
  115. package/dist/workspace.js +0 -1294
@@ -1,244 +0,0 @@
1
- // src/skills-manifest.ts — the .moda/skills.yml install manifest.
2
- //
3
- // The manifest records every skill file Moda manages inside a user's repo so
4
- // that (a) `skills sync` never pushes Moda-managed files back up, and (b) a
5
- // harness release change prunes exactly the files the previous release wrote.
6
- // Two producers write records here: `skills pull` (harness-generated skills,
7
- // source 'moda') and the bundled integration-skill installer
8
- // (src/skills-bundled.ts, source 'integration-bundled').
9
- //
10
- // IMPORTANT: the YAML here is hand-rolled on both sides — writeSkillsManifest
11
- // emits a fixed 2/4/6-space layout and readSkillRecords/readManagedPaths parse
12
- // exactly that layout. Keep reader and writer in lockstep; they live in this
13
- // module together so a format change cannot land on one side only.
14
- import { existsSync, mkdirSync, readdirSync, readFileSync, rmdirSync, unlinkSync, writeFileSync, } from 'node:fs';
15
- import { dirname, isAbsolute, join, normalize, relative, resolve } from 'node:path';
16
- export const SKILLS_MANIFEST_PATH = join('.moda', 'skills.yml');
17
- // Per-record `source` values. Harness-generated skills (pulled from the
18
- // tenant store) keep the legacy value 'moda'; skills materialized from the
19
- // CLI's bundled integration set use 'integration-bundled'. Pruning on a
20
- // release change is scoped to harness records only, and `skills sync`
21
- // excludes every managed path regardless of source.
22
- export const SKILL_SOURCE_HARNESS = 'moda';
23
- export const SKILL_SOURCE_INTEGRATION_BUNDLED = 'integration-bundled';
24
- export function readSkillsManifest(cwd) {
25
- const manifestPath = join(cwd, SKILLS_MANIFEST_PATH);
26
- if (!existsSync(manifestPath))
27
- return null;
28
- let text = '';
29
- try {
30
- text = readFileSync(manifestPath, 'utf8');
31
- }
32
- catch {
33
- return null;
34
- }
35
- return {
36
- tenantId: readYamlScalar(text, 'tenant_id'),
37
- generationRunId: readYamlScalar(text, 'generation_run_id'),
38
- generationVersion: Number(readYamlScalar(text, 'generation_version') || 0),
39
- releaseKey: readYamlScalar(text, 'release_key'),
40
- statusFilter: readYamlScalar(text, 'status_filter'),
41
- releasedAt: readYamlScalar(text, 'released_at'),
42
- managedPaths: readManagedPaths(text),
43
- records: readSkillRecords(text),
44
- };
45
- }
46
- export function manifestHeaderFrom(manifest) {
47
- return {
48
- tenantId: manifest?.tenantId ?? '',
49
- releaseKey: manifest?.releaseKey ?? '',
50
- statusFilter: manifest?.statusFilter ?? '',
51
- generationRunId: manifest?.generationRunId ?? '',
52
- generationVersion: manifest?.generationVersion ?? 0,
53
- releasedAt: manifest?.releasedAt ?? '',
54
- };
55
- }
56
- export function writeSkillsManifest(cwd, header, records) {
57
- const manifestPath = join(cwd, SKILLS_MANIFEST_PATH);
58
- const managedPaths = [...new Set(records.flatMap((record) => record.paths))].sort();
59
- const lines = [
60
- 'version: 1',
61
- 'source: moda',
62
- `tenant_id: ${yamlQuote(header.tenantId)}`,
63
- `release_key: ${yamlQuote(header.releaseKey)}`,
64
- `status_filter: ${yamlQuote(header.statusFilter)}`,
65
- `generation_run_id: ${yamlQuote(header.generationRunId)}`,
66
- `generation_version: ${header.generationVersion}`,
67
- `released_at: ${yamlQuote(header.releasedAt)}`,
68
- `installed_at: ${yamlQuote(new Date().toISOString())}`,
69
- 'managed_paths:',
70
- ...managedPaths.map((path) => ` - ${yamlQuote(path)}`),
71
- 'skills:',
72
- ...records.flatMap((record) => [
73
- ` - skill_id: ${yamlQuote(record.skillId)}`,
74
- ` content_hash: ${yamlQuote(record.contentHash)}`,
75
- ` source: ${yamlQuote(record.source)}`,
76
- ' paths:',
77
- ...record.paths.map((path) => ` - ${yamlQuote(path)}`),
78
- ]),
79
- '',
80
- ];
81
- mkdirSync(dirname(manifestPath), { recursive: true });
82
- writeFileSync(manifestPath, lines.join('\n'));
83
- }
84
- /**
85
- * Upsert a skill record into .moda/skills.yml, preserving the harness release
86
- * header and all other records. Used by the bundled integration-skill
87
- * installer so its materialized files become managed paths (excluded from
88
- * `skills sync`, never pruned by harness release changes).
89
- */
90
- export function upsertSkillManifestRecord(cwd, record) {
91
- const manifest = readSkillsManifest(cwd);
92
- const records = (manifest?.records ?? []).filter((existing) => !(existing.skillId === record.skillId && existing.source === record.source));
93
- records.push(record);
94
- writeSkillsManifest(cwd, manifestHeaderFrom(manifest), records);
95
- }
96
- export function pruneManagedSkillPaths(cwd, managedPaths, log) {
97
- let pruned = 0;
98
- for (const rawPath of [...new Set(managedPaths)]) {
99
- const safePath = safeManagedRelativePath(rawPath);
100
- if (!safePath)
101
- continue;
102
- const absolutePath = absoluteManagedPath(cwd, safePath);
103
- if (!absolutePath || !existsSync(absolutePath))
104
- continue;
105
- try {
106
- unlinkSync(absolutePath);
107
- pruned++;
108
- log(` pruned ${safePath}`);
109
- pruneEmptyClaudeSkillDir(cwd, safePath);
110
- }
111
- catch {
112
- // Best-effort cleanup. The following write pass can still repair files
113
- // that remain writable.
114
- }
115
- }
116
- return pruned;
117
- }
118
- function pruneEmptyClaudeSkillDir(cwd, relativePath) {
119
- if (!relativePath.startsWith('.claude/skills/') || !relativePath.endsWith('/SKILL.md'))
120
- return;
121
- const dir = dirname(join(cwd, relativePath));
122
- try {
123
- if (existsSync(dir) && readdirSync(dir).length === 0) {
124
- rmdirSync(dir);
125
- }
126
- }
127
- catch {
128
- // Empty-dir pruning is only cosmetic.
129
- }
130
- }
131
- function absoluteManagedPath(cwd, relativePath) {
132
- const abs = resolve(cwd, relativePath);
133
- const root = resolve(cwd);
134
- const rel = relative(root, abs);
135
- if (rel.startsWith('..') || isAbsolute(rel))
136
- return null;
137
- return abs;
138
- }
139
- function safeManagedRelativePath(rawPath) {
140
- if (!rawPath || rawPath.includes('\0') || isAbsolute(rawPath))
141
- return null;
142
- const normalized = normalize(rawPath).replace(/\\/g, '/');
143
- if (normalized.startsWith('../') || normalized === '..' || normalized.includes('/../'))
144
- return null;
145
- const isClaudeSkill = normalized.startsWith('.claude/skills/') && normalized.endsWith('/SKILL.md');
146
- const isCursorRule = normalized.startsWith('.cursor/rules/') && normalized.endsWith('.mdc');
147
- return isClaudeSkill || isCursorRule ? normalized : null;
148
- }
149
- function readYamlScalar(text, key) {
150
- const match = text.match(new RegExp(`^${key}:\\s*(.*?)\\s*$`, 'm'));
151
- return match ? parseYamlScalar(match[1]) : '';
152
- }
153
- /** Parse the `skills:` record list from the hand-rolled manifest YAML. */
154
- function readSkillRecords(text) {
155
- const records = [];
156
- let inSkills = false;
157
- let current = null;
158
- let inPaths = false;
159
- for (const line of text.split(/\r?\n/)) {
160
- if (line.trim() === 'skills:') {
161
- inSkills = true;
162
- continue;
163
- }
164
- if (!inSkills)
165
- continue;
166
- if (line.length > 0 && !line.startsWith(' '))
167
- break;
168
- const skillIdMatch = line.match(/^ {2}- skill_id:\s*(.*?)\s*$/);
169
- if (skillIdMatch) {
170
- if (current)
171
- records.push(current);
172
- current = {
173
- skillId: parseYamlScalar(skillIdMatch[1]),
174
- contentHash: '',
175
- // Legacy manifests predate per-record sources; they were all pulls.
176
- source: SKILL_SOURCE_HARNESS,
177
- paths: [],
178
- };
179
- inPaths = false;
180
- continue;
181
- }
182
- if (!current)
183
- continue;
184
- const hashMatch = line.match(/^ {4}content_hash:\s*(.*?)\s*$/);
185
- if (hashMatch) {
186
- current.contentHash = parseYamlScalar(hashMatch[1]);
187
- continue;
188
- }
189
- const sourceMatch = line.match(/^ {4}source:\s*(.*?)\s*$/);
190
- if (sourceMatch) {
191
- current.source = parseYamlScalar(sourceMatch[1]) || SKILL_SOURCE_HARNESS;
192
- continue;
193
- }
194
- if (/^ {4}paths:\s*$/.test(line)) {
195
- inPaths = true;
196
- continue;
197
- }
198
- const pathMatch = inPaths ? line.match(/^ {6}-\s*(.*?)\s*$/) : null;
199
- if (pathMatch) {
200
- const value = parseYamlScalar(pathMatch[1]);
201
- if (value)
202
- current.paths.push(value);
203
- }
204
- }
205
- if (current)
206
- records.push(current);
207
- return records;
208
- }
209
- function readManagedPaths(text) {
210
- const paths = [];
211
- let inManagedPaths = false;
212
- for (const line of text.split(/\r?\n/)) {
213
- if (line.trim() === 'managed_paths:') {
214
- inManagedPaths = true;
215
- continue;
216
- }
217
- if (inManagedPaths && line.length > 0 && !line.startsWith(' '))
218
- break;
219
- if (!inManagedPaths)
220
- continue;
221
- const match = line.match(/^\s*-\s*(.*?)\s*$/);
222
- if (match)
223
- paths.push(parseYamlScalar(match[1]));
224
- }
225
- return paths.filter(Boolean);
226
- }
227
- function parseYamlScalar(raw) {
228
- const value = raw.trim();
229
- if (!value)
230
- return '';
231
- if (value.startsWith('"')) {
232
- try {
233
- return String(JSON.parse(value));
234
- }
235
- catch {
236
- return value.replace(/^"|"$/g, '');
237
- }
238
- }
239
- return value.replace(/^'|'$/g, '');
240
- }
241
- function yamlQuote(value) {
242
- return JSON.stringify(value);
243
- }
244
- //# sourceMappingURL=skills-manifest.js.map
package/dist/skills.d.ts DELETED
@@ -1,57 +0,0 @@
1
- import { type CommandContext } from './command-context.js';
2
- import type { ProfileIOOptions } from './profiles.js';
3
- interface PullSummary {
4
- total: number;
5
- pruned: number;
6
- wrote: number;
7
- updated: number;
8
- unchanged: number;
9
- failed: number;
10
- }
11
- /**
12
- * Pull generated skills into the detected coding agents' skill directories.
13
- * Exported so `moda init` can run it as a setup step. Best-effort and quiet on
14
- * an empty store; never throws for "no skills yet".
15
- */
16
- export declare function pullSkills(options?: {
17
- status?: string;
18
- cwd?: string;
19
- silent?: boolean;
20
- }): Promise<PullSummary>;
21
- export interface SkillSyncResult {
22
- synced: Array<{
23
- key: string;
24
- skillId?: string;
25
- versionId?: string;
26
- version?: number;
27
- contentHash: string;
28
- changed?: boolean;
29
- sourcePath?: string;
30
- }>;
31
- dryRun: boolean;
32
- }
33
- /**
34
- * Push locally-authored `.claude/skills/**\/SKILL.md` files up to Moda via
35
- * `POST /api/skills/sync`. Modeled on `runPromptSync`: returns the synced list
36
- * without printing so callers (e.g. `moda init`) control their own output.
37
- * `moda skills sync` wraps this with JSON output.
38
- *
39
- * Skills that Moda itself manages — those previously pulled/generated (tracked
40
- * in `.moda/skills.yml`) and the shipped `moda-cli` skill — are excluded so we
41
- * only push skills the user authored.
42
- */
43
- export declare function runSkillSync(flags?: Record<string, string>, profileOptions?: ProfileIOOptions, options?: {
44
- cwd?: string;
45
- }): Promise<SkillSyncResult>;
46
- /**
47
- * `moda skills <subcommand>` dispatcher.
48
- */
49
- type LegacySkillsArgs = {
50
- command: string;
51
- positional: string | undefined;
52
- positionals: string[];
53
- flags: Record<string, string>;
54
- };
55
- export declare function runSkillsCommand(input: CommandContext | LegacySkillsArgs): Promise<number>;
56
- export {};
57
- //# sourceMappingURL=skills.d.ts.map