@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
package/tests/BC-20260710-002.sh
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
5
|
-
SCRIPT="${CONTEXT_GUARD_SCRIPT:-$ROOT_DIR/scripts/context_guard.py}"
|
|
6
|
-
HOOK="${CONTEXT_GUARD_HOOK:-$ROOT_DIR/scripts/context_guard_hook.py}"
|
|
7
|
-
BASE="$(mktemp -d "${TMPDIR:-/tmp}/context-guard-subagent-root-XXXXXX")"
|
|
8
|
-
trap 'rm -rf "$BASE"' EXIT
|
|
9
|
-
CONTROL="$BASE/control"
|
|
10
|
-
CHILD="$BASE/child-product"
|
|
11
|
-
mkdir -p "$CONTROL" "$CHILD"
|
|
12
|
-
CONTROL="$(realpath "$CONTROL")"
|
|
13
|
-
CHILD="$(realpath "$CHILD")"
|
|
14
|
-
|
|
15
|
-
cat >"$CHILD/verify.sh" <<'SH'
|
|
16
|
-
#!/usr/bin/env bash
|
|
17
|
-
set -euo pipefail
|
|
18
|
-
test -f product.txt
|
|
19
|
-
grep -Fq "ready" product.txt
|
|
20
|
-
SH
|
|
21
|
-
chmod +x "$CHILD/verify.sh"
|
|
22
|
-
printf 'ready\n' >"$CHILD/product.txt"
|
|
23
|
-
|
|
24
|
-
python3 "$SCRIPT" subagent-register \
|
|
25
|
-
--root "$CONTROL" \
|
|
26
|
-
--agent-id "root-agent" \
|
|
27
|
-
--project-root "$CHILD" \
|
|
28
|
-
--task "完善本地商品流程" >"$BASE/register.out"
|
|
29
|
-
|
|
30
|
-
grep -Fq "subagent project root: $CHILD" "$BASE/register.out"
|
|
31
|
-
python3 "$SCRIPT" test-hub-add \
|
|
32
|
-
--root "$CHILD" \
|
|
33
|
-
--title "商品流程" \
|
|
34
|
-
--command-text "./verify.sh" \
|
|
35
|
-
--run-policy every-dev-completion \
|
|
36
|
-
--test-status approved >/dev/null
|
|
37
|
-
|
|
38
|
-
cat >"$BASE/evidence.txt" <<'TXT'
|
|
39
|
-
CG_BAD_CASE: 商品状态切换后没有保存
|
|
40
|
-
CG_PHENOMENON: 切换商品状态并刷新后,页面恢复旧状态。
|
|
41
|
-
CG_TRIGGER: 修改状态后刷新页面。
|
|
42
|
-
CG_CAUSE: 状态切换没有写入本地存储。
|
|
43
|
-
CG_FIX: 状态变更后立即持久化。
|
|
44
|
-
CG_VERIFICATION: 修改状态后刷新,仍显示新状态。
|
|
45
|
-
CG_SCOPE: 商品状态管理
|
|
46
|
-
TXT
|
|
47
|
-
|
|
48
|
-
python3 - "$CONTROL" "$BASE/evidence.txt" <<'PY' | \
|
|
49
|
-
(cd "$CONTROL" && python3 "$HOOK" subagent-stop) >"$BASE/hook.out" 2>"$BASE/hook.err"
|
|
50
|
-
from pathlib import Path
|
|
51
|
-
import json
|
|
52
|
-
import sys
|
|
53
|
-
|
|
54
|
-
print(json.dumps({
|
|
55
|
-
"agent_id": "root-agent",
|
|
56
|
-
"cwd": sys.argv[1],
|
|
57
|
-
"last_assistant_message": Path(sys.argv[2]).read_text(encoding="utf-8"),
|
|
58
|
-
}, ensure_ascii=False))
|
|
59
|
-
PY
|
|
60
|
-
|
|
61
|
-
grep -Fq "project root: $CHILD" "$BASE/hook.err"
|
|
62
|
-
grep -Fq "test hub: 1 passed, 0 failed, 0 blocked" "$BASE/hook.err"
|
|
63
|
-
test -f "$CHILD/.codex/context/test-hub/last-run.json"
|
|
64
|
-
grep -Fq "completion evidence: archived concrete bad case(s)" "$BASE/hook.err"
|
|
65
|
-
|
|
66
|
-
python3 "$SCRIPT" subagent-complete \
|
|
67
|
-
--root "$CONTROL" \
|
|
68
|
-
--agent-id "root-agent" \
|
|
69
|
-
--evidence-file "$BASE/evidence.txt" >"$BASE/complete.out"
|
|
70
|
-
|
|
71
|
-
grep -Fq "subagent project root: $CHILD" "$BASE/complete.out"
|
|
72
|
-
grep -Fq "subagent completion already processed" "$BASE/complete.out"
|
|
73
|
-
grep -Fq "商品状态切换后没有保存" "$CHILD/.codex/context/bad-cases.md"
|
|
74
|
-
grep -Fq "Subagent completion handoff" "$CHILD/.codex/context/roadmap.md"
|
|
75
|
-
[[ "$(grep -c 'Subagent completion handoff' "$CHILD/.codex/context/roadmap.md")" == "1" ]]
|
|
76
|
-
[[ "$(grep -c '^### BC-' "$CHILD/.codex/context/bad-cases.md")" == "1" ]]
|
|
77
|
-
if grep -Fq "Subagent completion handoff" "$CONTROL/.codex/context/roadmap.md"; then
|
|
78
|
-
echo "completion checkpoint leaked into the control workspace" >&2
|
|
79
|
-
exit 1
|
|
80
|
-
fi
|
|
81
|
-
|
|
82
|
-
python3 - "$CONTROL/.codex/context/subagents/assignments.json" "$CHILD" <<'PY'
|
|
83
|
-
from pathlib import Path
|
|
84
|
-
import json
|
|
85
|
-
import sys
|
|
86
|
-
|
|
87
|
-
data = json.loads(Path(sys.argv[1]).read_text(encoding="utf-8"))
|
|
88
|
-
item = data["assignments"]["root-agent"]
|
|
89
|
-
assert item["project_root"] == sys.argv[2], item
|
|
90
|
-
assert item["status"] == "completed", item
|
|
91
|
-
assert item["last_test_code"] == 0, item
|
|
92
|
-
PY
|
|
93
|
-
|
|
94
|
-
python3 "$SCRIPT" subagent-register \
|
|
95
|
-
--root "$CONTROL" \
|
|
96
|
-
--agent-id "root-agent" \
|
|
97
|
-
--project-root "$CHILD" \
|
|
98
|
-
--task "继续下一轮商品流程" >/dev/null
|
|
99
|
-
|
|
100
|
-
python3 - "$CONTROL/.codex/context/subagents/assignments.json" <<'PY'
|
|
101
|
-
from pathlib import Path
|
|
102
|
-
import json
|
|
103
|
-
import sys
|
|
104
|
-
|
|
105
|
-
item = json.loads(Path(sys.argv[1]).read_text(encoding="utf-8"))["assignments"]["root-agent"]
|
|
106
|
-
assert item["status"] == "running", item
|
|
107
|
-
assert item["last_test_code"] == 0, item
|
|
108
|
-
assert item.get("last_completion_fingerprint"), item
|
|
109
|
-
PY
|
|
110
|
-
|
|
111
|
-
echo "BC-20260710-002 passed"
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
ROOT="$(mktemp -d "${TMPDIR:-/tmp}/context-guard-npm-install-XXXXXX")"
|
|
5
|
-
ROOT="$(cd "$ROOT" && pwd)"
|
|
6
|
-
trap 'rm -rf "$ROOT"' EXIT
|
|
7
|
-
NODE_BIN="${NODE:-node}"
|
|
8
|
-
|
|
9
|
-
SKILL_COUNT="$(find . -path './.git' -prune -o -name SKILL.md -print | wc -l | tr -d '[:space:]')"
|
|
10
|
-
test "$SKILL_COUNT" = "1"
|
|
11
|
-
|
|
12
|
-
"$NODE_BIN" bin/context-guard-skill.js --help >/dev/null
|
|
13
|
-
"$NODE_BIN" bin/context-guard-skill.js install --target "$ROOT/skill" >/dev/null
|
|
14
|
-
|
|
15
|
-
test -f "$ROOT/skill/SKILL.md"
|
|
16
|
-
test -f "$ROOT/skill/scripts/context_guard.py"
|
|
17
|
-
test -f "$ROOT/skill/README.zh-CN.md"
|
|
18
|
-
INSTALLED_SKILL_COUNT="$(find "$ROOT/skill" -name SKILL.md -print | wc -l | tr -d '[:space:]')"
|
|
19
|
-
test "$INSTALLED_SKILL_COUNT" = "1"
|
|
20
|
-
|
|
21
|
-
CODEX_HOME="$ROOT/codex-home" "$NODE_BIN" bin/context-guard-skill.js install >/dev/null
|
|
22
|
-
test -f "$ROOT/codex-home/skills/context-guard/SKILL.md"
|
|
23
|
-
|
|
24
|
-
npm_config_global=true CODEX_HOME="$ROOT/global-codex-home" "$NODE_BIN" bin/postinstall.js >/dev/null
|
|
25
|
-
test -f "$ROOT/global-codex-home/skills/context-guard/SKILL.md"
|
|
26
|
-
|
|
27
|
-
PROJECT="$ROOT/project"
|
|
28
|
-
"$NODE_BIN" bin/context-guard-skill.js init --root "$PROJECT" >/dev/null
|
|
29
|
-
test -f "$PROJECT/.codex/context/index.md"
|
|
30
|
-
|
|
31
|
-
HOOKS="$ROOT/hooks.json"
|
|
32
|
-
CONFIG="$ROOT/config.toml"
|
|
33
|
-
cat >"$CONFIG" <<'EOF'
|
|
34
|
-
[features]
|
|
35
|
-
codex_hooks = true
|
|
36
|
-
multi_agent = true
|
|
37
|
-
|
|
38
|
-
[model]
|
|
39
|
-
name = "test"
|
|
40
|
-
EOF
|
|
41
|
-
"$NODE_BIN" bin/context-guard-skill.js install --target "$ROOT/skill-with-hooks" --with-hooks --hooks-target "$HOOKS" >/dev/null
|
|
42
|
-
grep -Fq "$ROOT/skill-with-hooks/scripts/context_guard_hook.py" "$HOOKS"
|
|
43
|
-
grep -Fq '"SubagentStart"' "$HOOKS"
|
|
44
|
-
grep -Fq '"SubagentStop"' "$HOOKS"
|
|
45
|
-
grep -Fq 'hooks = true' "$CONFIG"
|
|
46
|
-
grep -Fq 'multi_agent = true' "$CONFIG"
|
|
47
|
-
grep -Fq 'name = "test"' "$CONFIG"
|
|
48
|
-
! grep -Fq 'codex_hooks' "$CONFIG"
|
|
49
|
-
|
|
50
|
-
EMPTY_HOME="$ROOT/empty-codex-home"
|
|
51
|
-
CODEX_HOME="$EMPTY_HOME" "$NODE_BIN" bin/context-guard-skill.js install --with-hooks >/dev/null
|
|
52
|
-
grep -Fq '[features]' "$EMPTY_HOME/config.toml"
|
|
53
|
-
grep -Fq 'hooks = true' "$EMPTY_HOME/config.toml"
|