Commit Graph
185 Commits
Author SHA1 Message Date
chichuan c5b537c8cf fix(drive): 修正 --latest 不完整扫描建议的自相矛盾并补齐叶子 Selection
P2-1 LATEST_SCAN_INCOMPLETE 的 Suggestion 与示例自相矛盾

问题:正文让用户「去掉 --latest 重跑」看失败明细,紧跟的唯一示例却是
dws drive list --folder <子目录ID> --latest N —— 照抄必然复现同一个错误。
根因:两条互斥的出路(缩范围后仍取 Top-N / 去掉 --latest 看明细)挤在一句里,
却只给了一条命令。
修法:每个「;」子句自带与该子句正文一致的命令 —— 重取 Top-N 那条保留 --latest,
去掉 --latest 那条给 --depth 版本。同时把 partial + errors[] 的承诺显式限定在
--depth>1:单层(含知识库 maxDepth=1)去掉 --latest 会路由回普通单层 list,
本就没有 errors[] 契约,无条件承诺只是把矛盾换成另一种不准确。
LATEST_SCAN_TRUNCATED 那条只有一个子句且命令保留 --latest,本身自洽,不动。

测试:新增 assertDriveLatestSuggestion 逐子句校验自洽性,替换 5 处只断言
Suggestion != "" 的弱断言。该断言对修改前的文案是红的(3 个 INCOMPLETE 用例
精确报出矛盾子句),对未改动的 TRUNCATED 文案是绿的 —— 证明它不是为新文案量身定做。

P2-2 drive list / drive recent 的 Selection 没跟上 Agent 路由目标

问题:上一轮改了 skill 文档与 flag help,但叶子 Contract 一字未动 ——
drive list 的 UseWhen 无 --latest 正选、Examples 两条都是 --limit 分页、
AvoidWhen 仍无条件让路给 drive recent(与 skill 里的三者路由矛盾);
drive recent 也没有反向指回 drive list --latest。
修法:drive list 追加 --latest 正选,AvoidWhen 第 3 条改写成「个人访问记录 →
recent / 文件修改时间 → 本命令 --latest」的分流;drive recent 追加对应反选。
措辞与 skills/**/drive.md 的三者路由一致。

Examples 是替换而非新增:schema_agent_examples.go 硬限最多 2 条
(has %d examples; maximum is 2),加第 3 条直接挂门禁。替换第 2 条不丢覆盖面 ——
--limit 仍由第 1 条示范、--folder 由第 2 条继续示范,第 2 条顺带示范 --latest,
且无 --limit(运行时互斥)、无 --yes(门禁禁止)。

删掉 docs/drive-list-latest-design.md

设计细节收敛到 skills/**/drive.md 单一出处。本轮 P2-2 正是「文档写对了、
Contract 没跟上」造成的,两份文档并存只会让下一次再跑偏。CHANGELOG 里唯一
指向它的链接行一并删除(第 23 行本身以句号结尾,bullet 依然完整)。
2026-08-06 15:29:14 +08:00
chichuan d1c8c903f6 fix(drive): 修复 --latest 的字段泄露、不完整扫描误报与别名互斥缺口
修复 PR #885 review 提出的三个问题,均已实机复现确认真实存在。

1. [P1] 内部排序字段 sortTime 泄露进输出契约
sortTime 无条件写入每个 BFS 项,却只在 latest>0 && depth==1 时随装饰字段一起剥除,
于是普通 --depth 2 与 depth>1 --latest 的输出都带上它,违反设计文档「不新增业务字段」。
改为只在 latest>0 时写入,并在 emitDriveDepthResult 发射前无条件删除(含 SIGINT 路径),
与 depth==1 的整体剥除解耦。

