specdx 0.4.0-alpha.6 → 0.4.0-alpha.7
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/{changelog-XPX4LD7B.js → changelog-IP7PNCWG.js} +3 -3
- package/dist/{check-5GQPH66L.js → check-UFMPBHJ4.js} +2 -2
- package/dist/{chunk-VIYRGPX5.js → chunk-EMMWQV52.js} +64 -25
- package/dist/chunk-EMMWQV52.js.map +1 -0
- package/dist/{chunk-GTMNEGQG.js → chunk-LDV7UXZ7.js} +3 -3
- package/dist/chunk-LDV7UXZ7.js.map +1 -0
- package/dist/{chunk-WQJLG5KJ.js → chunk-YYMQPWSZ.js} +2 -2
- package/dist/{diff-WH4KL2AK.js → diff-EJJSEI5Z.js} +3 -3
- package/dist/{dist-ZOIXQ2UW.js → dist-UAS5655D.js} +8 -4
- package/dist/dist-UAS5655D.js.map +1 -0
- package/dist/{explain-JFKOAFCD.js → explain-NLWMVXFQ.js} +2 -2
- package/dist/{generate-33LQORSQ.js → generate-ORC5WQ4Z.js} +3 -3
- package/dist/{generate-story-EOU6CEHU.js → generate-story-RQ6L5C3O.js} +2 -2
- package/dist/{generate-test-plan-MRK5MFZA.js → generate-test-plan-7MDFBSQN.js} +2 -2
- package/dist/{graph-7PUHYZ5G.js → graph-CXFIP6ZA.js} +14 -4
- package/dist/graph-CXFIP6ZA.js.map +1 -0
- package/dist/index.js +65 -25
- package/dist/index.js.map +1 -1
- package/dist/{lint-KA4RRYY7.js → lint-UW7DVZAS.js} +2 -2
- package/dist/main.js +15 -15
- package/dist/main.js.map +1 -1
- package/dist/{mcp-7PNSMMWB.js → mcp-56I3BENN.js} +2 -2
- package/dist/{migrate-EGF6SSUE.js → migrate-S7PFFBYI.js} +2 -2
- package/dist/{pack-VONQOQFP.js → pack-2N5KF75X.js} +6 -5
- package/dist/{pack-VONQOQFP.js.map → pack-2N5KF75X.js.map} +1 -1
- package/dist/{ready-7YI7BYBE.js → ready-BHLNDART.js} +3 -3
- package/dist/{status-ARUBEEOM.js → status-R6MALIAF.js} +3 -3
- package/dist/{update-WD2YAEH4.js → update-S54E2Y4J.js} +2 -2
- package/dist/validate-3ZDFA3MM.js +49 -0
- package/dist/validate-3ZDFA3MM.js.map +1 -0
- package/package.json +2 -2
- package/dist/chunk-GTMNEGQG.js.map +0 -1
- package/dist/chunk-VIYRGPX5.js.map +0 -1
- package/dist/dist-ZOIXQ2UW.js.map +0 -1
- package/dist/graph-7PUHYZ5G.js.map +0 -1
- package/dist/validate-VPPQWEW5.js +0 -34
- package/dist/validate-VPPQWEW5.js.map +0 -1
- /package/dist/{changelog-XPX4LD7B.js.map → changelog-IP7PNCWG.js.map} +0 -0
- /package/dist/{check-5GQPH66L.js.map → check-UFMPBHJ4.js.map} +0 -0
- /package/dist/{chunk-WQJLG5KJ.js.map → chunk-YYMQPWSZ.js.map} +0 -0
- /package/dist/{diff-WH4KL2AK.js.map → diff-EJJSEI5Z.js.map} +0 -0
- /package/dist/{explain-JFKOAFCD.js.map → explain-NLWMVXFQ.js.map} +0 -0
- /package/dist/{generate-33LQORSQ.js.map → generate-ORC5WQ4Z.js.map} +0 -0
- /package/dist/{generate-story-EOU6CEHU.js.map → generate-story-RQ6L5C3O.js.map} +0 -0
- /package/dist/{generate-test-plan-MRK5MFZA.js.map → generate-test-plan-7MDFBSQN.js.map} +0 -0
- /package/dist/{lint-KA4RRYY7.js.map → lint-UW7DVZAS.js.map} +0 -0
- /package/dist/{mcp-7PNSMMWB.js.map → mcp-56I3BENN.js.map} +0 -0
- /package/dist/{migrate-EGF6SSUE.js.map → migrate-S7PFFBYI.js.map} +0 -0
- /package/dist/{ready-7YI7BYBE.js.map → ready-BHLNDART.js.map} +0 -0
- /package/dist/{status-ARUBEEOM.js.map → status-R6MALIAF.js.map} +0 -0
- /package/dist/{update-WD2YAEH4.js.map → update-S54E2Y4J.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1620,31 +1620,66 @@ function compressSpec(specId, type, title, status, updatedDate, parsedSections,
|
|
|
1620
1620
|
// ../pack/dist/allocator.js
|
|
1621
1621
|
var HIGH_RELEVANCE = 0.75;
|
|
1622
1622
|
var MIN_TRIM_BUDGET = 150;
|
|
1623
|
-
|
|
1623
|
+
function omissionMarker(sections) {
|
|
1624
|
+
const names = sections.map((s) => s.heading || "(untitled)");
|
|
1625
|
+
const noun = names.length === 1 ? "section" : "sections";
|
|
1626
|
+
return `[${names.length} ${noun} omitted to fit token budget: ${names.join(", ")}]`;
|
|
1627
|
+
}
|
|
1624
1628
|
function trimToBudget(compressed, budget) {
|
|
1625
|
-
const
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1629
|
+
const sections = compressed.sections;
|
|
1630
|
+
let reserve = 0;
|
|
1631
|
+
for (; ; ) {
|
|
1632
|
+
const effective = budget - reserve;
|
|
1633
|
+
const keep = new Array(sections.length).fill(false);
|
|
1634
|
+
let used = 0;
|
|
1635
|
+
let keptReal = false;
|
|
1636
|
+
for (let i = 0; i < sections.length; i++) {
|
|
1637
|
+
if (used + sections[i].tokens <= effective) {
|
|
1638
|
+
keep[i] = true;
|
|
1639
|
+
used += sections[i].tokens;
|
|
1640
|
+
keptReal = true;
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
if (!keptReal)
|
|
1644
|
+
return null;
|
|
1645
|
+
const runs = [];
|
|
1646
|
+
for (let i = 0; i < sections.length; i++) {
|
|
1647
|
+
if (keep[i])
|
|
1648
|
+
continue;
|
|
1649
|
+
const start = i;
|
|
1650
|
+
const run = [];
|
|
1651
|
+
while (i < sections.length && !keep[i]) {
|
|
1652
|
+
run.push(sections[i]);
|
|
1653
|
+
i++;
|
|
1654
|
+
}
|
|
1655
|
+
i--;
|
|
1656
|
+
const marker = omissionMarker(run);
|
|
1657
|
+
runs.push({ start, sections: run, marker, markerTokens: countTokens(marker) });
|
|
1658
|
+
}
|
|
1659
|
+
const markerTokens = runs.reduce((sum, r) => sum + r.markerTokens, 0);
|
|
1660
|
+
if (markerTokens > reserve) {
|
|
1661
|
+
reserve = markerTokens;
|
|
1662
|
+
continue;
|
|
1663
|
+
}
|
|
1664
|
+
const out = [];
|
|
1665
|
+
for (let i = 0; i < sections.length; i++) {
|
|
1666
|
+
const run = runs.find((r) => r.start === i);
|
|
1667
|
+
if (run) {
|
|
1668
|
+
out.push({
|
|
1669
|
+
heading: "",
|
|
1670
|
+
content: run.marker,
|
|
1671
|
+
tokens: run.markerTokens,
|
|
1672
|
+
compressed: true,
|
|
1673
|
+
originalTokens: run.sections.reduce((sum, s) => sum + s.tokens, 0),
|
|
1674
|
+
omittedSections: run.sections.length
|
|
1675
|
+
});
|
|
1676
|
+
i += run.sections.length - 1;
|
|
1677
|
+
continue;
|
|
1678
|
+
}
|
|
1679
|
+
out.push(sections[i]);
|
|
1643
1680
|
}
|
|
1681
|
+
return { spec: { ...compressed, sections: out }, tokens: used + markerTokens };
|
|
1644
1682
|
}
|
|
1645
|
-
if (!keptReal)
|
|
1646
|
-
return null;
|
|
1647
|
-
return { spec: { ...compressed, sections: kept }, tokens: used };
|
|
1648
1683
|
}
|
|
1649
1684
|
function allocate(specs, scores, options) {
|
|
1650
1685
|
const specMap = /* @__PURE__ */ new Map();
|
|
@@ -1716,11 +1751,13 @@ function allocate(specs, scores, options) {
|
|
|
1716
1751
|
}
|
|
1717
1752
|
}
|
|
1718
1753
|
let sectionsCompressed = 0;
|
|
1754
|
+
let sectionsOmitted = 0;
|
|
1719
1755
|
for (const item of included) {
|
|
1720
1756
|
for (const section of item.compressed.sections) {
|
|
1721
1757
|
if (section.compressed) {
|
|
1722
1758
|
sectionsCompressed++;
|
|
1723
1759
|
}
|
|
1760
|
+
sectionsOmitted += section.omittedSections ?? 0;
|
|
1724
1761
|
}
|
|
1725
1762
|
}
|
|
1726
1763
|
const allocations = [];
|
|
@@ -1750,6 +1787,7 @@ function allocate(specs, scores, options) {
|
|
|
1750
1787
|
specsIncluded: included.length,
|
|
1751
1788
|
specsExcluded: excluded.length,
|
|
1752
1789
|
sectionsCompressed,
|
|
1790
|
+
sectionsOmitted,
|
|
1753
1791
|
allocations
|
|
1754
1792
|
};
|
|
1755
1793
|
return {
|
|
@@ -1764,7 +1802,7 @@ function escapeXml(text) {
|
|
|
1764
1802
|
}
|
|
1765
1803
|
function formatXml(specs, stats) {
|
|
1766
1804
|
const lines = [];
|
|
1767
|
-
lines.push(`<context budget="${stats.budget}" used="${stats.used}" specs="${stats.specsIncluded}" compressed="${stats.sectionsCompressed}">`);
|
|
1805
|
+
lines.push(`<context budget="${stats.budget}" used="${stats.used}" specs="${stats.specsIncluded}" compressed="${stats.sectionsCompressed}" omitted="${stats.sectionsOmitted}">`);
|
|
1768
1806
|
for (const spec of specs) {
|
|
1769
1807
|
const alloc = stats.allocations.find((a) => a.specId === spec.specId);
|
|
1770
1808
|
const relevance = alloc?.relevance ?? 0;
|
|
@@ -1823,6 +1861,7 @@ function formatJson2(specs, stats) {
|
|
|
1823
1861
|
const output = {
|
|
1824
1862
|
budget: stats.budget,
|
|
1825
1863
|
used: stats.used,
|
|
1864
|
+
sectionsOmitted: stats.sectionsOmitted,
|
|
1826
1865
|
specs: specs.map((spec) => {
|
|
1827
1866
|
const alloc = stats.allocations.find((a) => a.specId === spec.specId);
|
|
1828
1867
|
const relevance = alloc?.relevance ?? 0;
|
|
@@ -2066,7 +2105,8 @@ var pack_default = defineCommand3({
|
|
|
2066
2105
|
console.log(
|
|
2067
2106
|
` Included: ${stats.specsIncluded} / ${stats.specsIncluded + stats.specsExcluded} specs`
|
|
2068
2107
|
);
|
|
2069
|
-
console.log(` Sections compressed: ${stats.sectionsCompressed}
|
|
2108
|
+
console.log(` Sections compressed: ${stats.sectionsCompressed}`);
|
|
2109
|
+
console.log(` Sections omitted: ${stats.sectionsOmitted}
|
|
2070
2110
|
`);
|
|
2071
2111
|
return;
|
|
2072
2112
|
}
|
|
@@ -2083,7 +2123,7 @@ var pack_default = defineCommand3({
|
|
|
2083
2123
|
}
|
|
2084
2124
|
const total = stats.specsIncluded + stats.specsExcluded;
|
|
2085
2125
|
process.stderr.write(
|
|
2086
|
-
`Packed ${stats.specsIncluded}/${total} specs \u2022 ${stats.used} / ${stats.budget} tokens \u2022 ${stats.sectionsCompressed} sections compressed
|
|
2126
|
+
`Packed ${stats.specsIncluded}/${total} specs \u2022 ${stats.used} / ${stats.budget} tokens \u2022 ${stats.sectionsCompressed} sections compressed \u2022 ${stats.sectionsOmitted} sections omitted
|
|
2087
2127
|
`
|
|
2088
2128
|
);
|
|
2089
2129
|
} catch (err) {
|