Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-05-10
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Why

Cargo support added a `cargo` boolean to `quantex doctor --json` under `data.installers`, but the doctor entry in `quantex schema doctor` still described only `brew`, `bun`, `npm`, and `winget`. With `additionalProperties: false`, any consumer validating doctor output against the published schema incorrectly rejects valid payloads.

## What Changes

- Extend the doctor `dataSchema.installers` contract to include `cargo` alongside the other managed installer flags.
- Lock the alignment in tests and sync the agent-update spec narrative used for diagnostics contracts.

## Impact

- Affected specs: `openspec/specs/agent-update/spec.md`.
- Affected code: `src/commands/schema.ts`, `test/commands/schema.test.ts`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## ADDED Requirements

### Requirement: Doctor JSON schema MUST stay aligned with doctor installer diagnostics

The machine-readable schema for `quantex doctor` SHALL enumerate every installer availability flag that structured doctor output can emit, so validators using `additionalProperties: false` accept real doctor JSON.

#### Scenario: Doctor schema includes Cargo alongside other managed installers

- **GIVEN** the user runs `quantex schema doctor` in JSON mode
- **WHEN** Quantex returns the doctor command `dataSchema`
- **THEN** `dataSchema.properties.installers.properties` includes a `cargo` boolean field
- **AND** `dataSchema.properties.installers.required` includes `cargo` together with the other managed installer keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [x] 1.1 Add `cargo` to doctor JSON schema `installers` properties and `required` list in `src/commands/schema.ts`.
- [x] 1.2 Assert schema parity in `test/commands/schema.test.ts`.
- [x] 1.3 Document the contract in `openspec/specs/agent-update/spec.md`.
7 changes: 7 additions & 0 deletions openspec/specs/agent-update/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ Agent update behavior SHALL be inspectable through user-facing diagnostic comman
- AND includes `subject`, `suggestedAction`, and `suggestedCommands`
- AND allows an automation layer to distinguish between inspection, self-update, and manual-follow-up paths

#### Scenario: Doctor schema documents every managed installer availability flag

- GIVEN the user runs `quantex schema doctor` in JSON mode
- WHEN Quantex returns the doctor command `dataSchema`
- THEN the `installers` object lists every managed installer key that `quantex doctor --json` may emit, including `cargo`
- AND strict schema validation of real doctor JSON output does not fail solely because an installer flag is missing from the published schema

#### Scenario: Resolve exposes machine-actionable install guidance

- GIVEN the user runs `quantex resolve <agent> --json`
Expand Down
3 changes: 2 additions & 1 deletion src/commands/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,11 @@ const schemaCatalog: SchemaDocument[] = [
properties: {
brew: { type: 'boolean' },
bun: { type: 'boolean' },
cargo: { type: 'boolean' },
npm: { type: 'boolean' },
winget: { type: 'boolean' },
},
required: ['brew', 'bun', 'npm', 'winget'],
required: ['brew', 'bun', 'cargo', 'npm', 'winget'],
type: 'object',
},
issues: {
Expand Down
17 changes: 1 addition & 16 deletions src/self/index.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
import type {
SelfInspection,
SelfInstallSource,
SelfPackageMetadata,
SelfUpdateChannel,
SelfUpdateResult,
SelfUpgradePlan,
} from './types'
import type { SelfInspection, SelfInstallSource, SelfUpdateChannel, SelfUpdateResult, SelfUpgradePlan } from './types'
import process from 'node:process'
import {
canAutoUpdateSelf,
detectSelfInstallSource,
getSelfVersion,
reconcileSelfInstallSource,
resolveSelfInstallFacts,
resolveSelfPackageMetadata,
} from './facts'
import { acquireSelfUpgradeLock } from './lock'
import {
buildPlanFromInspection,
Expand Down
2 changes: 2 additions & 0 deletions test/commands/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ describe('schemaCommand', () => {
expect(payload.data.commands[0].name).toBe('doctor')
expect(payload.data.commands[0].dataSchema.properties.issues.items.properties.suggestedAction).toBeDefined()
expect(payload.data.commands[0].dataSchema.properties.issues.items.properties.suggestedCommands).toBeDefined()
expect(payload.data.commands[0].dataSchema.properties.installers.properties.cargo).toEqual({ type: 'boolean' })
expect(payload.data.commands[0].dataSchema.properties.installers.required).toContain('cargo')
})

it('returns the exec schema in json mode', async () => {
Expand Down
Loading