persona-harness 1.0.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 +15 -0
- package/README.md +16 -11
- 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/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/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/docs/current/context-program-status.md +22 -0
- package/docs/current/personalization-profile-v1.md +118 -0
- package/docs/current/portable-host-adapters.md +103 -3
- package/docs/current/release/consumer-authority-current-acceptance.json +1 -1
- package/docs/current/release/v1.1.0-release-notes.md +82 -0
- package/package.json +7 -3
- package/packages/host-plugins/antigravity/skills/ast-grep/SKILL.md +1 -1
- package/packages/host-plugins/antigravity/skills/debug/SKILL.md +1 -1
- package/packages/host-plugins/antigravity/skills/deep-interview/SKILL.md +54 -26
- package/packages/host-plugins/antigravity/skills/frontend/SKILL.md +1 -1
- package/packages/host-plugins/antigravity/skills/git/SKILL.md +1 -1
- package/packages/host-plugins/antigravity/skills/grill-me/SKILL.md +1 -1
- package/packages/host-plugins/antigravity/skills/implementation/SKILL.md +1 -1
- package/packages/host-plugins/antigravity/skills/lsp-setup/SKILL.md +1 -1
- package/packages/host-plugins/antigravity/skills/philosophy-refinement/SKILL.md +17 -6
- package/packages/host-plugins/antigravity/skills/philosophy-refinement/references/persistence.md +89 -0
- package/packages/host-plugins/antigravity/skills/plan/SKILL.md +1 -1
- package/packages/host-plugins/antigravity/skills/programming/SKILL.md +23 -1
- 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 +1 -1
- package/packages/host-plugins/antigravity/skills/refactor/SKILL.md +1 -1
- package/packages/host-plugins/antigravity/skills/review/SKILL.md +1 -1
- package/packages/host-plugins/antigravity/skills/tdd/SKILL.md +1 -1
- package/packages/host-plugins/antigravity/skills/technical-intake/SKILL.md +13 -6
- package/packages/host-plugins/antigravity/skills/visual-qa/SKILL.md +1 -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 +1 -1
- package/packages/host-plugins/claude/skills/debug/SKILL.md +1 -1
- package/packages/host-plugins/claude/skills/deep-interview/SKILL.md +54 -26
- package/packages/host-plugins/claude/skills/frontend/SKILL.md +1 -1
- package/packages/host-plugins/claude/skills/git/SKILL.md +1 -1
- package/packages/host-plugins/claude/skills/grill-me/SKILL.md +1 -1
- package/packages/host-plugins/claude/skills/implementation/SKILL.md +1 -1
- package/packages/host-plugins/claude/skills/lsp-setup/SKILL.md +1 -1
- package/packages/host-plugins/claude/skills/philosophy-refinement/SKILL.md +17 -6
- package/packages/host-plugins/claude/skills/philosophy-refinement/references/persistence.md +89 -0
- package/packages/host-plugins/claude/skills/plan/SKILL.md +1 -1
- package/packages/host-plugins/claude/skills/programming/SKILL.md +23 -1
- 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 +1 -1
- package/packages/host-plugins/claude/skills/refactor/SKILL.md +1 -1
- package/packages/host-plugins/claude/skills/review/SKILL.md +1 -1
- package/packages/host-plugins/claude/skills/tdd/SKILL.md +1 -1
- package/packages/host-plugins/claude/skills/technical-intake/SKILL.md +13 -6
- package/packages/host-plugins/claude/skills/visual-qa/SKILL.md +1 -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 +1 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/debug/SKILL.md +1 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/deep-interview/SKILL.md +54 -26
- package/packages/host-plugins/codex/plugins/persona-harness/skills/frontend/SKILL.md +1 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/git/SKILL.md +1 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/grill-me/SKILL.md +1 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/implementation/SKILL.md +1 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/lsp-setup/SKILL.md +1 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/philosophy-refinement/SKILL.md +17 -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 +1 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/programming/SKILL.md +23 -1
- 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 +1 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/refactor/SKILL.md +1 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/review/SKILL.md +1 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/tdd/SKILL.md +1 -1
- package/packages/host-plugins/codex/plugins/persona-harness/skills/technical-intake/SKILL.md +13 -6
- package/packages/host-plugins/codex/plugins/persona-harness/skills/visual-qa/SKILL.md +1 -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/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 +22 -0
- 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/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,21 @@ 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
|
+
|
|
11
26
|
## [1.0.0] - 2026-09-05
|
|
12
27
|
|
|
13
28
|
- Deliver common authorization-aware skill guidance across portable host
|
package/README.md
CHANGED
|
@@ -105,9 +105,10 @@ Persona Harness exposes two deliberately separate tracks:
|
|
|
105
105
|
|
|
106
106
|
- **Workflow Integrity** is the existing evidence and completion-gate product.
|
|
107
107
|
- **Context Personalization (Experimental)** is a local, default-off path for
|
|
108
|
-
targeted convention guidance.
|
|
109
|
-
|
|
110
|
-
|
|
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.
|
|
111
112
|
|
|
112
113
|
### Context Boundary
|
|
113
114
|
|
|
@@ -117,13 +118,15 @@ Persona Harness exposes two deliberately separate tracks:
|
|
|
117
118
|
verification authority.
|
|
118
119
|
- **Isolation:** Context-only paths do not execute project commands or contact
|
|
119
120
|
GitHub/network.
|
|
120
|
-
- **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
|
|
121
122
|
without the regular manifest created by `ph init` does not enable automatic
|
|
122
123
|
shared-skill routing or an interview. Resolve the project state explicitly
|
|
123
124
|
before enabling those routes.
|
|
124
125
|
- **Host:** `ph init` installs static skill adapters for Codex, Claude Code,
|
|
125
|
-
OpenCode, and Antigravity.
|
|
126
|
-
|
|
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).
|
|
127
130
|
- **Evidence:** Context usefulness remains `INCONCLUSIVE` until independent
|
|
128
131
|
external evidence exists.
|
|
129
132
|
- **Product focus:** the productized workflow focus is Java/Spring. The
|
|
@@ -208,12 +211,14 @@ the previous tracked configuration through your normal version-control flow.
|
|
|
208
211
|
These lifecycle actions do not enable `features.runtimeInjection`, and they do
|
|
209
212
|
not create workflow, evidence, or authority state or use network or GitHub.
|
|
210
213
|
|
|
211
|
-
With Context enabled, the OpenCode adapter
|
|
212
|
-
project-relative
|
|
213
|
-
|
|
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
|
|
214
218
|
prepends the selected bounded capsule content to the next user message for the
|
|
215
|
-
same session. It suppresses
|
|
216
|
-
|
|
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
|
|
217
222
|
catalog, access the network, execute shell commands, or write workflow,
|
|
218
223
|
evidence, or authority records. The adapter's actual behavior in a live
|
|
219
224
|
OpenCode release remains a separate host-observation boundary.
|
|
@@ -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
|
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AAI,CAAC,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,IAA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F,EAAE;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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GAAG,MAAM,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;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { buildContextEnvelope, createProductSafetyInvariants, createStarterProfileDefaults, resolveEffectiveContext, } from "../context-core/index.js";
|
|
2
2
|
import { isContextPersonalizationEnabled, loadHarnessConfigResult } from "../config/harness-config.js";
|
|
3
3
|
import { loadTeamProfile, toTeamContextRules } from "../context-profile/team-profile-store.js";
|
|
4
|
-
import { PersonalizationStoreError,
|
|
4
|
+
import { PersonalizationStoreError, } from "./personalization-profile-store.js";
|
|
5
|
+
import { contextScope, readContextPersonalization, withPersonalizationWarnings } from "./context-personalization.js";
|
|
5
6
|
import { parseContextPreviewRequest } from "./context-preview-request.js";
|
|
7
|
+
import { ContextScopeError, readCheckoutProjectBinding } from "./context-checkout-binding.js";
|
|
6
8
|
export function runContextPreviewCommand(args, projectDir, options = {}) {
|
|
7
9
|
const result = readContextPreview(args, projectDir, options);
|
|
8
10
|
if (result.status === "blocked")
|
|
@@ -14,9 +16,20 @@ export function runContextPreviewCommand(args, projectDir, options = {}) {
|
|
|
14
16
|
: success(renderPreview(contextEnabled, detected, envelope));
|
|
15
17
|
}
|
|
16
18
|
export function readContextPreview(args, projectDir, options = {}) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
return createContextPreviewReader(projectDir, options)(args);
|
|
20
|
+
}
|
|
21
|
+
// A reader owns one immutable batch snapshot; create a new reader for the next request.
|
|
22
|
+
export function createContextPreviewReader(projectDir, options = {}) {
|
|
23
|
+
let sources;
|
|
24
|
+
return (args) => {
|
|
25
|
+
const parsed = parseContextPreviewRequest(args);
|
|
26
|
+
if (parsed.status === "blocked")
|
|
27
|
+
return blocked(parsed.code);
|
|
28
|
+
sources ??= readContextPreviewSources(projectDir, options);
|
|
29
|
+
return sources.status === "blocked" ? sources : previewFromSources(parsed.request, sources);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function readContextPreviewSources(projectDir, options) {
|
|
20
33
|
const configResult = loadHarnessConfigResult(projectDir);
|
|
21
34
|
if (!configResult.safe)
|
|
22
35
|
return blocked("context-config-unavailable");
|
|
@@ -25,47 +38,56 @@ export function readContextPreview(args, projectDir, options = {}) {
|
|
|
25
38
|
const teamResult = loadTeamProfile(projectDir);
|
|
26
39
|
if (teamResult.status === "invalid")
|
|
27
40
|
return blocked("context-team-profile-invalid");
|
|
28
|
-
let
|
|
41
|
+
let personalization;
|
|
42
|
+
let binding;
|
|
29
43
|
try {
|
|
30
|
-
|
|
44
|
+
personalization = readContextPersonalization(options.personalization);
|
|
45
|
+
binding = readCheckoutProjectBinding(projectDir, options.personalization);
|
|
31
46
|
}
|
|
32
47
|
catch (error) {
|
|
48
|
+
if (error instanceof ContextScopeError)
|
|
49
|
+
return blocked("context-scope-unavailable");
|
|
33
50
|
if (error instanceof PersonalizationStoreError)
|
|
34
51
|
return blocked("context-personal-profile-unavailable");
|
|
35
52
|
throw error;
|
|
36
53
|
}
|
|
37
|
-
|
|
54
|
+
return { status: "ready", configResult, teamResult, personalization, binding };
|
|
55
|
+
}
|
|
56
|
+
function previewFromSources(request, sources) {
|
|
57
|
+
const { configResult, teamResult, personalization } = sources;
|
|
58
|
+
const projectKey = request.projectKey ?? (sources.binding.status === "bound" ? sources.binding.projectKey : undefined);
|
|
59
|
+
const detected = detectTarget(request.targetPath);
|
|
38
60
|
const teamRules = teamResult.status === "available" ? toTeamContextRules(teamResult.profile) : [];
|
|
39
61
|
const productInvariants = invariantRules();
|
|
40
62
|
const commonDefaults = starterRules();
|
|
41
|
-
const personalContextRules = toPersonalContextRules(personalRules);
|
|
42
63
|
const allRules = [
|
|
43
64
|
...productInvariants,
|
|
44
65
|
...commonDefaults,
|
|
45
66
|
...teamRules,
|
|
46
|
-
...
|
|
67
|
+
...personalization.personalRules,
|
|
68
|
+
...personalization.projectContracts,
|
|
69
|
+
...personalization.taskDecisions,
|
|
47
70
|
];
|
|
48
|
-
const topics = selectedTopics(
|
|
71
|
+
const topics = selectedTopics(request, allRules);
|
|
49
72
|
if (topics === undefined)
|
|
50
73
|
return blocked("context-topic-unavailable");
|
|
51
74
|
const resolution = resolveEffectiveContext({
|
|
52
75
|
commonDefaults,
|
|
53
76
|
languageDefaults: [],
|
|
54
77
|
maxCapsules: configResult.config.context.maxCapsules,
|
|
55
|
-
|
|
56
|
-
personalRules: personalContextRules,
|
|
78
|
+
personalRules: personalization.personalRules,
|
|
57
79
|
productInvariants,
|
|
58
|
-
projectContracts:
|
|
80
|
+
projectContracts: personalization.projectContracts,
|
|
59
81
|
relevance: {
|
|
60
82
|
fileRole: detected.fileRole,
|
|
61
83
|
language: detected.language,
|
|
62
|
-
projectKey
|
|
84
|
+
projectKey,
|
|
63
85
|
skillIds: [],
|
|
64
|
-
taskKey:
|
|
86
|
+
taskKey: request.taskKey,
|
|
65
87
|
teamKey: teamResult.status === "available" ? teamResult.profile.teamKey : undefined,
|
|
66
88
|
topics,
|
|
67
89
|
},
|
|
68
|
-
taskDecisions:
|
|
90
|
+
taskDecisions: personalization.taskDecisions,
|
|
69
91
|
teamContracts: teamRules,
|
|
70
92
|
});
|
|
71
93
|
const envelope = buildContextEnvelope({
|
|
@@ -77,14 +99,14 @@ export function readContextPreview(args, projectDir, options = {}) {
|
|
|
77
99
|
target: {
|
|
78
100
|
fileRole: detected.fileRole,
|
|
79
101
|
language: detected.language,
|
|
80
|
-
path:
|
|
102
|
+
path: request.targetPath,
|
|
81
103
|
},
|
|
82
104
|
});
|
|
83
105
|
return {
|
|
84
106
|
preview: {
|
|
85
107
|
contextEnabled: isContextPersonalizationEnabled(configResult),
|
|
86
108
|
detected,
|
|
87
|
-
envelope,
|
|
109
|
+
envelope: withPersonalizationWarnings(envelope, personalization, { ...request, projectKey }),
|
|
88
110
|
resolution,
|
|
89
111
|
},
|
|
90
112
|
status: "ready",
|
|
@@ -107,20 +129,6 @@ function toContextRule(rule) {
|
|
|
107
129
|
topic: rule.topic,
|
|
108
130
|
};
|
|
109
131
|
}
|
|
110
|
-
function toPersonalContextRules(rules) {
|
|
111
|
-
return rules.map((rule) => ({
|
|
112
|
-
id: rule.ruleId,
|
|
113
|
-
rule: rule.rule,
|
|
114
|
-
scope: contextScope(rule.scope),
|
|
115
|
-
status: "active",
|
|
116
|
-
topic: rule.topic,
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
119
|
-
function contextScope(scope) {
|
|
120
|
-
if (scope === undefined || scope === null || scope.kind === "personal")
|
|
121
|
-
return undefined;
|
|
122
|
-
return { key: scope.key, kind: scope.kind };
|
|
123
|
-
}
|
|
124
132
|
function selectedTopics(request, rules) {
|
|
125
133
|
const available = new Set(rules.map((rule) => rule.topic));
|
|
126
134
|
if (request.topics.length === 0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-preview.js","sourceRoot":"","sources":["../../src/cli/context-preview.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,4BAA4B,EAC5B,uBAAuB,
|
|
1
|
+
{"version":3,"file":"context-preview.js","sourceRoot":"","sources":["../../src/cli/context-preview.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,4BA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