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.
- package/CHANGELOG.md +44 -0
- package/README.md +57 -509
- package/dist/agents/claude/adapter.js +0 -1
- package/dist/agents/claude/content.js +0 -1
- package/dist/agents/codex/adapter.js +0 -1
- package/dist/agents/copilot/adapter.js +0 -1
- package/dist/agents/cursor/adapter.js +0 -1
- package/dist/agents/index.js +0 -1
- package/dist/agents/shared.js +0 -1
- package/dist/agents/types.js +0 -1
- package/dist/cli/args.d.ts +16 -0
- package/dist/cli/args.js +5 -1
- package/dist/cli/help.js +59 -17
- package/dist/cli/main.js +0 -1
- package/dist/cli/prompt.d.ts +15 -0
- package/dist/cli/prompt.js +113 -0
- package/dist/cli/render.d.ts +10 -0
- package/dist/cli/render.js +174 -4
- package/dist/cli/run.d.ts +3 -0
- package/dist/cli/run.js +366 -17
- package/dist/config/feature-gate.d.ts +15 -0
- package/dist/config/feature-gate.js +77 -0
- package/dist/config/feature-registry.d.ts +49 -0
- package/dist/config/feature-registry.js +451 -0
- package/dist/config/schemas.js +0 -1
- package/dist/config/settings.d.ts +54 -0
- package/dist/config/settings.js +293 -0
- package/dist/config/validate.js +0 -1
- package/dist/core/artifacts.js +0 -1
- package/dist/core/contracts.js +0 -1
- package/dist/core/migrations.js +0 -1
- package/dist/core/version.js +0 -1
- package/dist/core/versioned.js +0 -1
- package/dist/core/workspace.d.ts +1 -0
- package/dist/core/workspace.js +1 -1
- package/dist/decisions/decision.js +0 -1
- package/dist/discovery/cache.js +0 -1
- package/dist/discovery/commands.js +0 -1
- package/dist/discovery/detect.js +0 -1
- package/dist/discovery/docs.js +0 -1
- package/dist/discovery/entrypoints.js +0 -1
- package/dist/discovery/ignore.js +0 -1
- package/dist/discovery/scan.js +0 -1
- package/dist/discovery/types.js +0 -1
- package/dist/dx/dashboard.js +2 -1
- package/dist/dx/guidance.js +0 -1
- package/dist/dx/guided-setup.d.ts +102 -0
- package/dist/dx/guided-setup.js +508 -0
- package/dist/dx/index.js +0 -1
- package/dist/dx/onboarding.js +0 -1
- package/dist/dx/types.js +0 -1
- package/dist/errors/index.js +0 -1
- package/dist/features/schema.js +0 -1
- package/dist/features/types.js +0 -1
- package/dist/features/validate.js +0 -1
- package/dist/git/git.js +0 -1
- package/dist/index.d.ts +15 -5
- package/dist/index.js +10 -2
- package/dist/integrations/adapters/agent-skills.js +0 -1
- package/dist/integrations/adapters/claudePlugin.js +0 -1
- package/dist/integrations/adapters/graphify.js +0 -1
- package/dist/integrations/adapters/omniroute.js +0 -1
- package/dist/integrations/adapters/pluginSkill.js +0 -1
- package/dist/integrations/adapters/ponytail.js +0 -1
- package/dist/integrations/exec.js +0 -1
- package/dist/integrations/index.js +0 -1
- package/dist/integrations/manager.d.ts +2 -1
- package/dist/integrations/manager.js +22 -3
- package/dist/integrations/notices.js +0 -1
- package/dist/integrations/persistentPath.js +0 -1
- package/dist/integrations/protect.js +0 -1
- package/dist/integrations/state.js +0 -1
- package/dist/integrations/types.d.ts +1 -1
- package/dist/integrations/types.js +1 -1
- package/dist/intelligence/agents/profiles.js +0 -1
- package/dist/intelligence/agents/registry.js +0 -1
- package/dist/intelligence/agents/types.js +0 -1
- package/dist/intelligence/observability/tracer.js +0 -1
- package/dist/intelligence/observability/types.js +0 -1
- package/dist/intelligence/orchestration/engine.d.ts +21 -3
- package/dist/intelligence/orchestration/engine.js +486 -48
- package/dist/intelligence/orchestration/lock-manager.js +0 -1
- package/dist/intelligence/orchestration/store.js +0 -1
- package/dist/intelligence/orchestration/types.d.ts +40 -2
- package/dist/intelligence/orchestration/types.js +2 -3
- package/dist/intelligence/routing/matcher.js +0 -1
- package/dist/intelligence/routing/router.js +0 -1
- package/dist/intelligence/routing/types.js +0 -1
- package/dist/intelligence/runtime/adk/adapter.js +21 -33
- package/dist/intelligence/runtime/adk/detector.js +0 -1
- package/dist/intelligence/runtime/auth-provider.d.ts +63 -0
- package/dist/intelligence/runtime/auth-provider.js +201 -0
- package/dist/intelligence/runtime/boundary.d.ts +142 -0
- package/dist/intelligence/runtime/boundary.js +845 -0
- package/dist/intelligence/runtime/changes.d.ts +59 -0
- package/dist/intelligence/runtime/changes.js +362 -0
- package/dist/intelligence/runtime/external.d.ts +1 -0
- package/dist/intelligence/runtime/external.js +38 -61
- package/dist/intelligence/runtime/native.js +23 -56
- package/dist/intelligence/runtime/types.d.ts +91 -1
- package/dist/intelligence/runtime/types.js +11 -2
- package/dist/intelligence/security/audit.js +8 -2
- package/dist/intelligence/security/policy.js +0 -1
- package/dist/intelligence/security/types.d.ts +8 -0
- package/dist/intelligence/security/types.js +0 -1
- package/dist/intelligence/skills/builtins.js +0 -1
- package/dist/intelligence/skills/loader.js +0 -1
- package/dist/intelligence/skills/registry.js +0 -1
- package/dist/intelligence/skills/types.js +0 -1
- package/dist/intelligence/verification/engine.d.ts +30 -8
- package/dist/intelligence/verification/engine.js +126 -21
- package/dist/intelligence/verification/reviewer.d.ts +18 -2
- package/dist/intelligence/verification/reviewer.js +356 -4
- package/dist/intelligence/verification/types.d.ts +71 -0
- package/dist/intelligence/verification/types.js +0 -1
- package/dist/knowledge/facts.js +0 -1
- package/dist/mcp/protocol.js +0 -1
- package/dist/mcp/server.js +38 -2
- package/dist/mcp/setup.js +5 -2
- package/dist/mcp/tools.js +0 -1
- package/dist/mcp/types.js +0 -1
- package/dist/mcp/verify.js +0 -1
- package/dist/portability/bundle.js +0 -1
- package/dist/prompts/onboarding.js +0 -1
- package/dist/prompts/refresh.js +0 -1
- package/dist/prompts/requirements.js +0 -1
- package/dist/security/files.js +0 -1
- package/dist/security/redact.js +0 -1
- package/dist/services/agent.js +2 -1
- package/dist/services/analysis.js +0 -1
- package/dist/services/common.js +0 -1
- package/dist/services/doctor.js +13 -2
- package/dist/services/drift.js +0 -1
- package/dist/services/features.js +5 -1
- package/dist/services/graph.js +4 -1
- package/dist/services/init.js +0 -1
- package/dist/services/integrations.d.ts +2 -1
- package/dist/services/integrations.js +29 -6
- package/dist/services/intelligence.d.ts +2 -2
- package/dist/services/intelligence.js +38 -36
- package/dist/services/knowledge.js +0 -1
- package/dist/services/migrate.js +0 -1
- package/dist/services/modules.d.ts +85 -0
- package/dist/services/modules.js +313 -0
- package/dist/services/portability.js +0 -1
- package/dist/services/records.js +5 -1
- package/dist/services/refresh.js +0 -1
- package/dist/services/reset.js +0 -1
- package/dist/services/settings.d.ts +36 -0
- package/dist/services/settings.js +102 -0
- package/dist/services/setup.d.ts +4 -5
- package/dist/services/setup.js +40 -28
- package/dist/services/standards.js +10 -1
- package/dist/services/status.js +0 -1
- package/dist/services/taskContext.js +0 -1
- package/dist/services/tasks.js +9 -1
- package/dist/services/verify.js +7 -2
- package/dist/sessions/session.js +0 -1
- package/dist/standards/acquisition/ingest.js +0 -1
- package/dist/standards/applicability/engine.js +0 -1
- package/dist/standards/builtin/code-quality.js +0 -1
- package/dist/standards/builtin/database-safety.js +0 -1
- package/dist/standards/builtin/index.js +0 -1
- package/dist/standards/builtin/security-baseline.js +0 -1
- package/dist/standards/builtin/testing-contracts.js +0 -1
- package/dist/standards/builtin/undo-kit.js +0 -1
- package/dist/standards/config/config.js +0 -1
- package/dist/standards/distribution/cache.d.ts +1 -0
- package/dist/standards/distribution/cache.js +199 -186
- package/dist/standards/distribution/index.js +0 -1
- package/dist/standards/distribution/keys.js +0 -1
- package/dist/standards/distribution/package.js +6 -1
- package/dist/standards/distribution/server.js +0 -1
- package/dist/standards/distribution/sync.d.ts +7 -2
- package/dist/standards/distribution/sync.js +41 -9
- package/dist/standards/distribution/types.js +0 -1
- package/dist/standards/engine/compliance.js +0 -1
- package/dist/standards/engine/engine.js +0 -1
- package/dist/standards/engine/reporter.js +0 -1
- package/dist/standards/index.js +0 -1
- package/dist/standards/registry/registry.js +0 -1
- package/dist/standards/schema/types.js +0 -1
- package/dist/standards/schema/validate.js +0 -1
- package/dist/standards/templates/index.js +0 -1
- package/dist/standards/validators/database.js +0 -1
- package/dist/standards/validators/quality.js +0 -1
- package/dist/standards/validators/registry.js +0 -1
- package/dist/standards/validators/security.js +0 -1
- package/dist/standards/validators/testing.js +0 -1
- package/dist/standards/validators/types.js +0 -1
- package/dist/standards/validators/undo-kit.js +0 -1
- package/dist/tasks/routing.js +0 -1
- package/dist/tasks/task.js +0 -1
- package/dist/utils/cleanup.js +0 -1
- package/dist/utils/fs.js +0 -1
- package/dist/utils/lock.js +92 -49
- package/dist/utils/logger.js +0 -1
- package/dist/utils/paths.js +0 -1
- package/dist/utils/proc.d.ts +12 -0
- package/dist/utils/proc.js +106 -44
- package/dist/verification/safety.js +0 -1
- package/dist/verification/scope.js +0 -1
- package/docs/agents.md +15 -0
- package/docs/architecture/global-standards-architecture.md +287 -0
- package/docs/archive/global-standards/GLOBAL_STANDARDS_AUDIT.md +99 -0
- package/docs/archive/global-standards/GLOBAL_STANDARDS_FINAL_STATUS.md +138 -0
- package/docs/archive/global-standards/GLOBAL_STANDARDS_IMPLEMENTATION_PLAN.md +100 -0
- package/docs/archive/global-standards/GLOBAL_STANDARDS_INDEPENDENT_AUDIT.md +219 -0
- package/docs/archive/global-standards/GLOBAL_STANDARDS_SECURITY_REPORT.md +184 -0
- package/docs/configuration.md +67 -0
- package/docs/contributing.md +15 -5
- package/docs/development/EXECUTION_STATE.md +50 -0
- package/docs/features.md +80 -0
- package/docs/getting-started.md +69 -111
- package/docs/guides/global-standards-migration.md +100 -0
- package/docs/integrations.md +7 -0
- package/docs/mcp.md +13 -0
- package/docs/security/THIRD_PARTY_LICENSES.md +41 -0
- package/docs/security.md +8 -2
- package/docs/testing/FINAL_CORRECTION_AND_CLEANUP_REPORT.md +92 -0
- package/docs/testing/global-standards-real-project-tests.md +218 -0
- package/docs/testing/global-standards-test-report.md +89 -0
- package/docs/testing/global-standards-verification-matrix.md +174 -0
- package/docs/troubleshooting.md +3 -0
- package/package.json +1 -1
- package/dist/agents/claude/adapter.js.map +0 -1
- package/dist/agents/claude/content.js.map +0 -1
- package/dist/agents/codex/adapter.js.map +0 -1
- package/dist/agents/copilot/adapter.js.map +0 -1
- package/dist/agents/cursor/adapter.js.map +0 -1
- package/dist/agents/index.js.map +0 -1
- package/dist/agents/shared.js.map +0 -1
- package/dist/agents/types.js.map +0 -1
- package/dist/cli/args.js.map +0 -1
- package/dist/cli/help.js.map +0 -1
- package/dist/cli/main.js.map +0 -1
- package/dist/cli/render.js.map +0 -1
- package/dist/cli/run.js.map +0 -1
- package/dist/config/schemas.js.map +0 -1
- package/dist/config/validate.js.map +0 -1
- package/dist/core/artifacts.js.map +0 -1
- package/dist/core/contracts.js.map +0 -1
- package/dist/core/migrations.js.map +0 -1
- package/dist/core/version.js.map +0 -1
- package/dist/core/versioned.js.map +0 -1
- package/dist/core/workspace.js.map +0 -1
- package/dist/decisions/decision.js.map +0 -1
- package/dist/discovery/cache.js.map +0 -1
- package/dist/discovery/commands.js.map +0 -1
- package/dist/discovery/detect.js.map +0 -1
- package/dist/discovery/docs.js.map +0 -1
- package/dist/discovery/entrypoints.js.map +0 -1
- package/dist/discovery/ignore.js.map +0 -1
- package/dist/discovery/scan.js.map +0 -1
- package/dist/discovery/types.js.map +0 -1
- package/dist/dx/dashboard.js.map +0 -1
- package/dist/dx/guidance.js.map +0 -1
- package/dist/dx/index.js.map +0 -1
- package/dist/dx/onboarding.js.map +0 -1
- package/dist/dx/types.js.map +0 -1
- package/dist/errors/index.js.map +0 -1
- package/dist/features/schema.js.map +0 -1
- package/dist/features/types.js.map +0 -1
- package/dist/features/validate.js.map +0 -1
- package/dist/git/git.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/integrations/adapters/agent-skills.js.map +0 -1
- package/dist/integrations/adapters/claudePlugin.js.map +0 -1
- package/dist/integrations/adapters/graphify.js.map +0 -1
- package/dist/integrations/adapters/omniroute.js.map +0 -1
- package/dist/integrations/adapters/pluginSkill.js.map +0 -1
- package/dist/integrations/adapters/ponytail.js.map +0 -1
- package/dist/integrations/exec.js.map +0 -1
- package/dist/integrations/index.js.map +0 -1
- package/dist/integrations/manager.js.map +0 -1
- package/dist/integrations/notices.js.map +0 -1
- package/dist/integrations/persistentPath.js.map +0 -1
- package/dist/integrations/protect.js.map +0 -1
- package/dist/integrations/state.js.map +0 -1
- package/dist/integrations/types.js.map +0 -1
- package/dist/intelligence/agents/profiles.js.map +0 -1
- package/dist/intelligence/agents/registry.js.map +0 -1
- package/dist/intelligence/agents/types.js.map +0 -1
- package/dist/intelligence/observability/tracer.js.map +0 -1
- package/dist/intelligence/observability/types.js.map +0 -1
- package/dist/intelligence/orchestration/engine.js.map +0 -1
- package/dist/intelligence/orchestration/lock-manager.js.map +0 -1
- package/dist/intelligence/orchestration/store.js.map +0 -1
- package/dist/intelligence/orchestration/types.js.map +0 -1
- package/dist/intelligence/routing/matcher.js.map +0 -1
- package/dist/intelligence/routing/router.js.map +0 -1
- package/dist/intelligence/routing/types.js.map +0 -1
- package/dist/intelligence/runtime/adk/adapter.js.map +0 -1
- package/dist/intelligence/runtime/adk/detector.js.map +0 -1
- package/dist/intelligence/runtime/external.js.map +0 -1
- package/dist/intelligence/runtime/native.js.map +0 -1
- package/dist/intelligence/runtime/types.js.map +0 -1
- package/dist/intelligence/security/audit.js.map +0 -1
- package/dist/intelligence/security/policy.js.map +0 -1
- package/dist/intelligence/security/types.js.map +0 -1
- package/dist/intelligence/skills/builtins.js.map +0 -1
- package/dist/intelligence/skills/loader.js.map +0 -1
- package/dist/intelligence/skills/registry.js.map +0 -1
- package/dist/intelligence/skills/types.js.map +0 -1
- package/dist/intelligence/verification/engine.js.map +0 -1
- package/dist/intelligence/verification/reviewer.js.map +0 -1
- package/dist/intelligence/verification/types.js.map +0 -1
- package/dist/knowledge/facts.js.map +0 -1
- package/dist/mcp/protocol.js.map +0 -1
- package/dist/mcp/server.js.map +0 -1
- package/dist/mcp/setup.js.map +0 -1
- package/dist/mcp/tools.js.map +0 -1
- package/dist/mcp/types.js.map +0 -1
- package/dist/mcp/verify.js.map +0 -1
- package/dist/portability/bundle.js.map +0 -1
- package/dist/prompts/onboarding.js.map +0 -1
- package/dist/prompts/refresh.js.map +0 -1
- package/dist/prompts/requirements.js.map +0 -1
- package/dist/security/files.js.map +0 -1
- package/dist/security/redact.js.map +0 -1
- package/dist/services/agent.js.map +0 -1
- package/dist/services/analysis.js.map +0 -1
- package/dist/services/common.js.map +0 -1
- package/dist/services/doctor.js.map +0 -1
- package/dist/services/drift.js.map +0 -1
- package/dist/services/features.js.map +0 -1
- package/dist/services/graph.js.map +0 -1
- package/dist/services/init.js.map +0 -1
- package/dist/services/integrations.js.map +0 -1
- package/dist/services/intelligence.js.map +0 -1
- package/dist/services/knowledge.js.map +0 -1
- package/dist/services/migrate.js.map +0 -1
- package/dist/services/portability.js.map +0 -1
- package/dist/services/records.js.map +0 -1
- package/dist/services/refresh.js.map +0 -1
- package/dist/services/reset.js.map +0 -1
- package/dist/services/setup.js.map +0 -1
- package/dist/services/standards.js.map +0 -1
- package/dist/services/status.js.map +0 -1
- package/dist/services/taskContext.js.map +0 -1
- package/dist/services/tasks.js.map +0 -1
- package/dist/services/verify.js.map +0 -1
- package/dist/sessions/session.js.map +0 -1
- package/dist/standards/acquisition/ingest.js.map +0 -1
- package/dist/standards/applicability/engine.js.map +0 -1
- package/dist/standards/builtin/code-quality.js.map +0 -1
- package/dist/standards/builtin/database-safety.js.map +0 -1
- package/dist/standards/builtin/index.js.map +0 -1
- package/dist/standards/builtin/security-baseline.js.map +0 -1
- package/dist/standards/builtin/testing-contracts.js.map +0 -1
- package/dist/standards/builtin/undo-kit.js.map +0 -1
- package/dist/standards/config/config.js.map +0 -1
- package/dist/standards/distribution/cache.js.map +0 -1
- package/dist/standards/distribution/index.js.map +0 -1
- package/dist/standards/distribution/keys.js.map +0 -1
- package/dist/standards/distribution/package.js.map +0 -1
- package/dist/standards/distribution/server.js.map +0 -1
- package/dist/standards/distribution/sync.js.map +0 -1
- package/dist/standards/distribution/types.js.map +0 -1
- package/dist/standards/engine/compliance.js.map +0 -1
- package/dist/standards/engine/engine.js.map +0 -1
- package/dist/standards/engine/reporter.js.map +0 -1
- package/dist/standards/index.js.map +0 -1
- package/dist/standards/registry/registry.js.map +0 -1
- package/dist/standards/schema/types.js.map +0 -1
- package/dist/standards/schema/validate.js.map +0 -1
- package/dist/standards/templates/index.js.map +0 -1
- package/dist/standards/validators/database.js.map +0 -1
- package/dist/standards/validators/quality.js.map +0 -1
- package/dist/standards/validators/registry.js.map +0 -1
- package/dist/standards/validators/security.js.map +0 -1
- package/dist/standards/validators/testing.js.map +0 -1
- package/dist/standards/validators/types.js.map +0 -1
- package/dist/standards/validators/undo-kit.js.map +0 -1
- package/dist/tasks/routing.js.map +0 -1
- package/dist/tasks/task.js.map +0 -1
- package/dist/utils/cleanup.js.map +0 -1
- package/dist/utils/fs.js.map +0 -1
- package/dist/utils/lock.js.map +0 -1
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/paths.js.map +0 -1
- package/dist/utils/proc.js.map +0 -1
- package/dist/verification/safety.js.map +0 -1
- package/dist/verification/scope.js.map +0 -1
package/dist/cli/run.js
CHANGED
|
@@ -4,10 +4,17 @@ import { packageVersion } from '../core/version.js';
|
|
|
4
4
|
import { createLogger } from '../utils/logger.js';
|
|
5
5
|
import { bool, int, isCheckOrDryRun, list, parseCli, str } from './args.js';
|
|
6
6
|
import { COMMANDS, commandHelp, topHelp } from './help.js';
|
|
7
|
-
import { makeStyle, renderAgentInstall, renderAgentList, renderAnalyze, renderContext, renderTaskContext, renderDoctor, renderExport, renderImport, renderInit, renderIntegrationsStatus, renderSetup, renderMcpSetup, renderMigrate, renderRefresh, renderReset, renderStatus, renderTask, renderTaskBrief, renderTaskRun, renderFeature, renderFeatureList, renderFeatureValidation, renderGraphStatus, renderGraphTrace, renderGraphGenerate,
|
|
7
|
+
import { makeStyle, renderAgentInstall, renderAgentList, renderAnalyze, renderContext, renderTaskContext, renderDoctor, renderExport, renderImport, renderInit, renderIntegrationsStatus, renderSetup, renderMcpSetup, renderMigrate, renderRefresh, renderReset, renderStatus, renderTask, renderTaskBrief, renderTaskRun, renderFeature, renderFeatureList, renderFeatureValidation, renderGraphStatus, renderGraphTrace, renderGraphGenerate, renderGuidedPreview, renderGuidedSetup, renderSettingsSummary, renderModulesList, renderModuleDetail, renderModuleToggle, renderModuleConfigure, } from './render.js';
|
|
8
|
+
import { createReadlinePromptAdapter } from './prompt.js';
|
|
9
|
+
import { PRESET_DESCRIPTIONS, SETUP_PRESETS, defaultSettingsForPreset, loadWorkspaceSettingsSafe, saveWorkspaceSettings, } from '../config/settings.js';
|
|
10
|
+
import { getSettingsSummary } from '../services/settings.js';
|
|
11
|
+
import { assertModuleEnabled } from '../config/feature-gate.js';
|
|
12
|
+
import { configureModuleService, disableModuleService, enableModuleService, listModulesService, showModuleService, } from '../services/modules.js';
|
|
8
13
|
import { listFeaturesService, getFeatureService, validateFeatureMapService, saveFeatureService } from '../services/features.js';
|
|
9
14
|
import { generateOfflineGraphService, getGraphStatusService, traceGraphService } from '../services/graph.js';
|
|
10
15
|
import { setupProject } from '../services/setup.js';
|
|
16
|
+
import { applyGuidedSetup, detectSetupAgents, planGuidedSetup } from '../dx/guided-setup.js';
|
|
17
|
+
import { wsPaths } from '../core/workspace.js';
|
|
11
18
|
import { startMcpServer } from '../mcp/server.js';
|
|
12
19
|
import { setupMcpAgent } from '../mcp/setup.js';
|
|
13
20
|
import { findWorkspaceRoot } from '../core/workspace.js';
|
|
@@ -119,12 +126,276 @@ async function runAgentSetup(c, cwd, agent) {
|
|
|
119
126
|
c.err(` ${c.style.sym.arrow} ${dry ? 'Planning (nothing is written)' : 'Writing configuration'}${verify ? ', then starting the MCP server and testing its tools (a first npx run may download the package)' : ''}...
|
|
120
127
|
`);
|
|
121
128
|
const r = await setupMcpAgent({ ...opts, check: dry, verify });
|
|
129
|
+
if (!dry && r.conflicts === 0 && (await findWorkspaceRoot(path.resolve(target ?? process.cwd())))) {
|
|
130
|
+
const ws = wsPaths(await findWorkspaceRoot(path.resolve(target ?? process.cwd())));
|
|
131
|
+
const cur = await loadWorkspaceSettingsSafe(ws);
|
|
132
|
+
await saveWorkspaceSettings(ws, defaultSettingsForPreset(cur.settings.preset === 'minimal' ? 'recommended' : cur.settings.preset, {
|
|
133
|
+
agentSelected: r.agent,
|
|
134
|
+
agentMethod: 'mcp',
|
|
135
|
+
scope: bool(c.args.values, 'user') ? 'user' : 'project',
|
|
136
|
+
integrationsConsented: cur.settings.integrationsConsented,
|
|
137
|
+
source: 'cli',
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
122
140
|
c.data(r, renderMcpSetup(c.style, r));
|
|
123
141
|
if (r.verification && !r.verification.ok)
|
|
124
142
|
c.exit = EXIT.FAILURE;
|
|
125
143
|
else if (r.conflicts > 0)
|
|
126
144
|
c.exit = EXIT.WARNINGS;
|
|
127
145
|
}
|
|
146
|
+
const CUSTOM_CAPABILITY_OPTIONS = [
|
|
147
|
+
{ value: 'workflow.tasks', label: 'Task & Verification Tracking', description: 'track active tasks and verification evidence' },
|
|
148
|
+
{ value: 'workflow.decisions', label: 'Architecture Decisions', description: 'record short decision records in .devworkspace/decisions/' },
|
|
149
|
+
{ value: 'workflow.standards', label: 'Engineering Standards', description: 'audit project code/testing/database hygiene' },
|
|
150
|
+
{ value: 'intelligence.features', label: 'Feature Maps', description: 'link routes, services, models, and tests' },
|
|
151
|
+
{ value: 'intelligence.graph', label: 'Offline Dependency Graph', description: 'static TypeScript/Python symbol graph tracing' },
|
|
152
|
+
{ value: 'intelligence.orchestration', label: 'Multi-Agent Orchestration', description: 'scoped execution plans with explicit approvals' },
|
|
153
|
+
{ value: 'dx.dashboard', label: 'Local HTML Dashboard', description: 'generate offline accessible project overview HTML' },
|
|
154
|
+
];
|
|
155
|
+
const INTEGRATION_CHOICES = [
|
|
156
|
+
{ value: 'graphify', label: 'Graphify', description: 'optional code knowledge graph helper (requires Python 3.10+/uv/pipx)' },
|
|
157
|
+
{ value: 'agent-skills', label: 'Agent Skills', description: 'optional workflow skills via Claude plugin or npx' },
|
|
158
|
+
{ value: 'ponytail', label: 'Ponytail', description: 'optional code quality helper plugin' },
|
|
159
|
+
{ value: 'omniroute', label: 'OmniRoute', description: 'optional local AI router integration' },
|
|
160
|
+
];
|
|
161
|
+
function parseCommaList(v, key) {
|
|
162
|
+
return list(v, key)
|
|
163
|
+
.flatMap((entry) => entry.split(','))
|
|
164
|
+
.map((s) => s.trim())
|
|
165
|
+
.filter(Boolean);
|
|
166
|
+
}
|
|
167
|
+
async function runInteractiveSetupWizard(c, forceEdit = false) {
|
|
168
|
+
const v = c.args.values;
|
|
169
|
+
const dry = isCheckOrDryRun(v);
|
|
170
|
+
const prompt = c.io.prompt ?? createReadlinePromptAdapter((s) => c.io.stderr(s));
|
|
171
|
+
const cwd = c.svc.cwd ?? process.cwd();
|
|
172
|
+
const root = await findWorkspaceRoot(cwd);
|
|
173
|
+
const existingSettings = root ? (await loadWorkspaceSettingsSafe(wsPaths(root))).settings : null;
|
|
174
|
+
c.err(`\n${c.style.bold('Welcome to DevWorkspace')}\n`);
|
|
175
|
+
c.err('Give your coding agent reliable project context and verification guidance.\n');
|
|
176
|
+
let preset = str(v, 'preset')
|
|
177
|
+
?? (forceEdit && existingSettings ? existingSettings.preset : 'recommended');
|
|
178
|
+
if (!SETUP_PRESETS.includes(preset)) {
|
|
179
|
+
throw new DevWorkspaceError('USAGE', `--preset must be one of: ${SETUP_PRESETS.join(', ')}.`);
|
|
180
|
+
}
|
|
181
|
+
let selectedAgent = str(v, 'agent') ?? (existingSettings?.agent.selected ?? 'auto');
|
|
182
|
+
let selectedScope = bool(v, 'user') || str(v, 'scope') === 'user' ? 'user' : 'project';
|
|
183
|
+
let customFeatures = parseCommaList(v, 'features');
|
|
184
|
+
let optedIntegrations = parseCommaList(v, 'only');
|
|
185
|
+
let consentExternal = bool(v, 'yes');
|
|
186
|
+
const detectedAgents = await detectSetupAgents(cwd, c.svc.homeDir);
|
|
187
|
+
let step = 1;
|
|
188
|
+
while (step <= 4) {
|
|
189
|
+
if (step === 1) {
|
|
190
|
+
const choice = await prompt.selectOne('Choose your setup:', SETUP_PRESETS.map((id) => ({
|
|
191
|
+
value: id,
|
|
192
|
+
label: PRESET_DESCRIPTIONS[id].title,
|
|
193
|
+
description: PRESET_DESCRIPTIONS[id].summary,
|
|
194
|
+
})), preset, false);
|
|
195
|
+
if (choice === 'CANCEL') {
|
|
196
|
+
c.out(`${c.style.sym.info} Setup cancelled. No changes were written.`);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (choice !== 'BACK') {
|
|
200
|
+
preset = choice;
|
|
201
|
+
step = preset === 'minimal' ? 4 : 2;
|
|
202
|
+
if (preset === 'minimal') {
|
|
203
|
+
selectedAgent = 'none';
|
|
204
|
+
selectedScope = 'project';
|
|
205
|
+
optedIntegrations = [];
|
|
206
|
+
consentExternal = false;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
else if (step === 2) {
|
|
211
|
+
const detectedProj = detectedAgents.filter((a) => a.detected && a.scope === 'project');
|
|
212
|
+
const autoLabel = detectedProj.length === 1
|
|
213
|
+
? `Auto-detect (found ${detectedProj[0].id})`
|
|
214
|
+
: detectedProj.length > 1
|
|
215
|
+
? `Multiple agents detected (${detectedProj.map((d) => d.id).join(', ')}) — pick one below`
|
|
216
|
+
: 'Claude Code (default MCP)';
|
|
217
|
+
const agentOptions = [
|
|
218
|
+
...(detectedProj.length === 1 ? [{ value: 'auto', label: autoLabel }] : []),
|
|
219
|
+
...detectedAgents.map((a) => ({
|
|
220
|
+
value: a.id,
|
|
221
|
+
label: `${a.label}${a.detected ? ' [detected]' : ''}`,
|
|
222
|
+
description: a.scope === 'user' ? 'user-level config' : 'project-level config',
|
|
223
|
+
})),
|
|
224
|
+
{ value: 'none', label: 'Skip for now', description: 'initialize workspace only without configuring an agent' },
|
|
225
|
+
];
|
|
226
|
+
const defAgent = detectedProj.length === 1 ? 'auto' : selectedAgent === 'auto' ? 'none' : selectedAgent;
|
|
227
|
+
const choice = await prompt.selectOne('Coding agent:', agentOptions, defAgent, true);
|
|
228
|
+
if (choice === 'CANCEL') {
|
|
229
|
+
c.out(`${c.style.sym.info} Setup cancelled. No changes were written.`);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
if (choice === 'BACK') {
|
|
233
|
+
step = 1;
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
selectedAgent = choice;
|
|
237
|
+
if (selectedAgent === 'antigravity') {
|
|
238
|
+
const allowUser = await prompt.confirm('Antigravity stores MCP config at user scope (~/.gemini/...). Allow writing user-level config?', false);
|
|
239
|
+
if (allowUser === 'CANCEL') {
|
|
240
|
+
c.out(`${c.style.sym.info} Setup cancelled. No changes were written.`);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (allowUser === 'BACK')
|
|
244
|
+
continue;
|
|
245
|
+
selectedScope = allowUser ? 'user' : 'project';
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
selectedScope = 'project';
|
|
249
|
+
}
|
|
250
|
+
step = preset === 'full' || preset === 'custom' ? 3 : 4;
|
|
251
|
+
}
|
|
252
|
+
else if (step === 3) {
|
|
253
|
+
if (preset === 'custom') {
|
|
254
|
+
if (prompt.selectMany) {
|
|
255
|
+
const picked = await prompt.selectMany('Select optional built-in capabilities (core security & context are always on):', CUSTOM_CAPABILITY_OPTIONS, customFeatures.length > 0 ? customFeatures : ['workflow.tasks', 'workflow.decisions'], true);
|
|
256
|
+
if (picked === 'CANCEL') {
|
|
257
|
+
c.out(`${c.style.sym.info} Setup cancelled. No changes were written.`);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (picked === 'BACK') {
|
|
261
|
+
step = 2;
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
customFeatures = picked;
|
|
265
|
+
}
|
|
266
|
+
else if (customFeatures.length === 0) {
|
|
267
|
+
customFeatures = ['workflow.tasks', 'workflow.decisions'];
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
if (prompt.selectMany) {
|
|
271
|
+
const pickedTools = await prompt.selectMany('Optional third-party tools (require your explicit consent; press Enter to skip):', INTEGRATION_CHOICES, optedIntegrations, true);
|
|
272
|
+
if (pickedTools === 'CANCEL') {
|
|
273
|
+
c.out(`${c.style.sym.info} Setup cancelled. No changes were written.`);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (pickedTools === 'BACK') {
|
|
277
|
+
step = 2;
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
optedIntegrations = pickedTools;
|
|
281
|
+
if (optedIntegrations.length > 0) {
|
|
282
|
+
const okInstall = await prompt.confirm(`Consent to run third-party installation/checks for: ${optedIntegrations.join(', ')}?`, false);
|
|
283
|
+
if (okInstall === 'CANCEL') {
|
|
284
|
+
c.out(`${c.style.sym.info} Setup cancelled. No changes were written.`);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (okInstall === 'BACK')
|
|
288
|
+
continue;
|
|
289
|
+
consentExternal = Boolean(okInstall);
|
|
290
|
+
if (!okInstall)
|
|
291
|
+
optedIntegrations = [];
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
step = 4;
|
|
295
|
+
}
|
|
296
|
+
else if (step === 4) {
|
|
297
|
+
const guidedOpts = {
|
|
298
|
+
...c.svc,
|
|
299
|
+
dryRun: dry,
|
|
300
|
+
preset,
|
|
301
|
+
agent: selectedAgent,
|
|
302
|
+
features: customFeatures,
|
|
303
|
+
onlyIntegrations: optedIntegrations,
|
|
304
|
+
consentExternalInstalls: consentExternal,
|
|
305
|
+
scope: selectedScope,
|
|
306
|
+
user: selectedScope === 'user',
|
|
307
|
+
noVerify: bool(v, 'no-verify'),
|
|
308
|
+
launcher: str(v, 'launcher'),
|
|
309
|
+
packageVersion: str(v, 'package-version'),
|
|
310
|
+
source: 'wizard',
|
|
311
|
+
};
|
|
312
|
+
const preview = await planGuidedSetup(guidedOpts);
|
|
313
|
+
c.err(renderGuidedPreview(c.style, preview) + '\n');
|
|
314
|
+
const confirmed = await prompt.confirm(dry ? 'Show dry-run result?' : 'Apply this setup?', true);
|
|
315
|
+
if (confirmed === 'BACK') {
|
|
316
|
+
step = preset === 'minimal' ? 1 : preset === 'recommended' ? 2 : 3;
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
if (confirmed !== true) {
|
|
320
|
+
c.out(`${c.style.sym.info} Setup cancelled. No changes were written.`);
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
const res = await applyGuidedSetup(guidedOpts);
|
|
324
|
+
c.data(res, renderGuidedSetup(c.style, res));
|
|
325
|
+
if (res.doctor && !res.doctor.healthy)
|
|
326
|
+
c.exit = EXIT.FAILURE;
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
async function runDeterministicGuidedSetup(c, forceEdit = false) {
|
|
332
|
+
const v = c.args.values;
|
|
333
|
+
const cwd = c.svc.cwd ?? process.cwd();
|
|
334
|
+
const root = await findWorkspaceRoot(cwd);
|
|
335
|
+
const existing = root ? (await loadWorkspaceSettingsSafe(wsPaths(root))).settings : null;
|
|
336
|
+
const explicitPreset = str(v, 'preset');
|
|
337
|
+
const rawPreset = explicitPreset ?? (forceEdit && existing ? existing.preset : 'minimal');
|
|
338
|
+
if (!SETUP_PRESETS.includes(rawPreset)) {
|
|
339
|
+
throw new DevWorkspaceError('USAGE', `--preset must be one of: ${SETUP_PRESETS.join(', ')}.`);
|
|
340
|
+
}
|
|
341
|
+
const preset = rawPreset;
|
|
342
|
+
const scope = bool(v, 'user') || bool(v, 'scope') ? scopeOf(v) : (forceEdit && existing ? existing.agent.scope : 'project');
|
|
343
|
+
const explicitUser = bool(v, 'user') || scope === 'user';
|
|
344
|
+
const onlyIntegrations = parseCommaList(v, 'only');
|
|
345
|
+
const rawFeatures = parseCommaList(v, 'features');
|
|
346
|
+
const features = rawFeatures.length > 0 ? rawFeatures : (forceEdit && existing && preset === 'custom' && !explicitPreset ? existing.enabledFeatures : []);
|
|
347
|
+
const yes = bool(v, 'yes');
|
|
348
|
+
if (onlyIntegrations.length > 0 && !yes && !isCheckOrDryRun(v)) {
|
|
349
|
+
throw new DevWorkspaceError('USAGE', `External tools (${onlyIntegrations.join(', ')}) require explicit --yes consent in non-interactive mode.`, { hint: 'Pass --dry-run to preview, or add --yes to authorize external installation.' });
|
|
350
|
+
}
|
|
351
|
+
if (explicitUser && !yes && !isCheckOrDryRun(v)) {
|
|
352
|
+
throw new DevWorkspaceError('USAGE', 'User-level configuration writes require explicit --yes consent in non-interactive mode.', { hint: 'Pass --dry-run to preview, or add --yes alongside --user / --scope user.' });
|
|
353
|
+
}
|
|
354
|
+
let agent = str(v, 'agent');
|
|
355
|
+
if (!agent) {
|
|
356
|
+
if (forceEdit && existing && !explicitPreset) {
|
|
357
|
+
agent = existing.agent.selected ?? 'none';
|
|
358
|
+
}
|
|
359
|
+
else if (preset === 'minimal') {
|
|
360
|
+
agent = 'none';
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
const candidates = (await detectSetupAgents(cwd, c.svc.homeDir)).filter((cand) => cand.detected && cand.scope === 'project');
|
|
364
|
+
if (candidates.length > 1) {
|
|
365
|
+
throw new DevWorkspaceError('USAGE', `Multiple coding agents detected (${candidates.map((x) => x.id).join(', ')}). Specify --agent <id> cleanly in non-interactive mode.`, { hint: `Run with one of: ${candidates.map((x) => `--agent ${x.id}`).join(', ')}` });
|
|
366
|
+
}
|
|
367
|
+
agent = candidates.length === 1 ? candidates[0].id : 'none';
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
else if (agent === 'auto') {
|
|
371
|
+
const candidates = (await detectSetupAgents(cwd, c.svc.homeDir)).filter((cand) => cand.detected && cand.scope === 'project');
|
|
372
|
+
if (candidates.length > 1) {
|
|
373
|
+
throw new DevWorkspaceError('USAGE', `Ambiguous agent auto-detection (${candidates.map((x) => x.id).join(', ')}). Pass explicit --agent <id>.`);
|
|
374
|
+
}
|
|
375
|
+
agent = candidates.length === 1 ? candidates[0].id : 'none';
|
|
376
|
+
}
|
|
377
|
+
const res = await applyGuidedSetup({
|
|
378
|
+
...c.svc,
|
|
379
|
+
dryRun: isCheckOrDryRun(v),
|
|
380
|
+
preset,
|
|
381
|
+
agent,
|
|
382
|
+
features,
|
|
383
|
+
onlyIntegrations,
|
|
384
|
+
consentExternalInstalls: yes,
|
|
385
|
+
scope: explicitUser ? 'user' : scope,
|
|
386
|
+
user: explicitUser,
|
|
387
|
+
noVerify: bool(v, 'no-verify'),
|
|
388
|
+
launcher: str(v, 'launcher'),
|
|
389
|
+
packageVersion: str(v, 'package-version'),
|
|
390
|
+
edit: forceEdit,
|
|
391
|
+
source: 'cli',
|
|
392
|
+
});
|
|
393
|
+
c.data(res, renderGuidedSetup(c.style, res));
|
|
394
|
+
if (res.doctor && !res.doctor.healthy)
|
|
395
|
+
c.exit = EXIT.FAILURE;
|
|
396
|
+
else if (bool(v, 'strict') && res.doctor && res.doctor.counts.warn > 0)
|
|
397
|
+
c.exit = EXIT.WARNINGS;
|
|
398
|
+
}
|
|
128
399
|
const handlers = {
|
|
129
400
|
async init(c) {
|
|
130
401
|
const withInt = bool(c.args.values, 'with-integrations');
|
|
@@ -141,21 +412,85 @@ const handlers = {
|
|
|
141
412
|
await runAgentSetup(c, r.root, agent);
|
|
142
413
|
},
|
|
143
414
|
async setup(c) {
|
|
144
|
-
const
|
|
145
|
-
|
|
415
|
+
const v = c.args.values;
|
|
416
|
+
const agent = str(v, 'agent');
|
|
417
|
+
const preset = str(v, 'preset');
|
|
418
|
+
const features = parseCommaList(v, 'features');
|
|
419
|
+
const edit = bool(v, 'edit');
|
|
420
|
+
const only = parseCommaList(v, 'only');
|
|
421
|
+
if (bool(v, 'integrations')) {
|
|
422
|
+
await runSetupCommand(c, false);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
// Preserve explicit legacy `devworkspace setup --agent <id>` fast path when no preset/edit/wizard flags used
|
|
426
|
+
if (agent && !preset && features.length === 0 && !edit && only.length === 0) {
|
|
146
427
|
await runAgentSetup(c, undefined, agent);
|
|
147
428
|
return;
|
|
148
429
|
}
|
|
149
|
-
|
|
150
|
-
|
|
430
|
+
const canInteractive = c.io.isTTY &&
|
|
431
|
+
!c.json &&
|
|
432
|
+
!bool(v, 'yes') &&
|
|
433
|
+
!bool(v, 'non-interactive') &&
|
|
434
|
+
!c.io.env.CI &&
|
|
435
|
+
!preset &&
|
|
436
|
+
features.length === 0 &&
|
|
437
|
+
only.length === 0;
|
|
438
|
+
if (canInteractive || (bool(v, 'interactive') && c.io.isTTY && !c.json)) {
|
|
439
|
+
await runInteractiveSetupWizard(c, edit);
|
|
151
440
|
return;
|
|
152
441
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
442
|
+
// Non-interactive bare `devworkspace setup` (or explicit guided flags): persist Minimal preset deterministically by default
|
|
443
|
+
await runDeterministicGuidedSetup(c, edit);
|
|
444
|
+
},
|
|
445
|
+
async settings(c) {
|
|
446
|
+
const sub = c.rest[0] ?? 'show';
|
|
447
|
+
if (sub === 'show') {
|
|
448
|
+
const summary = await getSettingsSummary(c.svc);
|
|
449
|
+
c.data(summary, renderSettingsSummary(c.style, summary));
|
|
450
|
+
}
|
|
451
|
+
else if (sub === 'edit') {
|
|
452
|
+
c.args.values.edit = true;
|
|
453
|
+
await handlers.setup(c);
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
throw new DevWorkspaceError('USAGE', `Unknown settings subcommand "${sub}".`, {
|
|
457
|
+
hint: 'Use: devworkspace settings [show|edit] [--json]',
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
async modules(c) {
|
|
462
|
+
const v = c.args.values;
|
|
463
|
+
const sub = c.rest[0] ?? 'list';
|
|
464
|
+
if (sub === 'list') {
|
|
465
|
+
const res = await listModulesService(c.svc);
|
|
466
|
+
c.data(res, renderModulesList(c.style, res));
|
|
467
|
+
}
|
|
468
|
+
else if (sub === 'show') {
|
|
469
|
+
const id = need(c.rest[1] ?? str(v, 'id'), 'module id (positional)');
|
|
470
|
+
const res = await showModuleService(c.svc, id);
|
|
471
|
+
c.data(res, renderModuleDetail(c.style, res));
|
|
472
|
+
}
|
|
473
|
+
else if (sub === 'enable') {
|
|
474
|
+
const id = need(c.rest[1] ?? str(v, 'id'), 'module id (positional)');
|
|
475
|
+
const res = await enableModuleService(c.svc, id, { yes: bool(v, 'yes') });
|
|
476
|
+
c.data(res, renderModuleToggle(c.style, res));
|
|
477
|
+
}
|
|
478
|
+
else if (sub === 'disable') {
|
|
479
|
+
const id = need(c.rest[1] ?? str(v, 'id'), 'module id (positional)');
|
|
480
|
+
const res = await disableModuleService(c.svc, id, { force: bool(v, 'force') });
|
|
481
|
+
c.data(res, renderModuleToggle(c.style, res));
|
|
482
|
+
}
|
|
483
|
+
else if (sub === 'configure') {
|
|
484
|
+
const id = need(c.rest[1] ?? str(v, 'id'), 'module id (positional)');
|
|
485
|
+
const key = need(str(v, 'key'), 'key (--key <name>)');
|
|
486
|
+
const value = need(str(v, 'value'), 'value (--value <val>)');
|
|
487
|
+
const res = await configureModuleService(c.svc, id, key, value);
|
|
488
|
+
c.data(res, renderModuleConfigure(c.style, res));
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
throw new DevWorkspaceError('USAGE', `Unknown modules subcommand "${sub}".`, {
|
|
492
|
+
hint: 'Use: devworkspace modules list | show <id> | enable <id> | disable <id> | configure <id> --key <k> --value <v>',
|
|
493
|
+
});
|
|
159
494
|
}
|
|
160
495
|
},
|
|
161
496
|
async mcp(c) {
|
|
@@ -204,7 +539,11 @@ const handlers = {
|
|
|
204
539
|
await runSetupCommand(c, true);
|
|
205
540
|
}
|
|
206
541
|
else if (sub === 'status') {
|
|
207
|
-
const r = await integrationsStatus(c.svc, {
|
|
542
|
+
const r = await integrationsStatus(c.svc, {
|
|
543
|
+
deep: !bool(c.args.values, 'quick'),
|
|
544
|
+
restarted: bool(c.args.values, 'restarted'),
|
|
545
|
+
includeDisabled: bool(c.args.values, 'all') || bool(c.args.values, 'force'),
|
|
546
|
+
});
|
|
208
547
|
c.data(r, renderIntegrationsStatus(c.style, r));
|
|
209
548
|
if (bool(c.args.values, 'strict') && !r.summary.complete)
|
|
210
549
|
c.exit = EXIT.WARNINGS;
|
|
@@ -914,6 +1253,7 @@ const handlers = {
|
|
|
914
1253
|
c.data(report, renderGuidanceText(report));
|
|
915
1254
|
},
|
|
916
1255
|
async dashboard(c) {
|
|
1256
|
+
await assertModuleEnabled(c.svc.cwd, 'dx.dashboard', 'Local HTML dashboard');
|
|
917
1257
|
const v = c.args.values;
|
|
918
1258
|
const outPath = str(v, 'out');
|
|
919
1259
|
const includeStandards = !bool(v, 'no-standards');
|
|
@@ -929,7 +1269,7 @@ const handlers = {
|
|
|
929
1269
|
c.data({ filePath: res.filePath, bytes: res.bytes, localOnly: true, telemetryEnabled: false }, `${c.style.ok(c.style.sym.ok)} Local-only accessible dashboard written to ${res.filePath} (${res.bytes} bytes). Open locally in your browser.`);
|
|
930
1270
|
},
|
|
931
1271
|
};
|
|
932
|
-
const ALIASES = { tasks: 'task', standard: 'standards' };
|
|
1272
|
+
const ALIASES = { tasks: 'task', standard: 'standards', module: 'modules' };
|
|
933
1273
|
/** Run the CLI and return the process exit code. Never calls process.exit, so it is directly testable. */
|
|
934
1274
|
export async function run(argv, io = defaultIO()) {
|
|
935
1275
|
let debug = argv.includes('--debug');
|
|
@@ -948,11 +1288,20 @@ export async function run(argv, io = defaultIO()) {
|
|
|
948
1288
|
return EXIT.OK;
|
|
949
1289
|
}
|
|
950
1290
|
const [rawCmd, ...rest] = args.positionals;
|
|
951
|
-
|
|
1291
|
+
let cmd = rawCmd ? (ALIASES[rawCmd] ?? rawCmd) : undefined;
|
|
952
1292
|
if (rawCmd === 'tasks')
|
|
953
1293
|
rest.unshift('list');
|
|
954
|
-
|
|
955
|
-
|
|
1294
|
+
// Bare `devworkspace` in interactive TTY opens guided setup; non-TTY prints top-level help
|
|
1295
|
+
if (!cmd) {
|
|
1296
|
+
const allowBareWizard = io.isTTY && !json && !bool(v, 'help') && !bool(v, 'non-interactive') && !io.env.CI;
|
|
1297
|
+
if (!allowBareWizard) {
|
|
1298
|
+
io.stdout(topHelp(packageVersion()) + '\n');
|
|
1299
|
+
return EXIT.OK;
|
|
1300
|
+
}
|
|
1301
|
+
cmd = 'setup';
|
|
1302
|
+
}
|
|
1303
|
+
if (cmd === 'help') {
|
|
1304
|
+
const target = COMMANDS.find((c) => c.name === rest[0]);
|
|
956
1305
|
io.stdout((target ? commandHelp(target) : topHelp(packageVersion())) + '\n');
|
|
957
1306
|
return EXIT.OK;
|
|
958
1307
|
}
|
|
@@ -970,6 +1319,7 @@ export async function run(argv, io = defaultIO()) {
|
|
|
970
1319
|
args,
|
|
971
1320
|
rest,
|
|
972
1321
|
svc: { cwd, dryRun: bool(v, 'dry-run'), env: io.env, runner: io.runner, ...(io.env.DEVWORKSPACE_HOME ? { homeDir: io.env.DEVWORKSPACE_HOME } : {}) },
|
|
1322
|
+
io,
|
|
973
1323
|
json,
|
|
974
1324
|
style,
|
|
975
1325
|
exit: EXIT.OK,
|
|
@@ -994,4 +1344,3 @@ export async function run(argv, io = defaultIO()) {
|
|
|
994
1344
|
return isDevWorkspaceError(e) ? e.exitCode : EXIT.FAILURE;
|
|
995
1345
|
}
|
|
996
1346
|
}
|
|
997
|
-
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface CapabilityGateCheck {
|
|
2
|
+
moduleId: string;
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
reason?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Authoritative runtime capability resolver:
|
|
8
|
+
* - Core capabilities (canDisable === false) are ALWAYS enabled (and still verify valid settings if persisted).
|
|
9
|
+
* - When .devworkspace/settings.json exists, it is strictly validated before any gated capability executes.
|
|
10
|
+
* - Both the requested module AND all transitive dependencies must be enabled.
|
|
11
|
+
* - Legacy workspaces without settings.json preserve built-in modules safely until configured.
|
|
12
|
+
*/
|
|
13
|
+
export declare function checkModuleEnabled(cwd: string | undefined, moduleId: string): Promise<CapabilityGateCheck>;
|
|
14
|
+
/** Enforce runtime gating, throwing an actionable error when a disabled module is invoked. */
|
|
15
|
+
export declare function assertModuleEnabled(cwd: string | undefined, moduleId: string, actionDescription?: string): Promise<void>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { DevWorkspaceError } from '../errors/index.js';
|
|
3
|
+
import { findWorkspaceRoot, wsPaths } from '../core/workspace.js';
|
|
4
|
+
import { pathExists } from '../utils/fs.js';
|
|
5
|
+
import { getFeatureDefinition } from './feature-registry.js';
|
|
6
|
+
import { loadWorkspaceSettingsStrict } from './settings.js';
|
|
7
|
+
function findMissingTransitiveDependency(moduleId, enabledSet, disabledSet, visited = new Set()) {
|
|
8
|
+
if (visited.has(moduleId))
|
|
9
|
+
return null;
|
|
10
|
+
visited.add(moduleId);
|
|
11
|
+
const def = getFeatureDefinition(moduleId);
|
|
12
|
+
if (!def)
|
|
13
|
+
return moduleId;
|
|
14
|
+
for (const depId of def.requires) {
|
|
15
|
+
if (disabledSet.has(depId) || !enabledSet.has(depId))
|
|
16
|
+
return depId;
|
|
17
|
+
const nested = findMissingTransitiveDependency(depId, enabledSet, disabledSet, visited);
|
|
18
|
+
if (nested)
|
|
19
|
+
return nested;
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Authoritative runtime capability resolver:
|
|
25
|
+
* - Core capabilities (canDisable === false) are ALWAYS enabled (and still verify valid settings if persisted).
|
|
26
|
+
* - When .devworkspace/settings.json exists, it is strictly validated before any gated capability executes.
|
|
27
|
+
* - Both the requested module AND all transitive dependencies must be enabled.
|
|
28
|
+
* - Legacy workspaces without settings.json preserve built-in modules safely until configured.
|
|
29
|
+
*/
|
|
30
|
+
export async function checkModuleEnabled(cwd, moduleId) {
|
|
31
|
+
const def = getFeatureDefinition(moduleId);
|
|
32
|
+
if (!def) {
|
|
33
|
+
throw new DevWorkspaceError('USAGE', `Unknown module "${moduleId}".`);
|
|
34
|
+
}
|
|
35
|
+
const startDir = cwd ? path.resolve(cwd) : process.cwd();
|
|
36
|
+
const root = await findWorkspaceRoot(startDir);
|
|
37
|
+
if (!root) {
|
|
38
|
+
return { moduleId, enabled: true };
|
|
39
|
+
}
|
|
40
|
+
const ws = wsPaths(root);
|
|
41
|
+
if (!(await pathExists(ws.settings))) {
|
|
42
|
+
// Legacy workspace without persisted settings.json retains backwards-compatible built-in defaults
|
|
43
|
+
return { moduleId, enabled: true };
|
|
44
|
+
}
|
|
45
|
+
const loaded = await loadWorkspaceSettingsStrict(ws);
|
|
46
|
+
if (!def.canDisable) {
|
|
47
|
+
return { moduleId, enabled: true };
|
|
48
|
+
}
|
|
49
|
+
const enabledSet = new Set(loaded.settings.enabledFeatures);
|
|
50
|
+
const disabledSet = new Set(loaded.settings.disabledFeatures);
|
|
51
|
+
if (disabledSet.has(moduleId) || !enabledSet.has(moduleId)) {
|
|
52
|
+
return {
|
|
53
|
+
moduleId,
|
|
54
|
+
enabled: false,
|
|
55
|
+
reason: `Module "${moduleId}" (${def.name}) is disabled in .devworkspace/settings.json (preset: ${loaded.settings.preset}).`,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const missingDep = findMissingTransitiveDependency(moduleId, enabledSet, disabledSet);
|
|
59
|
+
if (missingDep) {
|
|
60
|
+
return {
|
|
61
|
+
moduleId,
|
|
62
|
+
enabled: false,
|
|
63
|
+
reason: `Module "${moduleId}" (${def.name}) cannot run because required dependency "${missingDep}" is disabled or missing.`,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return { moduleId, enabled: true };
|
|
67
|
+
}
|
|
68
|
+
/** Enforce runtime gating, throwing an actionable error when a disabled module is invoked. */
|
|
69
|
+
export async function assertModuleEnabled(cwd, moduleId, actionDescription) {
|
|
70
|
+
const check = await checkModuleEnabled(cwd, moduleId);
|
|
71
|
+
if (!check.enabled) {
|
|
72
|
+
const message = actionDescription ? `${check.reason} (${actionDescription})` : check.reason;
|
|
73
|
+
throw new DevWorkspaceError('USAGE', message, {
|
|
74
|
+
hint: `Enable this capability safely without losing existing data: devworkspace modules enable ${moduleId}`,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare const SETUP_PRESETS: readonly ["minimal", "recommended", "full", "custom"];
|
|
2
|
+
export type SetupPreset = (typeof SETUP_PRESETS)[number];
|
|
3
|
+
export type FeatureCategory = 'core' | 'agent' | 'workflow' | 'intelligence' | 'integration' | 'experience';
|
|
4
|
+
export type FeatureAvailability = 'core' | 'optional' | 'experimental';
|
|
5
|
+
export type FeatureInstallKind = 'bundled' | 'external-tool' | 'agent-config' | 'workspace-data';
|
|
6
|
+
export type FeatureDataPolicy = 'local-only' | 'external-tool-may-run';
|
|
7
|
+
export interface FeatureDefinition {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
category: FeatureCategory;
|
|
12
|
+
availability: FeatureAvailability;
|
|
13
|
+
defaultEnabled: boolean;
|
|
14
|
+
requires: readonly string[];
|
|
15
|
+
conflicts?: readonly string[];
|
|
16
|
+
prerequisites?: readonly string[];
|
|
17
|
+
installKind: FeatureInstallKind;
|
|
18
|
+
dataPolicy: FeatureDataPolicy;
|
|
19
|
+
canDisable: boolean;
|
|
20
|
+
preserveDataOnDisable: boolean;
|
|
21
|
+
entryPoints: readonly string[];
|
|
22
|
+
dataPaths: readonly string[];
|
|
23
|
+
configKeys?: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
export declare const FEATURE_REGISTRY: readonly FeatureDefinition[];
|
|
26
|
+
export declare function getFeatureDefinition(id: string, defs?: readonly FeatureDefinition[]): FeatureDefinition | undefined;
|
|
27
|
+
/** Validate registry uniqueness, references, conflict symmetry, and acyclicity. */
|
|
28
|
+
export declare function validateFeatureRegistry(defs?: readonly FeatureDefinition[]): void;
|
|
29
|
+
/** Deterministic topological ordering where every dependency precedes its dependents. */
|
|
30
|
+
export declare function topologicalSortFeatures(ids: readonly string[], defs?: readonly FeatureDefinition[]): string[];
|
|
31
|
+
export interface FeatureResolutionResult {
|
|
32
|
+
enabled: string[];
|
|
33
|
+
disabled: string[];
|
|
34
|
+
autoEnabledDependencies: string[];
|
|
35
|
+
autoDisabledDependents: string[];
|
|
36
|
+
disableOrder: string[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resolve requested enable/disable changes against dependencies, conflicts, and non-disableable core rules.
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveFeatureSelectionGraph(opts: {
|
|
42
|
+
requestedEnable?: readonly string[];
|
|
43
|
+
requestedDisable?: readonly string[];
|
|
44
|
+
currentEnabled?: readonly string[];
|
|
45
|
+
cascadeDisable?: boolean;
|
|
46
|
+
defs?: readonly FeatureDefinition[];
|
|
47
|
+
}): FeatureResolutionResult;
|
|
48
|
+
/** Deterministically derive built-in preset module lists from the authoritative registry. */
|
|
49
|
+
export declare function presetFeaturesFromRegistry(preset: Exclude<SetupPreset, 'custom'>): string[];
|