devworkspace 0.5.0 → 0.5.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.
Files changed (384) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +57 -509
  3. package/dist/agents/claude/adapter.js +0 -1
  4. package/dist/agents/claude/content.js +0 -1
  5. package/dist/agents/codex/adapter.js +0 -1
  6. package/dist/agents/copilot/adapter.js +0 -1
  7. package/dist/agents/cursor/adapter.js +0 -1
  8. package/dist/agents/index.js +0 -1
  9. package/dist/agents/shared.js +0 -1
  10. package/dist/agents/types.js +0 -1
  11. package/dist/cli/args.d.ts +16 -0
  12. package/dist/cli/args.js +5 -1
  13. package/dist/cli/help.js +59 -17
  14. package/dist/cli/main.js +0 -1
  15. package/dist/cli/prompt.d.ts +15 -0
  16. package/dist/cli/prompt.js +113 -0
  17. package/dist/cli/render.d.ts +10 -0
  18. package/dist/cli/render.js +174 -4
  19. package/dist/cli/run.d.ts +3 -0
  20. package/dist/cli/run.js +366 -17
  21. package/dist/config/feature-gate.d.ts +15 -0
  22. package/dist/config/feature-gate.js +77 -0
  23. package/dist/config/feature-registry.d.ts +49 -0
  24. package/dist/config/feature-registry.js +451 -0
  25. package/dist/config/schemas.js +0 -1
  26. package/dist/config/settings.d.ts +54 -0
  27. package/dist/config/settings.js +293 -0
  28. package/dist/config/validate.js +0 -1
  29. package/dist/core/artifacts.js +0 -1
  30. package/dist/core/contracts.js +0 -1
  31. package/dist/core/migrations.js +0 -1
  32. package/dist/core/version.js +0 -1
  33. package/dist/core/versioned.js +0 -1
  34. package/dist/core/workspace.d.ts +1 -0
  35. package/dist/core/workspace.js +1 -1
  36. package/dist/decisions/decision.js +0 -1
  37. package/dist/discovery/cache.js +0 -1
  38. package/dist/discovery/commands.js +0 -1
  39. package/dist/discovery/detect.js +0 -1
  40. package/dist/discovery/docs.js +0 -1
  41. package/dist/discovery/entrypoints.js +0 -1
  42. package/dist/discovery/ignore.js +0 -1
  43. package/dist/discovery/scan.js +0 -1
  44. package/dist/discovery/types.js +0 -1
  45. package/dist/dx/dashboard.js +2 -1
  46. package/dist/dx/guidance.js +0 -1
  47. package/dist/dx/guided-setup.d.ts +102 -0
  48. package/dist/dx/guided-setup.js +508 -0
  49. package/dist/dx/index.js +0 -1
  50. package/dist/dx/onboarding.js +0 -1
  51. package/dist/dx/types.js +0 -1
  52. package/dist/errors/index.js +0 -1
  53. package/dist/features/schema.js +0 -1
  54. package/dist/features/types.js +0 -1
  55. package/dist/features/validate.js +0 -1
  56. package/dist/git/git.js +0 -1
  57. package/dist/index.d.ts +15 -5
  58. package/dist/index.js +10 -2
  59. package/dist/integrations/adapters/agent-skills.js +0 -1
  60. package/dist/integrations/adapters/claudePlugin.js +0 -1
  61. package/dist/integrations/adapters/graphify.js +0 -1
  62. package/dist/integrations/adapters/omniroute.js +0 -1
  63. package/dist/integrations/adapters/pluginSkill.js +0 -1
  64. package/dist/integrations/adapters/ponytail.js +0 -1
  65. package/dist/integrations/exec.js +0 -1
  66. package/dist/integrations/index.js +0 -1
  67. package/dist/integrations/manager.d.ts +2 -1
  68. package/dist/integrations/manager.js +22 -3
  69. package/dist/integrations/notices.js +0 -1
  70. package/dist/integrations/persistentPath.js +0 -1
  71. package/dist/integrations/protect.js +0 -1
  72. package/dist/integrations/state.js +0 -1
  73. package/dist/integrations/types.d.ts +1 -1
  74. package/dist/integrations/types.js +1 -1
  75. package/dist/intelligence/agents/profiles.js +0 -1
  76. package/dist/intelligence/agents/registry.js +0 -1
  77. package/dist/intelligence/agents/types.js +0 -1
  78. package/dist/intelligence/observability/tracer.js +0 -1
  79. package/dist/intelligence/observability/types.js +0 -1
  80. package/dist/intelligence/orchestration/engine.d.ts +21 -3
  81. package/dist/intelligence/orchestration/engine.js +486 -48
  82. package/dist/intelligence/orchestration/lock-manager.js +0 -1
  83. package/dist/intelligence/orchestration/store.js +0 -1
  84. package/dist/intelligence/orchestration/types.d.ts +40 -2
  85. package/dist/intelligence/orchestration/types.js +2 -3
  86. package/dist/intelligence/routing/matcher.js +0 -1
  87. package/dist/intelligence/routing/router.js +0 -1
  88. package/dist/intelligence/routing/types.js +0 -1
  89. package/dist/intelligence/runtime/adk/adapter.js +21 -33
  90. package/dist/intelligence/runtime/adk/detector.js +0 -1
  91. package/dist/intelligence/runtime/auth-provider.d.ts +63 -0
  92. package/dist/intelligence/runtime/auth-provider.js +201 -0
  93. package/dist/intelligence/runtime/boundary.d.ts +142 -0
  94. package/dist/intelligence/runtime/boundary.js +845 -0
  95. package/dist/intelligence/runtime/changes.d.ts +59 -0
  96. package/dist/intelligence/runtime/changes.js +362 -0
  97. package/dist/intelligence/runtime/external.d.ts +1 -0
  98. package/dist/intelligence/runtime/external.js +38 -61
  99. package/dist/intelligence/runtime/native.js +23 -56
  100. package/dist/intelligence/runtime/types.d.ts +91 -1
  101. package/dist/intelligence/runtime/types.js +11 -2
  102. package/dist/intelligence/security/audit.js +8 -2
  103. package/dist/intelligence/security/policy.js +0 -1
  104. package/dist/intelligence/security/types.d.ts +8 -0
  105. package/dist/intelligence/security/types.js +0 -1
  106. package/dist/intelligence/skills/builtins.js +0 -1
  107. package/dist/intelligence/skills/loader.js +0 -1
  108. package/dist/intelligence/skills/registry.js +0 -1
  109. package/dist/intelligence/skills/types.js +0 -1
  110. package/dist/intelligence/verification/engine.d.ts +30 -8
  111. package/dist/intelligence/verification/engine.js +126 -21
  112. package/dist/intelligence/verification/reviewer.d.ts +18 -2
  113. package/dist/intelligence/verification/reviewer.js +356 -4
  114. package/dist/intelligence/verification/types.d.ts +71 -0
  115. package/dist/intelligence/verification/types.js +0 -1
  116. package/dist/knowledge/facts.js +0 -1
  117. package/dist/mcp/protocol.js +0 -1
  118. package/dist/mcp/server.js +38 -2
  119. package/dist/mcp/setup.js +5 -2
  120. package/dist/mcp/tools.js +0 -1
  121. package/dist/mcp/types.js +0 -1
  122. package/dist/mcp/verify.js +0 -1
  123. package/dist/portability/bundle.js +0 -1
  124. package/dist/prompts/onboarding.js +0 -1
  125. package/dist/prompts/refresh.js +0 -1
  126. package/dist/prompts/requirements.js +0 -1
  127. package/dist/security/files.js +0 -1
  128. package/dist/security/redact.js +0 -1
  129. package/dist/services/agent.js +2 -1
  130. package/dist/services/analysis.js +0 -1
  131. package/dist/services/common.js +0 -1
  132. package/dist/services/doctor.js +13 -2
  133. package/dist/services/drift.js +0 -1
  134. package/dist/services/features.js +5 -1
  135. package/dist/services/graph.js +4 -1
  136. package/dist/services/init.js +0 -1
  137. package/dist/services/integrations.d.ts +2 -1
  138. package/dist/services/integrations.js +29 -6
  139. package/dist/services/intelligence.d.ts +2 -2
  140. package/dist/services/intelligence.js +38 -36
  141. package/dist/services/knowledge.js +0 -1
  142. package/dist/services/migrate.js +0 -1
  143. package/dist/services/modules.d.ts +85 -0
  144. package/dist/services/modules.js +313 -0
  145. package/dist/services/portability.js +0 -1
  146. package/dist/services/records.js +5 -1
  147. package/dist/services/refresh.js +0 -1
  148. package/dist/services/reset.js +0 -1
  149. package/dist/services/settings.d.ts +36 -0
  150. package/dist/services/settings.js +102 -0
  151. package/dist/services/setup.d.ts +4 -5
  152. package/dist/services/setup.js +40 -28
  153. package/dist/services/standards.js +10 -1
  154. package/dist/services/status.js +0 -1
  155. package/dist/services/taskContext.js +0 -1
  156. package/dist/services/tasks.js +9 -1
  157. package/dist/services/verify.js +7 -2
  158. package/dist/sessions/session.js +0 -1
  159. package/dist/standards/acquisition/ingest.js +0 -1
  160. package/dist/standards/applicability/engine.js +0 -1
  161. package/dist/standards/builtin/code-quality.js +0 -1
  162. package/dist/standards/builtin/database-safety.js +0 -1
  163. package/dist/standards/builtin/index.js +0 -1
  164. package/dist/standards/builtin/security-baseline.js +0 -1
  165. package/dist/standards/builtin/testing-contracts.js +0 -1
  166. package/dist/standards/builtin/undo-kit.js +0 -1
  167. package/dist/standards/config/config.js +0 -1
  168. package/dist/standards/distribution/cache.d.ts +1 -0
  169. package/dist/standards/distribution/cache.js +199 -186
  170. package/dist/standards/distribution/index.js +0 -1
  171. package/dist/standards/distribution/keys.js +0 -1
  172. package/dist/standards/distribution/package.js +6 -1
  173. package/dist/standards/distribution/server.js +0 -1
  174. package/dist/standards/distribution/sync.d.ts +7 -2
  175. package/dist/standards/distribution/sync.js +41 -9
  176. package/dist/standards/distribution/types.js +0 -1
  177. package/dist/standards/engine/compliance.js +0 -1
  178. package/dist/standards/engine/engine.js +0 -1
  179. package/dist/standards/engine/reporter.js +0 -1
  180. package/dist/standards/index.js +0 -1
  181. package/dist/standards/registry/registry.js +0 -1
  182. package/dist/standards/schema/types.js +0 -1
  183. package/dist/standards/schema/validate.js +0 -1
  184. package/dist/standards/templates/index.js +0 -1
  185. package/dist/standards/validators/database.js +0 -1
  186. package/dist/standards/validators/quality.js +0 -1
  187. package/dist/standards/validators/registry.js +0 -1
  188. package/dist/standards/validators/security.js +0 -1
  189. package/dist/standards/validators/testing.js +0 -1
  190. package/dist/standards/validators/types.js +0 -1
  191. package/dist/standards/validators/undo-kit.js +0 -1
  192. package/dist/tasks/routing.js +0 -1
  193. package/dist/tasks/task.js +0 -1
  194. package/dist/utils/cleanup.js +0 -1
  195. package/dist/utils/fs.js +0 -1
  196. package/dist/utils/lock.js +92 -49
  197. package/dist/utils/logger.js +0 -1
  198. package/dist/utils/paths.js +0 -1
  199. package/dist/utils/proc.d.ts +12 -0
  200. package/dist/utils/proc.js +106 -44
  201. package/dist/verification/safety.js +0 -1
  202. package/dist/verification/scope.js +0 -1
  203. package/docs/agents.md +15 -0
  204. package/docs/architecture/global-standards-architecture.md +287 -0
  205. package/docs/archive/global-standards/GLOBAL_STANDARDS_AUDIT.md +99 -0
  206. package/docs/archive/global-standards/GLOBAL_STANDARDS_FINAL_STATUS.md +138 -0
  207. package/docs/archive/global-standards/GLOBAL_STANDARDS_IMPLEMENTATION_PLAN.md +100 -0
  208. package/docs/archive/global-standards/GLOBAL_STANDARDS_INDEPENDENT_AUDIT.md +219 -0
  209. package/docs/archive/global-standards/GLOBAL_STANDARDS_SECURITY_REPORT.md +184 -0
  210. package/docs/configuration.md +67 -0
  211. package/docs/contributing.md +15 -5
  212. package/docs/development/EXECUTION_STATE.md +50 -0
  213. package/docs/features.md +80 -0
  214. package/docs/getting-started.md +69 -111
  215. package/docs/guides/global-standards-migration.md +100 -0
  216. package/docs/integrations.md +7 -0
  217. package/docs/mcp.md +13 -0
  218. package/docs/security/THIRD_PARTY_LICENSES.md +41 -0
  219. package/docs/security.md +8 -2
  220. package/docs/testing/FINAL_CORRECTION_AND_CLEANUP_REPORT.md +92 -0
  221. package/docs/testing/global-standards-real-project-tests.md +218 -0
  222. package/docs/testing/global-standards-test-report.md +89 -0
  223. package/docs/testing/global-standards-verification-matrix.md +174 -0
  224. package/docs/troubleshooting.md +3 -0
  225. package/package.json +1 -1
  226. package/dist/agents/claude/adapter.js.map +0 -1
  227. package/dist/agents/claude/content.js.map +0 -1
  228. package/dist/agents/codex/adapter.js.map +0 -1
  229. package/dist/agents/copilot/adapter.js.map +0 -1
  230. package/dist/agents/cursor/adapter.js.map +0 -1
  231. package/dist/agents/index.js.map +0 -1
  232. package/dist/agents/shared.js.map +0 -1
  233. package/dist/agents/types.js.map +0 -1
  234. package/dist/cli/args.js.map +0 -1
  235. package/dist/cli/help.js.map +0 -1
  236. package/dist/cli/main.js.map +0 -1
  237. package/dist/cli/render.js.map +0 -1
  238. package/dist/cli/run.js.map +0 -1
  239. package/dist/config/schemas.js.map +0 -1
  240. package/dist/config/validate.js.map +0 -1
  241. package/dist/core/artifacts.js.map +0 -1
  242. package/dist/core/contracts.js.map +0 -1
  243. package/dist/core/migrations.js.map +0 -1
  244. package/dist/core/version.js.map +0 -1
  245. package/dist/core/versioned.js.map +0 -1
  246. package/dist/core/workspace.js.map +0 -1
  247. package/dist/decisions/decision.js.map +0 -1
  248. package/dist/discovery/cache.js.map +0 -1
  249. package/dist/discovery/commands.js.map +0 -1
  250. package/dist/discovery/detect.js.map +0 -1
  251. package/dist/discovery/docs.js.map +0 -1
  252. package/dist/discovery/entrypoints.js.map +0 -1
  253. package/dist/discovery/ignore.js.map +0 -1
  254. package/dist/discovery/scan.js.map +0 -1
  255. package/dist/discovery/types.js.map +0 -1
  256. package/dist/dx/dashboard.js.map +0 -1
  257. package/dist/dx/guidance.js.map +0 -1
  258. package/dist/dx/index.js.map +0 -1
  259. package/dist/dx/onboarding.js.map +0 -1
  260. package/dist/dx/types.js.map +0 -1
  261. package/dist/errors/index.js.map +0 -1
  262. package/dist/features/schema.js.map +0 -1
  263. package/dist/features/types.js.map +0 -1
  264. package/dist/features/validate.js.map +0 -1
  265. package/dist/git/git.js.map +0 -1
  266. package/dist/index.js.map +0 -1
  267. package/dist/integrations/adapters/agent-skills.js.map +0 -1
  268. package/dist/integrations/adapters/claudePlugin.js.map +0 -1
  269. package/dist/integrations/adapters/graphify.js.map +0 -1
  270. package/dist/integrations/adapters/omniroute.js.map +0 -1
  271. package/dist/integrations/adapters/pluginSkill.js.map +0 -1
  272. package/dist/integrations/adapters/ponytail.js.map +0 -1
  273. package/dist/integrations/exec.js.map +0 -1
  274. package/dist/integrations/index.js.map +0 -1
  275. package/dist/integrations/manager.js.map +0 -1
  276. package/dist/integrations/notices.js.map +0 -1
  277. package/dist/integrations/persistentPath.js.map +0 -1
  278. package/dist/integrations/protect.js.map +0 -1
  279. package/dist/integrations/state.js.map +0 -1
  280. package/dist/integrations/types.js.map +0 -1
  281. package/dist/intelligence/agents/profiles.js.map +0 -1
  282. package/dist/intelligence/agents/registry.js.map +0 -1
  283. package/dist/intelligence/agents/types.js.map +0 -1
  284. package/dist/intelligence/observability/tracer.js.map +0 -1
  285. package/dist/intelligence/observability/types.js.map +0 -1
  286. package/dist/intelligence/orchestration/engine.js.map +0 -1
  287. package/dist/intelligence/orchestration/lock-manager.js.map +0 -1
  288. package/dist/intelligence/orchestration/store.js.map +0 -1
  289. package/dist/intelligence/orchestration/types.js.map +0 -1
  290. package/dist/intelligence/routing/matcher.js.map +0 -1
  291. package/dist/intelligence/routing/router.js.map +0 -1
  292. package/dist/intelligence/routing/types.js.map +0 -1
  293. package/dist/intelligence/runtime/adk/adapter.js.map +0 -1
  294. package/dist/intelligence/runtime/adk/detector.js.map +0 -1
  295. package/dist/intelligence/runtime/external.js.map +0 -1
  296. package/dist/intelligence/runtime/native.js.map +0 -1
  297. package/dist/intelligence/runtime/types.js.map +0 -1
  298. package/dist/intelligence/security/audit.js.map +0 -1
  299. package/dist/intelligence/security/policy.js.map +0 -1
  300. package/dist/intelligence/security/types.js.map +0 -1
  301. package/dist/intelligence/skills/builtins.js.map +0 -1
  302. package/dist/intelligence/skills/loader.js.map +0 -1
  303. package/dist/intelligence/skills/registry.js.map +0 -1
  304. package/dist/intelligence/skills/types.js.map +0 -1
  305. package/dist/intelligence/verification/engine.js.map +0 -1
  306. package/dist/intelligence/verification/reviewer.js.map +0 -1
  307. package/dist/intelligence/verification/types.js.map +0 -1
  308. package/dist/knowledge/facts.js.map +0 -1
  309. package/dist/mcp/protocol.js.map +0 -1
  310. package/dist/mcp/server.js.map +0 -1
  311. package/dist/mcp/setup.js.map +0 -1
  312. package/dist/mcp/tools.js.map +0 -1
  313. package/dist/mcp/types.js.map +0 -1
  314. package/dist/mcp/verify.js.map +0 -1
  315. package/dist/portability/bundle.js.map +0 -1
  316. package/dist/prompts/onboarding.js.map +0 -1
  317. package/dist/prompts/refresh.js.map +0 -1
  318. package/dist/prompts/requirements.js.map +0 -1
  319. package/dist/security/files.js.map +0 -1
  320. package/dist/security/redact.js.map +0 -1
  321. package/dist/services/agent.js.map +0 -1
  322. package/dist/services/analysis.js.map +0 -1
  323. package/dist/services/common.js.map +0 -1
  324. package/dist/services/doctor.js.map +0 -1
  325. package/dist/services/drift.js.map +0 -1
  326. package/dist/services/features.js.map +0 -1
  327. package/dist/services/graph.js.map +0 -1
  328. package/dist/services/init.js.map +0 -1
  329. package/dist/services/integrations.js.map +0 -1
  330. package/dist/services/intelligence.js.map +0 -1
  331. package/dist/services/knowledge.js.map +0 -1
  332. package/dist/services/migrate.js.map +0 -1
  333. package/dist/services/portability.js.map +0 -1
  334. package/dist/services/records.js.map +0 -1
  335. package/dist/services/refresh.js.map +0 -1
  336. package/dist/services/reset.js.map +0 -1
  337. package/dist/services/setup.js.map +0 -1
  338. package/dist/services/standards.js.map +0 -1
  339. package/dist/services/status.js.map +0 -1
  340. package/dist/services/taskContext.js.map +0 -1
  341. package/dist/services/tasks.js.map +0 -1
  342. package/dist/services/verify.js.map +0 -1
  343. package/dist/sessions/session.js.map +0 -1
  344. package/dist/standards/acquisition/ingest.js.map +0 -1
  345. package/dist/standards/applicability/engine.js.map +0 -1
  346. package/dist/standards/builtin/code-quality.js.map +0 -1
  347. package/dist/standards/builtin/database-safety.js.map +0 -1
  348. package/dist/standards/builtin/index.js.map +0 -1
  349. package/dist/standards/builtin/security-baseline.js.map +0 -1
  350. package/dist/standards/builtin/testing-contracts.js.map +0 -1
  351. package/dist/standards/builtin/undo-kit.js.map +0 -1
  352. package/dist/standards/config/config.js.map +0 -1
  353. package/dist/standards/distribution/cache.js.map +0 -1
  354. package/dist/standards/distribution/index.js.map +0 -1
  355. package/dist/standards/distribution/keys.js.map +0 -1
  356. package/dist/standards/distribution/package.js.map +0 -1
  357. package/dist/standards/distribution/server.js.map +0 -1
  358. package/dist/standards/distribution/sync.js.map +0 -1
  359. package/dist/standards/distribution/types.js.map +0 -1
  360. package/dist/standards/engine/compliance.js.map +0 -1
  361. package/dist/standards/engine/engine.js.map +0 -1
  362. package/dist/standards/engine/reporter.js.map +0 -1
  363. package/dist/standards/index.js.map +0 -1
  364. package/dist/standards/registry/registry.js.map +0 -1
  365. package/dist/standards/schema/types.js.map +0 -1
  366. package/dist/standards/schema/validate.js.map +0 -1
  367. package/dist/standards/templates/index.js.map +0 -1
  368. package/dist/standards/validators/database.js.map +0 -1
  369. package/dist/standards/validators/quality.js.map +0 -1
  370. package/dist/standards/validators/registry.js.map +0 -1
  371. package/dist/standards/validators/security.js.map +0 -1
  372. package/dist/standards/validators/testing.js.map +0 -1
  373. package/dist/standards/validators/types.js.map +0 -1
  374. package/dist/standards/validators/undo-kit.js.map +0 -1
  375. package/dist/tasks/routing.js.map +0 -1
  376. package/dist/tasks/task.js.map +0 -1
  377. package/dist/utils/cleanup.js.map +0 -1
  378. package/dist/utils/fs.js.map +0 -1
  379. package/dist/utils/lock.js.map +0 -1
  380. package/dist/utils/logger.js.map +0 -1
  381. package/dist/utils/paths.js.map +0 -1
  382. package/dist/utils/proc.js.map +0 -1
  383. package/dist/verification/safety.js.map +0 -1
  384. package/dist/verification/scope.js.map +0 -1
