@amsterdamdatalabs/enact-extensions 0.1.0 → 0.1.3
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/README.md +96 -21
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +171 -1
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +402 -49
- package/dist/install.js.map +1 -1
- package/dist/internal/codex.d.ts.map +1 -1
- package/dist/internal/codex.js +7 -1
- package/dist/internal/codex.js.map +1 -1
- package/dist/internal/platform.d.ts +8 -0
- package/dist/internal/platform.d.ts.map +1 -1
- package/dist/internal/platform.js +46 -2
- package/dist/internal/platform.js.map +1 -1
- package/dist/provision.d.ts +30 -0
- package/dist/provision.d.ts.map +1 -0
- package/dist/provision.js +202 -0
- package/dist/provision.js.map +1 -0
- package/dist/validate/index.d.ts +44 -0
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +157 -0
- package/dist/validate/index.js.map +1 -1
- package/extensions/cmux/.agents/plugin.json +37 -0
- package/extensions/cmux/skills/cmux/SKILL.md +82 -0
- package/extensions/cmux/skills/cmux/agents/openai.yaml +4 -0
- package/extensions/cmux/skills/cmux/references/handles-and-identify.md +35 -0
- package/extensions/cmux/skills/cmux/references/panes-surfaces.md +37 -0
- package/extensions/cmux/skills/cmux/references/trigger-flash-and-health.md +23 -0
- package/extensions/cmux/skills/cmux/references/windows-workspaces.md +31 -0
- package/extensions/cmux/skills/cmux-vm-monitor/SKILL.md +122 -0
- package/extensions/cmux/skills/cmux-vm-monitor/agents/openai.yaml +4 -0
- package/extensions/cmux/skills/cmux-vm-monitor/references/cmux-commands.md +66 -0
- package/extensions/cmux/skills/cmux-vm-monitor/scripts/codex_vm_monitor.sh +45 -0
- package/extensions/cmux/skills/cmux-workspace/SKILL.md +93 -0
- package/extensions/dev-state/.agents/plugin.json +35 -0
- package/extensions/dev-state/skills/dev-state-plan-graduation/SKILL.md +194 -0
- package/extensions/dev-state/skills/dev-state-plan-graduation/agents/openai.yaml +4 -0
- package/extensions/dev-state/skills/dev-state-plan-graduation/references/reference.md +130 -0
- package/extensions/devops/.agents/plugin.json +36 -0
- package/extensions/devops/skills/azure-devops-cli/SKILL.md +431 -0
- package/extensions/devops/skills/azure-devops-cli/agents/openai.yaml +4 -0
- package/extensions/devops/skills/ci-pipeline-strategy/SKILL.md +217 -0
- package/extensions/devops/skills/ci-pipeline-strategy/agents/openai.yaml +4 -0
- package/extensions/enact-context/.agents/plugin.json +40 -0
- package/extensions/enact-context/.mcp.json +8 -0
- package/extensions/enact-context/README.md +25 -0
- package/extensions/enact-context/assets/icon.png +0 -0
- package/extensions/enact-context/assets/logo.png +0 -0
- package/extensions/enact-context/hooks/hooks.json +115 -0
- package/extensions/enact-context/skills/enact-context/SKILL.md +149 -0
- package/extensions/enact-context/skills/enact-context/scripts/install.sh +69 -0
- package/extensions/enact-factory/.agents/plugin.json +42 -0
- package/extensions/enact-factory/.mcp.json +8 -0
- package/extensions/enact-factory/assets/icon.png +0 -0
- package/extensions/enact-factory/assets/logo.png +0 -0
- package/extensions/enact-factory/hooks/user-prompt-submit.mjs +67 -0
- package/extensions/enact-factory/skills/testing-strategy/SKILL.md +167 -0
- package/extensions/enact-factory/skills/workitem-triage/SKILL.md +22 -0
- package/extensions/enact-operator/.agents/plugin.json +57 -0
- package/extensions/enact-operator/.app.json +3 -0
- package/extensions/enact-operator/.mcp.json +10 -0
- package/extensions/enact-operator/_taxonomy.md +86 -0
- package/extensions/enact-operator/agents/README.md +5 -0
- package/extensions/enact-operator/agents/architect.toml +25 -0
- package/extensions/enact-operator/agents/code-reviewer.toml +24 -0
- package/extensions/enact-operator/agents/critic.toml +30 -0
- package/extensions/enact-operator/agents/executor.toml +24 -0
- package/extensions/enact-operator/agents/explore.toml +23 -0
- package/extensions/enact-operator/agents/planner.toml +24 -0
- package/extensions/enact-operator/agents/verifier.toml +24 -0
- package/extensions/enact-operator/assets/icon.png +0 -0
- package/extensions/enact-operator/assets/logo.png +0 -0
- package/extensions/enact-operator/commands/doctor.md +39 -0
- package/extensions/enact-operator/commands/setup.md +51 -0
- package/extensions/enact-operator/hooks/hooks.json +146 -0
- package/extensions/enact-operator/skills/_variants.md +44 -0
- package/extensions/enact-operator/skills/ai-slop-cleaner/SKILL.md +50 -0
- package/extensions/enact-operator/skills/analyze/SKILL.md +91 -0
- package/extensions/enact-operator/skills/ask/SKILL.md +47 -0
- package/extensions/enact-operator/skills/autopilot/SKILL.md +170 -0
- package/extensions/enact-operator/skills/autoresearch-goal/SKILL.md +79 -0
- package/extensions/enact-operator/skills/cancel/SKILL.md +99 -0
- package/extensions/enact-operator/skills/configure-notifications/SKILL.md +77 -0
- package/extensions/enact-operator/skills/deep-interview/SKILL.md +80 -0
- package/extensions/enact-operator/skills/doctor/SKILL.md +48 -0
- package/extensions/enact-operator/skills/hud/SKILL.md +49 -0
- package/extensions/enact-operator/skills/hyperplan/SKILL.md +47 -0
- package/extensions/enact-operator/skills/plan/SKILL.md +78 -0
- package/extensions/enact-operator/skills/ralph/SKILL.md +201 -0
- package/extensions/enact-operator/skills/ralph/gemini.md +18 -0
- package/extensions/enact-operator/skills/ralplan/SKILL.md +151 -0
- package/extensions/enact-operator/skills/remove-deadcode/SKILL.md +45 -0
- package/extensions/enact-operator/skills/research/SKILL.md +74 -0
- package/extensions/enact-operator/skills/review/SKILL.md +58 -0
- package/extensions/enact-operator/skills/security-research/SKILL.md +54 -0
- package/extensions/enact-operator/skills/setup/SKILL.md +91 -0
- package/extensions/enact-operator/skills/setup/scripts/install.sh +50 -0
- package/extensions/enact-operator/skills/skill/SKILL.md +82 -0
- package/extensions/enact-operator/skills/tdd/SKILL.md +59 -0
- package/extensions/enact-operator/skills/team/SKILL.md +199 -0
- package/extensions/enact-operator/skills/trace/SKILL.md +41 -0
- package/extensions/enact-operator/skills/ultragoal/SKILL.md +99 -0
- package/extensions/enact-operator/skills/ultraqa/SKILL.md +113 -0
- package/extensions/enact-operator/skills/ultrawork/SKILL.md +145 -0
- package/extensions/enact-operator/skills/ultrawork/planner.md +28 -0
- package/extensions/enact-operator/skills/wiki/SKILL.md +41 -0
- package/extensions/enact-operator/skills/work-with-workitem/SKILL.md +51 -0
- package/extensions/enact-wiki/.agents/plugin.json +42 -0
- package/extensions/enact-wiki/.mcp.json +15 -0
- package/extensions/enact-wiki/README.md +44 -0
- package/extensions/enact-wiki/assets/icon.png +0 -0
- package/extensions/enact-wiki/assets/logo.png +0 -0
- package/extensions/enact-wiki/skills/document-parser/SKILL.md +17 -0
- package/extensions/enact-wiki/skills/document-parser/scripts/parse.sh +60 -0
- package/extensions/enact-wiki/skills/document-parser/skill.json +9 -0
- package/extensions/enact-wiki/skills/enact-wiki/SKILL.md +30 -0
- package/extensions/enact-wiki/skills/enact-wiki/references/ingest.md +62 -0
- package/extensions/enact-wiki/skills/enact-wiki/references/manage.md +34 -0
- package/extensions/enact-wiki/skills/enact-wiki/references/query.md +59 -0
- package/extensions/enact-wiki/skills/search-lab/SKILL.md +57 -0
- package/extensions/enact-wiki/skills/search-lab/scripts/analyze.ts +23 -0
- package/{plugins/net-revenue-management/.codex-plugin → extensions/net-revenue-management/.agents}/plugin.json +10 -6
- package/extensions/plugin-dev/.agents/plugin.json +42 -0
- package/extensions/plugin-dev/.mcp.json +3 -0
- package/extensions/plugin-dev/agents/agent-creator.md +199 -0
- package/extensions/plugin-dev/agents/plugin-validator.md +91 -0
- package/extensions/plugin-dev/agents/skill-reviewer.md +212 -0
- package/extensions/plugin-dev/commands/_archive/create-marketplace.md +427 -0
- package/extensions/plugin-dev/commands/_archive/plugin-dev-guide.md +12 -0
- package/extensions/plugin-dev/commands/create-plugin.md +498 -0
- package/extensions/plugin-dev/commands/start.md +81 -0
- package/extensions/plugin-dev/hooks/hooks.json +3 -0
- package/extensions/plugin-dev/skills/agent-development/SKILL.md +641 -0
- package/extensions/plugin-dev/skills/agent-development/examples/agent-creation-prompt.md +250 -0
- package/extensions/plugin-dev/skills/agent-development/examples/complete-agent-examples.md +461 -0
- package/extensions/plugin-dev/skills/agent-development/references/advanced-agent-fields.md +246 -0
- package/extensions/plugin-dev/skills/agent-development/references/agent-creation-system-prompt.md +216 -0
- package/extensions/plugin-dev/skills/agent-development/references/permission-modes-rules.md +226 -0
- package/extensions/plugin-dev/skills/agent-development/references/system-prompt-design.md +464 -0
- package/extensions/plugin-dev/skills/agent-development/references/triggering-examples.md +474 -0
- package/extensions/plugin-dev/skills/agent-development/scripts/create-agent-skeleton.sh +176 -0
- package/extensions/plugin-dev/skills/agent-development/scripts/test-agent-trigger.sh +227 -0
- package/extensions/plugin-dev/skills/agent-development/scripts/validate-agent.sh +227 -0
- package/extensions/plugin-dev/skills/command-development/SKILL.md +763 -0
- package/extensions/plugin-dev/skills/command-development/examples/plugin-commands.md +612 -0
- package/extensions/plugin-dev/skills/command-development/examples/simple-commands.md +527 -0
- package/extensions/plugin-dev/skills/command-development/references/advanced-workflows.md +762 -0
- package/extensions/plugin-dev/skills/command-development/references/documentation-patterns.md +769 -0
- package/extensions/plugin-dev/skills/command-development/references/frontmatter-reference.md +508 -0
- package/extensions/plugin-dev/skills/command-development/references/interactive-commands.md +966 -0
- package/extensions/plugin-dev/skills/command-development/references/marketplace-considerations.md +943 -0
- package/extensions/plugin-dev/skills/command-development/references/plugin-features-reference.md +637 -0
- package/extensions/plugin-dev/skills/command-development/references/plugin-integration.md +191 -0
- package/extensions/plugin-dev/skills/command-development/references/skill-tool.md +447 -0
- package/extensions/plugin-dev/skills/command-development/references/testing-strategies.md +723 -0
- package/extensions/plugin-dev/skills/command-development/scripts/check-frontmatter.sh +234 -0
- package/extensions/plugin-dev/skills/command-development/scripts/validate-command.sh +160 -0
- package/extensions/plugin-dev/skills/hook-development/SKILL.md +861 -0
- package/extensions/plugin-dev/skills/hook-development/examples/load-context.sh +55 -0
- package/extensions/plugin-dev/skills/hook-development/examples/validate-bash.sh +57 -0
- package/extensions/plugin-dev/skills/hook-development/examples/validate-write.sh +48 -0
- package/extensions/plugin-dev/skills/hook-development/references/advanced.md +871 -0
- package/extensions/plugin-dev/skills/hook-development/references/hook-input-schemas.md +145 -0
- package/extensions/plugin-dev/skills/hook-development/references/migration.md +392 -0
- package/extensions/plugin-dev/skills/hook-development/references/patterns.md +430 -0
- package/extensions/plugin-dev/skills/hook-development/scripts/README.md +181 -0
- package/extensions/plugin-dev/skills/hook-development/scripts/hook-linter.sh +153 -0
- package/extensions/plugin-dev/skills/hook-development/scripts/test-hook.sh +276 -0
- package/extensions/plugin-dev/skills/hook-development/scripts/validate-hook-schema.sh +159 -0
- package/extensions/plugin-dev/skills/mcp-integration/SKILL.md +775 -0
- package/extensions/plugin-dev/skills/mcp-integration/examples/http-server.json +20 -0
- package/extensions/plugin-dev/skills/mcp-integration/examples/sse-server.json +19 -0
- package/extensions/plugin-dev/skills/mcp-integration/examples/stdio-server.json +38 -0
- package/extensions/plugin-dev/skills/mcp-integration/examples/ws-server.json +26 -0
- package/extensions/plugin-dev/skills/mcp-integration/references/authentication.md +601 -0
- package/extensions/plugin-dev/skills/mcp-integration/references/server-discovery.md +190 -0
- package/extensions/plugin-dev/skills/mcp-integration/references/server-types.md +572 -0
- package/extensions/plugin-dev/skills/mcp-integration/references/tool-usage.md +623 -0
- package/extensions/plugin-dev/skills/plugin-dev-guide/SKILL.md +222 -0
- package/extensions/plugin-dev/skills/plugin-structure/SKILL.md +705 -0
- package/extensions/plugin-dev/skills/plugin-structure/examples/advanced-plugin.md +774 -0
- package/extensions/plugin-dev/skills/plugin-structure/examples/minimal-plugin.md +83 -0
- package/extensions/plugin-dev/skills/plugin-structure/examples/standard-plugin.md +611 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/advanced-topics.md +289 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/component-patterns.md +592 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/github-actions.md +233 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/headless-ci-mode.md +193 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/manifest-reference.md +625 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/output-styles.md +116 -0
- package/extensions/plugin-dev/skills/skill-development/SKILL.md +564 -0
- package/extensions/plugin-dev/skills/skill-development/examples/complete-skill.md +465 -0
- package/extensions/plugin-dev/skills/skill-development/examples/frontmatter-templates.md +167 -0
- package/extensions/plugin-dev/skills/skill-development/examples/minimal-skill.md +111 -0
- package/extensions/plugin-dev/skills/skill-development/references/advanced-frontmatter.md +225 -0
- package/extensions/plugin-dev/skills/skill-development/references/commands-vs-skills.md +39 -0
- package/extensions/plugin-dev/skills/skill-development/references/skill-creation-workflow.md +379 -0
- package/extensions/plugin-dev/skills/skill-development/references/skill-creator-original.md +210 -0
- package/package.json +8 -11
- package/scripts/enact-extensions.mjs +823 -21
- package/scripts/hooks/session-start-drift-check.mjs +58 -0
- package/scripts/lib/build-index.mjs +50 -0
- package/scripts/lib/bundle-hash.mjs +137 -0
- package/scripts/lib/hooks.mjs +741 -0
- package/scripts/lib/ledger.mjs +163 -0
- package/scripts/lib/list-bundles.mjs +70 -0
- package/scripts/lib/outdated.mjs +144 -0
- package/scripts/lib/provision-mcp.mjs +16 -0
- package/scripts/lib/resolve-bundle.mjs +121 -0
- package/scripts/lib/run-install.mjs +402 -38
- package/scripts/lib/run-prune.mjs +73 -0
- package/scripts/lib/run-sync.mjs +9 -1
- package/scripts/lib/run-uninstall.mjs +244 -0
- package/scripts/lib/run-update.mjs +152 -0
- package/scripts/lib/run-validate.mjs +21 -18
- package/scripts/lib/serve.mjs +472 -0
- package/scripts/postinstall.mjs +63 -0
- package/scripts/setup-enact-context.sh +2 -2
- package/scripts/version-bump.sh +463 -0
- package/spec/codex.json +1 -11
- package/spec/index.json +59 -0
- package/web/assets/README.md +111 -0
- package/web/assets/logo-full.png +0 -0
- package/web/assets/logo-slim.png +0 -0
- package/web/assets/tokens/base.css +45 -0
- package/web/assets/tokens/colors.css +248 -0
- package/web/assets/tokens/effects.css +24 -0
- package/web/assets/tokens/fonts.css +8 -0
- package/web/assets/tokens/index.css +18 -0
- package/web/assets/tokens/spacing.css +50 -0
- package/web/index.html +1188 -0
- package/.agents/plugins/marketplace.json +0 -20
- package/catalog/enact-context.json +0 -9
- package/catalog/enact-factory.json +0 -7
- package/catalog/enact-operator.json +0 -7
- package/catalog/enact-wiki.json +0 -7
- package/catalog/net-revenue-management.json +0 -8
- package/scripts/rename-supervisor-to-operator.pl +0 -66
- package/scripts/sync-manifests.mjs +0 -23
- package/scripts/validate-catalog.mjs +0 -37
- package/scripts/validate-plugin.mjs +0 -10
- /package/{plugins → extensions}/net-revenue-management/.mcp.json +0 -0
- /package/{plugins → extensions}/net-revenue-management/skills/net-revenue-risks/SKILL.md +0 -0
- /package/{plugins → extensions}/net-revenue-management/skills/net-revenue-scenario/SKILL.md +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# enact-context plugin
|
|
2
|
+
|
|
3
|
+
Canonical ENACT-native plugin bundle for `enact-context`.
|
|
4
|
+
|
|
5
|
+
This bundle is the single source of truth under `extensions/enact-context/.agents/plugin.json`.
|
|
6
|
+
`enact-extensions sync`/`install` derives `.claude-plugin`, `.codex-plugin`, and `.cursor-plugin`
|
|
7
|
+
from this file for deployment.
|
|
8
|
+
|
|
9
|
+
## Scope
|
|
10
|
+
|
|
11
|
+
- Targets: `claude`, `codex`, `cursor` only.
|
|
12
|
+
- No other host-specific first-class manifest is included (no Kiro, no extra platform surfaces).
|
|
13
|
+
|
|
14
|
+
## Files
|
|
15
|
+
|
|
16
|
+
- `.agents/plugin.json` — canonical manifest for validation, sync, and install
|
|
17
|
+
- `.mcp.json` — MCP server entry (`enact-context` command)
|
|
18
|
+
- `skills/` — shared `enact-context` skill for Codex/Claude/Cursor
|
|
19
|
+
- `assets/` — plugin icon and logo assets
|
|
20
|
+
- `skills/enact-context/scripts/install.sh` — optional install helper from the SKILL docs
|
|
21
|
+
|
|
22
|
+
## Canonical Install Path
|
|
23
|
+
|
|
24
|
+
The canonical install entrypoint is `extensions/enact-context/.agents/plugin.json`.
|
|
25
|
+
Host surfaces are generated by tooling and kept derived from that canonical source.
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"SessionStart": [
|
|
4
|
+
{
|
|
5
|
+
"matcher": "startup|resume|clear",
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "enact-context hook session-start",
|
|
10
|
+
"statusMessage": "Loading enact-context workspace memory",
|
|
11
|
+
"timeout": 15
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"UserPromptSubmit": [
|
|
17
|
+
{
|
|
18
|
+
"hooks": [
|
|
19
|
+
{
|
|
20
|
+
"type": "command",
|
|
21
|
+
"command": "enact-context hook observe"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"PreToolUse": [
|
|
27
|
+
{
|
|
28
|
+
"matcher": "Bash",
|
|
29
|
+
"hooks": [
|
|
30
|
+
{
|
|
31
|
+
"type": "command",
|
|
32
|
+
"command": "enact-context hook pre-tool-use",
|
|
33
|
+
"statusMessage": "enact-context shell policy"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"PostToolUse": [
|
|
39
|
+
{
|
|
40
|
+
"hooks": [
|
|
41
|
+
{
|
|
42
|
+
"type": "command",
|
|
43
|
+
"command": "enact-context hook observe"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"Stop": [
|
|
49
|
+
{
|
|
50
|
+
"hooks": [
|
|
51
|
+
{
|
|
52
|
+
"type": "command",
|
|
53
|
+
"command": "enact-context hook observe"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"PreCompact": [
|
|
59
|
+
{
|
|
60
|
+
"hooks": [
|
|
61
|
+
{
|
|
62
|
+
"type": "command",
|
|
63
|
+
"command": "enact-context hook session-end"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"hooks": [
|
|
69
|
+
{
|
|
70
|
+
"type": "command",
|
|
71
|
+
"command": "enact-context hook observe"
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"SessionEnd": [
|
|
77
|
+
{
|
|
78
|
+
"hooks": [
|
|
79
|
+
{
|
|
80
|
+
"type": "command",
|
|
81
|
+
"command": "enact-context hook session-end"
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"hooks": [
|
|
87
|
+
{
|
|
88
|
+
"type": "command",
|
|
89
|
+
"command": "enact-context hook observe"
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"SubagentStart": [
|
|
95
|
+
{
|
|
96
|
+
"hooks": [
|
|
97
|
+
{
|
|
98
|
+
"type": "command",
|
|
99
|
+
"command": "enact-context hook subagent-start"
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"SubagentStop": [
|
|
105
|
+
{
|
|
106
|
+
"hooks": [
|
|
107
|
+
{
|
|
108
|
+
"type": "command",
|
|
109
|
+
"command": "enact-context hook subagent-stop"
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: enact-context
|
|
3
|
+
description: Context Runtime for AI Agents — 63 MCP tools, 10 read modes, 90+ shell patterns, tree-sitter AST for 18 languages. Compresses LLM context by up to 99%. Use when reading files, running shell commands, searching code, or exploring directories. Auto-installs if not present.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Enact Context — Context Runtime for AI Agents
|
|
7
|
+
|
|
8
|
+
Enact Context optimizes LLM context through 63 MCP tools, 90+ shell compression patterns, and tree-sitter AST parsing for 18 languages. It provides adaptive file reading, cross-session memory (CCP), task-conditioned relevance scoring, and a feedback loop for learning optimal compression.
|
|
9
|
+
|
|
10
|
+
## Setup (run first)
|
|
11
|
+
|
|
12
|
+
Before using enact-context, verify it is installed:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
which enact-context || bash scripts/install.sh
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If the install script is not available locally, install manually:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
curl -fsSL https://amsterdamdatalabs.com/install.sh | sh
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
After installation, configure the MCP server:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
enact-context init --global
|
|
28
|
+
enact-context doctor --fix
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## When to use enact-context
|
|
32
|
+
|
|
33
|
+
Always prefer `enact-context -c <command>` over running commands directly when:
|
|
34
|
+
- The command produces verbose output (build logs, git diffs, dependency trees, test results)
|
|
35
|
+
- You are reading files and only need the structure or API surface
|
|
36
|
+
- You want to check token savings for the current session
|
|
37
|
+
|
|
38
|
+
## Shell commands (use instead of raw exec)
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
enact-context -c git status # Compressed git output
|
|
42
|
+
enact-context -c git diff # Only meaningful diff lines
|
|
43
|
+
enact-context -c git log --oneline -10
|
|
44
|
+
enact-context -c npm install # Strips progress bars, noise
|
|
45
|
+
enact-context -c cargo build
|
|
46
|
+
enact-context -c cargo test
|
|
47
|
+
enact-context -c docker ps
|
|
48
|
+
enact-context -c kubectl get pods
|
|
49
|
+
enact-context -c aws ec2 describe-instances
|
|
50
|
+
enact-context -c helm list
|
|
51
|
+
enact-context -c prisma migrate dev
|
|
52
|
+
enact-context -c curl -s <url> # JSON schema extraction
|
|
53
|
+
enact-context -c ls -la <dir> # Grouped directory listing
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Supported: git, npm, pnpm, yarn, bun, deno, cargo, docker, kubectl, helm, gh, pip, ruff, go, eslint, prettier, tsc, aws, psql, mysql, prisma, swift, zig, cmake, ansible, composer, mix, bazel, systemd, terraform, make, maven, dotnet, flutter, poetry, rubocop, playwright, curl, wget, and more.
|
|
57
|
+
|
|
58
|
+
## File reading (compressed modes)
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
enact-context read <file> # Full content with structured header
|
|
62
|
+
enact-context read <file> -m map # Dependency graph + exports + API (~5-15% tokens)
|
|
63
|
+
enact-context read <file> -m signatures # Function/class signatures only (~10-20% tokens)
|
|
64
|
+
enact-context read <file> -m aggressive # Syntax-stripped (~30-50% tokens)
|
|
65
|
+
enact-context read <file> -m entropy # Shannon entropy filtered (~20-40% tokens)
|
|
66
|
+
enact-context read <file> -m diff # Only changed lines since last read
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Use `map` mode when you need to understand what a file does without reading every line.
|
|
70
|
+
Use `signatures` mode when you need the API surface of a module (tree-sitter for 18 languages).
|
|
71
|
+
Use `full` mode only when you will edit the file.
|
|
72
|
+
|
|
73
|
+
## AI Tool Integration
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
enact-context init --global # Install shell aliases
|
|
77
|
+
enact-context init --agent claude # Claude Code PreToolUse hook
|
|
78
|
+
enact-context init --agent cursor # Cursor hooks.json
|
|
79
|
+
enact-context init --agent gemini # Gemini CLI BeforeTool hook
|
|
80
|
+
enact-context init --agent codex # Codex AGENTS.md
|
|
81
|
+
enact-context init --agent windsurf # .windsurfrules
|
|
82
|
+
enact-context init --agent cline # .clinerules
|
|
83
|
+
enact-context init --agent crush # Crush MCP config
|
|
84
|
+
enact-context init --agent copilot # VS Code / Copilot .vscode/mcp.json
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Multi-Agent & Knowledge
|
|
88
|
+
|
|
89
|
+
MCP tools:
|
|
90
|
+
- `ctx_knowledge(action="remember", category, key, value)` — persistent cross-session project knowledge store
|
|
91
|
+
- `ctx_knowledge(action="recall", query)` — search stored facts by text or category
|
|
92
|
+
- `ctx_knowledge(action="consolidate")` — extract session findings into permanent knowledge
|
|
93
|
+
- `ctx_agent(action="register", agent_type, role)` — multi-agent context sharing with scratchpad messaging
|
|
94
|
+
- `ctx_agent(action="post", message, tags)` — share findings/warnings between concurrent agents
|
|
95
|
+
- `ctx_agent(action="read")` — read messages from other agents
|
|
96
|
+
- `ctx_agent(action="handoff", to_agent, message)` — transfer task to another agent
|
|
97
|
+
- `ctx_agent(action="sync")` — multi-agent sync status (active agents, pending messages, shared contexts)
|
|
98
|
+
- `ctx_share(action="push", paths, to_agent, message)` — push cached file contexts to another agent
|
|
99
|
+
- `ctx_share(action="pull")` — pull shared contexts from other agents
|
|
100
|
+
- `ctx_share(action="list")` — list all shared contexts
|
|
101
|
+
- `ctx_share(action="clear")` — remove contexts shared by this agent
|
|
102
|
+
|
|
103
|
+
## Additional Intelligence Tools
|
|
104
|
+
|
|
105
|
+
- `ctx_edit(path, old_string, new_string)` — search-and-replace file editing without native Read/Edit
|
|
106
|
+
- `ctx_overview(task)` — task-relevant project map at session start
|
|
107
|
+
- `ctx_preload(task)` — proactive context loader, caches task-relevant files
|
|
108
|
+
- `ctx_semantic_search(query)` — BM25 code search by meaning across the project
|
|
109
|
+
- `ctx_intent` now supports multi-intent detection and complexity classification
|
|
110
|
+
- Semantic cache: TF-IDF + cosine similarity for finding similar files across reads
|
|
111
|
+
|
|
112
|
+
## Session Continuity (CCP)
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
enact-context sessions list # List all CCP sessions
|
|
116
|
+
enact-context sessions show # Show latest session state
|
|
117
|
+
enact-context gain --wrapped # Weekly savings report card
|
|
118
|
+
enact-context gain --wrapped --period=month # Monthly savings report card
|
|
119
|
+
enact-context benchmark run # Real project benchmark (terminal output)
|
|
120
|
+
enact-context benchmark run --json # Machine-readable JSON output
|
|
121
|
+
enact-context benchmark report # Shareable Markdown report
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
MCP tools for CCP:
|
|
125
|
+
- `ctx_session status` — show current session state (~400 tokens)
|
|
126
|
+
- `ctx_session load` — restore previous session (cross-chat memory)
|
|
127
|
+
- `ctx_session task "description"` — set current task
|
|
128
|
+
- `ctx_session finding "file:line — summary"` — record key finding
|
|
129
|
+
- `ctx_session decision "summary"` — record architectural decision
|
|
130
|
+
- `ctx_session save` — force persist session to disk
|
|
131
|
+
- `ctx_gain(action="wrapped")` — generate savings report card in chat
|
|
132
|
+
|
|
133
|
+
## Analytics
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
enact-context gain # Visual token savings dashboard
|
|
137
|
+
enact-context dashboard # Web dashboard at localhost:43205
|
|
138
|
+
enact-context session # Adoption statistics
|
|
139
|
+
enact-context discover # Find uncompressed commands in shell history
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Tips
|
|
143
|
+
|
|
144
|
+
- The output suffix `[enact-context: 5029→197 tok, -96%]` shows original vs compressed token count
|
|
145
|
+
- For large outputs, enact-context automatically truncates while preserving relevant context
|
|
146
|
+
- JSON responses from curl/wget are reduced to schema outlines
|
|
147
|
+
- Build errors are grouped by type with counts
|
|
148
|
+
- Test results show only failures with summary counts
|
|
149
|
+
- Cached re-reads cost only ~13 tokens
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
INSTALL_DIR="${HOME}/.local/bin"
|
|
5
|
+
|
|
6
|
+
already_installed() {
|
|
7
|
+
command -v enact-context >/dev/null 2>&1
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
detect_platform() {
|
|
11
|
+
local os arch
|
|
12
|
+
os="$(uname -s)"
|
|
13
|
+
arch="$(uname -m)"
|
|
14
|
+
|
|
15
|
+
case "$os" in
|
|
16
|
+
Darwin) os="apple-darwin" ;;
|
|
17
|
+
Linux) os="unknown-linux-musl" ;;
|
|
18
|
+
*) echo "ERROR: unsupported OS: $os" >&2; exit 1 ;;
|
|
19
|
+
esac
|
|
20
|
+
|
|
21
|
+
case "$arch" in
|
|
22
|
+
x86_64|amd64) arch="x86_64" ;;
|
|
23
|
+
arm64|aarch64) arch="aarch64" ;;
|
|
24
|
+
*) echo "ERROR: unsupported arch: $arch" >&2; exit 1 ;;
|
|
25
|
+
esac
|
|
26
|
+
|
|
27
|
+
echo "${arch}-${os}"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
install_binary() {
|
|
31
|
+
local platform="$1"
|
|
32
|
+
echo "Installing enact-context for ${platform} via the Amsterdam Data Labs installer..."
|
|
33
|
+
curl -fsSL "https://amsterdamdatalabs.com/install.sh" | sh
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
ensure_path() {
|
|
37
|
+
case ":${PATH}:" in
|
|
38
|
+
*":${INSTALL_DIR}:"*) ;;
|
|
39
|
+
*) export PATH="${INSTALL_DIR}:${PATH}"
|
|
40
|
+
echo "Added ${INSTALL_DIR} to PATH for this session."
|
|
41
|
+
echo "Add to your shell profile: export PATH=\"${INSTALL_DIR}:\$PATH\""
|
|
42
|
+
;;
|
|
43
|
+
esac
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
setup_mcp() {
|
|
47
|
+
echo "Configuring enact-context MCP server..."
|
|
48
|
+
enact-context init --global 2>/dev/null || true
|
|
49
|
+
enact-context doctor --fix 2>/dev/null || true
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
main() {
|
|
53
|
+
if already_installed; then
|
|
54
|
+
local current
|
|
55
|
+
current="$(enact-context --version 2>/dev/null | head -1 || echo 'unknown')"
|
|
56
|
+
echo "enact-context already installed: ${current}"
|
|
57
|
+
echo "Run 'enact-context doctor' to verify configuration."
|
|
58
|
+
exit 0
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
local platform
|
|
62
|
+
platform="$(detect_platform)"
|
|
63
|
+
install_binary "$platform"
|
|
64
|
+
ensure_path
|
|
65
|
+
setup_mcp
|
|
66
|
+
echo "enact-context installed and configured."
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
main "$@"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "enact-factory",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Enact Factory governance plugin — MCP server registration and factory-facing workflow tools.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "amsterdamdatalabs"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://amsterdamdatalabs.com",
|
|
9
|
+
"repository": "https://dev.azure.com/amsterdamdatalabs/enact/_git/enact-os",
|
|
10
|
+
"license": "UNLICENSED",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"enact-factory",
|
|
13
|
+
"governance",
|
|
14
|
+
"workitem",
|
|
15
|
+
"pipeline",
|
|
16
|
+
"mcp"
|
|
17
|
+
],
|
|
18
|
+
"targets": [
|
|
19
|
+
"claude",
|
|
20
|
+
"codex",
|
|
21
|
+
"cursor"
|
|
22
|
+
],
|
|
23
|
+
"mcpServers": "./.mcp.json",
|
|
24
|
+
"interface": {
|
|
25
|
+
"displayName": "Enact Factory",
|
|
26
|
+
"shortDescription": "Factory MCP server and governance skills for pipeline and WorkItem management.",
|
|
27
|
+
"longDescription": "Registers the enact-factory MCP server and exposes governance-facing workflow skills for pipeline orchestration and WorkItem tracking.",
|
|
28
|
+
"developerName": "amsterdamdatalabs",
|
|
29
|
+
"category": "Developer Tools",
|
|
30
|
+
"composerIcon": "./assets/icon.png",
|
|
31
|
+
"logo": "./assets/logo.png",
|
|
32
|
+
"capabilities": [
|
|
33
|
+
"mcp tools",
|
|
34
|
+
"workitem management",
|
|
35
|
+
"pipeline governance"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"factory": {
|
|
39
|
+
"firstParty": true,
|
|
40
|
+
"operatorScope": "global"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
4
|
+
|
|
5
|
+
function readStdin() {
|
|
6
|
+
try {
|
|
7
|
+
return JSON.parse(readFileSync(0, "utf8") || "{}");
|
|
8
|
+
} catch {
|
|
9
|
+
return {};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function findWorkspaceRoot() {
|
|
14
|
+
let current = resolve(process.cwd());
|
|
15
|
+
while (true) {
|
|
16
|
+
if (existsSync(join(current, "config.toml"))) {
|
|
17
|
+
return current;
|
|
18
|
+
}
|
|
19
|
+
const parent = dirname(current);
|
|
20
|
+
if (parent === current) {
|
|
21
|
+
throw new Error(`Workspace config.toml not found while walking up from ${process.cwd()}`);
|
|
22
|
+
}
|
|
23
|
+
current = parent;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function expandPath(raw, sourceDir) {
|
|
28
|
+
const trimmed = raw.trim();
|
|
29
|
+
if (trimmed === "~") return process.env.HOME ?? trimmed;
|
|
30
|
+
if (trimmed.startsWith("~/")) return join(process.env.HOME ?? "", trimmed.slice(2));
|
|
31
|
+
if (isAbsolute(trimmed)) return trimmed;
|
|
32
|
+
return resolve(sourceDir, trimmed);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function readFactoryStorage(root) {
|
|
36
|
+
const configPath = join(root, "config.toml");
|
|
37
|
+
const raw = readFileSync(configPath, "utf8");
|
|
38
|
+
const match = raw.match(/^\[factory\][\s\S]*?^\s*storage\s*=\s*"([^"]+)"/m);
|
|
39
|
+
if (!match?.[1]) {
|
|
40
|
+
throw new Error(`Missing [factory].storage in ${configPath}`);
|
|
41
|
+
}
|
|
42
|
+
return expandPath(match[1], root);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function writeJson(path, data) {
|
|
46
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
47
|
+
writeFileSync(path, `${JSON.stringify(data, null, 2)}\n`, "utf8");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const payload = readStdin();
|
|
51
|
+
const prompt = payload?.prompt ?? payload?.user_prompt ?? payload?.input ?? payload?.message ?? "";
|
|
52
|
+
if (typeof prompt !== "string") {
|
|
53
|
+
process.exit(0);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const normalized = prompt.toLowerCase();
|
|
57
|
+
if (!normalized.includes("$workitem-triage") && !normalized.includes("$enact-factory:workitem-triage")) {
|
|
58
|
+
process.exit(0);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const root = findWorkspaceRoot();
|
|
62
|
+
const factoryStorage = readFactoryStorage(root);
|
|
63
|
+
writeJson(join(factoryStorage, "state", "factory-active-skill.json"), {
|
|
64
|
+
activeSkill: "workitem-triage",
|
|
65
|
+
activatedAt: new Date().toISOString(),
|
|
66
|
+
activatedBy: "factory-hook-user-prompt-submit",
|
|
67
|
+
});
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: testing-strategy
|
|
3
|
+
description: >
|
|
4
|
+
Defines when and how to write tests in the enact-gateway codebase. Trigger
|
|
5
|
+
keywords: testing, write a test, TDD, bug fix, regression test, live test,
|
|
6
|
+
e2e, integration test, test harness, evidence, red-green, scenario, validate.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# testing-strategy
|
|
10
|
+
|
|
11
|
+
## Purpose
|
|
12
|
+
|
|
13
|
+
Enforce a consistent, lightweight approach across the three testing modes used
|
|
14
|
+
in `enact-gateway`. The mode is determined by the behavior under test — not by
|
|
15
|
+
preference. Pick once, follow the contract for that mode.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Decision Rule
|
|
20
|
+
|
|
21
|
+
| Situation | Mode |
|
|
22
|
+
|-----------|------|
|
|
23
|
+
| Pure function or isolated logic | Mode 0 — plain unit test |
|
|
24
|
+
| Bug fix (any scope) | Mode 1 — TDD + `_evidence` |
|
|
25
|
+
| Bug fix where behavior is runtime / live / cross-service (gateway → observe / iggy / questdb) | Mode 1 RED→GREEN + the regression test is a Mode-2 harness scenario |
|
|
26
|
+
| New live-provider, cross-service, or e2e behavior | Mode 2 — harness scenario under `tests/integration/` or `tests/e2e/` |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Mode 0 — Plain Unit Tests
|
|
31
|
+
|
|
32
|
+
Use for: pure functions, simple transformations, isolated module logic.
|
|
33
|
+
|
|
34
|
+
- File location: co-located with the source file, e.g. `src/foo/bar.spec.ts`.
|
|
35
|
+
- Stack: Jest + ts-jest (resolved from `packages/backend`).
|
|
36
|
+
- No harness ceremony. No fixtures directory. No `output/` directory.
|
|
37
|
+
- Run: `npm run test --workspace=packages/backend` (or `npx jest <pattern>`).
|
|
38
|
+
|
|
39
|
+
Do NOT force the harness onto plain unit tests. Co-located `.spec.ts` is
|
|
40
|
+
sufficient and preferred.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Mode 1 — Bug Fix: TDD with Captured `_evidence`
|
|
45
|
+
|
|
46
|
+
### Contract
|
|
47
|
+
|
|
48
|
+
1. **RED** — write a failing test that reproduces the bug before touching
|
|
49
|
+
implementation code. Capture the failure output:
|
|
50
|
+
```
|
|
51
|
+
_evidence/<scenario>/red.txt
|
|
52
|
+
```
|
|
53
|
+
2. **Fix** — implement the minimal change that makes the test pass.
|
|
54
|
+
3. **GREEN** — capture the passing output:
|
|
55
|
+
```
|
|
56
|
+
_evidence/<scenario>/green.txt
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`_evidence/` is **gitignored** — it is local proof, never committed source.
|
|
60
|
+
|
|
61
|
+
### Regression test placement
|
|
62
|
+
|
|
63
|
+
- If the bug is in pure/isolated logic, a co-located `.spec.ts` is sufficient.
|
|
64
|
+
- If the bug involves runtime behavior — real provider calls, streaming,
|
|
65
|
+
cross-service interaction (gateway → observe / iggy / questdb) — the
|
|
66
|
+
regression test **must** be a Mode-2 harness scenario, not an ad-hoc script.
|
|
67
|
+
|
|
68
|
+
### AzDO closure gate
|
|
69
|
+
|
|
70
|
+
A bug work item in Azure DevOps (area `Enact\<leaf>`) must not be closed until:
|
|
71
|
+
- A regression test exists (either `.spec.ts` or harness scenario).
|
|
72
|
+
- `_evidence/<scenario>/red.txt` and `green.txt` are present locally.
|
|
73
|
+
- The AzDO "Tests passing" Build boolean is green.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Mode 2 — Live / Integration Test Harness
|
|
78
|
+
|
|
79
|
+
### Directory layout
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
tests/
|
|
83
|
+
integration/<scenario>/ # harness scenarios (non-billable, require a live gateway)
|
|
84
|
+
fixtures/
|
|
85
|
+
input.json # request body POSTed to the gateway
|
|
86
|
+
run.py (or run.ts) # sends the request, writes output/<timestamp>.json
|
|
87
|
+
validate.py (or validate.ts) # reads latest output, prints PASS:/FAIL: per check
|
|
88
|
+
output/ # gitignored; populated by run.py
|
|
89
|
+
e2e/ # live, billable suites — OPT-IN only
|
|
90
|
+
<suite>.e2e-spec.ts # Jest spec; skipped unless ENACT_LIVE_PROVIDER_TESTS=1
|
|
91
|
+
<scenario>/ # standalone scenario dirs (same run.py/validate.py shape)
|
|
92
|
+
lib/ # shared harness helpers (import from here, do not duplicate)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
> **Known issue:** `cli.py` currently globs `domains/*/*` but scenarios are
|
|
96
|
+
> now laid out flat at `tests/integration/<scenario>/`. This mismatch is being
|
|
97
|
+
> fixed; do not work around it by restructuring existing scenarios.
|
|
98
|
+
|
|
99
|
+
### Scenario contract
|
|
100
|
+
|
|
101
|
+
**`fixtures/input.json`** — the full JSON request body. Secrets are never
|
|
102
|
+
stored here; only structure.
|
|
103
|
+
|
|
104
|
+
**`run.py`** — self-contained runner:
|
|
105
|
+
- Reads `ENACT_GATEWAY_BASE_URL` (default `http://127.0.0.1:43201`).
|
|
106
|
+
- Reads `ENACT_GATEWAY_API_KEY` or `GATEWAY_API_KEY` for the bearer token.
|
|
107
|
+
If absent, writes `status: "skip"` and exits 0 — no tokens spent.
|
|
108
|
+
- Reads `ENACT_GATEWAY_TIMEOUT_SECS` (default `30`).
|
|
109
|
+
- POSTs `fixtures/input.json` to `<base_url>/v1/responses`.
|
|
110
|
+
- Writes `output/<YYYYMMDDTHHmmss>.json` with one of:
|
|
111
|
+
- `{"status": "ok", "http_status": 200, "response_body": {...}, ...}`
|
|
112
|
+
- `{"status": "http_error", "http_status": <N>, "reason": "...", ...}`
|
|
113
|
+
- `{"status": "skip", "reason": "...", ...}`
|
|
114
|
+
- Prints the output path and exits 0 (even for `http_error` — validate decides).
|
|
115
|
+
|
|
116
|
+
**`validate.py`** — assertion layer:
|
|
117
|
+
- Reads the latest file in `output/` (sort by name, take last).
|
|
118
|
+
- If `status == "skip"`: prints `SKIP: <reason>` and exits 0.
|
|
119
|
+
- If `status != "ok"`: prints `FAIL: ...` and exits 1.
|
|
120
|
+
- For each behavioral check: prints `PASS: <label>` or `FAIL: <label>`.
|
|
121
|
+
- Exits non-zero if any check failed.
|
|
122
|
+
|
|
123
|
+
Secrets are **only ever passed by env-var name**, never committed to fixtures or
|
|
124
|
+
source.
|
|
125
|
+
|
|
126
|
+
### Task runner
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# from tests/integration/
|
|
130
|
+
uv run tasks list # list all discovered scenarios
|
|
131
|
+
uv run tasks run <scenario> # run + validate
|
|
132
|
+
uv run tasks run <scenario> --run-only # skip validate
|
|
133
|
+
uv run tasks run <scenario> --validate-only # skip run (re-validate last output)
|
|
134
|
+
uv run tasks run --all # run every scenario
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Live / billable suites (`tests/e2e/`)
|
|
138
|
+
|
|
139
|
+
Live tests make **real, billable upstream calls**. They are OPT-IN and skipped
|
|
140
|
+
in all normal / CI runs unless the flag is set explicitly:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# from packages/backend
|
|
144
|
+
ENACT_LIVE_PROVIDER_TESTS=1 \
|
|
145
|
+
LIVE_GATEWAY_URL=http://127.0.0.1:43201 \
|
|
146
|
+
LIVE_KEY_ENACT_CODING=engw_... \
|
|
147
|
+
LIVE_KEY_OPENCODE_GO=engw_... \
|
|
148
|
+
LIVE_KEY_NANOGPT=engw_... \
|
|
149
|
+
LIVE_KEY_OPENROUTER=engw_... \
|
|
150
|
+
npx jest --config ../../tests/e2e/jest-e2e.json --runInBand
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Each `describe` block gates on its own key env-var, so individual profiles can
|
|
154
|
+
be run in isolation by omitting the others.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Output / Definition of Done
|
|
159
|
+
|
|
160
|
+
A test is complete when:
|
|
161
|
+
|
|
162
|
+
| Mode | Done when |
|
|
163
|
+
|------|-----------|
|
|
164
|
+
| Mode 0 | `npx jest <file>` exits 0; coverage covers the changed logic |
|
|
165
|
+
| Mode 1 | `_evidence/<scenario>/red.txt` captured before fix; `green.txt` captured after; regression test in place |
|
|
166
|
+
| Mode 2 — harness | `uv run tasks run <scenario>` exits 0 with all `PASS:` lines printed; or `SKIP:` when key absent (acceptable in CI) |
|
|
167
|
+
| Mode 2 — live suite | Suite exits 0 under `ENACT_LIVE_PROVIDER_TESTS=1` with a live gateway; CI skips without the flag |
|