Files
portal/docs/archive/llm-bootstrap-2026-05/routing-docs/extract-node-dormancy.mjs
T
Дмитрий b917360e9b chore(brain): archive §12 + 4 routing/dormancy artefacts + 2 memory + switch 2 consumers to nodes.yaml (phase 1 task 4)
Phase 1 Task 4 of LLM-first router overhaul. Aggressive scope per user
choice (AskUserQuestion 2026-05-25).

Pravila changes:
- §12 (lines 678-748) extracted to docs/archive/.../pravila-12/, body
  replaced by 1-paragraph placeholder pointing to §17 (Task 5) + ADR-016.
- §0 priority chain dropped §12, added forward note about §17.
- §16.4 cross-refs migrated: tools/observer-classification-map.json
  -> docs/registry/nodes.yaml + buildClassificationMap;
  tools/.node-dormancy.json -> nodes.yaml status field + buildDormancyMap.
- §16.5 hard-rule list: §12 -> §17.

Code refactor (preserves test green):
- tools/observer-coverage-checker.mjs + observer-transcript-parser.mjs
  switched from readFileSync(.json) to loadRegistry + adapter.
- 9/9 + 154/154 GREEN.

git mv into archive/routing-docs/:
- tools/observer-classification-map.json, .node-dormancy.json,
  extract-node-dormancy.mjs, extract-node-dormancy.test.mjs.

lefthook.yml: job 12b removed.

Memory (user-level, cp+add-f):
- feedback_superpowers_hard_rule.md, feedback_feature_via_writing_plans.md
  copied to archive/memory/. MEMORY.md user-level updated.

Plan deviations (TASKLOG.md):
- registry-to-classification-map.mjs KEEP (4+ active consumers).
- routing-off-phase.md NOT ARCHIVED (auto-generated derivative).
- router-procedure.md deferred.

Verification: vitest tools/ 539 passed (baseline 543 -7 dormancy +3 rollback).

Rollback: node tools/test-rollback.mjs --execute + git reset --hard
brain-pre-llm-bootstrap.

Plan: docs/superpowers/plans/2026-05-25-llm-first-router-overhaul.md Task 4.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 14:28:24 +03:00

40 lines
1.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env node
/**
* Tooling Прил.Н dormancy extractor — emits {id: unavailable_bool} JSON for
* the missed-activation matcher (Pravila §16.4 conditional rule).
*
* Two signals (either is sufficient) treat a node as effectively unavailable:
* 1. `dormant: true` — Tooling-marked permanent dormancy (e.g. #17 pg_partman,
* native Windows-PG cannot load the extension).
* 2. `boundaries` column contains the word DEFERRED — node is registered
* but not active (e.g. #44 Figma MCP "DEFERRED — нет Figma-аккаунта",
* #50 Jupyter MCP, #54 n8n-mcp). The output key is still named "dormant"
* for consumer simplicity — semantics: "node cannot be activated right
* now, exclude from missed-activation counts".
*
* Parses 9-attribute table rows; ignores headers/separators/templates.
*
* Security Guidance #40: pure parsing — no exec/execSync.
*/
import { readFileSync, writeFileSync } from 'fs';
const ROW_RE = /^\|\s*#(\d+)\s*\|[^|]+\|[^|]+\|[^|]+\|[^|]+\|[^|]+\|([^|]+)\|\s*(true|false)\s*\|[^|]+\|$/gm;
export function extractDormancy(md) {
const out = {};
for (const m of md.matchAll(ROW_RE)) {
const id = `#${m[1]}`;
const boundaries = m[2];
const tooledDormant = m[3] === 'true';
out[id] = tooledDormant || /\bDEFERRED\b/.test(boundaries);
}
return out;
}
if (process.argv[1] && process.argv[1].replace(/\\/g, '/').endsWith('/extract-node-dormancy.mjs')) {
const src = readFileSync('docs/Tooling_v8_3.md', 'utf-8');
const dormancy = extractDormancy(src);
writeFileSync('tools/.node-dormancy.json', JSON.stringify(dormancy, null, 2) + '\n');
console.log(`[extract-node-dormancy] OK — ${Object.keys(dormancy).length} nodes`);
}