2. [P1] 扫描不完整仍以退出码 0 产出「全局 Top-N」
拒绝产出的防线只看 truncated,递归途中目录读取失败只进 errors[] 并继续执行。BFS 序与
修改时间无关,未读全的区域完全可能含更新文件,这种集合上的 Top-N 不是全局最新。改为
latest>0 时 truncated 或 errors[] 非空一律拒绝产出(新 token LATEST_SCAN_INCOMPLETE,
与 LATEST_SCAN_TRUNCATED 同 code,便于消费方区分「范围太大」与「读不到」);errors[]
不再进 stdout,失败目录数与首个失败详情因此搬进错误消息。不可恢复错误(token 过期 /
网络不可达)在 latest 下不吐 partial,原样上抛根因错误。不带 --latest 的路径行为不变
(partial + truncated:true + errors[] + 退出码 0),有独立护栏测试;SIGINT 路径不动
(退出码 130 已显式标记结果不完整)。

3. [P2] RegisterCrossProductAliases 自动注册的隐藏别名逃过互斥校验
校验手写枚举 limit/max 与 cursor/next-token,漏掉自动注册的 --page-size(limit 语义组)
与 --page-token(cursor 语义组):--latest 3 --page-size 1 此前退出 0 并静默忽略该 flag。
改为从注册表按语义组取别名(新增只读查询 crossProductAliasPeers),报错点名用户实际传入
的那个 flag 而非语义组主名。string 型按值判定(保住 Agent 的 --cursor "$CURSOR" 首页空值
模板)、其余按 Changed 判定,与改造前 flagOrFallback / Changed 逐字等价,只把覆盖面扩到
全部别名。

本 PR 之外的一处主动扩围(单列说明,便于单独判断):validateDriveListDepth 有完全相同的
枚举缺口。--depth 2 --limit 50 今天已报错,而 --depth 2 --page-size 50 静默忽略、
--depth 2 --page-token X 更糟(用户以为在续页,游标实际被丢掉)。共享 helper 后是一行
改动;已确认无代码以编程方式 Set 这些别名、无文档示例这样组合,行为变化面只是「静默忽略
→ 明确报错」。

测试:sortTime 不泄露(带/不带 latest 两侧)、目录失败与不可恢复错误下拒绝产出且 stdout
为空、对应的 latest=0 partial 护栏、用真实 newDriveCommand 构造的别名互斥回归(--latest
与 --depth 两侧共 14 组)、空值游标模板不误伤、crossProductAliasPeers 单测。
文档同步:设计文档 §3.2/§4/§5/§6/§7、两份 skill 镜像、flag 帮助文案与 CHANGELOG。
2026-08-06 12:14:55 +08:00
chichuan a9af027ed4 feat: drive list 支持 --latest 按修改时间取最新 N 个文件
同步 dws-wukong CR 28929931(feature/drive-list-latest),按本仓结构重新落地。

一条命令直达「最近改的那份 XX」,替代「拉全量再自己比时间」的既有做法:

- 钉盘单层走服务端 orderBy=modifyTime&order=desc,凑够 N 即停(无 pattern 时
  通常一次请求),最多扫描 1000 条
- 知识库(--workspace)与递归(--depth>1)复用现有 BFS 遍历 + 共享后置处理器
  客户端排序,零新增请求
- 文件夹不进 Top-N;排序 tie-break 链 sortTime desc → rel_path asc → ID asc
- 与 --order-by/--order/--limit/--cursor/--versions 互斥,报错均附等效改写
- 递归触 2000 条上限时报 LATEST_SCAN_TRUNCATED 且 stdout 为空(截断集的 Top-N
  不是全局最新);凑不满 N 不算失败,退出码 0 + stderr 提示

本仓侧的三处结构性适配:
- 时间归一化新写为独立 helper internal/helpers/drive_time.go(wukong 侧已有)
- wukong 的 pytest e2e 套件折叠进 Go 测试,全部 TestCrossPlatformCoverage* 前缀
- envelope 契约由 test/fixtures/cli-interface-baseline.txt 承接

