@evomap/evolver-cli 2.0.0-beta.13 → 2.0.0-beta.14
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/dist/cliContracts.js +45 -2
- package/package.json +7 -7
package/dist/cliContracts.js
CHANGED
|
@@ -139,17 +139,19 @@ export async function runPublishCommand(args, deps = {}) {
|
|
|
139
139
|
const validationCredits = extractCredits(validation.body);
|
|
140
140
|
if (!validation.ok) {
|
|
141
141
|
const reason = publishReasonFromResponse(validation.status, validation.body);
|
|
142
|
+
const detail = hubDetailFromBody(validation.body);
|
|
142
143
|
if (parsed.dryRun && reason === 'quality_gate_failed') {
|
|
143
144
|
bundle.gates.quality = 'fail';
|
|
144
145
|
if (!bundle.blockReasons.includes('quality_gate_failed'))
|
|
145
146
|
bundle.blockReasons.push('quality_gate_failed');
|
|
146
|
-
return write(dryRunEnvelope(bundle, validationCredits), 0);
|
|
147
|
+
return write(dryRunEnvelope(bundle, validationCredits, detail), 0);
|
|
147
148
|
}
|
|
148
149
|
return write(publishFailure(reason, publishReasonMessage(reason), {
|
|
149
150
|
retryable: publishRetryable(reason),
|
|
150
151
|
mode: parsed.dryRun ? 'dry_run' : 'publish',
|
|
151
152
|
gates: parsed.dryRun ? bundle.gates : { ...bundle.gates, quality: 'fail' },
|
|
152
153
|
assets: bundle.assets,
|
|
154
|
+
...(detail ? { detail } : {}),
|
|
153
155
|
...(validationCredits ? { credits: validationCredits } : {}),
|
|
154
156
|
}), 1);
|
|
155
157
|
}
|
|
@@ -160,11 +162,13 @@ export async function runPublishCommand(args, deps = {}) {
|
|
|
160
162
|
const publishCredits = extractCredits(published.body);
|
|
161
163
|
if (!published.ok) {
|
|
162
164
|
const reason = publishReasonFromResponse(published.status, published.body);
|
|
165
|
+
const detail = hubDetailFromBody(published.body);
|
|
163
166
|
return write(publishFailure(reason, publishReasonMessage(reason), {
|
|
164
167
|
retryable: publishRetryable(reason),
|
|
165
168
|
mode: 'publish',
|
|
166
169
|
gates: bundle.gates,
|
|
167
170
|
assets: bundle.assets,
|
|
171
|
+
...(detail ? { detail } : {}),
|
|
168
172
|
...(publishCredits ? { credits: publishCredits } : {}),
|
|
169
173
|
}), 1);
|
|
170
174
|
}
|
|
@@ -488,7 +492,7 @@ function stripPublishMetadata(asset) {
|
|
|
488
492
|
function storeBaseDir(store, deps) {
|
|
489
493
|
return store instanceof assetstore.LocalJsonlProvider ? store.baseDir : deps.assetsDir ?? events.assetsDir();
|
|
490
494
|
}
|
|
491
|
-
function dryRunEnvelope(bundle, credits) {
|
|
495
|
+
function dryRunEnvelope(bundle, credits, blockDetail) {
|
|
492
496
|
const suppressPayload = bundle.blockReasons.includes('leak_detected');
|
|
493
497
|
return {
|
|
494
498
|
ok: true,
|
|
@@ -497,6 +501,7 @@ function dryRunEnvelope(bundle, credits) {
|
|
|
497
501
|
reversibility: REVERSIBILITY,
|
|
498
502
|
blocked: bundle.blockReasons.length > 0,
|
|
499
503
|
block_reasons: bundle.blockReasons,
|
|
504
|
+
...(blockDetail ? { block_details: [blockDetail] } : {}),
|
|
500
505
|
assets: bundle.assets,
|
|
501
506
|
...(suppressPayload ? {} : { payload: { assets: bundle.sanitized } }),
|
|
502
507
|
gates: bundle.gates,
|
|
@@ -510,6 +515,7 @@ function publishFailure(reason, message, opts) {
|
|
|
510
515
|
...(opts.mode ? { mode: opts.mode } : {}),
|
|
511
516
|
...(opts.gates ? { gates: opts.gates } : {}),
|
|
512
517
|
...(opts.assets ? { assets: opts.assets } : {}),
|
|
518
|
+
...(opts.detail ? { detail: opts.detail } : {}),
|
|
513
519
|
...(opts.credits ? { credits: opts.credits } : {}),
|
|
514
520
|
reason,
|
|
515
521
|
retryable: opts.retryable,
|
|
@@ -757,6 +763,43 @@ function payloadRecord(body) {
|
|
|
757
763
|
const root = asRecord(body) ?? {};
|
|
758
764
|
return asRecord(root['payload']) ?? root;
|
|
759
765
|
}
|
|
766
|
+
// The Hub answers a rejected publish with the SPECIFIC rule that failed
|
|
767
|
+
// ("gene_validation_required: ..."), which our stable ContractReason enum
|
|
768
|
+
// necessarily flattens to `quality_gate_failed`. Keeping only the flattened code
|
|
769
|
+
// leaves every caller — the desktop wizard above all — with a red gate and no
|
|
770
|
+
// way to act on it, so the detail rides along in a separate additive field.
|
|
771
|
+
// Capped and control-character-stripped: it is Hub-authored text that ends up in
|
|
772
|
+
// a machine-readable envelope on stdout.
|
|
773
|
+
const HUB_DETAIL_MAX_CHARS = 300;
|
|
774
|
+
function stripControlChars(value) {
|
|
775
|
+
let out = '';
|
|
776
|
+
for (const ch of value) {
|
|
777
|
+
const code = ch.codePointAt(0) ?? 0;
|
|
778
|
+
out += code < 0x20 || code === 0x7f ? ' ' : ch;
|
|
779
|
+
}
|
|
780
|
+
return out;
|
|
781
|
+
}
|
|
782
|
+
function hubDetailFromBody(body) {
|
|
783
|
+
const root = asRecord(body) ?? {};
|
|
784
|
+
const payload = payloadRecord(body);
|
|
785
|
+
// Take the first candidate that ISN'T already a stable contract token: those
|
|
786
|
+
// are what `reason` carries, so emitting one here would repeat the flattened
|
|
787
|
+
// code this field exists to supplement. The Hub is free to put the token in
|
|
788
|
+
// `reason` and the rule text in `error` (or the reverse), so order alone
|
|
789
|
+
// cannot pick the informative one.
|
|
790
|
+
const raw = [
|
|
791
|
+
stringField(root, 'error'),
|
|
792
|
+
stringField(root, 'reason'),
|
|
793
|
+
stringField(payload, 'error'),
|
|
794
|
+
stringField(payload, 'reason'),
|
|
795
|
+
].find((candidate) => candidate && !isStableContractReason(candidate.trim()));
|
|
796
|
+
if (!raw)
|
|
797
|
+
return undefined;
|
|
798
|
+
const detail = stripControlChars(raw).replace(/\s+/g, ' ').trim();
|
|
799
|
+
if (!detail)
|
|
800
|
+
return undefined;
|
|
801
|
+
return detail.length > HUB_DETAIL_MAX_CHARS ? `${detail.slice(0, HUB_DETAIL_MAX_CHARS)}…` : detail;
|
|
802
|
+
}
|
|
760
803
|
function stableContractReasonFromBody(body) {
|
|
761
804
|
const payload = payloadRecord(body);
|
|
762
805
|
const reason = stringField(payload, 'reason') ?? stringField(payload, 'error');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evomap/evolver-cli",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.14",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "evolver CLI (status/watch/cycles/rebuild-views/...)",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@evomap/evolver-core": "2.0.0-beta.
|
|
24
|
-
"@evomap/evolver-adapter-public": "2.0.0-beta.
|
|
25
|
-
"@evomap/evolver-mcp": "2.0.0-beta.
|
|
26
|
-
"@evomap/evolver-proxy": "2.0.0-beta.
|
|
27
|
-
"@evomap/evolver-runtime-adapters": "2.0.0-beta.
|
|
28
|
-
"@evomap/evolver-webui": "2.0.0-beta.
|
|
23
|
+
"@evomap/evolver-core": "2.0.0-beta.14",
|
|
24
|
+
"@evomap/evolver-adapter-public": "2.0.0-beta.14",
|
|
25
|
+
"@evomap/evolver-mcp": "2.0.0-beta.14",
|
|
26
|
+
"@evomap/evolver-proxy": "2.0.0-beta.14",
|
|
27
|
+
"@evomap/evolver-runtime-adapters": "2.0.0-beta.14",
|
|
28
|
+
"@evomap/evolver-webui": "2.0.0-beta.14"
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|