@@ -0,0 +1,313 @@
1
+ import path from 'node:path';
2
+ import { DevWorkspaceError } from '../errors/index.js';
3
+ import { findWorkspaceRoot, requireWorkspace, wsPaths } from '../core/workspace.js';
4
+ import { FEATURE_REGISTRY, getFeatureDefinition, presetFeaturesFromRegistry, resolveFeatureSelectionGraph, } from '../config/feature-registry.js';
5
+ import { SETUP_PRESETS, loadWorkspaceSettingsSafe, loadWorkspaceSettingsStrict, saveWorkspaceSettings, validateWorkspaceSettings, } from '../config/settings.js';
6
+ import { pathExists } from '../utils/fs.js';
7
+ import { isoNow } from './common.js';
8
+ function inferMatchingPreset(enabledFeatures) {
9
+ const normalized = [...new Set(enabledFeatures)].sort();
10
+ for (const preset of SETUP_PRESETS) {
11
+ if (preset === 'custom')
12
+ continue;
13
+ const presetList = [...new Set(presetFeaturesFromRegistry(preset))].sort();
14
+ if (normalized.length === presetList.length
15
+ && normalized.every((value, idx) => value === presetList[idx])) {
16
+ return preset;
17
+ }
18
+ }
19
+ return 'custom';
20
+ }
21
+ function toModuleEntry(def, enabledSet, persisted, featureConfig) {
22
+ const enabled = !def.canDisable || enabledSet.has(def.id);
23
+ return {
24
+ id: def.id,
25
+ name: def.name,
26
+ description: def.description,
27
+ category: def.category,
28
+ availability: def.availability,
29
+ enabled,
30
+ canDisable: def.canDisable,
31
+ preserveDataOnDisable: def.preserveDataOnDisable,
32
+ installKind: def.installKind,
33
+ dataPolicy: def.dataPolicy,
34
+ requires: def.requires,
35
+ prerequisites: def.prerequisites ?? [],
36
+ entryPoints: def.entryPoints,
37
+ dataPaths: def.dataPaths,
38
+ configKeys: def.configKeys ?? [],
39
+ config: { ...(featureConfig[def.id] ?? {}) },
40
+ runtimeGated: def.canDisable && persisted && !enabled,
41
+ };
42
+ }
43
+ function parseConfigValue(moduleId, key, raw) {
44
+ const trimmed = raw.trim();
45
+ if (key === 'autoDetect') {
46
+ if (trimmed === 'true')
47
+ return true;
48
+ if (trimmed === 'false')
49
+ return false;
50
+ throw new DevWorkspaceError('USAGE', `Config "${moduleId}.${key}" must be "true" or "false".`);
51
+ }
52
+ if (key === 'maxRetries') {
53
+ const parsed = Number(trimmed);
54
+ if (!Number.isInteger(parsed) || parsed < 0 || parsed > 10) {
55
+ throw new DevWorkspaceError('USAGE', `Config "${moduleId}.${key}" must be an integer between 0 and 10.`);
56
+ }
57
+ return parsed;
58
+ }
59
+ if (key === 'scope') {
60
+ if (trimmed !== 'project' && trimmed !== 'user') {
61
+ throw new DevWorkspaceError('USAGE', `Config "${moduleId}.${key}" must be "project" or "user".`);
62
+ }
63
+ return trimmed;
64
+ }
65
+ if (key === 'launcher') {
66
+ if (trimmed !== 'auto' && trimmed !== 'npx' && trimmed !== 'local') {
67
+ throw new DevWorkspaceError('USAGE', `Config "${moduleId}.${key}" must be "auto", "npx", or "local".`);
68
+ }
69
+ return trimmed;
70
+ }
71
+ if (trimmed === 'true')
72
+ return true;
73
+ if (trimmed === 'false')
74
+ return false;
75
+ return trimmed;
76
+ }
77
+ /** List all registered DevWorkspace modules with live enablement and gating status. */
78
+ export async function listModulesService(o) {
79
+ const cwd = o.cwd ? path.resolve(o.cwd) : process.cwd();
80
+ const root = (await findWorkspaceRoot(cwd)) ?? cwd;
81
+ const ws = wsPaths(root);
82
+ const initialized = await pathExists(ws.projectJson);
83
+ if (!initialized) {
84
+ const enabledSet = new Set(presetFeaturesFromRegistry('minimal'));
85
+ return {
86
+ initialized: false,
87
+ root,
88
+ preset: 'minimal',
89
+ persisted: false,
90
+ migratedFromLegacy: false,
91
+ modules: FEATURE_REGISTRY.map((def) => toModuleEntry(def, enabledSet, false, {})),
92
+ };
93
+ }
94
+ const loaded = await loadWorkspaceSettingsSafe(ws);
95
+ const enabledSet = new Set(loaded.settings.enabledFeatures);
96
+ return {
97
+ initialized: true,
98
+ root,
99
+ preset: loaded.settings.preset,
100
+ persisted: loaded.persisted,
101
+ migratedFromLegacy: loaded.migratedFromLegacy,
102
+ recoveryWarning: loaded.recoveryWarning,
103
+ modules: FEATURE_REGISTRY.map((def) => toModuleEntry(def, enabledSet, loaded.persisted, loaded.settings.featureConfig)),
104
+ };
105
+ }
106
+ /** Inspect a single module, its prerequisites, dependencies, dependents, and data paths. */
107
+ export async function showModuleService(o, moduleId) {
108
+ const def = getFeatureDefinition(moduleId);
109
+ if (!def) {
110
+ throw new DevWorkspaceError('USAGE', `Unknown module "${moduleId}".`, {
111
+ hint: `Run "devworkspace modules list" to see valid module IDs.`,
112
+ });
113
+ }
114
+ const listed = await listModulesService(o);
115
+ const byId = new Map(listed.modules.map((m) => [m.id, m]));
116
+ const entry = byId.get(moduleId);
117
+ const dependencyStatus = def.requires.map((depId) => {
118
+ const dep = byId.get(depId);
119
+ return { id: dep.id, name: dep.name, enabled: dep.enabled };
120
+ });
121
+ const dependents = FEATURE_REGISTRY
122
+ .filter((candidate) => candidate.requires.includes(moduleId))
123
+ .map((candidate) => {
124
+ const item = byId.get(candidate.id);
125
+ return { id: item.id, name: item.name, enabled: item.enabled };
126
+ });
127
+ return {
128
+ initialized: listed.initialized,
129
+ root: listed.root,
130
+ preset: listed.preset,
131
+ persisted: listed.persisted,
132
+ recoveryWarning: listed.recoveryWarning,
133
+ module: entry,
134
+ dependents,
135
+ dependencyStatus,
136
+ };
137
+ }
138
+ /** Enable a module and its required dependencies safely, enforcing consent for external helpers. */
139
+ export async function enableModuleService(o, moduleId, opts = {}) {
140
+ const ws = await requireWorkspace(o.cwd);
141
+ const def = getFeatureDefinition(moduleId);
142
+ if (!def) {
143
+ throw new DevWorkspaceError('USAGE', `Unknown module "${moduleId}".`, {
144
+ hint: `Run "devworkspace modules list" to inspect available modules.`,
145
+ });
146
+ }
147
+ const loaded = await loadWorkspaceSettingsStrict(ws);
148
+ const current = loaded.settings;
149
+ const wasEnabled = current.enabledFeatures.includes(moduleId) && loaded.persisted;
150
+ const resolved = resolveFeatureSelectionGraph({
151
+ requestedEnable: [moduleId],
152
+ currentEnabled: current.enabledFeatures,
153
+ });
154
+ const externalTargets = [moduleId, ...resolved.autoEnabledDependencies]
155
+ .map((id) => getFeatureDefinition(id))
156
+ .filter((item) => item.dataPolicy === 'external-tool-may-run');
157
+ const unconsented = externalTargets.filter((item) => !current.integrationsConsented.includes(item.id));
158
+ const consentRequired = unconsented.length > 0 && !opts.yes;
159
+ const warnings = [];
160
+ if (consentRequired && !o.dryRun) {
161
+ const target = unconsented[0];
162
+ const prereqs = target.prerequisites?.length ? ` Prerequisites: ${target.prerequisites.join('; ')}.` : '';
163
+ throw new DevWorkspaceError('USAGE', `Enabling external integration "${target.id}" (${target.name}) requires explicit user consent.${prereqs}`, {
164
+ hint: `Re-run with --yes if you want to allow this external helper: devworkspace modules enable ${moduleId} --yes`,
165
+ });
166
+ }
167
+ if (consentRequired && o.dryRun) {
168
+ warnings.push(`Consent required to enable external integration(s): ${unconsented.map((u) => u.id).join(', ')} (pass --yes when applying).`);
169
+ }
170
+ const nextPreset = inferMatchingPreset(resolved.enabled);
171
+ const nextConsented = [
172
+ ...new Set([
173
+ ...current.integrationsConsented,
174
+ ...(opts.yes ? externalTargets.map((item) => item.id) : []),
175
+ ]),
176
+ ];
177
+ const nextSettings = validateWorkspaceSettings({
178
+ ...current,
179
+ preset: nextPreset,
180
+ enabledFeatures: resolved.enabled,
181
+ disabledFeatures: resolved.disabled,
182
+ integrationsConsented: nextConsented,
183
+ updatedAt: isoNow(o),
184
+ source: 'cli',
185
+ });
186
+ if (!o.dryRun) {
187
+ await saveWorkspaceSettings(ws, nextSettings);
188
+ }
189
+ const nextSteps = [];
190
+ if (def.category === 'integration') {
191
+ const shortId = def.id.replace(/^integration\./, '');
192
+ nextSteps.push(`Optional third-party tool installation stays explicit: devworkspace setup --integrations --only ${shortId} --yes`);
193
+ }
194
+ else if (def.id === 'agent.mcp') {
195
+ nextSteps.push(`Configure your coding agent MCP entry: devworkspace mcp setup --agent claude-code`);
196
+ }
197
+ else if (def.id === 'agent.instructions') {
198
+ nextSteps.push(`Write managed agent instruction files: devworkspace agent install --agent codex`);
199
+ }
200
+ else if (def.entryPoints.length > 0) {
201
+ nextSteps.push(`Ready to use: devworkspace ${def.entryPoints[0]}`);
202
+ }
203
+ return {
204
+ action: 'enable',
205
+ moduleId,
206
+ dryRun: !!o.dryRun,
207
+ changed: !wasEnabled || resolved.autoEnabledDependencies.length > 0 || !loaded.persisted,
208
+ preset: nextPreset,
209
+ enabled: true,
210
+ autoEnabledDependencies: resolved.autoEnabledDependencies,
211
+ autoDisabledDependents: [],
212
+ preservedDataPaths: [],
213
+ consentRequired,
214
+ nextSteps,
215
+ warnings,
216
+ };
217
+ }
218
+ /** Disable an optional module (optionally cascading dependents with --force) while preserving user data. */
219
+ export async function disableModuleService(o, moduleId, opts = {}) {
220
+ const ws = await requireWorkspace(o.cwd);
221
+ const def = getFeatureDefinition(moduleId);
222
+ if (!def) {
223
+ throw new DevWorkspaceError('USAGE', `Unknown module "${moduleId}".`, {
224
+ hint: `Run "devworkspace modules list" to inspect available modules.`,
225
+ });
226
+ }
227
+ const loaded = await loadWorkspaceSettingsStrict(ws);
228
+ const current = loaded.settings;
229
+ const wasDisabled = loaded.persisted && current.disabledFeatures.includes(moduleId);
230
+ const resolved = resolveFeatureSelectionGraph({
231
+ requestedDisable: [moduleId],
232
+ currentEnabled: current.enabledFeatures,
233
+ cascadeDisable: !!opts.force,
234
+ });
235
+ const nextPreset = inferMatchingPreset(resolved.enabled);
236
+ const nextSettings = validateWorkspaceSettings({
237
+ ...current,
238
+ preset: nextPreset,
239
+ enabledFeatures: resolved.enabled,
240
+ disabledFeatures: resolved.disabled,
241
+ updatedAt: isoNow(o),
242
+ source: 'cli',
243
+ });
244
+ if (!o.dryRun) {
245
+ await saveWorkspaceSettings(ws, nextSettings);
246
+ }
247
+ const disabledIds = [moduleId, ...resolved.autoDisabledDependents];
248
+ const preservedDataPaths = [
249
+ ...new Set(disabledIds.flatMap((id) => [...(getFeatureDefinition(id)?.dataPaths ?? [])])),
250
+ ];
251
+ const warnings = [];
252
+ if (preservedDataPaths.length > 0) {
253
+ warnings.push(`Existing data on disk is preserved (${preservedDataPaths.join(', ')}).`);
254
+ }
255
+ return {
256
+ action: 'disable',
257
+ moduleId,
258
+ dryRun: !!o.dryRun,
259
+ changed: !wasDisabled || !loaded.persisted,
260
+ preset: nextPreset,
261
+ enabled: false,
262
+ autoEnabledDependencies: [],
263
+ autoDisabledDependents: resolved.autoDisabledDependents,
264
+ preservedDataPaths,
265
+ consentRequired: false,
266
+ nextSteps: [`Re-enable anytime without losing data: devworkspace modules enable ${moduleId}`],
267
+ warnings,
268
+ };
269
+ }
270
+ /** Configure non-secret module preferences inside .devworkspace/settings.json. */
271
+ export async function configureModuleService(o, moduleId, key, rawValue) {
272
+ const ws = await requireWorkspace(o.cwd);
273
+ const def = getFeatureDefinition(moduleId);
274
+ if (!def) {
275
+ throw new DevWorkspaceError('USAGE', `Unknown module "${moduleId}".`);
276
+ }
277
+ const allowedKeys = def.configKeys ?? [];
278
+ if (allowedKeys.length === 0) {
279
+ throw new DevWorkspaceError('USAGE', `Module "${moduleId}" has no configurable keys.`);
280
+ }
281
+ const loaded = await loadWorkspaceSettingsStrict(ws);
282
+ const current = loaded.settings;
283
+ const parsedValue = parseConfigValue(moduleId, key, rawValue);
284
+ const nextModuleConfig = {
285
+ ...(current.featureConfig[moduleId] ?? {}),
286
+ [key]: parsedValue,
287
+ };
288
+ const candidateSettings = {
289
+ ...current,
290
+ featureConfig: {
291
+ ...current.featureConfig,
292
+ [moduleId]: nextModuleConfig,
293
+ },
294
+ updatedAt: isoNow(o),
295
+ source: 'cli',
296
+ };
297
+ // Enforce secret-key guards and schema validation even before check of configKey membership
298
+ const validated = validateWorkspaceSettings(candidateSettings);
299
+ if (!allowedKeys.includes(key)) {
300
+ throw new DevWorkspaceError('USAGE', `Unknown configuration key "${key}" for "${moduleId}". Allowed keys: ${allowedKeys.join(', ')}.`);
301
+ }
302
+ if (!o.dryRun) {
303
+ await saveWorkspaceSettings(ws, validated);
304
+ }
305
+ return {
306
+ moduleId,
307
+ key,
308
+ value: parsedValue,
309
+ dryRun: !!o.dryRun,
310
+ config: validated.featureConfig[moduleId] ?? {},
311
+ persisted: !o.dryRun,
312
+ };
313
+ }
@@ -152,4 +152,3 @@ export async function importWorkspace(o, file) {
152
152
  await withLock(ws.dir, apply);
153
153
  return result;
154
154
  }
