@michelj/context-guard 0.4.3 → 0.6.1
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.
- package/Coordinator.md +88 -0
- package/Executor.md +53 -0
- package/README.md +89 -224
- package/README.zh-CN.md +89 -224
- package/SKILL.md +26 -684
- package/THIRD_PARTY_NOTICES.md +47 -0
- package/Tester.md +53 -0
- package/agents/openai.yaml +2 -2
- package/bin/build-runtime.mjs +96 -0
- package/bin/context-guard-skill.js +399 -78
- package/bin/postinstall.js +2 -2
- package/hooks.json +89 -13
- package/licenses/JSONParse-MIT.txt +24 -0
- package/licenses/Marked-MIT.txt +44 -0
- package/licenses/Portless-Apache-2.0.txt +201 -0
- package/package.json +35 -6
- package/prototype/LICENSES/Marked-MIT.txt +44 -0
- package/prototype/LICENSES/Ready-redistribution.txt +14 -0
- package/prototype/attachments.mjs +75 -0
- package/prototype/coordinator-markdown.mjs +283 -0
- package/prototype/coordinator-working-blot.mjs +124 -0
- package/prototype/vendor/marked.mjs +2189 -0
- package/prototype/workbench-app.js +5197 -0
- package/prototype/workbench-data.js +33 -0
- package/prototype/workbench-sync.mjs +898 -0
- package/prototype/workbench.css +1050 -0
- package/prototype/workbench.html +211 -0
- package/prototype/working-blot-atlas.png +0 -0
- package/references/agent-handoff.md +40 -0
- package/references/claude-runtime.md +120 -0
- package/references/cloud-sync-interface.md +66 -0
- package/references/design-current.md +14 -0
- package/references/map-mount.md +41 -0
- package/references/map-read.md +50 -0
- package/references/memory-definition.md +120 -0
- package/references/memory-filesystem-v2/Bug.en.md +162 -0
- package/references/memory-filesystem-v2/Bug.md +162 -0
- package/references/memory-filesystem-v2/Bug_Coordinater.md +8 -0
- package/references/memory-filesystem-v2/Bug_Executor.md +8 -0
- package/references/memory-filesystem-v2/Bug_Tester.md +7 -0
- package/references/memory-filesystem-v2/Idea.en.md +36 -0
- package/references/memory-filesystem-v2/Idea.md +36 -0
- package/references/memory-filesystem-v2/Node_Module_Index.en.md +88 -0
- package/references/memory-filesystem-v2/Node_Module_Index.md +88 -0
- package/references/memory-filesystem-v2/README.md +60 -0
- package/references/memory-filesystem-v2/Todo.en.md +137 -0
- package/references/memory-filesystem-v2/Todo.md +137 -0
- package/references/memory-filesystem-v2/Todo_Coordinater.md +7 -0
- package/references/memory-filesystem-v2/Todo_Executor.md +7 -0
- package/references/memory-filesystem-v2/Todo_Tester.md +7 -0
- package/references/named-workbench.md +124 -0
- package/references/plan-review.md +12 -0
- package/references/server-memory.md +276 -0
- package/references/test-check.md +7 -0
- package/references/user-reply.md +38 -0
- package/references/workbench-interface.md +531 -0
- package/roles.md +13 -0
- package/scripts/context_guard.py +1366 -7602
- package/scripts/context_guard_hook.py +1960 -711
- package/scripts/map_owns.py +699 -0
- package/scripts/shared/LICENSES/JSONParse-MIT.txt +24 -0
- package/scripts/shared/filesystem-v2.mjs +430 -0
- package/scripts/shared/io.mjs +117 -0
- package/scripts/shared/map-model.mjs +506 -0
- package/scripts/shared/memory-schema.mjs +13 -0
- package/scripts/shared/protocol-blobs.mjs +112 -0
- package/scripts/shared/protocol-map.mjs +146 -0
- package/scripts/shared/protocol-snapshots.mjs +84 -0
- package/scripts/shared/protocol-store.mjs +624 -0
- package/scripts/shared/protocol-workflow.mjs +226 -0
- package/scripts/shared/protocol.mjs +125 -0
- package/scripts/shared/vendor/jsonparse.cjs +413 -0
- package/scripts/workbench/access.mjs +496 -0
- package/scripts/workbench/attachments.mjs +92 -0
- package/scripts/workbench/browser-login.mjs +78 -0
- package/scripts/workbench/claude-runtime.mjs +372 -0
- package/scripts/workbench/cli.mjs +980 -0
- package/scripts/workbench/device-heartbeat.mjs +72 -0
- package/scripts/workbench/hook-status.mjs +38 -0
- package/scripts/workbench/inbox.mjs +155 -0
- package/scripts/workbench/journal.mjs +56 -0
- package/scripts/workbench/memory-merge.mjs +65 -0
- package/scripts/workbench/memory.mjs +252 -0
- package/scripts/workbench/named-proxy.mjs +108 -0
- package/scripts/workbench/named.mjs +152 -0
- package/scripts/workbench/portless-routes.mjs +51 -0
- package/scripts/workbench/project.mjs +327 -0
- package/scripts/workbench/projections.mjs +68 -0
- package/scripts/workbench/protocol-client.mjs +165 -0
- package/scripts/workbench/protocol-delivery.mjs +133 -0
- package/scripts/workbench/protocol-device.mjs +316 -0
- package/scripts/workbench/protocol-events.mjs +53 -0
- package/scripts/workbench/protocol-repository.mjs +58 -0
- package/scripts/workbench/reconcile.mjs +244 -0
- package/scripts/workbench/registry.mjs +111 -0
- package/scripts/workbench/runtime.mjs +54 -0
- package/scripts/workbench/server.mjs +1171 -0
- package/scripts/workbench/store.mjs +243 -0
- package/scripts/workbench/sync-coordinator.mjs +518 -0
- package/scripts/workbench/sync.mjs +86 -0
- package/references/context-template.md +0 -341
- package/references/feature-chain-methodology.md +0 -228
- package/references/register-template.md +0 -85
- package/references/task-case-template.md +0 -63
- package/tests/BC-20260618-063.sh +0 -116
- package/tests/BC-20260618-065.sh +0 -66
- package/tests/BC-20260626-080.sh +0 -48
- package/tests/BC-20260626-081.sh +0 -40
- package/tests/BC-20260626-082.sh +0 -32
- package/tests/BC-20260626-083.sh +0 -66
- package/tests/BC-20260627-084.sh +0 -74
- package/tests/BC-20260630-086.sh +0 -50
- package/tests/BC-20260630-087.sh +0 -103
- package/tests/BC-20260630-088.sh +0 -32
- package/tests/BC-20260630-089.sh +0 -63
- package/tests/BC-20260701-090.sh +0 -84
- package/tests/BC-20260702-096.sh +0 -48
- package/tests/BC-20260706-098.sh +0 -66
- package/tests/BC-20260707-099.sh +0 -47
- package/tests/BC-20260707-100.sh +0 -46
- package/tests/BC-20260707-101.sh +0 -47
- package/tests/BC-20260707-102.sh +0 -68
- package/tests/BC-20260707-103.sh +0 -59
- package/tests/BC-20260707-104.sh +0 -103
- package/tests/BC-20260707-105.sh +0 -109
- package/tests/BC-20260707-106.sh +0 -80
- package/tests/BC-20260707-107.sh +0 -74
- package/tests/BC-20260707-108.sh +0 -48
- package/tests/BC-20260707-109.sh +0 -56
- package/tests/BC-20260707-110.sh +0 -71
- package/tests/BC-20260707-111.sh +0 -70
- package/tests/BC-20260707-112.sh +0 -45
- package/tests/BC-20260707-113.sh +0 -73
- package/tests/BC-20260707-115.sh +0 -77
- package/tests/BC-20260707-116.sh +0 -77
- package/tests/BC-20260707-118.sh +0 -115
- package/tests/BC-20260707-119.sh +0 -47
- package/tests/BC-20260707-120.sh +0 -60
- package/tests/BC-20260707-121.sh +0 -66
- package/tests/BC-20260707-122.sh +0 -48
- package/tests/BC-20260707-123.sh +0 -43
- package/tests/BC-20260707-124.sh +0 -56
- package/tests/BC-20260707-125.sh +0 -64
- package/tests/BC-20260707-126.sh +0 -80
- package/tests/BC-20260707-127.sh +0 -88
- package/tests/BC-20260707-129.sh +0 -59
- package/tests/BC-20260707-130.sh +0 -69
- package/tests/BC-20260707-131.sh +0 -140
- package/tests/BC-20260707-132.sh +0 -150
- package/tests/BC-20260707-133.sh +0 -70
- package/tests/BC-20260708-136.sh +0 -210
- package/tests/BC-20260708-137.sh +0 -106
- package/tests/BC-20260708-138.sh +0 -168
- package/tests/BC-20260708-139.sh +0 -79
- package/tests/BC-20260709-002.sh +0 -63
- package/tests/BC-20260709-003.sh +0 -239
- package/tests/BC-20260709-006.sh +0 -76
- package/tests/BC-20260709-008.sh +0 -168
- package/tests/BC-20260710-001.sh +0 -61
- package/tests/BC-20260710-002.sh +0 -111
- package/tests/npm-install-smoke.sh +0 -53
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
# Bad Case Register Template
|
|
2
|
-
|
|
3
|
-
Use this format for `.codex/context/bad-cases.md`, task-local `.codex/context/tasks/<task-id>/bad-cases.md`, or the existing project context register.
|
|
4
|
-
|
|
5
|
-
```md
|
|
6
|
-
# Bad Case Register
|
|
7
|
-
|
|
8
|
-
This register tracks bad cases found during development and the guards that prevent them from recurring.
|
|
9
|
-
|
|
10
|
-
Record only bad cases that are user-visible, recurring, risky, fixed, deferred, or needed to explain a guard. Do not turn the register into a defect diary.
|
|
11
|
-
|
|
12
|
-
## Active Cases
|
|
13
|
-
|
|
14
|
-
### BC-YYYYMMDD-001: Short descriptive title
|
|
15
|
-
|
|
16
|
-
- Status: open | resolved | recurred | deferred | superseded-by-route-change
|
|
17
|
-
- First observed: YYYY-MM-DD
|
|
18
|
-
- Last checked: YYYY-MM-DD
|
|
19
|
-
- Scope: feature, files, tests, route, UI flow, API, or subsystem
|
|
20
|
-
- Context task: `CTX-...` folder or shared
|
|
21
|
-
- Roadmap nodes: `NODE-...`
|
|
22
|
-
- Tags: #hot | #flaky | #ui | #data-loss | #route-risk | custom tags
|
|
23
|
-
- Frequency: first-seen | repeated-N | high-frequency
|
|
24
|
-
- Phenomenon: one-line user-visible behavior or failing output
|
|
25
|
-
- Trigger / reproduction: shortest command, step, input, environment, or precondition
|
|
26
|
-
- Root cause: confirmed cause, suspected cause, or unknown, one line
|
|
27
|
-
- Fix method: code/test/config/documentation change that fixed it, one line
|
|
28
|
-
- Guard type: script | native-test | manual | browser-screenshot | browser-dom | curl | cli | prompt | log-invariant | fixture | unit | integration | e2e | custom
|
|
29
|
-
- Guard / verification: native test, command, reusable script, manual check, screenshot, log, invariant, or reproduction note, one line
|
|
30
|
-
- Run policy: every-dev-completion | relevant-only | manual | release-only | goal-final | disabled-with-reason | user-defined cadence
|
|
31
|
-
- Artifact policy: cleanup-on-pass | preserve-on-fail | manual-preserve | none
|
|
32
|
-
- Blocker handling: credentials | external-service | permissions | resource-limits | network | destructive-confirmation | user-judgment | none
|
|
33
|
-
- Red condition: exact output, visual state, assertion, or symptom that means this bad case has recurred
|
|
34
|
-
- Green condition: exact evidence that means this bad case is absent
|
|
35
|
-
- Expected failure reason: why the guard should fail for the old symptom, not for a broken test or unrelated environment issue
|
|
36
|
-
- Reusable guard path: project test file, `.codex/context/task-cases/...#phase-name`, `.codex/context/bad-case-tests/...`, or none
|
|
37
|
-
- Covered by task case: TC-YYYYMMDD-short-slug phase/checkpoint, or none
|
|
38
|
-
- Test-chain issue: false-positive | false-negative | wrong-granularity | missing-phase | wrong-assertion | unrealistic-setup | missing-cleanup | unclear-localization | none
|
|
39
|
-
- Guard reuse rule: reuse this recorded guard before creating any new test or script for this case
|
|
40
|
-
- Test chain: ordered checks only when multiple checks are genuinely needed
|
|
41
|
-
- High-frequency note: warning text to show Codex when this pattern repeats often
|
|
42
|
-
- Recurrence analysis: why it came back, if it ever did
|
|
43
|
-
- Route-change note: only when an approved technical route change intentionally changes expected behavior
|
|
44
|
-
- Evidence: links to tests, commands run, PRs, commits, screenshots, or logs
|
|
45
|
-
|
|
46
|
-
## Resolved History
|
|
47
|
-
|
|
48
|
-
Move old resolved entries here only if the active section becomes noisy. Keep enough detail to replay the guard.
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Use the `### BC-...` section form as the canonical editable source. If a session accidentally records loose bullet blocks such as `- ID: BC-...`, `- Title: ...`, `- Status: ...`, or `- Nodes: ...`, the renderer should still project them, but future edits should normalize them back into formal case sections.
|
|
52
|
-
|
|
53
|
-
## Status Rules
|
|
54
|
-
|
|
55
|
-
- `open`: bad case is known and not fixed.
|
|
56
|
-
- `resolved`: fix is implemented and verification passed.
|
|
57
|
-
- `recurred`: bad case came back after resolution; must be analyzed and fixed before completion.
|
|
58
|
-
- `deferred`: intentionally not fixed in the current task; requires reason and owner/next step.
|
|
59
|
-
- `superseded-by-route-change`: old behavior is no longer expected because an approved technical route changed it.
|
|
60
|
-
|
|
61
|
-
## Context Guard Rules
|
|
62
|
-
|
|
63
|
-
- Use `.codex/context/` as the project folder for bad-case memory. Do not introduce a separate bad-case folder for new projects.
|
|
64
|
-
- Use the configured `.codex/context/preferences.json` `record_language` for bad-case titles, phenomenon, root cause, fix method, guard summaries, and test-chain notes.
|
|
65
|
-
- Preserve exact commands, paths, code identifiers, logs, API names, and error messages in their original language.
|
|
66
|
-
- Prefer existing recorded context, user-approved commands, native tests, screenshots, logs, or manual checks over newly invented tests.
|
|
67
|
-
- When the user creates or approves a test, default its `Run policy` to `every-dev-completion`; Codex must run it at every development completion unless the user sets another cadence.
|
|
68
|
-
- Only the user can demote an approved test to `relevant-only`, `manual`, `release-only`, `goal-final`, `disabled-with-reason`, or a custom cadence. Record why.
|
|
69
|
-
- After user approval, automate the check when feasible; successful automated checks should clean temporary files, while failed checks should preserve concise diagnostic evidence for Codex to analyze and rerun after fixing.
|
|
70
|
-
- Store reusable user-approved automated tests in `.codex/context/test-hub/registry.json` or approved task-case files; do not auto-register ordinary bad-case guards or roadmap `Test chain:` notes as always-run tests.
|
|
71
|
-
- At development completion, prefer `context_guard.py dev-complete --root <project>` so Test Hub runs the approved always-run set and writes `.codex/context/test-hub/last-run.json`.
|
|
72
|
-
- If an approved automated check is blocked by credentials, external services, permissions, resource limits, network, destructive confirmation, or user-only judgment, record the blocker and ask or warn the user instead of looping.
|
|
73
|
-
- For resolved or recurred cases, `Guard / verification`, `Guard type`, `Red condition`, `Green condition`, and `Expected failure reason` are required.
|
|
74
|
-
- The guard must be red-capable: it should fail if the same user-visible symptom returns.
|
|
75
|
-
- When the bad case is part of a longer workflow, attach it to a human-approved task-case checkpoint instead of creating a separate isolated script. The bad-case entry should say which task case phase covers it.
|
|
76
|
-
- If the test chain itself is wrong, record that as a bad case and classify the test-chain issue. Fix the test-chain design before trusting its result.
|
|
77
|
-
- Do not script every bad case. Store bad-case-specific scripts under `.codex/context/bad-case-tests/` only when the user approved the test design, the script is genuinely reusable, and it does not belong in the native test suite.
|
|
78
|
-
- Name any guard script with the bad case ID so it is easy to find and reuse.
|
|
79
|
-
- Update existing context when expected behavior changes; do not create parallel guards for the same case unless the old one is explicitly obsolete.
|
|
80
|
-
- If a guard is manual-only, list the exact manual check and why that is acceptable for now.
|
|
81
|
-
- Link bad cases to roadmap nodes so Codex can quickly see which mainline decisions created or fixed them.
|
|
82
|
-
- Keep record/display linkage explicit: use `Roadmap nodes:` or `Nodes:` on the bad case, or `Linked bad cases:` on the roadmap node.
|
|
83
|
-
- Add tags and frequency notes when a bad case repeats often; high-frequency cases should stand out during quick scanning.
|
|
84
|
-
- Promote high-frequency cases into fixed pressure checks and rerun them whenever related code, UI, context, or hooks change.
|
|
85
|
-
- Keep entries compact. If the same information appears in a roadmap node, link to it instead of duplicating it.
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# Task Case Template
|
|
2
|
-
|
|
3
|
-
Use task cases for realistic multi-step verification. A task case should simulate a full user or agent workflow and log phase-level checkpoints so failures identify the broken step. Test design is human-owned: Codex can draft a proposal, but a durable task case stays `proposed` until the user confirms it.
|
|
4
|
-
|
|
5
|
-
```md
|
|
6
|
-
# Task Case: short realistic workflow title
|
|
7
|
-
|
|
8
|
-
- ID: TC-YYYYMMDD-short-slug
|
|
9
|
-
- Status: proposed | approved | active | stable | deferred | obsolete
|
|
10
|
-
- Route/task: `CTX-...` or branch name
|
|
11
|
-
- Scope: feature, service, UI flow, agent workflow, or subsystem
|
|
12
|
-
- Last checked: YYYY-MM-DD
|
|
13
|
-
- Design confirmation: pending | user-approved YYYY-MM-DD
|
|
14
|
-
- Run policy: every-dev-completion | relevant-only | manual | release-only | goal-final | disabled-with-reason | user-defined cadence
|
|
15
|
-
- Automation entry: native command | script path | prompt/manual runner | none
|
|
16
|
-
- Artifact policy: cleanup-on-pass | preserve-on-fail | manual-preserve
|
|
17
|
-
- Linked roadmap nodes: NODE-...
|
|
18
|
-
- Linked bad cases: BC-..., BC-...
|
|
19
|
-
- Entry command/prompt: command, prompt, manual setup, or fixture
|
|
20
|
-
- Not covered: explicit exclusions to avoid fake confidence
|
|
21
|
-
- Stop condition: what means the workflow is complete
|
|
22
|
-
- Cleanup: required cleanup or none
|
|
23
|
-
- Blocker handling: credentials | external service | permissions | resource limits | network | destructive confirmation | user judgment | none
|
|
24
|
-
|
|
25
|
-
## Phases
|
|
26
|
-
|
|
27
|
-
### Phase 1: setup or trigger
|
|
28
|
-
|
|
29
|
-
- Action: one realistic action
|
|
30
|
-
- Expected checkpoint: invariant, log, UI state, file state, API result, or assertion
|
|
31
|
-
- Covers bad cases: BC-...
|
|
32
|
-
- Failure localization: what this phase failure usually means
|
|
33
|
-
- Log note: what the script/agent should record
|
|
34
|
-
|
|
35
|
-
### Phase 2: transition or recovery
|
|
36
|
-
|
|
37
|
-
- Action: one realistic action
|
|
38
|
-
- Expected checkpoint: invariant, log, UI state, file state, API result, or assertion
|
|
39
|
-
- Covers bad cases: BC-...
|
|
40
|
-
- Failure localization: what this phase failure usually means
|
|
41
|
-
- Log note: what the script/agent should record
|
|
42
|
-
|
|
43
|
-
## Result Log
|
|
44
|
-
|
|
45
|
-
- YYYY-MM-DD: pass/fail, failed phase/checkpoint if any, evidence path or command output summary
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Rules:
|
|
49
|
-
|
|
50
|
-
- When the user explicitly asks to create, write, generate, design, or add a test/task case, begin the user-visible response with a compact intake line such as `测试创建识别:...` before proposing or implementing the case.
|
|
51
|
-
- Prefer one task case with clear checkpoints over many disconnected bug-level scripts when the same workflow is being exercised.
|
|
52
|
-
- Link bad cases to the checkpoint that catches them.
|
|
53
|
-
- Keep the task case realistic enough to match actual product or agent usage.
|
|
54
|
-
- Once a test is approved, automate it when it can be safely encapsulated. Future Codex turns should run the registered entry instead of reinterpreting the test design.
|
|
55
|
-
- Automated approved tests should be registered in `.codex/context/test-hub/registry.json` or represented by this approved task-case file with `Run policy: every-dev-completion` and an executable `Entry command/prompt`.
|
|
56
|
-
- At development completion, run the approved always-run set through `context_guard.py dev-complete --root <project>` instead of manually reconstructing each test.
|
|
57
|
-
- Automated task cases should clean temporary files after full success and preserve the smallest useful evidence on failure.
|
|
58
|
-
- If the automated case fails, Codex should analyze the failed phase/checkpoint, record or update the bad case, fix in scope, and rerun the same approved test until it passes or a non-actionable blocker is reached.
|
|
59
|
-
- If blocked by credentials, unavailable services, permissions, hardware/resource limits, network, destructive-risk confirmation, or user-only judgment, stop and ask or warn the user with the blocker and evidence path.
|
|
60
|
-
- Keep checkpoint logs concise and useful for localizing failure.
|
|
61
|
-
- Keep the case in `proposed` state until the user confirms the design.
|
|
62
|
-
- Once the user confirms the design, default `Run policy` to `every-dev-completion`; lower the cadence only when the user explicitly asks.
|
|
63
|
-
- In goal mode, use human-approved task cases as phase gates and log phase progress; do not create broad new scripts or active task cases without confirmation unless the user explicitly asked for that exact test.
|
package/tests/BC-20260618-063.sh
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
SCRIPT="${1:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/scripts/context_guard.py}"
|
|
5
|
-
|
|
6
|
-
python3 - "$SCRIPT" <<'PY'
|
|
7
|
-
from __future__ import annotations
|
|
8
|
-
|
|
9
|
-
import json
|
|
10
|
-
import shutil
|
|
11
|
-
import subprocess
|
|
12
|
-
import sys
|
|
13
|
-
import tempfile
|
|
14
|
-
from pathlib import Path
|
|
15
|
-
|
|
16
|
-
script = Path(sys.argv[1])
|
|
17
|
-
root = Path(tempfile.mkdtemp(prefix="context-guard-branch-test-"))
|
|
18
|
-
|
|
19
|
-
try:
|
|
20
|
-
subprocess.run(["python3", str(script), "init", "--root", str(root)], check=True, capture_output=True, text=True)
|
|
21
|
-
subprocess.run(["python3", str(script), "set-language", "--language", "zh", "--root", str(root)], check=True, capture_output=True, text=True)
|
|
22
|
-
|
|
23
|
-
ctx = root / ".codex" / "context"
|
|
24
|
-
(ctx / "index.md").write_text(
|
|
25
|
-
"""# Context Index
|
|
26
|
-
|
|
27
|
-
## Quick Scan
|
|
28
|
-
|
|
29
|
-
- Current: CTX-20260618-main
|
|
30
|
-
- Latest roadmap node: NODE-20260618-001
|
|
31
|
-
- Hot bad-case tags: none
|
|
32
|
-
- Resume candidate: none
|
|
33
|
-
|
|
34
|
-
## Current
|
|
35
|
-
|
|
36
|
-
- ID: CTX-20260618-main
|
|
37
|
-
- Title: 主线任务
|
|
38
|
-
- State: current
|
|
39
|
-
- Folder: `.codex/context/tasks/CTX-20260618-main/`
|
|
40
|
-
- Last updated: 2026-06-18
|
|
41
|
-
- Summary: 正在推进主线任务。
|
|
42
|
-
- Next step: 继续主线。
|
|
43
|
-
|
|
44
|
-
## Parked / Resume Candidates
|
|
45
|
-
|
|
46
|
-
None.
|
|
47
|
-
|
|
48
|
-
## Archived
|
|
49
|
-
|
|
50
|
-
None.
|
|
51
|
-
""",
|
|
52
|
-
encoding="utf-8",
|
|
53
|
-
)
|
|
54
|
-
(ctx / "roadmap.md").write_text(
|
|
55
|
-
"""# Context Roadmap
|
|
56
|
-
|
|
57
|
-
## Nodes
|
|
58
|
-
|
|
59
|
-
### NODE-20260618-001: 主线起点
|
|
60
|
-
|
|
61
|
-
- Date: 2026-06-18
|
|
62
|
-
- Status: done
|
|
63
|
-
- Level: major
|
|
64
|
-
- Branch: Main
|
|
65
|
-
- Parent: none
|
|
66
|
-
- Task: `CTX-20260618-main`
|
|
67
|
-
- Outcome: 主线已经建立。
|
|
68
|
-
- Decision / reason: 作为支线父节点。
|
|
69
|
-
- Avoid going back: 不要把支线写回主线。
|
|
70
|
-
- Next: 等待支线。
|
|
71
|
-
- Linked bad cases: none
|
|
72
|
-
- Test chain: none
|
|
73
|
-
""",
|
|
74
|
-
encoding="utf-8",
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
result = subprocess.run(
|
|
78
|
-
[
|
|
79
|
-
"python3",
|
|
80
|
-
str(script),
|
|
81
|
-
"create-branch-task",
|
|
82
|
-
"--root",
|
|
83
|
-
str(root),
|
|
84
|
-
"--title",
|
|
85
|
-
"后端状态机设计",
|
|
86
|
-
"--branch",
|
|
87
|
-
"后端状态机",
|
|
88
|
-
"--parent-node",
|
|
89
|
-
"NODE-20260618-001",
|
|
90
|
-
],
|
|
91
|
-
check=True,
|
|
92
|
-
capture_output=True,
|
|
93
|
-
text=True,
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
output = result.stdout + result.stderr
|
|
97
|
-
assert "CTX-" in output, output
|
|
98
|
-
assert "NODE-" in output, output
|
|
99
|
-
|
|
100
|
-
index = (ctx / "index.md").read_text(encoding="utf-8")
|
|
101
|
-
roadmap = (ctx / "roadmap.md").read_text(encoding="utf-8")
|
|
102
|
-
exports = json.loads((ctx / "roadmap" / "roadmap.json").read_text(encoding="utf-8"))
|
|
103
|
-
|
|
104
|
-
assert "- Current: CTX-20260618-main" not in index, index
|
|
105
|
-
assert "后端状态机设计" in index, index
|
|
106
|
-
assert "主线任务" in index and "resume-candidate" in index, index
|
|
107
|
-
assert "- Branch: 后端状态机" in roadmap, roadmap
|
|
108
|
-
assert "- Parent: NODE-20260618-001" in roadmap, roadmap
|
|
109
|
-
assert "- Task: `CTX-" in roadmap, roadmap
|
|
110
|
-
assert any(route["branch"] == "后端状态机" for route in exports["routes"]), exports
|
|
111
|
-
|
|
112
|
-
task_dirs = list((ctx / "tasks").glob("CTX-*"))
|
|
113
|
-
assert any((path / "context.md").exists() and "后端状态机设计" in (path / "context.md").read_text(encoding="utf-8") for path in task_dirs), task_dirs
|
|
114
|
-
finally:
|
|
115
|
-
shutil.rmtree(root, ignore_errors=True)
|
|
116
|
-
PY
|
package/tests/BC-20260618-065.sh
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
SCRIPT="${1:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/scripts/context_guard.py}"
|
|
5
|
-
ROOT="$(mktemp -d "${TMPDIR:-/tmp}/context-guard-marker-test-XXXXXX")"
|
|
6
|
-
trap 'rm -rf "$ROOT"' EXIT
|
|
7
|
-
|
|
8
|
-
python3 "$SCRIPT" init --root "$ROOT" >/dev/null
|
|
9
|
-
python3 "$SCRIPT" set-language --language zh --root "$ROOT" >/dev/null
|
|
10
|
-
|
|
11
|
-
CTX="$ROOT/.codex/context"
|
|
12
|
-
cat > "$CTX/roadmap.md" <<'MD'
|
|
13
|
-
# Context Roadmap
|
|
14
|
-
|
|
15
|
-
## Nodes
|
|
16
|
-
|
|
17
|
-
### NODE-20260618-001: 标记测试节点
|
|
18
|
-
|
|
19
|
-
- Date: 2026-06-18
|
|
20
|
-
- Status: done
|
|
21
|
-
- Level: major
|
|
22
|
-
- Branch: Main
|
|
23
|
-
- Parent: none
|
|
24
|
-
- Task: `CTX-20260618-marker`
|
|
25
|
-
- Outcome: 检查问题案例标题行标记布局。
|
|
26
|
-
- Decision / reason: 标记不能单独占一行。
|
|
27
|
-
- Avoid going back: 不要把状态点放在标题前面。
|
|
28
|
-
- Next: none
|
|
29
|
-
- Linked bad cases: BC-20260618-999
|
|
30
|
-
- Test chain: none
|
|
31
|
-
MD
|
|
32
|
-
|
|
33
|
-
cat > "$CTX/bad-cases.md" <<'MD'
|
|
34
|
-
# Bad Case Register
|
|
35
|
-
|
|
36
|
-
## Active Cases
|
|
37
|
-
|
|
38
|
-
### BC-20260618-999: 这是一个很长的问题案例标题用于触发换行但标记不能单独成行
|
|
39
|
-
|
|
40
|
-
- Status: resolved
|
|
41
|
-
- First observed: 2026-06-18
|
|
42
|
-
- Last checked: 2026-06-18
|
|
43
|
-
- Scope: roadmap marker layout
|
|
44
|
-
- Context task: `CTX-20260618-marker`
|
|
45
|
-
- Roadmap nodes: NODE-20260618-001
|
|
46
|
-
- Tags: #roadmap-ux
|
|
47
|
-
- Frequency: repeated-2
|
|
48
|
-
- Phenomenon: 状态点和频率点不应该单独一行。
|
|
49
|
-
- Trigger / reproduction: 生成 roadmap 并检查 badcase-head。
|
|
50
|
-
- Root cause: 标记位于标题前,窄列时容易变成单独一行。
|
|
51
|
-
- Fix method: 将标记移到标题右侧的 inline marker 容器。
|
|
52
|
-
- Guard / verification: 本脚本检查 HTML 结构。
|
|
53
|
-
- Reusable guard path: none
|
|
54
|
-
- Test chain: none
|
|
55
|
-
MD
|
|
56
|
-
|
|
57
|
-
python3 "$SCRIPT" show-roadmap --root "$ROOT" >/dev/null
|
|
58
|
-
HTML="$CTX/roadmap/roadmap.html"
|
|
59
|
-
|
|
60
|
-
grep -q 'class="badcase-markers"' "$HTML"
|
|
61
|
-
grep -q '.badcase-head { display: grid; grid-template-columns: minmax(0, 1fr) auto;' "$HTML"
|
|
62
|
-
if grep -q '<div class="badcase-head"><span class="status-dot' "$HTML"; then
|
|
63
|
-
echo "badcase marker still starts a separate title row" >&2
|
|
64
|
-
exit 1
|
|
65
|
-
fi
|
|
66
|
-
grep -q '<a class="detail-link" href="#case-1">' "$HTML"
|
package/tests/BC-20260626-080.sh
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
SCRIPT="${1:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/scripts/context_guard.py}"
|
|
5
|
-
ROOT="$(mktemp -d "${TMPDIR:-/tmp}/context-guard-readable-map-XXXXXX")"
|
|
6
|
-
trap 'rm -rf "$ROOT"' EXIT
|
|
7
|
-
|
|
8
|
-
python3 "$SCRIPT" init --root "$ROOT" >/dev/null
|
|
9
|
-
python3 "$SCRIPT" set-language --language zh --root "$ROOT" >/dev/null
|
|
10
|
-
|
|
11
|
-
CTX="$ROOT/.codex/context"
|
|
12
|
-
cat > "$CTX/roadmap.md" <<'MD'
|
|
13
|
-
# Context Roadmap
|
|
14
|
-
|
|
15
|
-
## Nodes
|
|
16
|
-
|
|
17
|
-
### NODE-20260626-001: 主线起点
|
|
18
|
-
|
|
19
|
-
- Date: 2026-06-26
|
|
20
|
-
- Status: done
|
|
21
|
-
- Level: major
|
|
22
|
-
- Branch: Main
|
|
23
|
-
- Parent: none
|
|
24
|
-
- Outcome: 这是一段很长的主线摘要,过去会直接显示在多路线概览卡片里,让路线图看起来像卡片墙而不是路线骨架。
|
|
25
|
-
- Next: none
|
|
26
|
-
- Linked bad cases: none
|
|
27
|
-
|
|
28
|
-
### NODE-20260626-002: 支线入口
|
|
29
|
-
|
|
30
|
-
- Date: 2026-06-26
|
|
31
|
-
- Status: done
|
|
32
|
-
- Level: major
|
|
33
|
-
- Branch: 可读性支线
|
|
34
|
-
- Parent: NODE-20260626-001
|
|
35
|
-
- Outcome: 这是一段很长的支线摘要,应该留在详情里,而不是占据概览卡片的主要视觉空间。
|
|
36
|
-
- Next: none
|
|
37
|
-
- Linked bad cases: none
|
|
38
|
-
MD
|
|
39
|
-
|
|
40
|
-
python3 "$SCRIPT" show-roadmap --root "$ROOT" >/dev/null
|
|
41
|
-
HTML="$CTX/roadmap/roadmap.html"
|
|
42
|
-
|
|
43
|
-
grep -q 'class="route-stack branch-map"' "$HTML"
|
|
44
|
-
grep -q '.track-grid.route-only {' "$HTML"
|
|
45
|
-
grep -q 'grid-auto-columns: minmax(180px, 230px);' "$HTML"
|
|
46
|
-
grep -q '.branch-map .summary {' "$HTML"
|
|
47
|
-
grep -q 'display: none;' "$HTML"
|
|
48
|
-
grep -q -- '-webkit-line-clamp: 3;' "$HTML"
|
package/tests/BC-20260626-081.sh
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
SCRIPT="${1:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/scripts/context_guard.py}"
|
|
5
|
-
ROOT="$(mktemp -d "${TMPDIR:-/tmp}/context-guard-hidden-details-XXXXXX")"
|
|
6
|
-
trap 'rm -rf "$ROOT"' EXIT
|
|
7
|
-
|
|
8
|
-
python3 "$SCRIPT" init --root "$ROOT" >/dev/null
|
|
9
|
-
python3 "$SCRIPT" set-language --language zh --root "$ROOT" >/dev/null
|
|
10
|
-
|
|
11
|
-
CTX="$ROOT/.codex/context"
|
|
12
|
-
cat > "$CTX/roadmap.md" <<'MD'
|
|
13
|
-
# Context Roadmap
|
|
14
|
-
|
|
15
|
-
## Nodes
|
|
16
|
-
|
|
17
|
-
### NODE-20260626-001: 可点击路线节点
|
|
18
|
-
|
|
19
|
-
- Date: 2026-06-26
|
|
20
|
-
- Status: done
|
|
21
|
-
- Level: major
|
|
22
|
-
- Branch: Main
|
|
23
|
-
- Parent: none
|
|
24
|
-
- Outcome: 这个节点的详细概括只能在点击节点后显示,不能默认铺在 roadmap 下方。
|
|
25
|
-
- Next: none
|
|
26
|
-
- Linked bad cases: none
|
|
27
|
-
MD
|
|
28
|
-
|
|
29
|
-
python3 "$SCRIPT" show-roadmap --root "$ROOT" >/dev/null
|
|
30
|
-
HTML="$CTX/roadmap/roadmap.html"
|
|
31
|
-
|
|
32
|
-
grep -q '<a class="lane-link" href="#node-1">' "$HTML"
|
|
33
|
-
grep -q '<section class="inline-details" hidden data-inline-details' "$HTML"
|
|
34
|
-
grep -q 'function setupInlineDetails()' "$HTML"
|
|
35
|
-
grep -q 'class="detail-card" id="node-1"' "$HTML"
|
|
36
|
-
|
|
37
|
-
if grep -q '<section class="inline-details" aria-label="Roadmap details">' "$HTML"; then
|
|
38
|
-
echo "inline details are visible by default" >&2
|
|
39
|
-
exit 1
|
|
40
|
-
fi
|
package/tests/BC-20260626-082.sh
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
SKILL_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
-
SCRIPT="$SKILL_ROOT/scripts/context_guard.py"
|
|
6
|
-
HOOK="$SKILL_ROOT/scripts/context_guard_hook.py"
|
|
7
|
-
ROOT="$(mktemp -d "${TMPDIR:-/tmp}/context-guard-root-selection-XXXXXX")"
|
|
8
|
-
ROOT="$(cd "$ROOT" && pwd -P)"
|
|
9
|
-
trap 'rm -rf "$ROOT"' EXIT
|
|
10
|
-
|
|
11
|
-
mkdir -p "$ROOT/project"
|
|
12
|
-
git -C "$ROOT/project" init --quiet >/dev/null
|
|
13
|
-
|
|
14
|
-
if (cd "$SKILL_ROOT" && python3 "$SCRIPT" show-roadmap >/tmp/context-guard-implicit-skill-root.out 2>&1); then
|
|
15
|
-
echo "show-roadmap unexpectedly accepted the skill directory as implicit project root" >&2
|
|
16
|
-
exit 1
|
|
17
|
-
fi
|
|
18
|
-
grep -q 'refusing to use the Context Guard skill directory' /tmp/context-guard-implicit-skill-root.out
|
|
19
|
-
|
|
20
|
-
rm -rf "$SKILL_ROOT/.codex"
|
|
21
|
-
printf '{"cwd":"%s/project","prompt":"show roadmap"}' "$ROOT" | (
|
|
22
|
-
cd "$SKILL_ROOT"
|
|
23
|
-
python3 "$HOOK" session-start
|
|
24
|
-
) >/tmp/context-guard-hook-root.out
|
|
25
|
-
|
|
26
|
-
test -f "$ROOT/project/.codex/context/index.md"
|
|
27
|
-
test -f "$ROOT/project/.codex/context/roadmap.md"
|
|
28
|
-
if test -e "$SKILL_ROOT/.codex/context/roadmap.md"; then
|
|
29
|
-
echo "hook wrote project context into the skill directory" >&2
|
|
30
|
-
exit 1
|
|
31
|
-
fi
|
|
32
|
-
grep -q "$ROOT/project/.codex/context" /tmp/context-guard-hook-root.out
|
package/tests/BC-20260626-083.sh
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
SCRIPT="${1:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/scripts/context_guard.py}"
|
|
5
|
-
ROOT="$(mktemp -d "${TMPDIR:-/tmp}/context-guard-node-detail-XXXXXX")"
|
|
6
|
-
trap 'rm -rf "$ROOT"' EXIT
|
|
7
|
-
|
|
8
|
-
python3 "$SCRIPT" init --root "$ROOT" >/dev/null
|
|
9
|
-
python3 "$SCRIPT" set-language --language zh --root "$ROOT" >/dev/null
|
|
10
|
-
|
|
11
|
-
CTX="$ROOT/.codex/context"
|
|
12
|
-
cat > "$CTX/roadmap.md" <<'MD'
|
|
13
|
-
# Context Roadmap
|
|
14
|
-
|
|
15
|
-
## Nodes
|
|
16
|
-
|
|
17
|
-
### NODE-20260626-001: 加入 Task Case 设计确认和 goal 阶段门控
|
|
18
|
-
|
|
19
|
-
- Date: 2026-06-26
|
|
20
|
-
- Status: done
|
|
21
|
-
- Level: major
|
|
22
|
-
- Branch: Main
|
|
23
|
-
- Parent: none
|
|
24
|
-
- Task: `CTX-20260626-test-chain`
|
|
25
|
-
- Outcome: Context Guard 要求复杂 Task Case 先给用户确认测试设计;goal 模式下把 Task Case 作为阶段门控。
|
|
26
|
-
- Decision / reason: 用户指出测试 case 应该是任务导向,而不是为每个 bug 造很多零散脚本。
|
|
27
|
-
- Avoid going back: 不要让 agent 静默创建大批未经确认的测试 case。
|
|
28
|
-
- Next: 继续观察 goal 模式下是否按阶段记录测试 checkpoint。
|
|
29
|
-
- Linked bad cases: BC-20260626-999
|
|
30
|
-
- Test chain: 节点详情页应显示用户问题、相关问题案例、采取方法和当前进度。
|
|
31
|
-
MD
|
|
32
|
-
|
|
33
|
-
cat > "$CTX/bad-cases.md" <<'MD'
|
|
34
|
-
# Bad Case Register
|
|
35
|
-
|
|
36
|
-
## Active Cases
|
|
37
|
-
|
|
38
|
-
### BC-20260626-999: 测试链路变成碎片化脚本
|
|
39
|
-
|
|
40
|
-
- Status: resolved
|
|
41
|
-
- First observed: 2026-06-26
|
|
42
|
-
- Last checked: 2026-06-26
|
|
43
|
-
- Scope: test-chain design
|
|
44
|
-
- Roadmap nodes: NODE-20260626-001
|
|
45
|
-
- Tags: #test-chain #context-bloat
|
|
46
|
-
- Phenomenon: agent 为每个 bug 创建零散脚本,真实任务流反而看不清。
|
|
47
|
-
- Trigger / reproduction: 让 agent 为多个历史 bad case 设计测试。
|
|
48
|
-
- Root cause: 测试链路没有以真实任务为单位组织。
|
|
49
|
-
- Fix method: 引入 task case 草案确认和阶段 checkpoint。
|
|
50
|
-
- Guard / verification: 检查节点详情页的相关问题案例和测试链路说明聚合在节点页面内。
|
|
51
|
-
MD
|
|
52
|
-
|
|
53
|
-
python3 "$SCRIPT" show-roadmap --root "$ROOT" >/dev/null
|
|
54
|
-
DETAIL="$CTX/roadmap/roadmap-details.html"
|
|
55
|
-
|
|
56
|
-
grep -q '用户提出的问题' "$DETAIL"
|
|
57
|
-
grep -q '相关问题案例' "$DETAIL"
|
|
58
|
-
grep -q '采取方法' "$DETAIL"
|
|
59
|
-
grep -q '当前进度' "$DETAIL"
|
|
60
|
-
grep -q '测试链路变成碎片化脚本' "$DETAIL"
|
|
61
|
-
grep -q '引入 task case 草案确认和阶段 checkpoint' "$DETAIL"
|
|
62
|
-
|
|
63
|
-
if grep -q '<h2 data-i18n="badCases">Bad Cases</h2>' "$DETAIL"; then
|
|
64
|
-
echo "detail page still renders a global bad-case list instead of node-scoped sections" >&2
|
|
65
|
-
exit 1
|
|
66
|
-
fi
|
package/tests/BC-20260627-084.sh
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
SCRIPT="${1:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/scripts/context_guard.py}"
|
|
5
|
-
ROOT="$(mktemp -d "${TMPDIR:-/tmp}/context-guard-readable-detail-XXXXXX")"
|
|
6
|
-
trap 'rm -rf "$ROOT"' EXIT
|
|
7
|
-
|
|
8
|
-
python3 "$SCRIPT" init --root "$ROOT" >/dev/null
|
|
9
|
-
python3 "$SCRIPT" set-language --language zh --root "$ROOT" >/dev/null
|
|
10
|
-
|
|
11
|
-
CTX="$ROOT/.codex/context"
|
|
12
|
-
cat > "$CTX/roadmap.md" <<'MD'
|
|
13
|
-
# Context Roadmap
|
|
14
|
-
|
|
15
|
-
### NODE-20260627-001: 重构节点详情阅读页
|
|
16
|
-
- Date: 2026-06-27
|
|
17
|
-
- Status: done
|
|
18
|
-
- Level: major
|
|
19
|
-
- Branch: Main
|
|
20
|
-
- Outcome: Context Guard 现在承认用户截图、日志、复现和已定位根因可作为 red signal;证据足够时应停止补测试并进入实现。
|
|
21
|
-
- Decision / reason: 用户反馈旧详情页像列表堆料,不利于浏览;详情页应该围绕当前节点,而不是全局展开 bad case 列表;按 `;`、`;` 拆成长字段短条目时不能切碎代码片段;采取方法需要短行展示,不能把多个决策塞进一个段落。用户反馈 skill 又陷入测试循环,说明验证预算还不够,需要明确 stop condition。
|
|
22
|
-
- Avoid going back: 不要在节点详情里渲染全局 Bad Cases 长列表;不要把测试命令日志混入当前进度区;不要把采取方法渲染成一整段文字墙。
|
|
23
|
-
- Next: 保持节点详情只呈现当前节点的关键内容。
|
|
24
|
-
- Linked bad cases: BC-20260627-084
|
|
25
|
-
MD
|
|
26
|
-
|
|
27
|
-
cat > "$CTX/bad-cases.md" <<'MD'
|
|
28
|
-
# Bad Case Register
|
|
29
|
-
|
|
30
|
-
### BC-20260627-084: 节点详情采取方法像文字墙
|
|
31
|
-
- Status: resolved
|
|
32
|
-
- Roadmap nodes: NODE-20260627-001
|
|
33
|
-
- Tags: #roadmap-ux #readability
|
|
34
|
-
- Phenomenon: 节点详情的采取方法把多个长句拼成一段,用户很难扫读。
|
|
35
|
-
- Fix method: 将采取方法拆成短列表;相关问题案例留在当前节点内;进度区不混入测试命令日志。
|
|
36
|
-
- Guard / verification: 检查详情 HTML 中采取方法和当前进度使用 compact list。
|
|
37
|
-
MD
|
|
38
|
-
|
|
39
|
-
python3 "$SCRIPT" show-roadmap --root "$ROOT" >/dev/null
|
|
40
|
-
HTML="$CTX/roadmap/roadmap.html"
|
|
41
|
-
DETAIL="$CTX/roadmap/roadmap-details.html"
|
|
42
|
-
|
|
43
|
-
python3 - "$SCRIPT" <<'PY'
|
|
44
|
-
import importlib.util
|
|
45
|
-
import sys
|
|
46
|
-
|
|
47
|
-
script = sys.argv[1]
|
|
48
|
-
spec = importlib.util.spec_from_file_location("context_guard_under_test", script)
|
|
49
|
-
module = importlib.util.module_from_spec(spec)
|
|
50
|
-
assert spec.loader
|
|
51
|
-
spec.loader.exec_module(module)
|
|
52
|
-
items = module.split_detail_items("第一条;按 `;`、`;` 拆成长字段短条目时不能切碎代码片段;第三条。")
|
|
53
|
-
assert items == [
|
|
54
|
-
"第一条",
|
|
55
|
-
"按 `;`、`;` 拆成长字段短条目时不能切碎代码片段",
|
|
56
|
-
"第三条",
|
|
57
|
-
], items
|
|
58
|
-
assert module.polish_detail_zh(
|
|
59
|
-
"后续观察 stop hook 是否能让 Codex 在根因明确后先修复,再做一个最小 post-fix 检查。"
|
|
60
|
-
) == "下一步观察结束钩子能否提醒 Codex:根因明确后先修复,再做一次最小检查。"
|
|
61
|
-
PY
|
|
62
|
-
|
|
63
|
-
grep -q 'class="detail-list"' "$HTML"
|
|
64
|
-
grep -q 'class="detail-list"' "$DETAIL"
|
|
65
|
-
grep -q '<li>.*不要在节点详情里渲染全局 Bad Cases 长列表' "$DETAIL"
|
|
66
|
-
grep -q '<li>.*将采取方法拆成短列表' "$DETAIL"
|
|
67
|
-
grep -q '用户发现 Context Guard 又把时间耗在反复补测试上,因此需要给验证流程设置明确的停止条件' "$DETAIL"
|
|
68
|
-
grep -q '现在只要有截图、日志、复现步骤或明确根因,就可以确认问题已经成立' "$DETAIL"
|
|
69
|
-
grep -q '证据足够时,先修复问题,再做最小验证' "$DETAIL"
|
|
70
|
-
|
|
71
|
-
if grep -q '不要在节点详情里渲染全局 Bad Cases 长列表;不要把测试命令日志混入当前进度区;不要把采取方法渲染成一整段文字墙' "$DETAIL"; then
|
|
72
|
-
echo "method detail is still rendered as one paragraph wall" >&2
|
|
73
|
-
exit 1
|
|
74
|
-
fi
|
package/tests/BC-20260630-086.sh
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
SCRIPT="${1:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/scripts/context_guard.py}"
|
|
5
|
-
ROOT="$(mktemp -d "${TMPDIR:-/tmp}/context-guard-user-request-XXXXXX")"
|
|
6
|
-
trap 'rm -rf "$ROOT"' EXIT
|
|
7
|
-
|
|
8
|
-
python3 "$SCRIPT" init --root "$ROOT" >/dev/null
|
|
9
|
-
python3 "$SCRIPT" set-language --language zh --root "$ROOT" >/dev/null
|
|
10
|
-
|
|
11
|
-
CTX="$ROOT/.codex/context"
|
|
12
|
-
python3 "$SCRIPT" checkpoint-roadmap-node \
|
|
13
|
-
--root "$ROOT" \
|
|
14
|
-
--title "改善节点详情可读性" \
|
|
15
|
-
--branch "Main" \
|
|
16
|
-
--level major \
|
|
17
|
-
--user-request "用户希望节点详情里的问题摘要直接来自用户输入,不要由 Codex 自由发挥。" \
|
|
18
|
-
--outcome "节点详情页现在优先展示 User request 字段。" \
|
|
19
|
-
--decision "这是内部实现决策,不应该冒充用户提出的问题。" \
|
|
20
|
-
--next-step "继续保持用户问题摘要和实现复盘分离。" >/dev/null
|
|
21
|
-
|
|
22
|
-
python3 "$SCRIPT" show-roadmap --root "$ROOT" >/dev/null
|
|
23
|
-
DETAIL="$CTX/roadmap/roadmap-details.html"
|
|
24
|
-
|
|
25
|
-
grep -q -- "- User request: 用户希望节点详情里的问题摘要直接来自用户输入" "$CTX/roadmap.md"
|
|
26
|
-
grep -q "用户希望节点详情里的问题摘要直接来自用户输入,不要由 Codex 自由发挥" "$DETAIL"
|
|
27
|
-
|
|
28
|
-
python3 - "$DETAIL" <<'PY'
|
|
29
|
-
from pathlib import Path
|
|
30
|
-
import re
|
|
31
|
-
import sys
|
|
32
|
-
|
|
33
|
-
html = Path(sys.argv[1]).read_text(encoding="utf-8")
|
|
34
|
-
match = re.search(r'<h4>.*?用户提出的问题.*?</h4>\s*<div>(?P<body>.*?)</div>', html, re.S)
|
|
35
|
-
assert match, "user-question section should render"
|
|
36
|
-
body = match.group("body")
|
|
37
|
-
assert "用户希望节点详情里的问题摘要直接来自用户输入" in body
|
|
38
|
-
assert "内部实现决策" not in body
|
|
39
|
-
assert "Outcome" not in body
|
|
40
|
-
PY
|
|
41
|
-
|
|
42
|
-
python3 "$SCRIPT" checkpoint-roadmap-node \
|
|
43
|
-
--root "$ROOT" \
|
|
44
|
-
--title "历史节点没有用户请求字段" \
|
|
45
|
-
--branch "Main" \
|
|
46
|
-
--level major \
|
|
47
|
-
--outcome "历史节点没有 User request 字段。" >/dev/null
|
|
48
|
-
|
|
49
|
-
python3 "$SCRIPT" show-roadmap --root "$ROOT" >/dev/null
|
|
50
|
-
grep -q "这个历史节点没有记录用户原始请求" "$DETAIL"
|