dotmd-cli 0.8.5 → 0.8.6
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/bin/dotmd.mjs +8 -5
- package/package.json +1 -1
- package/src/index.mjs +6 -0
- package/src/render.mjs +4 -2
- package/src/stats.mjs +5 -1
package/bin/dotmd.mjs
CHANGED
|
@@ -431,8 +431,10 @@ async function main() {
|
|
|
431
431
|
index.docs = index.docs.filter(d => d.root === rootFilter || d.root.endsWith('/' + rootFilter) || d.root.split('/').pop() === rootFilter);
|
|
432
432
|
index.errors = index.errors.filter(e => index.docs.some(d => d.path === e.path));
|
|
433
433
|
index.warnings = index.warnings.filter(w => index.docs.some(d => d.path === w.path));
|
|
434
|
-
|
|
435
|
-
|
|
434
|
+
index.countsByStatus = {};
|
|
435
|
+
for (const doc of index.docs) {
|
|
436
|
+
const s = doc.status ?? 'unknown';
|
|
437
|
+
index.countsByStatus[s] = (index.countsByStatus[s] ?? 0) + 1;
|
|
436
438
|
}
|
|
437
439
|
}
|
|
438
440
|
|
|
@@ -551,9 +553,10 @@ async function main() {
|
|
|
551
553
|
if (command === 'context') {
|
|
552
554
|
if (args.includes('--json')) {
|
|
553
555
|
const byStatus = {};
|
|
554
|
-
for (const
|
|
555
|
-
const
|
|
556
|
-
if (
|
|
556
|
+
for (const doc of index.docs) {
|
|
557
|
+
const s = doc.status ?? 'unknown';
|
|
558
|
+
if (!byStatus[s]) byStatus[s] = [];
|
|
559
|
+
byStatus[s].push(doc);
|
|
557
560
|
}
|
|
558
561
|
const stale = index.docs.filter(d => d.isStale && !config.lifecycle.skipStaleFor.has(d.status));
|
|
559
562
|
process.stdout.write(JSON.stringify({
|
package/package.json
CHANGED
package/src/index.mjs
CHANGED
|
@@ -51,6 +51,12 @@ export function buildIndex(config) {
|
|
|
51
51
|
status,
|
|
52
52
|
transformedDocs.filter(doc => doc.status === status).length,
|
|
53
53
|
]));
|
|
54
|
+
const knownStatuses = new Set(config.statusOrder);
|
|
55
|
+
for (const doc of transformedDocs) {
|
|
56
|
+
if (doc.status && !knownStatuses.has(doc.status)) {
|
|
57
|
+
countsByStatus[doc.status] = (countsByStatus[doc.status] ?? 0) + 1;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
54
60
|
|
|
55
61
|
if (config.indexPath) {
|
|
56
62
|
const indexCheck = checkIndex(transformedDocs, config);
|
package/src/render.mjs
CHANGED
|
@@ -124,8 +124,10 @@ function _renderContext(index, config, opts = {}) {
|
|
|
124
124
|
const ctx = config.context;
|
|
125
125
|
|
|
126
126
|
const byStatus = {};
|
|
127
|
-
for (const
|
|
128
|
-
|
|
127
|
+
for (const doc of index.docs) {
|
|
128
|
+
const s = doc.status ?? 'unknown';
|
|
129
|
+
if (!byStatus[s]) byStatus[s] = [];
|
|
130
|
+
byStatus[s].push(doc);
|
|
129
131
|
}
|
|
130
132
|
|
|
131
133
|
for (const status of (ctx.expanded || [])) {
|
package/src/stats.mjs
CHANGED
|
@@ -94,7 +94,11 @@ function _renderStats(stats, config) {
|
|
|
94
94
|
|
|
95
95
|
// Status
|
|
96
96
|
lines.push(bold('Status'));
|
|
97
|
-
const
|
|
97
|
+
const allStatuses = [
|
|
98
|
+
...config.statusOrder.filter(s => stats.countsByStatus[s]),
|
|
99
|
+
...Object.keys(stats.countsByStatus).filter(s => !config.statusOrder.includes(s)).sort(),
|
|
100
|
+
];
|
|
101
|
+
const statusParts = allStatuses
|
|
98
102
|
.filter(s => stats.countsByStatus[s])
|
|
99
103
|
.map(s => `${s}: ${stats.countsByStatus[s]}`);
|
|
100
104
|
lines.push(' ' + statusParts.join(' '));
|