155
- //# sourceMappingURL=portability.js.map
@@ -2,12 +2,15 @@ import { requireWorkspace } from '../core/workspace.js';
2
2
  import { addDecision, listDecisions } from '../decisions/decision.js';
3
3
  import { listSessions, saveSession } from '../sessions/session.js';
4
4
  import { DevWorkspaceError } from '../errors/index.js';
5
+ import { assertModuleEnabled } from '../config/feature-gate.js';
5
6
  import { isoNow, mutate } from './common.js';
6
7
  export async function recordDecision(o, input) {
8
+ await assertModuleEnabled(o.cwd, 'workflow.decisions', 'Record decision');
7
9
  return mutate(o, (ws) => addDecision(ws, input, isoNow(o)));
8
10
  }
9
11
  export async function getDecisions(o) {
10
12
  const ws = await requireWorkspace(o.cwd);
13
+ await assertModuleEnabled(ws.root, 'workflow.decisions', 'List decisions');
11
14
  return (await listDecisions(ws)).decisions;
12
15
  }
13
16
  export async function getDecision(o, number) {
@@ -17,10 +20,11 @@ export async function getDecision(o, number) {
17
20
  return d;
18
21
  }
19
22
  export async function recordSession(o, input) {
23
+ await assertModuleEnabled(o.cwd, 'workflow.decisions', 'Record session');
20
24
  return mutate(o, (ws) => saveSession(ws, input, isoNow(o)));
21
25
  }
22
26
  export async function getSessions(o, limit = 10) {
23
27
  const ws = await requireWorkspace(o.cwd);
28
+ await assertModuleEnabled(ws.root, 'workflow.decisions', 'List sessions');
24
29
  return listSessions(ws, limit);
25
30
  }
26
- //# sourceMappingURL=records.js.map
@@ -76,4 +76,3 @@ export async function refreshWorkspace(o) {
76
76
  return { dryRun: false, headChanged, autoRefreshed: det.written, retired: det.retired, stale, needsReview: rep.needsReview, prompt };
77
77
  });
