✨ feat(spx): issue marker 支持第三种类型 prototype
- --type 三选一 spec|plan|prototype,marker 行写 <!-- spx:prototype=路径 -->,
与 spec/plan 共用同一套增量更新逻辑;类型→state 字段的映射收成一张表
- 同步写 state JSON 的 prototypeFile(pattern 要求 dir/.../x.json)
- 顺手补上 b62e58d 漏掉的 prototypeSessionId / prototypeProfilePath:
schema 与 knownStateFields 都没有它们,带原型会话的工单一 merge
就会被 additionalProperties 拒掉
Claude-Session: https://claude.ai/code/session_01Kgmb1LvrPmFX3NoUDB4zZC
This commit is contained in:
1 parent
814e0e8f5a
commit
def5f4e88c
5 files changed
+89
-8
No files matched your search
@@ -29,16 +29,38 @@ func TestUpsertMarkerReplacesWhenPresent(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpsertMarkerLeavesOtherTypesAlone(t *testing.T) {
|
||||
body := "<!-- spx:plan=p.md -->\n<!-- spx:spec=old.md -->"
|
||||
body := "<!-- spx:plan=p.md -->\n<!-- spx:prototype=docs/prototype/x/figma-plugin/manifest.json -->\n<!-- spx:spec=old.md -->"
|
||||
got := UpsertMarker(body, "spec", "new.md")
|
||||
if !strings.Contains(got, "<!-- spx:plan=p.md -->") {
|
||||
t.Fatalf("plan marker should be preserved: %q", got)
|
||||
}
|
||||
if !strings.Contains(got, "<!-- spx:prototype=docs/prototype/x/figma-plugin/manifest.json -->") {
|
||||
t.Fatalf("prototype marker should be preserved: %q", got)
|
||||
}
|
||||
if !strings.Contains(got, "<!-- spx:spec=new.md -->") {
|
||||
t.Fatalf("spec marker should be updated: %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpsertMarkerPrototypeAppendsWhenAbsent(t *testing.T) {
|
||||
got := UpsertMarker("hello body", "prototype", "docs/prototype/login/figma-plugin/manifest.json")
|
||||
want := "hello body\n<!-- spx:prototype=docs/prototype/login/figma-plugin/manifest.json -->"
|
||||
if got != want {
|
||||
t.Fatalf("got %q want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpsertMarkerPrototypeReplacesWhenPresent(t *testing.T) {
|
||||
body := "intro\n<!-- spx:prototype=old/manifest.json -->\nmore"
|
||||
got := UpsertMarker(body, "prototype", "new/manifest.json")
|
||||
if strings.Contains(got, "old/manifest.json") {
|
||||
t.Fatalf("old value should be gone: %q", got)
|
||||
}
|
||||
if !strings.Contains(got, "<!-- spx:prototype=new/manifest.json -->") {
|
||||
t.Fatalf("new marker missing: %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpsertMarkerEmptyBody(t *testing.T) {
|
||||
got := UpsertMarker("", "plan", "p.md")
|
||||
want := "<!-- spx:plan=p.md -->"
|
||||
|
||||
Reference in new issue
Block a user