@fulmenhq/tsfulmen 0.2.0 → 0.2.2
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/CHANGELOG.md +42 -0
- package/README.md +60 -7
- package/config/crucible-ts/agentic/roles/README.md +3 -3
- package/config/crucible-ts/library/fulencode/fixtures/README.md +18 -0
- package/config/crucible-ts/library/fulencode/fixtures/bom/bom.yaml +14 -0
- package/config/crucible-ts/library/fulencode/fixtures/detection/detection.yaml +12 -0
- package/config/crucible-ts/library/fulencode/fixtures/invalid-encodings/base64.yaml +10 -0
- package/config/crucible-ts/library/fulencode/fixtures/normalization/text-safe.yaml +10 -0
- package/config/crucible-ts/library/fulencode/fixtures/telemetry/telemetry-test-cases.yaml +24 -0
- package/config/crucible-ts/library/fulencode/fixtures/valid-encodings/base64.yaml +11 -0
- package/config/crucible-ts/taxonomy/library/platform-modules/v1.0.0/modules.yaml +2 -2
- package/config/crucible-ts/taxonomy/metrics.yaml +79 -1
- package/dist/appidentity/index.d.ts +1 -1
- package/dist/appidentity/index.js +122 -56
- package/dist/appidentity/index.js.map +1 -1
- package/dist/config/index.js +122 -56
- package/dist/config/index.js.map +1 -1
- package/dist/crucible/index.js +122 -56
- package/dist/crucible/index.js.map +1 -1
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +122 -56
- package/dist/errors/index.js.map +1 -1
- package/dist/foundry/index.js +122 -56
- package/dist/foundry/index.js.map +1 -1
- package/dist/fulencode/index.d.ts +102 -0
- package/dist/fulencode/index.js +806 -0
- package/dist/fulencode/index.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +123 -57
- package/dist/index.js.map +1 -1
- package/dist/pathfinder/index.d.ts +1 -1
- package/dist/pathfinder/index.js +122 -56
- package/dist/pathfinder/index.js.map +1 -1
- package/dist/reports/license-inventory.csv +7 -6
- package/dist/schema/index.d.ts +2 -2
- package/dist/schema/index.js +122 -56
- package/dist/schema/index.js.map +1 -1
- package/dist/signals/index.js +122 -56
- package/dist/signals/index.js.map +1 -1
- package/dist/telemetry/http/index.js +122 -56
- package/dist/telemetry/http/index.js.map +1 -1
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.js +122 -56
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/prometheus/index.d.ts +1 -1
- package/dist/telemetry/prometheus/index.js +122 -56
- package/dist/telemetry/prometheus/index.js.map +1 -1
- package/dist/{types-BJswWpQC.d.ts → types-DdoeE7F5.d.ts} +1 -1
- package/package.json +7 -2
- package/schemas/crucible-ts/library/fulencode/v1.0.0/README.md +37 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/bom-result.schema.json +48 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/decode-options.schema.json +60 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/decoding-result.schema.json +70 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/detect-options.schema.json +25 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/detection-result.schema.json +57 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/encode-options.schema.json +71 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/encoding-result.schema.json +57 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/fulencode-config.schema.json +8 -4
- package/schemas/crucible-ts/library/fulencode/v1.0.0/fulencode-error.schema.json +66 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/normalization-result.schema.json +73 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/normalize-options.schema.json +44 -0
- package/schemas/crucible-ts/meta/README.md +38 -2
- package/schemas/crucible-ts/meta/draft-04/schema.json +222 -0
- package/schemas/crucible-ts/meta/draft-06/schema.json +218 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/applicator.json +93 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/content.json +21 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/core.json +58 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/format.json +15 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/meta-data.json +35 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/validation.json +119 -0
- package/schemas/crucible-ts/meta/draft-2019-09/offline.schema.json +148 -0
- package/schemas/crucible-ts/meta/draft-2019-09/schema.json +62 -0
- package/schemas/crucible-ts/meta/fixtures/draft-04-sample.json +16 -0
- package/schemas/crucible-ts/meta/fixtures/draft-06-sample.json +16 -0
- package/schemas/crucible-ts/meta/fixtures/draft-07-sample.json +34 -0
- package/schemas/crucible-ts/meta/fixtures/draft-2019-09-sample.json +21 -0
- package/schemas/crucible-ts/meta/fixtures/draft-2020-12-sample.json +21 -0
- package/schemas/crucible-ts/taxonomy/library/fulencode/normalization-profiles/v1.0.0/profiles.yaml +16 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/PROVENANCE.md +64 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/access-tier.dimension.json +103 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/retention-lifecycle.dimension.json +103 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/schema-stability.dimension.json +100 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/sensitivity.dimension.json +130 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/velocity-mode.dimension.json +79 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/volatility.dimension.json +72 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/volume-tier.dimension.json +66 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/catalog/classifiers/README.md +29 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/access-tier-classification.md +163 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/classifiers-framework.md +157 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/data-sensitivity-classification.md +259 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/retention-lifecycle-classification.md +200 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/schema-stability-classification.md +205 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/velocity-mode-classification.md +222 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/volatility-classification.md +209 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/volume-tier-classification.md +200 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/ailink/v0/README.md +48 -0
- package/schemas/crucible-ts/upstream/3leaps/{ailink → crucible/schemas/ailink}/v0/prompt.schema.json +4 -18
- package/schemas/crucible-ts/upstream/3leaps/{ailink → crucible/schemas/ailink}/v0/search-response.schema.json +7 -37
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/classifiers/v0/dimension-definition.schema.json +247 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/classifiers/v0/sensitivity-level.schema.json +67 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/foundation/v0/error-response.schema.json +59 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/foundation/v0/lifecycle-phases.data.json +102 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/foundation/v0/lifecycle-phases.schema.json +101 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/foundation/v0/release-phase.schema.json +18 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/foundation/v0/types.schema.json +177 -0
- package/schemas/crucible-ts/upstream/3leaps/PROVENANCE.md +0 -43
- /package/schemas/crucible-ts/upstream/3leaps/{agentic → crucible/schemas/agentic}/v0/role-prompt.schema.json +0 -0
package/dist/crucible/index.js
CHANGED
|
@@ -5,6 +5,9 @@ import { spawn } from 'child_process';
|
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
import glob from 'fast-glob';
|
|
7
7
|
import Ajv from 'ajv';
|
|
8
|
+
import Ajv2019 from 'ajv/dist/2019';
|
|
9
|
+
import Ajv2020 from 'ajv/dist/2020';
|
|
10
|
+
import AjvDraft04 from 'ajv-draft-04';
|
|
8
11
|
import addFormats from 'ajv-formats';
|
|
9
12
|
import { Readable } from 'stream';
|
|
10
13
|
import picomatch from 'picomatch';
|
|
@@ -1451,20 +1454,14 @@ async function loadMetaSchema(draft) {
|
|
|
1451
1454
|
const content = await readFile(metaSchemaPath, "utf-8");
|
|
1452
1455
|
return JSON.parse(content);
|
|
1453
1456
|
}
|
|
1454
|
-
async function loadVocabularySchemas() {
|
|
1457
|
+
async function loadVocabularySchemas(draft) {
|
|
1458
|
+
if (draft !== "draft-2019-09" && draft !== "draft-2020-12") {
|
|
1459
|
+
return [];
|
|
1460
|
+
}
|
|
1455
1461
|
const __filename3 = fileURLToPath(import.meta.url);
|
|
1456
1462
|
const __dirname4 = dirname(__filename3);
|
|
1457
|
-
const vocabDir = join(
|
|
1458
|
-
|
|
1459
|
-
"..",
|
|
1460
|
-
"..",
|
|
1461
|
-
"schemas",
|
|
1462
|
-
"crucible-ts",
|
|
1463
|
-
"meta",
|
|
1464
|
-
"draft-2020-12",
|
|
1465
|
-
"meta"
|
|
1466
|
-
);
|
|
1467
|
-
const vocabFiles = [
|
|
1463
|
+
const vocabDir = join(__dirname4, "..", "..", "schemas", "crucible-ts", "meta", draft, "meta");
|
|
1464
|
+
const vocabFiles = draft === "draft-2020-12" ? [
|
|
1468
1465
|
"core.json",
|
|
1469
1466
|
"applicator.json",
|
|
1470
1467
|
"unevaluated.json",
|
|
@@ -1472,6 +1469,13 @@ async function loadVocabularySchemas() {
|
|
|
1472
1469
|
"meta-data.json",
|
|
1473
1470
|
"format-annotation.json",
|
|
1474
1471
|
"content.json"
|
|
1472
|
+
] : [
|
|
1473
|
+
"core.json",
|
|
1474
|
+
"applicator.json",
|
|
1475
|
+
"validation.json",
|
|
1476
|
+
"meta-data.json",
|
|
1477
|
+
"format.json",
|
|
1478
|
+
"content.json"
|
|
1475
1479
|
];
|
|
1476
1480
|
const schemas = [];
|
|
1477
1481
|
for (const file of vocabFiles) {
|
|
@@ -1526,47 +1530,68 @@ async function loadReferencedSchema(uri) {
|
|
|
1526
1530
|
}
|
|
1527
1531
|
return JSON.parse(content);
|
|
1528
1532
|
}
|
|
1529
|
-
function
|
|
1530
|
-
if (!
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
}
|
|
1540
|
-
addFormats(ajvInstance, {
|
|
1541
|
-
mode: "fast",
|
|
1542
|
-
formats: ["date-time", "email", "hostname", "ipv4", "ipv6", "uri", "uri-reference"]
|
|
1543
|
-
});
|
|
1544
|
-
metaschemaReady = Promise.all([loadVocabularySchemas(), loadMetaSchema("draft-2020-12")]).then(([vocabSchemas, metaSchema]) => {
|
|
1545
|
-
if (ajvInstance) {
|
|
1546
|
-
for (const vocabSchema of vocabSchemas) {
|
|
1547
|
-
try {
|
|
1548
|
-
ajvInstance.addMetaSchema(vocabSchema);
|
|
1549
|
-
} catch {
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
ajvInstance.addMetaSchema(metaSchema);
|
|
1553
|
-
}
|
|
1554
|
-
}).catch((error) => {
|
|
1555
|
-
throw new Error(`Failed to load metaschemas: ${error}`);
|
|
1556
|
-
});
|
|
1533
|
+
function detectDialect(schema) {
|
|
1534
|
+
if (schema && typeof schema === "object" && !Array.isArray(schema)) {
|
|
1535
|
+
const maybeSchema = schema;
|
|
1536
|
+
const declared = maybeSchema.$schema;
|
|
1537
|
+
if (typeof declared === "string") {
|
|
1538
|
+
if (declared.includes("draft-04")) return "draft-04";
|
|
1539
|
+
if (declared.includes("draft-06")) return "draft-06";
|
|
1540
|
+
if (declared.includes("draft-07")) return "draft-07";
|
|
1541
|
+
if (declared.includes("draft/2019-09")) return "draft-2019-09";
|
|
1542
|
+
if (declared.includes("draft/2020-12")) return "draft-2020-12";
|
|
1543
|
+
}
|
|
1557
1544
|
}
|
|
1558
|
-
return
|
|
1545
|
+
return "draft-2020-12";
|
|
1546
|
+
}
|
|
1547
|
+
function createAjv(dialect) {
|
|
1548
|
+
const AjvCtor = dialect === "draft-2020-12" ? Ajv2020 : dialect === "draft-2019-09" ? Ajv2019 : dialect === "draft-04" ? AjvDraft04 : Ajv;
|
|
1549
|
+
const ajv = new AjvCtor({
|
|
1550
|
+
strict: false,
|
|
1551
|
+
allErrors: true,
|
|
1552
|
+
verbose: true,
|
|
1553
|
+
// Allow schemas with $id to be added without replacing existing ones
|
|
1554
|
+
addUsedSchema: false,
|
|
1555
|
+
// draft-04 uses "id"; later drafts use "$id"
|
|
1556
|
+
schemaId: dialect === "draft-04" ? "id" : "$id",
|
|
1557
|
+
// Enable async schema loading for YAML references
|
|
1558
|
+
loadSchema: loadReferencedSchema
|
|
1559
|
+
});
|
|
1560
|
+
addFormats(ajv, {
|
|
1561
|
+
mode: "fast",
|
|
1562
|
+
formats: ["date-time", "email", "hostname", "ipv4", "ipv6", "uri", "uri-reference"]
|
|
1563
|
+
});
|
|
1564
|
+
return ajv;
|
|
1565
|
+
}
|
|
1566
|
+
async function getAjv(dialect) {
|
|
1567
|
+
const existing = ajvInstances.get(dialect);
|
|
1568
|
+
if (existing) {
|
|
1569
|
+
const ready = metaschemaReady.get(dialect);
|
|
1570
|
+
if (ready) await ready;
|
|
1571
|
+
return existing;
|
|
1572
|
+
}
|
|
1573
|
+
const ajv = createAjv(dialect);
|
|
1574
|
+
ajvInstances.set(dialect, ajv);
|
|
1575
|
+
const readyPromise = Promise.all([loadVocabularySchemas(dialect), loadMetaSchema(dialect)]).then(([vocabSchemas, metaSchema]) => {
|
|
1576
|
+
for (const vocabSchema of vocabSchemas) {
|
|
1577
|
+
try {
|
|
1578
|
+
ajv.addMetaSchema(vocabSchema);
|
|
1579
|
+
} catch {
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
try {
|
|
1583
|
+
ajv.addMetaSchema(metaSchema);
|
|
1584
|
+
} catch {
|
|
1585
|
+
}
|
|
1586
|
+
}).catch((error) => {
|
|
1587
|
+
throw new Error(`Failed to load metaschemas (${dialect}): ${error}`);
|
|
1588
|
+
});
|
|
1589
|
+
metaschemaReady.set(dialect, readyPromise);
|
|
1590
|
+
await readyPromise;
|
|
1591
|
+
return ajv;
|
|
1559
1592
|
}
|
|
1560
1593
|
async function compileSchema(schema, options = {}) {
|
|
1561
|
-
const
|
|
1562
|
-
if (metaschemaReady) {
|
|
1563
|
-
await metaschemaReady;
|
|
1564
|
-
}
|
|
1565
|
-
const cacheKey = typeof schema === "string" ? schema : JSON.stringify(schema);
|
|
1566
|
-
const cached = schemaCache.get(cacheKey);
|
|
1567
|
-
if (cached !== void 0) {
|
|
1568
|
-
return cached;
|
|
1569
|
-
}
|
|
1594
|
+
const baseKey = typeof schema === "string" ? schema : JSON.stringify(schema);
|
|
1570
1595
|
let parsedSchema;
|
|
1571
1596
|
if (typeof schema === "string") {
|
|
1572
1597
|
try {
|
|
@@ -1584,18 +1609,27 @@ async function compileSchema(schema, options = {}) {
|
|
|
1584
1609
|
} else {
|
|
1585
1610
|
parsedSchema = schema;
|
|
1586
1611
|
}
|
|
1612
|
+
const dialect = detectDialect(parsedSchema);
|
|
1613
|
+
const ajv = await getAjv(dialect);
|
|
1614
|
+
const cacheKey = `${dialect}:${baseKey}`;
|
|
1615
|
+
const cached = schemaCache.get(cacheKey);
|
|
1616
|
+
if (cached !== void 0) {
|
|
1617
|
+
return cached;
|
|
1618
|
+
}
|
|
1587
1619
|
try {
|
|
1588
1620
|
if (options.aliases && options.aliases.length > 0) {
|
|
1589
1621
|
for (const alias of options.aliases) {
|
|
1590
1622
|
if (alias && ajv.getSchema(alias) === void 0) {
|
|
1591
1623
|
try {
|
|
1592
|
-
|
|
1624
|
+
if (typeof parsedSchema === "object" && parsedSchema !== null) {
|
|
1625
|
+
ajv.addSchema(parsedSchema, alias);
|
|
1626
|
+
}
|
|
1593
1627
|
} catch {
|
|
1594
1628
|
}
|
|
1595
1629
|
}
|
|
1596
1630
|
}
|
|
1597
1631
|
}
|
|
1598
|
-
const validator = await ajv.compileAsync(parsedSchema);
|
|
1632
|
+
const validator = typeof parsedSchema === "boolean" ? ajv.compile(parsedSchema) : await ajv.compileAsync(parsedSchema);
|
|
1599
1633
|
schemaCache.set(cacheKey, validator);
|
|
1600
1634
|
return validator;
|
|
1601
1635
|
} catch (error) {
|
|
@@ -1665,8 +1699,39 @@ async function validateFile(filePath, validator) {
|
|
|
1665
1699
|
}
|
|
1666
1700
|
async function validateSchema(schema) {
|
|
1667
1701
|
try {
|
|
1668
|
-
|
|
1669
|
-
|
|
1702
|
+
let parsedSchema;
|
|
1703
|
+
if (typeof schema === "string") {
|
|
1704
|
+
try {
|
|
1705
|
+
parsedSchema = JSON.parse(schema);
|
|
1706
|
+
} catch {
|
|
1707
|
+
parsedSchema = parse(schema);
|
|
1708
|
+
}
|
|
1709
|
+
} else if (Buffer.isBuffer(schema)) {
|
|
1710
|
+
const content = schema.toString("utf-8");
|
|
1711
|
+
try {
|
|
1712
|
+
parsedSchema = JSON.parse(content);
|
|
1713
|
+
} catch {
|
|
1714
|
+
parsedSchema = parse(content);
|
|
1715
|
+
}
|
|
1716
|
+
} else {
|
|
1717
|
+
parsedSchema = schema;
|
|
1718
|
+
}
|
|
1719
|
+
const dialect = detectDialect(parsedSchema);
|
|
1720
|
+
const ajv = await getAjv(dialect);
|
|
1721
|
+
const metaValid = ajv.validateSchema(parsedSchema);
|
|
1722
|
+
if (!metaValid && ajv.errors) {
|
|
1723
|
+
const diagnostics = ajv.errors.map(
|
|
1724
|
+
(error) => createDiagnostic(
|
|
1725
|
+
error.instancePath || "",
|
|
1726
|
+
error.message || "Schema meta-validation failed",
|
|
1727
|
+
error.keyword || "unknown",
|
|
1728
|
+
"ERROR",
|
|
1729
|
+
"ajv"
|
|
1730
|
+
)
|
|
1731
|
+
);
|
|
1732
|
+
return { valid: false, diagnostics, source: "ajv" };
|
|
1733
|
+
}
|
|
1734
|
+
await compileSchema(parsedSchema);
|
|
1670
1735
|
return {
|
|
1671
1736
|
valid: true,
|
|
1672
1737
|
diagnostics: [],
|
|
@@ -1737,14 +1802,15 @@ async function validateFileBySchemaId(filePath, schemaId, registryOptions) {
|
|
|
1737
1802
|
throw error;
|
|
1738
1803
|
}
|
|
1739
1804
|
}
|
|
1740
|
-
var
|
|
1805
|
+
var ajvInstances, metaschemaReady, schemaCache;
|
|
1741
1806
|
var init_validator = __esm({
|
|
1742
1807
|
"src/schema/validator.ts"() {
|
|
1743
1808
|
init_telemetry();
|
|
1744
1809
|
init_errors();
|
|
1745
1810
|
init_registry2();
|
|
1746
1811
|
init_utils();
|
|
1747
|
-
|
|
1812
|
+
ajvInstances = /* @__PURE__ */ new Map();
|
|
1813
|
+
metaschemaReady = /* @__PURE__ */ new Map();
|
|
1748
1814
|
schemaCache = /* @__PURE__ */ new Map();
|
|
1749
1815
|
}
|
|
1750
1816
|
});
|