78
78
  }
79
- //# sourceMappingURL=refresh.js.map
@@ -133,4 +133,3 @@ export async function resetWorkspace(o) {
133
133
  await fs.rm(ws.dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 });
134
134
  return { root, executed: true, actions, fileCount };
135
135
  }
136
- //# sourceMappingURL=reset.js.map
@@ -0,0 +1,36 @@
1
+ import { type SetupPreset, type WorkspaceSettings } from '../config/settings.js';
2
+ import { type ServiceOptions } from './common.js';
3
+ export interface SettingsCapabilitySummary {
4
+ id: string;
5
+ label: string;
6
+ category: 'core' | 'workflow' | 'intelligence' | 'agent' | 'dx';
7
+ state: 'ENABLED' | 'DISABLED';
8
+ configured: boolean;
9
+ }
10
+ export interface SettingsIntegrationSummary {
11
+ id: string;
12
+ name: string;
13
+ status: string;
14
+ restartRequired: boolean;
15
+ }
16
+ export interface SettingsSummaryResult {
17
+ initialized: boolean;
18
+ root: string;
19
+ settingsPath: string;
20
+ persisted: boolean;
21
+ migratedFromLegacy: boolean;
22
+ recoveryWarning?: string;
23
+ preset: SetupPreset;
24
+ agent: {
25
+ selected: string | null;
26
+ method: WorkspaceSettings['agent']['method'];
27
+ scope: 'project' | 'user';
28
+ };
29
+ capabilities: SettingsCapabilitySummary[];
30
+ integrations: SettingsIntegrationSummary[];
31
+ restartRequired: boolean;
32
+ updatedAt: string | null;
33
+ howToChange: string[];
34
+ }
35
+ /** Read-only summary of persisted settings, enabled capabilities, agent scope, and live integration statuses. */
36
+ export declare function getSettingsSummary(o: ServiceOptions): Promise<SettingsSummaryResult>;
@@ -0,0 +1,102 @@
1
+ import path from 'node:path';
2
+ import { findWorkspaceRoot, wsPaths } from '../core/workspace.js';
3
+ import { CORE_FEATURE_IDS, PRESET_DEFAULT_FEATURES, loadWorkspaceSettingsSafe, } from '../config/settings.js';
4
+ import { inspectAll } from '../integrations/index.js';
5
+ import { pathExists } from '../utils/fs.js';
6
+ import { managerEnv } from './common.js';
7
+ const CAPABILITY_META = [
8
+ { id: 'core.workspace', label: 'Workspace & Project Context', category: 'core' },
9
+ { id: 'core.discovery', label: 'Deterministic Discovery & Verification Contract', category: 'core' },
10
+ { id: 'core.security', label: 'Privacy, Secret Redaction & Safe Paths', category: 'core' },
11
+ { id: 'agent.mcp', label: 'MCP Agent Connection', category: 'agent' },
12
+ { id: 'agent.instructions', label: 'Agent Instruction Files', category: 'agent' },
13
+ { id: 'workflow.tasks', label: 'Task & Verification Tracking', category: 'workflow' },
14
+ { id: 'workflow.decisions', label: 'Architecture Decisions & Sessions', category: 'workflow' },
15
+ { id: 'workflow.standards', label: 'Engineering Standards', category: 'workflow' },
16
+ { id: 'intelligence.features', label: 'Feature Maps', category: 'intelligence' },
17
+ { id: 'intelligence.graph', label: 'Offline Dependency Graph', category: 'intelligence' },
18
+ { id: 'intelligence.orchestration', label: 'Multi-Agent Orchestration', category: 'intelligence' },
19
+ { id: 'dx.dashboard', label: 'Local HTML Dashboard', category: 'dx' },
20
+ ];
21
+ /** Read-only summary of persisted settings, enabled capabilities, agent scope, and live integration statuses. */
22
+ export async function getSettingsSummary(o) {
23
+ const cwd = o.cwd ? path.resolve(o.cwd) : process.cwd();
24
+ const root = (await findWorkspaceRoot(cwd)) ?? cwd;
25
+ const ws = wsPaths(root);
26
+ const initialized = await pathExists(ws.projectJson);
27
+ if (!initialized) {
28
+ const minSet = new Set(PRESET_DEFAULT_FEATURES.minimal);
29
+ return {
30
+ initialized: false,
31
+ root,
32
+ settingsPath: '.devworkspace/settings.json',
33
+ persisted: false,
34
+ migratedFromLegacy: false,
35
+ preset: 'minimal',
36
+ agent: { selected: null, method: 'none', scope: 'project' },
37
+ capabilities: CAPABILITY_META.map((m) => ({
38
+ id: m.id,
39
+ label: m.label,
40
+ category: m.category,
41
+ state: minSet.has(m.id) ? 'ENABLED' : 'DISABLED',
42
+ configured: false,
43
+ })),
44
+ integrations: [],
45
+ restartRequired: false,
46
+ updatedAt: null,
47
+ howToChange: [
48
+ 'Run first-time setup: devworkspace setup',
49
+ 'Preview minimal setup: devworkspace setup --preset minimal --dry-run',
50
+ ],
51
+ };
52
+ }
53
+ const loaded = await loadWorkspaceSettingsSafe(ws);
54
+ const enabledSet = new Set([...CORE_FEATURE_IDS, ...loaded.settings.enabledFeatures]);
55
+ const inspections = loaded.recoveryWarning
56
+ ? []
57
+ : await inspectAll(ws, managerEnv(o, root), { deep: false });
58
+ const restartRequired = inspections.some((r) => r.status === 'RESTART_REQUIRED');
59
+ const capabilities = CAPABILITY_META.map((m) => {
60
+ const enabled = enabledSet.has(m.id);
61
+ const configured = m.category === 'core'
62
+ ? true
63
+ : m.id === 'agent.mcp' || m.id === 'agent.instructions'
64
+ ? Boolean(loaded.settings.agent.selected && enabled)
65
+ : enabled;
66
+ return {
67
+ id: m.id,
68
+ label: m.label,
69
+ category: m.category,
70
+ state: enabled ? 'ENABLED' : 'DISABLED',
71
+ configured,
72
+ };
73
+ });
74
+ const integrations = inspections.map((r) => ({
75
+ id: r.id,
76
+ name: r.name,
77
+ status: r.status,
78
+ restartRequired: r.status === 'RESTART_REQUIRED',
79
+ }));
80
+ const howToChange = [
81
+ 'Re-run guided setup: devworkspace setup --edit',
82
+ 'Change preset directly: devworkspace setup --preset minimal|recommended|full [--agent <id>]',
83
+ ];
84
+ if (restartRequired) {
85
+ howToChange.unshift('Reload your coding agent and acknowledge restart: devworkspace integrations status --restarted');
86
+ }
87
+ return {
88
+ initialized: true,
89
+ root,
90
+ settingsPath: '.devworkspace/settings.json',
91
+ persisted: loaded.persisted,
92
+ migratedFromLegacy: loaded.migratedFromLegacy,
93
+ recoveryWarning: loaded.recoveryWarning,
94
+ preset: loaded.settings.preset,
95
+ agent: loaded.settings.agent,
96
+ capabilities,
97
+ integrations,
98
+ restartRequired,
99
+ updatedAt: loaded.settings.updatedAt,
100
+ howToChange,
101
+ };
102
+ }
@@ -1,5 +1,5 @@
1
+ import { type ContractDriftItem } from '../discovery/commands.js';
1
2
  import { type ServiceOptions } from './common.js';
