# my-work **Repository Path**: adminwp/my-work ## Basic Information - **Project Name**: my-work - **Description**: 个人办公工作辅助工具 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-19 - **Last Updated**: 2026-04-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Command Center `Command Center` is a personal instruction-driven automation system for: - parsing structured commands - validating required inputs before execution - splitting commands into executable workflow steps - running built-in analyzers for review and acceptance - exporting auditable Markdown reports - storing every run for later traceability ## Supported command types - `审查 PR` - `拆分需求` - `排查 Bug` - `验收交付` ## Run locally Start the web console: ```powershell python -m command_center.main --serve --host 127.0.0.1 --port 8080 ``` Then open `http://127.0.0.1:8080`. Run a single command: ```powershell python -m command_center.main --command "任务: 审查 PR`n目标: 判断是否可合并`n输入:`n- diff: payment callback retry update order table schema migration added no idempotent key and no tests" ``` Write CLI output to a UTF-8 file: ```powershell python -m command_center.main --command-file .\review-pr.txt --output-file .\last-run.json ``` Run a command from file: ```powershell python -m command_center.main --command-file .\review-pr.txt ``` Run with execution budgets: ```powershell python -m command_center.main --command-file .\review-pr.txt --step-timeout 3 --run-timeout 10 ``` Run with a personal decision profile: ```powershell python -m command_center.main --command-file .\review-pr.txt --profile merge_guard ``` Run directly from a personal preset: ```powershell python -m command_center.main --preset review_pr_merge_gate --output-file .\last-run.json ``` Review a local git repository directly: ```text 任务: 审查 PR 目标: 判断本地变更是否可合并 输入: - repo_path: E:\repo\payment-service - base_ref: HEAD 检查项: - 幂等 - 测试 ``` Export a previous run as Markdown: ```powershell python -m command_center.main --report-run ``` Protect API access with a token: ```powershell $env:COMMAND_CENTER_TOKEN = "your-token" python -m command_center.main --serve ``` When a token is configured, API clients should send `X-Command-Center-Token`. Optional environment defaults for execution budgets: ```powershell $env:COMMAND_CENTER_STEP_TIMEOUT_SECONDS = "3" $env:COMMAND_CENTER_RUN_TIMEOUT_SECONDS = "10" $env:COMMAND_CENTER_DEFAULT_PROFILE = "merge_guard" $env:COMMAND_CENTER_DEFAULT_PRESET = "review_pr_merge_gate" ``` Run the test suite: ```powershell python -m unittest discover -s tests -v ``` ## Initialize MySQL locally If you want the same workflow data model provisioned into local MySQL, use: ```powershell python -m command_center.mysql_admin --host 127.0.0.1 --port 3306 --user root --password root --database my-work --seed --verify ``` This command will: - create database `my-work` - create core tables: `workflow_runs`, `risk_feedback`, `rule_overrides`, `run_signoffs` - insert deterministic demo records for runs, feedback, rule overrides, and signoffs - print row counts for quick verification ## Structured command example ```text 任务: 审查 PR 目标: 判断是否可合并 输入: - pr_id: !238 - diff: payment callback retry logic added, update order table, no idempotent key, no tests 检查项: - 幂等 - 事务一致性 - 回滚能力 输出: - 风险列表 - 是否通过 ``` ## Result shape Every run returns: - parsed command metadata - validation result - planned step graph - execution outputs by step - review findings - acceptance decision - persisted run id ## History filtering `GET /api/runs` supports: - `status` - `action` - `repo_path` - `q` ## Feedback loop You can record manual review feedback for a risk: - `POST /api/runs/{run_id}/feedback` - `GET /api/runs/{run_id}/feedback` Supported `feedback_type` values: - `false_positive` - `accepted_risk` - `fixed` ## Human signoff You can record your final personal decision for a run: - `POST /api/runs/{run_id}/signoff` - `GET /api/runs/{run_id}/signoff` Payload: ```json { "status": "accepted", "note": "人工确认可推进", "signer": "self" } ``` Supported signoff statuses: - `accepted` - `needs_human` - `rejected` The original automated status is preserved. Run detail and Markdown export also include `final_decision`, which uses the human signoff when present. ## Audit timeline Each run also includes a unified audit timeline that merges: - automated run result - related rule override records - manual feedback records - final human signoff API: - `GET /api/runs/{run_id}/timeline` Run detail and Markdown export also include the same timeline. ## Personal insights Use `GET /api/insights` to retrieve your recent personal operation metrics, including: - total runs - failure count - signoff count - human override count and rate - automated status distribution - final status distribution - top actions - top risks ## Rule analytics `GET /api/rules/analytics` supports optional: - `action` Each rule analytics item also includes: - `governance_status` - `suggested_action` - `override_mode` - `override_confidence_delta` ## Rule overrides Use rule overrides to tune or suppress noisy personal review rules: - `GET /api/rules/overrides` - `POST /api/rules/{rule_id}/override` Override payload examples: ```json { "mode": "downrank", "confidence_delta": -20, "note": "历史误报偏多,先降权观察" } ``` ```json { "mode": "disable", "note": "当前阶段不再使用这条规则" } ``` ```json { "mode": "normal" } ``` ## Health check `GET /api/health` This endpoint also returns: - `default_step_timeout_seconds` - `default_run_timeout_seconds` - `default_profile_name` ## Acceptance profiles Use `GET /api/profiles` to query available personal decision profiles. Current built-in profiles: - `balanced_default`: default behavior, high risk rejects, medium risk routes to manual review - `fast_track`: allows a single medium risk to pass for quick personal triage - `merge_guard`: suitable for PR final gate, failed checks reject directly - `delivery_gate`: suitable for上线前验收, any medium risk or failed check blocks direct pass Run API example: ```json { "command": "任务: 拆分需求\n目标: 拆成开发顺序和验收标准\n输入:\n- requirement: 新增 order query API\n- acceptance: 核心流程可执行", "options": { "profile": "fast_track", "step_timeout_seconds": 3, "run_timeout_seconds": 10 } } ``` ## Personal presets Use `GET /api/presets` to query built-in personal presets. Current presets: - `review_pr_merge_gate`: final PR gate, combines review template + `merge_guard` - `delivery_release_gate`: launch acceptance gate, combines delivery template + `delivery_gate` - `bug_hotfix_fastlane`: urgent bug triage, combines incident template + `fast_track` - `requirement_breakdown_default`: requirement split baseline, combines split template + `balanced_default` You can run with preset only: ```json { "options": { "preset": "review_pr_merge_gate" } } ``` ## Acceptance checklist 1. Start the service: ```powershell python -m command_center.main --serve --host 127.0.0.1 --port 8080 ``` 2. Run one `审查 PR` or `验收交付` command from the web console or CLI. 3. Confirm the result contains: - validation summary - execution steps - review findings with evidence and confidence - acceptance decision 4. Submit one feedback item for a risk and rerun the same command to confirm confidence changes. 5. Open the `规则治理` panel, apply `降权` or `停用`, rerun the command, and confirm the rule behavior changes. 6. Add a human signoff and confirm `final_decision` changes while the automated status is preserved. 7. Open the audit timeline and confirm run, feedback, rule governance, and signoff events are visible in order. 8. Open the personal insights panel and confirm aggregate metrics update after signoff/feedback activity. 9. Export the run as Markdown and confirm the report is readable. 10. Run the automated test suite: ```powershell python -m unittest discover -s tests -v ```