py-wlcli 0.8.0__py3-none-any.whl
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.
- py_wlcli-0.8.0.dist-info/METADATA +139 -0
- py_wlcli-0.8.0.dist-info/RECORD +320 -0
- py_wlcli-0.8.0.dist-info/WHEEL +4 -0
- py_wlcli-0.8.0.dist-info/entry_points.txt +2 -0
- py_wlcli-0.8.0.dist-info/licenses/LICENSE +21 -0
- wl_cli/__init__.py +27 -0
- wl_cli/__main__.py +130 -0
- wl_cli/capabilities.py +79 -0
- wl_cli/cc/__init__.py +5 -0
- wl_cli/cc/checks.py +1019 -0
- wl_cli/cc/cli.py +370 -0
- wl_cli/cc/mutate.py +1350 -0
- wl_cli/cli_click.py +156 -0
- wl_cli/commands/__init__.py +84 -0
- wl_cli/commands/base.py +80 -0
- wl_cli/commands/buildcommands/__init__.py +1 -0
- wl_cli/commands/buildcommands/build.py +71 -0
- wl_cli/commands/buildcommands/build_utils.py +47 -0
- wl_cli/commands/buildcommands/builders/__init__.py +18 -0
- wl_cli/commands/buildcommands/builders/cleanup.py +35 -0
- wl_cli/commands/buildcommands/builders/coordinator.py +122 -0
- wl_cli/commands/buildcommands/builders/environment.py +81 -0
- wl_cli/commands/buildcommands/builders/rust_builder.py +39 -0
- wl_cli/commands/buildcommands/builders/stubs.py +58 -0
- wl_cli/commands/buildcommands/dist.py +326 -0
- wl_cli/commands/buildcommands/test.py +89 -0
- wl_cli/commands/clean/__init__.py +1 -0
- wl_cli/commands/clean/build.py +151 -0
- wl_cli/commands/clean/clean.py +294 -0
- wl_cli/commands/clean/clean_utils.py +77 -0
- wl_cli/commands/clean/core.py +236 -0
- wl_cli/commands/clean/dead_code/__init__.py +0 -0
- wl_cli/commands/clean/dead_code/dead_code_command.py +70 -0
- wl_cli/commands/clean/dead_code/detector.py +161 -0
- wl_cli/commands/clean/dead_code/fixer.py +176 -0
- wl_cli/commands/clean/dead_code/reporter.py +295 -0
- wl_cli/commands/clean/dead_code/utils.py +0 -0
- wl_cli/commands/clean/lfs.py +215 -0
- wl_cli/commands/clean/python.py +81 -0
- wl_cli/commands/clean/rust.py +91 -0
- wl_cli/commands/clean/utils/__init__.py +34 -0
- wl_cli/commands/clean/venv.py +91 -0
- wl_cli/commands/cleanup.py +73 -0
- wl_cli/commands/click_base.py +79 -0
- wl_cli/commands/config/__init__.py +1 -0
- wl_cli/commands/config/config.py +291 -0
- wl_cli/commands/debug/__init__.py +6 -0
- wl_cli/commands/debug/debug.py +309 -0
- wl_cli/commands/debug/debug_cache.py +86 -0
- wl_cli/commands/debug/debug_subagent.py +156 -0
- wl_cli/commands/debug/output_formatter.py +165 -0
- wl_cli/commands/debug/source_hasher.py +92 -0
- wl_cli/commands/format/__init__.py +13 -0
- wl_cli/commands/format/format_cache_adapter.py +125 -0
- wl_cli/commands/format/format_command.py +197 -0
- wl_cli/commands/format/format_coordinator.py +191 -0
- wl_cli/commands/format/format_executor.py +470 -0
- wl_cli/commands/format/format_outcome.py +44 -0
- wl_cli/commands/format/format_path_handler.py +1016 -0
- wl_cli/commands/format/format_progress.py +62 -0
- wl_cli/commands/format/format_reporter.py +31 -0
- wl_cli/commands/format/python_formatter.py +506 -0
- wl_cli/commands/format/rust_formatter.py +106 -0
- wl_cli/commands/gate/__init__.py +1 -0
- wl_cli/commands/gate/gate_command.py +862 -0
- wl_cli/commands/gate/preflight.py +445 -0
- wl_cli/commands/git/__init__.py +1 -0
- wl_cli/commands/git/config.py +169 -0
- wl_cli/commands/git/git_facts.py +60 -0
- wl_cli/commands/git/git_flow.py +86 -0
- wl_cli/commands/git/hook.py +112 -0
- wl_cli/commands/git/policy.py +216 -0
- wl_cli/commands/git/push_update.py +82 -0
- wl_cli/commands/initenv/__init__.py +1 -0
- wl_cli/commands/initenv/common/__init__.py +23 -0
- wl_cli/commands/initenv/common/check_git_bash.py +78 -0
- wl_cli/commands/initenv/common/error_handler.py +68 -0
- wl_cli/commands/initenv/common/exceptions.py +52 -0
- wl_cli/commands/initenv/components/__init__.py +4 -0
- wl_cli/commands/initenv/components/cargo_sync.py +240 -0
- wl_cli/commands/initenv/components/config_manager.py +106 -0
- wl_cli/commands/initenv/components/directory_utils.py +71 -0
- wl_cli/commands/initenv/components/git/__init__.py +9 -0
- wl_cli/commands/initenv/components/git/branch_creator.py +143 -0
- wl_cli/commands/initenv/components/git/git_flow_interface.py +24 -0
- wl_cli/commands/initenv/components/git/git_flow_manager.py +159 -0
- wl_cli/commands/initenv/components/git/git_lfs_manager.py +272 -0
- wl_cli/commands/initenv/components/git/git_utility.py +254 -0
- wl_cli/commands/initenv/components/git/gitignore_manager.py +53 -0
- wl_cli/commands/initenv/components/git_initializer.py +212 -0
- wl_cli/commands/initenv/components/i18n_manager.py +104 -0
- wl_cli/commands/initenv/components/log_manager.py +241 -0
- wl_cli/commands/initenv/components/project_structure/__init__.py +23 -0
- wl_cli/commands/initenv/components/project_structure/config_generator.py +360 -0
- wl_cli/commands/initenv/components/project_structure/directory_creator.py +184 -0
- wl_cli/commands/initenv/components/project_structure/hook_source.py +110 -0
- wl_cli/commands/initenv/components/project_structure/hooks_manager.py +995 -0
- wl_cli/commands/initenv/components/project_structure/readme_handler.py +56 -0
- wl_cli/commands/initenv/components/project_structure/rust_files_handler.py +30 -0
- wl_cli/commands/initenv/components/project_structure/setup_handler.py +103 -0
- wl_cli/commands/initenv/components/project_structure/sop_generator.py +73 -0
- wl_cli/commands/initenv/components/project_structure/template_copier.py +104 -0
- wl_cli/commands/initenv/components/project_structure/template_manager.py +195 -0
- wl_cli/commands/initenv/components/pyproject_generator.py +194 -0
- wl_cli/commands/initenv/components/rust_initializer.py +145 -0
- wl_cli/commands/initenv/components/symlink_cleaner.py +99 -0
- wl_cli/commands/initenv/components/symlink_manager.py +52 -0
- wl_cli/commands/initenv/components/venv_manager.py +118 -0
- wl_cli/commands/initenv/initenv.py +169 -0
- wl_cli/commands/initenv/services/__init__.py +11 -0
- wl_cli/commands/initenv/services/environment_initializer.py +288 -0
- wl_cli/commands/initenv/services/git_lfs_initializer.py +26 -0
- wl_cli/commands/initenv/services/project_structure_initializer.py +52 -0
- wl_cli/commands/lfs/README.md +221 -0
- wl_cli/commands/lfs/__init__.py +5 -0
- wl_cli/commands/lfs/cli.py +106 -0
- wl_cli/commands/lfs/config.py +164 -0
- wl_cli/commands/lfs/hook.py +61 -0
- wl_cli/commands/lfs/initializer.py +531 -0
- wl_cli/commands/lfs/manager.py +95 -0
- wl_cli/commands/lfs/policy.py +165 -0
- wl_cli/commands/lfs/watcher.py +294 -0
- wl_cli/commands/lint/__init__.py +1 -0
- wl_cli/commands/lint/lint_command.py +297 -0
- wl_cli/commands/lint/lint_executor.py +409 -0
- wl_cli/commands/lint/lint_reporter.py +579 -0
- wl_cli/commands/lint/lint_run.py +258 -0
- wl_cli/commands/lint/mypy_config.py +90 -0
- wl_cli/commands/registry.py +103 -0
- wl_cli/commands/self/__init__.py +7 -0
- wl_cli/commands/self/common/__init__.py +8 -0
- wl_cli/commands/self/common/capabilities.py +30 -0
- wl_cli/commands/self/common/config.py +27 -0
- wl_cli/commands/self/common/version_cache.py +85 -0
- wl_cli/commands/self/handlers/__init__.py +19 -0
- wl_cli/commands/self/handlers/base_handler.py +28 -0
- wl_cli/commands/self/handlers/install_handler.py +85 -0
- wl_cli/commands/self/handlers/status_handler.py +66 -0
- wl_cli/commands/self/handlers/uninstall_handler.py +58 -0
- wl_cli/commands/self/handlers/update_handler.py +102 -0
- wl_cli/commands/self/handlers/version_handler.py +16 -0
- wl_cli/commands/self/self_command.py +237 -0
- wl_cli/commands/self/services/__init__.py +15 -0
- wl_cli/commands/self/services/installation_manager.py +187 -0
- wl_cli/commands/self/services/local_installer.py +165 -0
- wl_cli/commands/self/services/pypi_updater.py +278 -0
- wl_cli/commands/self/services/windows_update.py +174 -0
- wl_cli/commands/testcommands/__init__.py +8 -0
- wl_cli/commands/testcommands/base_dependency_analyzer.py +198 -0
- wl_cli/commands/testcommands/batch_processor.py +278 -0
- wl_cli/commands/testcommands/cache_manager.py +1156 -0
- wl_cli/commands/testcommands/coverage_analyzer.py +955 -0
- wl_cli/commands/testcommands/coverage_cache_manager.py +183 -0
- wl_cli/commands/testcommands/progress_manager.py +79 -0
- wl_cli/commands/testcommands/python_env_detector.py +207 -0
- wl_cli/commands/testcommands/report_generator.py +101 -0
- wl_cli/commands/testcommands/single_test_executor.py +250 -0
- wl_cli/commands/testcommands/speed_checker.py +118 -0
- wl_cli/commands/testcommands/test_command_builder.py +165 -0
- wl_cli/commands/testcommands/test_commands.py +786 -0
- wl_cli/commands/testcommands/test_reporter.py +181 -0
- wl_cli/commands/testcommands/test_result_handler.py +96 -0
- wl_cli/commands/testcommands/test_runner.py +1343 -0
- wl_cli/commands/testcommands/test_utils.py +197 -0
- wl_cli/commands/testcommands/utils/__init__.py +17 -0
- wl_cli/commands/testcommands/utils/coverage_parser.py +98 -0
- wl_cli/commands/testcommands/utils/env_info.py +36 -0
- wl_cli/commands/testcommands/utils/junit_parser.py +75 -0
- wl_cli/commands/testcommands/utils/markdown_utils.py +20 -0
- wl_cli/commands/testcommands/utils/project_root.py +61 -0
- wl_cli/commands/update/__init__.py +9 -0
- wl_cli/commands/update/services/__init__.py +21 -0
- wl_cli/commands/update/services/backup_manager.py +207 -0
- wl_cli/commands/update/services/component_manager.py +83 -0
- wl_cli/commands/update/services/conflict_resolver.py +189 -0
- wl_cli/commands/update/services/vendors_updater.py +85 -0
- wl_cli/commands/update/services/version_tracker.py +127 -0
- wl_cli/commands/update/update_command.py +270 -0
- wl_cli/commands/update/utils/__init__.py +3 -0
- wl_cli/commands/version/__init__.py +9 -0
- wl_cli/commands/version/version_command.py +155 -0
- wl_cli/commands/workflow.py +477 -0
- wl_cli/env/__init__.py +5 -0
- wl_cli/env/cli.py +167 -0
- wl_cli/env_status.py +157 -0
- wl_cli/envelope.py +91 -0
- wl_cli/exceptions.py +85 -0
- wl_cli/lib/__init__.py +3 -0
- wl_cli/lib/rust_utils.py +35 -0
- wl_cli/mcp/__init__.py +6 -0
- wl_cli/mcp/capabilities.py +19 -0
- wl_cli/mcp/cli.py +22 -0
- wl_cli/mcp/gitlab.py +553 -0
- wl_cli/mcp/k8s.py +344 -0
- wl_cli/mcp/protocol.py +159 -0
- wl_cli/platform.py +139 -0
- wl_cli/quality/__init__.py +18 -0
- wl_cli/utils/__init__.py +7 -0
- wl_cli/utils/cache.py +491 -0
- wl_cli/utils/cache_ledger.py +355 -0
- wl_cli/utils/cache_store.py +546 -0
- wl_cli/utils/config/__init__.py +27 -0
- wl_cli/utils/config/config_loader.py +163 -0
- wl_cli/utils/config/core.py +862 -0
- wl_cli/utils/config/defaults.py +142 -0
- wl_cli/utils/config/env_exporter.py +86 -0
- wl_cli/utils/config/env_parser.py +108 -0
- wl_cli/utils/config/validation.py +280 -0
- wl_cli/utils/error_handler.py +165 -0
- wl_cli/utils/file_copier.py +56 -0
- wl_cli/utils/file_operations.py +506 -0
- wl_cli/utils/language_utils.py +122 -0
- wl_cli/utils/lazy_import.py +240 -0
- wl_cli/utils/log_levels.py +35 -0
- wl_cli/utils/log_rotators.py +74 -0
- wl_cli/utils/logging.py +458 -0
- wl_cli/utils/output_context.py +142 -0
- wl_cli/utils/performance/__init__.py +1 -0
- wl_cli/utils/performance/decorators.py +111 -0
- wl_cli/utils/performance/exporter.py +38 -0
- wl_cli/utils/performance/models.py +16 -0
- wl_cli/utils/performance/monitor.py +161 -0
- wl_cli/utils/performance_monitor.py +32 -0
- wl_cli/utils/platform_adapter.py +131 -0
- wl_cli/utils/pre_commit.py +266 -0
- wl_cli/utils/pre_commit_config.py +72 -0
- wl_cli/utils/root.py +521 -0
- wl_cli/utils/root_fallback.py +256 -0
- wl_cli/utils/run_evidence.py +236 -0
- wl_cli/utils/structured_logger.py +18 -0
- wl_cli/utils/structured_logging/__init__.py +19 -0
- wl_cli/utils/structured_logging/config.py +337 -0
- wl_cli/utils/structured_logging/core.py +177 -0
- wl_cli/utils/structured_logging/env.py +56 -0
- wl_cli/utils/structured_logging/filtering.py +75 -0
- wl_cli/utils/structured_logging/filters.py +55 -0
- wl_cli/utils/structured_logging/formatters.py +251 -0
- wl_cli/utils/structured_logging/handlers.py +308 -0
- wl_cli/utils/structured_logging/logger.py +354 -0
- wl_cli/utils/subprocess.py +71 -0
- wl_cli/utils/subprocess_utils.py +260 -0
- wl_cli/utils/test_utils/__init__.py +5 -0
- wl_cli/utils/test_utils/test_filter.py +36 -0
- wl_cli/utils/uv_run.py +79 -0
- wl_cli/utils/uv_tool.py +117 -0
- wl_cli/utils/uv_tree.py +71 -0
- wl_cli/utils/uv_workspace.py +174 -0
- wl_cli/utils/version/__init__.py +15 -0
- wl_cli/utils/version/pypi_version_checker.py +95 -0
- wl_cli/utils/version/version_comparator.py +133 -0
- wl_cli/utils/version/version_detectors.py +312 -0
- wl_cli/utils/version/version_service.py +131 -0
- wl_cli/utils/version/version_updater.py +198 -0
- wl_cli/utils/wl_dir_updater.py +1440 -0
- wl_cli/utils/workspace_detector/__init__.py +28 -0
- wl_cli/utils/workspace_detector/core.py +161 -0
- wl_cli/utils/workspace_detector/detection_strategies.py +107 -0
- wl_cli/utils/workspace_detector/exceptions.py +5 -0
- wl_cli/utils/workspace_detector/types.py +17 -0
- wl_cli/utils/workspace_detector/venv_resolver.py +84 -0
- wl_cli/vendors/config/.codespellrc +2 -0
- wl_cli/vendors/config/dependencies.toml +10 -0
- wl_cli/vendors/config/mypy.ini +62 -0
- wl_cli/vendors/config/pyproject_defaults.toml +28 -0
- wl_cli/vendors/config/template_config.toml +24 -0
- wl_cli/vendors/config/tool_configs.toml +76 -0
- wl_cli/vendors/git/.gitignore +122 -0
- wl_cli/vendors/git/.pre-commit-config.yaml +37 -0
- wl_cli/vendors/hooks/applypatch-msg.sample +15 -0
- wl_cli/vendors/hooks/commit-msg.sample +24 -0
- wl_cli/vendors/hooks/fsmonitor-watchman.sample +174 -0
- wl_cli/vendors/hooks/post-update.sample +8 -0
- wl_cli/vendors/hooks/pre-applypatch.sample +14 -0
- wl_cli/vendors/hooks/pre-commit +45 -0
- wl_cli/vendors/hooks/pre-commit.legacy +31 -0
- wl_cli/vendors/hooks/pre-commit.sample +49 -0
- wl_cli/vendors/hooks/pre-merge-commit.sample +13 -0
- wl_cli/vendors/hooks/pre-push.sample +60 -0
- wl_cli/vendors/hooks/pre-rebase.sample +169 -0
- wl_cli/vendors/hooks/pre-receive.sample +24 -0
- wl_cli/vendors/hooks/prepare-commit-msg.sample +42 -0
- wl_cli/vendors/hooks/push-to-checkout.sample +78 -0
- wl_cli/vendors/hooks/sendemail-validate.sample +77 -0
- wl_cli/vendors/hooks/unix/applypatch-msg.sample +15 -0
- wl_cli/vendors/hooks/unix/check_lockfile.py +58 -0
- wl_cli/vendors/hooks/unix/check_lockfile.sh +36 -0
- wl_cli/vendors/hooks/unix/commit-msg.sample +24 -0
- wl_cli/vendors/hooks/unix/fsmonitor-watchman.sample +174 -0
- wl_cli/vendors/hooks/unix/post-update.sample +8 -0
- wl_cli/vendors/hooks/unix/pre-applypatch.sample +14 -0
- wl_cli/vendors/hooks/unix/pre-commit +190 -0
- wl_cli/vendors/hooks/unix/pre-commit.legacy +31 -0
- wl_cli/vendors/hooks/unix/pre-commit.py +81 -0
- wl_cli/vendors/hooks/unix/pre-commit.sample +49 -0
- wl_cli/vendors/hooks/unix/pre-merge-commit.sample +13 -0
- wl_cli/vendors/hooks/unix/pre-push +417 -0
- wl_cli/vendors/hooks/unix/pre-push.sample +53 -0
- wl_cli/vendors/hooks/unix/pre-rebase.sample +169 -0
- wl_cli/vendors/hooks/unix/pre-receive.sample +24 -0
- wl_cli/vendors/hooks/unix/prepare-commit-msg.sample +42 -0
- wl_cli/vendors/hooks/update.sample +128 -0
- wl_cli/vendors/hooks/win/work.bat +63 -0
- wl_cli/vendors/project/.gitignore +90 -0
- wl_cli/vendors/project/.python-version +1 -0
- wl_cli/vendors/project/LICENSE +21 -0
- wl_cli/vendors/project/README.md +0 -0
- wl_cli/vendors/project/pyproject.toml +27 -0
- wl_cli/vendors/project/pyproject_no_workspace.toml +16 -0
- wl_cli/vendors/project/pyproject_workspace.toml +14 -0
- wl_cli/vendors/readme/README.md +120 -0
- wl_cli/vendors/rust/Cargo.toml +14 -0
- wl_cli/vendors/rust/lib/__init__.py +3 -0
- wl_cli/vendors/rust/lib/rust_utils.py +31 -0
- wl_cli/vendors/rust/src/lib.rs +13 -0
- wl_cli/vendors/rust/src/main.rs +3 -0
- wl_cli/vendors/rust/tests/test_rust_fallback.py +40 -0
- wl_cli/vendors/sop_doc/git-dev-sop.md +220 -0
- wl_cli/vendors/sop_doc/industrial-standard-sop.md +145 -0
- wl_cli/vendors/sop_doc/python-sop.md +342 -0
- wl_cli/vendors/sop_doc/rust-readme.md +219 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# Git 开发 SOP —— 双主线 + AI 工具链
|
|
2
|
+
|
|
3
|
+
> 本 SOP 定义一套统一的 Git 开发与发布流程,供所有经 `wl init` 生成的项目(及团队自有仓库)采用。
|
|
4
|
+
> **适用范围**:默认适用——读者具备 Claude Code + `wl` + gstack(`/ship`)工具链,仓库托管在 GitLab 且采用下方 `main`+`develop` 双主线。不满足前置的仓库(无 gstack//ship、非 GitLab、或走单分支流)需先补齐前置或按自身模型裁剪本 SOP。
|
|
5
|
+
> **来源与分发**:本章由 `wl-cli` 仓库维护,权威在线版见该仓库;经 `wl init` 分发到各生成项目。深层 git 细则(冲突/回滚/worktree 机制)以**外链**方式引用权威文档(各仓库本地若无,以在线版为准),本文只写日常可直接执行的部分,不重复抄细则。
|
|
6
|
+
|
|
7
|
+
## 0. 分支模型与铁律
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
main(生产发布)
|
|
11
|
+
▲
|
|
12
|
+
│ /ship(常规发布 bump 入口) hotfix/<patch>(显式例外,admin 门禁)
|
|
13
|
+
│ │ │
|
|
14
|
+
│ ▼ ▼
|
|
15
|
+
│ [VERSION bump] main ← hotfix(PATCH + tag)
|
|
16
|
+
│
|
|
17
|
+
develop(集成基线, 不 bump) ◄── feature/* 经 MR 合入
|
|
18
|
+
│ └── hotfix 合 main 后立即回流 develop
|
|
19
|
+
└── feature/<任务> (开发道,从 develop 建)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**铁律(违反 = 事故)**
|
|
23
|
+
1. 不直接在 `main`/`develop` 上提交或 push。一切改动从分支走。
|
|
24
|
+
2. 分支命名按意图取前缀:`feature/<任务>`(新功能)、`fix/<任务>`(缺陷修复)、`chore/<任务>`(杂项维护)、`feat/<任务>`(轻量新功能)、`research/<任务>`(调研)、`implement/<任务>`(落地既定方案)、`refactor/<任务>`(重构,不改行为)、`release/<版本>`(发布道)、`hotfix/<版本>`(紧急修复,见 §3.3);不另设新前缀。
|
|
25
|
+
3. **常规发布**的版本 bump 唯一入口是 `/ship`;**hotfix 是显式例外**(PATCH 级,走 §3.3 的受保护 main 门禁)。除此两者外,任何分支合入都不动版本。
|
|
26
|
+
4. 绝不 `push --force`。需要改写历史用 `revert`,或经 `git rebase` 后 `--force-with-lease`(仅限自己独占的分支)。
|
|
27
|
+
5. 凭据/密钥永不入库:任何 diff 或提交含密钥即阻断。提交前运行项目预检(`wl test` + 相关 CI 门)。
|
|
28
|
+
6. `develop` 永远可以拿来开新分支;若集成基线长期落后于 `main`(含 hotfix 未回流),先修复再开新活。
|
|
29
|
+
|
|
30
|
+
## 1. 开发道(日常:feature → develop)
|
|
31
|
+
|
|
32
|
+
### 1.1 隔离工作区
|
|
33
|
+
|
|
34
|
+
开始功能前,先确认或创建隔离工作区(按 `using-git-worktrees` 的探测与建树纪律):
|
|
35
|
+
|
|
36
|
+
- 已在独立 worktree?直接使用,**不要重复开第二个**。
|
|
37
|
+
- 普通 checkout 且当前在 `develop`:征得同意后建 worktree(或按团队约定直接建):
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# 确保 develop 最新
|
|
41
|
+
git checkout develop && git pull origin develop
|
|
42
|
+
# 建树前确认目录会被 git 忽略,否则先入 .gitignore(防误提交整棵 worktree)
|
|
43
|
+
git check-ignore -q .worktrees || echo ".worktrees/" >> .gitignore
|
|
44
|
+
# 从 develop 建 feature 分支到独立 worktree
|
|
45
|
+
git worktree add -b feature/<任务> .worktrees/<任务> develop
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
> `wl init` 生成的仓库 `.gitignore` 默认已含 `.worktrees/`;老仓库按上面 check-ignore 自行补。
|
|
49
|
+
|
|
50
|
+
Claude Code 原生 worktree 工具(`EnterWorktree`)优先于手敲 `git worktree add`——原生工具自己管目录、建分支与清理,避免幽灵状态。
|
|
51
|
+
|
|
52
|
+
### 1.2 开发循环
|
|
53
|
+
|
|
54
|
+
1. **先 TDD**:写测试 → 看失败 → 实现 → 转绿。库/服务的测试与实现同 commit。
|
|
55
|
+
2. 每个逻辑单元完成后跑项目质量门(`wl test` / `wl format` + ruff,`wl debug` 已废弃勿用):
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
wl test # 全量测试(覆盖率门槛看项目配置)
|
|
59
|
+
wl format # 格式化
|
|
60
|
+
ruff check . # lint
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
3. 提交用 **Conventional Commits**(`ecc:git-workflow` 规则表):
|
|
64
|
+
|
|
65
|
+
| 类型 | 用途 |
|
|
66
|
+
|---|---|
|
|
67
|
+
| `feat` / `fix` | 新功能 / 缺陷修复 |
|
|
68
|
+
| `docs` / `style` | 文档 / 纯格式 |
|
|
69
|
+
| `refactor` | 重构(不改行为) |
|
|
70
|
+
| `test` / `chore` | 测试 / 维护杂项 |
|
|
71
|
+
| `ci` / `perf` / `revert` | CI / 性能 / 回滚 |
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
<type>(<scope>): <subject> # subject 祈使语气、≤50 字符
|
|
75
|
+
|
|
76
|
+
[body:为什么,而不是改了什么]
|
|
77
|
+
[footer:Breaking changes / Closes #issue]
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**每 commit 一个逻辑单元**(可 `git bisect`、可被 LLM 读懂)。小改(<50 行、<4 文件)单 commit 即可。
|
|
81
|
+
|
|
82
|
+
4. 一个 feature 分支内多个逻辑单元允许拆多个 commit;WIP 态用 `WIP:` 前缀,由后续吸收(见 §3.2 发布时由 /ship 收敛)。
|
|
83
|
+
|
|
84
|
+
### 1.3 合入 develop(MR)
|
|
85
|
+
|
|
86
|
+
开发完成、本地质检通过后:
|
|
87
|
+
|
|
88
|
+
1. 与 `develop` 同步(保持分支短命、降低冲突):
|
|
89
|
+
```bash
|
|
90
|
+
git fetch origin && git rebase origin/develop # 自己独占的分支用 rebase;多人共享则 merge
|
|
91
|
+
```
|
|
92
|
+
2. push 分支并开 GitLab MR → `develop`:
|
|
93
|
+
```bash
|
|
94
|
+
git push -u origin feature/<任务>
|
|
95
|
+
glab mr create --target-branch develop # 或经 Claude Code 交互创建
|
|
96
|
+
```
|
|
97
|
+
3. MR 描述含:What / Why / How / Testing 勾选。
|
|
98
|
+
4. **Review 通过 + CI 绿 → merge**(squash/rebase 合入,保持 develop 线性)。**不 bump 版本。**
|
|
99
|
+
5. 合入后立即清理(**顺序不能反**——git 拒绝删除正被另一 worktree 检出的分支;squash 合入后 feature 尖非 develop 祖先,`-d` 会报 not fully merged,须用 `-D`):
|
|
100
|
+
```bash
|
|
101
|
+
git worktree remove .worktrees/<任务> # 先从任何 checkout 移除该 worktree
|
|
102
|
+
git branch -D feature/<任务> # 再删分支
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## 2. 并行升级(需要时才并行)
|
|
106
|
+
|
|
107
|
+
**默认一个人一个任务顺序做**。仅在以下判据同时成立时,才把任务拆给多个 agent 并行(`dispatching-parallel-agents`):
|
|
108
|
+
|
|
109
|
+
- 任务可拆成 **2 个及以上相互独立**的子任务;
|
|
110
|
+
- 子任务之间**无共享状态**(不同文件/子系统、不会互相干扰);
|
|
111
|
+
- 每个子任务边界清晰,可独立验证。
|
|
112
|
+
|
|
113
|
+
**不并行**的情形:失败同根因(可能互相牵连)、需要全局上下文、会编辑同一批文件、探索性调试。
|
|
114
|
+
|
|
115
|
+
做法:
|
|
116
|
+
|
|
117
|
+
1. 先定接口与边界(谁改什么、合并点在哪),再派发——**绝不并行前不定义契约**。
|
|
118
|
+
2. 一个子任务一个 worktree、一个 agent、一条自包含指令(scope/goal/constraints/expected output)。
|
|
119
|
+
3. 多个派发放同一条消息里 → 并行执行;各 agent 之间不共享你的会话上下文。
|
|
120
|
+
4. 收齐后你逐个 review 摘要、**核对无冲突改动**、跑全量测试、再统一整合(§1.3 合入 develop)。
|
|
121
|
+
|
|
122
|
+
**Orca(`orca-cli`)承担"多窗口/终端/内嵌浏览器"增强面**,当任务同时要盯多个工作区、终端或页面时用它;单一顺序任务不需要 Orca。Orca 的 worktree 是应用层追踪视图,**不等于** git worktree——裸 git worktree 管理(§1.1/§1.3)仍以 git 为准。需要更强的"监督式协调"(Run/Task/Dispatch、等 worker_done、决策门、跨 agent 消息流)时,才升到 Orca `orchestration` 面——那是另一档纪律,默认不启用。
|
|
123
|
+
|
|
124
|
+
## 3. 发布道
|
|
125
|
+
|
|
126
|
+
### 3.1 版本源(单一权威)
|
|
127
|
+
|
|
128
|
+
- 每个 repo 维护 **`VERSION` 文件 = 三段 semver `X.Y.Z`**,是**唯一权威**版本源。
|
|
129
|
+
- `pyproject.toml`、`rust/Cargo.toml` 等处声明的版本是**派生值,不独立**——发布时 **follow VERSION 同步**,保持三者一致。
|
|
130
|
+
- git tag 语义化 **等于 VERSION**(`vX.Y.Z`)。
|
|
131
|
+
- 版本仅在发布道变更:常规发布经 `/ship`;hotfix 经 §3.3。CI 应有校验:VERSION 与各派生文件不一致即阻断(见 §6)。
|
|
132
|
+
|
|
133
|
+
### 3.2 常规发布(release → main:/ship)
|
|
134
|
+
|
|
135
|
+
**常规发布唯一 bump 入口是 `/ship`**(gstack):它把"merge 基线 → 测试 → 审 → 覆盖率 → bump VERSION+派生 → 拆提交 → push → 开 MR → 同步文档"收成一条非交互流水线。**人不手工 bump 版本、不手工写 CHANGELOG、不手工 commit/push 发布。**
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# 1) 从集成基线开 release 分支(/ship 拒绝在 base 分支上跑)
|
|
139
|
+
git checkout develop && git pull origin develop
|
|
140
|
+
git checkout -b release/<新版本>
|
|
141
|
+
# 2) 触发流水线(分支上自动 merge origin/main、跑测/审/覆盖、bump VERSION+派生、拆提交、push、开 MR→main)
|
|
142
|
+
/ship
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
/ship 行为契约(务必让团队知道这些停/不停点):
|
|
146
|
+
- **不会停**:未提交改动、PATCH 版本号选择、CHANGELOG 内容、提交消息、多文件拆 commit——自动处理。
|
|
147
|
+
- **会停问你**:MINOR/MAJOR 级版本 bump、复杂冲突、发布前 review 需要你判断的项、覆盖率低于门槛、计划项未完成、CI 失败。
|
|
148
|
+
- 输出:MR/PR 标题带 `v<版本>` 前缀 + review + 自动同步的文档。
|
|
149
|
+
- **规则**:绝不 force-push;绝不在 `main`/`develop` 上直接跑;测试不过不发版。
|
|
150
|
+
- 若 /ship 的版本工具尚不能自动写某派生文件(如 `rust/Cargo.toml`),发布人负责把派生文件按 VERSION 手工同步后再提交——VERSION 权威不变。
|
|
151
|
+
|
|
152
|
+
### 3.3 紧急修复(hotfix)
|
|
153
|
+
|
|
154
|
+
正规做法是**双合并**:hotfix 只进 main 会让 develop 落后于生产修复(铁律 6 的红线)。流程(细则参考权威文档 §3.4,此处给可执行步骤):
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
main ──► hotfix/vX.Y.Z ─────────► 合回 main(受保护门禁)─► tag vX.Y.Z
|
|
158
|
+
▲ │
|
|
159
|
+
│ ├──► 立即回流 develop(ff 或 merge)
|
|
160
|
+
└──────────────────────────────────┘
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
1. 从 `main` 建 `hotfix/<patch版本>`:`git checkout -b hotfix/vX.Y.Z main`。
|
|
164
|
+
2. 修复 + **PATCH bump**(VERSION 的 Z 位 + 派生文件同步)。
|
|
165
|
+
3. 质量门通过 → 打包 patch → 提 MR → `main`。
|
|
166
|
+
4. **受保护 main 门禁**:必须 MR + maintainer 审批 + CI 绿才合(GitLab 保护分支规则;repo 管理员是兜底执行者,不是绕过门禁的通道)。main 上直接 push 一律禁止。
|
|
167
|
+
5. 合 main 后立即打 tag `vX.Y.Z` 并推送。
|
|
168
|
+
6. **立即回流 develop**:develop 无并行分叉时 `git checkout develop && git merge --ff-only origin/main`;有分叉则把 hotfix merge 进 develop(消除落后基线)。
|
|
169
|
+
7. 清理分支/worktree(先 remove 再 `-D`,见 §1.3.5)。
|
|
170
|
+
|
|
171
|
+
### 3.4 发布后
|
|
172
|
+
|
|
173
|
+
- 常规发布 MR 合到 `main` 后打 tag(等于 VERSION)并推送。
|
|
174
|
+
- `develop` 收编 release 分支上仅属于发布的内容(版本 bump/CHANGELOG/发布期修正):无分叉用 ff 到 main tip,有分叉用 merge——保证下一个 release 从完整 develop 起。
|
|
175
|
+
- 清理:删 release/hotfix 分支与临时 worktree。
|
|
176
|
+
|
|
177
|
+
## 4. 冲突与回滚速查
|
|
178
|
+
|
|
179
|
+
冲突解决、误提交撤销、revert 的完整细则见权威文档(`docs/chapters/chapter-3-gitflow.md` §3.5,在线版为准);速查:
|
|
180
|
+
|
|
181
|
+
| 场景 | 命令 |
|
|
182
|
+
|---|---|
|
|
183
|
+
| 解冲突 | `git status` → 修冲突标记 → `git add` → `git commit` |
|
|
184
|
+
| 撤销上一 commit(保留改动) | `git reset --soft HEAD~1` |
|
|
185
|
+
| 撤销已推送提交 | `git revert HEAD`(不要 force-push) |
|
|
186
|
+
| 丢了暂存/工作区 | `git stash list` / `git stash pop` |
|
|
187
|
+
| 分支被误删 | `git reflog` 找回 commit → `git branch <name> <sha>` |
|
|
188
|
+
|
|
189
|
+
## 5. 工具 ↔ 环节映射表
|
|
190
|
+
|
|
191
|
+
| 环节 | 用什么 | 触发信号 |
|
|
192
|
+
|---|---|---|
|
|
193
|
+
| 建隔离 worktree | `using-git-worktrees` / Claude Code `EnterWorktree` | 开始 feature、要隔离当前分支 |
|
|
194
|
+
| git 细则(模型/冲突/回滚) | 权威文档 chapter-3 §3.x(在线版) | 任何 git 机制疑问 |
|
|
195
|
+
| 分支/提交规范 | `ecc:git-workflow` | 命名、commit message、rebase 纪律 |
|
|
196
|
+
| 并行分解 | `dispatching-parallel-agents` | 2+ 独立子任务、无共享状态 |
|
|
197
|
+
| 多窗口/终端/浏览器 | `orca-cli` | 要同时盯多工作区/页面 |
|
|
198
|
+
| 监督式多 agent 协调 | Orca `orchestration` | 要等 worker_done、决策门、消息流(默认不开) |
|
|
199
|
+
| 提交/合入 develop | 人:`glab mr create`(Conventional Commits) | 功能完成、CI 绿 |
|
|
200
|
+
| **常规发布(bump 入口)** | **`/ship`** | 把 develop 成果发到 main |
|
|
201
|
+
| 紧急修复(bump 例外) | `hotfix/<patch>` + admin/门禁合 main | 生产缺陷要立刻修 |
|
|
202
|
+
|
|
203
|
+
## 6. 落地与过渡
|
|
204
|
+
|
|
205
|
+
1. **单一版本源校验(CI)**:`VERSION` 与 `pyproject.toml`/`rust/Cargo.toml` 派生文件不一致 → CI 阻断。本 SOP 落地时先在 wl 自身仓库加上并修掉现存漂移。
|
|
206
|
+
2. **Dogfood**:下一次 wl 自身发布按本 SOP §3.2/§3.3 走一遍,验证 /ship + 派生同步流程现实可行;走不通处回填本节或归档为工具适配任务。
|
|
207
|
+
3. **分发同步**:本 SOP 经 `wl init` 按 `vendors/config/template_config.toml` 的 `[sop_templates]` 条目**逐字复制**到生成项目(`git_dev_sop` → `docs/git-dev-sop.md`),随后把正文中的包名记号改写为生成项目自己的包名。注意:与 `.wl/.templates.json` 跟踪的 **config** 模板不同,**SOP 副本不参与哈希同步**——不做漂移检测、不保留用户修改,每次 `wl init` 直接覆盖。本仓内两份副本(`vendors/sop_doc/git-dev-sop.md` 权威 + `docs/git-dev-sop.md` 部署)由 `tests/test_sop_generator.py` 断言字节相等;改本文后跑该测试即可。
|
|
208
|
+
4. **团队迁移**:新 repo 默认生效;存量 repo 按其当前分支模型对照「适用范围」,缺前置的补齐后切换,并列出迁移过渡期的例外。
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## 附:落地检查
|
|
213
|
+
|
|
214
|
+
- [ ] 分支规范:按意图取标准前缀(`feature`/`fix`/`chore`/`feat`/`research`/`implement`/`refactor` 等)从 develop 建,MR 合 develop,无 main/develop 直推
|
|
215
|
+
- [ ] 每个逻辑单元一个 Conventional Commits,WIP 有前缀
|
|
216
|
+
- [ ] `.worktrees/` 已在 .gitignore;worktree 用完先 remove、分支再用 `-D` 清理
|
|
217
|
+
- [ ] develop 常规不 bump;版本只经 `/ship`(常规)或 hotfix(例外)变更
|
|
218
|
+
- [ ] VERSION = 三段 X.Y.Z,派生文件(pyproject/Cargo)follow VERSION 一致
|
|
219
|
+
- [ ] hotfix:双合并 + tag + 立即回流 develop;main 合入走受保护门禁
|
|
220
|
+
- [ ] 密钥不入库、绝不 force-push
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# 按工业化标准补齐仓库 SOP(industrial-standard-sop)
|
|
2
|
+
|
|
3
|
+
> 定位:repo 无关的工业化基准 + 差距审计运行手册 + 修复推进指引。可复制到任意 Python/Rust
|
|
4
|
+
> (或通用)仓库执行。首次 dogfood 对象与产出实例见文末「附录 A」。
|
|
5
|
+
|
|
6
|
+
## 1. 概述
|
|
7
|
+
|
|
8
|
+
本 SOP 把一个仓库从「能用」推进到「工业化基线」。它做两件事:
|
|
9
|
+
|
|
10
|
+
1. **给基准**:一套 repo 无关的「五支柱工业化基准」checklist,每个检查项都带达标判据(可证伪)。
|
|
11
|
+
2. **给方法**:如何跑一次**只读差距审计**(既对照外部通用标准,也核对「仓库自己文档里宣称的
|
|
12
|
+
标准是否真的被强制」),把差距沉淀成分级 remediation ticket,再逐个走
|
|
13
|
+
brainstorm → spec → plan → implement 闭环。
|
|
14
|
+
|
|
15
|
+
**关键视角:审计必须「双基准」。** 只看外部标准会漏掉「名实不符」——仓库文档声称有质量门/
|
|
16
|
+
有 CI/有安全扫描,但代码里根本没有执行载体。自宣兑现度审计往往比外部标准审计找到更多真实缺口。
|
|
17
|
+
|
|
18
|
+
**范围与红线**:审计阶段只读取证、不修改代码;remediation 一律进 ticket,不在审计阶段顺手改。
|
|
19
|
+
|
|
20
|
+
## 2. 工业化五支柱基准(checklist)
|
|
21
|
+
|
|
22
|
+
评级:`ok`(已达标)| `partial`(部分达标)| `missing`(缺失)。每条记录证据
|
|
23
|
+
(`文件:行` / 命令输出 / 政策引用)+ 置信度(`CONFIRMED` 亲验 / `PLAUSIBLE` 待复核)。
|
|
24
|
+
|
|
25
|
+
### 支柱 A:代码工程质量
|
|
26
|
+
- A1 lint/format:lint 与 format 检查零错误零 diff,且**有执行载体**(本地命令 + hook + CI 至少一处强制)。
|
|
27
|
+
- A2 类型检查:静态类型检查真实在跑(不是文档写了但命令不可执行 / 无人跑),错误基线**可追踪且收敛**;
|
|
28
|
+
基线配置是「诚实收紧」(无大量 `type: ignore`、无 per-module 整段 disable)。
|
|
29
|
+
- A3 测试:测试有断言质量(非纯冒烟);无 flaky/时间依赖失控;**门禁是全量**——CI/hook 不得用
|
|
30
|
+
`-k`/skip/xfail 静默豁免某条测试而无线索。
|
|
31
|
+
- A4 覆盖率:覆盖率阈值声明一致(本地命令 / 配置文件 / CI 三方一致),且**口径可证实**
|
|
32
|
+
(如分支覆盖率有存档快照,不是只留一句声明)。
|
|
33
|
+
- A5 dead code:有系统性清理入口,且 lint 不全局吞掉未用导入/变量(F401/F841 类不被无差别 ignore)。
|
|
34
|
+
- A6 质量门真实:文档宣称的「质量门」(debug/check 命令、CI 门禁)确实串联了它声称的全部检查,
|
|
35
|
+
而非只跑子集。
|
|
36
|
+
|
|
37
|
+
### 支柱 B:CI/CD 与发布
|
|
38
|
+
- B1 分级 pipeline:lint/轻量先行,构建/发布按分支分层;feature 分支不被重活拖垮。
|
|
39
|
+
- B2 构建可复现:锁文件入库(Python lock + Cargo.lock);安装用锁定模式(`sync --locked`);
|
|
40
|
+
基础镜像 pin 到 patch/digest;构建工具版本固定。
|
|
41
|
+
- B3 产物可溯源:构建产物有清单/校验和(sha256 manifest),与 pipeline+commit 绑定;CI 配置文件
|
|
42
|
+
从仓库可找到(含 include 链或路径接线有据可查)。
|
|
43
|
+
- B4 发布安全:生产级发布有**人工门禁**(manual/环境门禁),不是任意 tag/分支自动推生产;
|
|
44
|
+
凭据走 CI 变量、最小暴露、可轮换。
|
|
45
|
+
- B5 版本纪律:单一版本源由工具 + **CI 断言**强制(多文件版本一致),changelog 按版本分节且有条目纪律。
|
|
46
|
+
- B6 失败路径:有发布失败/yank/重发/回滚的 runbook,不是只有「git revert」。
|
|
47
|
+
|
|
48
|
+
### 支柱 C:安全与供应链
|
|
49
|
+
- C1 依赖漏洞审计:Python 与 Rust(如适用)漏洞审计有**入口**(CI job/hook:uv audit / cargo audit /
|
|
50
|
+
GitLab Dependency Scanning 等)并纳入发布门禁。
|
|
51
|
+
- C2 凭据卫生:secret 扫描入口存在(gitleaks/Secret-Detection 类);**git 历史无已提交凭据**
|
|
52
|
+
(有则先轮换再清历史);CI 无明文密钥。
|
|
53
|
+
- C3 SBOM:发布流程产出依赖 SBOM。
|
|
54
|
+
- C4 license/来源合规:Rust crate/依赖有 license 与来源合规检查(cargo deny 类);依赖来源可信、有 pin。
|
|
55
|
+
- C5 CI 最小权限:pipeline 用到的 runner/credential/token 最小化,无第三方镜像 + `TRUSTED_HOST`
|
|
56
|
+
之类降低可复现/可审计性的做法而无说明。
|
|
57
|
+
|
|
58
|
+
### 支柱 D:文档与工程规范
|
|
59
|
+
- D1 占位符零泄漏:正式文档(README/CONTRIBUTING/安装指南)无模板占位符(`your-username`、
|
|
60
|
+
`test-project` 等)、无 stub。
|
|
61
|
+
- D2 文档与代码一致:文档描述的入口(命令、模块、子系统)**真实存在**;被删除子系统的文档残留必须清理。
|
|
62
|
+
- D3 架构/决策记录:架构说明(CLAUDE/README)与实际代码路径一致;有 ADR 实践并覆盖关键决策。
|
|
63
|
+
- D4 贡献基座:有 MR/issue 模板;CoC 声明与文件匹配;CONTRIBUTING 的命令可执行。
|
|
64
|
+
- D5 发布文档:发布/上线文档指向真实发布路径(CI 或真实命令),不指向已删命令。
|
|
65
|
+
- D6 changelog/版本实时:CHANGELOG 覆盖近期版本且与提交对应;README 可运行可复现。
|
|
66
|
+
|
|
67
|
+
### 支柱 E:交付/健康横切
|
|
68
|
+
- E1 版本一致:当前版本在版本源/构建文件/changelog 顶部一致。
|
|
69
|
+
- E2 许可证:LICENSE 存在,版权署名与包元数据作者一致。
|
|
70
|
+
- E3 环境锁定:`.python-version`、锁文件在库且被 CI 使用。
|
|
71
|
+
- E4 仓库卫生:`.gitignore`/体积健康、无损坏/过期构建产物入库。
|
|
72
|
+
- E5 测试工程:测试可并行/可缓存;测试文件数与 src 匹配且文档数字不过期。
|
|
73
|
+
- E6 可复现 onboarding:从干净 clone 按 ONBOARDING 能复现开发环境(含 hook/工具链安装、生成目录的澄清)。
|
|
74
|
+
- E7 辅助脚本非死物:install/reinstall/辅助脚本指向现存入口,无缺参/指向已删模块。
|
|
75
|
+
|
|
76
|
+
## 3. 审计运行手册
|
|
77
|
+
|
|
78
|
+
### 3.1 提取自宣声明(兑现度审计的关键前置)
|
|
79
|
+
扫 `README`、`CONTRIBUTING`、`CLAUDE.md`、维护/发布指南、`docs/`,把所有**可证伪声明**列出来,
|
|
80
|
+
例如:
|
|
81
|
+
- 「合并前需通过 X」 → 执行载体是什么(命令/hook/CI job)?
|
|
82
|
+
- 「我们提供 Y 命令」 → `registry`/CLI 里 Y 还在吗?
|
|
83
|
+
- 「CI 含 security-scan」 → pipeline 里真有该 job 吗?
|
|
84
|
+
- 「基于 Contributor Code of Conduct」 → 文件在吗?
|
|
85
|
+
- 「锁文件保持一致」 → 锁文件入库了吗?
|
|
86
|
+
|
|
87
|
+
### 3.2 找执行载体
|
|
88
|
+
每条声明去找载体:本地质量命令 → pre-commit hook → CI job。**声明而无载体 = 名实不符(必录)**;
|
|
89
|
+
有载体但命令本身报错/不可执行同样必录。
|
|
90
|
+
|
|
91
|
+
### 3.3 证据规则
|
|
92
|
+
- 每条 finding:`claim`(一句话)+ `evidence`(文件:行/命令输出,可复核)+ `criterion`(A1…E7)+ `gap`
|
|
93
|
+
+ `confidence` + `ticket_draft`(建议 remediation 一句话)+ `effort/risk`(S/M/L)。
|
|
94
|
+
- CONFIRMED 必须亲验(实跑命令或逐行读文件);拿不准标 PLAUSIBLE 交主控复核。
|
|
95
|
+
- 审计**只读**:跑只读命令可以,修代码不行。
|
|
96
|
+
|
|
97
|
+
### 3.4 运行方式(并行加速)
|
|
98
|
+
按五支柱各派一个只读研究代理并行取证(互不共享状态),主控复核去重后综合。跨支柱重叠(如
|
|
99
|
+
「文档声称已删命令」会同时命中 D 与 B)由主控归一化。
|
|
100
|
+
|
|
101
|
+
### 3.5 名实不符实例警示(来自真实 dogfood,供识别同类问题)
|
|
102
|
+
1. **README stub 直通打包面**:根 README 只剩 `# test-project` 一行,而包配置 `readme =` 指向它
|
|
103
|
+
→ PyPI/打包展示同为 stub。判据:README 存在且非占位,或显式指向替代文档。
|
|
104
|
+
2. **模板占位符泄漏**:`CONTRIBUTING`/安装指南多处 `your-username` clone URL,新人照抄会克隆失败。
|
|
105
|
+
判据:正式文档无占位符。
|
|
106
|
+
3. **自宣质量门无执行载体**:文档称「类型检查全绿」但类型检查器不在 hook/CI/质量命令里,
|
|
107
|
+
且命令行本身报错(`--package` 缺 `py.typed` → 0 检查)——错误数字可无感合入。
|
|
108
|
+
判据:宣称的门禁必须能在 CI/hook 里看到它在跑。
|
|
109
|
+
4. **删除子系统后文档残留**:publish 命令已删/迁 CI,但发布文档、命令参考、onboarding 仍指导用户
|
|
110
|
+
执行一个已不存在的 publish 子命令。判据:文档入口与 CLI 注册表一致。
|
|
111
|
+
5. **锁文件未入库**:lockfile 在 `.gitignore` 里,CI 却用非锁定安装 + 第三方镜像。
|
|
112
|
+
判据:锁文件入库且 CI 用锁定模式,或显式声明不锁依赖。
|
|
113
|
+
|
|
114
|
+
## 4. 修复期排序与推进
|
|
115
|
+
|
|
116
|
+
### 4.1 P0/P1/P2 判据
|
|
117
|
+
- **P0**:阻断工业化基线 / 安全与发布完整性 / 低风险高可见快赢(README、占位符、发布 manual 门禁、
|
|
118
|
+
历史凭据、mypy 空转、`-k` 豁免、锁文件缺失、依赖审计门禁)。
|
|
119
|
+
- **P1**:下一里程碑补齐(文档↔CI 现实对齐、ADR/模板基座、CI 断言单一版本源、SBOM/license gate、
|
|
120
|
+
可复现 onboarding、pipeline 触发收窄)。
|
|
121
|
+
- **P2**:长期卫生(模板刷新、计数刷新、flaky 评估、死代码 lint 兜底)。
|
|
122
|
+
|
|
123
|
+
排序启发:`missing > partial`;安全/凭据类**先轮换再清历史**;低 effort 高收益靠前;
|
|
124
|
+
每 ticket 尽量单会话可独立解决。
|
|
125
|
+
|
|
126
|
+
### 4.2 每个 ticket 的推进闭环
|
|
127
|
+
```
|
|
128
|
+
brainstorm → spec(设计/契约) → plan(writing-plans) → implement(TDD/executing) → 质量门全绿(lint/type/测试/覆盖) → MR
|
|
129
|
+
```
|
|
130
|
+
- 删除类 remediation 用「彻底删除,不保留兼容层」原则。
|
|
131
|
+
- 改动验收 = 仓库质量门全绿(lint/type/测试/覆盖/pre-commit)+ 有针对性测试。
|
|
132
|
+
|
|
133
|
+
## 5. 落地约定
|
|
134
|
+
|
|
135
|
+
- 审计产物三件套:**差距报告**(支柱×发现表 + 自宣兑现度摘要 + P0/P1/P2 列表)、**路线图**
|
|
136
|
+
(wayfinder 地图 + 分级 ticket,issue tracker canonical)、**本 SOP**(把基准与方法固化,供复用到别的库)。
|
|
137
|
+
- 多库推广时:复制本 SOP 到目标库,跑 §3 手册;五支柱 checklist 保留,证据/专名替换为目标库实况。
|
|
138
|
+
- issue canonical:审计先落本地 ticket 文件;有 issue 跟踪系统(如 GitLab)恢复后按报告 §5 清单批量建 issue 回填。
|
|
139
|
+
|
|
140
|
+
## 附录 A:首次执行记录(dogfood)
|
|
141
|
+
|
|
142
|
+
- 目标:wl_cli v0.6.11(Python+Rust CLI)
|
|
143
|
+
- 产出:差距报告 + 25 张 remediation ticket(P0×10 / P1×9 / P2×6)+ 本 SOP
|
|
144
|
+
- 口径样例:五支柱 78 条发现归一化为 25 ticket;名实不符集中在「已删子系统文档残留 / 宣称无载体门禁 / 占位符泄漏」三类
|
|
145
|
+
- 复用注意:附录内容仅作执行样例,复制到其他仓库时删除本附录并替换为目标库的记录
|