顺带补齐遗漏已久的 --depth / --pattern / --quiet 文档(mono + multi 双份)。
2026-08-05 23:05:12 +08:00
玉澜andCursor 9531dad9c6 Merge origin/main into agent/cmdcore-phase2
Port OA approval form-schema / forecast-process / create-instance from
main via DeclareLeafMetadata and mapping-ledger exclusions; keep retired
schema pin paths deleted and preserve the CI auth/keychain split.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-04 20:52:53 +08:00
chichuan 678f108adf docs(oa): complete approval workflow references 2026-08-04 11:39:55 +08:00
玉澜 9bc6a15232 Merge phase3-followups: catalog side-guards, CommandSpec.Source=contract_identity, docs 2026-08-03 18:14:13 +08:00
玉澜andCursor ba72358f78 retire pinned schema_mcp_metadata.json from Schema assembly
Schema Catalog now assembles from Contract/ParamDecl/Interface and Cobra only.
Keep fetch-mcp-metadata as an optional diagnostic dump and ban the retired pin path.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 17:24:32 +08:00
玉澜 07fea09561 chore(schema): Phase 3 follow-ups after registry retirement
- Relocate the registry-agnostic side-guards from the deleted
  check-schema-command-registry.sh into check-schema-catalog.sh:
  legacy hint/visibility source ban, go:generate single-track checks,
  agent-metadata embed/loader bans, lazy-loader reference-count checks,
  package-scope eager-initializer ban, internal/app loader ban, and the
  two fresh-process laziness tests (TestRuntimeSchemaMetadataLoadsOnlyOnDemand,
  TestOrdinaryRootCommandsDoNotLoadSchemaMetadata). Drop the guards that only
  protected the retired reviewed registry (JSON Schema/product shard presence,
  registry-overwrite go:generate ban, registry-count test runs); the native
  materialization ban already lived in check-schema-catalog.sh.

- Rename the wire-visible CommandSpec.Source label from
  "reviewed_command_registry" to "contract_identity" (new exported
  constant CommandSourceContractIdentity): identity is collected from
  ContractFinal.Identity declarations, the registry is gone. Source is a
  provenance label excluded from the identity SourceHash (surface hash is
  unchanged); the catalog content hash shifts with the delivered bytes as
  expected. Updated every assignment and every test pin consistently.

- Update docs/schema-dynamic-endpoint-design.md,
  docs/rfc-command-framework-convergence.md and
  docs/flag-help-schema-homology.md: collector is the single identity
  source, reviewed registry retired; keep genuine historical context.
2026-08-03 17:07:36 +08:00
玉澜andCursor 057a860dcc retire MCP service review without a replacement ledger
Drop schema_mcp_service_review disposition gates from policy, outputguard,
and docs. Keep schema_mcp_metadata.json as the only pinned MCP baseline.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 17:04:42 +08:00
玉澜andCursor aeec39115f retire schema_mcp_service_review.json into Go ledger
Keep notify→out_of_surface disposition and snapshot hash alignment as
reviewed Go constants so policy/tests no longer depend on a committed JSON.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 17:01:15 +08:00
玉澜 b1cefba808 refactor(schema): retire reviewed registry; collector is the single identity source
Phase 3 of identity-deregistry. BuildEffectiveCommandRegistry now builds the
EffectiveCommandRegistry from CollectIdentitySpecs(root) instead of the
embedded reviewed registry, and the registry source is removed atomically:

- delete internal/cli/schema_command_registry/ (registry.json + products/),
  schema_command_registry.schema.json, the three //go:embed directives, and
  the registry-only loaders/validators (loadReviewedCommandRegistry,
  decodeCommandRegistry, ValidateCommandRegistrySource, shard assemble/merge
  helpers, ReviewedCommandRegistryMergedJSON/SourceHash, ReviewedCommandSpecs)
- keep CommandSpec/CommandRegistry/EffectiveCommandRegistry,
  newEffectiveCommandRegistry/indexCommandSpecs, and SourceHash; the
  collector-built effective hash is byte-identical to the reviewed one, so
  catalog surface_hash/source_hash are unchanged