2
- import type { ContractDriftItem } from '../discovery/commands.js';
3
3
  export type CliExecutionMode = 'source-checkout' | 'installed-package' | 'npx-cache';
4
4
  export interface CliProvenance {
5
5
  version: string;
@@ -48,9 +48,8 @@ export interface ProjectSetupResult {
48
48
  nextSteps: string[];
49
49
  }
50
50
  /**
51
- * Single-command setup workflow.
52
- * Idempotently inspects repository, initializes or safely updates .devworkspace/,
53
- * discovers packages & commands, checks for drift, validates feature map if present,
54
- * observes optional integrations, and runs safe diagnostics.
51
+ * Single-command core setup workflow (non-destructive).
52
+ * Initializes or safely updates .devworkspace/, discovers packages & commands,
53
+ * checks contract drift, validates feature map if present, inspects integrations, and runs doctor.
55
54
  */
56
55
  export declare function setupProject(o: ServiceOptions): Promise<ProjectSetupResult>;
@@ -3,14 +3,14 @@ import path from 'node:path';
3
3
  import { packageVersion } from '../core/version.js';
4
4
  import { findWorkspaceRoot, loadProject, wsPaths } from '../core/workspace.js';
5
5
  import { detectContractDrift } from '../discovery/commands.js';
6
+ import { validateFeatureMap } from '../features/validate.js';
6
7
  import { inspectAll } from '../integrations/index.js';
7
8
  import { pathExists } from '../utils/fs.js';
8
- import { analyzeWorkspace } from './analysis.js';
9
+ import { analyzeWorkspace, runDiscovery } from './analysis.js';
9
10
  import { managerEnv } from './common.js';
10
11
  import { runDoctor } from './doctor.js';
11
12
  import { loadFeatures } from './features.js';
12
13
  import { initWorkspace } from './init.js';
13
- import { validateFeatureMap } from '../features/validate.js';
14
14
  export function detectCliProvenance() {
15
15
  const cliPath = process.argv[1] ? path.resolve(process.argv[1]) : 'unknown';
16
16
  const norm = cliPath.replace(/\\/g, '/');
@@ -19,7 +19,7 @@ export function detectCliProvenance() {
19
19
  mode = 'npx-cache';
20
20
  }
21
21
  else if (norm.includes('/node_modules/')) {
22
- mode = 'installed-package'; // an installed copy also ends in dist/cli/main.js; it is not a source checkout
22
+ mode = 'installed-package';
23
23
  }
24
24
  else if (norm.includes('/devworkspace/dist/') || norm.endsWith('/dist/cli/main.js') || norm.endsWith('/src/cli/main.ts')) {
25
25
  mode = 'source-checkout';
@@ -27,10 +27,9 @@ export function detectCliProvenance() {
27
27
  return { version: packageVersion(), path: cliPath, mode };
28
28
  }
29
29
  /**
30
- * Single-command setup workflow.
31
- * Idempotently inspects repository, initializes or safely updates .devworkspace/,
32
- * discovers packages & commands, checks for drift, validates feature map if present,
33
- * observes optional integrations, and runs safe diagnostics.
30
+ * Single-command core setup workflow (non-destructive).
31
+ * Initializes or safely updates .devworkspace/, discovers packages & commands,
32
+ * checks contract drift, validates feature map if present, inspects integrations, and runs doctor.
34
33
  */
35
34
  export async function setupProject(o) {
36
35
  const startDir = o.cwd ? path.resolve(o.cwd) : process.cwd();
@@ -38,14 +37,16 @@ export async function setupProject(o) {
38
37
  const root = existingRoot ?? startDir;
39
38
  const isFirstRun = !existingRoot;
40
39
  const cli = detectCliProvenance();
41
- // 1. Initialize workspace non-destructively
40
+ // 1. Initialize workspace non-destructively (honors o.dryRun)
42
41
  await initWorkspace({ ...o, cwd: root, root });
43
42
  // 2. Discover packages, commands, frameworks, entrypoints, and derive detector facts
44
43
  const ws = wsPaths(root);
45
- const analysis = await analyzeWorkspace(ws, { ...o, cwd: root });
44
+ const discoveryReport = o.dryRun && !(await pathExists(ws.projectJson))
45
+ ? (await runDiscovery(ws, path.basename(root), undefined, { writeCache: false })).discovery
46
+ : (await analyzeWorkspace(ws, { ...o, cwd: root })).discovery;
46
47
  // 3. Inspect configured verification commands and detect contract drift
47
- const driftReport = await detectContractDrift(ws.root, analysis.discovery.commands);
48
- const availableChecks = analysis.discovery.commands.filter((c) => c.available);
48
+ const driftReport = await detectContractDrift(ws.root, discoveryReport.commands);
49
+ const availableChecks = discoveryReport.commands.filter((c) => c.available);
49
50
  // 4. Validate feature map if present
50
51
  let featuresSummary = null;
51
52
  if (await pathExists(ws.features)) {
@@ -63,7 +64,7 @@ export async function setupProject(o) {
63
64
  featuresSummary = { present: true, total: 0, verified: 0, unknown: 0 };
64
65
  }
65
66
  }
66
- // 5. Shallowly observe optional integrations (Graphify, Agent Skills, Ponytail, OmniRoute)
67
+ // 5. Shallowly observe optional integrations (never installs external tools)
67
68
  const integrationsReports = await inspectAll(ws, managerEnv(o, root), { deep: false });
68
69
  const integrations = integrationsReports.map((r) => ({
69
70
  id: r.id,
@@ -71,37 +72,49 @@ export async function setupProject(o) {
71
72
  status: r.status,
72
73
  required: r.required,
73
74
  }));
74
- // 6. Run doctor diagnostics
75
- const doctorResult = await runDoctor({ ...o, cwd: root });
76
- // 7. Compile next steps
75
+ // 6. Run doctor diagnostics (in dryRun on uninitialized dir, avoid reading non-existent project.json)
76
+ let doctorResult;
77
+ if (o.dryRun && !(await pathExists(ws.projectJson))) {
78
+ doctorResult = {
79
+ root,
80
+ healthy: true,
81
+ ready: false,
82
+ fixed: [],
83
+ counts: { pass: 1, warn: 0, fail: 0, info: 0 },
84
+ checks: [{ id: 'dry-run', status: 'pass', message: 'Preview only (no files written).' }],
85
+ integrations: [],
86
+ integrationSummary: { complete: false, required: 0, verified: 0 },
87
+ };
88
+ }
89
+ else {
90
+ doctorResult = await runDoctor({ ...o, cwd: root });
91
+ }
77
92
  const nextSteps = [];
78
93
  if (driftReport.hasDrift) {
79
94
  nextSteps.push('Review verification contract drift: run "devworkspace refresh" or edit .devworkspace/context/commands.json.');
80
95
  }
81
- const missingRequired = integrationsReports.filter((r) => r.required && r.status === 'NOT_INSTALLED');
82
- if (missingRequired.length > 0) {
83
- nextSteps.push(`Optional integrations: run "devworkspace setup --integrations --yes" to install ${missingRequired.map((m) => m.name).join(', ')}.`);
84
- }
85
- nextSteps.push('Connect an AI coding agent via MCP: run "devworkspace setup --agent claude-code" (or codex, antigravity, all).');
96
+ nextSteps.push('Connect a coding agent (optional): run "devworkspace setup --preset recommended --agent claude-code" (or codex, cursor, copilot, antigravity).');
97
+ nextSteps.push('Review settings any time: run "devworkspace settings".');
86
98
  nextSteps.push('Check overall workspace health: run "devworkspace status".');
87
- nextSteps.push('Start your first engineering task: run "devworkspace task new <request>".');
88
- const project = await loadProject(ws);
99
+ const projectName = (await pathExists(ws.projectJson))
100
+ ? (await loadProject(ws)).name
101
+ : path.basename(root);
89
102
  return {
90
103
  root,
91
104
  os: `${os.type()} ${os.release()} (${process.platform})`,
92
105
  nodeVersion: process.versions.node,
93
106
  cli,
94
- initialized: true,
107
+ initialized: !o.dryRun || !isFirstRun,
95
108
  isFirstRun,
96
- projectName: project.name,
97
- packages: analysis.discovery.monorepo.packages.map((p) => ({
109
+ projectName,
110
+ packages: discoveryReport.monorepo.packages.map((p) => ({
98
111
  path: p.path,
99
112
  ecosystem: p.ecosystem,
100
113
  packageManager: p.packageManager,
101
114
  })),
102
- frameworks: analysis.discovery.frameworks.map((f) => f.name),
115
+ frameworks: discoveryReport.frameworks.map((f) => f.name),
103
116
  verification: {
104
- total: analysis.discovery.commands.length,
117
+ total: discoveryReport.commands.length,
105
118
  available: availableChecks.length,
106
119
  checks: [...new Set(availableChecks.map((c) => c.id))],
107
120
  drift: driftReport.issues,
@@ -117,4 +130,3 @@ export async function setupProject(o) {
117
130
  nextSteps,
118
131
  };
119
132
  }
120
- //# sourceMappingURL=setup.js.map