persona-harness 0.13.0 → 1.1.0
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/CHANGELOG.md +27 -0
- package/README.md +20 -13
- package/dist/cli/agents-contract.js +4 -0
- package/dist/cli/agents-contract.js.map +1 -1
- package/dist/cli/context-checkout-binding.d.ts +31 -0
- package/dist/cli/context-checkout-binding.js +170 -0
- package/dist/cli/context-checkout-binding.js.map +1 -0
- package/dist/cli/context-command.js +13 -2
- package/dist/cli/context-command.js.map +1 -1
- package/dist/cli/context-personalization.d.ts +15 -0
- package/dist/cli/context-personalization.js +51 -0
- package/dist/cli/context-personalization.js.map +1 -0
- package/dist/cli/context-preview.d.ts +2 -1
- package/dist/cli/context-preview.js +40 -32
- package/dist/cli/context-preview.js.map +1 -1
- package/dist/cli/context-scope-command.d.ts +6 -0
- package/dist/cli/context-scope-command.js +37 -0
- package/dist/cli/context-scope-command.js.map +1 -0
- package/dist/cli/context-task-command.d.ts +6 -0
- package/dist/cli/context-task-command.js +51 -0
- package/dist/cli/context-task-command.js.map +1 -0
- package/dist/cli/cooperative-finish-context.js +3 -6
- package/dist/cli/cooperative-finish-context.js.map +1 -1
- package/dist/cli/host-plugin-context-assets.d.ts +2 -0
- package/dist/cli/host-plugin-context-assets.js +35 -0
- package/dist/cli/host-plugin-context-assets.js.map +1 -0
- package/dist/cli/host-plugin-distribution.js +8 -4
- package/dist/cli/host-plugin-distribution.js.map +1 -1
- package/dist/cli/host-plugin-reference-assets.d.ts +2 -0
- package/dist/cli/host-plugin-reference-assets.js +36 -0
- package/dist/cli/host-plugin-reference-assets.js.map +1 -0
- package/dist/cli/host-skill-materializer.js +3 -0
- package/dist/cli/host-skill-materializer.js.map +1 -1
- package/dist/cli/personalization-file-boundary.d.ts +16 -0
- package/dist/cli/personalization-file-boundary.js +106 -0
- package/dist/cli/personalization-file-boundary.js.map +1 -0
- package/dist/cli/personalization-profile-store.d.ts +2 -16
- package/dist/cli/personalization-profile-store.js +82 -232
- package/dist/cli/personalization-profile-store.js.map +1 -1
- package/dist/cli/personalization-store-io.d.ts +25 -0
- package/dist/cli/personalization-store-io.js +144 -0
- package/dist/cli/personalization-store-io.js.map +1 -0
- package/dist/cli/project-auto-update.d.ts +1 -1
- package/dist/cli/project-auto-update.js +3 -0
- package/dist/cli/project-auto-update.js.map +1 -1
- package/dist/config/harness-config.js +14 -7
- package/dist/config/harness-config.js.map +1 -1
- package/dist/context-core/context-envelope-builder.js +2 -1
- package/dist/context-core/context-envelope-builder.js.map +1 -1
- package/dist/context-core/context-renderer.d.ts +4 -0
- package/dist/context-core/context-renderer.js +11 -0
- package/dist/context-core/context-renderer.js.map +1 -0
- package/dist/context-delivery/context-delivery-store.d.ts +13 -9
- package/dist/context-delivery/context-delivery-store.js +18 -43
- package/dist/context-delivery/context-delivery-store.js.map +1 -1
- package/dist/context-delivery/context-target-selection.d.ts +21 -0
- package/dist/context-delivery/context-target-selection.js +79 -0
- package/dist/context-delivery/context-target-selection.js.map +1 -0
- package/dist/context-delivery/context-tool-targets.d.ts +11 -0
- package/dist/context-delivery/context-tool-targets.js +57 -0
- package/dist/context-delivery/context-tool-targets.js.map +1 -0
- package/dist/context-delivery/opencode-context-hooks.d.ts +11 -1
- package/dist/context-delivery/opencode-context-hooks.js +38 -53
- package/dist/context-delivery/opencode-context-hooks.js.map +1 -1
- package/dist/context-delivery/portable-context-hook.d.ts +26 -0
- package/dist/context-delivery/portable-context-hook.js +60 -0
- package/dist/context-delivery/portable-context-hook.js.map +1 -0
- package/dist/context-delivery/portable-context-main.d.ts +1 -0
- package/dist/context-delivery/portable-context-main.js +46 -0
- package/dist/context-delivery/portable-context-main.js.map +1 -0
- package/dist/context-delivery/portable-context-runtime.mjs +2917 -0
- package/dist/context-delivery/portable-context-session.d.ts +2 -0
- package/dist/context-delivery/portable-context-session.js +70 -0
- package/dist/context-delivery/portable-context-session.js.map +1 -0
- package/dist/context-delivery/portable-context-setup.d.ts +1 -0
- package/dist/context-delivery/portable-context-setup.js +59 -0
- package/dist/context-delivery/portable-context-setup.js.map +1 -0
- package/dist/context-delivery/portable-context-setup.mjs +3568 -0
- package/dist/io/no-follow-directory-chain.d.ts +1 -1
- package/dist/io/no-follow-directory-chain.js +46 -13
- package/dist/io/no-follow-directory-chain.js.map +1 -1
- package/dist/runtime/opencode-skill-adapter.js +2 -0
- package/dist/runtime/opencode-skill-adapter.js.map +1 -1
- package/dist/runtime/skill-execution-guidance.d.ts +2 -0
- package/dist/runtime/skill-execution-guidance.js +15 -0
- package/dist/runtime/skill-execution-guidance.js.map +1 -0
- package/dist/runtime/system-constitution.js +7 -5
- package/dist/runtime/system-constitution.js.map +1 -1
- package/docs/current/README.md +2 -0
- package/docs/current/astra-migration-guide.ko.md +158 -0
- package/docs/current/context-program-status.md +22 -0
- package/docs/current/personalization-profile-v1.md +118 -0
- package/docs/current/portable-host-adapters.md +111 -3
- package/docs/current/release/consumer-authority-current-acceptance.json +1 -1
- package/docs/current/release/v1.0.0-release-notes.md +49 -0
- package/docs/current/release/v1.1.0-release-notes.md +82 -0
- package/docs/releases/package-index.md +2 -1
- package/package.json +8 -3
- package/packages/host-plugins/antigravity/skills/ast-grep/SKILL.md +15 -1
- package/packages/host-plugins/antigravity/skills/debug/SKILL.md +15 -1
- package/packages/host-plugins/antigravity/skills/deep-interview/SKILL.md +68 -26
- package/packages/host-plugins/antigravity/skills/frontend/SKILL.md +15 -1
- package/packages/host-plugins/antigravity/skills/git/SKILL.md +15 -1
- package/packages/host-plugins/antigravity/skills/grill-me/SKILL.md +15 -1
- package/packages/host-plugins/antigravity/skills/implementation/SKILL.md +23 -6
- package/packages/host-plugins/antigravity/skills/lsp-setup/SKILL.md +15 -1
- package/packages/host-plugins/antigravity/skills/philosophy-refinement/SKILL.md +31 -6
- package/packages/host-plugins/antigravity/skills/philosophy-refinement/references/persistence.md +89 -0
- package/packages/host-plugins/antigravity/skills/plan/SKILL.md +15 -1
- package/packages/host-plugins/antigravity/skills/programming/SKILL.md +45 -6
- package/packages/host-plugins/antigravity/skills/programming/references/java/README.md +211 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/anti-patterns.md +85 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/application-layer.md +200 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/architecture.md +152 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/backend.md +158 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/code-quality-refactoring.md +146 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/concurrency-discipline.md +98 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/domain-model.md +214 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/error-handling.md +179 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/foundations.md +49 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/java-idioms.md +108 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/language-core.md +96 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/method-and-naming.md +164 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/object-collaboration.md +140 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/performance-discipline.md +115 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/repository-pattern.md +181 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/technology-seams.md +96 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/test-design.md +149 -0
- package/packages/host-plugins/antigravity/skills/programming/references/java/testing.md +194 -0
- package/packages/host-plugins/antigravity/skills/programming/scripts/java/check-no-excuse-rules.sh +193 -0
- package/packages/host-plugins/antigravity/skills/ralplan/SKILL.md +15 -1
- package/packages/host-plugins/antigravity/skills/refactor/SKILL.md +15 -1
- package/packages/host-plugins/antigravity/skills/review/SKILL.md +20 -3
- package/packages/host-plugins/antigravity/skills/tdd/SKILL.md +15 -1
- package/packages/host-plugins/antigravity/skills/technical-intake/SKILL.md +27 -6
- package/packages/host-plugins/antigravity/skills/visual-qa/SKILL.md +15 -1
- package/packages/host-plugins/claude/.claude-plugin/plugin.json +2 -2
- package/packages/host-plugins/claude/hooks/hooks.json +27 -0
- package/packages/host-plugins/claude/scripts/context-runtime.mjs +2917 -0
- package/packages/host-plugins/claude/scripts/context-setup.mjs +3568 -0
- package/packages/host-plugins/claude/skills/ast-grep/SKILL.md +15 -1
- package/packages/host-plugins/claude/skills/debug/SKILL.md +15 -1
- package/packages/host-plugins/claude/skills/deep-interview/SKILL.md +68 -26
- package/packages/host-plugins/claude/skills/frontend/SKILL.md +15 -1
- package/packages/host-plugins/claude/skills/git/SKILL.md +15 -1
- package/packages/host-plugins/claude/skills/grill-me/SKILL.md +15 -1
- package/packages/host-plugins/claude/skills/implementation/SKILL.md +23 -6
- package/packages/host-plugins/claude/skills/lsp-setup/SKILL.md +15 -1
- package/packages/host-plugins/claude/skills/philosophy-refinement/SKILL.md +31 -6
- package/packages/host-plugins/claude/skills/philosophy-refinement/references/persistence.md +89 -0
- package/packages/host-plugins/claude/skills/plan/SKILL.md +15 -1
- package/packages/host-plugins/claude/skills/programming/SKILL.md +45 -6
- package/packages/host-plugins/claude/skills/programming/references/java/README.md +211 -0
- package/packages/host-plugins/claude/skills/programming/references/java/anti-patterns.md +85 -0
- package/packages/host-plugins/claude/skills/programming/references/java/application-layer.md +200 -0
- package/packages/host-plugins/claude/skills/programming/references/java/architecture.md +152 -0
- package/packages/host-plugins/claude/skills/programming/references/java/backend.md +158 -0
- package/packages/host-plugins/claude/skills/programming/references/java/code-quality-refactoring.md +146 -0
- package/packages/host-plugins/claude/skills/programming/references/java/concurrency-discipline.md +98 -0
- package/packages/host-plugins/claude/skills/programming/references/java/domain-model.md +214 -0
- package/packages/host-plugins/claude/skills/programming/references/java/error-handling.md +179 -0
- package/packages/host-plugins/claude/skills/programming/references/java/foundations.md +49 -0
- package/packages/host-plugins/claude/skills/programming/references/java/java-idioms.md +108 -0
- package/packages/host-plugins/claude/skills/programming/references/java/language-core.md +96 -0
- package/packages/host-plugins/claude/skills/programming/references/java/method-and-naming.md +164 -0
- package/packages/host-plugins/claude/skills/programming/references/java/object-collaboration.md +140 -0
- package/packages/host-plugins/claude/skills/programming/references/java/performance-discipline.md +115 -0
- package/packages/host-plugins/claude/skills/programming/references/java/repository-pattern.md +181 -0
- package/packages/host-plugins/claude/skills/programming/references/java/technology-seams.md +96 -0
- package/packages/host-plugins/claude/skills/programming/references/java/test-design.md +149 -0
- package/packages/host-plugins/claude/skills/programming/references/java/testing.md +194 -0
- package/packages/host-plugins/claude/skills/programming/scripts/java/check-no-excuse-rules.sh +193 -0
- package/packages/host-plugins/claude/skills/ralplan/SKILL.md +15 -1
- package/packages/host-plugins/claude/skills/refactor/SKILL.md +15 -1
- package/packages/host-plugins/claude/skills/review/SKILL.md +20 -3
- package/packages/host-plugins/claude/skills/tdd/SKILL.md +15 -1
- package/packages/host-plugins/claude/skills/technical-intake/SKILL.md +27 -6
- package/packages/host-plugins/claude/skills/visual-qa/SKILL.md +15 -1
- package/packages/host-plugins/codex/plugins/persona-harness/.codex-plugin/plugin.json +4 -4
- package/packages/host-plugins/codex/plugins/persona-harness/hooks/hooks.json +29 -0
- package/packages/host-plugins/codex/plugins/persona-harness/scripts/context-runtime.mjs +2917 -0
- package/packages/host-plugins/codex/plugins/persona-harness/scripts/context-setup.mjs +3568 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/ast-grep/SKILL.md +15 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/debug/SKILL.md +15 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/deep-interview/SKILL.md +68 -26
- package/packages/host-plugins/codex/plugins/persona-harness/skills/frontend/SKILL.md +15 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/git/SKILL.md +15 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/grill-me/SKILL.md +15 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/implementation/SKILL.md +23 -6
- package/packages/host-plugins/codex/plugins/persona-harness/skills/lsp-setup/SKILL.md +15 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/philosophy-refinement/SKILL.md +31 -6
- package/packages/host-plugins/codex/plugins/persona-harness/skills/philosophy-refinement/references/persistence.md +89 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/plan/SKILL.md +15 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/SKILL.md +45 -6
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/README.md +211 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/anti-patterns.md +85 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/application-layer.md +200 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/architecture.md +152 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/backend.md +158 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/code-quality-refactoring.md +146 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/concurrency-discipline.md +98 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/domain-model.md +214 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/error-handling.md +179 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/foundations.md +49 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/java-idioms.md +108 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/language-core.md +96 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/method-and-naming.md +164 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/object-collaboration.md +140 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/performance-discipline.md +115 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/repository-pattern.md +181 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/technology-seams.md +96 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/test-design.md +149 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/references/java/testing.md +194 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/scripts/java/check-no-excuse-rules.sh +193 -0
- package/packages/host-plugins/codex/plugins/persona-harness/skills/ralplan/SKILL.md +15 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/refactor/SKILL.md +15 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/review/SKILL.md +20 -3
- package/packages/host-plugins/codex/plugins/persona-harness/skills/tdd/SKILL.md +15 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/technical-intake/SKILL.md +27 -6
- package/packages/host-plugins/codex/plugins/persona-harness/skills/visual-qa/SKILL.md +15 -1
- package/packages/shared-skills/package.json +1 -1
- package/packages/shared-skills/skills/deep-interview/SKILL.md +53 -25
- package/packages/shared-skills/skills/implementation/SKILL.md +8 -5
- package/packages/shared-skills/skills/philosophy-refinement/SKILL.md +16 -5
- package/packages/shared-skills/skills/philosophy-refinement/references/persistence.md +89 -0
- package/packages/shared-skills/skills/programming/SKILL.md +30 -5
- package/packages/shared-skills/skills/programming/references/java/README.md +16 -2
- package/packages/shared-skills/skills/programming/references/java/backend.md +1 -1
- package/packages/shared-skills/skills/programming/scripts/java/check-no-excuse-rules.sh +193 -0
- package/packages/shared-skills/skills/review/SKILL.md +5 -2
- package/packages/shared-skills/skills/technical-intake/SKILL.md +12 -5
- package/scripts/build-portable-context.mjs +34 -0
- package/scripts/package-root-build.mjs +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,33 @@ preparation alone does not establish stable support or channel state.
|
|
|
8
8
|
|
|
9
9
|
## Unreleased
|
|
10
10
|
|
|
11
|
+
## [1.1.0] - 2026-09-07
|
|
12
|
+
|
|
13
|
+
- Bundle consent/setup, targeted Context hooks and Java reference/checker assets
|
|
14
|
+
in the portable Codex and Claude plugins. Reuse approved decisions and ask
|
|
15
|
+
only about unresolved choices that change implementation.
|
|
16
|
+
- Add explicit checkout-local project connections and session-local task
|
|
17
|
+
inspection/resume/Preview/end commands. Preserve profile V1, explicit opt-out,
|
|
18
|
+
unrelated user files and existing Workflow Integrity/Finish authority.
|
|
19
|
+
- Share full PH-block rendering limits between Preview and delivery; preserve
|
|
20
|
+
multi-file snapshots and fail closed on invalid or incomplete selection.
|
|
21
|
+
- Verification evidence includes workspace integration tests, local-tarball
|
|
22
|
+
npm-installed contracts and bounded isolated Codex Luna Max observations.
|
|
23
|
+
It is not registry smoke, universal model compliance or generated-app product
|
|
24
|
+
quality certification. Claude live behavior and token savings are not claimed.
|
|
25
|
+
|
|
26
|
+
## [1.0.0] - 2026-09-05
|
|
27
|
+
|
|
28
|
+
- Deliver common authorization-aware skill guidance across portable host
|
|
29
|
+
adapters and managed AGENTS instructions, with Astra migration documentation.
|
|
30
|
+
- Preserve task continuity through status questions and corrections; explain
|
|
31
|
+
confusion before advancing and honor stop without a new interview question.
|
|
32
|
+
- Reuse existing approval for implementation and review, size verification to
|
|
33
|
+
the changed behavior, and retain workflow completion evidence requirements.
|
|
34
|
+
- Block automatic OpenCode pin changes across major versions before writes;
|
|
35
|
+
retain explicit version-selected upgrades and user customization.
|
|
36
|
+
- Keep Context opt-in and legacy runtime-injection defaults unchanged.
|
|
37
|
+
|
|
11
38
|
## [0.13.0] - 2026-09-03
|
|
12
39
|
|
|
13
40
|
- Add a portable Socratic product-discovery core and the explicit `ph interview`
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Persona Harness
|
|
8
8
|
|
|
9
|
-
**
|
|
9
|
+
**Project philosophy, conventions, and evidence-first workflows for AI coding agents, with portable skills and a Java/Spring workflow rail.**
|
|
10
10
|
|
|
11
11
|
[](https://www.npmjs.com/package/persona-harness)
|
|
12
12
|
[](https://www.npmjs.com/package/persona-harness)
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
**[Start Here](docs/START-HERE.md) · [Quick Demo](docs/QUICK-DEMO.md) · [Measured Claims](docs/MEASURED-CLAIMS.md)**
|
|
19
19
|
|
|
20
|
+
[Astra migration, prompts, and AGENTS.md (한국어)](docs/current/astra-migration-guide.ko.md)
|
|
21
|
+
|
|
20
22
|
</div>
|
|
21
23
|
|
|
22
24
|
<!-- </CENTERED SECTION FOR GITHUB DISPLAY> -->
|
|
@@ -65,7 +67,7 @@ production readiness, token savings, or broad security guarantees.
|
|
|
65
67
|
**Start with:** [Quick Demo](docs/QUICK-DEMO.md) · [Measured Claims](docs/MEASURED-CLAIMS.md) · [Install guide](docs/START-HERE.md)
|
|
66
68
|
|
|
67
69
|
> [!IMPORTANT]
|
|
68
|
-
> **
|
|
70
|
+
> **Versioned, evidence-first.** Live registry channels, tags, GitHub releases,
|
|
69
71
|
> and audit lifecycle facts are maintained by governed workflows and release
|
|
70
72
|
> records; source release notes are inputs, not standalone proof. Runtime
|
|
71
73
|
> injection remains **default-off / opt-in**. See
|
|
@@ -103,9 +105,10 @@ Persona Harness exposes two deliberately separate tracks:
|
|
|
103
105
|
|
|
104
106
|
- **Workflow Integrity** is the existing evidence and completion-gate product.
|
|
105
107
|
- **Context Personalization (Experimental)** is a local, default-off path for
|
|
106
|
-
targeted convention guidance.
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
targeted convention guidance. Enabled adapters offer a bounded Context block
|
|
109
|
+
after safe observed file targets. Version 1.1.0 adds
|
|
110
|
+
Codex and Claude plugin hooks alongside OpenCode; this does not establish
|
|
111
|
+
live model receipt or grant completion authority.
|
|
109
112
|
|
|
110
113
|
### Context Boundary
|
|
111
114
|
|
|
@@ -115,13 +118,15 @@ Persona Harness exposes two deliberately separate tracks:
|
|
|
115
118
|
verification authority.
|
|
116
119
|
- **Isolation:** Context-only paths do not execute project commands or contact
|
|
117
120
|
GitHub/network.
|
|
118
|
-
- **No inferred skill route:** a Context-only or partial `.persona` directory
|
|
121
|
+
- **No inferred skill route:** for the existing OpenCode route, a Context-only or partial `.persona` directory
|
|
119
122
|
without the regular manifest created by `ph init` does not enable automatic
|
|
120
123
|
shared-skill routing or an interview. Resolve the project state explicitly
|
|
121
124
|
before enabling those routes.
|
|
122
125
|
- **Host:** `ph init` installs static skill adapters for Codex, Claude Code,
|
|
123
|
-
OpenCode, and Antigravity.
|
|
124
|
-
|
|
126
|
+
OpenCode, and Antigravity. The packaged Codex/Claude hooks add
|
|
127
|
+
bounded session guidance and targeted Context transport after host trust.
|
|
128
|
+
Actual delivery and behavior remain separate observations; see the
|
|
129
|
+
[portable host boundary](docs/current/portable-host-adapters.md).
|
|
125
130
|
- **Evidence:** Context usefulness remains `INCONCLUSIVE` until independent
|
|
126
131
|
external evidence exists.
|
|
127
132
|
- **Product focus:** the productized workflow focus is Java/Spring. The
|
|
@@ -206,12 +211,14 @@ the previous tracked configuration through your normal version-control flow.
|
|
|
206
211
|
These lifecycle actions do not enable `features.runtimeInjection`, and they do
|
|
207
212
|
not create workflow, evidence, or authority state or use network or GitHub.
|
|
208
213
|
|
|
209
|
-
With Context enabled, the OpenCode adapter
|
|
210
|
-
project-relative
|
|
211
|
-
|
|
214
|
+
With Context enabled, the OpenCode adapter collects safe observed
|
|
215
|
+
project-relative targets from supported file tools, including multi-file patches.
|
|
216
|
+
It resolves one current profile snapshot for the entire pending batch,
|
|
217
|
+
rejects invalid/unsafe/budget-exceeding input without a rule payload, and
|
|
212
218
|
prepends the selected bounded capsule content to the next user message for the
|
|
213
|
-
same session. It suppresses
|
|
214
|
-
|
|
219
|
+
same session. It suppresses a duplicate only when the exact synthetic block is
|
|
220
|
+
visible in the current model input; it does not assume retained delivery from
|
|
221
|
+
an earlier transform. It does not infer a target from the prompt, inject a full skill
|
|
215
222
|
catalog, access the network, execute shell commands, or write workflow,
|
|
216
223
|
evidence, or authority records. The adapter's actual behavior in a live
|
|
217
224
|
OpenCode release remains a separate host-observation boundary.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PERSONA_EXECUTION_GUIDANCE } from "../runtime/skill-execution-guidance.js";
|
|
1
2
|
export const AGENTS_START_MARKER = "<!-- persona-harness:agents:start schema=persona-harness.agents.v1 -->";
|
|
2
3
|
export const AGENTS_END_MARKER = "<!-- persona-harness:agents:end -->";
|
|
3
4
|
export const LEGACY_AGENTS_TITLE = "# Persona Harness Agent Instructions";
|
|
@@ -9,6 +10,9 @@ export function backendAgentInstructions() {
|
|
|
9
10
|
"",
|
|
10
11
|
"This project is initialized with Persona Harness for Java/Spring backend work.",
|
|
11
12
|
"",
|
|
13
|
+
"Working agreements:",
|
|
14
|
+
PERSONA_EXECUTION_GUIDANCE,
|
|
15
|
+
"",
|
|
12
16
|
"Project-local philosophy:",
|
|
13
17
|
"- Read `.persona/project-profile.jsonc` directly. Do not rely on Glob results for hidden `.persona` paths.",
|
|
14
18
|
"- Use the project profile as the source of truth for language, framework, build tool, storage, persistence, migration, package style, and architecture style.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents-contract.js","sourceRoot":"","sources":["../../src/cli/agents-contract.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAC9B,wEAAwE,CAAA;AAC1E,MAAM,CAAC,MAAM,iBAAiB,GAAG,qCAAqC,CAAA;AACtE,MAAM,CAAC,MAAM,mBAAmB,GAAG,sCAAsC,CAAA;AACzE,MAAM,CAAC,MAAM,wBAAwB,GAAG,2BAA2B,CAAA;AACnE,MAAM,CAAC,MAAM,qBAAqB,GAAG,kCAAkC,CAAA;AAEvE,MAAM,UAAU,wBAAwB;IACtC,OAAO;QACL,mBAAmB;QACnB,EAAE;QACF,gFAAgF;QAChF,EAAE;QACF,2BAA2B;QAC3B,4GAA4G;QAC5G,+JAA+J;QAC/J,mHAAmH;QACnH,+NAA+N;QAC/N,2GAA2G;QAC3G,EAAE;QACF,oBAAoB;QACpB,0EAA0E;QAC1E,iKAAiK;QACjK,oIAAoI;QACpI,4KAA4K;QAC5K,EAAE;QACF,yDAAy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iB,CAAC,CAAA;IAC5C,IAAI,KAAK,IAAI,CAAC,IAAI,GAAG,GAAG,KAAK,EAAE,CAAC;QAC9B,OAAO;YACL,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;YACxB,GAAG,+BAA+B,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;YAC1D,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;SACxB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IACrC,CAAC;IACD,OAAO,+BAA+B,EAAE,CAAA;AAC1C,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type PersonalizationStoreOptions } from "./personalization-store-io.js";
|
|
2
|
+
type ScopeBindingOptions = PersonalizationStoreOptions & {
|
|
3
|
+
readonly taskSession?: string;
|
|
4
|
+
};
|
|
5
|
+
export type ContextScopeBinding = {
|
|
6
|
+
readonly status: "unbound";
|
|
7
|
+
} | {
|
|
8
|
+
readonly status: "bound";
|
|
9
|
+
readonly scopeKey: string;
|
|
10
|
+
};
|
|
11
|
+
export type CheckoutProjectBinding = {
|
|
12
|
+
readonly status: "unbound";
|
|
13
|
+
} | {
|
|
14
|
+
readonly status: "bound";
|
|
15
|
+
readonly projectKey: string;
|
|
16
|
+
};
|
|
17
|
+
export declare class ContextScopeError extends Error {
|
|
18
|
+
readonly code: "context-scope-unavailable" | "context-scope-invalid" | "context-scope-existing-binding" | "context-scope-key-mismatch";
|
|
19
|
+
constructor(code: "context-scope-unavailable" | "context-scope-invalid" | "context-scope-existing-binding" | "context-scope-key-mismatch");
|
|
20
|
+
}
|
|
21
|
+
export declare function readCheckoutProjectBinding(projectDir: string, options?: PersonalizationStoreOptions): CheckoutProjectBinding;
|
|
22
|
+
export declare function changeCheckoutProjectBinding(projectDir: string, change: {
|
|
23
|
+
readonly action: "bind" | "unbind";
|
|
24
|
+
readonly projectKey: string;
|
|
25
|
+
}, options?: PersonalizationStoreOptions): CheckoutProjectBinding;
|
|
26
|
+
export declare function readContextScopeBinding(projectDir: string, options: ScopeBindingOptions): ContextScopeBinding;
|
|
27
|
+
export declare function changeContextScopeBinding(projectDir: string, change: {
|
|
28
|
+
readonly action: "bind" | "unbind";
|
|
29
|
+
readonly scopeKey: string;
|
|
30
|
+
}, options: ScopeBindingOptions): ContextScopeBinding;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { closeSync, constants, fstatSync, fsyncSync, linkSync, lstatSync, openSync, realpathSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
4
|
+
import { isRecord } from "../config/jsonc.js";
|
|
5
|
+
import { canonicalContextDigest } from "../context-core/context-digest.js";
|
|
6
|
+
import { withNoFollowDirectoryChain } from "../io/no-follow-directory-chain.js";
|
|
7
|
+
import { captureNoFollowDirectory, noFollowPathIdentityFromStat, readNoFollowProjectFile, sameNoFollowPathLocation } from "../io/no-follow-file.js";
|
|
8
|
+
import { personalizationStorePath } from "./personalization-store-io.js";
|
|
9
|
+
const MAX_BYTES = 4_096;
|
|
10
|
+
export class ContextScopeError extends Error {
|
|
11
|
+
code;
|
|
12
|
+
constructor(code) {
|
|
13
|
+
super(code);
|
|
14
|
+
this.code = code;
|
|
15
|
+
this.name = "ContextScopeError";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function readCheckoutProjectBinding(projectDir, options = {}) {
|
|
19
|
+
const result = readContextScopeBinding(projectDir, options);
|
|
20
|
+
return result.status === "bound" ? { status: "bound", projectKey: result.scopeKey } : result;
|
|
21
|
+
}
|
|
22
|
+
export function changeCheckoutProjectBinding(projectDir, change, options = {}) {
|
|
23
|
+
const result = changeContextScopeBinding(projectDir, { action: change.action, scopeKey: change.projectKey }, options);
|
|
24
|
+
return result.status === "bound" ? { status: "bound", projectKey: result.scopeKey } : result;
|
|
25
|
+
}
|
|
26
|
+
export function readContextScopeBinding(projectDir, options) {
|
|
27
|
+
const location = bindingLocation(projectDir, options);
|
|
28
|
+
const file = readNoFollowProjectFile(location.root, location.relativePath, MAX_BYTES);
|
|
29
|
+
switch (file.kind) {
|
|
30
|
+
case "absent": return { status: "unbound" };
|
|
31
|
+
case "blocked": throw new ContextScopeError("context-scope-unavailable");
|
|
32
|
+
case "ready": return parseBinding(file.value.bytes, location);
|
|
33
|
+
default: return assertNever(file);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export function changeContextScopeBinding(projectDir, change, options) {
|
|
37
|
+
const checkoutPath = resolve(projectDir);
|
|
38
|
+
const location = bindingLocation(checkoutPath, options);
|
|
39
|
+
const root = captureNoFollowDirectory(location.root);
|
|
40
|
+
if (root.kind !== "ready")
|
|
41
|
+
throw new ContextScopeError("context-scope-unavailable");
|
|
42
|
+
const existing = readContextScopeBinding(checkoutPath, options);
|
|
43
|
+
if (existing.status === "bound" && existing.scopeKey !== change.scopeKey) {
|
|
44
|
+
throw new ContextScopeError(change.action === "bind" ? "context-scope-existing-binding" : "context-scope-key-mismatch");
|
|
45
|
+
}
|
|
46
|
+
if (existing.status === "unbound" && change.action === "unbind")
|
|
47
|
+
return existing;
|
|
48
|
+
if (existing.status === "bound" && change.action === "bind")
|
|
49
|
+
return existing;
|
|
50
|
+
const result = withNoFollowDirectoryChain(join(location.root, location.directory), 0o700, () => {
|
|
51
|
+
const parent = captureNoFollowDirectory("..");
|
|
52
|
+
if (parent.kind !== "ready" || !sameNoFollowPathLocation(root.value, parent.value)
|
|
53
|
+
|| bindingLocation(checkoutPath, options).bindingDigest !== location.bindingDigest) {
|
|
54
|
+
throw new ContextScopeError("context-scope-unavailable");
|
|
55
|
+
}
|
|
56
|
+
const leaf = basename(location.relativePath);
|
|
57
|
+
const lock = `${leaf}.lock`;
|
|
58
|
+
const lockDescriptor = openSync(lock, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600);
|
|
59
|
+
try {
|
|
60
|
+
const latest = readContextScopeBinding(checkoutPath, options);
|
|
61
|
+
if (latest.status === "bound" && latest.scopeKey !== change.scopeKey) {
|
|
62
|
+
throw new ContextScopeError(change.action === "bind" ? "context-scope-existing-binding" : "context-scope-key-mismatch");
|
|
63
|
+
}
|
|
64
|
+
if (latest.status === "unbound" && change.action === "unbind")
|
|
65
|
+
return latest;
|
|
66
|
+
if (latest.status === "bound" && change.action === "bind")
|
|
67
|
+
return latest;
|
|
68
|
+
switch (change.action) {
|
|
69
|
+
case "bind": {
|
|
70
|
+
const temporary = `.binding-${randomUUID()}.tmp`;
|
|
71
|
+
const descriptor = openSync(temporary, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600);
|
|
72
|
+
let temporaryPresent = true;
|
|
73
|
+
try {
|
|
74
|
+
writeFileSync(descriptor, `${JSON.stringify({ schemaVersion: location.schema, [location.digestField]: location.bindingDigest, [location.keyField]: change.scopeKey })}\n`);
|
|
75
|
+
fsyncSync(descriptor);
|
|
76
|
+
// Publish complete bytes without replacing any existing binding.
|
|
77
|
+
linkSync(temporary, leaf);
|
|
78
|
+
unlinkSync(temporary);
|
|
79
|
+
temporaryPresent = false;
|
|
80
|
+
const opened = fstatSync(descriptor, { bigint: true });
|
|
81
|
+
const current = lstatSync(leaf, { bigint: true });
|
|
82
|
+
if (!opened.isFile() || opened.nlink !== 1n || current.isSymbolicLink()
|
|
83
|
+
|| !sameNoFollowPathLocation(noFollowPathIdentityFromStat(opened), noFollowPathIdentityFromStat(current))) {
|
|
84
|
+
throw new ContextScopeError("context-scope-unavailable");
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
closeSync(descriptor);
|
|
89
|
+
if (temporaryPresent)
|
|
90
|
+
unlinkSync(temporary);
|
|
91
|
+
}
|
|
92
|
+
return { status: "bound", scopeKey: change.scopeKey };
|
|
93
|
+
}
|
|
94
|
+
case "unbind": {
|
|
95
|
+
const file = readNoFollowProjectFile(location.root, location.relativePath, MAX_BYTES);
|
|
96
|
+
if (file.kind !== "ready" || parseBinding(file.value.bytes, location).scopeKey !== change.scopeKey) {
|
|
97
|
+
throw new ContextScopeError("context-scope-unavailable");
|
|
98
|
+
}
|
|
99
|
+
unlinkSync(leaf);
|
|
100
|
+
return { status: "unbound" };
|
|
101
|
+
}
|
|
102
|
+
default: return assertNever(change.action);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
closeSync(lockDescriptor);
|
|
107
|
+
unlinkSync(lock);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
if (result === undefined)
|
|
111
|
+
throw new ContextScopeError("context-scope-unavailable");
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
function bindingLocation(projectDir, options) {
|
|
115
|
+
if (options.taskSession !== undefined && !/^[a-f0-9]{64}$/u.test(options.taskSession))
|
|
116
|
+
throw new ContextScopeError("context-scope-invalid");
|
|
117
|
+
const projectPath = resolve(projectDir);
|
|
118
|
+
const captured = captureNoFollowDirectory(projectPath);
|
|
119
|
+
if (captured.kind !== "ready")
|
|
120
|
+
throw new ContextScopeError("context-scope-unavailable");
|
|
121
|
+
let canonicalPath;
|
|
122
|
+
let birthtime;
|
|
123
|
+
try {
|
|
124
|
+
canonicalPath = realpathSync.native(projectPath);
|
|
125
|
+
const stat = lstatSync(canonicalPath, { bigint: true });
|
|
126
|
+
if (!stat.isDirectory() || !sameNoFollowPathLocation(captured.value, noFollowPathIdentityFromStat(stat))) {
|
|
127
|
+
throw new ContextScopeError("context-scope-unavailable");
|
|
128
|
+
}
|
|
129
|
+
birthtime = stat.birthtimeNs.toString();
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
if (error instanceof ContextScopeError)
|
|
133
|
+
throw error;
|
|
134
|
+
throw new ContextScopeError("context-scope-unavailable");
|
|
135
|
+
}
|
|
136
|
+
const checkoutDigest = canonicalContextDigest({ path: canonicalPath, dev: captured.value.dev, ino: captured.value.ino, birthtime });
|
|
137
|
+
const root = dirname(personalizationStorePath(options));
|
|
138
|
+
const task = options.taskSession !== undefined;
|
|
139
|
+
const bindingDigest = task ? canonicalContextDigest({ checkoutDigest, sessionHandle: options.taskSession }) : checkoutDigest;
|
|
140
|
+
const directory = task ? "task-bindings" : "project-bindings";
|
|
141
|
+
return {
|
|
142
|
+
root, bindingDigest, directory, relativePath: `${directory}/${bindingDigest}.json`,
|
|
143
|
+
schema: task ? "persona-context-task-binding.1" : "persona-context-checkout-binding.1",
|
|
144
|
+
digestField: task ? "bindingDigest" : "checkoutDigest",
|
|
145
|
+
keyField: task ? "taskKey" : "projectKey",
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function parseBinding(bytes, location) {
|
|
149
|
+
let value;
|
|
150
|
+
try {
|
|
151
|
+
value = JSON.parse(bytes.toString("utf8"));
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
if (error instanceof SyntaxError)
|
|
155
|
+
throw new ContextScopeError("context-scope-invalid");
|
|
156
|
+
throw error;
|
|
157
|
+
}
|
|
158
|
+
if (!isRecord(value) || Object.keys(value).length !== 3
|
|
159
|
+
|| value.schemaVersion !== location.schema || value[location.digestField] !== location.bindingDigest) {
|
|
160
|
+
throw new ContextScopeError("context-scope-invalid");
|
|
161
|
+
}
|
|
162
|
+
const scopeKey = value[location.keyField];
|
|
163
|
+
if (typeof scopeKey !== "string" || !/^[A-Za-z0-9][A-Za-z0-9._-]{0,119}$/u.test(scopeKey))
|
|
164
|
+
throw new ContextScopeError("context-scope-invalid");
|
|
165
|
+
return { status: "bound", scopeKey };
|
|
166
|
+
}
|
|
167
|
+
function assertNever(value) {
|
|
168
|
+
throw new ContextScopeError("context-scope-invalid");
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=context-checkout-binding.js.map
|
|
@@ -0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C,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY;KAC1C,CAAA;AACH,CAAC;AAED,SAAS,YAAY,CAAC,KAAa,EAAE,QAA4C;IAC/E,IAAI,KAAc,CAAA;IAClB,IAAI,CAAC;QACH,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,WAAW;YAAE,MAAM,IAAI,iBAAiB,CAAC,uBAAuB,CAAC,CAAA;QACtF,MAAM,KAAK,CAAA;IACb,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC;WAClD,KAAK,CAAC,aAAa,KAAK,QAAQ,CAAC,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,QAAQ,CAAC,aAAa,EAAE,CAAC;QACvG,MAAM,IAAI,iBAAiB,CAAC,uBAAuB,CAAC,CAAA;IACtD,CAAC;IACD,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACzC,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,qCAAqC,CAAC,IAAI,CAAC,QAAQ,CAAC;QAAE,MAAM,IAAI,iBAAiB,CAAC,uBAAuB,CAAC,CAAA;IAC/I,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA;AACtC,CAAC;AAED,SAAS,WAAW,CAAC,KAAY;IAC/B,MAAM,IAAI,iBAAiB,CAAC,uBAAuB,CAAC,CAAA;AACtD,CAAC"}
|
|
@@ -2,6 +2,8 @@ import process from "node:process";
|
|
|
2
2
|
import { runContextExplainCommand } from "./context-explain.js";
|
|
3
3
|
import { runContextInitCommand } from "./context-init.js";
|
|
4
4
|
import { runContextPreviewCommand } from "./context-preview.js";
|
|
5
|
+
import { runContextScopeCommand } from "./context-scope-command.js";
|
|
6
|
+
import { runContextTaskCommand } from "./context-task-command.js";
|
|
5
7
|
import { renderContextDoctor } from "./context-doctor.js";
|
|
6
8
|
import { readContextStatus, renderContextStatus } from "./context-status.js";
|
|
7
9
|
export function runContextCommand(args, invocationName = "ph", options = {}) {
|
|
@@ -12,6 +14,12 @@ export function runContextCommand(args, invocationName = "ph", options = {}) {
|
|
|
12
14
|
if (command === "init") {
|
|
13
15
|
return runContextInitCommand(args.slice(1), options.projectDir ?? process.cwd());
|
|
14
16
|
}
|
|
17
|
+
if (command === "scope") {
|
|
18
|
+
return runContextScopeCommand(args.slice(1), options.projectDir ?? process.cwd(), options.personalization);
|
|
19
|
+
}
|
|
20
|
+
if (command === "task") {
|
|
21
|
+
return runContextTaskCommand(args.slice(1), options.projectDir ?? process.cwd(), options.personalization);
|
|
22
|
+
}
|
|
15
23
|
if (command === "status") {
|
|
16
24
|
if (args.length !== 1)
|
|
17
25
|
return invalidArguments(invocationName);
|
|
@@ -36,7 +44,7 @@ export function runContextCommand(args, invocationName = "ph", options = {}) {
|
|
|
36
44
|
}
|
|
37
45
|
export function contextUsage(invocationName) {
|
|
38
46
|
return [
|
|
39
|
-
`Usage: ${invocationName} context <init|status|preview|explain|doctor>`,
|
|
47
|
+
`Usage: ${invocationName} context <init|status|preview|explain|doctor|scope|task>`,
|
|
40
48
|
"",
|
|
41
49
|
"Context Personalization (Experimental, default-off)",
|
|
42
50
|
"",
|
|
@@ -46,8 +54,11 @@ export function contextUsage(invocationName) {
|
|
|
46
54
|
" preview <target-file> [--json] [--project <key>] [--task <key>] [--topic <topic>]",
|
|
47
55
|
" explain <target-file> [--project <key>] [--task <key>] [--topic <topic>]",
|
|
48
56
|
" doctor Diagnose only the local Context track.",
|
|
57
|
+
" scope [bind|unbind --project <key>] Inspect or explicitly change this checkout's project binding.",
|
|
58
|
+
" task --session <handle> [resume|end --task <key>] Inspect or explicitly change a session's task connection.",
|
|
59
|
+
" task --session <handle> preview <target-file> [--json] [--topic <topic>]",
|
|
49
60
|
"",
|
|
50
|
-
"Preview and
|
|
61
|
+
"Preview, explanation and scope/task inspection are read-only. Scope bind/unbind and task resume/end are explicit local writes; init requires --enable.",
|
|
51
62
|
].join("\n");
|
|
52
63
|
}
|
|
53
64
|
function invalidArguments(invocationName) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-command.js","sourceRoot":"","sources":["../../src/cli/context-command.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAA;AAElC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAc5E,MAAM,UAAU,iBAAiB,CAC/B,IAAuB,EACvB,iBAAyB,IAAI,EAC7B,UAAiC,EAAE;IAEnC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;IAEvB,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,MAAM,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QAC5F,OAAO,OAAO,CAAC,GAAG,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;IACrD,CAAC;IAED,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QACvB,OAAO,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;IAClF,CAAC;IAED,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QACzB,IAAI,IAAI,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QACF,qDAAqD;QACrD,EAAE;QACF,WAAW;QACX,6FAA6F;QAC7F,sEAAsE;QACtE,qFAAqF;QACrF,4EAA4E;QAC5E,uEAAuE;QACvE,sGAAsG;QACtG,gHAAgH;QAChH,4EAA4E;QAC5E,EAAE;QACF,wJAAwJ;KACzJ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACd,CAAC;AAED,SAAS,gBAAgB,CAAC,cAAsB;IAC9C,OAAO,OAAO,CAAC,gCAAgC,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;AAClF,CAAC;AAED,SAAS,OAAO,CAAC,MAAc;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;AAC1C,CAAC;AAED,SAAS,OAAO,CAAC,MAAc;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAA;AAC1C,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ContextEnvelope, ContextWarning } from "../context-core/context-envelope.js";
|
|
2
|
+
import type { ContextRelevance, ContextRule, ContextScope } from "../context-core/rule-types.js";
|
|
3
|
+
import { type PersonalizationStoreOptions } from "./personalization-store-io.js";
|
|
4
|
+
export type ContextPersonalization = {
|
|
5
|
+
readonly personalRules: readonly ContextRule[];
|
|
6
|
+
readonly projectContracts: readonly ContextRule[];
|
|
7
|
+
readonly taskDecisions: readonly ContextRule[];
|
|
8
|
+
readonly warnings: readonly ContextWarning[];
|
|
9
|
+
};
|
|
10
|
+
export declare function readContextPersonalization(options?: PersonalizationStoreOptions, scopeKeys?: Pick<ContextRelevance, "projectKey" | "taskKey">): ContextPersonalization;
|
|
11
|
+
export declare function withPersonalizationWarnings(envelope: ContextEnvelope, profile: ContextPersonalization, scopeKeys?: Pick<ContextRelevance, "projectKey" | "taskKey">): ContextEnvelope;
|
|
12
|
+
export declare function contextScope(scope: {
|
|
13
|
+
readonly key: string;
|
|
14
|
+
readonly kind: "personal" | "project" | "task";
|
|
15
|
+
} | null | undefined): ContextScope | undefined;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { canonicalContextDigest } from "../context-core/context-digest.js";
|
|
2
|
+
import { renderContextEnvelope } from "../context-core/context-renderer.js";
|
|
3
|
+
import { readPersonalizationStoreSnapshot } from "./personalization-store-io.js";
|
|
4
|
+
export function readContextPersonalization(options, scopeKeys = {}) {
|
|
5
|
+
const snapshot = readPersonalizationStoreSnapshot(options);
|
|
6
|
+
const rules = snapshot.document.profile.activeRules;
|
|
7
|
+
const warnings = snapshot.status === "missing"
|
|
8
|
+
? [{ code: "personal-profile-missing", message: "No personal profile is initialized; defaults are not approved personal philosophy." }]
|
|
9
|
+
: rules.length === 0
|
|
10
|
+
? [{ code: "personal-profile-empty", message: "The personal profile contains no active approved rules." }]
|
|
11
|
+
: [];
|
|
12
|
+
if (scopeKeys.projectKey === undefined && rules.some((rule) => rule.scope.kind === "project")) {
|
|
13
|
+
warnings.push({ code: "project-scope-unbound", message: "Project-scoped rules exist, but no project identity was supplied; those rules were not applied." });
|
|
14
|
+
}
|
|
15
|
+
if (scopeKeys.taskKey === undefined && rules.some((rule) => rule.scope.kind === "task")) {
|
|
16
|
+
warnings.push({ code: "task-scope-unbound", message: "Task-scoped rules exist, but no task identity was supplied; those rules were not applied." });
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
personalRules: rules.filter((rule) => rule.scope.kind === "personal").map(toContextRule),
|
|
20
|
+
projectContracts: rules.filter((rule) => rule.scope.kind === "project").map(toContextRule),
|
|
21
|
+
taskDecisions: rules.filter((rule) => rule.scope.kind === "task").map(toContextRule),
|
|
22
|
+
warnings,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export function withPersonalizationWarnings(envelope, profile, scopeKeys = {}) {
|
|
26
|
+
const warnings = profile.warnings.filter((warning) => !(warning.code === "project-scope-unbound" && scopeKeys.projectKey !== undefined)
|
|
27
|
+
&& !(warning.code === "task-scope-unbound" && scopeKeys.taskKey !== undefined));
|
|
28
|
+
if (warnings.length === 0)
|
|
29
|
+
return envelope;
|
|
30
|
+
const { digest: _digest, ...body } = envelope;
|
|
31
|
+
const payload = { ...body, warnings: [...body.warnings, ...warnings] };
|
|
32
|
+
if (payload.status === "blocked")
|
|
33
|
+
return { ...payload, digest: canonicalContextDigest(payload) };
|
|
34
|
+
const usedChars = renderContextEnvelope({ ...payload, digest: "" }).length;
|
|
35
|
+
const budget = { ...payload.budget, usedChars };
|
|
36
|
+
if (usedChars > budget.maxChars) {
|
|
37
|
+
const blocked = { ...payload, budget, status: "blocked", blockReason: "budget-exceeded", selected: [] };
|
|
38
|
+
return { ...blocked, digest: canonicalContextDigest(blocked) };
|
|
39
|
+
}
|
|
40
|
+
const resolved = { ...payload, budget };
|
|
41
|
+
return { ...resolved, digest: canonicalContextDigest(resolved) };
|
|
42
|
+
}
|
|
43
|
+
function toContextRule(rule) {
|
|
44
|
+
return { id: rule.ruleId, rule: rule.rule, scope: contextScope(rule.scope), status: "active", topic: rule.topic };
|
|
45
|
+
}
|
|
46
|
+
export function contextScope(scope) {
|
|
47
|
+
if (scope === undefined || scope === null || scope.kind === "personal")
|
|
48
|
+
return undefined;
|
|
49
|
+
return { key: scope.key, kind: scope.kind };
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=context-personalization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-personalization.js","sourceRoot":"","sources":["../../src/cli/context-personalization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AAI3E,OAAO,EAAE,gCAAgC,EAAoC,MAAM,+BAA+B,CAAA;AASlH,MAAM,UAAU,0BAA0B,CACxC,OAAqC,EACrC,YAA8D,EAAE;IAEhE,MAAM,QAAQ,GAAG,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AM,CAAC,QAAQ,EAAE,CAAC;QAChC,MAAM,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,iBAAiB,EAAE,QAAQ,EAAE,EAAE,EAAW,CAAA;QAChH,OAAO,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,sBAAsB,CAAC,OAAO,CAAC,EAAE,CAAA;IAChE,CAAC;IACD,MAAM,QAAQ,GAAG,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CAAA;IACvC,OAAO,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,sBAAsB,CAAC,QAAQ,CAAC,EAAE,CAAA;AAClE,CAAC;AAED,SAAS,aAAa,CAAC,IAAyB;IAC9C,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAA;AACnH,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,KAAkG;IAElG,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,SAAS,CAAA;IACxF,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAA;AAC7C,CAAC"}
|
|
@@ -5,7 +5,7 @@ export type ContextPreviewCommandResult = {
|
|
|
5
5
|
readonly stderr: string;
|
|
6
6
|
readonly stdout: string;
|
|
7
7
|
};
|
|
8
|
-
export type ContextPreviewFailureCode = "context-config-invalid" | "context-config-unavailable" | "context-personal-profile-unavailable" | "context-target-invalid" | "context-target-required" | "context-team-profile-invalid" | "context-topic-unavailable" | "context-preview-arguments-invalid";
|
|
8
|
+
export type ContextPreviewFailureCode = "context-config-invalid" | "context-config-unavailable" | "context-personal-profile-unavailable" | "context-target-invalid" | "context-target-required" | "context-team-profile-invalid" | "context-topic-unavailable" | "context-preview-arguments-invalid" | "context-scope-unavailable";
|
|
9
9
|
export type ContextTargetDetection = {
|
|
10
10
|
readonly fileRole: string;
|
|
11
11
|
readonly language: string;
|
|
@@ -28,3 +28,4 @@ export type ContextPreviewReadResult = {
|
|
|
28
28
|
};
|
|
29
29
|
export declare function runContextPreviewCommand(args: readonly string[], projectDir: string, options?: ContextPreviewOptions): ContextPreviewCommandResult;
|
|
30
30
|
export declare function readContextPreview(args: readonly string[], projectDir: string, options?: ContextPreviewOptions): ContextPreviewReadResult;
|
|
31
|
+
export declare function createContextPreviewReader(projectDir: string, options?: ContextPreviewOptions): (args: readonly string[]) => ContextPreviewReadResult;
|