@memberjunction/cli 6.1.0-edge.4 → 6.1.0-edge.5

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 (206) hide show
  1. package/README.md +81 -0
  2. package/dist/commands/ai/actions/list.d.ts +2 -1
  3. package/dist/commands/ai/actions/list.d.ts.map +1 -1
  4. package/dist/commands/ai/actions/list.js +12 -3
  5. package/dist/commands/ai/actions/list.js.map +1 -1
  6. package/dist/commands/ai/actions/run.d.ts +7 -6
  7. package/dist/commands/ai/actions/run.d.ts.map +1 -1
  8. package/dist/commands/ai/actions/run.js +15 -16
  9. package/dist/commands/ai/actions/run.js.map +1 -1
  10. package/dist/commands/ai/agents/list.d.ts +2 -1
  11. package/dist/commands/ai/agents/list.d.ts.map +1 -1
  12. package/dist/commands/ai/agents/list.js +12 -3
  13. package/dist/commands/ai/agents/list.js.map +1 -1
  14. package/dist/commands/ai/agents/run.d.ts +7 -6
  15. package/dist/commands/ai/agents/run.d.ts.map +1 -1
  16. package/dist/commands/ai/agents/run.js +27 -5
  17. package/dist/commands/ai/agents/run.js.map +1 -1
  18. package/dist/commands/ai/audit/agent-run.d.ts +15 -14
  19. package/dist/commands/ai/audit/agent-run.d.ts.map +1 -1
  20. package/dist/commands/ai/audit/agent-run.js +18 -6
  21. package/dist/commands/ai/audit/agent-run.js.map +1 -1
  22. package/dist/commands/ai/prompts/run.d.ts +10 -9
  23. package/dist/commands/ai/prompts/run.d.ts.map +1 -1
  24. package/dist/commands/ai/prompts/run.js +12 -3
  25. package/dist/commands/ai/prompts/run.js.map +1 -1
  26. package/dist/commands/ai/usage.d.ts +7 -0
  27. package/dist/commands/ai/usage.d.ts.map +1 -0
  28. package/dist/commands/ai/usage.js +10 -0
  29. package/dist/commands/ai/usage.js.map +1 -0
  30. package/dist/commands/app/check-updates.d.ts.map +1 -1
  31. package/dist/commands/app/check-updates.js +55 -17
  32. package/dist/commands/app/check-updates.js.map +1 -1
  33. package/dist/commands/app/remove.d.ts.map +1 -1
  34. package/dist/commands/app/remove.js +12 -4
  35. package/dist/commands/app/remove.js.map +1 -1
  36. package/dist/commands/app/usage.d.ts +7 -0
  37. package/dist/commands/app/usage.d.ts.map +1 -0
  38. package/dist/commands/app/usage.js +10 -0
  39. package/dist/commands/app/usage.js.map +1 -0
  40. package/dist/commands/artifacts/usage.d.ts +7 -0
  41. package/dist/commands/artifacts/usage.d.ts.map +1 -0
  42. package/dist/commands/artifacts/usage.js +10 -0
  43. package/dist/commands/artifacts/usage.js.map +1 -0
  44. package/dist/commands/baseline/usage.d.ts +7 -0
  45. package/dist/commands/baseline/usage.d.ts.map +1 -0
  46. package/dist/commands/baseline/usage.js +10 -0
  47. package/dist/commands/baseline/usage.js.map +1 -0
  48. package/dist/commands/bump/usage.d.ts +7 -0
  49. package/dist/commands/bump/usage.d.ts.map +1 -0
  50. package/dist/commands/bump/usage.js +10 -0
  51. package/dist/commands/bump/usage.js.map +1 -0
  52. package/dist/commands/bundle/usage.d.ts +7 -0
  53. package/dist/commands/bundle/usage.d.ts.map +1 -0
  54. package/dist/commands/bundle/usage.js +10 -0
  55. package/dist/commands/bundle/usage.js.map +1 -0
  56. package/dist/commands/clean/usage.d.ts +7 -0
  57. package/dist/commands/clean/usage.d.ts.map +1 -0
  58. package/dist/commands/clean/usage.js +10 -0
  59. package/dist/commands/clean/usage.js.map +1 -0
  60. package/dist/commands/dbdoc/usage.d.ts +7 -0
  61. package/dist/commands/dbdoc/usage.d.ts.map +1 -0
  62. package/dist/commands/dbdoc/usage.js +10 -0
  63. package/dist/commands/dbdoc/usage.js.map +1 -0
  64. package/dist/commands/dev/workspace/index.d.ts.map +1 -1
  65. package/dist/commands/dev/workspace/index.js +7 -2
  66. package/dist/commands/dev/workspace/index.js.map +1 -1
  67. package/dist/commands/doctor/usage.d.ts +7 -0
  68. package/dist/commands/doctor/usage.d.ts.map +1 -0
  69. package/dist/commands/doctor/usage.js +10 -0
  70. package/dist/commands/doctor/usage.js.map +1 -0
  71. package/dist/commands/install/index.d.ts +20 -0
  72. package/dist/commands/install/index.d.ts.map +1 -1
  73. package/dist/commands/install/index.js +80 -10
  74. package/dist/commands/install/index.js.map +1 -1
  75. package/dist/commands/install/usage.d.ts +7 -0
  76. package/dist/commands/install/usage.d.ts.map +1 -0
  77. package/dist/commands/install/usage.js +10 -0
  78. package/dist/commands/install/usage.js.map +1 -0
  79. package/dist/commands/migrate/convert.d.ts +1 -0
  80. package/dist/commands/migrate/convert.d.ts.map +1 -1
  81. package/dist/commands/migrate/convert.js +54 -5
  82. package/dist/commands/migrate/convert.js.map +1 -1
  83. package/dist/commands/migrate/rebake.d.ts +1 -0
  84. package/dist/commands/migrate/rebake.d.ts.map +1 -1
  85. package/dist/commands/migrate/rebake.js +16 -6
  86. package/dist/commands/migrate/rebake.js.map +1 -1
  87. package/dist/commands/migrate/usage.d.ts +7 -0
  88. package/dist/commands/migrate/usage.d.ts.map +1 -0
  89. package/dist/commands/migrate/usage.js +10 -0
  90. package/dist/commands/migrate/usage.js.map +1 -0
  91. package/dist/commands/plugin/usage.d.ts +7 -0
  92. package/dist/commands/plugin/usage.d.ts.map +1 -0
  93. package/dist/commands/plugin/usage.js +10 -0
  94. package/dist/commands/plugin/usage.js.map +1 -0
  95. package/dist/commands/querygen/usage.d.ts +7 -0
  96. package/dist/commands/querygen/usage.d.ts.map +1 -0
  97. package/dist/commands/querygen/usage.js +10 -0
  98. package/dist/commands/querygen/usage.js.map +1 -0
  99. package/dist/commands/sql-audit/usage.d.ts +7 -0
  100. package/dist/commands/sql-audit/usage.d.ts.map +1 -0
  101. package/dist/commands/sql-audit/usage.js +10 -0
  102. package/dist/commands/sql-audit/usage.js.map +1 -0
  103. package/dist/commands/sql-convert/usage.d.ts +7 -0
  104. package/dist/commands/sql-convert/usage.d.ts.map +1 -0
  105. package/dist/commands/sql-convert/usage.js +10 -0
  106. package/dist/commands/sql-convert/usage.js.map +1 -0
  107. package/dist/commands/standards/usage.d.ts +7 -0
  108. package/dist/commands/standards/usage.d.ts.map +1 -0
  109. package/dist/commands/standards/usage.js +10 -0
  110. package/dist/commands/standards/usage.js.map +1 -0
  111. package/dist/commands/sync/file-reset.d.ts +6 -6
  112. package/dist/commands/sync/file-reset.d.ts.map +1 -1
  113. package/dist/commands/sync/file-reset.js +151 -127
  114. package/dist/commands/sync/file-reset.js.map +1 -1
  115. package/dist/commands/sync/init.d.ts +10 -1
  116. package/dist/commands/sync/init.d.ts.map +1 -1
  117. package/dist/commands/sync/init.js +127 -78
  118. package/dist/commands/sync/init.js.map +1 -1
  119. package/dist/commands/test/compare.d.ts +11 -11
  120. package/dist/commands/test/compare.d.ts.map +1 -1
  121. package/dist/commands/test/compare.js +8 -7
  122. package/dist/commands/test/compare.js.map +1 -1
  123. package/dist/commands/test/history.d.ts +7 -7
  124. package/dist/commands/test/history.d.ts.map +1 -1
  125. package/dist/commands/test/history.js +8 -7
  126. package/dist/commands/test/history.js.map +1 -1
  127. package/dist/commands/test/list.d.ts +8 -8
  128. package/dist/commands/test/list.d.ts.map +1 -1
  129. package/dist/commands/test/list.js +8 -7
  130. package/dist/commands/test/list.js.map +1 -1
  131. package/dist/commands/test/regression/compare.d.ts.map +1 -1
  132. package/dist/commands/test/regression/compare.js +5 -7
  133. package/dist/commands/test/regression/compare.js.map +1 -1
  134. package/dist/commands/test/run.d.ts +9 -9
  135. package/dist/commands/test/run.d.ts.map +1 -1
  136. package/dist/commands/test/run.js +8 -7
  137. package/dist/commands/test/run.js.map +1 -1
  138. package/dist/commands/test/suite.d.ts +11 -11
  139. package/dist/commands/test/suite.d.ts.map +1 -1
  140. package/dist/commands/test/suite.js +8 -7
  141. package/dist/commands/test/suite.js.map +1 -1
  142. package/dist/commands/test/usage.d.ts +7 -0
  143. package/dist/commands/test/usage.d.ts.map +1 -0
  144. package/dist/commands/test/usage.js +10 -0
  145. package/dist/commands/test/usage.js.map +1 -0
  146. package/dist/commands/test/validate.d.ts +7 -7
  147. package/dist/commands/test/validate.d.ts.map +1 -1
  148. package/dist/commands/test/validate.js +8 -7
  149. package/dist/commands/test/validate.js.map +1 -1
  150. package/dist/commands/translate-sql/usage.d.ts +7 -0
  151. package/dist/commands/translate-sql/usage.d.ts.map +1 -0
  152. package/dist/commands/translate-sql/usage.js +10 -0
  153. package/dist/commands/translate-sql/usage.js.map +1 -0
  154. package/dist/commands/update/usage.d.ts +7 -0
  155. package/dist/commands/update/usage.d.ts.map +1 -0
  156. package/dist/commands/update/usage.js +10 -0
  157. package/dist/commands/update/usage.js.map +1 -0
  158. package/dist/commands/usage.d.ts.map +1 -1
  159. package/dist/commands/usage.js +9 -4
  160. package/dist/commands/usage.js.map +1 -1
  161. package/dist/hooks/prerun.d.ts.map +1 -1
  162. package/dist/hooks/prerun.js +63 -30
  163. package/dist/hooks/prerun.js.map +1 -1
  164. package/dist/lib/cli-plugins.d.ts +8 -1
  165. package/dist/lib/cli-plugins.d.ts.map +1 -1
  166. package/dist/lib/cli-plugins.js +17 -1
  167. package/dist/lib/cli-plugins.js.map +1 -1
  168. package/dist/lib/derived-usage.d.ts +68 -0
  169. package/dist/lib/derived-usage.d.ts.map +1 -0
  170. package/dist/lib/derived-usage.js +121 -0
  171. package/dist/lib/derived-usage.js.map +1 -0
  172. package/dist/lib/domain-profiles.d.ts +42 -0
  173. package/dist/lib/domain-profiles.d.ts.map +1 -0
  174. package/dist/lib/domain-profiles.js +118 -0
  175. package/dist/lib/domain-profiles.js.map +1 -0
  176. package/dist/lib/domain-usage-command.d.ts.map +1 -1
  177. package/dist/lib/domain-usage-command.js +9 -4
  178. package/dist/lib/domain-usage-command.js.map +1 -1
  179. package/dist/lib/format-compat.d.ts +68 -0
  180. package/dist/lib/format-compat.d.ts.map +1 -0
  181. package/dist/lib/format-compat.js +111 -0
  182. package/dist/lib/format-compat.js.map +1 -0
  183. package/dist/lib/interactive-guard.d.ts +56 -0
  184. package/dist/lib/interactive-guard.d.ts.map +1 -0
  185. package/dist/lib/interactive-guard.js +60 -0
  186. package/dist/lib/interactive-guard.js.map +1 -0
  187. package/dist/lib/legacy-install.d.ts.map +1 -1
  188. package/dist/lib/legacy-install.js +4 -0
  189. package/dist/lib/legacy-install.js.map +1 -1
  190. package/dist/lib/usage-render.d.ts +2 -2
  191. package/dist/lib/usage-render.d.ts.map +1 -1
  192. package/dist/lib/usage-render.js +2 -1
  193. package/dist/lib/usage-render.js.map +1 -1
  194. package/dist/light-commands.d.ts.map +1 -1
  195. package/dist/light-commands.js +43 -0
  196. package/dist/light-commands.js.map +1 -1
  197. package/dist/utils/open-app-context.d.ts +24 -0
  198. package/dist/utils/open-app-context.d.ts.map +1 -1
  199. package/dist/utils/open-app-context.js +21 -6
  200. package/dist/utils/open-app-context.js.map +1 -1
  201. package/dist/utils/update-check.d.ts +86 -0
  202. package/dist/utils/update-check.d.ts.map +1 -0
  203. package/dist/utils/update-check.js +98 -0
  204. package/dist/utils/update-check.js.map +1 -0
  205. package/oclif.manifest.json +1860 -1000
  206. package/package.json +21 -21
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Derives `mj usage` entries for the commands that are still plain oclif
3
+ * `Command`s, straight from oclif's own manifest.
4
+ *
5
+ * Why derive rather than hand-write: `mj usage` tier 1 tells an agent
6
+ * *"Run `mj <domain> usage` before invoking. Do NOT guess flags."* — so a domain
7
+ * absent from that map reads as "this domain does not exist". Before this, only the
8
+ * handful of `BaseCLIPlugin` domains were registered, and the map confidently
9
+ * advertised a fraction of the CLI. A map that lies by omission is worse than no map,
10
+ * because an agent has no way to tell the difference.
11
+ *
12
+ * Hand-writing 80-odd `PluginUsage` literals would have fixed it once and rotted
13
+ * immediately. oclif already holds every command's description, flags, and examples
14
+ * and cannot fall out of sync with itself, so the only thing left to hand-maintain
15
+ * is what oclif genuinely doesn't know: the runtime budget (see `domain-profiles.ts`).
16
+ *
17
+ * Registration is additive and never overwrites: `CLIPluginRegistry.RegisterUsage`
18
+ * keeps the first entry per command key, and plugin-declared `static Usage` is read
19
+ * first, so a migrated command always keeps its richer, curated metadata.
20
+ */
21
+ import { CLIPluginRegistry } from '@memberjunction/cli-core';
22
+ import { getDomainProfile } from './domain-profiles.js';
23
+ /**
24
+ * oclif's own built-in plugin commands. They are real commands, but they are not part
25
+ * of MJ's surface — advertising `help` and `version` as top-level *domains* in the
26
+ * tier-1 map would push two non-domains ahead of real ones for no benefit.
27
+ */
28
+ const BUILT_IN_COMMANDS = new Set(['help', 'version']);
29
+ /** oclif ids are colon-separated internally but render with the configured separator. */
30
+ function normalizeCommandKey(id) {
31
+ return id.trim().replace(/[\s:]+/g, ':');
32
+ }
33
+ /** The domain is the first segment: `sync:push` → `sync`, `codegen` → `codegen`. */
34
+ export function domainOf(commandId) {
35
+ return normalizeCommandKey(commandId).split(':')[0] ?? commandId;
36
+ }
37
+ /**
38
+ * First sentence (or first line) of a description, for the one-line summary.
39
+ * oclif descriptions are frequently multi-paragraph; the tier-1 map has room for one line.
40
+ */
41
+ function firstLine(text) {
42
+ if (!text)
43
+ return undefined;
44
+ const line = text.split('\n').map((l) => l.trim()).find((l) => l.length > 0);
45
+ if (!line)
46
+ return undefined;
47
+ const sentence = /^(.*?[.!?])(\s|$)/.exec(line);
48
+ return (sentence?.[1] ?? line).trim();
49
+ }
50
+ /** oclif accepts examples as strings or `{command, description}` objects. */
51
+ function normalizeExamples(examples) {
52
+ if (!examples?.length)
53
+ return undefined;
54
+ const out = examples
55
+ .map((e) => (typeof e === 'string' ? e : e.command))
56
+ .filter((e) => typeof e === 'string' && e.length > 0);
57
+ return out.length > 0 ? out : undefined;
58
+ }
59
+ /** Converts oclif's flag record to the usage surface's flag list, options included. */
60
+ function normalizeFlags(flags) {
61
+ if (!flags)
62
+ return undefined;
63
+ const out = [];
64
+ for (const [name, def] of Object.entries(flags)) {
65
+ if (!def)
66
+ continue;
67
+ const type = def.options?.length ? def.options.join('|') : (def.type ?? 'string');
68
+ const parts = [def.description ?? ''];
69
+ if (def.char)
70
+ parts.push(`(-${def.char})`);
71
+ if (def.required)
72
+ parts.push('(required)');
73
+ out.push({ name: `--${name}`, type, description: parts.filter(Boolean).join(' ').trim() });
74
+ }
75
+ return out.length > 0 ? out : undefined;
76
+ }
77
+ /**
78
+ * Synthesizes a {@link PluginUsage} from one oclif command definition.
79
+ *
80
+ * Exported for testing — the registration path below is what production calls.
81
+ */
82
+ export function deriveUsage(command) {
83
+ const key = normalizeCommandKey(command.id);
84
+ const domain = domainOf(key);
85
+ const profile = getDomainProfile(domain);
86
+ const description = command.description ?? command.summary;
87
+ return {
88
+ domain,
89
+ command: key,
90
+ summary: command.summary ?? firstLine(description) ?? `mj ${key.replace(/:/g, ' ')}`,
91
+ description,
92
+ flags: normalizeFlags(command.flags),
93
+ examples: normalizeExamples(command.examples),
94
+ runtime: profile.runtime,
95
+ };
96
+ }
97
+ /**
98
+ * Registers derived usage for every visible oclif command.
99
+ *
100
+ * Hidden commands and oclif's own built-ins (`help`, `version`) are skipped — the
101
+ * former are hidden from humans, so advertising them to an agent would be a strictly
102
+ * worse kind of surprise; the latter are not MJ domains. Already-registered commands
103
+ * (plugins, and the `dev` domain's explicit registrations) are left alone by
104
+ * `RegisterUsage`'s first-wins rule.
105
+ *
106
+ * Returns the keys it registered, so a caller or test can assert coverage.
107
+ */
108
+ export function registerDerivedUsage(commands) {
109
+ const registered = [];
110
+ for (const command of commands) {
111
+ if (!command?.id || command.hidden)
112
+ continue;
113
+ if (BUILT_IN_COMMANDS.has(normalizeCommandKey(command.id)))
114
+ continue;
115
+ const usage = deriveUsage(command);
116
+ CLIPluginRegistry.RegisterUsage(usage);
117
+ registered.push(usage.command);
118
+ }
119
+ return registered;
120
+ }
121
+ //# sourceMappingURL=derived-usage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derived-usage.js","sourceRoot":"","sources":["../../src/lib/derived-usage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,iBAAiB,EAA0C,MAAM,0BAA0B,CAAC;AACrG,OAAO,EAAE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AAC,CAAC;IACjC,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { RuntimeHint } from '@memberjunction/cli-core';
2
+ /**
3
+ * Per-domain runtime + summary for the commands that are still plain oclif
4
+ * `Command`s rather than `BaseCLIPlugin` subclasses.
5
+ *
6
+ * This table is deliberately the ONLY hand-maintained part of the usage surface.
7
+ * Everything else about an unmigrated command — its description, flags, and
8
+ * examples — is derived from oclif's own manifest at runtime (see
9
+ * `derived-usage.ts`), so it cannot drift from the actual command.
10
+ *
11
+ * What lives here is exactly what oclif does not know: how long a command tends to
12
+ * run (so an agent can budget a timeout) and a one-line domain summary for the
13
+ * tier-1 map. A domain missing from this table still appears — it just falls back
14
+ * to {@link DEFAULT_DOMAIN_PROFILE}, so adding a command can never make `mj usage`
15
+ * lie by omission.
16
+ */
17
+ export interface DomainProfile {
18
+ /** One line for the tier-1 `mj usage` map. */
19
+ summary: string;
20
+ /** Timeout budget for the slowest command in the domain. */
21
+ runtime: RuntimeHint;
22
+ }
23
+ /**
24
+ * Applied to any domain not listed below. `variable` is the honest answer for an
25
+ * undocumented command — it tells an agent "I don't know, don't set a tight timeout"
26
+ * rather than implying a fast run.
27
+ */
28
+ export declare const DEFAULT_DOMAIN_PROFILE: DomainProfile;
29
+ /**
30
+ * Per-domain profiles.
31
+ *
32
+ * Domains whose commands ship as `BaseCLIPlugin` plugins (`sync`, `codegen`) still
33
+ * appear here: a plugin declares usage per COMMAND, and the tier-1 map needs a line
34
+ * for the DOMAIN. Without one, a multi-command domain renders as one command's
35
+ * summary plus "(+7 more commands)", which tells an agent nothing about what the
36
+ * domain is for. The per-command metadata those plugins declare is untouched —
37
+ * `RegisterUsage` is first-wins and reads plugin metadata first.
38
+ */
39
+ export declare const DOMAIN_PROFILES: Readonly<Record<string, DomainProfile>>;
40
+ /** The profile for a domain, falling back to {@link DEFAULT_DOMAIN_PROFILE}. */
41
+ export declare function getDomainProfile(domain: string): DomainProfile;
42
+ //# sourceMappingURL=domain-profiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-profiles.d.ts","sourceRoot":"","sources":["../../src/lib/domain-profiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,aAAa;IAC5B,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,OAAO,EAAE,WAAW,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,aAGpC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CA6FnE,CAAC;AAEF,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAE9D"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Applied to any domain not listed below. `variable` is the honest answer for an
3
+ * undocumented command — it tells an agent "I don't know, don't set a tight timeout"
4
+ * rather than implying a fast run.
5
+ */
6
+ export const DEFAULT_DOMAIN_PROFILE = {
7
+ summary: 'See `mj <domain> usage` for this domain’s commands.',
8
+ runtime: { class: 'variable', note: 'no runtime profile declared for this domain' },
9
+ };
10
+ /**
11
+ * Per-domain profiles.
12
+ *
13
+ * Domains whose commands ship as `BaseCLIPlugin` plugins (`sync`, `codegen`) still
14
+ * appear here: a plugin declares usage per COMMAND, and the tier-1 map needs a line
15
+ * for the DOMAIN. Without one, a multi-command domain renders as one command's
16
+ * summary plus "(+7 more commands)", which tells an agent nothing about what the
17
+ * domain is for. The per-command metadata those plugins declare is untouched —
18
+ * `RegisterUsage` is first-wins and reads plugin metadata first.
19
+ */
20
+ export const DOMAIN_PROFILES = {
21
+ codegen: {
22
+ summary: 'Regenerate entities, SQL, and Angular forms from the database schema.',
23
+ runtime: { class: 'slow', typicalSeconds: 120, note: 'scales with entity count; a full run ≫ a single-entity change' },
24
+ },
25
+ sync: {
26
+ summary: 'Move metadata between local files and the database — push, pull, validate, watch.',
27
+ runtime: { class: 'variable', note: 'a status check is instant; a full push scales with record count' },
28
+ },
29
+ dev: {
30
+ summary: 'Local development tooling, including the cross-repo pnpm workspace generator.',
31
+ runtime: { class: 'variable', note: 'generation is fast; a workspace install is not' },
32
+ },
33
+ ai: {
34
+ summary: 'Run and inspect AI agents, prompts, and actions from the terminal.',
35
+ runtime: { class: 'variable', note: 'a listing is instant; an agent run is bounded only by the agent itself' },
36
+ },
37
+ app: {
38
+ summary: 'Install, upgrade, enable, and remove Open Apps.',
39
+ runtime: { class: 'slow', typicalSeconds: 180, note: 'installs run migrations and package installs' },
40
+ },
41
+ artifacts: {
42
+ summary: 'Maintenance operations over stored conversation artifacts.',
43
+ runtime: { class: 'moderate', typicalSeconds: 30, note: 'scales with artifact count' },
44
+ },
45
+ baseline: {
46
+ summary: 'Build and compare database baselines for clean-room verification.',
47
+ runtime: { class: 'slow', typicalSeconds: 120, note: 'full schema introspection; scales with table count' },
48
+ },
49
+ bump: {
50
+ summary: 'Bump the version across workspace package.json files.',
51
+ runtime: { class: 'fast' },
52
+ },
53
+ bundle: {
54
+ summary: 'Bundle interactive component source for distribution.',
55
+ runtime: { class: 'moderate', typicalSeconds: 20 },
56
+ },
57
+ clean: {
58
+ summary: 'Remove build artifacts and generated output.',
59
+ runtime: { class: 'fast' },
60
+ },
61
+ dbdoc: {
62
+ summary: 'Generate and export AI-authored database documentation.',
63
+ runtime: { class: 'slow', typicalSeconds: 300, note: 'LLM-driven; scales with table and column count' },
64
+ },
65
+ doctor: {
66
+ summary: 'Diagnose the local MJ environment and report what is misconfigured.',
67
+ runtime: { class: 'moderate', typicalSeconds: 15 },
68
+ },
69
+ install: {
70
+ summary: 'Install MemberJunction, or seed the Claude Code pack into a repo.',
71
+ runtime: { class: 'slow', typicalSeconds: 300, note: 'downloads a release, installs packages, runs migrations' },
72
+ },
73
+ migrate: {
74
+ summary: 'Create, run, and convert Flyway migrations.',
75
+ runtime: { class: 'slow', typicalSeconds: 90, note: 'scales with the number of pending migrations' },
76
+ },
77
+ plugin: {
78
+ summary: 'Register third-party CLI plugins in mj-cli-plugins.json.',
79
+ runtime: { class: 'fast' },
80
+ },
81
+ querygen: {
82
+ summary: 'Generate, validate, and export stored queries.',
83
+ runtime: { class: 'slow', typicalSeconds: 120, note: 'LLM-driven generation; validation alone is fast' },
84
+ },
85
+ 'sql-audit': {
86
+ summary: 'Audit SQL objects for drift against the metadata.',
87
+ runtime: { class: 'moderate', typicalSeconds: 45, note: 'scales with object count' },
88
+ },
89
+ 'sql-convert': {
90
+ summary: 'Convert T-SQL to PostgreSQL via the SQLConverter toolchain.',
91
+ runtime: { class: 'moderate', typicalSeconds: 30 },
92
+ },
93
+ standards: {
94
+ summary: 'List, adopt, and check the repo’s adopted MJ standards.',
95
+ runtime: { class: 'moderate', typicalSeconds: 20, note: 'a check scans changed files; --all scans the repo' },
96
+ },
97
+ test: {
98
+ summary: 'Run, list, compare, and validate MJ test suites.',
99
+ runtime: { class: 'variable', note: 'a single test is seconds; a full suite can run for many minutes' },
100
+ },
101
+ 'translate-sql': {
102
+ summary: 'Translate SQL between dialects.',
103
+ runtime: { class: 'moderate', typicalSeconds: 15 },
104
+ },
105
+ update: {
106
+ summary: 'Update installed MJ tooling, including the Claude Code pack.',
107
+ runtime: { class: 'moderate', typicalSeconds: 30, note: 'fetches from GitHub unless --from is given' },
108
+ },
109
+ usage: {
110
+ summary: 'This progressive-disclosure surface: domains, then per-domain detail.',
111
+ runtime: { class: 'fast' },
112
+ },
113
+ };
114
+ /** The profile for a domain, falling back to {@link DEFAULT_DOMAIN_PROFILE}. */
115
+ export function getDomainProfile(domain) {
116
+ return DOMAIN_PROFILES[domain] ?? DEFAULT_DOMAIN_PROFILE;
117
+ }
118
+ //# sourceMappingURL=domain-profiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3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,CAAC,MAAM,EAAE,MAAM,CAAC;IAE5B,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAO3B"}
1
+ {"version":3,"file":"domain-usage-command.d.ts","sourceRoot":"","sources":["../../src/lib/domain-usage-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;AAM7C;;;;;GAKG;AACH,8BAAsB,kBAAmB,SAAQ,OAAO;IACtD,MAAM,CAAC,KAAK;;MAMV;IAEF,kEAAkE;IAClE,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAE5B,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ3B"}
@@ -1,5 +1,5 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
- import { CLIPluginRegistry } from '@memberjunction/cli-core';
2
+ import { CLIPluginRegistry, ResolveOutputFormat } from '@memberjunction/cli-core';
3
3
  import { loadAllCliPlugins } from './cli-plugins.js';
4
4
  import { emitUsage, renderDomainDetail } from './usage-render.js';
5
5
  /**
@@ -10,14 +10,19 @@ import { emitUsage, renderDomainDetail } from './usage-render.js';
10
10
  */
11
11
  export class DomainUsageCommand extends Command {
12
12
  static { this.flags = {
13
- format: Flags.string({ options: ['text', 'json', 'md'], default: 'text', description: 'Output format' }),
13
+ // No default: the absence of a value is what lets a piped stdout select json.
14
+ format: Flags.string({
15
+ options: ['text', 'json', 'md'],
16
+ description: 'Output format. Defaults to text on a terminal and json when stdout is piped.',
17
+ }),
14
18
  }; }
15
19
  async run() {
16
20
  const { flags } = await this.parse(this.constructor);
17
- await loadAllCliPlugins(process.cwd());
21
+ await loadAllCliPlugins(process.cwd(), this.config.commands);
18
22
  const detail = CLIPluginRegistry.BuildDomainDetail(this.Domain);
19
23
  const result = CLIPluginRegistry.AsResult(`${this.Domain}:usage`, { domain: detail.domain, commands: detail.commands });
20
- emitUsage((m) => this.log(m), flags.format, result, renderDomainDetail(detail));
24
+ const { format } = ResolveOutputFormat({ formatFlag: flags.format });
25
+ emitUsage((m) => this.log(m), format, result, renderDomainDetail(detail));
21
26
  }
22
27
  }
23
28
  //# sourceMappingURL=domain-usage-command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"domain-usage-command.js","sourceRoot":"","sources":["../../src/lib/domain-usage-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAElE;;;;;GAKG;AACH,MAAM,OAAgB,kBAAmB,SAAQ,OAAO;aAC/C,UAAK,GAAG;QACb,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC;KACzG,CAAC;IAKF,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAwC,CAAC,CAAC;QAClF,MAAM,iBAAiB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACvC,MAAM,MAAM,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,MAAM,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxH,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,MA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C,CAAC;QACrE,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5E,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { type OutputFormat } from '@memberjunction/cli-core';
2
+ export declare const CANONICAL_FORMAT_FLAG: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
3
+ /**
4
+ * The same flag for `mj test *`, which has always spelled its format flag
5
+ * `--format` **with a `-f` shorthand**.
6
+ *
7
+ * Widening the accepted *values* must not narrow the accepted *spellings*: dropping
8
+ * `char` would silently break every script that runs `mj test run -f json` — exactly
9
+ * the class of unannounced breakage this compatibility layer exists to prevent. `-f`
10
+ * is unclaimed across all six `mj test` commands, so restoring it collides with nothing.
11
+ *
12
+ * The `mj ai` family deliberately does NOT get this: `--format` is brand new there
13
+ * (its historical flag is `--output`/`-o`), so there is no `-f` to preserve, and
14
+ * `mj ai audit agent-run` already binds `-f` to `--file` — an output FILE path, so
15
+ * pointing it at a format would repeat the exact `-o` ambiguity described above.
16
+ */
17
+ export declare const TEST_FORMAT_FLAG: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
18
+ /** Inputs to {@link resolveLegacyFormat}. */
19
+ export interface LegacyFormatInput<TLegacy extends string> {
20
+ /** The canonical `--format` value, if the caller passed one. */
21
+ format?: string;
22
+ /** The family's own flag value as oclif parsed it (its default included). */
23
+ legacy: TLegacy;
24
+ /** What that flag falls back to when nothing was specified. */
25
+ legacyDefault: TLegacy;
26
+ /**
27
+ * Whether the caller actually typed the family's flag. Pass
28
+ * `metadata.flags.<name>?.setFromDefault === false` from the command's `parse()`.
29
+ *
30
+ * When omitted this falls back to comparing the value against the default, which
31
+ * cannot distinguish `-o compact` (the caller asking for compact) from no flag at
32
+ * all — so a piped `mj ai agents list -o compact` would silently return json,
33
+ * overriding an explicit request. Always pass it from a real command.
34
+ */
35
+ legacyWasExplicit?: boolean;
36
+ /** How each canonical format maps onto this family's vocabulary. */
37
+ map: Record<OutputFormat, TLegacy>;
38
+ /** Defaults to `process.stdout.isTTY`. Injectable for tests. */
39
+ stdoutIsTTY?: boolean;
40
+ /** Defaults to `process.env`. Injectable for tests. */
41
+ env?: NodeJS.ProcessEnv;
42
+ }
43
+ /**
44
+ * Resolves which value of a family's own output flag to use, honoring — in order:
45
+ *
46
+ * 1. an explicit canonical `--format`,
47
+ * 2. an explicit legacy value (anything other than the family default),
48
+ * 3. `MJ_CLI_FORMAT`,
49
+ * 4. a piped stdout → the family's json value,
50
+ * 5. the family default.
51
+ *
52
+ * Rule 2 is what makes this backwards compatible: an existing script passing
53
+ * `--format=markdown` or `-o table` keeps getting exactly what it always got.
54
+ * Rule 4 only fires when the caller expressed no preference at all, so it can
55
+ * never override an intentional choice — which is precisely why rule 2 needs
56
+ * {@link LegacyFormatInput.legacyWasExplicit} rather than a value comparison.
57
+ */
58
+ export declare function resolveLegacyFormat<TLegacy extends string>(input: LegacyFormatInput<TLegacy>): TLegacy;
59
+ /** Canonical → `mj test *` vocabulary. */
60
+ export declare const TEST_FORMAT_MAP: Record<OutputFormat, 'console' | 'json' | 'markdown'>;
61
+ /**
62
+ * Canonical → `mj ai *` vocabulary.
63
+ *
64
+ * `md` maps to `json` because most `mj ai` commands have no Markdown renderer;
65
+ * the ones that do (`mj ai audit agent-run`) pass their own map with `markdown`.
66
+ */
67
+ export declare const AI_FORMAT_MAP: Record<OutputFormat, 'compact' | 'json' | 'table'>;
68
+ //# sourceMappingURL=format-compat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-compat.d.ts","sourceRoot":"","sources":["../../src/lib/format-compat.ts"],"names":[],"mappings":"AAsBA,OAAO,EAA6C,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAoBxG,eAAO,MAAM,qBAAqB,6GAGhC,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,6GAI3B,CAAC;AAEH,6CAA6C;AAC7C,MAAM,WAAW,iBAAiB,CAAC,OAAO,SAAS,MAAM;IACvD,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,MAAM,EAAE,OAAO,CAAC;IAChB,+DAA+D;IAC/D,aAAa,EAAE,OAAO,CAAC;IACvB;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oEAAoE;IACpE,GAAG,EAAE,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACnC,gEAAgE;IAChE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uDAAuD;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,SAAS,MAAM,EAAE,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG,OAAO,CAiBtG;AAED,0CAA0C;AAC1C,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,YAAY,EAAE,SAAS,GAAG,MAAM,GAAG,UAAU,CAIjF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,YAAY,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAI5E,CAAC"}
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Bridges the per-family output flags to the one canonical `--format` contract.
3
+ *
4
+ * Three command families grew their own spelling of the same idea:
5
+ *
6
+ * | family | flag | values |
7
+ * |------------------|---------------------|-----------------------------|
8
+ * | plugin commands | `--format` | `text` \| `json` \| `md` |
9
+ * | `mj test *` | `--format` | `console` \| `json` \| `markdown` |
10
+ * | `mj ai *` | `--output` / `-o` | `compact` \| `json` \| `table` |
11
+ *
12
+ * An agent that learned one spelling got a parse error — or worse, in the `mj ai`
13
+ * case, silence — from the next. Worse still, `-o` means *output format* under
14
+ * `mj ai` but *output file path* under `mj test`, `querygen export`, and
15
+ * `sql-audit`, so `-o json` writes a file called `json` in half the CLI.
16
+ *
17
+ * {@link resolveLegacyFormat} keeps every existing value working while making all
18
+ * three families accept the canonical spellings and honor the same TTY-detection
19
+ * default. {@link CANONICAL_FORMAT_FLAG} is the shared flag definition to add
20
+ * alongside a family's own.
21
+ */
22
+ import { Flags } from '@oclif/core';
23
+ import { NormalizeFormatAlias, ResolveOutputFormat } from '@memberjunction/cli-core';
24
+ /**
25
+ * The canonical `--format` flag for commands that are not yet `BaseCLIPlugin`
26
+ * subclasses (which inherit it from `baseFlags`).
27
+ *
28
+ * Deliberately has **no `default`**: the absence of a value is the signal that
29
+ * lets {@link resolveLegacyFormat} fall through to the family default or to
30
+ * TTY detection. A default here would make every run look explicit.
31
+ *
32
+ * Note `char` is omitted — `-f` and `-o` already mean other things in these
33
+ * families, and quietly rebinding a short flag is how the `-o` collision started.
34
+ */
35
+ const FORMAT_VALUES = ['text', 'json', 'md', 'human', 'console', 'markdown', 'compact', 'table'];
36
+ const FORMAT_DESCRIPTION = 'Output format: text (human), json (machine-readable), md (Markdown). ' +
37
+ 'Defaults to human output on a terminal and json when stdout is piped. ' +
38
+ 'Legacy spellings (console/markdown/compact/table) are accepted.';
39
+ export const CANONICAL_FORMAT_FLAG = Flags.string({
40
+ options: FORMAT_VALUES,
41
+ description: FORMAT_DESCRIPTION,
42
+ });
43
+ /**
44
+ * The same flag for `mj test *`, which has always spelled its format flag
45
+ * `--format` **with a `-f` shorthand**.
46
+ *
47
+ * Widening the accepted *values* must not narrow the accepted *spellings*: dropping
48
+ * `char` would silently break every script that runs `mj test run -f json` — exactly
49
+ * the class of unannounced breakage this compatibility layer exists to prevent. `-f`
50
+ * is unclaimed across all six `mj test` commands, so restoring it collides with nothing.
51
+ *
52
+ * The `mj ai` family deliberately does NOT get this: `--format` is brand new there
53
+ * (its historical flag is `--output`/`-o`), so there is no `-f` to preserve, and
54
+ * `mj ai audit agent-run` already binds `-f` to `--file` — an output FILE path, so
55
+ * pointing it at a format would repeat the exact `-o` ambiguity described above.
56
+ */
57
+ export const TEST_FORMAT_FLAG = Flags.string({
58
+ char: 'f',
59
+ options: FORMAT_VALUES,
60
+ description: FORMAT_DESCRIPTION,
61
+ });
62
+ /**
63
+ * Resolves which value of a family's own output flag to use, honoring — in order:
64
+ *
65
+ * 1. an explicit canonical `--format`,
66
+ * 2. an explicit legacy value (anything other than the family default),
67
+ * 3. `MJ_CLI_FORMAT`,
68
+ * 4. a piped stdout → the family's json value,
69
+ * 5. the family default.
70
+ *
71
+ * Rule 2 is what makes this backwards compatible: an existing script passing
72
+ * `--format=markdown` or `-o table` keeps getting exactly what it always got.
73
+ * Rule 4 only fires when the caller expressed no preference at all, so it can
74
+ * never override an intentional choice — which is precisely why rule 2 needs
75
+ * {@link LegacyFormatInput.legacyWasExplicit} rather than a value comparison.
76
+ */
77
+ export function resolveLegacyFormat(input) {
78
+ const explicitCanonical = NormalizeFormatAlias(input.format);
79
+ if (explicitCanonical)
80
+ return input.map[explicitCanonical];
81
+ // The caller typed the family's own flag — an explicit choice that outranks any
82
+ // inference we could make, even when the value they typed IS the default.
83
+ const legacyWasExplicit = input.legacyWasExplicit ?? input.legacy !== input.legacyDefault;
84
+ if (legacyWasExplicit)
85
+ return input.legacy;
86
+ const { format, reason } = ResolveOutputFormat({
87
+ stdoutIsTTY: input.stdoutIsTTY,
88
+ env: input.env,
89
+ });
90
+ // 'tty-default' means nothing at all asked for a format — keep the family's own
91
+ // default rather than flattening every human rendering to a generic 'text'.
92
+ return reason === 'tty-default' ? input.legacyDefault : input.map[format];
93
+ }
94
+ /** Canonical → `mj test *` vocabulary. */
95
+ export const TEST_FORMAT_MAP = {
96
+ text: 'console',
97
+ json: 'json',
98
+ md: 'markdown',
99
+ };
100
+ /**
101
+ * Canonical → `mj ai *` vocabulary.
102
+ *
103
+ * `md` maps to `json` because most `mj ai` commands have no Markdown renderer;
104
+ * the ones that do (`mj ai audit agent-run`) pass their own map with `markdown`.
105
+ */
106
+ export const AI_FORMAT_MAP = {
107
+ text: 'compact',
108
+ json: 'json',
109
+ md: 'json',
110
+ };
111
+ //# sourceMappingURL=format-compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-compat.js","sourceRoot":"","sources":["../../src/lib/format-compat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAqB,MAAM,0BAA0B,CAAC;AAExG;;;;;;;;;;GAUG;AACH,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAEjG,MAAM,kBAAkB,GACtB,uEAAuE;IACvE,wEAAwE;IACxE,iEAAiE,CAAC;AAEpE,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC,MAAM,CAAC;IAChD,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,kBAAkB;CAChC,CAAC,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,GAAG;IACT,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,kBAAkB;CAChC,CAAC,CAAC;AA4BH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,mBAAmB,CAAyB,KAAiC;IAC3F,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7D,IAAI,iBAAiB;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAE3D,gFAAgF;IAChF,0EAA0E;IAC1E,MAAM,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,aAAa,CAAC;IAC1F,IAAI,iBAAiB;QAAE,OAAO,KAAK,CAAC,MAAM,CAAC;IAE3C,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,mBAAmB,CAAC;QAC7C,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,GAAG,EAAE,KAAK,CAAC,GAAG;KACf,CAAC,CAAC;IAEH,gFAAgF;IAChF,4EAA4E;IAC5E,OAAO,MAAM,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC5E,CAAC;AAED,0CAA0C;AAC1C,MAAM,CAAC,MAAM,eAAe,GAA0D;IACpF,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,MAAM;IACZ,EAAE,EAAE,UAAU;CACf,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAuD;IAC/E,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,MAAM;IACZ,EAAE,EAAE,MAAM;CACX,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * MJCLI-side helpers for the agent-first interactivity contract (see
3
+ * `@memberjunction/cli-core`'s `interaction.ts` for the model).
4
+ *
5
+ * These exist because most `mj` commands are still plain oclif `Command`s rather
6
+ * than `BaseCLIPlugin` subclasses, so they don't inherit `--interactive` or the
7
+ * structured `NonInteractiveError` handling. They read the same env signal the prerun
8
+ * hook sets from that flag, which keeps a migrated plugin and an unmigrated command
9
+ * behaving identically at the prompt — and both of them detecting a terminal the same
10
+ * way when no flag is given.
11
+ */
12
+ import { NonInteractiveError, RequireInteractive, ResolveOrPrompt, type InteractivityInput } from '@memberjunction/cli-core';
13
+ export { NonInteractiveError };
14
+ /**
15
+ * Whether this run may prompt: true at a real terminal, false when piped, spawned, or
16
+ * running in CI. Reads the env var the prerun hook sets from the global `--interactive`
17
+ * / `--no-interactive` flags, then falls back to detecting the terminal.
18
+ */
19
+ export declare function isInteractiveRun(overrides?: InteractivityInput): boolean;
20
+ /**
21
+ * Asks for one value, or fails fast naming the flag that supplies it.
22
+ *
23
+ * Thin re-export of cli-core's `ResolveOrPrompt` so unmigrated commands import from
24
+ * one place and pick up the env-based interactivity default automatically.
25
+ */
26
+ export declare const resolveOrPrompt: typeof ResolveOrPrompt;
27
+ /** Guards a command that is interactive by nature and has no flag equivalent. */
28
+ export declare const requireInteractive: typeof RequireInteractive;
29
+ /**
30
+ * Renders a {@link NonInteractiveError} through oclif's error path for commands that
31
+ * aren't `BaseCLIPlugin` subclasses (which get the structured envelope instead).
32
+ *
33
+ * Sets exit code 1 and prints the suggestion, so an agent reading stderr still gets
34
+ * the flag to pass — the important half of the contract — even before the command is
35
+ * migrated.
36
+ *
37
+ * Re-throws anything that isn't a `NonInteractiveError` untouched.
38
+ */
39
+ export declare function failOnNonInteractive(command: {
40
+ error: (message: string | Error, options?: {
41
+ exit?: number;
42
+ suggestions?: string[];
43
+ }) => never;
44
+ }, error: unknown): never;
45
+ /**
46
+ * Wraps a command body so any {@link NonInteractiveError} raised anywhere inside it
47
+ * — including deep in a service callback — surfaces as a clean, actionable failure
48
+ * instead of an unhandled rejection.
49
+ */
50
+ export declare function withNonInteractiveHandling<T>(command: {
51
+ error: (message: string | Error, options?: {
52
+ exit?: number;
53
+ suggestions?: string[];
54
+ }) => never;
55
+ }, body: () => Promise<T>): Promise<T>;
56
+ //# sourceMappingURL=interactive-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactive-guard.d.ts","sourceRoot":"","sources":["../../src/lib/interactive-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAElB,eAAe,EACf,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,GAAE,kBAAuB,GAAG,OAAO,CAE5E;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,wBAAkB,CAAC;AAE/C,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,2BAAqB,CAAC;AAErD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE;IAAE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,KAAK,KAAK,CAAA;CAAE,EAC3G,KAAK,EAAE,OAAO,GACb,KAAK,CAKP;AAED;;;;GAIG;AACH,wBAAsB,0BAA0B,CAAC,CAAC,EAChD,OAAO,EAAE;IAAE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,KAAK,KAAK,CAAA;CAAE,EAC3G,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACrB,OAAO,CAAC,CAAC,CAAC,CAMZ"}