- convert the Phase 2 dual-run gate into TestCollectedIdentityIsValidSingleSource:
  collected specs non-empty, no missing primaries, effective build succeeds,
  SourceHash stable across repeated collection walks
- generators: catalog -surface and agent-metadata -registry/-surface become
  fail-closed retired valves; outputguard no longer protects the registry
  paths; fetch_mcp_metadata derives interface refs from collected identity
  instead of the merged registry JSON
- retire scripts/policy/check-schema-command-registry.sh and its Makefile
  invocation; generate-schema/check-generated-drift now fail closed if
  schema_command_registry/ reappears
- update AGENTS.md, docs/reference.md, and in-code reviewed-input notes
2026-08-03 16:18:20 +08:00
玉澜andCursor f26968264d test(schema): cover Identity/AttachContract edges for platform gate
Fill the remaining ~12 changed-code stmts blocking Coverage at 99.85%,
and point RFC reviewed-input wording at the Go mapping ledger.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 13:38:43 +08:00
玉澜 517eedb412 refactor(schema): drop dead cli.RegisterRuntimeContractFinal wrapper and legacy catalog label
- 删除 cli.RegisterRuntimeContractFinal 包装器:生产侧零调用(全部走
  corecmd.New 内部注册或 contractfinal 直调),9 处测试调用迁移到
  contractfinal.RegisterRuntimeContractFinal
- 删除死常量 ProvenanceEmbeddedCommandCatalog(全库零引用的 legacy
  wire label;运行时装配统一打 SchemaSourceRuntimeAssembled)
- 同步 6 处文档/注释:AGENTS.md、RFC §277、contract/final.go、
  contractfinal/store.go、contractfinal/doc.go、corecmd.go、
  contract/doc.go、contract_register_seam_test.go 的死符号钉扎改为
  import 前缀分层检查兜底
2026-08-03 13:26:34 +08:00
玉澜andCursor 6210840b54 retire empty schema_parameter_bindings.json audit table
Move mapping_exclusions/removals into a reviewed Go ledger so ParamDecl.Property
stays the sole property authority without a committed empty bindings{} Phase 2 gate.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 13:09:14 +08:00
玉澜andCursor 2d76433be0 docs(schema): group reviewed inputs beside command registry
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 12:27:26 +08:00
玉澜 633862d07a docs(schema): add command-registry guide and correct AGENTS.md facts
- docs/schema/schema-command-registry.md:身份册论证(为什么不能删/
  Cobra 不够当身份源/Contract 不能顶替)、文件结构、三层校验、
  写入格式与验证步骤、防漂移表与「精确版」边界
- AGENTS.md:修复 go build ./cmd 报错命令为 make build;registry 指南
  指向 docs/schema/schema-command-registry.md;Tier1 精确为
  helpers.NewLeafCommand;区分 ResolveSchemaBuild 与 deliverySchemaCatalog
  的 lazy 包装;runtime-confirmation 脚本描述补运行时门禁探测
2026-08-03 11:59:05 +08:00
玉澜 ea43db1d64 refactor(schema): drop cli shim packages, add testseam swap, consolidate ForTest helpers
- import 统一:删除 cli/contractfinal 与 cli/runtimeannotate 垫片包,
  26 个消费文件一律直引 corecmd/*;cli 根仅保留 runtime_schema_seam.go
  包内别名,依赖图保持单向无环
- 新增 internal/testseam.Swap[T]:包级 var 注入缝置换由 t.Cleanup
  结构性恢复;迁移 pipeline*/stdinIsTerminalFn/loadReviewedCommandRegistry/
  schemaCommandCatalogError/schemaParameterBindingData/finalSchemaAgentMetadata
  六组核心缝(26+ 处)
- ForTest 辅助归拢到 per-package fortest.go(corecmd/contract、
  corecmd/contractfinal、shortcut、cli),生产文件只留真逻辑
