MVP: establish cross-platform Computer Doctor CLI architecture with controlled E2E repair loop#2
Open
Copilot wants to merge 5 commits into
Open
MVP: establish cross-platform Computer Doctor CLI architecture with controlled E2E repair loop#2Copilot wants to merge 5 commits into
Copilot wants to merge 5 commits into
Conversation
11 tasks
Agent-Logs-Url: https://github.com/idea2app/Computer-Doctor-CLI/sessions/8827e4d4-0d61-4fa5-bda7-9dc395f78b90 Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Build MVP framework for cross-platform CLI tool for tech repair
MVP: establish cross-platform Computer Doctor CLI architecture with controlled E2E repair loop
May 18, 2026
TechQuery
requested changes
May 18, 2026
Comment on lines
+58
to
+63
| export interface Session { | ||
| id: string; | ||
| platform: string; | ||
| status: 'running' | 'completed' | 'failed'; | ||
| createdAt: Date; | ||
| } |
Member
There was a problem hiding this comment.
Suggested change
| export interface Session { | |
| id: string; | |
| platform: string; | |
| status: 'running' | 'completed' | 'failed'; | |
| createdAt: Date; | |
| } |
class 本身就具备 interface 的类型信息。
Author
There was a problem hiding this comment.
已移除这块重复接口定义,并让相关抽象边界改为基类承载类型信息。见提交 94a68d3。UI 截图:https://github.com/user-attachments/assets/6de680e3-1c9c-4668-a876-1186f9d4a284
Agent-Logs-Url: https://github.com/idea2app/Computer-Doctor-CLI/sessions/f5e8c5cd-f4d6-4ef4-9634-f5e05814cd3b Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
TechQuery
requested changes
May 18, 2026
Agent-Logs-Url: https://github.com/idea2app/Computer-Doctor-CLI/sessions/c67b8c88-56e3-4cf5-9fd9-a4926d62a999 Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
Agent-Logs-Url: https://github.com/idea2app/Computer-Doctor-CLI/sessions/3148ecc7-f923-4d46-bd5c-54e8a4e5382b Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR establishes the initial TypeScript CLI architecture for Computer Doctor, including a runnable MVP diagnostic/planning/repair/reporting loop with platform adapters, local SQLite persistence, markdown reports, and tests.
Changes:
- Adds CLI entrypoint, command wiring, Ink summary UI, and MVP workflow orchestration.
- Introduces core contracts, platform adapters, action execution, AI-backed/fallback planning, TypeORM persistence, and markdown report rendering.
- Adds project tooling, pnpm lockfile, README usage notes, gitignore updates, and an MVP integration test.
Reviewed changes
Copilot reviewed 20 out of 23 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
.gitignore |
Ignores SQLite/report artifacts and npm lockfile. |
package.json |
Defines package metadata, scripts, runtime deps, and CLI bin. |
pnpm-lock.yaml |
Locks newly introduced pnpm dependencies. |
README.md |
Documents MVP framework, usage, development, and artifacts. |
tsconfig.json |
Adds strict TypeScript/JSX/decorator build config. |
src/index.tsx |
Adds commander-jsx CLI entrypoint. |
src/command/MVP.tsx |
Composes MVP dependencies and renders run summary. |
src/core/contracts.ts |
Defines domain contracts and shared types. |
src/core/actions.ts |
Adds health-check repair action. |
src/core/action-executor.ts |
Adds default action executor. |
src/core/diagnostic-provider.ts |
Adds default diagnostic provider wrapper. |
src/infra/llm/vercel-ai-plan-generator.ts |
Adds Gemini/Vercel AI SDK plan generator with fallback. |
src/infra/store/data-source.ts |
Adds TypeORM better-sqlite3 data source factory. |
src/infra/store/entities.ts |
Adds session and stage persistence entities. |
src/infra/store/typeorm-session-store.ts |
Implements session store with TypeORM repositories. |
src/platform/registry.ts |
Adds platform adapter registry and selector. |
src/platform/linux/adapter.ts |
Adds Linux diagnostic adapter skeleton. |
src/platform/macos/adapter.ts |
Adds macOS diagnostic adapter skeleton. |
src/platform/windows/adapter.ts |
Adds Windows diagnostic adapter skeleton. |
src/report/markdown-report-renderer.ts |
Adds markdown report writer. |
src/ui/run-summary.tsx |
Adds Ink summary component. |
src/workflow/mvp-runner.ts |
Orchestrates session, diagnostic, plan, repair, rollback, and persistence. |
test/mvp-runner.test.ts |
Adds MVP flow persistence/report integration test. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+8
to
+13
| "computer-doctor": "dist/index.js" | ||
| }, | ||
| "scripts": { | ||
| "build": "tsc -p tsconfig.json", | ||
| "dev": "tsx src/index.tsx", | ||
| "start": "node dist/index.js", |
Comment on lines
+9
to
+11
| async execute(_context: RuntimeContext, payload: Record<string, string>): Promise<ActionExecution> { | ||
| const command = payload.command ?? 'node'; | ||
| const args = [payload.arg0 ?? '-e', payload.arg1 ?? "console.log('health-check-ok')"]; |
| @@ -0,0 +1,50 @@ | |||
| /** @jsxImportSource commander-jsx */ | |||
Comment on lines
+18
to
+28
| const result = await runMVPFlow(context, { | ||
| diagnosticProvider: new DefaultDiagnosticProvider(), | ||
| planGenerator: new VercelAIPlanGenerator(), | ||
| actionExecutor: new DefaultActionExecutor([new HealthCheckAction()]), | ||
| sessionStore, | ||
| reportRenderer: new DefaultMarkdownReportRenderer(context.workspaceDir) | ||
| }); | ||
|
|
||
| render(<RunSummary result={result} verbose={context.verbose} />); | ||
|
|
||
| await dataSource.destroy(); |
Comment on lines
+45
to
+48
| () => process.exit(), | ||
| error => { | ||
| console.error(error); | ||
| process.exit(1); |
| # Computer-Doctor-CLI | ||
| AI command line toolkit for Computer Repairing | ||
|
|
||
| AI command line toolkit for Computer Repairing. |
Comment on lines
+25
to
+61
| const workspaceDir = await mkdtemp(path.join(os.tmpdir(), 'computer-doctor-')); | ||
| tempDirs.push(workspaceDir); | ||
|
|
||
| const dataSource = createAppDataSource(workspaceDir); | ||
|
|
||
| const result = await runMVPFlow( | ||
| { verbose: false, workspaceDir }, | ||
| { | ||
| diagnosticProvider: new DefaultDiagnosticProvider(), | ||
| planGenerator: new VercelAIPlanGenerator(), | ||
| actionExecutor: new DefaultActionExecutor([new HealthCheckAction()]), | ||
| sessionStore: new TypeormSessionStore(dataSource), | ||
| reportRenderer: new DefaultMarkdownReportRenderer(workspaceDir) | ||
| } | ||
| ); | ||
|
|
||
| assert.equal(result.actionCount, 1); | ||
|
|
||
| const stageFiles = await Promise.all([ | ||
| readFile(result.reports.diagnostic, 'utf8'), | ||
| readFile(result.reports.plan, 'utf8'), | ||
| readFile(result.reports.repair, 'utf8'), | ||
| readFile(result.reports.rollback, 'utf8') | ||
| ]); | ||
|
|
||
| for (const content of stageFiles) { | ||
| assert.match(content, /# [A-Z]+ 报告/); | ||
| assert.match(content, /Session:/); | ||
| } | ||
|
|
||
| const sessionCount = await dataSource.getRepository(Session).count(); | ||
| const stageCount = await dataSource.getRepository(StageRecord).count(); | ||
|
|
||
| assert.equal(sessionCount, 1); | ||
| assert.equal(stageCount, 4); | ||
|
|
||
| await dataSource.destroy(); |
Comment on lines
+23
to
+33
| const { text } = await generateText({ | ||
| model: google(process.env.AI_MODEL || 'gemini-2.5-flash'), | ||
| prompt: [ | ||
| '你是电脑维修助手。', | ||
| '请基于输入诊断信息输出 JSON:{"summary": string, "actions": [{"id": "health-check", "title": string, "payload": {"command": "node", "arg0": "-e", "arg1": "console.log(\\"health-check-ok\\")"}}]}。', | ||
| '只能使用 id=health-check,不能生成其他命令。', | ||
| `输入: ${JSON.stringify(input)}` | ||
| ].join('\n') | ||
| }); | ||
|
|
||
| try { |
Comment on lines
+44
to
+49
|
|
||
| const rollback = repairs.map(({ actionId, rollbackHint }) => ({ actionId, rollbackHint })); | ||
| const rollbackReport = await deps.reportRenderer.renderStage(session.id, 'rollback', rollback); | ||
| await deps.sessionStore.appendStage(session.id, 'rollback', rollback, rollbackReport); | ||
|
|
||
| await deps.sessionStore.updateSessionStatus(session.id, 'completed'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR lays down the MVP framework for a technician-facing, USB-portable CLI repair agent: clear architectural boundaries first, platform-specific capability later. It introduces the first runnable end-to-end loop (session → diagnostics → plan → action → persistence → markdown audit artifacts) with cross-platform extension points from day one.
CLI entry + command architecture (commander-jsx)
mvpentrypoint.zx($.verbose) and workspace routing for local runtime artifacts.src/command/MVP.tsx.Core domain contracts (extensibility boundaries)
PlatformAdapter,DiagnosticProvider,PlanGenerator,RepairAction,ActionExecutor,SessionStore,MarkdownReportRenderer) to abstract base classes for cleaner type reuse and implementation style.Platform adapter layout
Controlled execution + planning path
zxin actions.@ai-sdk/google) and added configurable model selection viaAI_MODEL.AI_API_KEY.Local persistence + auditability
infra/dbtoinfra/store.better-sqlite3.Baseclass and simplified repository usage inTypeormSessionStore.Markdown documentation outputs
reports/<session-id>/.MVP orchestration
.tsx).Project tooling and tests
debugandpack-exe(usingpnpm pack-app).test/directory and updated test script accordingly.