@structured-vibe-coding/core 0.6.1 → 0.6.2

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.
@@ -5,6 +5,7 @@ import {
5
5
  DEFAULT_INIT_INTEGRATION,
6
6
  PROTOCOL_MD,
7
7
  SDD_AGENT_ROLES,
8
+ agentHostPaths,
8
9
  getIntegration,
9
10
  installAgentIntegration,
10
11
  installAgentIntegrations,
@@ -13,8 +14,9 @@ import {
13
14
  parseAgentTargets,
14
15
  parseIntegration,
15
16
  refreshActiveAgentContext,
17
+ removeOtherAgentHosts,
16
18
  renderThinAgent
17
- } from "./chunk-QTHYRKMK.js";
19
+ } from "./chunk-74AHVIH4.js";
18
20
  export {
19
21
  AGENT_INTEGRATIONS,
20
22
  AGENT_TARGET_OPTIONS,
@@ -22,6 +24,7 @@ export {
22
24
  DEFAULT_INIT_INTEGRATION,
23
25
  PROTOCOL_MD,
24
26
  SDD_AGENT_ROLES,
27
+ agentHostPaths,
25
28
  getIntegration,
26
29
  installAgentIntegration,
27
30
  installAgentIntegrations,
@@ -30,5 +33,6 @@ export {
30
33
  parseAgentTargets,
31
34
  parseIntegration,
32
35
  refreshActiveAgentContext,
36
+ removeOtherAgentHosts,
33
37
  renderThinAgent
34
38
  };
@@ -686,6 +686,54 @@ function integrationKeyFor(target) {
686
686
  function optionForTarget(target) {
687
687
  return getIntegration(target);
688
688
  }
689
+ function agentHostPaths(target) {
690
+ switch (target) {
691
+ case "copilot":
692
+ return [".github/agents"];
693
+ case "claude-code":
694
+ return [".claude/agents"];
695
+ case "grok":
696
+ return [".grok/rules"];
697
+ default:
698
+ return [];
699
+ }
700
+ }
701
+ var LEGACY_AGENT_PATHS = [".idea/sdd-agent-notes.md"];
702
+ async function removeOtherAgentHosts(projectRoot, keep) {
703
+ const removed = [];
704
+ for (const integ of AGENT_INTEGRATIONS) {
705
+ if (integ.id === keep) continue;
706
+ for (const rel of agentHostPaths(integ.id)) {
707
+ const full = join4(projectRoot, rel);
708
+ if (await pathExists(full)) {
709
+ await removePath(full);
710
+ removed.push(rel);
711
+ }
712
+ }
713
+ }
714
+ for (const rel of LEGACY_AGENT_PATHS) {
715
+ const full = join4(projectRoot, rel);
716
+ if (await pathExists(full)) {
717
+ await removePath(full);
718
+ removed.push(rel);
719
+ }
720
+ }
721
+ for (const parent of [".claude", ".idea", ".grok"]) {
722
+ if (keep === "grok" && parent === ".grok") continue;
723
+ const full = join4(projectRoot, parent);
724
+ if (!await pathExists(full)) continue;
725
+ try {
726
+ const { readdir } = await import("fs/promises");
727
+ const kids = await readdir(full);
728
+ if (kids.length === 0) {
729
+ await removePath(full);
730
+ removed.push(parent);
731
+ }
732
+ } catch {
733
+ }
734
+ }
735
+ return removed;
736
+ }
689
737
  function parseIntegration(raw) {
690
738
  const p = raw.trim().toLowerCase();
691
739
  if (!p) {
@@ -764,6 +812,7 @@ async function installAgentIntegration(opts) {
764
812
  const skipped = [];
765
813
  const root = opts.projectRoot;
766
814
  const force = opts.force ?? false;
815
+ await removeOtherAgentHosts(root, opts.target);
767
816
  const write = async (rel, content) => {
768
817
  const full = join4(root, rel);
769
818
  if (await pathExists(full) && !force) {
@@ -1034,6 +1083,8 @@ export {
1034
1083
  getIntegration,
1035
1084
  integrationKeyFor,
1036
1085
  optionForTarget,
1086
+ agentHostPaths,
1087
+ removeOtherAgentHosts,
1037
1088
  parseIntegration,
1038
1089
  parseAgentTargets,
1039
1090
  SDD_AGENT_ROLES,
package/dist/index.d.ts CHANGED
@@ -1197,6 +1197,16 @@ declare const AGENT_TARGET_OPTIONS: AgentTargetOption[];
1197
1197
  declare function getIntegration(target: AgentTarget): AgentIntegration;
1198
1198
  declare function integrationKeyFor(target: AgentTarget): string;
1199
1199
  declare function optionForTarget(target: AgentTarget): AgentTargetOption;
1200
+ /**
1201
+ * Paths this integration owns (safe to delete when switching agents).
1202
+ * Never includes shared SDD dirs (memory, changes, .sdd) or whole .github (workflows stay).
1203
+ */
1204
+ declare function agentHostPaths(target: AgentTarget): string[];
1205
+ /**
1206
+ * Remove agent files for hosts other than `keep` (and legacy IntelliJ notes).
1207
+ * Does not touch .sdd/, memory/, changes/, or non-agent .github content.
1208
+ */
1209
+ declare function removeOtherAgentHosts(projectRoot: string, keep: AgentTarget): Promise<string[]>;
1200
1210
  /** Parse one Speckit-style integration key. */
1201
1211
  declare function parseIntegration(raw: string): AgentTarget;
1202
1212
  /**
@@ -1319,4 +1329,4 @@ declare function listFiles(path: string): Promise<string[]>;
1319
1329
  declare function copyDir(src: string, dest: string): Promise<void>;
1320
1330
  declare function removePath(path: string): Promise<void>;
1321
1331
 
1322
- export { AGENT_INTEGRATIONS, AGENT_TARGET_OPTIONS, ALL_AGENT_TARGETS, type AdvanceResult, type AgentIntegration, type AgentTarget, type AgentTargetOption, type ArtifactDef, ArtifactDefSchema, type ChangeContext, type ChangeMeta, ChangeMetaSchema, type Complexity, type Config, ConfigSchema, type CreateChangeInput, DEFAULT_INIT_INTEGRATION, type Gate, GateSchema, type InitOptions, type InitResult, type InstallAgentOptions, type InstallAgentResult, type InstallAgentsOptions, type InstallAgentsResult, PROTOCOL_MD, SDD_AGENT_ROLES, SDD_DIR, type SddAgentRole, type SddAgentRoleId, type Stage, StageSchema, VerifyCommandSchema, type VerifyResult, type Workflow, WorkflowSchema, activePointerPath, activeStages, advanceStage, approveGate, archiveDir, buildAgentPrompt, buildContext, canLeaveStage, changeDirName, changeMetaPath, changePath, changesDir, clearActiveIf, completeChange, configPath, copyDir, createChange, defaultConfig, defaultMemoryDir, defaultTemplatesDir, defaultWorkflowsDir, defaultsRoot, domainsDir, ensureDir, firstActiveStageId, formatStatus, getActiveChangeId, getIntegration, getStage, inferComplexity, initProject, installAgentIntegration, installAgentIntegrations, integrationKeyFor, isInitialized, isStageSkipped, listChanges, listDirs, listFiles, listWorkflowNames, loadChangeMeta, loadConfig, loadWorkflow, memoryDir, nextStageId, nowIso, optionForTarget, parseAgentTargets, parseIntegration, pathExists, readText, readYaml, recommendWorkflow, refreshActiveAgentContext, removePath, renderThinAgent, resolveChangeId, resolveStages, runLocalVerify, saveChangeMeta, saveConfig, sddRoot, setActiveChange, shouldAutoSkip, skipStage, slugify, switchWorkflow, templatesDir, todayIsoDate, uniqueChangeDirName, workflowsDir, writeText, writeYaml };
1332
+ export { AGENT_INTEGRATIONS, AGENT_TARGET_OPTIONS, ALL_AGENT_TARGETS, type AdvanceResult, type AgentIntegration, type AgentTarget, type AgentTargetOption, type ArtifactDef, ArtifactDefSchema, type ChangeContext, type ChangeMeta, ChangeMetaSchema, type Complexity, type Config, ConfigSchema, type CreateChangeInput, DEFAULT_INIT_INTEGRATION, type Gate, GateSchema, type InitOptions, type InitResult, type InstallAgentOptions, type InstallAgentResult, type InstallAgentsOptions, type InstallAgentsResult, PROTOCOL_MD, SDD_AGENT_ROLES, SDD_DIR, type SddAgentRole, type SddAgentRoleId, type Stage, StageSchema, VerifyCommandSchema, type VerifyResult, type Workflow, WorkflowSchema, activePointerPath, activeStages, advanceStage, agentHostPaths, approveGate, archiveDir, buildAgentPrompt, buildContext, canLeaveStage, changeDirName, changeMetaPath, changePath, changesDir, clearActiveIf, completeChange, configPath, copyDir, createChange, defaultConfig, defaultMemoryDir, defaultTemplatesDir, defaultWorkflowsDir, defaultsRoot, domainsDir, ensureDir, firstActiveStageId, formatStatus, getActiveChangeId, getIntegration, getStage, inferComplexity, initProject, installAgentIntegration, installAgentIntegrations, integrationKeyFor, isInitialized, isStageSkipped, listChanges, listDirs, listFiles, listWorkflowNames, loadChangeMeta, loadConfig, loadWorkflow, memoryDir, nextStageId, nowIso, optionForTarget, parseAgentTargets, parseIntegration, pathExists, readText, readYaml, recommendWorkflow, refreshActiveAgentContext, removeOtherAgentHosts, removePath, renderThinAgent, resolveChangeId, resolveStages, runLocalVerify, saveChangeMeta, saveConfig, sddRoot, setActiveChange, shouldAutoSkip, skipStage, slugify, switchWorkflow, templatesDir, todayIsoDate, uniqueChangeDirName, workflowsDir, writeText, writeYaml };
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ import {
15
15
  WorkflowSchema,
16
16
  activePointerPath,
17
17
  activeStages,
18
+ agentHostPaths,
18
19
  archiveDir,
19
20
  buildAgentPrompt,
20
21
  buildContext,
@@ -57,6 +58,7 @@ import {
57
58
  readYaml,
58
59
  recommendWorkflow,
59
60
  refreshActiveAgentContext,
61
+ removeOtherAgentHosts,
60
62
  removePath,
61
63
  renderThinAgent,
62
64
  resolveChangeId,
@@ -73,7 +75,7 @@ import {
73
75
  workflowsDir,
74
76
  writeText,
75
77
  writeYaml
76
- } from "./chunk-QTHYRKMK.js";
78
+ } from "./chunk-74AHVIH4.js";
77
79
 
78
80
  // src/change.ts
79
81
  import { join as join2 } from "pathe";
@@ -185,7 +187,7 @@ async function createChange(input) {
185
187
  await materializeStageArtifacts(projectRoot, config, id, workflow, meta, firstStage);
186
188
  await setActiveChange(projectRoot, config, id);
187
189
  try {
188
- const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-O5ABMQJQ.js");
190
+ const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-TYGI6EX3.js");
189
191
  await refreshActiveAgentContext2(projectRoot);
190
192
  } catch {
191
193
  }
@@ -281,7 +283,7 @@ async function advanceStage(projectRoot, config, changeId, opts) {
281
283
  stage
282
284
  );
283
285
  try {
284
- const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-O5ABMQJQ.js");
286
+ const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-TYGI6EX3.js");
285
287
  await refreshActiveAgentContext2(projectRoot);
286
288
  } catch {
287
289
  }
@@ -708,6 +710,7 @@ export {
708
710
  activePointerPath,
709
711
  activeStages,
710
712
  advanceStage,
713
+ agentHostPaths,
711
714
  approveGate,
712
715
  archiveDir,
713
716
  buildAgentPrompt,
@@ -759,6 +762,7 @@ export {
759
762
  readYaml,
760
763
  recommendWorkflow,
761
764
  refreshActiveAgentContext,
765
+ removeOtherAgentHosts,
762
766
  removePath,
763
767
  renderThinAgent,
764
768
  resolveChangeId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@structured-vibe-coding/core",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Core engine for structured vibe coding (local-first Spec-Driven Development)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",