- 文档同步:runtime_schema_seam.go / runtimeannotate/doc.go 注释、
  CHANGELOG、RFC §278-279、AGENTS.md
2026-08-03 00:50:16 +08:00
玉澜andCursor 9bf772ea06 chore(schema): rename Embedded/Hint leftovers to delivery/selection
Drop misleading Catalog-embed and HintFile naming now that assembly is
declare→delivery and selection comes from ContractFinal.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 13:47:26 +08:00
玉澜andCursor 53816b3d33 fix(schema): drop retired Hint dead code and harden CI coverage shards
Remove manual_hints/Hint* leftovers after declare-or-annotate delivery, and fix macOS auth scoping plus Windows/.exe TestMain and race shard packaging so platform coverage gates stay reliable.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 13:21:15 +08:00
玉澜andCursor 0a2e49e7e4 fix(schema): separate catalog content hash from surface registry hash
Runtime assemble was stamping Snapshot.SourceHash with the registry
surface hash, so schema --all catalog_hash diverged from the CI dump
content source_hash and failed Policy. Also remap ContractFinal
Interface.Ref onto pinned MCP metadata so interface_type stays aligned.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 12:26:25 +08:00
玉澜andCursor dc5c9fe110 docs(schema): align architecture with runtime ResolveSchemaBuild delivery
Drop residual go:embed catalog / committed-fixture wording so architecture
and the dynamic-endpoint design match declare→runtime assembly + Meta cache.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 10:41:09 +08:00
玉澜andCursor 3d163242f5 fix(schema): cache ResolveMeta from runtime assembly Once
Keep declare→ResolveSchemaBuild as the ToolSpec authority, but materialize
map[cli_path]CommandMeta during deliverySchemaCatalog sync.Once so leaf
--help / ResolveMeta are O(1) after the first Schema touch. Defer wire
Catalog/Tools maps, stamp Source as runtime-assembled, drop committed
catalog/gob fixtures, and cover steady-state reuse with app/cli tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 10:07:19 +08:00
玉澜andCursor 2a1fe47c50 refactor(schema): retire JSON Catalog delivery for runtime assembly
Move schema authority to declare-time ParamDecl/ContractFinal and
ResolveSchemaBuild so CI/runtime assemble instead of shipping JSON
exclusions/meta-index as delivery sources.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 09:08:17 +08:00
玉澜andCursor 286a84edcd refactor(cmdcore): move annotate/ContractFinal store under corecmd
Break the remaining corecmd→cli reverse dependency by owning
runtimeannotate and contractfinal on the framework side, with cli
keeping thin re-exports. Document the three authoring tiers and that
Shortcut may use DeclareLeafMetadata.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 00:10:03 +08:00
玉澜andCursor a26957c425 docs(schema): align architecture homology with Catalog and declare-vs-delivery
Round-6 Medium docs only: drop retired agent-metadata JSON authority, document
seam packages, and pin Title/Description delivery rules. Also clarify
AttachContract godoc that description compares Long only.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 22:59:41 +08:00
玉澜andCursor b7f04fd2a0 refactor(schema): break corecmd→cli cycle and split contract seams
Move AnnotateRuntime* into cli/runtimeannotate and the Cobra-keyed
ContractFinal store into cli/contractfinal so corecmd depends on thin
subpackages instead of the cli delivery root. Keep contract as DTO-only,
document Description declare-vs-delivery, and house homology gates under
cli/homology.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 22:16:17 +08:00
玉澜andCursor 7fedbea806 fix(schema): document dual delivery and lock Short out of description
Homology docs still said Catalog was the sole embed artifact; align with
meta-index ResolveMeta/help Safety, and add an assemble-path regression
so Short-only leaves keep declared description as contract_final.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 21:18:16 +08:00
玉澜andCursor 6cdd781ae7 fix(schema): gofmt contract_decl_test and align meta-index docs
Unblock CI Lint/gofmt on contract_decl_test, refresh design/CHANGELOG for
ContractDecl + schema_meta_index ResolveMeta delivery, and correct SafetyForCLIPath comments.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 21:07:52 +08:00
玉澜andCursor 3e83ac18d1 docs(schema): align description provenance with Long-first assembly
Review Medium fixes: document Cobra Long → cobra_help over ContractDecl
description (title stays declared-first), add assembly regression tests,
and retire LeafSchema/Decl naming leftovers to ContractDecl + contract.*.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 20:51:33 +08:00
玉澜andCursor 75bd1f1447 refactor(cmdcore): rename SchemaDecl to ContractDecl and unify register seam
SchemaDecl confused authoring with Catalog/ToolSpec delivery. Authors now
declare ContractDecl (nested contract.* types) on Spec/LeafSpec/Shortcut;
AttachContract registers only through cli.RegisterRuntimeContractFinal, and
description provenance stamps cobra_help when Long wins.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 20:33:45 +08:00
玉澜andCursor a26d219b27 refactor(schema): remove cli contract aliases; single entry at corecmd/contract
Drop the dual-entry thin alias layer so helpers/shortcut/framework author
contract.* types directly; keep only AnnotateRuntime* delivery helpers in cli
and document the corecmd→cli seam.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 19:51:54 +08:00
玉澜andCursor c2e4a85ba9 feat(schema): remove Manual/Schema hint overlays; Catalog from ContractFinal only
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 18:54:09 +08:00
玉澜andCursor e29354ca70 feat(schema): retire schema_hints and gate Catalog on ContractFinal only
Remove schema_hints as a generation input so Catalog delivery depends solely on leaf ContractFinal and ProductDecl; migrate policy and contract tests to embedded catalog introspection and fix publicShortcutCount for chat-list.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 18:18:07 +08:00
玉澜andCursor e98586ebb0 feat(schema): retire schema_agent_metadata JSON in favor of catalog-only delivery
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 14:51:13 +08:00
玉澜andCursor bd45de95ab feat(schema): finish declaration-framework migration and remove metadata hints
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 13:46:54 +08:00
玉澜 746b7e403c fix(schema): restore merge-base contract parity for the corecmd migration
The ContractFinal assembly path dropped every non-declared parameter fact,
breaking the published Schema against the reviewed merge-base contract:

