@skillcap/gdh 0.15.1 → 0.17.0

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.
Files changed (75) hide show
  1. package/INSTALL-BUNDLE.json +1 -1
  2. package/README.md +37 -108
  3. package/RELEASE-SPAN-UPDATE-CONTRACTS.json +184 -0
  4. package/node_modules/@gdh/adapters/dist/index.d.ts +2 -2
  5. package/node_modules/@gdh/adapters/dist/index.d.ts.map +1 -1
  6. package/node_modules/@gdh/adapters/dist/index.js +148 -110
  7. package/node_modules/@gdh/adapters/dist/index.js.map +1 -1
  8. package/node_modules/@gdh/adapters/package.json +8 -8
  9. package/node_modules/@gdh/authoring/dist/index.d.ts +4 -3
  10. package/node_modules/@gdh/authoring/dist/index.d.ts.map +1 -1
  11. package/node_modules/@gdh/authoring/dist/index.js +80 -9
  12. package/node_modules/@gdh/authoring/dist/index.js.map +1 -1
  13. package/node_modules/@gdh/authoring/dist/lsp-client.d.ts +47 -0
  14. package/node_modules/@gdh/authoring/dist/lsp-client.d.ts.map +1 -0
  15. package/node_modules/@gdh/authoring/dist/lsp-client.js +371 -0
  16. package/node_modules/@gdh/authoring/dist/lsp-client.js.map +1 -0
  17. package/node_modules/@gdh/authoring/dist/lsp-test-server.test-utils.d.ts +35 -0
  18. package/node_modules/@gdh/authoring/dist/lsp-test-server.test-utils.d.ts.map +1 -0
  19. package/node_modules/@gdh/authoring/dist/lsp-test-server.test-utils.js +194 -0
  20. package/node_modules/@gdh/authoring/dist/lsp-test-server.test-utils.js.map +1 -0
  21. package/node_modules/@gdh/authoring/dist/lsp.d.ts +62 -1
  22. package/node_modules/@gdh/authoring/dist/lsp.d.ts.map +1 -1
  23. package/node_modules/@gdh/authoring/dist/lsp.js +1207 -109
  24. package/node_modules/@gdh/authoring/dist/lsp.js.map +1 -1
  25. package/node_modules/@gdh/authoring/dist/project.d.ts.map +1 -1
  26. package/node_modules/@gdh/authoring/dist/project.js +28 -1
  27. package/node_modules/@gdh/authoring/dist/project.js.map +1 -1
  28. package/node_modules/@gdh/authoring/dist/scene-resource.d.ts +39 -0
  29. package/node_modules/@gdh/authoring/dist/scene-resource.d.ts.map +1 -0
  30. package/node_modules/@gdh/authoring/dist/scene-resource.js +544 -0
  31. package/node_modules/@gdh/authoring/dist/scene-resource.js.map +1 -0
  32. package/node_modules/@gdh/authoring/package.json +2 -2
  33. package/node_modules/@gdh/cli/dist/index.d.ts.map +1 -1
  34. package/node_modules/@gdh/cli/dist/index.js +121 -35
  35. package/node_modules/@gdh/cli/dist/index.js.map +1 -1
  36. package/node_modules/@gdh/cli/dist/migrate.d.ts +1 -0
  37. package/node_modules/@gdh/cli/dist/migrate.d.ts.map +1 -1
  38. package/node_modules/@gdh/cli/dist/migrate.js +140 -13
  39. package/node_modules/@gdh/cli/dist/migrate.js.map +1 -1
  40. package/node_modules/@gdh/cli/package.json +10 -10
  41. package/node_modules/@gdh/core/dist/index.d.ts +109 -14
  42. package/node_modules/@gdh/core/dist/index.d.ts.map +1 -1
  43. package/node_modules/@gdh/core/dist/index.js +16 -18
  44. package/node_modules/@gdh/core/dist/index.js.map +1 -1
  45. package/node_modules/@gdh/core/package.json +1 -1
  46. package/node_modules/@gdh/docs/dist/guidance.d.ts.map +1 -1
  47. package/node_modules/@gdh/docs/dist/guidance.js +34 -2
  48. package/node_modules/@gdh/docs/dist/guidance.js.map +1 -1
  49. package/node_modules/@gdh/docs/dist/rules.d.ts.map +1 -1
  50. package/node_modules/@gdh/docs/dist/rules.js +2 -2
  51. package/node_modules/@gdh/docs/dist/rules.js.map +1 -1
  52. package/node_modules/@gdh/docs/package.json +2 -2
  53. package/node_modules/@gdh/mcp/package.json +8 -8
  54. package/node_modules/@gdh/observability/package.json +2 -2
  55. package/node_modules/@gdh/runtime/dist/bridge-surface.d.ts.map +1 -1
  56. package/node_modules/@gdh/runtime/dist/bridge-surface.js +128 -16
  57. package/node_modules/@gdh/runtime/dist/bridge-surface.js.map +1 -1
  58. package/node_modules/@gdh/runtime/dist/index.d.ts +1 -0
  59. package/node_modules/@gdh/runtime/dist/index.d.ts.map +1 -1
  60. package/node_modules/@gdh/runtime/dist/index.js +189 -0
  61. package/node_modules/@gdh/runtime/dist/index.js.map +1 -1
  62. package/node_modules/@gdh/runtime/dist/knowledge-surface.d.ts +6 -0
  63. package/node_modules/@gdh/runtime/dist/knowledge-surface.d.ts.map +1 -0
  64. package/node_modules/@gdh/runtime/dist/knowledge-surface.js +216 -0
  65. package/node_modules/@gdh/runtime/dist/knowledge-surface.js.map +1 -0
  66. package/node_modules/@gdh/runtime/package.json +2 -2
  67. package/node_modules/@gdh/scan/dist/onboard.d.ts.map +1 -1
  68. package/node_modules/@gdh/scan/dist/onboard.js +13 -0
  69. package/node_modules/@gdh/scan/dist/onboard.js.map +1 -1
  70. package/node_modules/@gdh/scan/package.json +3 -3
  71. package/node_modules/@gdh/verify/dist/policy.d.ts.map +1 -1
  72. package/node_modules/@gdh/verify/dist/policy.js +157 -29
  73. package/node_modules/@gdh/verify/dist/policy.js.map +1 -1
  74. package/node_modules/@gdh/verify/package.json +7 -7
  75. package/package.json +11 -11
