vgxness 0.1.0 → 0.1.1-alpha.1
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/dist/cli/dispatcher.js +169 -10
- package/dist/cli/guided-main-menu.js +446 -0
- package/dist/code/cli/code-command.js +62 -0
- package/dist/code/config/defaults.js +104 -0
- package/dist/code/prompts/prompt-builder.js +110 -0
- package/dist/code/providers/credentials.js +13 -0
- package/dist/code/providers/fake-provider-adapter.js +90 -0
- package/dist/code/providers/message-mapper.js +63 -0
- package/dist/code/providers/openai-compatible-provider-adapter.js +50 -0
- package/dist/code/providers/provider-adapter.js +10 -0
- package/dist/code/providers/provider-registry.js +28 -0
- package/dist/code/providers/stream-normalizer.js +29 -0
- package/dist/code/reporting/redaction.js +39 -0
- package/dist/code/reporting/summary.js +24 -0
- package/dist/code/runtime/approval-coordinator.js +75 -0
- package/dist/code/runtime/code-runtime.js +402 -0
- package/dist/code/runtime/gateways.js +59 -0
- package/dist/code/runtime/memory-service-gateway.js +20 -0
- package/dist/code/runtime/project-detection.js +94 -0
- package/dist/code/runtime/runs-code-run-gateway.js +29 -0
- package/dist/code/runtime/sdd-context.js +57 -0
- package/dist/code/runtime/sdd-workflow-gateway.js +44 -0
- package/dist/code/runtime/types.js +1 -0
- package/dist/code/runtime/verification-coordinator.js +26 -0
- package/dist/code/tools/read-only-executor.js +144 -0
- package/dist/code/tools/tool-definitions.js +58 -0
- package/dist/code/tools/tool-registry.js +13 -0
- package/dist/code/tools/tool-result-normalizer.js +34 -0
- package/dist/code/tools/workspace-executor.js +174 -0
- package/dist/export/redaction.js +18 -16
- package/dist/governance/governance-report-builder.js +242 -0
- package/dist/governance/index.js +3 -0
- package/dist/governance/overlay-fingerprint.js +15 -0
- package/dist/governance/schema.js +1 -0
- package/dist/harness/tools/agents.js +63 -47
- package/dist/harness/tools/memory.js +2 -2
- package/dist/mcp/client-install-opencode-contract.js +163 -80
- package/dist/mcp/control-plane.js +102 -1
- package/dist/mcp/index.js +3 -0
- package/dist/mcp/opencode-default-agent-config.js +18 -2
- package/dist/mcp/provider-doctor.js +121 -0
- package/dist/mcp/provider-health-types.js +67 -0
- package/dist/mcp/provider-status.js +152 -0
- package/dist/mcp/schema.js +61 -1
- package/dist/mcp/stdio-server.js +8 -1
- package/dist/mcp/validation.js +145 -3
- package/dist/memory/repositories/artifacts.js +9 -4
- package/dist/memory/sqlite/migrations/015_artifact_metadata.sql +1 -0
- package/dist/permissions/policy-evaluator.js +114 -7
- package/dist/permissions/schema.js +37 -1
- package/dist/providers/opencode/injection-preview.js +5 -0
- package/dist/providers/opencode/manager-payload.js +5 -0
- package/dist/runs/run-service.js +178 -9
- package/dist/sdd/schema.js +54 -0
- package/dist/sdd/sdd-workflow-service.js +114 -19
- package/dist/skills/skill-payload.js +35 -0
- package/dist/skills/skill-resolver.js +79 -0
- package/dist/skills/skill-seed-service.js +213 -0
- package/docs/vgxness-code.md +46 -0
- package/package.json +3 -2
- package/seeds/skills/skill-seed-v1.json +81 -0
package/dist/cli/dispatcher.js
CHANGED
|
@@ -6,9 +6,14 @@ import { ManagerProfileOverlayService } from '../agents/manager-profile-overlay-
|
|
|
6
6
|
import { resolveAgentProfileModel } from '../agents/profile-model-routing.js';
|
|
7
7
|
import { ManagerProfileOverlayRepository } from '../agents/repositories/manager-profile-overlays.js';
|
|
8
8
|
import { getProviderRenderer } from '../agents/renderers/index.js';
|
|
9
|
+
import { runCodeCommand } from '../code/cli/code-command.js';
|
|
10
|
+
import { MemoryServiceCodeGateway } from '../code/runtime/memory-service-gateway.js';
|
|
11
|
+
import { RunsCodeRunGateway } from '../code/runtime/runs-code-run-gateway.js';
|
|
12
|
+
import { SddWorkflowGateway } from '../code/runtime/sdd-workflow-gateway.js';
|
|
9
13
|
import { renderDashboard as renderStatusDashboard } from './dashboard-renderer.js';
|
|
10
14
|
import { buildDashboardApprovalsReadModel, buildDashboardRunsReadModel, buildDashboardWorkflowsReadModel } from './dashboard-operational-read-models.js';
|
|
11
15
|
import { dashboardKeyFromInput, loadInitialDashboardState, reduceDashboardKey, refreshDashboard, renderDashboard as renderInteractiveDashboard, resolveDashboardRenderStyle } from './interactive-dashboard.js';
|
|
16
|
+
import { createGuidedSetupPreview, noTtyGuidedMenuGuidance, runGuidedMainMenuLoop } from './guided-main-menu.js';
|
|
12
17
|
import { sanitizeDashboardError } from './dashboard-tui-read-model.js';
|
|
13
18
|
import { createAgentRegistryToolHandlers } from '../harness/tools/agents.js';
|
|
14
19
|
import { createMemoryToolHandlers } from '../harness/tools/memory.js';
|
|
@@ -677,25 +682,29 @@ async function runSetupApplyCommand(parsed, environment) {
|
|
|
677
682
|
const input = setupPlanInputFromFlags(parsed, environment);
|
|
678
683
|
if (!input.ok)
|
|
679
684
|
return resultFailure(input);
|
|
680
|
-
const
|
|
685
|
+
const applied = await applySetupPlanInput(input.value, environment);
|
|
686
|
+
return applied.ok ? jsonResult({ ok: true, value: applied.value }) : resultFailure(applied);
|
|
687
|
+
}
|
|
688
|
+
async function applySetupPlanInput(input, environment) {
|
|
689
|
+
const plan = createSetupPlan(input);
|
|
681
690
|
if (!plan.ok)
|
|
682
|
-
return
|
|
691
|
+
return plan;
|
|
683
692
|
if (plan.value.status !== 'ready')
|
|
684
|
-
return
|
|
685
|
-
if (input.
|
|
686
|
-
return
|
|
693
|
+
return validationFailure(`Setup plan is ${plan.value.status}; resolve conflicts before applying.`);
|
|
694
|
+
if (input.provider === 'none')
|
|
695
|
+
return { ok: true, value: { status: 'manual-required', message: 'Provider is none; there is no config to apply.', plan: plan.value } };
|
|
687
696
|
const result = await installOpenCodeMcpClient({
|
|
688
697
|
cwd: environment.cwd,
|
|
689
698
|
databasePath: plan.value.db.path,
|
|
690
699
|
databasePathSource: plan.value.db.source === 'global-default' || plan.value.db.source === 'environment' ? plan.value.db.source : 'flag',
|
|
691
|
-
scope: input.
|
|
700
|
+
scope: input.scope ?? vgxnessSetupDefaults.defaultOpenCodeScope,
|
|
692
701
|
env: environment.env,
|
|
693
702
|
confirmed: true,
|
|
694
|
-
mcpOnly: input.
|
|
703
|
+
mcpOnly: input.installMode === 'mcp-only',
|
|
695
704
|
});
|
|
696
705
|
return result.status === 'installed'
|
|
697
|
-
?
|
|
698
|
-
:
|
|
706
|
+
? { ok: true, value: { kind: 'setup-apply-result', version: 1, status: 'installed', plan: plan.value, opencode: result, nextCommands: ['vgx doctor', 'Restart OpenCode and verify the vgxness MCP server is visible.'] } }
|
|
707
|
+
: validationFailure(`${result.reason}: ${result.message}`);
|
|
699
708
|
}
|
|
700
709
|
function setupPlanInputFromFlags(parsed, environment) {
|
|
701
710
|
const project = optionalStringFlag(parsed.flags, 'project');
|
|
@@ -824,7 +833,7 @@ export async function dispatchCliAsync(argv, environment) {
|
|
|
824
833
|
const parsed = parseArgs(argv);
|
|
825
834
|
const [area, command] = parsed.positionals;
|
|
826
835
|
if (argv.length === 0)
|
|
827
|
-
return
|
|
836
|
+
return runGuidedMainMenuCommand(environment);
|
|
828
837
|
if (area === 'dashboard' && command === 'interactive')
|
|
829
838
|
return runDashboardInteractiveCommand(parsed, environment);
|
|
830
839
|
if (area === 'mcp') {
|
|
@@ -840,6 +849,8 @@ export async function dispatchCliAsync(argv, environment) {
|
|
|
840
849
|
}
|
|
841
850
|
if (area === 'doctor')
|
|
842
851
|
return runDoctorAliasCommand(parsed, environment);
|
|
852
|
+
if (area === 'code')
|
|
853
|
+
return runCodeCliCommand(parsed, environment);
|
|
843
854
|
if (area === 'init')
|
|
844
855
|
return runInitCommand(parsed, environment);
|
|
845
856
|
if (area === 'setup' && command === 'apply')
|
|
@@ -848,6 +859,115 @@ export async function dispatchCliAsync(argv, environment) {
|
|
|
848
859
|
return runSetupRollbackCommand(parsed);
|
|
849
860
|
return dispatchCli(argv, environment);
|
|
850
861
|
}
|
|
862
|
+
async function runGuidedMainMenuCommand(environment) {
|
|
863
|
+
const terminal = resolveGuidedMainMenuTerminal(environment);
|
|
864
|
+
if (!terminal.ok)
|
|
865
|
+
return okText(noTtyGuidedMenuGuidance());
|
|
866
|
+
const setupPreview = createDefaultGuidedSetupPreview(environment);
|
|
867
|
+
await runGuidedMainMenuLoop({
|
|
868
|
+
...terminal.value,
|
|
869
|
+
...(setupPreview === undefined ? {} : {
|
|
870
|
+
context: {
|
|
871
|
+
setupPreview,
|
|
872
|
+
...(setupPreview.provider === 'opencode' ? { onApplyConfirmed: () => applyDefaultGuidedOpenCodeSetup(environment) } : {}),
|
|
873
|
+
},
|
|
874
|
+
}),
|
|
875
|
+
});
|
|
876
|
+
return { exitCode: 0, stdout: '', stderr: '' };
|
|
877
|
+
}
|
|
878
|
+
async function applyDefaultGuidedOpenCodeSetup(environment) {
|
|
879
|
+
const applied = await applySetupPlanInput({ workspaceRoot: environment.cwd, env: environment.env, provider: 'opencode' }, environment);
|
|
880
|
+
return mapSetupApplyResultToGuidedApplyResult(applied);
|
|
881
|
+
}
|
|
882
|
+
function mapSetupApplyResultToGuidedApplyResult(result) {
|
|
883
|
+
if (!result.ok) {
|
|
884
|
+
return {
|
|
885
|
+
status: 'failure',
|
|
886
|
+
summary: `OpenCode setup apply failed: ${result.error.message}`,
|
|
887
|
+
details: [`Error code: ${result.error.code}`],
|
|
888
|
+
nextSteps: ['Inspect the setup plan with `vgxness setup plan`.', 'Run `vgxness doctor` after resolving the issue.'],
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
if (result.value.status === 'manual-required') {
|
|
892
|
+
return {
|
|
893
|
+
status: 'partial',
|
|
894
|
+
summary: result.value.message,
|
|
895
|
+
details: ['No provider config was written because this setup requires manual action.'],
|
|
896
|
+
nextSteps: result.value.plan.nextCommands,
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
return {
|
|
900
|
+
status: 'success',
|
|
901
|
+
summary: `OpenCode setup installed at ${result.value.opencode.targetPath}.`,
|
|
902
|
+
details: [
|
|
903
|
+
`Plan status: ${result.value.plan.status}.`,
|
|
904
|
+
`Installed MCP server command: ${result.value.opencode.server.command.join(' ')}.`,
|
|
905
|
+
...(result.value.opencode.backupPath === undefined ? [] : [`Backup created: ${result.value.opencode.backupPath}.`]),
|
|
906
|
+
...(result.value.opencode.warnings.length === 0 ? [] : result.value.opencode.warnings),
|
|
907
|
+
],
|
|
908
|
+
nextSteps: result.value.nextCommands,
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
function createDefaultGuidedSetupPreview(environment) {
|
|
912
|
+
const plan = createSetupPlan({ workspaceRoot: environment.cwd, env: environment.env });
|
|
913
|
+
if (!plan.ok)
|
|
914
|
+
return undefined;
|
|
915
|
+
return createGuidedSetupPreview({
|
|
916
|
+
status: plan.value.status,
|
|
917
|
+
project: plan.value.project,
|
|
918
|
+
database: { mode: plan.value.db.mode, path: plan.value.db.path },
|
|
919
|
+
provider: plan.value.provider,
|
|
920
|
+
actions: plan.value.actions,
|
|
921
|
+
conflicts: plan.value.conflicts,
|
|
922
|
+
backupsPlanned: plan.value.backupsPlanned,
|
|
923
|
+
nextCommands: plan.value.nextCommands,
|
|
924
|
+
safety: plan.value.safety,
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
function resolveGuidedMainMenuTerminal(environment) {
|
|
928
|
+
const input = environment.stdin;
|
|
929
|
+
const output = environment.stdout;
|
|
930
|
+
if (input === undefined || output === undefined || input.isTTY !== true || output.isTTY !== true || input.setRawMode === undefined)
|
|
931
|
+
return validationFailure('Guided main menu requires an interactive terminal');
|
|
932
|
+
return { ok: true, value: { input, output } };
|
|
933
|
+
}
|
|
934
|
+
async function runCodeCliCommand(parsed, environment) {
|
|
935
|
+
const [, command] = parsed.positionals;
|
|
936
|
+
if (command !== 'inspect' && command !== 'plan' && command !== 'craft' && command !== 'sdd')
|
|
937
|
+
return usageFailure(`Unknown code command: ${command ?? ''}`.trim());
|
|
938
|
+
const maxSourceBytes = optionalNumberFlag(parsed.flags, 'max-source-bytes');
|
|
939
|
+
if (!maxSourceBytes.ok)
|
|
940
|
+
return resultFailure(maxSourceBytes);
|
|
941
|
+
const output = parsed.flags.json === true || optionalStringFlag(parsed.flags, 'output') === 'json' ? 'json' : 'human';
|
|
942
|
+
const approvalPolicy = codeApprovalPolicyFlag(parsed.flags);
|
|
943
|
+
if (!approvalPolicy.ok)
|
|
944
|
+
return resultFailure(approvalPolicy);
|
|
945
|
+
const verificationMode = codeVerificationModeFlag(parsed.flags);
|
|
946
|
+
if (!verificationMode.ok)
|
|
947
|
+
return resultFailure(verificationMode);
|
|
948
|
+
const transcriptMode = codeTranscriptModeFlag(parsed.flags);
|
|
949
|
+
if (!transcriptMode.ok)
|
|
950
|
+
return resultFailure(transcriptMode);
|
|
951
|
+
const memoryPolicy = codeMemoryPolicyFlag(parsed.flags);
|
|
952
|
+
if (!memoryPolicy.ok)
|
|
953
|
+
return resultFailure(memoryPolicy);
|
|
954
|
+
const selectedDatabasePath = databasePathFor(parsed.flags, environment);
|
|
955
|
+
if (!selectedDatabasePath.ok)
|
|
956
|
+
return resultFailure(selectedDatabasePath);
|
|
957
|
+
const opened = openCliDatabase(selectedDatabasePath.value);
|
|
958
|
+
if (!opened.ok)
|
|
959
|
+
return resultFailure(opened);
|
|
960
|
+
try {
|
|
961
|
+
const runs = new RunService(opened.value);
|
|
962
|
+
const memory = new MemoryService(opened.value);
|
|
963
|
+
const provider = optionalStringFlag(parsed.flags, 'provider');
|
|
964
|
+
const model = optionalStringFlag(parsed.flags, 'model');
|
|
965
|
+
return await runCodeCommand({ command, args: parsed.positionals.slice(2), cwd: environment.cwd, output, runGateway: new RunsCodeRunGateway(runs), sddGateway: new SddWorkflowGateway(new SddWorkflowService(memory)), memoryGateway: new MemoryServiceCodeGateway(memory), project: optionalStringFlag(parsed.flags, 'project') ?? 'vgxness', ...(provider === undefined ? {} : { provider }), ...(model === undefined ? {} : { model }), stream: parsed.flags.stream === true, env: environment.env, persistArtifact: parsed.flags['save-artifact'] === true || parsed.flags.persist === true, ...(maxSourceBytes.value !== undefined ? { maxSourceBytes: maxSourceBytes.value } : {}), ...(approvalPolicy.value === undefined ? {} : { approvalPolicy: approvalPolicy.value }), ...(verificationMode.value === undefined ? {} : { verificationMode: verificationMode.value }), ...(transcriptMode.value === undefined ? {} : { transcriptMode: transcriptMode.value }), ...(memoryPolicy.value === undefined ? {} : { memoryPolicy: memoryPolicy.value }) });
|
|
966
|
+
}
|
|
967
|
+
finally {
|
|
968
|
+
opened.value.close();
|
|
969
|
+
}
|
|
970
|
+
}
|
|
851
971
|
async function runInitCommand(parsed, environment) {
|
|
852
972
|
if (parsed.flags.plan === true || parsed.flags.json === true)
|
|
853
973
|
return runSetupPlanCommand(parsed, environment);
|
|
@@ -2501,6 +2621,11 @@ function validateCommand(area, command) {
|
|
|
2501
2621
|
? { ok: true }
|
|
2502
2622
|
: { ok: false, message: `Unknown dashboard command: ${command}` };
|
|
2503
2623
|
}
|
|
2624
|
+
if (area === 'code') {
|
|
2625
|
+
return command === 'inspect' || command === 'plan' || command === 'craft' || command === 'sdd'
|
|
2626
|
+
? { ok: true }
|
|
2627
|
+
: { ok: false, message: `Unknown code command: ${command}` };
|
|
2628
|
+
}
|
|
2504
2629
|
return { ok: false, message: `Unknown command area: ${area}` };
|
|
2505
2630
|
}
|
|
2506
2631
|
function requiredFlag(flags, name) {
|
|
@@ -2511,6 +2636,34 @@ function optionalStringFlag(flags, name) {
|
|
|
2511
2636
|
const value = flags[name];
|
|
2512
2637
|
return typeof value === 'string' && value.trim() ? value : undefined;
|
|
2513
2638
|
}
|
|
2639
|
+
function codeApprovalPolicyFlag(flags) {
|
|
2640
|
+
const value = optionalStringFlag(flags, 'approval-policy');
|
|
2641
|
+
if (value === undefined)
|
|
2642
|
+
return { ok: true, value: undefined };
|
|
2643
|
+
return value === 'ask' || value === 'allow' || value === 'deny' ? { ok: true, value } : validationFailure('--approval-policy must be ask, allow, or deny');
|
|
2644
|
+
}
|
|
2645
|
+
function codeVerificationModeFlag(flags) {
|
|
2646
|
+
const value = optionalStringFlag(flags, 'verification');
|
|
2647
|
+
if (value === undefined)
|
|
2648
|
+
return { ok: true, value: undefined };
|
|
2649
|
+
return value === 'none' || value === 'suggest' || value === 'run' || value === 'repair' ? { ok: true, value } : validationFailure('--verification must be none, suggest, run, or repair');
|
|
2650
|
+
}
|
|
2651
|
+
function codeTranscriptModeFlag(flags) {
|
|
2652
|
+
const value = optionalStringFlag(flags, 'transcript');
|
|
2653
|
+
if (value === undefined)
|
|
2654
|
+
return { ok: true, value: undefined };
|
|
2655
|
+
return value === 'off' || value === 'summary' || value === 'full'
|
|
2656
|
+
? { ok: true, value }
|
|
2657
|
+
: validationFailure('--transcript must be off, summary, or full');
|
|
2658
|
+
}
|
|
2659
|
+
function codeMemoryPolicyFlag(flags) {
|
|
2660
|
+
const value = optionalStringFlag(flags, 'memory');
|
|
2661
|
+
if (value === undefined)
|
|
2662
|
+
return { ok: true, value: undefined };
|
|
2663
|
+
return value === 'off' || value === 'ask' || value === 'auto'
|
|
2664
|
+
? { ok: true, value }
|
|
2665
|
+
: validationFailure('--memory must be off, ask, or auto');
|
|
2666
|
+
}
|
|
2514
2667
|
function scopeFlag(flags, name, fallback) {
|
|
2515
2668
|
const value = optionalStringFlag(flags, name) ?? fallback;
|
|
2516
2669
|
return value === 'project' || value === 'personal' ? { ok: true, value } : validationFailure(`--${name} must be project or personal`);
|
|
@@ -2780,6 +2933,12 @@ Areas:
|
|
|
2780
2933
|
|
|
2781
2934
|
opencode preview --provider opencode (--agent <name> | --agent-id <id>) --project <name> --change <id> --phase <phase> [--scope project|personal]
|
|
2782
2935
|
|
|
2936
|
+
code inspect "<question>" [--json] [--max-source-bytes <n>] [--provider fake|openai-compatible] [--model <id>] [--stream] [--transcript off|summary|full] [--memory off|ask|auto]
|
|
2937
|
+
code plan "<task>" [--json] [--max-source-bytes <n>] [--provider fake|openai-compatible] [--model <id>] [--stream] [--transcript off|summary|full] [--memory off|ask|auto]
|
|
2938
|
+
code craft "<task>" [--json] [--max-source-bytes <n>] [--provider fake|openai-compatible] [--model <id>] [--stream] [--approval-policy ask|allow|deny] [--verification none|suggest|run|repair] [--transcript off|summary|full] [--memory off|ask|auto]
|
|
2939
|
+
code sdd <change> <phase> [--json] [--save-artifact] [--provider fake|openai-compatible] [--model <id>] [--stream] [--verification none|suggest|run|repair] [--transcript off|summary|full] [--memory off|ask|auto]
|
|
2940
|
+
VGXNESS Code inspect and plan are native read-only repository flows. Craft is bounded edit-capable work with approval-gated edits and shell verification; SDD mode follows phase-specific artifact boundaries and saves only with --save-artifact.
|
|
2941
|
+
|
|
2783
2942
|
orchestrator preview --project <name> --intent <text> [--change <id>] [--db <path>]
|
|
2784
2943
|
Orchestrator preview classifies natural-language requests only; it never executes providers, edits files, records runs, or writes provider config.
|
|
2785
2944
|
|