Merge pull request #256 from open-gsd/fix/186-migrate-per-family-handlers
refactor(#186): split per-family handler maps into sdk/src/handlers
This commit is contained in:
28
sdk/src/handlers/init/index.ts
Normal file
28
sdk/src/handlers/init/index.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import type { QueryHandler } from '../../query/utils.js';
|
||||
import {
|
||||
initExecutePhase, initPlanPhase, initNewMilestone, initQuick,
|
||||
initIngestDocs, initResume, initVerifyWork, initPhaseOp, initTodos,
|
||||
initMilestoneOp, initMapCodebase, initNewWorkspace,
|
||||
initListWorkspaces, initRemoveWorkspace,
|
||||
} from './composer.js';
|
||||
import { initNewProject, initProgress, initManager } from './complex.js';
|
||||
|
||||
export const INIT_FAMILY_HANDLERS: Readonly<Record<string, QueryHandler>> = {
|
||||
'init.execute-phase': initExecutePhase,
|
||||
'init.plan-phase': initPlanPhase,
|
||||
'init.new-project': initNewProject,
|
||||
'init.new-milestone': initNewMilestone,
|
||||
'init.quick': initQuick,
|
||||
'init.ingest-docs': initIngestDocs,
|
||||
'init.resume': initResume,
|
||||
'init.verify-work': initVerifyWork,
|
||||
'init.phase-op': initPhaseOp,
|
||||
'init.todos': initTodos,
|
||||
'init.milestone-op': initMilestoneOp,
|
||||
'init.map-codebase': initMapCodebase,
|
||||
'init.progress': initProgress,
|
||||
'init.manager': initManager,
|
||||
'init.new-workspace': initNewWorkspace,
|
||||
'init.list-workspaces': initListWorkspaces,
|
||||
'init.remove-workspace': initRemoveWorkspace,
|
||||
};
|
||||
20
sdk/src/handlers/phase/index.ts
Normal file
20
sdk/src/handlers/phase/index.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { QueryHandler } from '../../query/utils.js';
|
||||
import { phaseListPlans, phaseListArtifacts } from '../../query/phase-list-queries.js';
|
||||
import { phaseUatPassed } from '../../query/phase-uat-passed.js';
|
||||
import {
|
||||
phaseAdd, phaseAddBatch, phaseInsert, phaseRemove, phaseComplete,
|
||||
phaseScaffold, phaseNextDecimal,
|
||||
} from '../../query/phase-lifecycle.js';
|
||||
|
||||
export const PHASE_FAMILY_HANDLERS: Readonly<Record<string, QueryHandler>> = {
|
||||
'phase.list-plans': phaseListPlans,
|
||||
'phase.list-artifacts': phaseListArtifacts,
|
||||
'phase.uat-passed': phaseUatPassed,
|
||||
'phase.add': phaseAdd,
|
||||
'phase.add-batch': phaseAddBatch,
|
||||
'phase.insert': phaseInsert,
|
||||
'phase.remove': phaseRemove,
|
||||
'phase.complete': phaseComplete,
|
||||
'phase.scaffold': phaseScaffold,
|
||||
'phase.next-decimal': phaseNextDecimal,
|
||||
};
|
||||
8
sdk/src/handlers/phases/index.ts
Normal file
8
sdk/src/handlers/phases/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { QueryHandler } from '../../query/utils.js';
|
||||
import { phasesList, phasesClear, phasesArchive } from '../../query/phase-lifecycle.js';
|
||||
|
||||
export const PHASES_FAMILY_HANDLERS: Readonly<Record<string, QueryHandler>> = {
|
||||
'phases.list': phasesList,
|
||||
'phases.clear': phasesClear,
|
||||
'phases.archive': phasesArchive,
|
||||
};
|
||||
10
sdk/src/handlers/roadmap/index.ts
Normal file
10
sdk/src/handlers/roadmap/index.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { QueryHandler } from '../../query/utils.js';
|
||||
import { roadmapAnalyze, roadmapGetPhase, roadmapAnnotateDependencies } from '../../query/roadmap.js';
|
||||
import { roadmapUpdatePlanProgress } from '../../query/roadmap-update-plan-progress.js';
|
||||
|
||||
export const ROADMAP_FAMILY_HANDLERS: Readonly<Record<string, QueryHandler>> = {
|
||||
'roadmap.analyze': roadmapAnalyze,
|
||||
'roadmap.get-phase': roadmapGetPhase,
|
||||
'roadmap.update-plan-progress': roadmapUpdatePlanProgress,
|
||||
'roadmap.annotate-dependencies': roadmapAnnotateDependencies,
|
||||
};
|
||||
35
sdk/src/handlers/state/index.ts
Normal file
35
sdk/src/handlers/state/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import type { QueryHandler } from '../../query/utils.js';
|
||||
import { stateProjectLoad } from '../../query/state-project-load.js';
|
||||
import { stateJson, stateGet } from '../../query/state.js';
|
||||
import {
|
||||
stateUpdate, statePatch, stateBeginPhase, stateAdvancePlan,
|
||||
stateRecordMetric, stateUpdateProgress, stateAddDecision,
|
||||
stateAddBlocker, stateResolveBlocker, stateRecordSession,
|
||||
stateSignalWaiting, stateSignalResume, statePlannedPhase,
|
||||
stateValidate, stateSync, statePrune, stateMilestoneSwitch,
|
||||
stateAddRoadmapEvolution,
|
||||
} from '../../query/state-mutation.js';
|
||||
|
||||
export const STATE_FAMILY_HANDLERS: Readonly<Record<string, QueryHandler>> = {
|
||||
'state.load': stateProjectLoad,
|
||||
'state.json': stateJson,
|
||||
'state.get': stateGet,
|
||||
'state.update': stateUpdate,
|
||||
'state.patch': statePatch,
|
||||
'state.begin-phase': stateBeginPhase,
|
||||
'state.advance-plan': stateAdvancePlan,
|
||||
'state.record-metric': stateRecordMetric,
|
||||
'state.update-progress': stateUpdateProgress,
|
||||
'state.add-decision': stateAddDecision,
|
||||
'state.add-blocker': stateAddBlocker,
|
||||
'state.resolve-blocker': stateResolveBlocker,
|
||||
'state.record-session': stateRecordSession,
|
||||
'state.signal-waiting': stateSignalWaiting,
|
||||
'state.signal-resume': stateSignalResume,
|
||||
'state.planned-phase': statePlannedPhase,
|
||||
'state.validate': stateValidate,
|
||||
'state.sync': stateSync,
|
||||
'state.prune': statePrune,
|
||||
'state.milestone-switch': stateMilestoneSwitch,
|
||||
'state.add-roadmap-evolution': stateAddRoadmapEvolution,
|
||||
};
|
||||
9
sdk/src/handlers/validate/index.ts
Normal file
9
sdk/src/handlers/validate/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { QueryHandler } from '../../query/utils.js';
|
||||
import { validateConsistency, validateHealth, validateAgents, validateContext } from '../../query/validate.js';
|
||||
|
||||
export const VALIDATE_FAMILY_HANDLERS: Readonly<Record<string, QueryHandler>> = {
|
||||
'validate.consistency': validateConsistency,
|
||||
'validate.health': validateHealth,
|
||||
'validate.agents': validateAgents,
|
||||
'validate.context': validateContext,
|
||||
};
|
||||
18
sdk/src/handlers/verify/index.ts
Normal file
18
sdk/src/handlers/verify/index.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { QueryHandler } from '../../query/utils.js';
|
||||
import {
|
||||
verifyPlanStructure, verifyPhaseCompleteness, verifyReferences,
|
||||
verifyCommits, verifyArtifacts, verifySchemaDrift,
|
||||
} from '../../query/verify.js';
|
||||
import { verifyKeyLinks } from '../../query/validate.js';
|
||||
|
||||
export const VERIFY_FAMILY_HANDLERS: Readonly<Record<string, QueryHandler>> = {
|
||||
'verify.plan-structure': verifyPlanStructure,
|
||||
'verify.phase-completeness': verifyPhaseCompleteness,
|
||||
'verify.references': verifyReferences,
|
||||
'verify.commits': verifyCommits,
|
||||
'verify.artifacts': verifyArtifacts,
|
||||
'verify.key-links': verifyKeyLinks,
|
||||
'verify.schema-drift': verifySchemaDrift,
|
||||
// 'verify.codebase-drift' intentionally omitted — out-of-seam CJS-only
|
||||
// per ADR/PRD 3524 §3 / L160. Router dispatches direct to CJS handler.
|
||||
};
|
||||
@@ -1,123 +1,19 @@
|
||||
import type { QueryHandler } from './utils.js';
|
||||
|
||||
import { stateProjectLoad } from './state-project-load.js';
|
||||
import { stateJson, stateGet } from './state.js';
|
||||
import {
|
||||
stateUpdate, statePatch, stateBeginPhase, stateAdvancePlan,
|
||||
stateRecordMetric, stateUpdateProgress, stateAddDecision,
|
||||
stateAddBlocker, stateResolveBlocker, stateRecordSession,
|
||||
stateSignalWaiting, stateSignalResume, statePlannedPhase,
|
||||
stateValidate, stateSync, statePrune, stateMilestoneSwitch,
|
||||
stateAddRoadmapEvolution,
|
||||
} from './state-mutation.js';
|
||||
import { roadmapAnalyze, roadmapGetPhase, roadmapAnnotateDependencies } from './roadmap.js';
|
||||
import { roadmapUpdatePlanProgress } from './roadmap-update-plan-progress.js';
|
||||
import {
|
||||
verifyPlanStructure, verifyPhaseCompleteness, verifyReferences,
|
||||
verifyCommits, verifyArtifacts, verifySchemaDrift,
|
||||
} from './verify.js';
|
||||
// verifyCodebaseDrift intentionally NOT imported — drift is out-of-seam
|
||||
// (CJS-only) per ADR/PRD docs/adr/3524-cjs-sdk-hard-seam.md §3 and
|
||||
// docs/prd/3524-cjs-sdk-hard-seam.md L160. The CJS router dispatches
|
||||
// verify codebase-drift directly to bin/lib/drift.cjs / verify.cjs.
|
||||
import { verifyKeyLinks, validateConsistency, validateHealth, validateAgents, validateContext } from './validate.js';
|
||||
import {
|
||||
phaseListPlans, phaseListArtifacts,
|
||||
} from './phase-list-queries.js';
|
||||
import { phaseUatPassed } from './phase-uat-passed.js';
|
||||
import {
|
||||
phaseAdd, phaseAddBatch, phaseInsert, phaseRemove, phaseComplete,
|
||||
phaseScaffold, phaseNextDecimal, phasesList, phasesClear, phasesArchive,
|
||||
} from './phase-lifecycle.js';
|
||||
import {
|
||||
initExecutePhase, initPlanPhase, initNewMilestone, initQuick,
|
||||
initIngestDocs, initResume, initVerifyWork, initPhaseOp, initTodos,
|
||||
initMilestoneOp, initMapCodebase, initNewWorkspace,
|
||||
initListWorkspaces, initRemoveWorkspace,
|
||||
} from '../handlers/init/composer.js';
|
||||
import { initNewProject, initProgress, initManager } from '../handlers/init/complex.js';
|
||||
import { STATE_FAMILY_HANDLERS } from '../handlers/state/index.js';
|
||||
import { ROADMAP_FAMILY_HANDLERS } from '../handlers/roadmap/index.js';
|
||||
import { VERIFY_FAMILY_HANDLERS } from '../handlers/verify/index.js';
|
||||
import { VALIDATE_FAMILY_HANDLERS } from '../handlers/validate/index.js';
|
||||
import { PHASE_FAMILY_HANDLERS } from '../handlers/phase/index.js';
|
||||
import { PHASES_FAMILY_HANDLERS } from '../handlers/phases/index.js';
|
||||
import { INIT_FAMILY_HANDLERS } from '../handlers/init/index.js';
|
||||
|
||||
export const FAMILY_HANDLERS: Record<string, Readonly<Record<string, QueryHandler>>> = {
|
||||
state: {
|
||||
'state.load': stateProjectLoad,
|
||||
'state.json': stateJson,
|
||||
'state.get': stateGet,
|
||||
'state.update': stateUpdate,
|
||||
'state.patch': statePatch,
|
||||
'state.begin-phase': stateBeginPhase,
|
||||
'state.advance-plan': stateAdvancePlan,
|
||||
'state.record-metric': stateRecordMetric,
|
||||
'state.update-progress': stateUpdateProgress,
|
||||
'state.add-decision': stateAddDecision,
|
||||
'state.add-blocker': stateAddBlocker,
|
||||
'state.resolve-blocker': stateResolveBlocker,
|
||||
'state.record-session': stateRecordSession,
|
||||
'state.signal-waiting': stateSignalWaiting,
|
||||
'state.signal-resume': stateSignalResume,
|
||||
'state.planned-phase': statePlannedPhase,
|
||||
'state.validate': stateValidate,
|
||||
'state.sync': stateSync,
|
||||
'state.prune': statePrune,
|
||||
'state.milestone-switch': stateMilestoneSwitch,
|
||||
'state.add-roadmap-evolution': stateAddRoadmapEvolution,
|
||||
},
|
||||
roadmap: {
|
||||
'roadmap.analyze': roadmapAnalyze,
|
||||
'roadmap.get-phase': roadmapGetPhase,
|
||||
'roadmap.update-plan-progress': roadmapUpdatePlanProgress,
|
||||
'roadmap.annotate-dependencies': roadmapAnnotateDependencies,
|
||||
},
|
||||
verify: {
|
||||
'verify.plan-structure': verifyPlanStructure,
|
||||
'verify.phase-completeness': verifyPhaseCompleteness,
|
||||
'verify.references': verifyReferences,
|
||||
'verify.commits': verifyCommits,
|
||||
'verify.artifacts': verifyArtifacts,
|
||||
'verify.key-links': verifyKeyLinks,
|
||||
'verify.schema-drift': verifySchemaDrift,
|
||||
// 'verify.codebase-drift' intentionally omitted — out-of-seam CJS-only
|
||||
// per ADR/PRD 3524 §3 / L160. Router dispatches direct to CJS handler.
|
||||
},
|
||||
validate: {
|
||||
'validate.consistency': validateConsistency,
|
||||
'validate.health': validateHealth,
|
||||
'validate.agents': validateAgents,
|
||||
'validate.context': validateContext,
|
||||
},
|
||||
phase: {
|
||||
'phase.list-plans': phaseListPlans,
|
||||
'phase.list-artifacts': phaseListArtifacts,
|
||||
'phase.uat-passed': phaseUatPassed,
|
||||
'phase.add': phaseAdd,
|
||||
'phase.add-batch': phaseAddBatch,
|
||||
'phase.insert': phaseInsert,
|
||||
'phase.remove': phaseRemove,
|
||||
'phase.complete': phaseComplete,
|
||||
'phase.scaffold': phaseScaffold,
|
||||
'phase.next-decimal': phaseNextDecimal,
|
||||
},
|
||||
phases: {
|
||||
'phases.list': phasesList,
|
||||
'phases.clear': phasesClear,
|
||||
'phases.archive': phasesArchive,
|
||||
},
|
||||
init: {
|
||||
'init.execute-phase': initExecutePhase,
|
||||
'init.plan-phase': initPlanPhase,
|
||||
'init.new-project': initNewProject,
|
||||
'init.new-milestone': initNewMilestone,
|
||||
'init.quick': initQuick,
|
||||
'init.ingest-docs': initIngestDocs,
|
||||
'init.resume': initResume,
|
||||
'init.verify-work': initVerifyWork,
|
||||
'init.phase-op': initPhaseOp,
|
||||
'init.todos': initTodos,
|
||||
'init.milestone-op': initMilestoneOp,
|
||||
'init.map-codebase': initMapCodebase,
|
||||
'init.progress': initProgress,
|
||||
'init.manager': initManager,
|
||||
'init.new-workspace': initNewWorkspace,
|
||||
'init.list-workspaces': initListWorkspaces,
|
||||
'init.remove-workspace': initRemoveWorkspace,
|
||||
},
|
||||
state: STATE_FAMILY_HANDLERS,
|
||||
roadmap: ROADMAP_FAMILY_HANDLERS,
|
||||
verify: VERIFY_FAMILY_HANDLERS,
|
||||
validate: VALIDATE_FAMILY_HANDLERS,
|
||||
phase: PHASE_FAMILY_HANDLERS,
|
||||
phases: PHASES_FAMILY_HANDLERS,
|
||||
init: INIT_FAMILY_HANDLERS,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user