@namewta/speculo 0.8.8 → 0.8.10

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.
Files changed (65) hide show
  1. package/dist/src/structured.js +186 -0
  2. package/dist/src/structured.js.map +1 -1
  3. package/package.json +1 -1
  4. package/template/canonical/canonical-specdev-goal-plan.md +1 -0
  5. package/template/canonical/canonical-specdev-grill-with-docs.md +1 -0
  6. package/template/canonical/canonical-specdev-orchestrate-implementation.md +1 -0
  7. package/template/canonical/canonical-specdev-spec.md +1 -0
  8. package/template/canonical/canonical-specdev-tickets.md +1 -0
  9. package/template/commands/archive-and-consolidate.md +9 -0
  10. package/template/commands/status.md +3 -3
  11. package/template/workflows/ops/A-archive-and-learn/A-archive-and-learn.md +64 -0
  12. package/template/workflows/ops/A-archive-and-learn/promotion-plan-template.md +41 -0
  13. package/template/workflows/ops/A-archive-and-learn/retrospective-template.md +53 -0
  14. package/template/workflows/ops/E-execute-and-stabilize/E-execute-and-stabilize.md +75 -0
  15. package/template/workflows/ops/E-execute-and-stabilize/attempt-summary-template.md +44 -0
  16. package/template/workflows/ops/E-execute-and-stabilize/diagnosis-template.md +24 -0
  17. package/template/workflows/ops/E-execute-and-stabilize/handoff-template.md +32 -0
  18. package/template/workflows/ops/E-execute-and-stabilize/rollback-template.md +26 -0
  19. package/template/workflows/ops/E-execute-and-stabilize/verification-state-template.json +30 -0
  20. package/template/workflows/ops/E-execute-and-stabilize/verification-template.md +55 -0
  21. package/template/workflows/ops/I-intake-and-assess/I-intake-and-assess.md +66 -0
  22. package/template/workflows/ops/I-intake-and-assess/change-status-template.json +26 -0
  23. package/template/workflows/ops/I-intake-and-assess/collector-catalog.md +28 -0
  24. package/template/workflows/ops/I-intake-and-assess/deployment-dossier-template.md +62 -0
  25. package/template/workflows/ops/I-intake-and-assess/global-change-status-template.json +26 -0
  26. package/template/workflows/ops/I-intake-and-assess/project-detection.md +38 -0
  27. package/template/workflows/ops/I-intake-and-assess/request-template.md +44 -0
  28. package/template/workflows/ops/I-intake-and-assess/system-report-template.md +34 -0
  29. package/template/workflows/ops/I-intake-and-assess/target-profile-template.json +24 -0
  30. package/template/workflows/ops/INDEX.md +30 -0
  31. package/template/workflows/ops/P-plan-and-approve/P-plan-and-approve.md +65 -0
  32. package/template/workflows/ops/P-plan-and-approve/plan-review-template.md +78 -0
  33. package/template/workflows/ops/README.md +120 -0
  34. package/template/workflows/ops/_state/archive/.gitkeep +1 -0
  35. package/template/workflows/ops/_state/changes/.gitkeep +1 -0
  36. package/template/workflows/ops/_state/status.json +6 -0
  37. package/template/workflows/ops/common/rules/artifact-contract.md +37 -0
  38. package/template/workflows/ops/common/rules/closure-and-learning.md +25 -0
  39. package/template/workflows/ops/common/rules/evidence-and-redaction.md +22 -0
  40. package/template/workflows/ops/common/rules/execution-loop.md +27 -0
  41. package/template/workflows/ops/common/rules/path-and-scope-contract.md +21 -0
  42. package/template/workflows/ops/common/rules/plan-and-approval.md +25 -0
  43. package/template/workflows/ops/common/rules/project-and-change-scope.md +20 -0
  44. package/template/workflows/ops/common/rules/target-profile-and-release-gates.md +44 -0
  45. package/template/workflows/ops/common/schemas/approval.schema.json +28 -0
  46. package/template/workflows/ops/common/schemas/attempt.schema.json +42 -0
  47. package/template/workflows/ops/common/schemas/change-status.schema.json +43 -0
  48. package/template/workflows/ops/common/schemas/deployment-model.schema.json +26 -0
  49. package/template/workflows/ops/common/schemas/implementation-plan.schema.json +221 -0
  50. package/template/workflows/ops/common/schemas/inventory-snapshot.schema.json +31 -0
  51. package/template/workflows/ops/common/schemas/journal-event.schema.json +22 -0
  52. package/template/workflows/ops/common/schemas/project.schema.json +19 -0
  53. package/template/workflows/ops/common/schemas/promotion-approval.schema.json +20 -0
  54. package/template/workflows/ops/common/schemas/promotion-manifest.schema.json +22 -0
  55. package/template/workflows/ops/common/schemas/status.schema.json +30 -0
  56. package/template/workflows/ops/common/schemas/target-profile.schema.json +32 -0
  57. package/template/workflows/ops/common/schemas/verification-state.schema.json +30 -0
  58. package/template/workflows/ops/common/tools/close-change.mjs +177 -0
  59. package/template/workflows/ops/common/tools/validate-ops.mjs +992 -0
  60. package/template/workflows/ops/runtime-contract.json +14 -0
  61. package/template/workflows/specdev/L-learn-change/L-learn-change.md +99 -0
  62. package/template/workflows/specdev/README.md +8 -2
  63. package/template/workflows/specdev/common/rules/artifact-contract.md +1 -0
  64. package/template/workflows/specdev/common/tools/README.md +1 -1
  65. package/template/workflows/specdev/common/tools/validate-specdev.mjs +105 -0
