@hcmai/sdk 0.3.12 → 0.3.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/index.js +25 -11
- package/dist/index.js.map +1 -1
- package/package.json +9 -5
package/dist/index.js
CHANGED
|
@@ -592,6 +592,11 @@ var CliError = class extends Error {
|
|
|
592
592
|
const detailText = formatDetails(details);
|
|
593
593
|
if (detailText) out += `
|
|
594
594
|
\u8BE6\u60C5: ${detailText}`;
|
|
595
|
+
if (!detailText) {
|
|
596
|
+
const causeText = formatCause(this.cause);
|
|
597
|
+
if (causeText) out += `
|
|
598
|
+
\u539F\u56E0: ${causeText}`;
|
|
599
|
+
}
|
|
595
600
|
const nextStep = this.context?.nextStep;
|
|
596
601
|
if (typeof nextStep === "string" && nextStep) out += `
|
|
597
602
|
\u4E0B\u4E00\u6B65: ${nextStep}`;
|
|
@@ -657,6 +662,15 @@ function formatDetails(details) {
|
|
|
657
662
|
if (!text || text === "{}" || text === "[]") return void 0;
|
|
658
663
|
return text.length > 800 ? `${text.slice(0, 800)}\u2026\uFF08\u5DF2\u622A\u65AD\uFF09` : text;
|
|
659
664
|
}
|
|
665
|
+
function formatCause(cause) {
|
|
666
|
+
if (!cause) return void 0;
|
|
667
|
+
if (typeof cause === "string") return cause.trim().slice(0, 300) || void 0;
|
|
668
|
+
if (cause instanceof Error) {
|
|
669
|
+
const text = cause.message?.trim();
|
|
670
|
+
return text ? text.slice(0, 300) : void 0;
|
|
671
|
+
}
|
|
672
|
+
return void 0;
|
|
673
|
+
}
|
|
660
674
|
|
|
661
675
|
// src/config/env.ts
|
|
662
676
|
async function saveEnv(name, cfg) {
|
|
@@ -5433,7 +5447,7 @@ function parseSettingAssignment(raw) {
|
|
|
5433
5447
|
|
|
5434
5448
|
// src/fde/layout.ts
|
|
5435
5449
|
import { createHash as createHash3 } from "crypto";
|
|
5436
|
-
import { mkdirSync, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
5450
|
+
import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
5437
5451
|
import * as path6 from "path";
|
|
5438
5452
|
var UNSAFE = /[^A-Za-z0-9._-]/g;
|
|
5439
5453
|
function slug(value) {
|
|
@@ -5763,7 +5777,7 @@ function networkOutcome() {
|
|
|
5763
5777
|
|
|
5764
5778
|
// src/fde/recon/runner.ts
|
|
5765
5779
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
5766
|
-
import { existsSync as
|
|
5780
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3, readdirSync } from "fs";
|
|
5767
5781
|
import * as path8 from "path";
|
|
5768
5782
|
|
|
5769
5783
|
// src/fde/recon/carry-over.ts
|
|
@@ -6740,7 +6754,7 @@ function writeModelsMd(layout, text) {
|
|
|
6740
6754
|
}
|
|
6741
6755
|
|
|
6742
6756
|
// src/fde/recon/pointer-audit.ts
|
|
6743
|
-
import { existsSync as
|
|
6757
|
+
import { existsSync as existsSync3 } from "fs";
|
|
6744
6758
|
import * as path7 from "path";
|
|
6745
6759
|
function isRecord3(v) {
|
|
6746
6760
|
return Boolean(v) && typeof v === "object" && !Array.isArray(v);
|
|
@@ -6754,7 +6768,7 @@ function auditValueDomainPointers(layout, sheets) {
|
|
|
6754
6768
|
const pointer = isRecord3(ref) ? ref.valueDomain : null;
|
|
6755
6769
|
if (typeof pointer !== "string" || pointer === "") continue;
|
|
6756
6770
|
if (!seen.has(pointer)) {
|
|
6757
|
-
seen.set(pointer,
|
|
6771
|
+
seen.set(pointer, existsSync3(path7.join(layout.dir, pointer)));
|
|
6758
6772
|
}
|
|
6759
6773
|
if (!seen.get(pointer)) {
|
|
6760
6774
|
problems.push(
|
|
@@ -7179,7 +7193,7 @@ function writeCrawledAt(layout, freshKeys, carriedKeys, roundId, started) {
|
|
|
7179
7193
|
return sorted;
|
|
7180
7194
|
}
|
|
7181
7195
|
function finishRound(layout, models, roundId, started, products) {
|
|
7182
|
-
const written = [...new Set(products.filter((rel) => rel &&
|
|
7196
|
+
const written = [...new Set(products.filter((rel) => rel && existsSync4(path8.join(layout.dir, rel))))].sort();
|
|
7183
7197
|
layout.writeJson(KIT_CRAWLED_AT_FILE, {
|
|
7184
7198
|
note: CRAWLED_AT_NOTE,
|
|
7185
7199
|
roundNote: ROUND_NOTE,
|
|
@@ -7197,7 +7211,7 @@ function relOf(layout, p) {
|
|
|
7197
7211
|
}
|
|
7198
7212
|
function productRoundId(root, rel) {
|
|
7199
7213
|
const p = path8.join(root, rel);
|
|
7200
|
-
if (!
|
|
7214
|
+
if (!existsSync4(p)) return ["missing", null];
|
|
7201
7215
|
const body = readJsonSoft(p);
|
|
7202
7216
|
if (body === void 0 || !isRecord5(body)) return ["unreadable", null];
|
|
7203
7217
|
const rid = body.roundId;
|
|
@@ -7213,7 +7227,7 @@ function inspectRound(root) {
|
|
|
7213
7227
|
const written = Array.isArray(rawWritten) ? rawWritten : null;
|
|
7214
7228
|
let ledgerMissing = null;
|
|
7215
7229
|
if (written !== null) {
|
|
7216
|
-
const gone = written.filter((rel) => typeof rel === "string" && !
|
|
7230
|
+
const gone = written.filter((rel) => typeof rel === "string" && !existsSync4(path8.join(root, rel))).sort();
|
|
7217
7231
|
ledgerMissing = { checked: written.length, count: gone.length, files: gone };
|
|
7218
7232
|
}
|
|
7219
7233
|
const products = [];
|
|
@@ -7563,7 +7577,7 @@ async function runRecon(probe, layout, opts = {}) {
|
|
|
7563
7577
|
}
|
|
7564
7578
|
|
|
7565
7579
|
// src/fde/gate0/aclass.ts
|
|
7566
|
-
import { existsSync as
|
|
7580
|
+
import { existsSync as existsSync5, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync2 } from "fs";
|
|
7567
7581
|
import * as path9 from "path";
|
|
7568
7582
|
|
|
7569
7583
|
// src/fde/gate0/mapping-artifact.ts
|
|
@@ -7854,7 +7868,7 @@ function deriveAclass(root, mappingArtifact = null) {
|
|
|
7854
7868
|
}
|
|
7855
7869
|
}
|
|
7856
7870
|
const valueDomain = path9.join(root, VALUE_DOMAIN_DIR);
|
|
7857
|
-
if (
|
|
7871
|
+
if (existsSync5(valueDomain) && statSync2(valueDomain).isDirectory()) {
|
|
7858
7872
|
const tables = readdirSync2(valueDomain).filter((f) => f.endsWith(".json") && !RESERVED_FILENAMES.includes(f)).sort();
|
|
7859
7873
|
for (const name of tables) {
|
|
7860
7874
|
const file = path9.join(valueDomain, name);
|
|
@@ -7923,7 +7937,7 @@ function deriveAclass(root, mappingArtifact = null) {
|
|
|
7923
7937
|
}
|
|
7924
7938
|
|
|
7925
7939
|
// src/fde/gate0/facts.ts
|
|
7926
|
-
import { existsSync as
|
|
7940
|
+
import { existsSync as existsSync6, readFileSync as readFileSync6 } from "fs";
|
|
7927
7941
|
import * as path10 from "path";
|
|
7928
7942
|
var REGISTRY_SCOPE = "registry";
|
|
7929
7943
|
var ENTRY_SCOPE2 = "entry";
|
|
@@ -8008,7 +8022,7 @@ function loadProtocolFacts(entries = PROTOCOL_FACTS, options = {}) {
|
|
|
8008
8022
|
if (probeRoot !== void 0) {
|
|
8009
8023
|
const file = path10.join(probeRoot, shape.groups.file);
|
|
8010
8024
|
const mark = `${PROBE_MARK_PREFIX} ${shape.groups.mark}`;
|
|
8011
|
-
const found =
|
|
8025
|
+
const found = existsSync6(file) && readFileSync6(file, "utf8").includes(mark);
|
|
8012
8026
|
if (!found) {
|
|
8013
8027
|
problems.push({
|
|
8014
8028
|
scope: ENTRY_SCOPE2,
|