@@ -1,11 +1,11 @@
1
1
  import { spawnSync } from "node:child_process";
2
- import fs from "node:fs/promises";
3
2
  import fsSync from "node:fs";
3
+ import fs from "node:fs/promises";
4
4
  import os from "node:os";
5
5
  import path from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
- import { buildGdhStatusResult, CLAUDE_CHECK_COMMAND_RELATIVE_PATH, CLAUDE_CHECK_UPDATE_HOOK_RELATIVE_PATH, CLAUDE_MIGRATE_COMMAND_RELATIVE_PATH, CLAUDE_ONBOARD_COMMAND_RELATIVE_PATH, CLAUDE_PREPARE_COMMAND_RELATIVE_PATH, CLAUDE_STATUS_COMMAND_RELATIVE_PATH, CLAUDE_VERIFY_COMMAND_RELATIVE_PATH, CODEX_CHECK_SKILL_RELATIVE_PATH, CODEX_MIGRATE_SKILL_RELATIVE_PATH, CODEX_ONBOARD_SKILL_RELATIVE_PATH, CODEX_PREPARE_SKILL_RELATIVE_PATH, CODEX_STATUS_SKILL_RELATIVE_PATH, CODEX_VERIFY_SKILL_RELATIVE_PATH, createGsdSnapshot, CURSOR_CHECK_SKILL_RELATIVE_PATH, CURSOR_MIGRATE_SKILL_RELATIVE_PATH, CURSOR_ONBOARD_SKILL_RELATIVE_PATH, CURSOR_PREPARE_SKILL_RELATIVE_PATH, CURSOR_STATUS_SKILL_RELATIVE_PATH, CURSOR_VERIFY_SKILL_RELATIVE_PATH, getSupportedAgentAdaptersStatus, installSupportedAgentAdapters, } from "@gdh/adapters";
8
- import { getManagedLspStatus, hasCompleteOnboardingSurface, inspectCacheState, pruneCacheState, readProjectConfig, resolvePinnedVersion, resolveProjectRoot, readWorktreeState, resolveAuthoringStatus, resolveTargetGodotDocsVersion, runAuthoringCheck, runImportRefresh, runTargetPrepare, runWarmup, } from "@gdh/authoring";
7
+ import { buildGdhStatusResult, CLAUDE_CHECK_COMMAND_RELATIVE_PATH, CLAUDE_CHECK_UPDATE_HOOK_RELATIVE_PATH, CLAUDE_MIGRATE_COMMAND_RELATIVE_PATH, CLAUDE_ONBOARD_COMMAND_RELATIVE_PATH, CLAUDE_PREPARE_COMMAND_RELATIVE_PATH, CLAUDE_STATUS_COMMAND_RELATIVE_PATH, CLAUDE_VERIFY_COMMAND_RELATIVE_PATH, CODEX_CHECK_SKILL_RELATIVE_PATH, CODEX_MIGRATE_SKILL_RELATIVE_PATH, CODEX_ONBOARD_SKILL_RELATIVE_PATH, CODEX_PREPARE_SKILL_RELATIVE_PATH, CODEX_STATUS_SKILL_RELATIVE_PATH, CODEX_VERIFY_SKILL_RELATIVE_PATH, CURSOR_CHECK_SKILL_RELATIVE_PATH, CURSOR_MIGRATE_SKILL_RELATIVE_PATH, CURSOR_ONBOARD_SKILL_RELATIVE_PATH, CURSOR_PREPARE_SKILL_RELATIVE_PATH, CURSOR_STATUS_SKILL_RELATIVE_PATH, CURSOR_VERIFY_SKILL_RELATIVE_PATH, createGsdSnapshot, getSupportedAgentAdaptersStatus, installSupportedAgentAdapters, } from "@gdh/adapters";
8
+ import { checkManagedLsp, doctorManagedLsp, getManagedLspStatus, hasCompleteOnboardingSurface, inspectCacheState, pruneCacheState, pruneManagedLsp, readProjectConfig, readWorktreeState, resolveAuthoringStatus, resolvePinnedVersion, resolveProjectRoot, resolveTargetGodotDocsVersion, restartManagedLsp, runAuthoringCheck, runImportRefresh, runTargetPrepare, runWarmup, stopManagedLsp, } from "@gdh/authoring";
9
9
  import { definePackageBoundary, GDH_AUTHORING_DOGFOOD_VERSION, GDH_AUTHORING_SLICE_REPORT_VERSION, GDH_PRODUCT_NAME, resolveCurrentGdhInstall, resolveGdhProductMetadata, } from "@gdh/core";
