@mandujs/cli 0.9.46 → 0.11.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.
- package/package.json +3 -2
- package/src/commands/check.ts +290 -238
- package/src/commands/dev.ts +486 -440
- package/src/commands/init.ts +128 -21
- package/src/commands/lock.ts +434 -0
- package/src/commands/registry.ts +357 -0
- package/src/hooks/index.ts +17 -0
- package/src/hooks/preaction.ts +256 -0
- package/src/main.ts +228 -419
- package/src/terminal/banner.ts +166 -0
- package/src/terminal/help.ts +306 -0
- package/src/terminal/index.ts +71 -0
- package/src/terminal/output.ts +295 -0
- package/src/terminal/palette.ts +30 -0
- package/src/terminal/progress.ts +327 -0
- package/src/terminal/stream-writer.ts +214 -0
- package/src/terminal/table.ts +354 -0
- package/src/terminal/theme.ts +142 -0
- package/src/util/output.ts +7 -26
package/src/util/output.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { getOutputMode } from "../terminal/output";
|
|
2
|
+
|
|
1
3
|
export type OutputFormat = "console" | "agent" | "json";
|
|
2
4
|
|
|
3
5
|
function normalizeFormat(value?: string): OutputFormat | undefined {
|
|
4
6
|
if (!value) return undefined;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
const normalized = value.toLowerCase();
|
|
8
|
+
if (normalized === "console" || normalized === "agent" || normalized === "json") {
|
|
9
|
+
return normalized;
|
|
7
10
|
}
|
|
8
11
|
return undefined;
|
|
9
12
|
}
|
|
@@ -14,28 +17,6 @@ export function resolveOutputFormat(explicit?: OutputFormat): OutputFormat {
|
|
|
14
17
|
const direct = normalizeFormat(explicit) ?? normalizeFormat(env.MANDU_OUTPUT);
|
|
15
18
|
if (direct) return direct;
|
|
16
19
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
"CODEX_AGENT",
|
|
20
|
-
"CODEX",
|
|
21
|
-
"CLAUDE_CODE",
|
|
22
|
-
"ANTHROPIC_CLAUDE_CODE",
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
for (const key of agentSignals) {
|
|
26
|
-
const value = env[key];
|
|
27
|
-
if (value === "1" || value === "true") {
|
|
28
|
-
return "json";
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (env.CI === "true") {
|
|
33
|
-
return "json";
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (process.stdout && !process.stdout.isTTY) {
|
|
37
|
-
return "json";
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return "console";
|
|
20
|
+
const mode = getOutputMode();
|
|
21
|
+
return mode === "json" ? "json" : "console";
|
|
41
22
|
}
|