@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/config/index.js
CHANGED
|
@@ -5,6 +5,9 @@ import { join, dirname, extname, relative, isAbsolute, resolve } from 'path';
|
|
|
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';
|
|
@@ -1474,20 +1477,14 @@ async function loadMetaSchema(draft) {
|
|
|
1474
1477
|
const content = await readFile(metaSchemaPath, "utf-8");
|
|
1475
1478
|
return JSON.parse(content);
|
|
1476
1479
|
}
|
|
1477
|
-
async function loadVocabularySchemas() {
|
|
1480
|
+
async function loadVocabularySchemas(draft) {
|
|
1481
|
+
if (draft !== "draft-2019-09" && draft !== "draft-2020-12") {
|
|
1482
|
+
return [];
|
|
1483
|
+
}
|
|
1478
1484
|
const __filename3 = fileURLToPath(import.meta.url);
|
|
1479
1485
|
const __dirname4 = dirname(__filename3);
|
|
1480
|
-
const vocabDir = join(
|
|
1481
|
-
|
|
1482
|
-
"..",
|
|
1483
|
-
"..",
|
|
1484
|
-
"schemas",
|
|
1485
|
-
"crucible-ts",
|
|
1486
|
-
"meta",
|
|
1487
|
-
"draft-2020-12",
|
|
1488
|
-
"meta"
|
|
1489
|
-
);
|
|
1490
|
-
const vocabFiles = [
|
|
1486
|
+
const vocabDir = join(__dirname4, "..", "..", "schemas", "crucible-ts", "meta", draft, "meta");
|
|
1487
|
+
const vocabFiles = draft === "draft-2020-12" ? [
|
|
1491
1488
|
"core.json",
|
|
1492
1489
|
"applicator.json",
|
|
1493
1490
|
"unevaluated.json",
|
|
@@ -1495,6 +1492,13 @@ async function loadVocabularySchemas() {
|
|
|
1495
1492
|
"meta-data.json",
|
|
1496
1493
|
"format-annotation.json",
|
|
1497
1494
|
"content.json"
|
|
1495
|
+
] : [
|
|
1496
|
+
"core.json",
|
|
1497
|
+
"applicator.json",
|
|
1498
|
+
"validation.json",
|
|
1499
|
+
"meta-data.json",
|
|
1500
|
+
"format.json",
|
|
1501
|
+
"content.json"
|
|
1498
1502
|
];
|
|
1499
1503
|
const schemas = [];
|
|
1500
1504
|
for (const file of vocabFiles) {
|
|
@@ -1549,47 +1553,68 @@ async function loadReferencedSchema(uri) {
|
|
|
1549
1553
|
}
|
|
1550
1554
|
return JSON.parse(content);
|
|
1551
1555
|
}
|
|
1552
|
-
function
|
|
1553
|
-
if (!
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
}
|
|
1563
|
-
addFormats(ajvInstance, {
|
|
1564
|
-
mode: "fast",
|
|
1565
|
-
formats: ["date-time", "email", "hostname", "ipv4", "ipv6", "uri", "uri-reference"]
|
|
1566
|
-
});
|
|
1567
|
-
metaschemaReady = Promise.all([loadVocabularySchemas(), loadMetaSchema("draft-2020-12")]).then(([vocabSchemas, metaSchema]) => {
|
|
1568
|
-
if (ajvInstance) {
|
|
1569
|
-
for (const vocabSchema of vocabSchemas) {
|
|
1570
|
-
try {
|
|
1571
|
-
ajvInstance.addMetaSchema(vocabSchema);
|
|
1572
|
-
} catch {
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
ajvInstance.addMetaSchema(metaSchema);
|
|
1576
|
-
}
|
|
1577
|
-
}).catch((error) => {
|
|
1578
|
-
throw new Error(`Failed to load metaschemas: ${error}`);
|
|
1579
|
-
});
|
|
1556
|
+
function detectDialect(schema) {
|
|
1557
|
+
if (schema && typeof schema === "object" && !Array.isArray(schema)) {
|
|
1558
|
+
const maybeSchema = schema;
|
|
1559
|
+
const declared = maybeSchema.$schema;
|
|
1560
|
+
if (typeof declared === "string") {
|
|
1561
|
+
if (declared.includes("draft-04")) return "draft-04";
|
|
1562
|
+
if (declared.includes("draft-06")) return "draft-06";
|
|
1563
|
+
if (declared.includes("draft-07")) return "draft-07";
|
|
1564
|
+
if (declared.includes("draft/2019-09")) return "draft-2019-09";
|
|
1565
|
+
if (declared.includes("draft/2020-12")) return "draft-2020-12";
|
|
1566
|
+
}
|
|
1580
1567
|
}
|
|
1581
|
-
return
|
|
1568
|
+
return "draft-2020-12";
|
|
1569
|
+
}
|
|
1570
|
+
function createAjv(dialect) {
|
|
1571
|
+
const AjvCtor = dialect === "draft-2020-12" ? Ajv2020 : dialect === "draft-2019-09" ? Ajv2019 : dialect === "draft-04" ? AjvDraft04 : Ajv;
|
|
1572
|
+
const ajv = new AjvCtor({
|
|
1573
|
+
strict: false,
|
|
1574
|
+
allErrors: true,
|
|
1575
|
+
verbose: true,
|
|
1576
|
+
// Allow schemas with $id to be added without replacing existing ones
|
|
1577
|
+
addUsedSchema: false,
|
|
1578
|
+
// draft-04 uses "id"; later drafts use "$id"
|
|
1579
|
+
schemaId: dialect === "draft-04" ? "id" : "$id",
|
|
1580
|
+
// Enable async schema loading for YAML references
|
|
1581
|
+
loadSchema: loadReferencedSchema
|
|
1582
|
+
});
|
|
1583
|
+
addFormats(ajv, {
|
|
1584
|
+
mode: "fast",
|
|
1585
|
+
formats: ["date-time", "email", "hostname", "ipv4", "ipv6", "uri", "uri-reference"]
|
|
1586
|
+
});
|
|
1587
|
+
return ajv;
|
|
1588
|
+
}
|
|
1589
|
+
async function getAjv(dialect) {
|
|
1590
|
+
const existing = ajvInstances.get(dialect);
|
|
1591
|
+
if (existing) {
|
|
1592
|
+
const ready = metaschemaReady.get(dialect);
|
|
1593
|
+
if (ready) await ready;
|
|
1594
|
+
return existing;
|
|
1595
|
+
}
|
|
1596
|
+
const ajv = createAjv(dialect);
|
|
1597
|
+
ajvInstances.set(dialect, ajv);
|
|
1598
|
+
const readyPromise = Promise.all([loadVocabularySchemas(dialect), loadMetaSchema(dialect)]).then(([vocabSchemas, metaSchema]) => {
|
|
1599
|
+
for (const vocabSchema of vocabSchemas) {
|
|
1600
|
+
try {
|
|
1601
|
+
ajv.addMetaSchema(vocabSchema);
|
|
1602
|
+
} catch {
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
try {
|
|
1606
|
+
ajv.addMetaSchema(metaSchema);
|
|
1607
|
+
} catch {
|
|
1608
|
+
}
|
|
1609
|
+
}).catch((error) => {
|
|
1610
|
+
throw new Error(`Failed to load metaschemas (${dialect}): ${error}`);
|
|
1611
|
+
});
|
|
1612
|
+
metaschemaReady.set(dialect, readyPromise);
|
|
1613
|
+
await readyPromise;
|
|
1614
|
+
return ajv;
|
|
1582
1615
|
}
|
|
1583
1616
|
async function compileSchema(schema, options = {}) {
|
|
1584
|
-
const
|
|
1585
|
-
if (metaschemaReady) {
|
|
1586
|
-
await metaschemaReady;
|
|
1587
|
-
}
|
|
1588
|
-
const cacheKey = typeof schema === "string" ? schema : JSON.stringify(schema);
|
|
1589
|
-
const cached = schemaCache.get(cacheKey);
|
|
1590
|
-
if (cached !== void 0) {
|
|
1591
|
-
return cached;
|
|
1592
|
-
}
|
|
1617
|
+
const baseKey = typeof schema === "string" ? schema : JSON.stringify(schema);
|
|
1593
1618
|
let parsedSchema;
|
|
1594
1619
|
if (typeof schema === "string") {
|
|
1595
1620
|
try {
|
|
@@ -1607,18 +1632,27 @@ async function compileSchema(schema, options = {}) {
|
|
|
1607
1632
|
} else {
|
|
1608
1633
|
parsedSchema = schema;
|
|
1609
1634
|
}
|
|
1635
|
+
const dialect = detectDialect(parsedSchema);
|
|
1636
|
+
const ajv = await getAjv(dialect);
|
|
1637
|
+
const cacheKey = `${dialect}:${baseKey}`;
|
|
1638
|
+
const cached = schemaCache.get(cacheKey);
|
|
1639
|
+
if (cached !== void 0) {
|
|
1640
|
+
return cached;
|
|
1641
|
+
}
|
|
1610
1642
|
try {
|
|
1611
1643
|
if (options.aliases && options.aliases.length > 0) {
|
|
1612
1644
|
for (const alias of options.aliases) {
|
|
1613
1645
|
if (alias && ajv.getSchema(alias) === void 0) {
|
|
1614
1646
|
try {
|
|
1615
|
-
|
|
1647
|
+
if (typeof parsedSchema === "object" && parsedSchema !== null) {
|
|
1648
|
+
ajv.addSchema(parsedSchema, alias);
|
|
1649
|
+
}
|
|
1616
1650
|
} catch {
|
|
1617
1651
|
}
|
|
1618
1652
|
}
|
|
1619
1653
|
}
|
|
1620
1654
|
}
|
|
1621
|
-
const validator = await ajv.compileAsync(parsedSchema);
|
|
1655
|
+
const validator = typeof parsedSchema === "boolean" ? ajv.compile(parsedSchema) : await ajv.compileAsync(parsedSchema);
|
|
1622
1656
|
schemaCache.set(cacheKey, validator);
|
|
1623
1657
|
return validator;
|
|
1624
1658
|
} catch (error) {
|
|
@@ -1688,8 +1722,39 @@ async function validateFile(filePath, validator) {
|
|
|
1688
1722
|
}
|
|
1689
1723
|
async function validateSchema(schema) {
|
|
1690
1724
|
try {
|
|
1691
|
-
|
|
1692
|
-
|
|
1725
|
+
let parsedSchema;
|
|
1726
|
+
if (typeof schema === "string") {
|
|
1727
|
+
try {
|
|
1728
|
+
parsedSchema = JSON.parse(schema);
|
|
1729
|
+
} catch {
|
|
1730
|
+
parsedSchema = parse(schema);
|
|
1731
|
+
}
|
|
1732
|
+
} else if (Buffer.isBuffer(schema)) {
|
|
1733
|
+
const content = schema.toString("utf-8");
|
|
1734
|
+
try {
|
|
1735
|
+
parsedSchema = JSON.parse(content);
|
|
1736
|
+
} catch {
|
|
1737
|
+
parsedSchema = parse(content);
|
|
1738
|
+
}
|
|
1739
|
+
} else {
|
|
1740
|
+
parsedSchema = schema;
|
|
1741
|
+
}
|
|
1742
|
+
const dialect = detectDialect(parsedSchema);
|
|
1743
|
+
const ajv = await getAjv(dialect);
|
|
1744
|
+
const metaValid = ajv.validateSchema(parsedSchema);
|
|
1745
|
+
if (!metaValid && ajv.errors) {
|
|
1746
|
+
const diagnostics = ajv.errors.map(
|
|
1747
|
+
(error) => createDiagnostic(
|
|
1748
|
+
error.instancePath || "",
|
|
1749
|
+
error.message || "Schema meta-validation failed",
|
|
1750
|
+
error.keyword || "unknown",
|
|
1751
|
+
"ERROR",
|
|
1752
|
+
"ajv"
|
|
1753
|
+
)
|
|
1754
|
+
);
|
|
1755
|
+
return { valid: false, diagnostics, source: "ajv" };
|
|
1756
|
+
}
|
|
1757
|
+
await compileSchema(parsedSchema);
|
|
1693
1758
|
return {
|
|
1694
1759
|
valid: true,
|
|
1695
1760
|
diagnostics: [],
|
|
@@ -1760,14 +1825,15 @@ async function validateFileBySchemaId(filePath, schemaId, registryOptions) {
|
|
|
1760
1825
|
throw error;
|
|
1761
1826
|
}
|
|
1762
1827
|
}
|
|
1763
|
-
var
|
|
1828
|
+
var ajvInstances, metaschemaReady, schemaCache;
|
|
1764
1829
|
var init_validator = __esm({
|
|
1765
1830
|
"src/schema/validator.ts"() {
|
|
1766
1831
|
init_telemetry();
|
|
1767
1832
|
init_errors();
|
|
1768
1833
|
init_registry();
|
|
1769
1834
|
init_utils();
|
|
1770
|
-
|
|
1835
|
+
ajvInstances = /* @__PURE__ */ new Map();
|
|
1836
|
+
metaschemaReady = /* @__PURE__ */ new Map();
|
|
1771
1837
|
schemaCache = /* @__PURE__ */ new Map();
|
|
1772
1838
|
}
|
|
1773
1839
|
});
|