ma-agents 3.17.0-beta.4 → 3.17.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.
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"name": "ma-skills",
|
|
38
38
|
"source": "./",
|
|
39
39
|
"description": "ma-agents extension module providing enterprise SDLC personas and operational workflow skills.",
|
|
40
|
-
"version": "3.17.0
|
|
40
|
+
"version": "3.17.0",
|
|
41
41
|
"author": {
|
|
42
42
|
"name": "Alon Mayaffit"
|
|
43
43
|
},
|
package/lib/diag.js
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Log-file-only diagnostics.
|
|
5
|
-
*
|
|
6
|
-
* When `--log` is active, bin/cli.js#setupLogging installs a sink that writes
|
|
7
|
-
* to the log file descriptor. `diag()`/`diagError()` then emit structured
|
|
8
|
-
* breadcrumbs to the LOG FILE ONLY — never to the user's console (the wizard's
|
|
9
|
-
* user-facing output intentionally stays clean; e.g. a failed custom-marketplace
|
|
10
|
-
* source shows a one-line message, not a raw stack — NFR71). Without a sink
|
|
11
|
-
* (no `--log`), every call is a cheap no-op.
|
|
12
|
-
*
|
|
13
|
-
* This is how the swallowed root cause of a custom-marketplace failure (the
|
|
14
|
-
* git/clone/resolve error behind a clean CustomMarketplaceError, the per-entry
|
|
15
|
-
* module_definition that was missing, the FR238 zero-module trigger, etc.)
|
|
16
|
-
* reaches the log for post-hoc diagnosis without leaking to the terminal.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
let sink = null;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @param {((text: string) => void)|null} fn - writer for log-file output, or null to disable.
|
|
23
|
-
*/
|
|
24
|
-
function setLogSink(fn) {
|
|
25
|
-
sink = typeof fn === 'function' ? fn : null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** @returns {boolean} whether diagnostics are being captured. */
|
|
29
|
-
function isActive() {
|
|
30
|
-
return sink !== null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function stamp() {
|
|
34
|
-
// new Date() is available in the CLI runtime (this is not a workflow script).
|
|
35
|
-
return new Date().toISOString();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function stringify(detail) {
|
|
39
|
-
if (typeof detail === 'string') return detail;
|
|
40
|
-
try {
|
|
41
|
-
return JSON.stringify(detail);
|
|
42
|
-
} catch {
|
|
43
|
-
return String(detail);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Emit one diagnostic breadcrumb to the log file (no-op without a sink).
|
|
49
|
-
* @param {string} label
|
|
50
|
-
* @param {*} [detail] - string or JSON-serializable value.
|
|
51
|
-
*/
|
|
52
|
-
function diag(label, detail) {
|
|
53
|
-
if (!sink) return;
|
|
54
|
-
let line = `[diag ${stamp()}] ${label}`;
|
|
55
|
-
if (detail !== undefined) line += `: ${stringify(detail)}`;
|
|
56
|
-
try {
|
|
57
|
-
sink(line + '\n');
|
|
58
|
-
} catch {
|
|
59
|
-
/* never let diagnostics break the install */
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Emit an error — including its `stack` AND any wrapped `cause` (message +
|
|
65
|
-
* stack) — to the log file. This is the crucial bit for custom-marketplace
|
|
66
|
-
* failures, whose user-facing message deliberately hides the upstream cause.
|
|
67
|
-
* @param {string} label
|
|
68
|
-
* @param {Error|*} err
|
|
69
|
-
*/
|
|
70
|
-
function diagError(label, err) {
|
|
71
|
-
if (!sink || !err) return;
|
|
72
|
-
const parts = [`[diag ${stamp()}] ${label}: ${err.message || String(err)}`];
|
|
73
|
-
if (err.stack) parts.push(` stack: ${err.stack}`);
|
|
74
|
-
if (err.cause) {
|
|
75
|
-
const c = err.cause;
|
|
76
|
-
parts.push(` cause: ${(c && c.message) || String(c)}`);
|
|
77
|
-
if (c && c.stack) parts.push(` cause.stack: ${c.stack}`);
|
|
78
|
-
}
|
|
79
|
-
try {
|
|
80
|
-
sink(parts.join('\n') + '\n');
|
|
81
|
-
} catch {
|
|
82
|
-
/* never let diagnostics break the install */
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
module.exports = { setLogSink, isActive, diag, diagError };
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Log-file-only diagnostics.
|
|
5
|
+
*
|
|
6
|
+
* When `--log` is active, bin/cli.js#setupLogging installs a sink that writes
|
|
7
|
+
* to the log file descriptor. `diag()`/`diagError()` then emit structured
|
|
8
|
+
* breadcrumbs to the LOG FILE ONLY — never to the user's console (the wizard's
|
|
9
|
+
* user-facing output intentionally stays clean; e.g. a failed custom-marketplace
|
|
10
|
+
* source shows a one-line message, not a raw stack — NFR71). Without a sink
|
|
11
|
+
* (no `--log`), every call is a cheap no-op.
|
|
12
|
+
*
|
|
13
|
+
* This is how the swallowed root cause of a custom-marketplace failure (the
|
|
14
|
+
* git/clone/resolve error behind a clean CustomMarketplaceError, the per-entry
|
|
15
|
+
* module_definition that was missing, the FR238 zero-module trigger, etc.)
|
|
16
|
+
* reaches the log for post-hoc diagnosis without leaking to the terminal.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
let sink = null;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @param {((text: string) => void)|null} fn - writer for log-file output, or null to disable.
|
|
23
|
+
*/
|
|
24
|
+
function setLogSink(fn) {
|
|
25
|
+
sink = typeof fn === 'function' ? fn : null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** @returns {boolean} whether diagnostics are being captured. */
|
|
29
|
+
function isActive() {
|
|
30
|
+
return sink !== null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function stamp() {
|
|
34
|
+
// new Date() is available in the CLI runtime (this is not a workflow script).
|
|
35
|
+
return new Date().toISOString();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function stringify(detail) {
|
|
39
|
+
if (typeof detail === 'string') return detail;
|
|
40
|
+
try {
|
|
41
|
+
return JSON.stringify(detail);
|
|
42
|
+
} catch {
|
|
43
|
+
return String(detail);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Emit one diagnostic breadcrumb to the log file (no-op without a sink).
|
|
49
|
+
* @param {string} label
|
|
50
|
+
* @param {*} [detail] - string or JSON-serializable value.
|
|
51
|
+
*/
|
|
52
|
+
function diag(label, detail) {
|
|
53
|
+
if (!sink) return;
|
|
54
|
+
let line = `[diag ${stamp()}] ${label}`;
|
|
55
|
+
if (detail !== undefined) line += `: ${stringify(detail)}`;
|
|
56
|
+
try {
|
|
57
|
+
sink(line + '\n');
|
|
58
|
+
} catch {
|
|
59
|
+
/* never let diagnostics break the install */
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Emit an error — including its `stack` AND any wrapped `cause` (message +
|
|
65
|
+
* stack) — to the log file. This is the crucial bit for custom-marketplace
|
|
66
|
+
* failures, whose user-facing message deliberately hides the upstream cause.
|
|
67
|
+
* @param {string} label
|
|
68
|
+
* @param {Error|*} err
|
|
69
|
+
*/
|
|
70
|
+
function diagError(label, err) {
|
|
71
|
+
if (!sink || !err) return;
|
|
72
|
+
const parts = [`[diag ${stamp()}] ${label}: ${err.message || String(err)}`];
|
|
73
|
+
if (err.stack) parts.push(` stack: ${err.stack}`);
|
|
74
|
+
if (err.cause) {
|
|
75
|
+
const c = err.cause;
|
|
76
|
+
parts.push(` cause: ${(c && c.message) || String(c)}`);
|
|
77
|
+
if (c && c.stack) parts.push(` cause.stack: ${c.stack}`);
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
sink(parts.join('\n') + '\n');
|
|
81
|
+
} catch {
|
|
82
|
+
/* never let diagnostics break the install */
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
module.exports = { setLogSink, isActive, diag, diagError };
|
package/package.json
CHANGED