@@ -0,0 +1,75 @@
1
+ ---
2
+ id: ops/execute-and-stabilize
3
+ type: workflow-entry
4
+ workflow: ops
5
+ name: 执行、诊断并稳定部署
6
+ description: 以不可覆盖 attempt 执行批准计划或只读验证,在失败时诊断并路由重新规划或回滚,最终用稳定性证据完成 change。
7
+ keywords: [执行, attempt, 调试, 诊断, 回滚, 验证, 稳定性]
8
+ ---
9
+
10
+ # 执行、诊断并稳定部署
11
+
12
+ > 激活本 Work 后,先读取 `<Path>{roots.workflows}/ops/README.md</Path>`,再执行本入口。
13
+
14
+ E 是正常部署、批准回滚、attempt 诊断、验证和 completed 转换的唯一 owner。它不补写计划或批准,也不把命令退出零当作部署完成。
15
+
16
+ ## 模式
17
+
18
+ - `deploy`:执行当前批准计划;
19
+ - `remediation`:执行失败 attempt 触发并重新批准的修订计划;
20
+ - `rollback`:执行当前计划已批准的恢复批次或 automatic trigger;
21
+ - `verification-only`:global inventory-only change 的定向只读重读,不伪造部署 run。
22
+
23
+ ## 流程
24
+
25
+ ### 1. 恢复与预检
26
+
27
+ 读取所有既有 attempts、当前 status、request、inventory、deployment model、target profile、plan/approval、`<Path>{roots.workflows}/ops/common/rules/execution-loop.md</Path>` 与 `<Path>{roots.workflows}/ops/common/rules/target-profile-and-release-gates.md</Path>`。除 verification-only 外必须通过 `--stage pre-execute`,重建 plan/profile 摘要、source、target、路径包含、整体控制面身份、权限、容量、端口、Gate、数据保护、preview 和 rollback material。
28
+
29
+ 在第一条 mutation 前重采集 identity assertions 并按 exact/ordered-list/set/digest 比较。任何 profile/identity/构件漂移、新 mutation、新权限或计划外写入都会零 mutation 停止,令 approval invalidated 并返回 I/P。发现同一 target/deployment root 正被另一 change 执行时阻塞。
30
+
31
+ 旧 plan v2 与 attempt v1 只读,不得追加 journal、补写字段或作为新 pre-execute/pre-close 证据。需要继续或关闭此类 change 时,保留旧工件,由 I/P 在需要 mutation 时生成 plan v3;无新增 mutation 时创建绑定当前 target profile 的 verification-only attempt v2。只有该 v2 attempt 的 verification state 与 HANDOFF 通过,change 才能重新进入 pre-close/pre-archive。
32
+
33
+ ### 2. 创建 Attempt
34
+
35
+ 分配最小未占用 ATTEMPT-NNN,创建 `execution/attempts/{attempt-id}/`,从 `<Path>{roots.workflows}/ops/E-execute-and-stabilize/attempt-summary-template.md</Path>` 初始化 summary,并写符合 attempt v2 schema 的 `attempt.json`。创建 append-only `journal.jsonl`,每一行独立符合 `<Path>{roots.workflows}/ops/common/schemas/journal-event.schema.json</Path>`;先持久化 attempt-start,再设置 phase=executing/latest_attempt_id。
36
+
37
+ 每个 required Gate 通过后才能开始其约束的 batch。每个 operation 先写 intent/precondition,再执行 apply,随后写 exit、脱敏摘要、postcondition 和 evidence。Gate failed/blocked 后立即停止新 operation,后续 Gate 只记 skipped;不得提升活动指针或删除候选。恢复会话时先核对连续 journal sequence 和真实 postcondition;无法证明幂等则停止。
38
+
39
+ ### 3. 失败诊断与循环
40
+
41
+ operation、postcondition 或验证失败时立即停止后续 batch,使用 `<Path>{roots.workflows}/ops/E-execute-and-stabilize/diagnosis-template.md</Path>` 写 `diagnosis.md`:记录错误 signature、现场、假设、证据、确认/排除根因、已尝试动作和建议修复。
42
+
43
+ 只读、scope 内、不会写 cache/产生业务负载的诊断可继续并写 journal。任何修复 mutation、命令、write set、权限或事故半径变化都把 phase 设为 diagnosing,返回 `<Path>{roots.workflows}/ops/P-plan-and-approve/P-plan-and-approve.md</Path>` 创建新计划并批量批准。不得临场修改旧计划。
44
+
45
+ ### 4. 回滚
46
+
47
+ 仅当 rollback 已在当前批准 batch 内,或 operation rollback mode=automatic 且触发条件确定命中时执行。使用 `<Path>{roots.workflows}/ops/E-execute-and-stabilize/rollback-template.md</Path>` 记录 checkpoint、反向依赖顺序、数据/流量影响和恢复后状态;数据恢复仍需计划中的独立授权。未批准恢复动作返回 P,不以紧急为由扩大权限。
48
+
49
+ ### 5. 验证与完成
50
+
51
+ 所有 mutation attempt 完成后设置 phase=stabilizing,从 `<Path>{roots.workflows}/ops/E-execute-and-stabilize/verification-state-template.json</Path>` 生成 `verification-state.json` v1,并按 `<Path>{roots.workflows}/ops/common/schemas/verification-state.schema.json</Path>` 校验。它穷尽 identity results、required Gates、目标端构件摘要、服务状态/restart/runtime digest、逐 probe 预期 HTTP/业务码/认证要求、收敛组、稳定窗口、数据保护、恢复兼容、previous release、rollback material、保留候选和风险。verification-only 还证明 snapshot scope、target identity、关键关联、容量和零 mutation。
52
+
53
+ 使用 `<Path>{roots.workflows}/ops/E-execute-and-stabilize/verification-template.md</Path>` 投影 `verification.md`,并从 `<Path>{roots.workflows}/ops/E-execute-and-stabilize/handoff-template.md</Path>` 生成无密钥 `HANDOFF.md`;Markdown 不得成为结构化状态的替代事实源。production data mutation 的 protection 必须 verified,任何 waiver 都失败;local waiver 必须与 plan 的精确授权和完整 preflight 一致。
54
+
55
+ 全部 required Gate/verification 通过且 HANDOFF 无密钥时,将 attempt 标记 succeeded,按实际结果设置 outcome=succeeded 或 rolled_back;用户明确终止、证明没有未受控 mutation并接受残余风险时可 abandoned。随后原子设置 change_status=completed、phase=ready_to_archive、completed_at,清空 blockers/current_work,运行 `--stage pre-close` 并返回 A。
56
+
57
+ ## 完成标准
58
+
59
+ - 每次执行、诊断、回滚或只读验证都有独立 attempt,旧 attempt 未覆盖;
60
+ - 新 attempt 为 v2,journal 每行符合 journal-event v1,verification state/HANDOFF 与 attempt locator 一致;
61
+ - 每个 mutation 有有效批次批准、前后条件和脱敏 evidence;
62
+ - Gate 失败后未推进后续 operation,production 数据保护不存在 waiver;
63
+ - 失败后停止,新增修复动作通过 P 重新规划而非临场执行;
64
+ - 最终验证覆盖所有 required 条件和稳定窗口;
65
+ - 未知或失败状态没有 completed;
66
+ - completed change 通过 pre-close validator并路由 A。
67
+
68
+ ## 子文件引用
69
+
70
+ - Attempt 摘要:`<Path>{roots.workflows}/ops/E-execute-and-stabilize/attempt-summary-template.md</Path>`
71
+ - 失败诊断:`<Path>{roots.workflows}/ops/E-execute-and-stabilize/diagnosis-template.md</Path>`
72
+ - 验证矩阵:`<Path>{roots.workflows}/ops/E-execute-and-stabilize/verification-template.md</Path>`
73
+ - 回滚记录:`<Path>{roots.workflows}/ops/E-execute-and-stabilize/rollback-template.md</Path>`
74
+ - 结构化验证与交接:`<Path>{roots.workflows}/ops/E-execute-and-stabilize/verification-state-template.json</Path>`、`<Path>{roots.workflows}/ops/E-execute-and-stabilize/handoff-template.md</Path>`
75
+ - Attempt、journal 与验证 schema:`<Path>{roots.workflows}/ops/common/schemas/attempt.schema.json</Path>`、`<Path>{roots.workflows}/ops/common/schemas/journal-event.schema.json</Path>`、`<Path>{roots.workflows}/ops/common/schemas/verification-state.schema.json</Path>`
@@ -0,0 +1,44 @@
1
+ # Ops Attempt Summary
2
+
3
+ | Field | Value |
4
+ | --- | --- |
5
+ | Scope / project | {scope} / {project_id} |
6
+ | Change / attempt | {change} / {attempt_id} |
7
+ | Kind | deploy / remediation / rollback / verification-only |
8
+ | Triggered by | {triggered_by} |
9
+ | Plan / digest | {plan_path} / {plan_digest} |
10
+ | Approval | {approval_path} |
11
+ | Target profile / digest | {target_profile_path} / {target_profile_digest} |
12
+ | Verification state | {verification_state_path} |
13
+ | Handoff | {handoff_path} |
14
+ | Started / ended | {started_at} / pending |
15
+ | Result | running |
16
+
17
+ ## Preflight
18
+
19
+ 记录 profile/plan/approval 摘要、控制面 identity 重采集、protected targets、deployment root、数据保护和恢复资产;不得回显 secret。
20
+
21
+ ## Gate Results
22
+
23
+ | Sequence | Gate | Status | Required verification | Evidence |
24
+ | --- | --- | --- | --- | --- |
25
+
26
+ ## Batch and Operation Results
27
+
28
+ ## Actual Mutations
29
+
30
+ 所有事实事件逐行写入 append-only `journal.jsonl`,每行使用 journal-event v1;本摘要不替代 typed journal。
31
+
32
+ ## Diagnostics Performed
33
+
34
+ ## Failed and Not-run Operations
35
+
36
+ ## Redactions
37
+
38
+ ## Deviations and Residual Risk
39
+
40
+ ## Data Protection and Recovery Assets
41
+
42
+ ## Verification or Next Route
43
+
44
+ terminal attempt 引用 `verification-state.json`;成功、回滚或 completed abandoned 还必须引用无密钥 `HANDOFF.md`。
@@ -0,0 +1,24 @@
1
+ # Attempt Diagnosis
2
+
3
+ ## Failure Signature
4
+
5
+ 提供稳定、脱敏、可检索的错误特征,不复制 secret 或无界原始日志。
6
+
7
+ ## Target State and Evidence
8
+
9
+ ## Hypotheses
10
+
11
+ | Hypothesis | Evidence for | Evidence against | Verdict |
12
+ | --- | --- | --- | --- |
13
+
14
+ ## Confirmed or Suspected Root Cause
15
+
16
+ 明确 confidence 和仍缺失的证据。
17
+
18
+ ## Actions Already Tried
19
+
20
+ ## Proposed Remediation or Rollback
21
+
22
+ ## Plan Delta Required
23
+
24
+ 列出新增或改变的 mutation、command、write set、privilege、external target、验证和恢复;无变化时明确 `none`。
@@ -0,0 +1,32 @@
1
+ # Ops Deployment Handoff
2
+
3
+ | Field | Value |
4
+ | --- | --- |
5
+ | Scope / project | {scope} / {project_id} |
6
+ | Change / attempt | {change} / {attempt_id} |
7
+ | Mode / environment | {operation_mode} / {environment_class} |
8
+ | Plan / approval | {plan_path} / {approval_path} |
9
+ | Verification state | {verification_state_path} |
10
+ | Verdict | passed / failed / blocked |
11
+
12
+ ## Target and Control-plane Identity
13
+
14
+ 只列非敏感 identity assertion、匹配结果与 evidence locator。
15
+
16
+ ## Source and Immutable Artifacts
17
+
18
+ ## Gate Results
19
+
20
+ ## Services and Runtime Convergence
21
+
22
+ ## Semantic Probes and Stability Windows
23
+
24
+ ## Data Protection
25
+
26
+ ## Recovery and Previous Release
27
+
28
+ ## Retained Candidates and Rollback Assets
29
+
30
+ ## Remaining Risks and Operator Follow-up
31
+
32
+ 不得包含密码、token、私钥、cookie、完整连接串或 secret 值。凭据仅记录 provider/受控 locator、版本和 presence 状态。
@@ -0,0 +1,26 @@
1
+ # Attempt Rollback
2
+
3
+ | Field | Value |
4
+ | --- | --- |
5
+ | Change / attempt | {change} / {attempt_id} |
6
+ | Failed attempt | {triggered_by} |
7
+ | Plan / approval | {plan_path} / {approval_path} |
8
+ | Restore checkpoint | {checkpoint} |
9
+ | Started / ended | {started_at} / pending |
10
+
11
+ ## Trigger and Authorization
12
+
13
+ ## Pre-rollback Target State
14
+
15
+ ## Restore Operations
16
+
17
+ | Operation | Expected restore | Actual | Result | Evidence |
18
+ | --- | --- | --- | --- | --- |
19
+
20
+ ## Data and Traffic Effects
21
+
22
+ ## Post-rollback Target State
23
+
24
+ ## Failed or Manual Recovery Items
25
+
26
+ ## Residual Risks and Verification
@@ -0,0 +1,30 @@
1
+ {
2
+ "schema_version": 1,
3
+ "artifact": "ops-verification-state",
4
+ "scope": "project",
5
+ "project_id": "{project_id}",
6
+ "change": "{change}",
7
+ "attempt_id": "{attempt_id}",
8
+ "captured_at": "{captured_at}",
9
+ "target_profile_path": "deployment/target-profile.json",
10
+ "target_profile_digest": "{target_profile_digest}",
11
+ "identity_results": [],
12
+ "gates": [],
13
+ "artifacts": [],
14
+ "services": [],
15
+ "probes": [],
16
+ "convergence": [],
17
+ "data_protection": [],
18
+ "recovery": {
19
+ "strategy": "not-applicable",
20
+ "previous_release_ref": null,
21
+ "rollback_operation_refs": [],
22
+ "material_refs": [],
23
+ "compatibility_verified": false,
24
+ "data_restore_authorized": null,
25
+ "evidence": []
26
+ },
27
+ "retained_artifacts": [],
28
+ "risks": [],
29
+ "verdict": "blocked"
30
+ }
@@ -0,0 +1,55 @@
1
+ # Attempt Verification
2
+
3
+ | Field | Value |
4
+ | --- | --- |
5
+ | Change / attempt | {change} / {attempt_id} |
6
+ | Target | {target} |
7
+ | Target profile / digest | {target_profile_path} / {target_profile_digest} |
8
+ | Verification state | {verification_state_path} |
9
+ | Started / ended | {started_at} / pending |
10
+ | Outcome | pending |
11
+
12
+ ## Target Re-read
13
+
14
+ ## Identity Assertion Results
15
+
16
+ | Assertion | Comparison | Expected | Actual | Matched | Evidence |
17
+ | --- | --- | --- | --- | --- | --- |
18
+
19
+ ## Gate Results
20
+
21
+ | Sequence | Gate | Status | Evidence |
22
+ | --- | --- | --- | --- |
23
+
24
+ ## Verification Matrix
25
+
26
+ | Check | Required | Method/environment | Expected | Actual | Result | Evidence |
27
+ | --- | --- | --- | --- | --- | --- | --- |
28
+
29
+ ## Immutable Artifacts and Target-side Digests
30
+
31
+ ## Health, Ports and Dependencies
32
+
33
+ ## Smoke and Business Signals
34
+
35
+ 每个 probe 使用自身允许的 HTTP 状态、业务码与认证要求;记录瞬时失败和连续成功数。
36
+
37
+ ## Restart and Persistence
38
+
39
+ ## Resource and Stability Window
40
+
41
+ ## Multi-instance Convergence
42
+
43
+ ## Data and Migration
44
+
45
+ 记录每个 protection id 的 backup/waiver/not-required/failed、evidence digest、readability 和 restore 验证。production 不允许 waiver;local waiver 必须与 plan 的精确授权一致。
46
+
47
+ ## Recovery, Previous Release and Retained Assets
48
+
49
+ ## Logs, Monitoring and Alerts
50
+
51
+ ## Deviations and Residual Risks
52
+
53
+ ## Completion Decision
54
+
55
+ 本文件是 `verification-state.json` v1 的无密钥 Markdown 投影。结构化 state 缺失、摘要不匹配、required Gate/verification 未通过或 HANDOFF 含 secret 时不得 completed。
@@ -0,0 +1,66 @@
1
+ ---
2
+ id: ops/intake-and-assess
3
+ type: workflow-entry
4
+ workflow: ops
5
+ name: 摄入并评估运维目标
6
+ description: 初始化 Ops,识别全局或项目 scope,创建或恢复 change,并用系统盘点、项目分析和目标身份形成可规划部署档案。
7
+ keywords: [摄入, change, 项目识别, 系统盘点, 部署分析, target profile]
8
+ ---
9
+
10
+ # 摄入并评估运维目标
11
+
12
+ > 激活本 Work 后,先读取 `<Path>{roots.workflows}/ops/README.md</Path>`,再执行本入口。
13
+
14
+ I 是初始化、scope/project/change 选择、部署模型和 target profile 的唯一 owner。它回答“当前工作属于哪里、目标现在是什么、项目需要怎样部署、现场身份与授权边界是什么、是否已经可以规划”,不构建、安装、启动服务或修改目标。
15
+
16
+ ## 流程
17
+
18
+ ### 1. 初始化与确定 Scope
19
+
20
+ 读取 `<Path>{roots.workflows}/ops/common/rules/project-and-change-scope.md</Path>`。缺少状态时以 schema v2 seed 原子创建 `status.json`,并创建不存在的全局 `changes/`、`archive/`、`context/`、`adr/`、`runbooks/` 和 `projects/`;已有内容只验证,不覆盖或猜测迁移。
21
+
22
+ 系统基线、Docker/宿主机通用配置或跨项目文档使用 `scope=global`。指定项目的部署、修复、扩容、升级和回滚使用 `scope=project`。项目 scope 必须解析或创建 `<Path>{roots.state}/ops/projects/{project_id}/project.json</Path>`,对照 `<Path>{roots.workflows}/ops/common/schemas/project.schema.json</Path>` 验证稳定 id、显示名、aliases 和无凭据 identity。
23
+
24
+ ### 2. 创建或恢复 Change
25
+
26
+ 在 scope 根选择用户指定 change、唯一 active change 或新 change;多个候选一次性消歧。新 change 使用 `YYYY-MM-DD-<topic>[-NN]`:project scope 从 `<Path>{roots.workflows}/ops/I-intake-and-assess/change-status-template.json</Path>` 创建 `.status.json`,global scope 从 `<Path>{roots.workflows}/ops/I-intake-and-assess/global-change-status-template.json</Path>` 创建;随后用 `<Path>{roots.workflows}/ops/I-intake-and-assess/request-template.md</Path>` 初始化 request、LOG、CONTEXT 和 ADR。
27
+
28
+ 先原子写 change,再将 `{scope, project_id, change}` 加入全局 active。归档历史只读;继续历史时创建 follow-up,并记录 `derived_from` 的完整 scope locator。项目 change 根必须是 `<Path>{roots.state}/ops/projects/{project_id}/changes/{change}/</Path>`,不得使用全局 flat change 目录。
29
+
30
+ ### 3. 盘点目标系统
31
+
32
+ 读取 `<Path>{roots.workflows}/ops/common/rules/path-and-scope-contract.md</Path>` 和 `<Path>{roots.workflows}/ops/common/rules/evidence-and-redaction.md</Path>`,按 `<Path>{roots.workflows}/ops/I-intake-and-assess/collector-catalog.md</Path>` 运行适用 L0/L1 collectors。L2 只针对用户一次批准的根列表。
33
+
34
+ 把不可覆盖快照写入 change `inventory/snapshots/{snapshot-id}.json`,并从 `<Path>{roots.workflows}/ops/I-intake-and-assess/system-report-template.md</Path>` 更新 `inventory/system-report.md`。瞬时 Docker/进程/端口状态只留在 change;稳定系统事实在 A 阶段才可提升为全局 context。
35
+
36
+ ### 4. 分析项目部署与目标身份
37
+
38
+ global inventory-only 请求跳过 deployment model,但仍为 verification-only 目标生成非 mutation target profile;global 配置变更则以 `project=null` 建立系统配置 deployment model。project scope 读取真实项目指令和 `<Path>{roots.workflows}/ops/I-intake-and-assess/project-detection.md</Path>`,穷尽实际 manifest、lockfile、容器、CI/CD、配置、服务、集群、数据、健康和恢复线索;结构化格式使用 parser。
39
+
40
+ 读取 `<Path>{roots.workflows}/ops/common/rules/target-profile-and-release-gates.md</Path>`,从 `<Path>{roots.workflows}/ops/I-intake-and-assess/target-profile-template.json</Path>` 生成 `deployment/target-profile.json` v1,并按 `<Path>{roots.workflows}/ops/common/schemas/target-profile.schema.json</Path>` 验证。profile 选择 `audit | takeover | fresh | release | upgrade | rollback`,记录 environment class、唯一 deployment root、existing state、不可拆分 identity assertions、owned/protected/unknown targets、差异分类和 secret provider/locator 元数据。
41
+
42
+ 只要存在持久目录、控制面资源、数据、路由或服务,就使用 takeover;现场为 present 或 unknown 时不得选择 fresh。fresh 只在目标为空、归属明确且 protected/unknown targets 为空时 Ready。mutation 模式必须有整体 identity confirmation;ownership-conflict、unknown difference、未确认身份或不明 deployment root 都使 profile blocked。
43
+
44
+ 会联网、执行项目代码、写 cache 或下载依赖的动态 probe 只登记,不在 I 执行。写入 `deployment/deployment-model.json`、`deployment/target-profile.json` 和 `deployment/deployment-dossier.md`,分别对照 schema 与 `<Path>{roots.workflows}/ops/I-intake-and-assess/deployment-dossier-template.md</Path>`。配置和 secret requirement 只记录 key、scope、provider/受控 source ref、version/presence,不保存值。
45
+
46
+ ### 5. 验证与路由
47
+
48
+ 运行 validator 并重读工件。全局 inventory-only 在快照完整且 audit profile 有效时将 phase 设为 assessment,路由 `<Path>{roots.workflows}/ops/E-execute-and-stabilize/E-execute-and-stabilize.md</Path>` 的 verification-only 分支。项目部署或全局 mutation 只有 deployment model 与 target profile 都 Ready 才进入 `<Path>{roots.workflows}/ops/P-plan-and-approve/P-plan-and-approve.md</Path>`;blocking unknown 保持 blocked,并一次列出 owner 和所需决定。
49
+
50
+ ## 完成标准
51
+
52
+ - scope/project/change tuple 唯一且与实际目录、全局索引一致;
53
+ - 项目身份不会因目录同名误合并,也不包含凭据;
54
+ - target profile v1 固定 operation mode、environment、deployment root、控制面身份、ownership 与差异分类;
55
+ - present/unknown 现场没有被误判为 fresh,mutation profile 已显式确认整体身份;
56
+ - 适用 collector 全部得到 observed/partial/unavailable/denied/failed 结论;
57
+ - 项目评估穷尽实际部署入口且未把推断伪装为观测;
58
+ - 未发生构建、安装、目标写入或外部 mutation;
59
+ - validator 通过并返回唯一下一路由。
60
+
61
+ ## 子文件引用
62
+
63
+ - 状态与请求模板:`<Path>{roots.workflows}/ops/I-intake-and-assess/change-status-template.json</Path>`、`<Path>{roots.workflows}/ops/I-intake-and-assess/global-change-status-template.json</Path>`、`<Path>{roots.workflows}/ops/I-intake-and-assess/request-template.md</Path>`
64
+ - 盘点分支:`<Path>{roots.workflows}/ops/I-intake-and-assess/collector-catalog.md</Path>`、`<Path>{roots.workflows}/ops/I-intake-and-assess/system-report-template.md</Path>`
65
+ - 项目分支:`<Path>{roots.workflows}/ops/I-intake-and-assess/project-detection.md</Path>`、`<Path>{roots.workflows}/ops/I-intake-and-assess/deployment-dossier-template.md</Path>`
66
+ - Target profile:`<Path>{roots.workflows}/ops/I-intake-and-assess/target-profile-template.json</Path>`、`<Path>{roots.workflows}/ops/common/schemas/target-profile.schema.json</Path>`
@@ -0,0 +1,26 @@
1
+ {
2
+ "schema_version": 2,
3
+ "artifact": "ops-change-status",
4
+ "scope": "project",
5
+ "project_id": "{project_id}",
6
+ "change": "{change}",
7
+ "change_status": "active",
8
+ "phase": "intake",
9
+ "current_work": null,
10
+ "works_run": [],
11
+ "created_at": "{created_at}",
12
+ "updated_at": "{updated_at}",
13
+ "completed_at": null,
14
+ "archived_at": null,
15
+ "archive_path": null,
16
+ "source_revision": null,
17
+ "target_fingerprint": null,
18
+ "plan_path": null,
19
+ "plan_digest": null,
20
+ "approval_path": null,
21
+ "approval_status": "not_requested",
22
+ "approved_batches": [],
23
+ "latest_attempt_id": null,
24
+ "outcome": "pending",
25
+ "blockers": []
26
+ }
@@ -0,0 +1,28 @@
1
+ # 系统盘点 Collector 目录
2
+
3
+ 只选择当前目标适用且已存在的工具。以下命令族是发现候选,不是强制执行清单;运行前检查帮助、版本、权限和输出敏感性。
4
+
5
+ ## L0
6
+
7
+ | Category | Unix/Linux candidates | macOS candidates | Required result |
8
+ | --- | --- | --- | --- |
9
+ | Host | `uname`, `/etc/os-release`, `hostname`, `uptime` | `uname`, `sw_vers`, `hostname`, `uptime` | OS、架构、稳定目标标识、时间 |
10
+ | Capacity | `nproc`, `free`, `df`, `df -i`, `mount`, `lsblk` | `sysctl`, `vm_stat`, `df`, `mount`, `diskutil` | CPU、内存、挂载点、容量和 inode |
11
+ | Runtimes | 查询已安装 Java/Go/Node/Python/Docker/包管理器版本 | 同左 | executable、版本、来源;不安装 |
12
+
13
+ ## L1
14
+
15
+ | Category | Candidates | Required result |
16
+ | --- | --- | --- |
17
+ | Services | `systemctl list-units/show`;macOS `launchctl` | 名称、状态、unit/plist、ExecStart、WorkingDirectory |
18
+ | Processes | `ps`、受限 `/proc/<pid>`、`lsof` 或 osquery | PID 仅作瞬时证据;关联 executable、cwd、user |
19
+ | Network | `ss`、`lsof -i`、`netstat` | listener、address、port、process;不扫描外部网络 |
20
+ | Docker | `docker info/ps/compose ls/system df` 和必要 inspect | context、daemon、container/image/volume/network、compose 与 bind path |
21
+ | Kubernetes | current-context 和 scoped `get` | context、namespace、workload、service、ingress;不切换 context |
22
+ | Project locations | 从 service cwd、compose labels、bind mounts 和明确 roots 反查 | 只报告证据支持的路径 |
23
+
24
+ Docker inspect、Compose config、进程环境和 Kubernetes Secret 可能泄露敏感值。默认不读取进程完整环境或 Secret data,保存前按 evidence-and-redaction 处理。
25
+
26
+ ## L2
27
+
28
+ 只对批准根执行受限深度的容量、权限、文件类型、最大文件或 inode 热点分析。记录根、排除项、超时和实际边界;不得跟随符号链接越界或读取文件正文来判断占用。
@@ -0,0 +1,62 @@
1
+ # Deployment Dossier
2
+
3
+ | Field | Value |
4
+ | --- | --- |
5
+ | Project / change | {project_id} / {change} |
6
+ | Source root | {source_root} |
7
+ | Source revision | {source_revision} |
8
+ | Target snapshot | {snapshot_path} |
9
+ | Target profile / digest | deployment/target-profile.json / {target_profile_digest} |
10
+ | Operation mode | audit / takeover / fresh / release / upgrade / rollback |
11
+ | Environment class | local / shared-nonprod / production |
12
+ | Existing state | absent / present / unknown |
13
+ | Identity confirmed | true / false |
14
+ | Deployment root | {deployment_root} |
15
+ | Existing project SOP | {runbook_paths} |
16
+ | Readiness | blocked / ready |
17
+
18
+ ## Requested Outcome and Constraints
19
+
20
+ ## Component and Runtime Map
21
+
22
+ ## Build, Artifact, Start and Restart
23
+
24
+ ## Middleware and External Dependencies
25
+
26
+ ## Configuration Matrix
27
+
28
+ 仅记录 key、scope、required、secret 和 source reference。
29
+
30
+ ## Ports, Exposure and Health
31
+
32
+ ## Data, Volumes, Migration and Backup
33
+
34
+ ## Deployment Options and Tradeoffs
35
+
36
+ ## Selected Method and Target Fit
37
+
38
+ ## Target and Control-plane Identity
39
+
40
+ 逐项列出 provider、key、comparison、非敏感 expected 与 evidence。Compose project、有序 files、env file、services、labels/image identity 和 bind host 不得折叠成单一目录名判断。
41
+
42
+ ## Ownership and Difference Classification
43
+
44
+ 列出 owned/protected/unknown targets;每项差异只能是 expected、safe-reconcile、requires-backup、ownership-conflict 或 unknown。
45
+
46
+ ## Immutable Artifacts, Staging and Activation
47
+
48
+ ## Required Gates and Stability Expectations
49
+
50
+ ## Security and Required Privileges
51
+
52
+ ## Secret Requirements
53
+
54
+ 只记录 key、provider/受控 source reference、version 和 presence requirement,不保存值。
55
+
56
+ ## Prior SOP, Known Failures and Applicable ADRs
57
+
58
+ ## Unknowns and Dynamic Probes
59
+
60
+ ## Planning Preconditions
61
+
62
+ ## Evidence Sources
@@ -0,0 +1,26 @@
1
+ {
2
+ "schema_version": 2,
3
+ "artifact": "ops-change-status",
4
+ "scope": "global",
5
+ "project_id": null,
6
+ "change": "{change}",
7
+ "change_status": "active",
8
+ "phase": "intake",
9
+ "current_work": null,
10
+ "works_run": [],
11
+ "created_at": "{created_at}",
12
+ "updated_at": "{updated_at}",
13
+ "completed_at": null,
14
+ "archived_at": null,
15
+ "archive_path": null,
16
+ "source_revision": null,
17
+ "target_fingerprint": null,
18
+ "plan_path": null,
19
+ "plan_digest": null,
20
+ "approval_path": null,
21
+ "approval_status": "not_requested",
22
+ "approved_batches": [],
23
+ "latest_attempt_id": null,
24
+ "outcome": "pending",
25
+ "blockers": []
26
+ }
@@ -0,0 +1,38 @@
1
+ # 项目部署探测
2
+
3
+ 按实际存在内容选择,不按语言预设结论。
4
+
5
+ ## 身份与边界
6
+
7
+ - 读取项目 Agent 指令、仓库根、worktree/dirty 状态、子模块和多仓库关系;
8
+ - VCS remote 必须移除 userinfo、token 和 query 后才能作为 identity;
9
+ - monorepo 使用仓库 identity 加组件相对路径,不能把两个组件误作同一部署单元;
10
+ - 目录名只能作为 project id 候选,不能单独证明项目身份。
11
+
12
+ ## 通用入口
13
+
14
+ - README、部署/运维文档、Makefile、Taskfile、脚本和 CI/CD;
15
+ - Dockerfile、Compose、`.dockerignore`、entrypoint 和 healthcheck;
16
+ - Kubernetes、Kustomize、Helm、Terraform、Ansible、systemd/launchd;
17
+ - 配置 schema、`.env.example`、示例 YAML/TOML/JSON、secret provider 引用;
18
+ - migration、seed、backup/restore、volume 和数据保留说明。
19
+
20
+ ## Runtime 线索
21
+
22
+ | Ecosystem | Static sources | Questions to resolve |
23
+ | --- | --- | --- |
24
+ | Java/JVM | `pom.xml`、Gradle、wrapper、toolchains、application config | JDK、artifact、profile、JVM flags、中间件、migration |
25
+ | Go | `go.mod`、workspace、build tags、main、embed | Go version、CGO、OS/arch、binary flags |
26
+ | Node | `package.json`、lockfile、workspace、runtime version | package manager、build/start、Node、process manager |
27
+ | Python | `pyproject.toml`、lockfiles、WSGI/ASGI | interpreter、environment、workers、native dependencies |
28
+ | Container | Dockerfile stages、Compose、healthcheck、mounts | args、runtime env、ports、volumes、networks、platform |
29
+
30
+ XML、JSON、YAML 和 TOML 使用可用结构化 parser。读取配置时只提取 key 和结构;示例值不自动视为生产值,真实值不复制到 change。
31
+
32
+ ## 证据等级
33
+
34
+ - manifest 明确声明:declared;
35
+ - lockfile/runtime file 固定:declared with stronger pin;
36
+ - 文档无配置支持:unverified;
37
+ - 目标命令验证:observed;
38
+ - 模型推断:inferred,写依据与置信度。
@@ -0,0 +1,44 @@
1
+ # Ops Request
2
+
3
+ | Field | Value | Source |
4
+ | --- | --- | --- |
5
+ | Scope | global / project | user and discovery |
6
+ | Project id | none / `{project_id}` | project registry |
7
+ | Change | `{change}` | assigned |
8
+ | Topic | unresolved | user request |
9
+ | Requested outcome | unresolved | user |
10
+ | Source project | none / unresolved | user/project discovery |
11
+ | Target environment | unresolved | user |
12
+ | Target systems | unresolved | user/current context |
13
+ | Environment class | local / shared-nonprod / production / unresolved | user |
14
+ | Deployment root | unresolved | user/plan |
15
+ | Maintenance window | unresolved | user |
16
+ | Derived from | none | status/archive |
17
+
18
+ ## In Scope
19
+
20
+ - unresolved
21
+
22
+ ## Out of Scope
23
+
24
+ - unresolved
25
+
26
+ ## User Constraints
27
+
28
+ - unresolved
29
+
30
+ ## Success, Stop and Recovery
31
+
32
+ - Success: unresolved
33
+ - Failure/stop conditions: unresolved
34
+ - Recovery expectation: unresolved
35
+
36
+ ## Known Inputs
37
+
38
+ - Source revision: unresolved
39
+ - Existing inventory snapshot: none
40
+ - Existing project SOP: none
41
+
42
+ ## Open Decisions
43
+
44
+ - unresolved
@@ -0,0 +1,34 @@
1
+ # System Survey
2
+
3
+ | Field | Value |
4
+ | --- | --- |
5
+ | Scope / project | {scope} / {project_id} |
6
+ | Change | {change} |
7
+ | Snapshot | {snapshot_path} |
8
+ | Captured at | {captured_at} |
9
+ | Target fingerprint | {target_fingerprint} |
10
+ | Levels | {levels} |
11
+
12
+ ## Target and Host
13
+
14
+ ## Capacity and Paths
15
+
16
+ ## Runtimes and Development Tools
17
+
18
+ ## Services, Processes and Working Directories
19
+
20
+ ## Ports and Network Bindings
21
+
22
+ ## Docker and Compose
23
+
24
+ ## Kubernetes or Other Control Planes
25
+
26
+ ## Project Locations
27
+
28
+ ## Observation Gaps
29
+
30
+ ## Redactions and Sensitivity
31
+
32
+ ## Freshness
33
+
34
+ 说明规划或执行前必须重采集的事实,以及本快照不能证明的内容。
@@ -0,0 +1,24 @@
1
+ {
2
+ "schema_version": 1,
3
+ "artifact": "ops-target-profile",
4
+ "scope": "project",
5
+ "project_id": "{project_id}",
6
+ "change": "{change}",
7
+ "created_at": "{created_at}",
8
+ "operation_mode": "takeover",
9
+ "environment_class": "shared-nonprod",
10
+ "deployment_root": "{absolute_deployment_root}",
11
+ "existing_state": "present",
12
+ "identity_confirmed": false,
13
+ "identity_confirmation_evidence": null,
14
+ "identity_assertions": [],
15
+ "ownership": {
16
+ "owned_targets": [],
17
+ "protected_targets": [],
18
+ "unknown_targets": []
19
+ },
20
+ "differences": [],
21
+ "secret_requirements": [],
22
+ "readiness": "blocked",
23
+ "blockers": ["target identity has not been confirmed"]
24
+ }