- merge pinned MCP parameter metadata and the reviewed in-code runtime hints
  back into contract_final parameter resolution (318 interface_type losses,
  calendar recurrence required/required_when regressions)
- restore devapp write risk to high and publish back to write/high; the
  migration silently downgraded 14 dev write tools and re-classified publish
  as destructive
- keep dev at-least-one checks as Validate hooks with the shipped wording
  instead of publishing new typed constraints; constraint publication is a
  contract change that belongs to its own reviewed PR (aitable annotations
  reverted for the same reason)
- align RunE escape hatch, BoolFlag shadowing, guard-first ConfirmFirst
  declaration, and Sheet target preflight with behavioral tests; drop the
  retired gen_schema_decls.py helper and fix corecmd naming in docs/CHANGELOG

check-authoritative-schema-compatibility vs origin/main: ok.
2026-07-31 22:15:45 +08:00
玉澜andCursor b64438d01c fix(corecmd): keep Validate and ConfirmSafety on the same RunE layer
PreRunE Validate was skipped by direct RunE / proxy calls. Run both hooks
in one wrapper (Validate first), add pat chmod Validate, let Sheet outer
guards call ContractValidate first, and assert declare user_required
leaves expose Validate, required flags, or CallTool-defer confirm.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-31 16:58:11 +08:00
玉澜andCursor 4943c6ff49 fix(corecmd): defer metadata ConfirmSafety until CallTool
Without Validate, DeclareLeafMetadata no longer confirms before RunE-local
required checks. Wrap deps.Caller so the first MCP CallTool runs
ConfirmSafety; Validate-backed leaves keep confirm-after-PreRunE.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-31 16:12:24 +08:00
玉澜andCursor f0fef85905 fix(corecmd): run metadata Validate before ConfirmSafety
DeclareLeafMetadata user_required wraps were confirming before RunE-local
checks, so illegal calls got confirmation_required instead of real errors.
Allow Validate on PreRunE, migrate event stop and drive publish checks, and
lock the Sheet dual-gate transitional state.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-31 15:46:48 +08:00
玉澜andCursor 7773eb27f1 refactor(corecmd): rename package and finish ContractFinal leaf migration
Move cmdcore to corecmd, declare attendance ContractFinal in helpers, keep
Sheet destructive commands --yes-only, and align catalog/policy provenance.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-31 14:13:46 +08:00
玉澜 f0d558a0d1 refactor(shortcut): route live commands through cmdcore 2026-07-31 00:21:33 +08:00
玉澜 3cf690e779 Merge remote-tracking branch 'origin/main' into agent/cmdcore-phase2
# Conflicts:
#	CHANGELOG.md
#	internal/cli/schema_agent_metadata/index.json
#	internal/cli/schema_agent_metadata_audit.json
#	internal/cli/schema_catalog/catalog.json
2026-07-30 23:43:21 +08:00
玉澜 340f01e95c refactor(cmdcore): align leaf safety with schema contract 2026-07-30 23:03:32 +08:00
johnandClaude Opus 4.6 acfbd35aa2 docs: add command framework comparison (DWS vs lark-cli vs GWS)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-30 21:56:52 +08:00
johnandClaude Opus 4.6 95a5fd069a docs: add command framework architecture and domain model
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-30 21:42:52 +08:00
08c9c8a923 fix(cmdcore): close review findings on safety tier inference
- schemaSafetyFromDecl: drop the now-unreachable nil return; the tier
  fill always produces a complete block for a declared Schema
