@structured-vibe-coding/core 0.20.0 → 0.21.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.
@@ -26,8 +26,8 @@ import {
26
26
  renderProtocolMd,
27
27
  renderThinAgent,
28
28
  writeAgentHandoff
29
- } from "./chunk-O4OQWVC7.js";
30
- import "./chunk-HUSXETPS.js";
29
+ } from "./chunk-5GLH6ZWU.js";
30
+ import "./chunk-AERAWOAK.js";
31
31
  import "./chunk-TNWFMRIA.js";
32
32
  import "./chunk-MHODNFIL.js";
33
33
  import "./chunk-O5SP6X5R.js";
@@ -6,7 +6,7 @@ import {
6
6
  loadConfig,
7
7
  readRole,
8
8
  readTeamConfig
9
- } from "./chunk-HUSXETPS.js";
9
+ } from "./chunk-AERAWOAK.js";
10
10
  import {
11
11
  buildContext,
12
12
  defaultMemoryDir,
@@ -3322,7 +3322,7 @@ async function buildAgentPrompt(ctx, config, projectRoot, budget, runtime) {
3322
3322
  }
3323
3323
  try {
3324
3324
  const { loadMcpConfig } = await import("./sources-3TXUPU6V.js");
3325
- const { gatherMcpContextForChange, formatMcpContextForHandoff } = await import("./gather-ZKVMJW5L.js");
3325
+ const { gatherMcpContextForChange, formatMcpContextForHandoff } = await import("./gather-A3Q4WSPH.js");
3326
3326
  const mcpCfg = await loadMcpConfig(projectRoot);
3327
3327
  if (mcpCfg.auto_fetch_on_handoff && mcpCfg.sources.length) {
3328
3328
  const fetched = await gatherMcpContextForChange(projectRoot, ctx);
@@ -26,7 +26,7 @@ function toProcessEnv(base, extra) {
26
26
  }
27
27
 
28
28
  // src/version.ts
29
- var SDD_CORE_VERSION = "0.20.0" ? "0.20.0" : "0.0.0-dev";
29
+ var SDD_CORE_VERSION = "0.21.0" ? "0.21.0" : "0.0.0-dev";
30
30
 
31
31
  // src/mcp/client.ts
32
32
  function mcpTimeoutMs() {
@@ -4,7 +4,7 @@ import {
4
4
  gitUserName,
5
5
  loadConfig,
6
6
  readTeamConfig
7
- } from "./chunk-HUSXETPS.js";
7
+ } from "./chunk-AERAWOAK.js";
8
8
  import {
9
9
  ChangeMetaSchema,
10
10
  activeStages,
@@ -970,7 +970,7 @@ async function createChange(input) {
970
970
  await materializeStageArtifacts(projectRoot, config, id, workflow, meta, firstStage);
971
971
  await setActiveChange(projectRoot, config, id);
972
972
  try {
973
- const { refreshActiveAgentContext } = await import("./agents-YN3Z3VOH.js");
973
+ const { refreshActiveAgentContext } = await import("./agents-U5RVEZTX.js");
974
974
  await refreshActiveAgentContext(projectRoot);
975
975
  } catch {
976
976
  }
@@ -1072,7 +1072,7 @@ async function advanceStage(projectRoot, config, changeId, opts) {
1072
1072
  stage2
1073
1073
  );
1074
1074
  try {
1075
- const { refreshActiveAgentContext } = await import("./agents-YN3Z3VOH.js");
1075
+ const { refreshActiveAgentContext } = await import("./agents-U5RVEZTX.js");
1076
1076
  await refreshActiveAgentContext(projectRoot);
1077
1077
  } catch {
1078
1078
  }
@@ -1129,7 +1129,7 @@ async function advanceStage(projectRoot, config, changeId, opts) {
1129
1129
  stage
1130
1130
  );
1131
1131
  try {
1132
- const { refreshActiveAgentContext } = await import("./agents-YN3Z3VOH.js");
1132
+ const { refreshActiveAgentContext } = await import("./agents-U5RVEZTX.js");
1133
1133
  await refreshActiveAgentContext(projectRoot);
1134
1134
  } catch {
1135
1135
  }
@@ -1262,7 +1262,7 @@ async function completeChange(projectRoot, config, changeId) {
1262
1262
  let promoted;
1263
1263
  if (ctx.meta.workflow === "greenfield" || ctx.meta.flags?.greenfield === true) {
1264
1264
  try {
1265
- const { promoteGreenfieldToMemory: promoteGreenfieldToMemory2 } = await import("./greenfield-O2DI27HY.js");
1265
+ const { promoteGreenfieldToMemory: promoteGreenfieldToMemory2 } = await import("./greenfield-QTMU2MH6.js");
1266
1266
  promoted = await promoteGreenfieldToMemory2(projectRoot, config, changeId);
1267
1267
  } catch {
1268
1268
  }
@@ -3,7 +3,7 @@ import {
3
3
  gatherMcpContext,
4
4
  gatherMcpContextForChange,
5
5
  listMatchingSourceIds
6
- } from "./chunk-EDXT3RTN.js";
6
+ } from "./chunk-ICRQOQWE.js";
7
7
  import "./chunk-4BRO7BOJ.js";
8
8
  import "./chunk-MHODNFIL.js";
9
9
  import "./chunk-O5SP6X5R.js";
@@ -6,8 +6,8 @@ import {
6
6
  startFeatureFromBacklog,
7
7
  startGreenfield,
8
8
  updateFeatureStatus
9
- } from "./chunk-NY5FFWXG.js";
10
- import "./chunk-HUSXETPS.js";
9
+ } from "./chunk-Z2ULYVHO.js";
10
+ import "./chunk-AERAWOAK.js";
11
11
  import "./chunk-TNWFMRIA.js";
12
12
  import "./chunk-MHODNFIL.js";
13
13
  import "./chunk-O5SP6X5R.js";
package/dist/index.d.ts CHANGED
@@ -3397,6 +3397,32 @@ declare function runGuide(root: string, input?: {
3397
3397
  now?: () => Date;
3398
3398
  }): Promise<RoleCommandResult>;
3399
3399
 
3400
+ declare const SETUP_STEP_IDS: readonly ["folder", "workflow", "host", "roles", "model", "check", "start"];
3401
+ type SetupStepId = (typeof SETUP_STEP_IDS)[number];
3402
+ declare const SETUP_WHY: Record<SetupStepId, string>;
3403
+ type SetupRolesChoice = "duties" | "software" | "keep";
3404
+ type SetupModelState = "configured" | "missing" | {
3405
+ error: string;
3406
+ };
3407
+ type SetupStatus = {
3408
+ folder: boolean;
3409
+ host: string | null;
3410
+ roles: string[];
3411
+ model: SetupModelState;
3412
+ };
3413
+ type SetupStepInput = {
3414
+ step: SetupStepId;
3415
+ workflow?: string;
3416
+ host?: false | AgentTarget;
3417
+ roles?: SetupRolesChoice;
3418
+ /** When the model is missing, true exits 1. False prints the sentence and exits 0. */
3419
+ requireModel?: boolean;
3420
+ };
3421
+ declare function parseSetupStep(raw: string): SetupStepId | null;
3422
+ declare function formatSetupStatus(status: SetupStatus): string;
3423
+ declare function readSetupStatus(root: string, env?: Record<string, string | undefined>): Promise<SetupStatus>;
3424
+ declare function runSetupStep(root: string, input: SetupStepInput, env?: Record<string, string | undefined>): Promise<RoleCommandResult>;
3425
+
3400
3426
  declare function recordSignoff(root: string, input: {
3401
3427
  note?: string;
3402
3428
  stage?: string;
@@ -4005,4 +4031,4 @@ declare function formatEpicGraph(nodes: StoryNode[]): {
4005
4031
  /** Graph errors, then open dependencies. Null means the branch may be created. */
4006
4032
  declare function branchBlock(nodes: StoryNode[], story: string): string | null;
4007
4033
 
4008
- export { AGENT_INTEGRATIONS, AGENT_TARGET_OPTIONS, ALL_AGENT_TARGETS, type AdapterExtractResult, AdapterRegistry, type AdvanceResult, type AgentInstallPlan, AgentInstallPreflightError, type AgentIntegration, type AgentTarget, type AgentTargetOption, type AllowRoleInput, type ArtifactDef, ArtifactDefSchema, type BuildRefinePlanOptions, type CallMcpToolResult, type ChangeContext, type ChangeMeta, ChangeMetaSchema, type ChangeMetrics, ChangeMetricsSchema, type ChangePhaseOrder, type CodeContextCaps, type CodeContextGap, type CodeContextGapCode, type CodeContextRequest, type CodeContextResult, type CodeContextSummary, type CodeSlice, type Complexity, type Config, ConfigSchema, type CreateChangeInput, DEFAULT_CODE_CONTEXT_CAPS, DEFAULT_INIT_INTEGRATION, type DecideInput, type DecisionMetric, DecisionMetricSchema, type DecisionModel, type DecisionOutcome, type Duty, EMBEDDINGS_UNAVAILABLE, EMBEDDING_MODEL, type Embedder, type FastembedHooks, type FocusPlan, type Gate, GateSchema, type GatherMcpOptions, type GenerateCodeContextDeps, type GeneratedManifest, type GeneratedState, type GitHeadRunner, type GreenfieldFeature, type IndexStats, type InitOptions, type InitResult, type InstallAgentOptions, type InstallAgentResult, type InstallAgentsOptions, type InstallAgentsResult, type InstalledAgentSnapshot, type KeptFile, type KeptReason, type LanguageAdapter, type McpConfig, McpConfigSchema, type McpFetchResult, type McpInvoke, McpInvokeSchema, type McpMatchContext, type McpSource, McpSourceSchema, type McpWhen, McpWhenSchema, type MetricsImportResult, type ModelChoice, type ModelContext, type ModelEntry, type ModelsConfig, ModelsConfigSchema, PROTOCOL_MD, type PhaseMetric, PhaseMetricSchema, type PhaseTiming, type PhaseTimingRow, type PlannedWrite, type PriceCard, type Prices, type ProductTeamMember, RRF_K, type RawHit, type ReconcileGeneratedResult, type RefineArtifactRef, type RefineMode, type RefinePlan, type RemoveAgentHostsResult, type RenderChangeReportInput, type RoleCommandResult, type RoleLists, type RoleModel, type RoleProfile, type RouteDeps, type RouteHit, type RouteItem, type RunRoleInput, SDD_AGENT_ROLES, SDD_CORE_VERSION, SDD_DIR, SUMMARY_TOKEN_CAP, type SddAgentRole, type SddAgentRoleId, SddError, type SearchConfig, SearchConfigError, type SearchHit, type SearchProvider, type SearchQuery, type SearchResult, type SearchRuntime, type SearchScope, type Stage, StageSchema, type StartFeatureInput, type StartGreenfieldInput, type StartGreenfieldResult, type StoryDraft, type StoryNode, type SymbolInfo, type SymbolKind, type SyncChangeResult, type TeamConfig, TeamSchema, type TokenCounts, type TokenUsageMetric, TokenUsageMetricSchema, VerifyCommandSchema, type VerifyResult, type VerifyStatus, WORK_TYPES, type WorkType, type Workflow, WorkflowSchema, acceptNetwork, activePointerPath, activeStages, addLesson, addMcpSource, advanceStage, agentHostPaths, agentKickoffMessage, allowRole, approveGate, archiveDir, assertAgentInstallable, assertSessionLogAllowed, branchBlock, budgetForStage, buildAgentPrompt, buildContext, buildRefinePlan, buildRetrievedInner, callMcpSourceTool, canLeaveStage, changeDirName, changeMetaPath, changePath, changesDir, changesPathRel, checkModels, checkTeam, chunkCode, chunkMarkdown, classifyPath, clearActiveIf, clearRegisteredSearchProviders, compareChangesByFirstPhase, completeChange, configPath, contentHash, copyDir, copyDirSkipExisting, costFor, countTokens, createBuiltinProvider, createChange, createFastembedEmbedder, createRole, createRoleFromTemplate, decide, defaultConfig, defaultMcpConfig, defaultMcpYamlPath, defaultMemoryDir, defaultPricesYamlPath, defaultSearchYamlPath, defaultTeamsDir, defaultTemplatesDir, defaultWorkflowsDir, defaultsRoot, deleteRole, describeFsError, describeKept, displayArchivePath, displayChangePath, domainsDir, duplicateRole, dutyForStage, editRole, embedSearchQuery, emptyChangeMetrics, ensureDir, ensureMcpConfig, errorMessage, executeSearch, explainMatch, explainModel, extractiveSummary, fallbackAdapter, fallbackIncompleteStageId, fallbackWarning, fastembedImportCount, findFeaturesBacklogPath, firstActiveStageId, formatDuration, formatEpicGraph, formatJsonSummary, formatMcpContextForHandoff, formatModels, formatStatus, formatTeam, formatTokenInventory, ftsTokens, fuseByRank, fuseHits, gatherMcpContext, gatherMcpContextForChange, generateCodeContext, generatedState, getActiveChangeId, getFacts, getHeadSha, getIntegration, getStage, gitUserName, guidancePaths, handoffRole, hideRole, importSessionMetrics, incompletePriorStageErrors, indexDbPath, inferComplexity, initProject, initTeam, installAgentIntegration, installAgentIntegrations, integrationKeyFor, interpolate, interpolateArgs, isHardDenied, isIgnoredPath, isInitialized, isPrunedDir, isSddError, isSecretPath, isStageSkipped, isSubstantiveArtifactContent, isWorkType, keywordHits, listBacklogFeatures, listBundledWorkflowNames, listChanges, listDirs, listFacts, listFiles, listMatchingSourceIds, listMcpSourceTools, listRoleTemplates, listScopeHits, listTeamTemplates, listWorkflowNames, loadBrain, loadChangeMeta, loadConfig, loadEpicStories, loadExcluder, loadGeneratedManifest, loadInstalledAgent, loadMcpConfig, loadModels, loadPrices, loadProductTeam, loadSearchConfig, loadWorkflow, markGenerated, matchMcpSources, mcpConfigPath, mcpTimeoutMs, memoryDir, memoryPathRel, mergeCaps, mergeConfigDefaults, mergeRankedHits, migrateTeamMemory, missingBundledWorkflows, modelFromEnv, nextStageId, nowIso, optionForTarget, packHits, parseAgentTargets, parseFeaturesBacklog, parseIntegration, parseStoryDraft, pathExists, phaseTiming, pinRole, planAgentIntegration, planNetwork, postRoom, prepareGuide, productTeamHome, promoteGreenfieldToMemory, queueRole, rankScope, readChangeMetrics, readHandoffCodePoints, readTeamConfig, readText, readYaml, rebuildNetwork, recommendWorkflow, reconcileGeneratedTree, recordDecisionMetric, recordDecisionRequest, recordSignoff, refreshActiveAgentContext, refreshConfiguredGuidance, registerSearchProvider, removeMcpSource, removeOtherAgentHosts, removeOtherAgentHostsDetailed, removePath, renderAgentsMd, renderBlock, renderChangeReport, renderMemoryIndex, renderProductTeamSection, renderProtocolMd, renderSddReadme, renderThinAgent, repairRequiredIgnores, reportAllChanges, reportChange, resolveActiveDirectory, resolveBot, resolveChangeId, resolveEmbedder, resolveFocus, resolveSearchProvider, resolveStages, reviewRoom, roleContextBody, routeRole, rrf, runGuide, runLocalVerify, runLoop, runNetwork, runRole, saveChangeMeta, saveConfig, saveGeneratedManifest, saveMcpConfig, scopeForPath, sddRoot, searchConfigPath, searchPreamble, selectModel, setActiveChange, setFact, setRoleContext, setRoleMessaging, shouldAutoSkip, showFact, showMemory, showRoleGroup, showRoles, showRoom, showTeam, skipStage, slugify, spawnModelCommand, startFeatureFromBacklog, startGreenfield, startPhase, storyIdTaken, switchWorkflow, syncChangeHead, takeRole, templatesDir, toProcessEnv, todayIsoDate, tokenizeKeywords, transitionPhase, typescriptAdapter, uniqueChangeDirName, updateFeatureStatus, validBranchName, withMcpSource, workKind, workflowUnavailableMessage, workflowsDir, writeAgentHandoff, writeRefineBrief, writeText, writeTextIfMissing, writeYaml };
4034
+ export { AGENT_INTEGRATIONS, AGENT_TARGET_OPTIONS, ALL_AGENT_TARGETS, type AdapterExtractResult, AdapterRegistry, type AdvanceResult, type AgentInstallPlan, AgentInstallPreflightError, type AgentIntegration, type AgentTarget, type AgentTargetOption, type AllowRoleInput, type ArtifactDef, ArtifactDefSchema, type BuildRefinePlanOptions, type CallMcpToolResult, type ChangeContext, type ChangeMeta, ChangeMetaSchema, type ChangeMetrics, ChangeMetricsSchema, type ChangePhaseOrder, type CodeContextCaps, type CodeContextGap, type CodeContextGapCode, type CodeContextRequest, type CodeContextResult, type CodeContextSummary, type CodeSlice, type Complexity, type Config, ConfigSchema, type CreateChangeInput, DEFAULT_CODE_CONTEXT_CAPS, DEFAULT_INIT_INTEGRATION, type DecideInput, type DecisionMetric, DecisionMetricSchema, type DecisionModel, type DecisionOutcome, type Duty, EMBEDDINGS_UNAVAILABLE, EMBEDDING_MODEL, type Embedder, type FastembedHooks, type FocusPlan, type Gate, GateSchema, type GatherMcpOptions, type GenerateCodeContextDeps, type GeneratedManifest, type GeneratedState, type GitHeadRunner, type GreenfieldFeature, type IndexStats, type InitOptions, type InitResult, type InstallAgentOptions, type InstallAgentResult, type InstallAgentsOptions, type InstallAgentsResult, type InstalledAgentSnapshot, type KeptFile, type KeptReason, type LanguageAdapter, type McpConfig, McpConfigSchema, type McpFetchResult, type McpInvoke, McpInvokeSchema, type McpMatchContext, type McpSource, McpSourceSchema, type McpWhen, McpWhenSchema, type MetricsImportResult, type ModelChoice, type ModelContext, type ModelEntry, type ModelsConfig, ModelsConfigSchema, PROTOCOL_MD, type PhaseMetric, PhaseMetricSchema, type PhaseTiming, type PhaseTimingRow, type PlannedWrite, type PriceCard, type Prices, type ProductTeamMember, RRF_K, type RawHit, type ReconcileGeneratedResult, type RefineArtifactRef, type RefineMode, type RefinePlan, type RemoveAgentHostsResult, type RenderChangeReportInput, type RoleCommandResult, type RoleLists, type RoleModel, type RoleProfile, type RouteDeps, type RouteHit, type RouteItem, type RunRoleInput, SDD_AGENT_ROLES, SDD_CORE_VERSION, SDD_DIR, SETUP_STEP_IDS, SETUP_WHY, SUMMARY_TOKEN_CAP, type SddAgentRole, type SddAgentRoleId, SddError, type SearchConfig, SearchConfigError, type SearchHit, type SearchProvider, type SearchQuery, type SearchResult, type SearchRuntime, type SearchScope, type SetupModelState, type SetupRolesChoice, type SetupStatus, type SetupStepId, type SetupStepInput, type Stage, StageSchema, type StartFeatureInput, type StartGreenfieldInput, type StartGreenfieldResult, type StoryDraft, type StoryNode, type SymbolInfo, type SymbolKind, type SyncChangeResult, type TeamConfig, TeamSchema, type TokenCounts, type TokenUsageMetric, TokenUsageMetricSchema, VerifyCommandSchema, type VerifyResult, type VerifyStatus, WORK_TYPES, type WorkType, type Workflow, WorkflowSchema, acceptNetwork, activePointerPath, activeStages, addLesson, addMcpSource, advanceStage, agentHostPaths, agentKickoffMessage, allowRole, approveGate, archiveDir, assertAgentInstallable, assertSessionLogAllowed, branchBlock, budgetForStage, buildAgentPrompt, buildContext, buildRefinePlan, buildRetrievedInner, callMcpSourceTool, canLeaveStage, changeDirName, changeMetaPath, changePath, changesDir, changesPathRel, checkModels, checkTeam, chunkCode, chunkMarkdown, classifyPath, clearActiveIf, clearRegisteredSearchProviders, compareChangesByFirstPhase, completeChange, configPath, contentHash, copyDir, copyDirSkipExisting, costFor, countTokens, createBuiltinProvider, createChange, createFastembedEmbedder, createRole, createRoleFromTemplate, decide, defaultConfig, defaultMcpConfig, defaultMcpYamlPath, defaultMemoryDir, defaultPricesYamlPath, defaultSearchYamlPath, defaultTeamsDir, defaultTemplatesDir, defaultWorkflowsDir, defaultsRoot, deleteRole, describeFsError, describeKept, displayArchivePath, displayChangePath, domainsDir, duplicateRole, dutyForStage, editRole, embedSearchQuery, emptyChangeMetrics, ensureDir, ensureMcpConfig, errorMessage, executeSearch, explainMatch, explainModel, extractiveSummary, fallbackAdapter, fallbackIncompleteStageId, fallbackWarning, fastembedImportCount, findFeaturesBacklogPath, firstActiveStageId, formatDuration, formatEpicGraph, formatJsonSummary, formatMcpContextForHandoff, formatModels, formatSetupStatus, formatStatus, formatTeam, formatTokenInventory, ftsTokens, fuseByRank, fuseHits, gatherMcpContext, gatherMcpContextForChange, generateCodeContext, generatedState, getActiveChangeId, getFacts, getHeadSha, getIntegration, getStage, gitUserName, guidancePaths, handoffRole, hideRole, importSessionMetrics, incompletePriorStageErrors, indexDbPath, inferComplexity, initProject, initTeam, installAgentIntegration, installAgentIntegrations, integrationKeyFor, interpolate, interpolateArgs, isHardDenied, isIgnoredPath, isInitialized, isPrunedDir, isSddError, isSecretPath, isStageSkipped, isSubstantiveArtifactContent, isWorkType, keywordHits, listBacklogFeatures, listBundledWorkflowNames, listChanges, listDirs, listFacts, listFiles, listMatchingSourceIds, listMcpSourceTools, listRoleTemplates, listScopeHits, listTeamTemplates, listWorkflowNames, loadBrain, loadChangeMeta, loadConfig, loadEpicStories, loadExcluder, loadGeneratedManifest, loadInstalledAgent, loadMcpConfig, loadModels, loadPrices, loadProductTeam, loadSearchConfig, loadWorkflow, markGenerated, matchMcpSources, mcpConfigPath, mcpTimeoutMs, memoryDir, memoryPathRel, mergeCaps, mergeConfigDefaults, mergeRankedHits, migrateTeamMemory, missingBundledWorkflows, modelFromEnv, nextStageId, nowIso, optionForTarget, packHits, parseAgentTargets, parseFeaturesBacklog, parseIntegration, parseSetupStep, parseStoryDraft, pathExists, phaseTiming, pinRole, planAgentIntegration, planNetwork, postRoom, prepareGuide, productTeamHome, promoteGreenfieldToMemory, queueRole, rankScope, readChangeMetrics, readHandoffCodePoints, readSetupStatus, readTeamConfig, readText, readYaml, rebuildNetwork, recommendWorkflow, reconcileGeneratedTree, recordDecisionMetric, recordDecisionRequest, recordSignoff, refreshActiveAgentContext, refreshConfiguredGuidance, registerSearchProvider, removeMcpSource, removeOtherAgentHosts, removeOtherAgentHostsDetailed, removePath, renderAgentsMd, renderBlock, renderChangeReport, renderMemoryIndex, renderProductTeamSection, renderProtocolMd, renderSddReadme, renderThinAgent, repairRequiredIgnores, reportAllChanges, reportChange, resolveActiveDirectory, resolveBot, resolveChangeId, resolveEmbedder, resolveFocus, resolveSearchProvider, resolveStages, reviewRoom, roleContextBody, routeRole, rrf, runGuide, runLocalVerify, runLoop, runNetwork, runRole, runSetupStep, saveChangeMeta, saveConfig, saveGeneratedManifest, saveMcpConfig, scopeForPath, sddRoot, searchConfigPath, searchPreamble, selectModel, setActiveChange, setFact, setRoleContext, setRoleMessaging, shouldAutoSkip, showFact, showMemory, showRoleGroup, showRoles, showRoom, showTeam, skipStage, slugify, spawnModelCommand, startFeatureFromBacklog, startGreenfield, startPhase, storyIdTaken, switchWorkflow, syncChangeHead, takeRole, templatesDir, toProcessEnv, todayIsoDate, tokenizeKeywords, transitionPhase, typescriptAdapter, uniqueChangeDirName, updateFeatureStatus, validBranchName, withMcpSource, workKind, workflowUnavailableMessage, workflowsDir, writeAgentHandoff, writeRefineBrief, writeText, writeTextIfMissing, writeYaml };
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  mcpTimeoutMs,
12
12
  toProcessEnv,
13
13
  withMcpSource
14
- } from "./chunk-EDXT3RTN.js";
14
+ } from "./chunk-ICRQOQWE.js";
15
15
  import {
16
16
  McpConfigSchema,
17
17
  McpInvokeSchema,
@@ -68,7 +68,7 @@ import {
68
68
  renderThinAgent,
69
69
  saveGeneratedManifest,
70
70
  writeAgentHandoff
71
- } from "./chunk-O4OQWVC7.js";
71
+ } from "./chunk-5GLH6ZWU.js";
72
72
  import {
73
73
  ChangeMetricsSchema,
74
74
  DecisionMetricSchema,
@@ -100,7 +100,7 @@ import {
100
100
  switchWorkflow,
101
101
  transitionPhase,
102
102
  updateFeatureStatus
103
- } from "./chunk-NY5FFWXG.js";
103
+ } from "./chunk-Z2ULYVHO.js";
104
104
  import {
105
105
  EMBEDDINGS_UNAVAILABLE,
106
106
  EMBEDDING_MODEL,
@@ -190,7 +190,7 @@ import {
190
190
  showTeam,
191
191
  workKind,
192
192
  writePackedCache
193
- } from "./chunk-HUSXETPS.js";
193
+ } from "./chunk-AERAWOAK.js";
194
194
  import {
195
195
  ArtifactDefSchema,
196
196
  ChangeMetaSchema,
@@ -1395,7 +1395,7 @@ ${output}`);
1395
1395
  status = failed.length ? "fail" : "pass";
1396
1396
  reason = failed.length ? `failed: ${failed.join(", ")}` : void 0;
1397
1397
  }
1398
- const ok10 = status === "pass";
1398
+ const ok11 = status === "pass";
1399
1399
  const checklist = stage.gate?.checklist ?? [];
1400
1400
  const lines = buildSummaryLines(
1401
1401
  ctx.meta.title,
@@ -1446,7 +1446,7 @@ ${output}`);
1446
1446
  ctx.meta.verify_results = {
1447
1447
  ...ctx.meta.verify_results,
1448
1448
  [stage.id]: {
1449
- ok: ok10,
1449
+ ok: ok11,
1450
1450
  status,
1451
1451
  ...results.length && headSha2 ? { head_sha: headSha2 } : {},
1452
1452
  at: nowIso(),
@@ -1462,7 +1462,7 @@ ${output}`);
1462
1462
  checklist,
1463
1463
  evidencePath: evidenceDir,
1464
1464
  resultsPath: summaryPath,
1465
- ok: ok10
1465
+ ok: ok11
1466
1466
  };
1467
1467
  }
1468
1468
 
@@ -1875,10 +1875,10 @@ function formatMarkdown(input) {
1875
1875
  `;
1876
1876
  return { markdown: packed ? frame + packed : frame, truncated: input.summary.truncated };
1877
1877
  }
1878
- function formatJsonSummary(summary, gaps, slices, ok10) {
1878
+ function formatJsonSummary(summary, gaps, slices, ok11) {
1879
1879
  return JSON.stringify(
1880
1880
  {
1881
- ok: ok10,
1881
+ ok: ok11,
1882
1882
  summary,
1883
1883
  gaps,
1884
1884
  slices: slices.map((s) => ({
@@ -3608,8 +3608,8 @@ function asRecord(value) {
3608
3608
  if (!value || typeof value !== "object" || Array.isArray(value)) return {};
3609
3609
  return value;
3610
3610
  }
3611
- function result(name, ok10, text2) {
3612
- return { ok: ok10, name, text: clip(text2) };
3611
+ function result(name, ok11, text2) {
3612
+ return { ok: ok11, name, text: clip(text2) };
3613
3613
  }
3614
3614
  async function git(cwd, args) {
3615
3615
  return new Promise((resolve) => {
@@ -6511,6 +6511,130 @@ async function runGuide(root, input = {}) {
6511
6511
  return fail9("The guide stopped after 16 steps.");
6512
6512
  }
6513
6513
 
6514
+ // src/role/setup-tour.ts
6515
+ import { join as join19 } from "pathe";
6516
+ var SETUP_STEP_IDS = [
6517
+ "folder",
6518
+ "workflow",
6519
+ "host",
6520
+ "roles",
6521
+ "model",
6522
+ "check",
6523
+ "start"
6524
+ ];
6525
+ var SETUP_WHY = {
6526
+ folder: "sdd reads .sdd/config.yaml first.",
6527
+ workflow: "Stage lists on new role files come from this workflow.",
6528
+ host: "A host is optional. Drafts use a role model, not the host.",
6529
+ roles: "These files say who drafts each stage. Existing files stay.",
6530
+ model: "A draft needs SDD_ROLE_MODEL. Setup does not write that command into the repo.",
6531
+ check: "This is what is already in place.",
6532
+ start: "The first change is optional. sdd go asks the role for that stage."
6533
+ };
6534
+ function ok10(stdout) {
6535
+ return { exitCode: 0, stdout };
6536
+ }
6537
+ function fail10(stdout) {
6538
+ return { exitCode: 1, stdout };
6539
+ }
6540
+ function parseSetupStep(raw) {
6541
+ const id = raw.trim();
6542
+ return SETUP_STEP_IDS.includes(id) ? id : null;
6543
+ }
6544
+ function formatSetupStatus(status) {
6545
+ const folder = status.folder ? "Folder: ready." : "Folder: not set up.";
6546
+ const host = status.host ? `Host: ${status.host}.` : "Host: none.";
6547
+ const roles = status.roles.length > 0 ? `Roles: ${status.roles.join(", ")}.` : "Roles: none.";
6548
+ const model = status.model === "configured" ? "Model: configured." : status.model === "missing" ? "Model: No role model is configured." : `Model: ${status.model.error}`;
6549
+ return [folder, host, roles, model].join("\n");
6550
+ }
6551
+ async function roleNames(root) {
6552
+ const names = await listFiles(join19(root, ".sdd", "roles"));
6553
+ return names.filter((name) => name.endsWith(".md")).map((name) => name.slice(0, -".md".length)).sort((left, right) => left.localeCompare(right));
6554
+ }
6555
+ async function modelState(root, env) {
6556
+ if (modelFromEnv(env)) return "configured";
6557
+ const loaded = await loadModels(root);
6558
+ if (loaded === null) return "missing";
6559
+ if ("error" in loaded) return { error: loaded.error };
6560
+ return "configured";
6561
+ }
6562
+ async function readSetupStatus(root, env = process.env) {
6563
+ const installed = await loadInstalledAgent(root);
6564
+ return {
6565
+ folder: await isInitialized(root),
6566
+ host: installed?.ai ?? null,
6567
+ roles: await roleNames(root),
6568
+ model: await modelState(root, env)
6569
+ };
6570
+ }
6571
+ function withRoleHints(result2) {
6572
+ if (result2.exitCode !== 0) return result2;
6573
+ const hints = [
6574
+ "Add stages with sdd role edit <name> --stages ...",
6575
+ 'Add context with sdd role context <name> --text "..."'
6576
+ ];
6577
+ const body = result2.stdout.trim();
6578
+ return ok10(body.length > 0 ? `${body}
6579
+ ${hints.join("\n")}` : hints.join("\n"));
6580
+ }
6581
+ function messageOf(error) {
6582
+ return error instanceof Error ? error.message : String(error);
6583
+ }
6584
+ async function runSetupStep(root, input, env = process.env) {
6585
+ const workflow = input.workflow?.trim() || "feature";
6586
+ try {
6587
+ if (input.step === "folder") {
6588
+ if (!await isInitialized(root)) {
6589
+ await initProject({ projectRoot: root, agents: false });
6590
+ }
6591
+ return ok10("Folder: ready.");
6592
+ }
6593
+ if (input.step === "workflow") {
6594
+ const lines = [`Workflow: ${workflow}.`];
6595
+ if ((await roleNames(root)).length > 0) lines.push("Roles are already here.");
6596
+ return ok10(lines.join("\n"));
6597
+ }
6598
+ if (input.step === "host") {
6599
+ const installed = await loadInstalledAgent(root);
6600
+ if (installed) return ok10(`Host: ${installed.ai}.`);
6601
+ if (!input.host) return ok10("Host: none.");
6602
+ if (!await isInitialized(root)) {
6603
+ await initProject({ projectRoot: root, agents: input.host });
6604
+ } else {
6605
+ await installAgentIntegration({ projectRoot: root, target: input.host });
6606
+ }
6607
+ const after = await loadInstalledAgent(root);
6608
+ return ok10(`Host: ${after?.ai ?? input.host}.`);
6609
+ }
6610
+ if (input.step === "roles") {
6611
+ const choice = input.roles ?? "duties";
6612
+ if (choice === "keep") {
6613
+ const names = await roleNames(root);
6614
+ const line = names.length > 0 ? "Roles are already here." : "Roles: none.";
6615
+ return withRoleHints(ok10(line));
6616
+ }
6617
+ if (choice === "software") {
6618
+ return withRoleHints(await initTeam(root, "software", gitUserName(root)));
6619
+ }
6620
+ return withRoleHints(await prepareGuide(root, { workflow, agents: false }));
6621
+ }
6622
+ if (input.step === "model") {
6623
+ const state = await modelState(root, env);
6624
+ if (state === "configured") return ok10("Model: configured.");
6625
+ if (typeof state === "object") return fail10(state.error);
6626
+ if (input.requireModel) return fail10("No role model is configured.");
6627
+ return ok10("No role model is configured.");
6628
+ }
6629
+ if (input.step === "check") {
6630
+ return ok10(formatSetupStatus(await readSetupStatus(root, env)));
6631
+ }
6632
+ return ok10('Next: sdd go "what you want to build"');
6633
+ } catch (error) {
6634
+ return fail10(messageOf(error));
6635
+ }
6636
+ }
6637
+
6514
6638
  // src/role/models/show.ts
6515
6639
  function formatModelChoice(workType, choice) {
6516
6640
  return `${workType} ${choice.id} ${choice.kind} ${choice.provider} ${choice.why}`;
@@ -6549,7 +6673,7 @@ function explainModel(config, workType, ctx) {
6549
6673
  }
6550
6674
 
6551
6675
  // src/stories.ts
6552
- import { join as join19 } from "pathe";
6676
+ import { join as join20 } from "pathe";
6553
6677
  var STORY_ID = /^S-\d+$/i;
6554
6678
  var EPIC_KEY = /^[A-Za-z0-9][A-Za-z0-9-]{0,39}$/;
6555
6679
  function validBranchName(name) {
@@ -6591,7 +6715,7 @@ function parseStoryDraft(input) {
6591
6715
  async function metasIn(dir) {
6592
6716
  const out = [];
6593
6717
  for (const id of await listDirs(dir)) {
6594
- const path = join19(dir, id, "meta.yaml");
6718
+ const path = join20(dir, id, "meta.yaml");
6595
6719
  if (!await pathExists(path)) continue;
6596
6720
  try {
6597
6721
  out.push(ChangeMetaSchema.parse(await readYaml(path)));
@@ -6739,6 +6863,8 @@ export {
6739
6863
  SDD_AGENT_ROLES,
6740
6864
  SDD_CORE_VERSION,
6741
6865
  SDD_DIR,
6866
+ SETUP_STEP_IDS,
6867
+ SETUP_WHY,
6742
6868
  SUMMARY_TOKEN_CAP,
6743
6869
  SddError,
6744
6870
  SearchConfigError,
@@ -6834,6 +6960,7 @@ export {
6834
6960
  formatJsonSummary,
6835
6961
  formatMcpContextForHandoff,
6836
6962
  formatModels,
6963
+ formatSetupStatus,
6837
6964
  formatStatus,
6838
6965
  formatTeam,
6839
6966
  formatTokenInventory,
@@ -6918,6 +7045,7 @@ export {
6918
7045
  parseAgentTargets,
6919
7046
  parseFeaturesBacklog,
6920
7047
  parseIntegration,
7048
+ parseSetupStep,
6921
7049
  parseStoryDraft,
6922
7050
  pathExists,
6923
7051
  phaseTiming,
@@ -6932,6 +7060,7 @@ export {
6932
7060
  rankScope,
6933
7061
  readChangeMetrics,
6934
7062
  readHandoffCodePoints,
7063
+ readSetupStatus,
6935
7064
  readTeamConfig,
6936
7065
  readText,
6937
7066
  readYaml,
@@ -6975,6 +7104,7 @@ export {
6975
7104
  runLoop,
6976
7105
  runNetwork,
6977
7106
  runRole,
7107
+ runSetupStep,
6978
7108
  saveChangeMeta,
6979
7109
  saveConfig,
6980
7110
  saveGeneratedManifest,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@structured-vibe-coding/core",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "Core engine for sdd — Spec-Driven Development workflows, change packs, greenfield, and AI agent handoff (used by the sdd CLI)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",