thachvd-kit 1.0.38 → 1.0.39

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/spec.js CHANGED
@@ -7,6 +7,7 @@ const nativeSkills = require('./native-skills');
7
7
  const specState = require('./spec-state');
8
8
  const userConfig = require('./config');
9
9
  const specDoctor = require('./spec-doctor');
10
+ const specSite = require('./spec-site');
10
11
 
11
12
  const MANIFEST_RELATIVE_PATH = path.join('.thachvd', 'system.json');
12
13
  const DEFAULT_SPEC_ROOT = 'system-specs';
@@ -563,6 +564,8 @@ Usage:
563
564
  thachvd-kit spec verify [CAPABILITY]
564
565
  thachvd-kit spec check [--strict]
565
566
  thachvd-kit spec doctor [--strict]
567
+ thachvd-kit spec build [--output PATH] [--remote-mermaid]
568
+ thachvd-kit spec serve [--output PATH] [--host HOST] [--port PORT] [--no-build] [--remote-mermaid]
566
569
  thachvd-kit spec link [--dry-run] [--allow-unverified]
567
570
  thachvd-kit spec status
568
571
 
@@ -583,6 +586,10 @@ Commands:
583
586
  --strict exits non-zero when stale/unknown capabilities exist.
584
587
  doctor Read-only health report for repos, tools, skills, progress, verification, drift, and links.
585
588
  --strict exits non-zero when any WARN/ERROR remains.
589
+ build Generate a static HTML system explorer from Markdown + JSON specs. No AI call.
590
+ Default output: <spec_root>/_site. --remote-mermaid explicitly allows CDN JavaScript.
591
+ serve Build (unless --no-build) and serve the generated explorer locally.
592
+ Defaults: 127.0.0.1:4173.
586
593
  link Add/update the managed system-spec block in each repository's AGENTS.md.
587
594
  Requires all capabilities independently verified unless --allow-unverified is explicit.
588
595
  status Show configured repositories, reverse progress, and verification state.
@@ -591,7 +598,7 @@ Commands:
591
598
  Recommended order:
592
599
  init -> index -> discover -> /system-discovery -> human review
593
600
  -> reverse -> /system-reverse-engineer -> verify -> /system-spec-review
594
- -> check -> link
601
+ -> check -> build/serve -> link
595
602
  `);
596
603
  }
597
604
 
@@ -766,6 +773,41 @@ function runSpecCommand(args, options = {}) {
766
773
  return 0;
767
774
  }
768
775
 
776
+ if (command === 'build') {
777
+ const commandArgs = args.slice(1);
778
+ const manifest = readManifest(workspaceRoot);
779
+ const result = specSite.buildSite(workspaceRoot, manifest, {
780
+ output: parseSingleOption(commandArgs, '--output'),
781
+ remoteMermaid: hasFlag(commandArgs, '--remote-mermaid')
782
+ });
783
+ console.log(`Built ${result.pages} HTML page(s) for ${result.model.counts.capabilities} capability(s).`);
784
+ console.log(`Output: ${toPortablePath(path.relative(workspaceRoot, result.outputRoot))}`);
785
+ console.log(`Open: ${toPortablePath(path.join(path.relative(workspaceRoot, result.outputRoot), 'index.html'))}`);
786
+ return 0;
787
+ }
788
+
789
+ if (command === 'serve') {
790
+ const commandArgs = args.slice(1);
791
+ const manifest = readManifest(workspaceRoot);
792
+ const outputOption = parseSingleOption(commandArgs, '--output');
793
+ let outputRoot = specSite.resolveOutputRoot(workspaceRoot, manifest, outputOption);
794
+ if (!hasFlag(commandArgs, '--no-build')) {
795
+ const result = specSite.buildSite(workspaceRoot, manifest, {
796
+ output: outputOption,
797
+ remoteMermaid: hasFlag(commandArgs, '--remote-mermaid')
798
+ });
799
+ outputRoot = result.outputRoot;
800
+ console.log(`Built ${result.pages} HTML page(s) before serving.`);
801
+ } else if (!fs.existsSync(path.join(outputRoot, 'index.html'))) {
802
+ throw new Error('Generated site not found. Run thachvd-kit spec build first or omit --no-build.');
803
+ }
804
+ specSite.serveSite(outputRoot, {
805
+ host: parseSingleOption(commandArgs, '--host', specSite.DEFAULT_HOST),
806
+ port: parseSingleOption(commandArgs, '--port', String(specSite.DEFAULT_PORT))
807
+ });
808
+ return 0;
809
+ }
810
+
769
811
  if (command === 'link') {
770
812
  const commandArgs = args.slice(1);
771
813
  const manifest = readManifest(workspaceRoot);