10
10
  import { fetchOfficialGodotDoc, getGuidanceStatus, resolveGuidanceQuery, searchOfficialGodotDocs, } from "@gdh/docs";
11
11
  import { createMcpManifest, invokeMcpTool, serveMcpOverStdio } from "@gdh/mcp";
@@ -354,7 +354,12 @@ async function runOnboardCommand(args, io) {
354
354
  const dryRun = args.includes("--dry-run");
355
355
  const { targetPath, error: targetPathError } = parseOptionalPositionalTargetPath(args, {
356
356
  usage: "Usage: gdh onboard [target] [--dry-run]\n",
357
- additionalOptionsWithValues: new Set(["--task-type", "--capability", "--repo-state", "--keyword"]),
357
+ additionalOptionsWithValues: new Set([
358
+ "--task-type",
359
+ "--capability",
360
+ "--repo-state",
361
+ "--keyword",
362
+ ]),
358
363
  });
359
364
  if (targetPathError !== null) {
360
365
  io.stderr.write(targetPathError);
@@ -426,7 +431,6 @@ async function runStatusCommand(args, io) {
426
431
  return 1;
427
432
  }
428
433
  const targetPath = parsedTarget.targetPath;
429
- const commandStartedAtMs = Date.now();
430
434
  // UPD-04: emit the update banner to stderr BEFORE primary work so the
431
435
  // stderr prelude precedes any stdout JSON payload. D-13 scopes the banner
432
436
  // to `gdh status` and `gdh verify` only. Silent when cache is null /
@@ -434,25 +438,10 @@ async function runStatusCommand(args, io) {
434
438
  await emitUpdateBannerIfStale(targetPath, io);
435
439
  try {
436
440
  const status = await buildGdhStatusResult(targetPath);
437
- await recordSessionEvent(targetPath, {
438
- commandStartedAtMs,
439
- kind: "status",
440
- command: "gdh status",
441
- state: status.readiness === "undetected" ? "blocked" : "succeeded",
442
- summary: status.summary,
443
- });
444
441
  io.stdout.write(`${JSON.stringify(status, null, 2)}\n`);
445
442
  return 0;
446
443
  }
447
444
  catch (error) {
448
- await recordSessionEvent(targetPath, {
449
- commandStartedAtMs,
450
- kind: "status",
451
- command: "gdh status",
452
- state: "failed",
453
- summary: "GDH status resolution failed before producing a result.",
454
- errorMessage: formatCliError(error),
455
- });
456
445
  io.stderr.write(`Failed to resolve status for "${targetPath}": ${formatCliError(error)}\n`);
457
446
  return 1;
458
447
  }
@@ -497,14 +486,26 @@ async function runLspCommand(args, io) {
497
486
  "Usage: gdh lsp <command> [target]",
498
487
  "",
499
488
  "Commands:",
500
- " status [target] Resolve the managed authoring.lsp lifecycle state and print it as JSON.",
489
+ " status [target] Resolve the managed authoring.lsp lifecycle state and print it as JSON.",
490
+ " check [target] Check the persisted managed LSP instance without launching a new one.",
491
+ " stop [target] Stop the persisted GDH-managed LSP instance for this worktree.",
492
+ " restart [target] Stop and relaunch the managed LSP instance for this worktree.",
493
+ " prune [target] Remove stale managed LSP state without killing live unrelated processes.",
494
+ " doctor [target] Report lifecycle, transport, diagnostics, and cleanup guidance.",
501
495
  ].join("\n") + "\n");
502
496
  return 0;
503
497
  }
504
498
  if (subcommand === "status") {
505
499
  return runLspStatusCommand(rest, io);
506
500
  }
507
- io.stderr.write(`Unknown lsp command: ${subcommand}\n\nUsage: gdh lsp status [target]\n`);
501
+ if (subcommand === "check" ||
502
+ subcommand === "stop" ||
503
+ subcommand === "restart" ||
504
+ subcommand === "prune" ||
505
+ subcommand === "doctor") {
506
+ return runLspLifecycleCommand(subcommand, rest, io);
507
+ }
508
+ io.stderr.write(`Unknown lsp command: ${subcommand}\n\nUsage: gdh lsp <status|check|stop|restart|prune|doctor> [target]\n`);
508
509
  return 1;
509
510
  }
