@rage-against-the-pixel/unity-cli 1.8.3 → 2.0.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/README.md +128 -66
- package/dist/cli.js +260 -33
- package/dist/cli.js.map +1 -1
- package/dist/github-actions-ci.d.ts +21 -0
- package/dist/github-actions-ci.js +137 -0
- package/dist/github-actions-ci.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/logger-provider.d.ts +35 -0
- package/dist/logger-provider.js +48 -0
- package/dist/logger-provider.js.map +1 -0
- package/dist/logging.d.ts +89 -4
- package/dist/logging.js +780 -186
- package/dist/logging.js.map +1 -1
- package/dist/unity-editor.d.ts +7 -0
- package/dist/unity-editor.js +26 -1
- package/dist/unity-editor.js.map +1 -1
- package/dist/unity-hub.js +13 -5
- package/dist/unity-hub.js.map +1 -1
- package/dist/unity-logging.d.ts +23 -1
- package/dist/unity-logging.js +259 -12
- package/dist/unity-logging.js.map +1 -1
- package/dist/upm-cli.d.ts +80 -0
- package/dist/upm-cli.js +459 -0
- package/dist/upm-cli.js.map +1 -0
- package/dist/utilities.d.ts +49 -0
- package/dist/utilities.js +204 -12
- package/dist/utilities.js.map +1 -1
- package/dist/{utp/utp.d.ts → utp.d.ts} +21 -3
- package/dist/{utp/utp.js → utp.js} +25 -12
- package/dist/utp.js.map +1 -0
- package/package.json +7 -2
- package/dist/utp/utp.js.map +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ILoggerProvider, LoggerAnnotationOptions, LoggerProviderLevel, MarkdownTarget } from './logger-provider';
|
|
2
|
+
export declare enum GitHubAnnotationLevel {
|
|
3
|
+
Notice = "notice",
|
|
4
|
+
Warning = "warning",
|
|
5
|
+
Error = "error"
|
|
6
|
+
}
|
|
7
|
+
/** When set to 1/true/yes/on (case-insensitive), unity-cli may append to `GITHUB_STEP_SUMMARY`. Default: off. */
|
|
8
|
+
export declare function isUnityCliWorkflowSummaryEnabled(): boolean;
|
|
9
|
+
export declare class GitHubActionsLoggerProvider implements ILoggerProvider {
|
|
10
|
+
readonly isCi: boolean;
|
|
11
|
+
log(level: LoggerProviderLevel, message: any, optionalParams?: any[]): void;
|
|
12
|
+
startGroup(message: any, optionalParams?: any[]): void;
|
|
13
|
+
endGroup(): void;
|
|
14
|
+
annotate(level: GitHubAnnotationLevel, message: string, options?: LoggerAnnotationOptions): void;
|
|
15
|
+
mask(message: string): void;
|
|
16
|
+
setEnvironmentVariable(name: string, value: string): void;
|
|
17
|
+
setOutput(name: string, value: string): void;
|
|
18
|
+
appendStepSummary(summary: string): void;
|
|
19
|
+
getMarkdownByteLimit(target: MarkdownTarget): number;
|
|
20
|
+
private escapeGitHubCommandValue;
|
|
21
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.GitHubActionsLoggerProvider = exports.GitHubAnnotationLevel = void 0;
|
|
37
|
+
exports.isUnityCliWorkflowSummaryEnabled = isUnityCliWorkflowSummaryEnabled;
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
var GitHubAnnotationLevel;
|
|
40
|
+
(function (GitHubAnnotationLevel) {
|
|
41
|
+
GitHubAnnotationLevel["Notice"] = "notice";
|
|
42
|
+
GitHubAnnotationLevel["Warning"] = "warning";
|
|
43
|
+
GitHubAnnotationLevel["Error"] = "error";
|
|
44
|
+
})(GitHubAnnotationLevel || (exports.GitHubAnnotationLevel = GitHubAnnotationLevel = {}));
|
|
45
|
+
/** When set to 1/true/yes/on (case-insensitive), unity-cli may append to `GITHUB_STEP_SUMMARY`. Default: off. */
|
|
46
|
+
function isUnityCliWorkflowSummaryEnabled() {
|
|
47
|
+
const v = process.env.UNITY_CLI_WORKFLOW_SUMMARY?.trim().toLowerCase();
|
|
48
|
+
return v === '1' || v === 'true' || v === 'yes' || v === 'on';
|
|
49
|
+
}
|
|
50
|
+
class GitHubActionsLoggerProvider {
|
|
51
|
+
isCi = process.env.GITHUB_ACTIONS === 'true';
|
|
52
|
+
log(level, message, optionalParams = []) {
|
|
53
|
+
switch (level) {
|
|
54
|
+
case 'debug': {
|
|
55
|
+
message.toString().split('\n').forEach((line) => {
|
|
56
|
+
process.stdout.write(`::debug::${line}\n`, ...optionalParams);
|
|
57
|
+
});
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
case 'ci':
|
|
61
|
+
case 'info':
|
|
62
|
+
process.stdout.write(`${message}\n`, ...optionalParams);
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
process.stdout.write(`::${level}::${message}\n`, ...optionalParams);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
startGroup(message, optionalParams = []) {
|
|
70
|
+
const firstLine = message.toString().split('\n')[0];
|
|
71
|
+
process.stdout.write(`::group::${firstLine}\n`, ...optionalParams);
|
|
72
|
+
}
|
|
73
|
+
endGroup() {
|
|
74
|
+
process.stdout.write('::endgroup::\n');
|
|
75
|
+
}
|
|
76
|
+
annotate(level, message, options) {
|
|
77
|
+
const parts = [];
|
|
78
|
+
const appendPart = (key, value) => {
|
|
79
|
+
if (value === undefined || value === null) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const stringValue = value.toString();
|
|
83
|
+
if (stringValue.length === 0) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
parts.push(`${key}=${this.escapeGitHubCommandValue(stringValue)}`);
|
|
87
|
+
};
|
|
88
|
+
appendPart('file', options?.file);
|
|
89
|
+
if (options?.line !== undefined && options.line > 0)
|
|
90
|
+
appendPart('line', options.line);
|
|
91
|
+
if (options?.endLine !== undefined && options.endLine > 0)
|
|
92
|
+
appendPart('endLine', options.endLine);
|
|
93
|
+
if (options?.column !== undefined && options.column > 0)
|
|
94
|
+
appendPart('col', options.column);
|
|
95
|
+
if (options?.endColumn !== undefined && options.endColumn > 0)
|
|
96
|
+
appendPart('endColumn', options.endColumn);
|
|
97
|
+
appendPart('title', options?.title);
|
|
98
|
+
const metadata = parts.length > 0 ? ` ${parts.join(',')}` : '';
|
|
99
|
+
process.stdout.write(`::${level}${metadata}::${this.escapeGitHubCommandValue(message)}\n`);
|
|
100
|
+
}
|
|
101
|
+
mask(message) {
|
|
102
|
+
process.stdout.write(`::add-mask::${message}\n`);
|
|
103
|
+
}
|
|
104
|
+
setEnvironmentVariable(name, value) {
|
|
105
|
+
const githubEnv = process.env.GITHUB_ENV;
|
|
106
|
+
if (githubEnv) {
|
|
107
|
+
fs.appendFileSync(githubEnv, `${name}=${value}\n`, { encoding: 'utf8' });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
setOutput(name, value) {
|
|
111
|
+
const githubOutput = process.env.GITHUB_OUTPUT;
|
|
112
|
+
if (githubOutput) {
|
|
113
|
+
fs.appendFileSync(githubOutput, `${name}=${value}\n`, { encoding: 'utf8' });
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
appendStepSummary(summary) {
|
|
117
|
+
const githubSummary = process.env.GITHUB_STEP_SUMMARY;
|
|
118
|
+
if (!githubSummary) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
fs.appendFileSync(githubSummary, summary, { encoding: 'utf8' });
|
|
122
|
+
}
|
|
123
|
+
getMarkdownByteLimit(target) {
|
|
124
|
+
if (target === 'workflow-summary' && isUnityCliWorkflowSummaryEnabled()) {
|
|
125
|
+
return 1024 * 1024;
|
|
126
|
+
}
|
|
127
|
+
return Number.POSITIVE_INFINITY;
|
|
128
|
+
}
|
|
129
|
+
escapeGitHubCommandValue(value) {
|
|
130
|
+
return value
|
|
131
|
+
.replace(/%/g, '%25')
|
|
132
|
+
.replace(/\r/g, '%0D')
|
|
133
|
+
.replace(/\n/g, '%0A');
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
exports.GitHubActionsLoggerProvider = GitHubActionsLoggerProvider;
|
|
137
|
+
//# sourceMappingURL=github-actions-ci.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-actions-ci.js","sourceRoot":"","sources":["../src/github-actions-ci.ts"],"names":[],"mappings":";;;;;;;;;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C,OAAe;QACpC,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;QACtD,IAAI,CAAC,aAAa,EAAE,CAAC;YAAC,OAAO;QAAC,CAAC;QAC/B,EAAE,CAAC,cAAc,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IACpE,CAAC;IAEM,oBAAoB,CAAC,MAAsB;QAC9C,IAAI,MAAM,KAAK,kBAAkB,IAAI,gCAAgC,EAAE,EAAE,CAAC;YACtE,OAAO,IAAI,GAAG,IAAI,CAAC;QACvB,CAAC;QACD,OAAO,MAAM,CAAC,iBAAiB,CAAC;IACpC,CAAC;IAEO,wBAAwB,CAAC,KAAa;QAC1C,OAAO,KAAK;aACP,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;aACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;aACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;CACJ;AAvFD,kEAuFC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -24,4 +24,5 @@ __exportStar(require("./unity-project"), exports);
|
|
|
24
24
|
__exportStar(require("./unity-version"), exports);
|
|
25
25
|
__exportStar(require("./utilities"), exports);
|
|
26
26
|
__exportStar(require("./unity-logging"), exports);
|
|
27
|
+
__exportStar(require("./upm-cli"), exports);
|
|
27
28
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oBAAoB;AACpB,gDAA8B;AAC9B,mDAAiC;AACjC,4CAA0B;AAC1B,iDAA+B;AAC/B,8CAA4B;AAC5B,kDAAgC;AAChC,kDAAgC;AAChC,8CAA4B;AAC5B,kDAAgC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oBAAoB;AACpB,gDAA8B;AAC9B,mDAAiC;AACjC,4CAA0B;AAC1B,iDAA+B;AAC/B,8CAA4B;AAC5B,kDAAgC;AAChC,kDAAgC;AAChC,8CAA4B;AAC5B,kDAAgC;AAChC,4CAA0B"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type MarkdownTarget = 'workflow-summary' | 'stdout';
|
|
2
|
+
export type LoggerProviderLevel = 'debug' | 'ci' | 'utp' | 'info' | 'warning' | 'error';
|
|
3
|
+
export type LoggerProviderAnnotationLevel = 'notice' | 'warning' | 'error';
|
|
4
|
+
export interface LoggerAnnotationOptions {
|
|
5
|
+
file?: string;
|
|
6
|
+
line?: number;
|
|
7
|
+
endLine?: number;
|
|
8
|
+
column?: number;
|
|
9
|
+
endColumn?: number;
|
|
10
|
+
title?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ILoggerProvider {
|
|
13
|
+
readonly isCi: boolean;
|
|
14
|
+
log(level: LoggerProviderLevel, message: any, optionalParams?: any[]): void;
|
|
15
|
+
startGroup(message: any, optionalParams?: any[]): void;
|
|
16
|
+
endGroup(): void;
|
|
17
|
+
annotate(level: LoggerProviderAnnotationLevel, message: string, options?: LoggerAnnotationOptions): void;
|
|
18
|
+
mask(message: string): void;
|
|
19
|
+
setEnvironmentVariable(name: string, value: string): void;
|
|
20
|
+
setOutput(name: string, value: string): void;
|
|
21
|
+
appendStepSummary(summary: string): void;
|
|
22
|
+
getMarkdownByteLimit(target: MarkdownTarget): number;
|
|
23
|
+
}
|
|
24
|
+
export declare class LocalCliLoggerProvider implements ILoggerProvider {
|
|
25
|
+
readonly isCi = false;
|
|
26
|
+
log(level: LoggerProviderLevel, message: any, optionalParams?: any[]): void;
|
|
27
|
+
startGroup(message: any, optionalParams?: any[]): void;
|
|
28
|
+
endGroup(): void;
|
|
29
|
+
annotate(level: LoggerProviderAnnotationLevel, message: string): void;
|
|
30
|
+
mask(_message: string): void;
|
|
31
|
+
setEnvironmentVariable(_name: string, _value: string): void;
|
|
32
|
+
setOutput(_name: string, _value: string): void;
|
|
33
|
+
appendStepSummary(_summary: string): void;
|
|
34
|
+
getMarkdownByteLimit(_target: MarkdownTarget): number;
|
|
35
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LocalCliLoggerProvider = void 0;
|
|
4
|
+
class LocalCliLoggerProvider {
|
|
5
|
+
isCi = false;
|
|
6
|
+
log(level, message, optionalParams = []) {
|
|
7
|
+
const stringColor = {
|
|
8
|
+
debug: '\x1b[35m',
|
|
9
|
+
ci: undefined,
|
|
10
|
+
utp: undefined,
|
|
11
|
+
info: undefined,
|
|
12
|
+
warning: '\x1b[33m',
|
|
13
|
+
error: '\x1b[31m',
|
|
14
|
+
}[level];
|
|
15
|
+
if (stringColor && stringColor.length > 0) {
|
|
16
|
+
process.stdout.write(`${stringColor}${message}\x1b[0m\n`, ...optionalParams);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
process.stdout.write(`${message}\n`, ...optionalParams);
|
|
20
|
+
}
|
|
21
|
+
startGroup(message, optionalParams = []) {
|
|
22
|
+
this.log('info', message, optionalParams);
|
|
23
|
+
}
|
|
24
|
+
endGroup() {
|
|
25
|
+
// no-op for local terminal
|
|
26
|
+
}
|
|
27
|
+
annotate(level, message) {
|
|
28
|
+
const mapped = level === 'error' ? 'error' : (level === 'warning' ? 'warning' : 'info');
|
|
29
|
+
this.log(mapped, message);
|
|
30
|
+
}
|
|
31
|
+
mask(_message) {
|
|
32
|
+
// no-op for local terminal
|
|
33
|
+
}
|
|
34
|
+
setEnvironmentVariable(_name, _value) {
|
|
35
|
+
// no-op for local terminal
|
|
36
|
+
}
|
|
37
|
+
setOutput(_name, _value) {
|
|
38
|
+
// no-op for local terminal
|
|
39
|
+
}
|
|
40
|
+
appendStepSummary(_summary) {
|
|
41
|
+
// no-op for local terminal
|
|
42
|
+
}
|
|
43
|
+
getMarkdownByteLimit(_target) {
|
|
44
|
+
return Number.POSITIVE_INFINITY;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.LocalCliLoggerProvider = LocalCliLoggerProvider;
|
|
48
|
+
//# sourceMappingURL=logger-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger-provider.js","sourceRoot":"","sources":["../src/logger-provider.ts"],"names":[],"mappings":";;;AA0BA,MAAa,sBAAsB;IACf,IAAI,GAAG,KAAK,CAAC;IAEtB,GAAG,CAAC,KAA0B,EAAE,OAAY,EAAE,iBAAwB,EAAE;QAC3E,MAAM,WAAW,GAAuB;YACpC,KAAK,EAAE,UAAU;YACjB,EAAE,EAAE,SAAS;YACb,GAAG,EAAE,SAAS;YACd,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,UAAU;YACnB,KAAK,EAAE,UAAU;SACpB,CAAC,KAAK,CAAC,CAAC;QACT,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,WAAW,GAAG,OAAO,WAAW,EAAE,GAAG,cAAc,CAAC,CAAC;YAC7E,OAAO;QACX,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,EAAE,GAAG,cAAc,CAAC,CAAC;IAC5D,CAAC;IAEM,UAAU,CAAC,OAAY,EAAE,iBAAwB,EAAE;QACtD,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;IAC9C,CAAC;IAEM,QAAQ;QACX,2BAA2B;IAC/B,CAAC;IAEM,QAAQ,CAAC,KAAoC,EAAE,OAAe;QACjE,MAAM,MAAM,GAAwB,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QAC7G,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,CAAC;IAEM,IAAI,CAAC,QAAgB;QACxB,2BAA2B;IAC/B,CAAC;IAEM,sBAAsB,CAAC,KAAa,EAAE,MAAc;QACvD,2BAA2B;IAC/B,CAAC;IAEM,SAAS,CAAC,KAAa,EAAE,MAAc;QAC1C,2BAA2B;IAC/B,CAAC;IAEM,iBAAiB,CAAC,QAAgB;QACrC,2BAA2B;IAC/B,CAAC;IAEM,oBAAoB,CAAC,OAAuB;QAC/C,OAAO,MAAM,CAAC,iBAAiB,CAAC;IACpC,CAAC;CACJ;AAnDD,wDAmDC"}
|
package/dist/logging.d.ts
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
import { UTP } from './utp';
|
|
2
|
+
import { MarkdownTarget } from './logger-provider';
|
|
3
|
+
/**
|
|
4
|
+
* Merges LogEntry/Compiler rows by message+file+line; on collision keeps the more severe entry.
|
|
5
|
+
* Exported for unit tests.
|
|
6
|
+
*/
|
|
7
|
+
export declare function mergeLogEntriesPreferringSeverity(candidates: UTP[]): UTP[];
|
|
8
|
+
/** Single test result row for summary and CLI table. */
|
|
9
|
+
export interface TestResultSummary {
|
|
10
|
+
status: string;
|
|
11
|
+
durationMs: number;
|
|
12
|
+
description: string;
|
|
13
|
+
message?: string;
|
|
14
|
+
file?: string;
|
|
15
|
+
line?: number;
|
|
16
|
+
}
|
|
17
|
+
/** Maps UTPTestStatus.state to display status (Unity/NUnit-style: 0 Inconclusive, 1 Passed, 2 Failed, 3 Skipped). */
|
|
18
|
+
export declare function testStatusFromState(state: number | undefined): string;
|
|
19
|
+
/** Converts a single TestStatus UTP to TestResultSummary. Exported for CLI use. */
|
|
20
|
+
export declare function utpToTestResultSummary(e: UTP): TestResultSummary;
|
|
21
|
+
/** Builds a markdown table string for test results (Status | Duration | Test). Exported for CLI use. */
|
|
22
|
+
export declare function buildTestResultsTableMarkdown(testResults: TestResultSummary[], byteLimit: number, prefix?: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Rich unit-test markdown block used by workflow summary and stdout.
|
|
25
|
+
* Keeps byte-budget behavior and truncation hints.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildUnitTestJobSummaryMarkdown(testResults: TestResultSummary[], byteLimit: number, prefix?: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Truncates s to fit within maxBytes in UTF-8. If truncated, appends an ellipsis (…).
|
|
30
|
+
* If s already fits, returns s unchanged.
|
|
31
|
+
* Exported for unit tests.
|
|
32
|
+
*/
|
|
33
|
+
export declare function truncateStringToUtf8ByteLength(s: string, maxBytes: number): string;
|
|
34
|
+
/**
|
|
35
|
+
* Removes known noise phrases from a log message for summary display.
|
|
36
|
+
* Exported for unit tests.
|
|
37
|
+
*/
|
|
38
|
+
export declare function stripSummaryNoiseFromLogMessage(message: string): string;
|
|
1
39
|
export declare enum LogLevel {
|
|
2
40
|
DEBUG = "debug",
|
|
3
41
|
CI = "ci",
|
|
@@ -8,10 +46,9 @@ export declare enum LogLevel {
|
|
|
8
46
|
}
|
|
9
47
|
export declare class Logger {
|
|
10
48
|
logLevel: LogLevel;
|
|
11
|
-
private readonly
|
|
49
|
+
private readonly _provider;
|
|
12
50
|
static readonly instance: Logger;
|
|
13
51
|
private constructor();
|
|
14
|
-
private printLine;
|
|
15
52
|
/**
|
|
16
53
|
* Logs a message to the console.
|
|
17
54
|
* @param level The log level for this message.
|
|
@@ -49,13 +86,36 @@ export declare class Logger {
|
|
|
49
86
|
* @param title The title of the annotation.
|
|
50
87
|
*/
|
|
51
88
|
annotate(logLevel: LogLevel, message: string, file?: string, line?: number, endLine?: number, column?: number, endColumn?: number, title?: string): void;
|
|
52
|
-
private escapeGitHubCommandValue;
|
|
53
89
|
private shouldLog;
|
|
54
90
|
/**
|
|
55
91
|
* Masks a string in the console output in CI environments that support it.
|
|
56
92
|
* @param message The string to mask.
|
|
57
93
|
*/
|
|
58
94
|
CI_mask(message: string): void;
|
|
95
|
+
/**
|
|
96
|
+
* Masks a credential value in CI environments before it appears in logs.
|
|
97
|
+
* This is a convenience wrapper around CI_mask for credential values.
|
|
98
|
+
* @param value The credential value to mask.
|
|
99
|
+
*/
|
|
100
|
+
maskCredential(value: string | undefined): void;
|
|
101
|
+
/**
|
|
102
|
+
* Logs command-line options with sensitive information scrubbed.
|
|
103
|
+
* Automatically removes passwords, tokens, emails, and other credentials from the output.
|
|
104
|
+
* @param options The options object to log (typically from commander.js).
|
|
105
|
+
* @param optionalParams Additional parameters to log.
|
|
106
|
+
*/
|
|
107
|
+
debugOptions(options: any, ...optionalParams: any[]): void;
|
|
108
|
+
/**
|
|
109
|
+
* List of sensitive option keys that should be scrubbed from debug output.
|
|
110
|
+
*/
|
|
111
|
+
private readonly SENSITIVE_KEYS;
|
|
112
|
+
/**
|
|
113
|
+
* Scrubs sensitive information from an object for safe logging.
|
|
114
|
+
* Creates a deep clone of the object and replaces sensitive values with [REDACTED].
|
|
115
|
+
* @param obj The object to scrub (typically command-line options).
|
|
116
|
+
* @returns A new object with sensitive values replaced.
|
|
117
|
+
*/
|
|
118
|
+
private scrubSensitiveData;
|
|
59
119
|
/**
|
|
60
120
|
* Sets an environment variable in CI environments that support it.
|
|
61
121
|
* @param name The name of the environment variable.
|
|
@@ -63,5 +123,30 @@ export declare class Logger {
|
|
|
63
123
|
*/
|
|
64
124
|
CI_setEnvironmentVariable(name: string, value: string): void;
|
|
65
125
|
CI_setOutput(name: string, value: string): void;
|
|
66
|
-
|
|
126
|
+
private static formatDurationMs;
|
|
127
|
+
private static truncateStr;
|
|
128
|
+
private static truncateSummaryToByteLimit;
|
|
129
|
+
/**
|
|
130
|
+
* Returns the markdown byte limit for a given output target.
|
|
131
|
+
* Workflow summary may be backend constrained; stdout is intentionally uncapped.
|
|
132
|
+
*/
|
|
133
|
+
getMarkdownByteLimit(target: MarkdownTarget): number;
|
|
134
|
+
CI_appendWorkflowSummary(name: string, telemetry: UTP[], options?: {
|
|
135
|
+
projectPath?: string;
|
|
136
|
+
additionalLogEntries?: UTP[];
|
|
137
|
+
}): void;
|
|
138
|
+
/**
|
|
139
|
+
* Builds summary: stats + action table + unit-test block + severity foldouts.
|
|
140
|
+
*/
|
|
141
|
+
private buildSummaryTimelineAndMergedLog;
|
|
142
|
+
/**
|
|
143
|
+
* Builds summary with timeline in a <details> and merged log foldouts by severity.
|
|
144
|
+
* Used when primary builder would exceed size limit.
|
|
145
|
+
*/
|
|
146
|
+
private buildSummaryCollapsibleWithMergedLog;
|
|
147
|
+
/**
|
|
148
|
+
* Fallback: list timeline (when actions exist) + unit-test block (when present) + compact count lines.
|
|
149
|
+
* Used when even collapsible summary would exceed 1 MB.
|
|
150
|
+
*/
|
|
151
|
+
private buildSummaryTimelineAndCounts;
|
|
67
152
|
}
|