- validateDispatchDecl: panic when ConfirmFirst is set without Risk —
  it orders a confirmation that does not exist, and for declared-Schema
  writes an empty Risk would silently publish the read safety tier
- RFC: document the boundary that write commands must declare Risk

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 21:13:29 +08:00
johnandClaude Opus 4.6 f805c966d6 docs: add command framework architecture overview
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-30 21:02:55 +08:00
ce0501b93e refactor(cmdcore): split Safety into its own enum tier with Risk default
Risk (runtime confirmation) and Safety (schema metadata) are two
independent enums composed at embed time: explicit SafetyDecl fields >
CommandSpec.Safety tier > Risk.SafetyDefault(). The tier fill now also
covers idempotency, so an enum-only declaration is self-sufficient and
validateSchemaDecl no longer needs safety completeness checks.

devapp reclassifies its write leaves by reversibility: reversible
mutations declare LeafSafetyWrite (risk high->medium), create/robot
submit/version create declare LeafSafetyHighWrite, and delete/version
publish declare LeafSafetyDestructive (publish effect
write->destructive). Shared hand-written safety constants are deleted.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 20:37:40 +08:00
玉澜andCursor a5cefd67f3 feat(cmdcore): typed SchemaDecl final source with assembly guards
- SchemaDecl on CommandSpec/LeafSpec declares the final ToolSpec payload;
  framework converts in-process (no JSON bridge) and Schema assembly
  pass-throughs it.
- Assembly fails closed on declared identity mismatched with the bound
  entry and on reviewed fields in the declaration payload.
- RFC/homology/AGENTS docs pin declare=final-source, safety precedence
  Final > Risk > gate, and light runtime write semantics.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 20:36:33 +08:00
玉澜andCursor 8c9c22f4b0 feat(cmdcore): declare-or-annotate homology with full ToolSpec authority
Pin path A: Contract fields declare CLI surface; write-guard uses runtime_gate;
RFC §5.0/§5.0.4 covers every Schema ToolSpec field group so none are ownerless.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 20:36:31 +08:00