510
511
  async function runDocsCommand(args, io) {
@@ -787,6 +788,63 @@ async function runLspStatusCommand(args, io) {
787
788
  return 1;
788
789
  }
789
790
  }
791
+ async function runLspLifecycleCommand(command, args, io) {
792
+ if (args.includes("--help")) {
793
+ io.stdout.write([
794
+ `Usage: gdh lsp ${command} [target]`,
795
+ `Usage: gdh lsp ${command} --target <path>`,
796
+ "",
797
+ describeLspLifecycleCommand(command),
798
+ ].join("\n") + "\n");
799
+ return 0;
800
+ }
801
+ const parsedTarget = parseSingleTargetPathArg(args, {
802
+ usage: `Usage: gdh lsp ${command} [target]\nUsage: gdh lsp ${command} --target <path>\n`,
803
+ allowTargetOption: true,
804
+ });
805
+ if (parsedTarget.error !== null) {
806
+ io.stderr.write(parsedTarget.error);
807
+ return 1;
808
+ }
809
+ const targetPath = parsedTarget.targetPath;
810
+ try {
811
+ const context = await buildAuthoringContext(targetPath);
812
+ const input = {
813
+ targetPath,
814
+ status: context.status,
815
+ projectConfig: context.projectConfig,
816
+ };
817
+ const result = command === "check"
818
+ ? await checkManagedLsp(input)
819
+ : command === "stop"
820
+ ? await stopManagedLsp(input)
821
+ : command === "restart"
822
+ ? await restartManagedLsp({ ...input, owner: "gdh lsp restart" })
823
+ : command === "prune"
824
+ ? await pruneManagedLsp(input)
825
+ : await doctorManagedLsp(input);
826
+ io.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
827
+ return 0;
828
+ }
829
+ catch (error) {
830
+ io.stderr.write(`Failed to run lsp ${command} for "${targetPath}": ${formatCliError(error)}\n`);
831
+ return 1;
832
+ }
833
+ }
834
+ function describeLspLifecycleCommand(command) {
835
+ switch (command) {
836
+ case "check":
837
+ return "Check the persisted managed LSP instance without launching a new one.";
838
+ case "stop":
839
+ return "Stop the persisted GDH-managed LSP instance for this worktree.";
840
+ case "restart":
841
+ return "Stop and relaunch the managed LSP instance for this worktree.";
842
+ case "prune":
843
+ return "Remove stale managed LSP state without killing live unrelated processes.";
844
+ case "doctor":
845
+ return "Report lifecycle, transport, diagnostics, and cleanup guidance.";
846
+ }
847
+ }
790
848
  async function runWarmupCommand(args, io) {
791
849
  if (args.includes("--help")) {
792
850
  io.stdout.write([
@@ -807,7 +865,12 @@ async function runWarmupCommand(args, io) {
807
865
  const dryRun = args.includes("--dry-run");
808
866
  const { targetPath, error: targetPathError } = parseOptionalPositionalTargetPath(args, {
809
867
  usage: "Usage: gdh warmup [target] [--dry-run]\n",
810
- additionalOptionsWithValues: new Set(["--task-type", "--capability", "--repo-state", "--keyword"]),
868
+ additionalOptionsWithValues: new Set([
869
+ "--task-type",
870
+ "--capability",
871
+ "--repo-state",
872
+ "--keyword",
873
+ ]),
811
874
  });
812
875
  if (targetPathError !== null) {
813
876
  io.stderr.write(targetPathError);
@@ -1692,7 +1755,13 @@ async function runRecipeListCommand(args, io) {
1692
1755
  }
1693
1756
  const { targetPath, error: targetPathError } = parseOptionalPositionalTargetPath(args, {
1694
1757
  usage: "Usage: gdh run-config list [target]\n",
1695
- additionalOptionsWithValues: new Set(["--provider", "--param", "--feature", "--no-feature", "--env"]),
1758
+ additionalOptionsWithValues: new Set([
1759
+ "--provider",
1760
+ "--param",
1761
+ "--feature",
1762
+ "--no-feature",
1763
+ "--env",
1764
+ ]),
1696
1765
  });
1697
1766
  if (targetPathError !== null) {
1698
1767
  io.stderr.write(targetPathError);
@@ -1929,7 +1998,13 @@ async function runScenarioListCommand(args, io) {
1929
1998
  }
1930
1999
  const { targetPath, error: targetPathError } = parseOptionalPositionalTargetPath(args, {
1931
2000
  usage: "Usage: gdh verification-scenario list [target]\n",
1932
- additionalOptionsWithValues: new Set(["--provider", "--param", "--feature", "--no-feature", "--env"]),
2001
+ additionalOptionsWithValues: new Set([
2002
+ "--provider",
2003
+ "--param",
2004
+ "--feature",
2005
+ "--no-feature",
2006
+ "--env",
2007
+ ]),
1933
2008
  });
1934
2009
  if (targetPathError !== null) {
1935
2010
  io.stderr.write(targetPathError);
@@ -2506,7 +2581,8 @@ async function runVerifyRunCommand(args, io) {
2506
2581
  disabledFeatures: collectOptionValues(args, "--no-feature"),
2507
2582
  environment: collectAssignmentOptionValues(args, "--env"),
2508
2583
  workspaceMode: args.includes("--live-workspace") ? "live_workspace" : "isolated_copy",
2509
- screenshotCapture: args.includes("--rendered-screenshot") || readSingleOptionValue(args, "--provider") === "docker"
2584
+ screenshotCapture: args.includes("--rendered-screenshot") ||
2585
+ readSingleOptionValue(args, "--provider") === "docker"
2510
2586
  ? "rendered"
2511
2587
  : "never",
2512
2588
  });
@@ -2779,11 +2855,7 @@ async function runVerifyDriftCommand(args, io) {
2779
2855
  }
2780
2856
  const match = content.match(file.versionRegex ?? VERIFY_DRIFT_BAKED_VERSION_REGEX);
2781
2857
  const baked = match?.[1] ?? null;
2782
- const reason = baked === null
2783
- ? "no_baked_version"
2784
- : baked !== pinnedVersion
2785
- ? "version_mismatch"
2786
- : "ok";
2858
+ const reason = baked === null ? "no_baked_version" : baked !== pinnedVersion ? "version_mismatch" : "ok";
2787
2859
  return {
2788
2860
  relativePath: file.relativePath,
2789
2861
  description: file.description,
@@ -3013,7 +3085,12 @@ async function runCacheInspectCommand(args, io) {
3013
3085
  }
3014
3086
  const { targetPath, error: targetPathError } = parseOptionalPositionalTargetPath(args, {
3015
3087
  usage: "Usage: gdh cache inspect [target]\n",
3016
- additionalOptionsWithValues: new Set(["--task-type", "--capability", "--repo-state", "--keyword"]),
3088
+ additionalOptionsWithValues: new Set([
3089
+ "--task-type",
3090
+ "--capability",
3091
+ "--repo-state",
3092
+ "--keyword",
3093
+ ]),
3017
3094
  });
3018
3095
  if (targetPathError !== null) {
3019
3096
  io.stderr.write(targetPathError);
@@ -3120,7 +3197,12 @@ async function runGuidanceResolveCommand(args, io) {
3120
3197
  }
3121
3198
  const { targetPath, error: targetPathError } = parseOptionalPositionalTargetPath(args, {
3122
3199
  usage: "Usage: gdh guidance resolve [target] [--task-type <type>] [--capability <id>] [--repo-state <state>] [--keyword <term>]\n",
3123
- additionalOptionsWithValues: new Set(["--task-type", "--capability", "--repo-state", "--keyword"]),
3200
+ additionalOptionsWithValues: new Set([
3201
+ "--task-type",
3202
+ "--capability",
3203
+ "--repo-state",
3204
+ "--keyword",
3205
+ ]),
3124
3206
  });
3125
3207
  if (targetPathError !== null) {
3126
3208
  io.stderr.write(targetPathError);
@@ -3872,7 +3954,7 @@ function renderHelp() {
3872
3954
  " adapters install [target] [--dry-run] [--agent <name>] [--user] [--dev-repo <path>] [--integration-root <path>] Install or repair supported-agent reinforcement.",
3873
3955
  " adapters gsd snapshot [target] [--files <path>] [--performed <kind>] Export a read-only GSD projection.",
3874
3956
  " authoring check [target] Run the current authoring-check entrypoint.",
3875
- " lsp status [target] Resolve the managed authoring.lsp lifecycle state.",
3957
+ " lsp <status|check|stop|restart|prune|doctor> [target] Manage authoring.lsp lifecycle state.",
3876
3958
  " warmup [target] [--dry-run] Inspect or apply authoring worktree warmup.",
3877
3959
  " target prepare [target] [--source-target <path>] [--dry-run] Prepare target-local generated/import state.",
3878
3960
  " imports refresh [target] [--dry-run] Run or plan a headless Godot import refresh.",
@@ -4063,11 +4145,15 @@ function buildGuidanceSnapshot(result) {
4063
4145
  }
4064
4146
  export async function recordSessionEvent(targetPath, input) {
4065
4147
  try {
4148
+ const onboardedRoot = await resolveProjectRoot(targetPath);
4149
+ if (onboardedRoot === null) {
4150
+ return;
4151
+ }
4066
4152
  const { commandStartedAtMs, ...eventInput } = input;
4067
4153
  const startedAt = typeof commandStartedAtMs === "number" && Number.isFinite(commandStartedAtMs)
4068
4154
  ? new Date(commandStartedAtMs).toISOString()
4069
4155
  : null;
4070
- await recordAuthoringSessionEvent(targetPath, {
4156
+ await recordAuthoringSessionEvent(onboardedRoot, {
4071
4157
  sessionId: process.env["GDH_SESSION_ID"] ?? null,
4072
4158
  startedAt,
4073
4159
  ...eventInput,