devworkspace 0.4.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +83 -0
- package/README.md +14 -6
- package/dist/cli/args.d.ts +37 -0
- package/dist/cli/args.js +12 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/help.js +141 -1
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/render.d.ts +8 -1
- package/dist/cli/render.js +124 -0
- package/dist/cli/render.js.map +1 -1
- package/dist/cli/run.js +364 -4
- package/dist/cli/run.js.map +1 -1
- package/dist/core/contracts.d.ts +70 -0
- package/dist/core/contracts.js +88 -0
- package/dist/core/contracts.js.map +1 -0
- package/dist/discovery/commands.d.ts +1 -1
- package/dist/discovery/commands.js.map +1 -1
- package/dist/discovery/detect.d.ts +2 -70
- package/dist/discovery/detect.js.map +1 -1
- package/dist/discovery/entrypoints.d.ts +2 -11
- package/dist/discovery/entrypoints.js.map +1 -1
- package/dist/discovery/types.d.ts +79 -0
- package/dist/discovery/types.js +2 -0
- package/dist/discovery/types.js.map +1 -0
- package/dist/dx/dashboard.d.ts +21 -0
- package/dist/dx/dashboard.js +274 -0
- package/dist/dx/dashboard.js.map +1 -0
- package/dist/dx/guidance.d.ts +21 -0
- package/dist/dx/guidance.js +266 -0
- package/dist/dx/guidance.js.map +1 -0
- package/dist/dx/index.d.ts +4 -0
- package/dist/dx/index.js +5 -0
- package/dist/dx/index.js.map +1 -0
- package/dist/dx/onboarding.d.ts +23 -0
- package/dist/dx/onboarding.js +155 -0
- package/dist/dx/onboarding.js.map +1 -0
- package/dist/dx/types.d.ts +70 -0
- package/dist/dx/types.js +3 -0
- package/dist/dx/types.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/dist/integrations/adapters/pluginSkill.js +15 -1
- package/dist/integrations/adapters/pluginSkill.js.map +1 -1
- package/dist/integrations/persistentPath.d.ts +2 -9
- package/dist/integrations/persistentPath.js.map +1 -1
- package/dist/integrations/types.d.ts +4 -1
- package/dist/integrations/types.js.map +1 -1
- package/dist/intelligence/agents/profiles.d.ts +2 -0
- package/dist/intelligence/agents/profiles.js +326 -0
- package/dist/intelligence/agents/profiles.js.map +1 -0
- package/dist/intelligence/agents/registry.d.ts +15 -0
- package/dist/intelligence/agents/registry.js +108 -0
- package/dist/intelligence/agents/registry.js.map +1 -0
- package/dist/intelligence/agents/types.d.ts +43 -0
- package/dist/intelligence/agents/types.js +2 -0
- package/dist/intelligence/agents/types.js.map +1 -0
- package/dist/intelligence/observability/tracer.d.ts +13 -0
- package/dist/intelligence/observability/tracer.js +129 -0
- package/dist/intelligence/observability/tracer.js.map +1 -0
- package/dist/intelligence/observability/types.d.ts +38 -0
- package/dist/intelligence/observability/types.js +2 -0
- package/dist/intelligence/observability/types.js.map +1 -0
- package/dist/intelligence/orchestration/engine.d.ts +42 -0
- package/dist/intelligence/orchestration/engine.js +418 -0
- package/dist/intelligence/orchestration/engine.js.map +1 -0
- package/dist/intelligence/orchestration/lock-manager.d.ts +21 -0
- package/dist/intelligence/orchestration/lock-manager.js +70 -0
- package/dist/intelligence/orchestration/lock-manager.js.map +1 -0
- package/dist/intelligence/orchestration/store.d.ts +11 -0
- package/dist/intelligence/orchestration/store.js +73 -0
- package/dist/intelligence/orchestration/store.js.map +1 -0
- package/dist/intelligence/orchestration/types.d.ts +100 -0
- package/dist/intelligence/orchestration/types.js +48 -0
- package/dist/intelligence/orchestration/types.js.map +1 -0
- package/dist/intelligence/routing/matcher.d.ts +7 -0
- package/dist/intelligence/routing/matcher.js +96 -0
- package/dist/intelligence/routing/matcher.js.map +1 -0
- package/dist/intelligence/routing/router.d.ts +9 -0
- package/dist/intelligence/routing/router.js +198 -0
- package/dist/intelligence/routing/router.js.map +1 -0
- package/dist/intelligence/routing/types.d.ts +64 -0
- package/dist/intelligence/routing/types.js +2 -0
- package/dist/intelligence/routing/types.js.map +1 -0
- package/dist/intelligence/runtime/adk/adapter.d.ts +7 -0
- package/dist/intelligence/runtime/adk/adapter.js +60 -0
- package/dist/intelligence/runtime/adk/adapter.js.map +1 -0
- package/dist/intelligence/runtime/adk/detector.d.ts +7 -0
- package/dist/intelligence/runtime/adk/detector.js +28 -0
- package/dist/intelligence/runtime/adk/detector.js.map +1 -0
- package/dist/intelligence/runtime/external.d.ts +9 -0
- package/dist/intelligence/runtime/external.js +102 -0
- package/dist/intelligence/runtime/external.js.map +1 -0
- package/dist/intelligence/runtime/native.d.ts +19 -0
- package/dist/intelligence/runtime/native.js +99 -0
- package/dist/intelligence/runtime/native.js.map +1 -0
- package/dist/intelligence/runtime/types.d.ts +49 -0
- package/dist/intelligence/runtime/types.js +2 -0
- package/dist/intelligence/runtime/types.js.map +1 -0
- package/dist/intelligence/security/audit.d.ts +8 -0
- package/dist/intelligence/security/audit.js +43 -0
- package/dist/intelligence/security/audit.js.map +1 -0
- package/dist/intelligence/security/policy.d.ts +12 -0
- package/dist/intelligence/security/policy.js +153 -0
- package/dist/intelligence/security/policy.js.map +1 -0
- package/dist/intelligence/security/types.d.ts +25 -0
- package/dist/intelligence/security/types.js +2 -0
- package/dist/intelligence/security/types.js.map +1 -0
- package/dist/intelligence/skills/builtins.d.ts +2 -0
- package/dist/intelligence/skills/builtins.js +379 -0
- package/dist/intelligence/skills/builtins.js.map +1 -0
- package/dist/intelligence/skills/loader.d.ts +4 -0
- package/dist/intelligence/skills/loader.js +84 -0
- package/dist/intelligence/skills/loader.js.map +1 -0
- package/dist/intelligence/skills/registry.d.ts +15 -0
- package/dist/intelligence/skills/registry.js +134 -0
- package/dist/intelligence/skills/registry.js.map +1 -0
- package/dist/intelligence/skills/types.d.ts +35 -0
- package/dist/intelligence/skills/types.js +2 -0
- package/dist/intelligence/skills/types.js.map +1 -0
- package/dist/intelligence/verification/engine.d.ts +23 -0
- package/dist/intelligence/verification/engine.js +66 -0
- package/dist/intelligence/verification/engine.js.map +1 -0
- package/dist/intelligence/verification/reviewer.d.ts +8 -0
- package/dist/intelligence/verification/reviewer.js +55 -0
- package/dist/intelligence/verification/reviewer.js.map +1 -0
- package/dist/intelligence/verification/types.d.ts +32 -0
- package/dist/intelligence/verification/types.js +2 -0
- package/dist/intelligence/verification/types.js.map +1 -0
- package/dist/mcp/setup.d.ts +23 -4
- package/dist/mcp/setup.js +107 -22
- package/dist/mcp/setup.js.map +1 -1
- package/dist/mcp/tools.js +6 -6
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/types.d.ts +4 -0
- package/dist/mcp/types.js.map +1 -1
- package/dist/mcp/verify.d.ts +1 -1
- package/dist/mcp/verify.js +45 -10
- package/dist/mcp/verify.js.map +1 -1
- package/dist/security/redact.js +3 -2
- package/dist/security/redact.js.map +1 -1
- package/dist/services/doctor.js +4 -0
- package/dist/services/doctor.js.map +1 -1
- package/dist/services/graph.d.ts +21 -0
- package/dist/services/graph.js +222 -3
- package/dist/services/graph.js.map +1 -1
- package/dist/services/intelligence.d.ts +44 -0
- package/dist/services/intelligence.js +119 -0
- package/dist/services/intelligence.js.map +1 -0
- package/dist/services/standards.d.ts +85 -0
- package/dist/services/standards.js +230 -0
- package/dist/services/standards.js.map +1 -0
- package/dist/services/taskContext.js +4 -0
- package/dist/services/taskContext.js.map +1 -1
- package/dist/standards/acquisition/ingest.d.ts +12 -0
- package/dist/standards/acquisition/ingest.js +98 -0
- package/dist/standards/acquisition/ingest.js.map +1 -0
- package/dist/standards/applicability/engine.d.ts +38 -0
- package/dist/standards/applicability/engine.js +250 -0
- package/dist/standards/applicability/engine.js.map +1 -0
- package/dist/standards/builtin/code-quality.d.ts +2 -0
- package/dist/standards/builtin/code-quality.js +53 -0
- package/dist/standards/builtin/code-quality.js.map +1 -0
- package/dist/standards/builtin/database-safety.d.ts +2 -0
- package/dist/standards/builtin/database-safety.js +56 -0
- package/dist/standards/builtin/database-safety.js.map +1 -0
- package/dist/standards/builtin/index.d.ts +8 -0
- package/dist/standards/builtin/index.js +14 -0
- package/dist/standards/builtin/index.js.map +1 -0
- package/dist/standards/builtin/security-baseline.d.ts +2 -0
- package/dist/standards/builtin/security-baseline.js +64 -0
- package/dist/standards/builtin/security-baseline.js.map +1 -0
- package/dist/standards/builtin/testing-contracts.d.ts +2 -0
- package/dist/standards/builtin/testing-contracts.js +54 -0
- package/dist/standards/builtin/testing-contracts.js.map +1 -0
- package/dist/standards/builtin/undo-kit.d.ts +8 -0
- package/dist/standards/builtin/undo-kit.js +106 -0
- package/dist/standards/builtin/undo-kit.js.map +1 -0
- package/dist/standards/config/config.d.ts +12 -0
- package/dist/standards/config/config.js +110 -0
- package/dist/standards/config/config.js.map +1 -0
- package/dist/standards/distribution/cache.d.ts +57 -0
- package/dist/standards/distribution/cache.js +411 -0
- package/dist/standards/distribution/cache.js.map +1 -0
- package/dist/standards/distribution/index.d.ts +6 -0
- package/dist/standards/distribution/index.js +7 -0
- package/dist/standards/distribution/index.js.map +1 -0
- package/dist/standards/distribution/keys.d.ts +53 -0
- package/dist/standards/distribution/keys.js +269 -0
- package/dist/standards/distribution/keys.js.map +1 -0
- package/dist/standards/distribution/package.d.ts +25 -0
- package/dist/standards/distribution/package.js +248 -0
- package/dist/standards/distribution/package.js.map +1 -0
- package/dist/standards/distribution/server.d.ts +38 -0
- package/dist/standards/distribution/server.js +204 -0
- package/dist/standards/distribution/server.js.map +1 -0
- package/dist/standards/distribution/sync.d.ts +51 -0
- package/dist/standards/distribution/sync.js +212 -0
- package/dist/standards/distribution/sync.js.map +1 -0
- package/dist/standards/distribution/types.d.ts +140 -0
- package/dist/standards/distribution/types.js +26 -0
- package/dist/standards/distribution/types.js.map +1 -0
- package/dist/standards/engine/compliance.d.ts +2 -0
- package/dist/standards/engine/compliance.js +45 -0
- package/dist/standards/engine/compliance.js.map +1 -0
- package/dist/standards/engine/engine.d.ts +14 -0
- package/dist/standards/engine/engine.js +114 -0
- package/dist/standards/engine/engine.js.map +1 -0
- package/dist/standards/engine/reporter.d.ts +2 -0
- package/dist/standards/engine/reporter.js +42 -0
- package/dist/standards/engine/reporter.js.map +1 -0
- package/dist/standards/index.d.ts +18 -0
- package/dist/standards/index.js +19 -0
- package/dist/standards/index.js.map +1 -0
- package/dist/standards/registry/registry.d.ts +29 -0
- package/dist/standards/registry/registry.js +210 -0
- package/dist/standards/registry/registry.js.map +1 -0
- package/dist/standards/schema/types.d.ts +133 -0
- package/dist/standards/schema/types.js +33 -0
- package/dist/standards/schema/types.js.map +1 -0
- package/dist/standards/schema/validate.d.ts +6 -0
- package/dist/standards/schema/validate.js +131 -0
- package/dist/standards/schema/validate.js.map +1 -0
- package/dist/standards/templates/index.d.ts +11 -0
- package/dist/standards/templates/index.js +176 -0
- package/dist/standards/templates/index.js.map +1 -0
- package/dist/standards/validators/database.d.ts +5 -0
- package/dist/standards/validators/database.js +122 -0
- package/dist/standards/validators/database.js.map +1 -0
- package/dist/standards/validators/quality.d.ts +6 -0
- package/dist/standards/validators/quality.js +91 -0
- package/dist/standards/validators/quality.js.map +1 -0
- package/dist/standards/validators/registry.d.ts +11 -0
- package/dist/standards/validators/registry.js +83 -0
- package/dist/standards/validators/registry.js.map +1 -0
- package/dist/standards/validators/security.d.ts +7 -0
- package/dist/standards/validators/security.js +182 -0
- package/dist/standards/validators/security.js.map +1 -0
- package/dist/standards/validators/testing.d.ts +6 -0
- package/dist/standards/validators/testing.js +142 -0
- package/dist/standards/validators/testing.js.map +1 -0
- package/dist/standards/validators/types.d.ts +11 -0
- package/dist/standards/validators/types.js +2 -0
- package/dist/standards/validators/types.js.map +1 -0
- package/dist/standards/validators/undo-kit.d.ts +7 -0
- package/dist/standards/validators/undo-kit.js +334 -0
- package/dist/standards/validators/undo-kit.js.map +1 -0
- package/dist/tasks/routing.js +5 -3
- package/dist/tasks/routing.js.map +1 -1
- package/dist/utils/fs.d.ts +1 -1
- package/dist/utils/fs.js.map +1 -1
- package/dist/utils/lock.js +11 -3
- package/dist/utils/lock.js.map +1 -1
- package/dist/utils/paths.js +29 -0
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/proc.js +21 -3
- package/dist/utils/proc.js.map +1 -1
- package/docs/contributing.md +9 -0
- package/docs/getting-started.md +7 -0
- package/docs/integrations.md +2 -2
- package/docs/mcp.md +8 -3
- package/docs/security/HOME_SERVER_THREAT_MODEL.md +72 -0
- package/docs/security/THREAT_MODEL.md +101 -0
- package/docs/standards.md +143 -0
- package/package.json +1 -1
package/dist/cli/run.js
CHANGED
|
@@ -4,9 +4,9 @@ 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, renderProjectSetup, } from './render.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, renderProjectSetup, } from './render.js';
|
|
8
8
|
import { listFeaturesService, getFeatureService, validateFeatureMapService, saveFeatureService } from '../services/features.js';
|
|
9
|
-
import { getGraphStatusService, traceGraphService } from '../services/graph.js';
|
|
9
|
+
import { generateOfflineGraphService, getGraphStatusService, traceGraphService } from '../services/graph.js';
|
|
10
10
|
import { setupProject } from '../services/setup.js';
|
|
11
11
|
import { startMcpServer } from '../mcp/server.js';
|
|
12
12
|
import { setupMcpAgent } from '../mcp/setup.js';
|
|
@@ -29,7 +29,12 @@ import { getStatus } from '../services/status.js';
|
|
|
29
29
|
import { declareTestEnv, listTestEnv, revokeTestEnv, runTaskCheck } from '../services/verify.js';
|
|
30
30
|
import { attestTask, createTask, listTasksService, recordTests, recordVerification, setTaskStatus, showTask, updateTask, } from '../services/tasks.js';
|
|
31
31
|
import { CONFIDENCE, FACT_STATUS, SOURCE_TYPES } from '../config/schemas.js';
|
|
32
|
+
import { getIntelligenceStatusService, listAgentsService, getAgentService, removeAgentService, listSkillsService, searchSkillsService, getSkillService, removeSkillService, planOrchestrationService, runOrchestrationService, approveOrchestrationService, cancelOrchestrationService, getOrchestrationRunService, listOrchestrationHistoryService, } from '../services/intelligence.js';
|
|
33
|
+
import { listStandardsService, getStandardService, auditStandardsService, applyStandardService, addStandardService, approveStandardService, updateStandardsService, validateStandardsRegistryService, generateStandardsReportService, } from '../services/standards.js';
|
|
34
|
+
import { renderStandardsList, renderStandard, renderStandardsAudit, renderRegistryValidation, } from './render.js';
|
|
35
|
+
import { formatProgressiveSkillInstructions } from '../intelligence/skills/loader.js';
|
|
32
36
|
import { loadFacts } from '../knowledge/facts.js';
|
|
37
|
+
import { EXPERIENCE_LEVELS, PRIVACY_MODES, buildDashboardViewModel, buildGuidanceReport, renderGuidanceText, saveDxPreferences, writeLocalDashboardFile, } from '../dx/index.js';
|
|
33
38
|
export function defaultIO() {
|
|
34
39
|
return {
|
|
35
40
|
stdout: (s) => process.stdout.write(s),
|
|
@@ -100,6 +105,8 @@ async function runAgentSetup(c, cwd, agent) {
|
|
|
100
105
|
agent,
|
|
101
106
|
launcher: str(c.args.values, 'launcher'),
|
|
102
107
|
packageVersion: str(c.args.values, 'package-version'),
|
|
108
|
+
user: bool(c.args.values, 'user'),
|
|
109
|
+
homeDir: c.svc.homeDir,
|
|
103
110
|
};
|
|
104
111
|
if (!dry && !c.json) {
|
|
105
112
|
// Say what is about to change before changing it (read-only planning pass).
|
|
@@ -356,8 +363,16 @@ const handlers = {
|
|
|
356
363
|
const trace = await traceGraphService(c.svc, query, { depth });
|
|
357
364
|
c.data(trace, renderGraphTrace(c.style, trace));
|
|
358
365
|
}
|
|
366
|
+
else if (sub === 'generate') {
|
|
367
|
+
const res = await generateOfflineGraphService(c.svc, {
|
|
368
|
+
force: bool(v, 'force'),
|
|
369
|
+
dryRun: bool(v, 'dry-run'),
|
|
370
|
+
out: str(v, 'out'),
|
|
371
|
+
});
|
|
372
|
+
c.data(res, renderGraphGenerate(c.style, res));
|
|
373
|
+
}
|
|
359
374
|
else {
|
|
360
|
-
throw new DevWorkspaceError('USAGE', `Unknown graph subcommand "${sub}".`, { hint: 'Use: status, trace.' });
|
|
375
|
+
throw new DevWorkspaceError('USAGE', `Unknown graph subcommand "${sub}".`, { hint: 'Use: status, trace, generate.' });
|
|
361
376
|
}
|
|
362
377
|
},
|
|
363
378
|
async task(c) {
|
|
@@ -568,8 +583,353 @@ const handlers = {
|
|
|
568
583
|
const r = await migrateWorkspace(c.svc);
|
|
569
584
|
c.data(r, renderMigrate(c.style, r));
|
|
570
585
|
},
|
|
586
|
+
async agents(c) {
|
|
587
|
+
const sub = c.rest[0] || 'list';
|
|
588
|
+
if (sub === 'list') {
|
|
589
|
+
const agents = await listAgentsService(c.svc.cwd);
|
|
590
|
+
const lines = [
|
|
591
|
+
`${c.style.bold('Intelligent Agent Profiles')} (${agents.length} registered):`,
|
|
592
|
+
'',
|
|
593
|
+
...agents.map((a) => ` ${c.style.bold(a.id.padEnd(22))} [${a.role.padEnd(14)}] [Risk: ${a.riskClassification.padEnd(8)}] ${a.description}`),
|
|
594
|
+
];
|
|
595
|
+
c.data(agents, lines.join('\n'));
|
|
596
|
+
}
|
|
597
|
+
else if (sub === 'inspect') {
|
|
598
|
+
const id = need(c.rest[1], 'id (positional)');
|
|
599
|
+
const agent = await getAgentService(c.svc.cwd, id);
|
|
600
|
+
if (!agent)
|
|
601
|
+
throw new DevWorkspaceError('NOT_FOUND', `Agent profile "${id}" not found.`);
|
|
602
|
+
const text = [
|
|
603
|
+
`${c.style.bold(agent.name)} (${agent.id})`,
|
|
604
|
+
`Role: ${agent.role}`,
|
|
605
|
+
`Description: ${agent.description}`,
|
|
606
|
+
`Risk: ${agent.riskClassification}`,
|
|
607
|
+
`Version: ${agent.version}`,
|
|
608
|
+
`Capabilities: ${agent.capabilities.join(', ')}`,
|
|
609
|
+
`Supported Tasks: ${agent.supportedTaskTypes.join(', ')}`,
|
|
610
|
+
`Required Skills: ${agent.requiredSkills.join(', ') || 'none'}`,
|
|
611
|
+
`Supported Runtimes: ${agent.supportedProviders.join(', ')}`,
|
|
612
|
+
`Max Budget/Time: ${agent.maxTokenBudget.toLocaleString()} tokens / ${agent.maxExecutionTimeSeconds}s`,
|
|
613
|
+
].join('\n');
|
|
614
|
+
c.data(agent, text);
|
|
615
|
+
}
|
|
616
|
+
else if (sub === 'health') {
|
|
617
|
+
const id = c.rest[1];
|
|
618
|
+
const agents = await listAgentsService(c.svc.cwd);
|
|
619
|
+
const targetList = id ? agents.filter((a) => a.id.toLowerCase() === id.toLowerCase()) : agents;
|
|
620
|
+
if (id && targetList.length === 0)
|
|
621
|
+
throw new DevWorkspaceError('NOT_FOUND', `Agent profile "${id}" not found.`);
|
|
622
|
+
const results = targetList.map((a) => ({
|
|
623
|
+
id: a.id,
|
|
624
|
+
name: a.name,
|
|
625
|
+
healthy: true,
|
|
626
|
+
available: true,
|
|
627
|
+
provider: a.supportedProviders[0] || 'native',
|
|
628
|
+
}));
|
|
629
|
+
const text = [
|
|
630
|
+
`${c.style.bold('Agent Health & Availability')}:`,
|
|
631
|
+
...results.map((r) => ` ${c.style.sym.ok} ${r.id.padEnd(22)} ${r.name.padEnd(24)} provider: ${r.provider}`),
|
|
632
|
+
].join('\n');
|
|
633
|
+
c.data(id ? results[0] : results, text);
|
|
634
|
+
}
|
|
635
|
+
else if (sub === 'remove') {
|
|
636
|
+
const id = need(c.rest[1], 'id (positional)');
|
|
637
|
+
const ok = await removeAgentService(c.svc.cwd, id);
|
|
638
|
+
if (!ok)
|
|
639
|
+
throw new DevWorkspaceError('NOT_FOUND', `Custom agent profile "${id}" not found.`);
|
|
640
|
+
c.data({ removed: id }, `${c.style.sym.ok} Custom agent profile "${id}" removed.`);
|
|
641
|
+
}
|
|
642
|
+
else {
|
|
643
|
+
throw new DevWorkspaceError('USAGE', `Unknown agents subcommand "${sub}".`, {
|
|
644
|
+
hint: 'Use: devworkspace agents list | inspect <id> | health [id] | remove <id>',
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
async skills(c) {
|
|
649
|
+
const sub = c.rest[0] || 'list';
|
|
650
|
+
if (sub === 'list') {
|
|
651
|
+
const skills = await listSkillsService(c.svc.cwd);
|
|
652
|
+
const lines = [
|
|
653
|
+
`${c.style.bold('Portable Engineering Skills')} (${skills.length} available):`,
|
|
654
|
+
'',
|
|
655
|
+
...skills.map((s) => ` ${c.style.bold(s.id.padEnd(28))} [${s.category.padEnd(14)}] ${s.description}`),
|
|
656
|
+
];
|
|
657
|
+
c.data(skills, lines.join('\n'));
|
|
658
|
+
}
|
|
659
|
+
else if (sub === 'search') {
|
|
660
|
+
const q = c.rest.slice(1).join(' ') || str(c.args.values, 'query') || '';
|
|
661
|
+
const skills = await searchSkillsService(c.svc.cwd, q);
|
|
662
|
+
const lines = [
|
|
663
|
+
`${c.style.bold(`Skills matching "${q}"`)} (${skills.length} found):`,
|
|
664
|
+
'',
|
|
665
|
+
...skills.map((s) => ` ${c.style.bold(s.id.padEnd(28))} [${s.category.padEnd(14)}] ${s.description}`),
|
|
666
|
+
];
|
|
667
|
+
c.data(skills, lines.join('\n'));
|
|
668
|
+
}
|
|
669
|
+
else if (sub === 'inspect') {
|
|
670
|
+
const id = need(c.rest[1], 'id (positional)');
|
|
671
|
+
const skill = await getSkillService(c.svc.cwd, id);
|
|
672
|
+
if (!skill)
|
|
673
|
+
throw new DevWorkspaceError('NOT_FOUND', `Skill "${id}" not found.`);
|
|
674
|
+
const formatted = formatProgressiveSkillInstructions(skill, 'full');
|
|
675
|
+
c.data(skill, formatted);
|
|
676
|
+
}
|
|
677
|
+
else if (sub === 'remove') {
|
|
678
|
+
const id = need(c.rest[1], 'id (positional)');
|
|
679
|
+
const ok = await removeSkillService(c.svc.cwd, id);
|
|
680
|
+
if (!ok)
|
|
681
|
+
throw new DevWorkspaceError('NOT_FOUND', `Project skill "${id}" not found.`);
|
|
682
|
+
c.data({ removed: id }, `${c.style.sym.ok} Project skill "${id}" removed.`);
|
|
683
|
+
}
|
|
684
|
+
else {
|
|
685
|
+
throw new DevWorkspaceError('USAGE', `Unknown skills subcommand "${sub}".`, {
|
|
686
|
+
hint: 'Use: devworkspace skills list | search <query> | inspect <id> | remove <id>',
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
},
|
|
690
|
+
async orchestrate(c) {
|
|
691
|
+
const sub = need(c.rest[0], 'subcommand (plan|run|status|explain|cancel|history)');
|
|
692
|
+
if (sub === 'plan') {
|
|
693
|
+
const request = c.rest.slice(1).join(' ').trim();
|
|
694
|
+
if (!request)
|
|
695
|
+
throw new DevWorkspaceError('USAGE', 'Describe what to orchestrate: devworkspace orchestrate plan "<request>"');
|
|
696
|
+
const run = await planOrchestrationService(c.svc.cwd, {
|
|
697
|
+
request,
|
|
698
|
+
autoApprove: bool(c.args.values, 'auto-approve'),
|
|
699
|
+
});
|
|
700
|
+
const lines = [
|
|
701
|
+
`${c.style.bold('Orchestration Plan Generated')}: ${c.style.bold(run.runId)}`,
|
|
702
|
+
`Task Type: ${run.routing.taskType} (Complexity: ${run.routing.complexity})`,
|
|
703
|
+
`Strategy: ${run.routing.strategy}`,
|
|
704
|
+
`State: ${run.state}`,
|
|
705
|
+
`Explanation: ${run.routing.explanation}`,
|
|
706
|
+
'',
|
|
707
|
+
c.style.bold('Selected Specialists:'),
|
|
708
|
+
...run.routing.selectedAgents.map((a) => ` - ${c.style.bold(a.role)}: ${a.reason}`),
|
|
709
|
+
'',
|
|
710
|
+
c.style.bold('Selected Skills:'),
|
|
711
|
+
...run.routing.selectedSkills.map((s) => ` - ${c.style.bold(s.name)}: ${s.reason}`),
|
|
712
|
+
'',
|
|
713
|
+
c.style.bold('Execution Stages:'),
|
|
714
|
+
...run.stages.map((st, idx) => ` ${idx + 1}. [${st.status}] ${st.name} (${st.agentId})`),
|
|
715
|
+
];
|
|
716
|
+
if (run.state === 'AWAITING_APPROVAL') {
|
|
717
|
+
lines.push('');
|
|
718
|
+
lines.push(`${c.style.sym.warn} This plan requires approval before execution: devworkspace orchestrate approve ${run.runId}`);
|
|
719
|
+
}
|
|
720
|
+
else {
|
|
721
|
+
lines.push('');
|
|
722
|
+
lines.push(`To execute: devworkspace orchestrate run ${run.runId}`);
|
|
723
|
+
}
|
|
724
|
+
c.data(run, lines.join('\n'));
|
|
725
|
+
}
|
|
726
|
+
else if (sub === 'approve') {
|
|
727
|
+
const runId = need(c.rest[1], 'runId (positional)');
|
|
728
|
+
const run = await approveOrchestrationService(c.svc.cwd, runId);
|
|
729
|
+
c.data(run, `${c.style.sym.ok} Plan ${run.runId} approved. Ready to run: devworkspace orchestrate run ${run.runId}`);
|
|
730
|
+
}
|
|
731
|
+
else if (sub === 'run') {
|
|
732
|
+
const runId = need(c.rest[1], 'runId (positional)');
|
|
733
|
+
const run = await runOrchestrationService(c.svc.cwd, { runId });
|
|
734
|
+
const lines = [
|
|
735
|
+
`${c.style.bold('Orchestration Run Result')}: ${run.runId} [${run.state}]`,
|
|
736
|
+
`Stages: ${run.metrics.stagesCompleted}/${run.stages.length} completed`,
|
|
737
|
+
`Duration: ${run.metrics.durationMs}ms`,
|
|
738
|
+
];
|
|
739
|
+
if (run.error)
|
|
740
|
+
lines.push(`Error: ${run.error}`);
|
|
741
|
+
c.data(run, lines.join('\n'));
|
|
742
|
+
if (run.state === 'FAILED')
|
|
743
|
+
c.exit = EXIT.FAILURE;
|
|
744
|
+
}
|
|
745
|
+
else if (sub === 'status' || sub === 'explain') {
|
|
746
|
+
const runId = need(c.rest[1], 'runId (positional)');
|
|
747
|
+
const run = await getOrchestrationRunService(c.svc.cwd, runId);
|
|
748
|
+
if (!run)
|
|
749
|
+
throw new DevWorkspaceError('NOT_FOUND', `Run "${runId}" not found.`);
|
|
750
|
+
const lines = [
|
|
751
|
+
`${c.style.bold('Orchestration Run')}: ${run.runId} [${run.state}]`,
|
|
752
|
+
`Request: ${run.request}`,
|
|
753
|
+
`Task Type: ${run.routing.taskType} (Complexity: ${run.routing.complexity})`,
|
|
754
|
+
`Strategy: ${run.routing.strategy}`,
|
|
755
|
+
`Explanation: ${run.routing.explanation}`,
|
|
756
|
+
'',
|
|
757
|
+
c.style.bold('Stages:'),
|
|
758
|
+
...run.stages.map((st) => ` - [${st.status}] ${st.name} (${st.agentId})`),
|
|
759
|
+
'',
|
|
760
|
+
c.style.bold('Checkpoints:'),
|
|
761
|
+
...run.checkpoints.map((cp) => ` · [${cp.state}] ${cp.note} (${new Date(cp.at).toLocaleTimeString()})`),
|
|
762
|
+
];
|
|
763
|
+
c.data(run, lines.join('\n'));
|
|
764
|
+
}
|
|
765
|
+
else if (sub === 'cancel') {
|
|
766
|
+
const runId = need(c.rest[1], 'runId (positional)');
|
|
767
|
+
const run = await cancelOrchestrationService(c.svc.cwd, runId);
|
|
768
|
+
c.data(run, `${c.style.sym.warn} Run "${run.runId}" is now CANCELLED.`);
|
|
769
|
+
}
|
|
770
|
+
else if (sub === 'history') {
|
|
771
|
+
const history = await listOrchestrationHistoryService(c.svc.cwd);
|
|
772
|
+
const lines = [
|
|
773
|
+
`${c.style.bold('Orchestration History')} (${history.length} run(s)):`,
|
|
774
|
+
'',
|
|
775
|
+
...history.map((r) => ` ${c.style.bold(r.runId.padEnd(20))} [${r.state.padEnd(10)}] ${r.routing.taskType.padEnd(14)} ${r.request.slice(0, 50)}`),
|
|
776
|
+
];
|
|
777
|
+
c.data(history, lines.join('\n'));
|
|
778
|
+
}
|
|
779
|
+
else {
|
|
780
|
+
throw new DevWorkspaceError('USAGE', `Unknown orchestrate subcommand "${sub}".`, {
|
|
781
|
+
hint: 'Use: devworkspace orchestrate plan|run|status|explain|cancel|history',
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
},
|
|
785
|
+
async intelligence(c) {
|
|
786
|
+
const sub = c.rest[0] || 'status';
|
|
787
|
+
if (sub === 'status') {
|
|
788
|
+
const status = await getIntelligenceStatusService(c.svc.cwd);
|
|
789
|
+
const lines = [
|
|
790
|
+
`${c.style.bold('DevWorkspace Intelligence Status')}:`,
|
|
791
|
+
`Specialist Agents: ${status.agentsCount} active profiles`,
|
|
792
|
+
`Engineering Skills: ${status.skillsCount} loaded skills`,
|
|
793
|
+
`Total Runs: ${status.runsCount} historical runs`,
|
|
794
|
+
`Average Latency: ${status.metrics.averageDurationMs}ms`,
|
|
795
|
+
`Success Rate: ${status.metrics.totalRuns ? Math.round((status.metrics.successfulRuns / status.metrics.totalRuns) * 100) : 100}%`,
|
|
796
|
+
];
|
|
797
|
+
c.data(status, lines.join('\n'));
|
|
798
|
+
}
|
|
799
|
+
else if (sub === 'doctor') {
|
|
800
|
+
const status = await getIntelligenceStatusService(c.svc.cwd);
|
|
801
|
+
const lines = [
|
|
802
|
+
`${c.style.bold('DevWorkspace Intelligence Diagnostics')}:`,
|
|
803
|
+
` ${c.style.sym.ok} Agent Registry: ${status.agentsCount} profiles available`,
|
|
804
|
+
` ${c.style.sym.ok} Skill Engine: ${status.skillsCount} skills verified`,
|
|
805
|
+
` ${c.style.sym.ok} Routing Engine: capability matching and single-writer policies active`,
|
|
806
|
+
` ${c.style.sym.ok} Verification Gate: dual-agent independent reviews active`,
|
|
807
|
+
` ${c.style.sym.ok} Security Boundaries: path traversal, sensitive file quarantine and metacharacter blocks active`,
|
|
808
|
+
];
|
|
809
|
+
c.data(status, lines.join('\n'));
|
|
810
|
+
}
|
|
811
|
+
else if (sub === 'benchmark') {
|
|
812
|
+
const status = await getIntelligenceStatusService(c.svc.cwd);
|
|
813
|
+
const lines = [
|
|
814
|
+
`${c.style.bold('Intelligence Orchestration Benchmarks')}:`,
|
|
815
|
+
`Total Orchestrated Runs: ${status.metrics.totalRuns}`,
|
|
816
|
+
`Successful Runs: ${status.metrics.successfulRuns}`,
|
|
817
|
+
`Failed Runs: ${status.metrics.failedRuns}`,
|
|
818
|
+
`Average Duration: ${status.metrics.averageDurationMs}ms`,
|
|
819
|
+
`Estimated Total Tokens: ${status.metrics.totalTokensEstimate.toLocaleString()}`,
|
|
820
|
+
];
|
|
821
|
+
c.data(status.metrics, lines.join('\n'));
|
|
822
|
+
}
|
|
823
|
+
else {
|
|
824
|
+
throw new DevWorkspaceError('USAGE', `Unknown intelligence subcommand "${sub}".`, {
|
|
825
|
+
hint: 'Use: devworkspace intelligence status | doctor | benchmark',
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
async standards(c) {
|
|
830
|
+
const sub = c.rest[0] || 'list';
|
|
831
|
+
const v = c.args.values;
|
|
832
|
+
if (sub === 'list') {
|
|
833
|
+
const category = str(v, 'category');
|
|
834
|
+
const status = str(v, 'status')?.toUpperCase();
|
|
835
|
+
const applicableOnly = bool(v, 'applicable');
|
|
836
|
+
const r = await listStandardsService(c.svc, { category, status, applicableOnly });
|
|
837
|
+
c.data(r, renderStandardsList(c.style, r));
|
|
838
|
+
}
|
|
839
|
+
else if (sub === 'show') {
|
|
840
|
+
const id = need(c.rest[1] || str(v, 'id'), 'standard ID: devworkspace standards show <id>');
|
|
841
|
+
const r = await getStandardService(c.svc, id);
|
|
842
|
+
c.data(r, renderStandard(c.style, r));
|
|
843
|
+
}
|
|
844
|
+
else if (sub === 'audit' || sub === 'check') {
|
|
845
|
+
const id = c.rest[1] || str(v, 'id') || str(v, 'standard');
|
|
846
|
+
const r = await auditStandardsService(c.svc, id);
|
|
847
|
+
c.data(r, renderStandardsAudit(c.style, r));
|
|
848
|
+
if (r.summary.failed > 0) {
|
|
849
|
+
c.exit = EXIT.FAILURE;
|
|
850
|
+
}
|
|
851
|
+
else if (bool(v, 'strict') && r.summary.warn > 0) {
|
|
852
|
+
c.exit = EXIT.WARNINGS;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
else if (sub === 'apply') {
|
|
856
|
+
const id = need(c.rest[1] || str(v, 'id'), 'standard ID: devworkspace standards apply <id>');
|
|
857
|
+
const force = bool(v, 'force');
|
|
858
|
+
const r = await applyStandardService(c.svc, id, { force });
|
|
859
|
+
c.data(r, `${c.style.ok(c.style.sym.ok)} ${r.message}`);
|
|
860
|
+
}
|
|
861
|
+
else if (sub === 'add') {
|
|
862
|
+
const file = need(c.rest[1] || str(v, 'file'), 'file path: devworkspace standards add <path>');
|
|
863
|
+
const title = str(v, 'title') || str(v, 'name');
|
|
864
|
+
const category = str(v, 'category');
|
|
865
|
+
const force = bool(v, 'force');
|
|
866
|
+
const r = await addStandardService(c.svc, file, { name: title, category, overwrite: force });
|
|
867
|
+
c.data(r, `${c.style.ok(c.style.sym.ok)} Imported standard "${r.standard.name}" (${r.standard.id}) -> ${r.createdFile}`);
|
|
868
|
+
}
|
|
869
|
+
else if (sub === 'approve') {
|
|
870
|
+
const id = need(c.rest[1] || str(v, 'id'), 'standard ID: devworkspace standards approve <id>');
|
|
871
|
+
const r = await approveStandardService(c.svc, id);
|
|
872
|
+
c.data(r, `${c.style.ok(c.style.sym.ok)} ${r.message}`);
|
|
873
|
+
}
|
|
874
|
+
else if (sub === 'update') {
|
|
875
|
+
const r = await updateStandardsService(c.svc);
|
|
876
|
+
c.data(r, `${c.style.ok(c.style.sym.ok)} ${r.message}`);
|
|
877
|
+
}
|
|
878
|
+
else if (sub === 'report') {
|
|
879
|
+
const out = str(v, 'out') || 'STANDARDS_REPORT.md';
|
|
880
|
+
const r = await generateStandardsReportService(c.svc, out);
|
|
881
|
+
c.data(r.report, `${c.style.ok(c.style.sym.ok)} Generated standards report at "${r.writtenFile}". Score: ${r.report.summary.score}%`);
|
|
882
|
+
}
|
|
883
|
+
else if (sub === 'validate') {
|
|
884
|
+
const r = validateStandardsRegistryService();
|
|
885
|
+
c.data(r, renderRegistryValidation(c.style, r));
|
|
886
|
+
if (!r.valid)
|
|
887
|
+
c.exit = EXIT.FAILURE;
|
|
888
|
+
}
|
|
889
|
+
else {
|
|
890
|
+
throw new DevWorkspaceError('USAGE', `Unknown standards subcommand "${sub}".`, {
|
|
891
|
+
hint: 'Use: devworkspace standards list | show | audit | check | apply | add | approve | update | report | validate',
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
},
|
|
895
|
+
async guide(c) {
|
|
896
|
+
const v = c.args.values;
|
|
897
|
+
const expRaw = str(v, 'experience');
|
|
898
|
+
const privRaw = str(v, 'privacy');
|
|
899
|
+
const experienceLevel = expRaw
|
|
900
|
+
? oneOf(expRaw, EXPERIENCE_LEVELS, 'experience')
|
|
901
|
+
: undefined;
|
|
902
|
+
const privacyMode = privRaw
|
|
903
|
+
? oneOf(privRaw, PRIVACY_MODES, 'privacy')
|
|
904
|
+
: undefined;
|
|
905
|
+
if (bool(v, 'save') && (experienceLevel || privacyMode)) {
|
|
906
|
+
await saveDxPreferences(c.svc.cwd ?? process.cwd(), { experienceLevel, privacyMode });
|
|
907
|
+
}
|
|
908
|
+
const report = await buildGuidanceReport({
|
|
909
|
+
...c.svc,
|
|
910
|
+
experienceLevel,
|
|
911
|
+
privacyMode,
|
|
912
|
+
includeDoctor: bool(v, 'deep'),
|
|
913
|
+
});
|
|
914
|
+
c.data(report, renderGuidanceText(report));
|
|
915
|
+
},
|
|
916
|
+
async dashboard(c) {
|
|
917
|
+
const v = c.args.values;
|
|
918
|
+
const outPath = str(v, 'out');
|
|
919
|
+
const includeStandards = !bool(v, 'no-standards');
|
|
920
|
+
if (bool(v, 'dry-run')) {
|
|
921
|
+
const model = await buildDashboardViewModel({ ...c.svc, includeStandards });
|
|
922
|
+
c.data(model, `${c.style.sym.info} Dry-run: local dashboard model built for ${model.status.project?.name ?? 'uninitialized'} (${model.guidance.recommendations.length} recommendation(s)).`);
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
925
|
+
const res = await writeLocalDashboardFile(c.svc.cwd ?? process.cwd(), outPath, {
|
|
926
|
+
...c.svc,
|
|
927
|
+
includeStandards,
|
|
928
|
+
});
|
|
929
|
+
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
|
+
},
|
|
571
931
|
};
|
|
572
|
-
const ALIASES = { tasks: 'task' };
|
|
932
|
+
const ALIASES = { tasks: 'task', standard: 'standards' };
|
|
573
933
|
/** Run the CLI and return the process exit code. Never calls process.exit, so it is directly testable. */
|
|
574
934
|
export async function run(argv, io = defaultIO()) {
|
|
575
935
|
let debug = argv.includes('--debug');
|