Skip to content

feat(hub-mode): re-derive hub-mode as a gsd-core capability - #1

Open
avireddy0 wants to merge 1 commit into
nextfrom
envision-hub
Open

feat(hub-mode): re-derive hub-mode as a gsd-core capability#1
avireddy0 wants to merge 1 commit into
nextfrom
envision-hub

Conversation

@avireddy0

Copy link
Copy Markdown

Summary

Re-derives the deferred Envision-authored hub-mode against gsd-core's capability architecture (ADR-457 build-at-publish, ADR-959 command families). Hub-mode is a hybrid: a capability descriptor + additive, repo_type-gated branches in core .cts. The standalone validator path stays byte-behavior-identical — every hub branch is isHub-gated.

Spec source: the deferred gsd-hub-mode-deferred/ artifacts (the only true engine patch in the retired get-shit-done-cc@1.42.3 overlay; no upstream home).

What's in it

Created

  • capabilities/hub-mode/capability.jsonrole:feature; capability-owned federated config keys repo_type {enum standalone|spoke|hub, default standalone} + workflow.hub_mode {boolean,false}; commands:[{family:"hub", module:"hub-command-router.cjs", router:"routeHubCommand"}] (auto-routed by dispatchCapabilityCommandno gsd-tools.cjs edit). repo_type is deliberately NOT in the central config-schema.manifest.json (validateCrossCapability owns-exactly-once).
  • src/hub-query.cts — typed, synchronous port of the deferred hub-query.cjs (5 read-only getters + deriveState/loadPhaseBundle/readStateMilestone/sliceCurrentMilestoneSection). PORT FIX: extractCurrentMilestone imported from ./roadmap-parser.cjs (retired ./core.cjs spine). Stamps generator_version: "1.0.0".
  • src/hub-command-router.cts — synchronous routeHubCommand; requires hub v1; dispatches milestone current / phase <id> / phases [--milestone][--state] / manifest [--tier][--role] / spoke <slug>. All mutation:false.
  • tests/{hub-query,repo-type-hub-mode}.test.cjs — ported, 47 asserts (21 repo-type + 26 hub-query), invoked via tests/helpers.cjs runGsdTools.

Edited (additive, repo_type-gated)

  • src/verify.cts cmdValidateHealth — reads repo_type RAW via JSON.parse(.planning/config.json) (default standalone, fail-open) → isHub. Hub branches: W005 skip _-dirs; W006 archive-aware; W007 scope to current-milestone {lo,hi}; W002 lookbehind/lookahead regex + archive-prefix union; W019 .planning/.gsdrootallow allowlist + hub fix text. Archive walks are try/catch fail-open. New invalid-repo_type warning = W022 (W021 is already used twice in verify.cts).
  • .gitignore + eslint.config.mjs — register the two gitignored compiled artifacts.
  • gsd-core/bin/lib/capability-registry.cjs — regenerated.

Reconciliations (called out for review)

  • standalone W005 digit-width (T1/T6): the deferred spec asserted standalone strictly flags 3-digit phase dirs, but the live phaseDirNameRe accepts \d{2,} by upstream contract (tests/26-w005-... asserts 999.1-foo is valid in standalone). Restoring a strict 2-digit standalone regex regressed that upstream test, so standalone keeps the shared regex; hub's only W005 relaxation is the _-prefix skip. T1/T6 reconciled to the engine's real behavior (documented inline).
  • W021 → W022: invalid-repo_type uses W022; ported W021 asserts updated.

Verification

  • npm run build → exit 0
  • node scripts/gen-capability-registry.cjs --check → in sync; repo_type federated + absent from central manifest
  • 47/47 hub asserts pass; upstream W005/W006/validator regression tests green (14/14 + 47 adjacent)
  • lint:ci clean on all hub files
  • verb smokes (hub v1 milestone current/phase/phases/manifest/spoke → versioned JSON, generator_version 1.0.0; hub v2 rejected) + relaxation smokes (W005/W006/W007/W019 suppressed under hub, W022 fires on bad value) green

https://claude.ai/code/session_01Jo32HyGuio7m4BDxLbBYvf

…e + hub v1 query + validator relaxations)

Re-derives the deferred Envision-authored hub-mode against gsd-core's
capability architecture (ADR-457 build-at-publish, ADR-959 command families).
Hybrid: a capability descriptor + additive, repo_type-gated branches in core .cts.
The standalone validator path is byte-behavior-identical (all hub branches isHub-gated).

CREATE:
- capabilities/hub-mode/capability.json — role:feature; capability-owned federated
  config keys repo_type {enum standalone|spoke|hub, default standalone} +
  workflow.hub_mode {boolean,false}; commands:[{family:"hub",
  module:"hub-command-router.cjs",router:"routeHubCommand"}] (auto-routed by
  dispatchCapabilityCommand — no gsd-tools.cjs edit). repo_type is NOT added to the
  central config-schema.manifest.json (validateCrossCapability owns-exactly-once).
- src/hub-query.cts — typed, synchronous port of the deferred hub-query.cjs
  (5 read-only getters + deriveState/loadPhaseBundle/readStateMilestone/
  sliceCurrentMilestoneSection). PORT FIX: extractCurrentMilestone imported from
  ./roadmap-parser.cjs (retired ./core.cjs spine). Stamps generator_version 1.0.0.
- src/hub-command-router.cts — synchronous routeHubCommand; requires `hub v1`;
  dispatches milestone current / phase / phases / manifest / spoke. All mutation:false.
- tests/{hub-query,repo-type-hub-mode}.test.cjs — ported (47 asserts, via runGsdTools).

EDIT (additive, repo_type-gated):
- src/verify.cts cmdValidateHealth — reads repo_type RAW via JSON.parse (default
  standalone, fail-open) → isHub. Hub branches: W005 skip _-dirs; W006 archive-aware;
  W007 scope to current-milestone {lo,hi}; W002 lookbehind/lookahead regex + archive
  prefix union; W019 .planning/.gsdrootallow allowlist + hub fix text. NEW invalid
  repo_type warning = W022 (W021 already used twice at :1719 and :1822).
- .gitignore + eslint.config.mjs — register the two gitignored compiled artifacts.
- gsd-core/bin/lib/capability-registry.cjs — regenerated (gen:capability-registry).

RECONCILIATIONS:
- repo-type T1/T6: the deferred spec asserted standalone STRICTLY flags 3-digit
  phase dirs, but live phaseDirNameRe accepts \d{2,} by upstream contract
  (tests/26-w005-... asserts 999.1-foo is valid in standalone). Restoring a strict
  2-digit standalone regex regressed that upstream test, so standalone keeps the
  shared regex; hub's only W005 relaxation is the _-prefix skip. T1/T6 reconciled
  to the engine's real behavior (documented inline).
- W021→W022: the invalid-repo_type warning uses W022; ported W021 asserts updated.
- Assert count: 47 (21 repo-type + 26 hub-query), matching the README design intent.

Verified: npm run build (exit 0), gen-capability-registry --check (in sync,
repo_type federated + absent from central manifest), 47/47 hub asserts pass,
upstream W005/W006/validator regression tests green, lint:ci clean on all
hub files, verb + relaxation smokes green.

Claude-Session: https://claude.ai/code/session_01Jo32HyGuio7m4BDxLbBYvf
Comment thread src/hub-query.cts

function sliceCurrentMilestoneSection(roadmapContent: string, version: string | null): string | null {
if (!version) return null;
const escaped = version.replace(/\./g, '\\.');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants