persona-harness 0.8.32 → 0.8.34

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.
Files changed (120) hide show
  1. package/README.md +77 -8
  2. package/dist/cli/cli-usage.js +12 -0
  3. package/dist/cli/cli-usage.js.map +1 -1
  4. package/dist/cli/context-command.d.ts +12 -0
  5. package/dist/cli/context-command.js +62 -0
  6. package/dist/cli/context-command.js.map +1 -0
  7. package/dist/cli/context-doctor.d.ts +2 -0
  8. package/dist/cli/context-doctor.js +19 -0
  9. package/dist/cli/context-doctor.js.map +1 -0
  10. package/dist/cli/context-explain.d.ts +7 -0
  11. package/dist/cli/context-explain.js +44 -0
  12. package/dist/cli/context-explain.js.map +1 -0
  13. package/dist/cli/context-init.d.ts +6 -0
  14. package/dist/cli/context-init.js +176 -0
  15. package/dist/cli/context-init.js.map +1 -0
  16. package/dist/cli/context-preview-request.d.ts +16 -0
  17. package/dist/cli/context-preview-request.js +71 -0
  18. package/dist/cli/context-preview-request.js.map +1 -0
  19. package/dist/cli/context-preview.d.ts +30 -0
  20. package/dist/cli/context-preview.js +187 -0
  21. package/dist/cli/context-preview.js.map +1 -0
  22. package/dist/cli/context-status.d.ts +15 -0
  23. package/dist/cli/context-status.js +46 -0
  24. package/dist/cli/context-status.js.map +1 -0
  25. package/dist/cli/index.js +12 -0
  26. package/dist/cli/index.js.map +1 -1
  27. package/dist/cli/personalization-profile-store.d.ts +1 -1
  28. package/dist/cli/personalization-profile-store.js +1 -7
  29. package/dist/cli/personalization-profile-store.js.map +1 -1
  30. package/dist/cli/workflow-safe-rendering.d.ts +10 -10
  31. package/dist/config/context-config.d.ts +17 -0
  32. package/dist/config/context-config.js +59 -0
  33. package/dist/config/context-config.js.map +1 -0
  34. package/dist/config/harness-config.d.ts +6 -0
  35. package/dist/config/harness-config.js +24 -4
  36. package/dist/config/harness-config.js.map +1 -1
  37. package/dist/context-comparison/context-comparison-evaluator.d.ts +2 -0
  38. package/dist/context-comparison/context-comparison-evaluator.js +190 -0
  39. package/dist/context-comparison/context-comparison-evaluator.js.map +1 -0
  40. package/dist/context-comparison/context-comparison-manifest.d.ts +8 -0
  41. package/dist/context-comparison/context-comparison-manifest.js +190 -0
  42. package/dist/context-comparison/context-comparison-manifest.js.map +1 -0
  43. package/dist/context-comparison/context-comparison-types.d.ts +123 -0
  44. package/dist/context-comparison/context-comparison-types.js +19 -0
  45. package/dist/context-comparison/context-comparison-types.js.map +1 -0
  46. package/dist/context-comparison/index.d.ts +2 -0
  47. package/dist/context-comparison/index.js +3 -0
  48. package/dist/context-comparison/index.js.map +1 -0
  49. package/dist/context-core/context-budget.d.ts +5 -0
  50. package/dist/context-core/context-budget.js +5 -0
  51. package/dist/context-core/context-budget.js.map +1 -0
  52. package/dist/context-core/context-digest.d.ts +6 -0
  53. package/dist/context-core/context-digest.js +30 -0
  54. package/dist/context-core/context-digest.js.map +1 -0
  55. package/dist/context-core/context-envelope-builder.d.ts +2 -0
  56. package/dist/context-core/context-envelope-builder.js +99 -0
  57. package/dist/context-core/context-envelope-builder.js.map +1 -0
  58. package/dist/context-core/context-envelope-input.d.ts +34 -0
  59. package/dist/context-core/context-envelope-input.js +133 -0
  60. package/dist/context-core/context-envelope-input.js.map +1 -0
  61. package/dist/context-core/context-envelope.d.ts +62 -0
  62. package/dist/context-core/context-envelope.js +2 -0
  63. package/dist/context-core/context-envelope.js.map +1 -0
  64. package/dist/context-core/effective-context-input.d.ts +5 -0
  65. package/dist/context-core/effective-context-input.js +139 -0
  66. package/dist/context-core/effective-context-input.js.map +1 -0
  67. package/dist/context-core/effective-context-v2-input.d.ts +5 -0
  68. package/dist/context-core/effective-context-v2-input.js +158 -0
  69. package/dist/context-core/effective-context-v2-input.js.map +1 -0
  70. package/dist/context-core/effective-context-v2.d.ts +2 -0
  71. package/dist/context-core/effective-context-v2.js +95 -0
  72. package/dist/context-core/effective-context-v2.js.map +1 -0
  73. package/dist/context-core/effective-context.d.ts +3 -0
  74. package/dist/context-core/effective-context.js +57 -0
  75. package/dist/context-core/effective-context.js.map +1 -0
  76. package/dist/context-core/index.d.ts +7 -0
  77. package/dist/context-core/index.js +8 -0
  78. package/dist/context-core/index.js.map +1 -0
  79. package/dist/context-core/rule-types.d.ts +125 -0
  80. package/dist/context-core/rule-types.js +34 -0
  81. package/dist/context-core/rule-types.js.map +1 -0
  82. package/dist/context-delivery/context-delivery-store.d.ts +14 -0
  83. package/dist/context-delivery/context-delivery-store.js +56 -0
  84. package/dist/context-delivery/context-delivery-store.js.map +1 -0
  85. package/dist/context-delivery/opencode-context-hooks.d.ts +10 -0
  86. package/dist/context-delivery/opencode-context-hooks.js +105 -0
  87. package/dist/context-delivery/opencode-context-hooks.js.map +1 -0
  88. package/dist/context-profile/team-profile-model.d.ts +23 -0
  89. package/dist/context-profile/team-profile-model.js +106 -0
  90. package/dist/context-profile/team-profile-model.js.map +1 -0
  91. package/dist/context-profile/team-profile-store.d.ts +16 -0
  92. package/dist/context-profile/team-profile-store.js +27 -0
  93. package/dist/context-profile/team-profile-store.js.map +1 -0
  94. package/dist/index.js +14 -0
  95. package/dist/index.js.map +1 -1
  96. package/dist/io/tool-target.d.ts +3 -0
  97. package/dist/io/tool-target.js +69 -0
  98. package/dist/io/tool-target.js.map +1 -0
  99. package/dist/runtime/effective-profile.d.ts +1 -55
  100. package/dist/runtime/effective-profile.js +1 -222
  101. package/dist/runtime/effective-profile.js.map +1 -1
  102. package/dist/runtime/target-file.d.ts +1 -7
  103. package/dist/runtime/target-file.js +1 -84
  104. package/dist/runtime/target-file.js.map +1 -1
  105. package/docs/START-HERE.md +2 -2
  106. package/docs/current/README.md +1 -0
  107. package/docs/current/canonical-docs-index.md +1 -0
  108. package/docs/current/context-program-status.md +276 -0
  109. package/docs/current/docs-inventory.md +5 -2
  110. package/docs/current/release/consumer-authority-current-acceptance.json +40 -0
  111. package/docs/current/release/history.md +6 -4
  112. package/docs/current/release/v0.8.33-release-notes.md +23 -0
  113. package/docs/current/release/v0.8.34-release-notes.md +39 -0
  114. package/package.json +16 -4
  115. package/packages/shared-skills/package.json +1 -1
  116. package/scripts/consumer-authority-current-acceptance-schema.d.mts +32 -0
  117. package/scripts/consumer-authority-current-acceptance-schema.mjs +108 -0
  118. package/scripts/preflight-consumer-authority-external-artifact-transport.mjs +2 -2
  119. package/scripts/preflight-consumer-authority-external-attestation.mjs +2 -2
  120. package/scripts/run-default-test.mjs +27 -0
package/README.md CHANGED
@@ -87,6 +87,61 @@ A workflow + evidence CLI (`ph`) with an optional OpenCode plugin, for Java/Spri
87
87
  - can block completion when required reports or evidence for defined gates are
88
88
  missing.
89
89
 
90
+ Persona Harness exposes two deliberately separate tracks:
91
+
92
+ - **Workflow Integrity** is the existing evidence and completion-gate product.
93
+ - **Context Personalization (Experimental)** is a local, default-off path for
94
+ targeted convention guidance. When enabled in a project that has the
95
+ OpenCode plugin registered, it delivers one bounded Context block only after
96
+ a safe observed file target. It grants no completion authority.
97
+
98
+ Context configuration is separate from legacy runtime guidance switches. A
99
+ missing block stays disabled. An explicit `context.enabled` setting controls
100
+ only the targeted Context adapter; it does not enable legacy runtime guidance,
101
+ write configuration, or create workflow/evidence/authority state:
102
+
103
+ ```jsonc
104
+ {
105
+ "context": {
106
+ "enabled": false,
107
+ "mode": "targeted",
108
+ "maxCapsules": 8,
109
+ "maxChars": 1600
110
+ }
111
+ }
112
+ ```
113
+
114
+ Only `targeted` is accepted. Invalid or unknown Context fields leave Context
115
+ disabled with a bounded diagnostic; they do not inherit enablement from
116
+ `features.runtimeInjection` or `features.projectPhilosophyInjection`.
117
+
118
+ `ph context status` is available as a read-only local inspection of that
119
+ configuration and an optional safe Team Profile. `ph context preview
120
+ <target-file>` accepts a safe project-relative path without opening the target,
121
+ then renders a deterministic local Context Envelope from product invariants,
122
+ starter defaults, and any available Team or personal rules. It remains an
123
+ inspection surface: it neither enables Context nor delivers to a host.
124
+ `ph context explain <target-file>` renders the envelope's bounded selection,
125
+ shadowing, resolution, budget, and digest metadata without exposing rule text.
126
+ Both inspection commands are read-only: they do not enable Context, activate a
127
+ host adapter, or create state. Bare `ph context init` remains a no-write
128
+ preview. `ph context init --enable` creates only the minimal Context config in
129
+ a fresh safe project; it refuses to overwrite an existing harness config and
130
+ does not change legacy feature flags. `ph context doctor` reports the actual
131
+ local configuration and Team Profile state, including the bundled OpenCode 1.x
132
+ adapter. It cannot prove that a particular OpenCode session has loaded the
133
+ project plugin.
134
+
135
+ With Context enabled, the OpenCode adapter accepts only a safe observed
136
+ project-relative target from a read or edit tool. It resolves the local
137
+ envelope, rejects invalid/unsafe/budget-exceeding input without delivery, and
138
+ prepends the selected bounded capsule content to the next user message for the
139
+ same session. It suppresses the same digest until that session is compacted or
140
+ deleted. It does not infer a target from the prompt, inject a full skill
141
+ catalog, access the network, execute shell commands, or write workflow,
142
+ evidence, or authority records. The adapter's actual behavior in a live
143
+ OpenCode release remains a separate host-observation boundary.
144
+
90
145
  The optional runtime adapter also registers the bundled portable Persona-owned
91
146
  shared-skill catalog with OpenCode. Product ideas start with a one-question
92
147
  interview and explicit brief approval; adapters advise only and never create
@@ -198,15 +253,29 @@ Three-beat setup, gate, and goal-entry walkthrough: **[Quick Demo](docs/QUICK-DE
198
253
  From a source checkout, the commands have deliberately different scopes:
199
254
 
200
255
  ```bash
201
- npm test # packaged CLI smoke
202
- npm run test:unit # full Vitest unit/integration suite
203
- npm run test:repository # full repository contract: policy, docs, unit/integration, and clean-package checks
256
+ npm test # source checkout: fast tests; installed tarball: CLI smoke
257
+ npm run test:unit # focused pure resolver/config/adapter tests
258
+ npm run test:integration # focused profile/runtime/package-policy integration
259
+ npm run test:smoke # build plus packaged CLI help smoke
260
+ npm run test:package # fresh tarball and installed-package contract
261
+ npm run test:full # complete repository/release contract
262
+ npm run test:repository:parallel # parallel-safe Vitest project
263
+ npm run test:repository:resource-sensitive # isolated fixture-heavy Vitest project
264
+ npm run test:repository:fast # both PR test projects, sequentially for local use
265
+ npm run test:repository # full repository contract for release: policy, docs, all tests, and clean-package checks
204
266
  node scripts/verify-cooperative-finish-demo.mjs # exact packed-package Java/Spring Gradle/JUnit demo
205
267
  ```
206
268
 
207
- The required `Verify repository` workflow runs the full repository contract and
208
- the exact cooperative demo. These commands establish their named contracts; they
209
- do not certify generated application quality or external Finish authority.
269
+ The required `Verify repository` aggregate waits for policy, typecheck, build,
270
+ and both Vitest projects on pull requests. On `main` pushes it additionally
271
+ requires the authoritative clean-package boundary, Linux source and installed
272
+ package surfaces, and the exact cooperative demo. Release and publish workflows
273
+ retain the full `test:repository` contract. These commands establish their
274
+ named contracts; they do not certify generated application quality or external
275
+ Finish authority.
276
+
277
+ For the measured CI decision and operational failure modes, see [CI fast
278
+ feedback troubleshooting](docs/troubleshooting/ci-fast-feedback.md).
210
279
 
211
280
  ## TDD Rail (opt-in)
212
281
 
@@ -289,12 +358,12 @@ command publishes a package, moves a channel, or consumes Finish authority.
289
358
 
290
359
  | Surface | Status | Evidence boundary |
291
360
  | --- | --- | --- |
292
- | Linux + OpenCode | Product: Node ^20.17.0 || >=22.9.0; source checks: Node 20.19.0 | Required Verify repository runs Linux Node 20.19.0 source-built, packed-tarball, and fresh local-tarball installed checks on pull requests and main pushes. The dispatch-only support matrix retains exact product-floor Linux Node 20.17.0 and 22.9.0 imports plus latest Linux Node 20, 22, and 24 on demand. |
361
+ | Linux + OpenCode | Product: Node ^20.17.0 || >=22.9.0; source checks: Node 20.19.0 | Required Verify repository aggregates PR fast feedback and main package integration. Pull requests run policy, typecheck, build, and the two Vitest projects; main pushes additionally run Linux Node 20.19.0 source-built, packed-tarball, and fresh local-tarball installed checks. The dispatch-only support matrix retains exact product-floor Linux Node 20.17.0 and 22.9.0 imports plus latest Linux Node 20, 22, and 24 on demand. |
293
362
  | macOS + OpenCode | Manual limited smoke | The dispatch-only support matrix retains macOS Node 22 smoke only; this is not a promise of macOS Node 20/24 coverage. |
294
363
  | Windows | Unverified / nonblocking | No Windows matrix job or support claim. Lock identity device/inode behavior and stale-lock/concurrency conclusions are not measured or verified. |
295
364
  | Codex adapter | Planned | No current Codex adapter or Codex product evidence; this is a planned adapter only. |
296
365
 
297
- Automatic CI boundary: Verify repository is the required Linux Node 20.19.0 PR/main gate. The dispatch-only support matrix is deferred multi-runtime evidence, not a required PR/main gate. It is distinct from the canonical clean-CI builder's main-push signed evidence and the ordinary path-filtered diagnostic selftest.
366
+ Automatic CI boundary: Verify repository is the required PR/main aggregate. Pull requests require only the fast feedback lanes; main pushes also require Linux Node 20.19.0 package integration. The dispatch-only support matrix is deferred multi-runtime evidence, not a required PR/main gate. It is distinct from the canonical clean-CI builder's main-push signed evidence and the ordinary path-filtered diagnostic selftest.
298
367
 
299
368
  ## Boundaries & safety
300
369
 
@@ -2,6 +2,10 @@ function englishUsage(invocationName) {
2
2
  return [
3
3
  `Usage: ${invocationName} <command> [args...]`,
4
4
  "",
5
+ "Product tracks:",
6
+ " Workflow Integrity Evidence and completion gates.",
7
+ " Context Personalization (Experimental) Local, default-off Context guidance.",
8
+ "",
5
9
  "Public commands:",
6
10
  " version Print the packaged Persona Harness version.",
7
11
  " init Install Persona Harness config and OpenCode plugin config.",
@@ -10,6 +14,7 @@ function englishUsage(invocationName) {
10
14
  " doctor Diagnose local OpenCode and Persona Harness installation state.",
11
15
  " update Control opt-in project-local automatic Persona Harness updates.",
12
16
  " observe <path> Report Java/Spring observer findings for a file or directory.",
17
+ " context Inspect the experimental default-off Context track.",
13
18
  " authority Inspect or enroll bounded external consumer authority.",
14
19
  " feedback Write a project feedback template or capture a bounded owner dogfood event.",
15
20
  " philosophy Inspect and resolve the local personalization profile.",
@@ -25,6 +30,7 @@ function englishUsage(invocationName) {
25
30
  ` ${invocationName} update enable --yes`,
26
31
  ` ${invocationName} update repair --yes`,
27
32
  ` ${invocationName} observe src/main/java`,
33
+ ` ${invocationName} context status`,
28
34
  ` ${invocationName} authority status`,
29
35
  ` ${invocationName} feedback dogfood source-read-runtime-unavailable`,
30
36
  ` ${invocationName} philosophy status`,
@@ -34,6 +40,10 @@ function koreanUsage(invocationName) {
34
40
  return [
35
41
  `사용법: ${invocationName} <명령> [인자...]`,
36
42
  "",
43
+ "제품 트랙:",
44
+ " Workflow Integrity 근거와 완료 게이트입니다.",
45
+ " Context Personalization (Experimental) 로컬 기본 비활성 Context 안내입니다.",
46
+ "",
37
47
  "공개 명령:",
38
48
  " version 패키지된 Persona Harness 버전을 출력합니다.",
39
49
  " init Persona Harness 설정과 OpenCode 플러그인 설정을 설치합니다.",
@@ -42,6 +52,7 @@ function koreanUsage(invocationName) {
42
52
  " doctor 로컬 OpenCode 및 Persona Harness 설치 상태를 진단합니다.",
43
53
  " update 프로젝트별 자동 Persona Harness 업데이트를 제어합니다.",
44
54
  " observe <path> 파일 또는 디렉터리의 Java/Spring observer 관측 결과를 보고합니다.",
55
+ " context 실험적 기본 비활성 Context 트랙을 확인합니다.",
45
56
  " authority 제한된 외부 consumer authority 상태를 확인하거나 등록합니다.",
46
57
  " feedback 프로젝트 feedback 템플릿 또는 제한된 owner dogfood event를 기록합니다.",
47
58
  " philosophy 개인화 profile을 확인하고 결정을 append-only로 관리합니다.",
@@ -59,6 +70,7 @@ function koreanUsage(invocationName) {
59
70
  ` ${invocationName} update enable --yes`,
60
71
  ` ${invocationName} update repair --yes`,
61
72
  ` ${invocationName} observe src/main/java`,
73
+ ` ${invocationName} context status`,
62
74
  ` ${invocationName} authority status`,
63
75
  ` ${invocationName} feedback dogfood source-read-runtime-unavailable`,
64
76
  ` ${invocationName} philosophy status`,
@@ -1 +1 @@
1
- {"version":3,"file":"cli-usage.js","sourceRoot":"","sources":["../../src/cli/cli-usage.ts"],"names":[],"mappings":"AAEA,SAAS,YAAY,CAAC,cAAsB;IAC1C,OAAO;QACL,UAAU,cAAc,sBAAsB;QAC9C,EAAE;QACF,kBAAkB;QAClB,4EAA4E;QAC5E,2FAA2F;QAC3F,iGAAiG;QACjG,+HAA+H;QAC/H,gGAAgG;QAChG,gGAAgG;QAChG,8FAA8F;QAC9F,uFAAuF;QAC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QACF,mCAAmC;QACnC,EAAE;QACF,KAAK;QACL,KAAK,cAAc,UAAU;QAC7B,KAAK,cAAc,YAAY;QAC/B,KAAK,cAAc,OAAO;QAC1B,KAAK,cAAc,eAAe;QAClC,KAAK,cAAc,6BAA6B;QAChD,sCAAsC,cAAc,aAAa;QACjE,KAAK,cAAc,SAAS;QAC5B,KAAK,cAAc,sBAAsB;QACzC,KAAK,cAAc,sBAAsB;QACzC,KAAK,cAAc,wBAAwB;QAC3C,KAAK,cAAc,iBAAiB;QACpC,KAAK,cAAc,mBAAmB;QACtC,KAAK,cAAc,mDAAmD;QACtE,KAAK,cAAc,oBAAoB;KACxC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACd,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,cAAsB,EAAE,SAAwB,IAAI;IAClF,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,cAAc,CAAC,CAAA;AACrF,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { PersonalizationStoreOptions } from "./personalization-profile-store.js";
2
+ export type ContextCommandResult = {
3
+ readonly status: 0 | 1;
4
+ readonly stdout: string;
5
+ readonly stderr: string;
6
+ };
7
+ export type ContextCommandOptions = {
8
+ readonly personalization?: PersonalizationStoreOptions;
9
+ readonly projectDir?: string;
10
+ };
11
+ export declare function runContextCommand(args: readonly string[], invocationName?: string, options?: ContextCommandOptions): ContextCommandResult;
12
+ export declare function contextUsage(invocationName: string): string;
@@ -0,0 +1,62 @@
1
+ import process from "node:process";
2
+ import { runContextExplainCommand } from "./context-explain.js";
3
+ import { runContextInitCommand } from "./context-init.js";
4
+ import { runContextPreviewCommand } from "./context-preview.js";
5
+ import { renderContextDoctor } from "./context-doctor.js";
6
+ import { readContextStatus, renderContextStatus } from "./context-status.js";
7
+ export function runContextCommand(args, invocationName = "ph", options = {}) {
8
+ const command = args[0];
9
+ if (command === undefined || command === "help" || command === "--help" || command === "-h") {
10
+ return success(`${contextUsage(invocationName)}\n`);
11
+ }
12
+ if (command === "init") {
13
+ return runContextInitCommand(args.slice(1), options.projectDir ?? process.cwd());
14
+ }
15
+ if (command === "status") {
16
+ if (args.length !== 1)
17
+ return invalidArguments(invocationName);
18
+ return success(renderContextStatus(readContextStatus(options.projectDir ?? process.cwd())));
19
+ }
20
+ if (command === "doctor") {
21
+ if (args.length !== 1)
22
+ return invalidArguments(invocationName);
23
+ return success(renderContextDoctor(readContextStatus(options.projectDir ?? process.cwd())));
24
+ }
25
+ if (command === "preview") {
26
+ return runContextPreviewCommand(args.slice(1), options.projectDir ?? process.cwd(), {
27
+ personalization: options.personalization,
28
+ });
29
+ }
30
+ if (command === "explain") {
31
+ return runContextExplainCommand(args.slice(1), options.projectDir ?? process.cwd(), {
32
+ personalization: options.personalization,
33
+ });
34
+ }
35
+ return failure(`Unknown context command.\n\n${contextUsage(invocationName)}\n`);
36
+ }
37
+ export function contextUsage(invocationName) {
38
+ return [
39
+ `Usage: ${invocationName} context <init|status|preview|explain|doctor>`,
40
+ "",
41
+ "Context Personalization (Experimental, default-off)",
42
+ "",
43
+ "Commands:",
44
+ " init [--enable] Preview initialization, or explicitly create Context config.",
45
+ " status Show the bounded local Context state.",
46
+ " preview <target-file> [--json] [--project <key>] [--task <key>] [--topic <topic>]",
47
+ " explain <target-file> [--project <key>] [--task <key>] [--topic <topic>]",
48
+ " doctor Diagnose only the local Context track.",
49
+ "",
50
+ "Preview and explanation are read-only; init writes only with explicit --enable.",
51
+ ].join("\n");
52
+ }
53
+ function invalidArguments(invocationName) {
54
+ return failure(`context-arguments-invalid\n\n${contextUsage(invocationName)}\n`);
55
+ }
56
+ function success(stdout) {
57
+ return { status: 0, stdout, stderr: "" };
58
+ }
59
+ function failure(stderr) {
60
+ return { status: 1, stdout: "", stderr };
61
+ }
62
+ //# sourceMappingURL=context-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-command.js","sourceRoot":"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AAA;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,2 @@
1
+ import type { ContextStatus } from "./context-status.js";
2
+ export declare function renderContextDoctor(status: ContextStatus): string;
@@ -0,0 +1,19 @@
1
+ export function renderContextDoctor(status) {
2
+ return [
3
+ "Context Doctor (Experimental)",
4
+ `Configuration: ${status.configuration}`,
5
+ `Context enabled: ${status.contextEnabled}`,
6
+ `Context mode: ${status.mode}`,
7
+ `Context budget: maxCapsules=${status.maxCapsules} maxChars=${status.maxChars}`,
8
+ "Context Core: available",
9
+ "CLI inspection: available",
10
+ `Team Profile: ${status.teamProfile}`,
11
+ "Host adapter: bundled (OpenCode 1.x)",
12
+ "Runtime activation: safe target observed when Context is enabled",
13
+ "Network access: not used",
14
+ "Shell access: not used",
15
+ `Diagnostics: ${status.diagnostics.length === 0 ? "none" : status.diagnostics.join(", ")}`,
16
+ "",
17
+ ].join("\n");
18
+ }
19
+ //# sourceMappingURL=context-doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-doctor.js","sourceRoot":"","sources":["../../src/cli/context-doctor.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,mBAAmB,CAAC,MAAqB;IACvD,OAAO;QACL,+BAA+B;QAC/B,kBAAkB,MAAM,CAAC,aAAa,EAAE;QACxC,oBAAoB,MAAM,CAAC,cAAc,EAAE;QAC3C,iBAAiB,MAAM,CAAC,IAAI,EAAE;QAC9B,+BAA+B,MAAM,CAAC,WAAW,aAAa,MAAM,CAAC,QAAQ,EAAE;QAC/E,yBAAyB;QACzB,2BAA2B;QAC3B,iBAAiB,MAAM,CAAC,WAAW,EAAE;QACrC,sCAAsC;QACtC,kEAAkE;QAClE,0BAA0B;QAC1B,wBAAwB;QACxB,gBAAgB,MAAM,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAC1F,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACd,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type ContextPreviewOptions } from "./context-preview.js";
2
+ export type ContextExplainCommandResult = {
3
+ readonly status: 0 | 1;
4
+ readonly stderr: string;
5
+ readonly stdout: string;
6
+ };
7
+ export declare function runContextExplainCommand(args: readonly string[], projectDir: string, options?: ContextPreviewOptions): ContextExplainCommandResult;
@@ -0,0 +1,44 @@
1
+ import { readContextPreview, } from "./context-preview.js";
2
+ export function runContextExplainCommand(args, projectDir, options = {}) {
3
+ const result = readContextPreview(args, projectDir, options);
4
+ if (result.status === "blocked")
5
+ return failure(result.code);
6
+ return success(renderExplanation(result.preview));
7
+ }
8
+ function renderExplanation(preview) {
9
+ const { contextEnabled, detected, envelope, resolution } = preview;
10
+ const lines = [
11
+ "Context Explanation (Experimental)",
12
+ `Target: ${envelope.target.path}`,
13
+ `Detected language: ${detected.language}`,
14
+ `Detected file role: ${detected.fileRole}`,
15
+ `Context enabled: ${contextEnabled}`,
16
+ `Envelope status: ${envelope.status}`,
17
+ ];
18
+ if (resolution.status === "blocked") {
19
+ lines.push(`Resolution: ${resolution.reason}`);
20
+ }
21
+ else {
22
+ lines.push(...renderSelections(resolution));
23
+ lines.push(...renderShadows(resolution));
24
+ }
25
+ lines.push(`Budget: selected=${envelope.budget.usedCapsules} chars=${envelope.budget.usedChars} / capsules=${envelope.budget.maxCapsules} chars=${envelope.budget.maxChars}`, `Digest: ${envelope.digest}`);
26
+ return `${lines.join("\n")}\n`;
27
+ }
28
+ function renderSelections(preview) {
29
+ if (preview.selected.length === 0)
30
+ return ["Selected: none"];
31
+ return preview.selected.map((selection) => (`Selected: ${selection.id} topic=${selection.topic} layer=${selection.layer} reason=${selection.reason}`));
32
+ }
33
+ function renderShadows(preview) {
34
+ if (preview.shadowed.length === 0)
35
+ return ["Shadowed: none"];
36
+ return preview.shadowed.map((shadow) => (`Shadowed: ${shadow.id} -> ${shadow.winnerId} topic=${shadow.topic} reason=${shadow.reason}`));
37
+ }
38
+ function success(stdout) {
39
+ return { status: 0, stderr: "", stdout };
40
+ }
41
+ function failure(code) {
42
+ return { status: 1, stderr: `${code}\n`, stdout: "" };
43
+ }
44
+ //# sourceMappingURL=context-explain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-explain.js","sourceRoot":"","sources":["../../src/cli/context-explain.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,GAGnB,MAAM,sBAAsB,CAAA;AAQ7B,MAAM,UAAU,wBAAwB,CACtC,IAAuB,EACvB,UAAkB,EAClB,UAAiC,EAAE;IAEnC,MAAM,MAAM,GAAG,kBAAkB,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IAC5D,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC5D,OAAO,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;AACnD,CAAC;AAED,SAAS,iBAAiB,CAAC,OAA2B;IACpD,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAA;IAClE,MAAM,KAAK,GAAG;QACZ,oCAAoC;QACpC,WAAW,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE;QACjC,sBAAsB,QAAQ,CAAC,QAAQ,EAAE;QACzC,uBAAuB,QAAQ,CAAC,QAAQ,EAAE;QAC1C,oBAAoB,cAAc,EAAE;QACpC,oBAAoB,QAAQ,CAAC,MAAM,EAAE;KACtC,CAAA;IAED,IAAI,UAAU,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACpC,KAAK,CAAC,IAAI,CAAC,eAAe,UA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S,OAAO,CAAC,MAAc;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAA;AAC1C,CAAC;AAED,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;AACvD,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type ContextInitCommandResult = {
2
+ readonly status: 0 | 1;
3
+ readonly stderr: string;
4
+ readonly stdout: string;
5
+ };
6
+ export declare function runContextInitCommand(args: readonly string[], projectDir: string): ContextInitCommandResult;
@@ -0,0 +1,176 @@
1
+ import { closeSync, constants, fstatSync, fsyncSync, lstatSync, mkdirSync, openSync, rmdirSync, unlinkSync, writeFileSync, } from "node:fs";
2
+ import { join, resolve } from "node:path";
3
+ import { DEFAULT_CONTEXT_CONFIG } from "../config/context-config.js";
4
+ import { captureNoFollowDirectory, noFollowPathIdentityFromStat, sameNoFollowPathIdentity, sameNoFollowPathLocation, } from "../io/no-follow-file.js";
5
+ const CONFIG_FILE_NAME = "harness.jsonc";
6
+ const PERSONA_DIRECTORY_NAME = ".persona";
7
+ export function runContextInitCommand(args, projectDir) {
8
+ if (args.length === 0)
9
+ return preview();
10
+ if (args.length !== 1 || args[0] !== "--enable")
11
+ return failure("context-init-arguments-invalid");
12
+ const outcome = enableContext(projectDir);
13
+ if (outcome === "created")
14
+ return enabled();
15
+ if (outcome === "existing")
16
+ return failure("context-init-existing-config");
17
+ if (outcome === "unsafe")
18
+ return failure("context-init-path-unsafe");
19
+ return failure("context-init-write-unavailable");
20
+ }
21
+ function enableContext(projectDir) {
22
+ const rootPath = resolve(projectDir);
23
+ const root = captureNoFollowDirectory(rootPath);
24
+ if (root.kind !== "ready")
25
+ return "unsafe";
26
+ const persona = reservePersonaDirectory(rootPath, root.value);
27
+ if (persona === undefined)
28
+ return "unsafe";
29
+ const configPath = join(persona.path, CONFIG_FILE_NAME);
30
+ const before = inspectConfigFile(configPath);
31
+ if (before === "existing")
32
+ return "existing";
33
+ if (before === "unsafe") {
34
+ removeEmptyCreatedPersona(persona);
35
+ return "unsafe";
36
+ }
37
+ let descriptor;
38
+ let createdIdentity;
39
+ let completed = false;
40
+ try {
41
+ if (!sameDirectoryLocation(rootPath, root.value) || !sameDirectoryLocation(persona.path, persona.identity)) {
42
+ return "unsafe";
43
+ }
44
+ descriptor = openSync(configPath, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600);
45
+ const opened = fstatSync(descriptor, { bigint: true });
46
+ if (!opened.isFile())
47
+ return "unsafe";
48
+ createdIdentity = noFollowPathIdentityFromStat(opened);
49
+ writeFileSync(descriptor, contextConfigText());
50
+ fsyncSync(descriptor);
51
+ const afterWrite = noFollowPathIdentityFromStat(fstatSync(descriptor, { bigint: true }));
52
+ const pathAfterWrite = lstatSync(configPath, { bigint: true });
53
+ if (!pathAfterWrite.isFile()
54
+ || pathAfterWrite.isSymbolicLink()
55
+ || !sameNoFollowPathIdentity(afterWrite, noFollowPathIdentityFromStat(pathAfterWrite))
56
+ || !sameDirectoryLocation(rootPath, root.value)
57
+ || !sameDirectoryLocation(persona.path, persona.identity)) {
58
+ return "unsafe";
59
+ }
60
+ createdIdentity = afterWrite;
61
+ completed = true;
62
+ return "created";
63
+ }
64
+ catch (error) {
65
+ const after = inspectConfigFile(configPath);
66
+ if (after === "existing" && createdIdentity === undefined)
67
+ return "existing";
68
+ if (after === "unsafe")
69
+ return "unsafe";
70
+ return isAlreadyPresent(error) ? "existing" : "unavailable";
71
+ }
72
+ finally {
73
+ if (descriptor !== undefined)
74
+ closeSync(descriptor);
75
+ if (!completed && createdIdentity !== undefined) {
76
+ removeOwnedConfig(configPath, createdIdentity);
77
+ }
78
+ if (!completed) {
79
+ removeEmptyCreatedPersona(persona);
80
+ }
81
+ }
82
+ }
83
+ function reservePersonaDirectory(rootPath, rootIdentity) {
84
+ const personaPath = join(rootPath, PERSONA_DIRECTORY_NAME);
85
+ const existing = captureNoFollowDirectory(personaPath);
86
+ if (existing.kind === "ready")
87
+ return { created: false, identity: existing.value, path: personaPath };
88
+ if (existing.kind === "blocked")
89
+ return undefined;
90
+ let createdHere = false;
91
+ try {
92
+ mkdirSync(personaPath, { mode: 0o700 });
93
+ createdHere = true;
94
+ }
95
+ catch (error) {
96
+ if (!isAlreadyPresent(error))
97
+ return undefined;
98
+ }
99
+ const created = captureNoFollowDirectory(personaPath);
100
+ if (created.kind !== "ready" || !sameDirectoryLocation(rootPath, rootIdentity))
101
+ return undefined;
102
+ return { created: createdHere, identity: created.value, path: personaPath };
103
+ }
104
+ function inspectConfigFile(path) {
105
+ try {
106
+ const stat = lstatSync(path, { bigint: true });
107
+ return stat.isFile() && !stat.isSymbolicLink() ? "existing" : "unsafe";
108
+ }
109
+ catch (error) {
110
+ return isMissing(error) ? "absent" : "unsafe";
111
+ }
112
+ }
113
+ function sameDirectoryLocation(path, expected) {
114
+ const current = captureNoFollowDirectory(path);
115
+ return current.kind === "ready" && sameNoFollowPathLocation(current.value, expected);
116
+ }
117
+ function contextConfigText() {
118
+ return `${JSON.stringify({
119
+ context: {
120
+ enabled: true,
121
+ maxCapsules: DEFAULT_CONTEXT_CONFIG.maxCapsules,
122
+ maxChars: DEFAULT_CONTEXT_CONFIG.maxChars,
123
+ mode: DEFAULT_CONTEXT_CONFIG.mode,
124
+ },
125
+ }, null, 2)}\n`;
126
+ }
127
+ function preview() {
128
+ return success([
129
+ "Context Personalization (Experimental)",
130
+ "Initialization: preview-only",
131
+ "Context enabled: false",
132
+ "Context Core: available",
133
+ "No files were written.",
134
+ "",
135
+ ].join("\n"));
136
+ }
137
+ function enabled() {
138
+ return success([
139
+ "Context Personalization (Experimental)",
140
+ "Initialization: enabled",
141
+ "Configuration: .persona/harness.jsonc",
142
+ "Context enabled: true",
143
+ "No host adapter was activated.",
144
+ "",
145
+ ].join("\n"));
146
+ }
147
+ function success(stdout) {
148
+ return { status: 0, stderr: "", stdout };
149
+ }
150
+ function failure(code) {
151
+ return { status: 1, stderr: `${code}\n`, stdout: "" };
152
+ }
153
+ function removeOwnedConfig(path, expected) {
154
+ try {
155
+ const current = lstatSync(path, { bigint: true });
156
+ if (current.isFile() && !current.isSymbolicLink() && sameNoFollowPathLocation(expected, noFollowPathIdentityFromStat(current))) {
157
+ unlinkSync(path);
158
+ }
159
+ }
160
+ catch { }
161
+ }
162
+ function removeEmptyCreatedPersona(persona) {
163
+ if (!persona.created || !sameDirectoryLocation(persona.path, persona.identity))
164
+ return;
165
+ try {
166
+ rmdirSync(persona.path);
167
+ }
168
+ catch { }
169
+ }
170
+ function isAlreadyPresent(error) {
171
+ return error !== null && typeof error === "object" && "code" in error && error.code === "EEXIST";
172
+ }
173
+ function isMissing(error) {
174
+ return error !== null && typeof error === "object" && "code" in error && error.code === "ENOENT";
175
+ }
176
+ //# sourceMappingURL=context-init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-init.js","sourceRoot":"","sources":["../../src/cli/context-init.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,QAAQ,EACR,SAAS,EACT,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,GAEzB,MAAM,yBAAyB,CAAA;AAEhC,MAAM,gBAAgB,GAAG,eAAe,CAAA;AACxC,MAAM,sBAAsB,GAAG,UAAU,CAAA;AAgBzC,MAAM,UAAU,qBAAqB,CACnC,IAAuB,EACvB,UAAkB;IAElB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE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AAO,CAAC,OAAO,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC;QAAE,OAAM;IACtF,IAAI,CAAC;QACH,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACzB,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;AACZ,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAA;AAClG,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAA;AAClG,CAAC"}
@@ -0,0 +1,16 @@
1
+ export type ContextPreviewFormat = "json" | "text";
2
+ export type ContextPreviewRequest = {
3
+ readonly format: ContextPreviewFormat;
4
+ readonly projectKey?: string;
5
+ readonly targetPath: string;
6
+ readonly taskKey?: string;
7
+ readonly topics: readonly string[];
8
+ };
9
+ export type ContextPreviewRequestResult = {
10
+ readonly status: "ready";
11
+ readonly request: ContextPreviewRequest;
12
+ } | {
13
+ readonly status: "blocked";
14
+ readonly code: "context-preview-arguments-invalid" | "context-target-invalid" | "context-target-required";
15
+ };
16
+ export declare function parseContextPreviewRequest(args: readonly string[]): ContextPreviewRequestResult;
@@ -0,0 +1,71 @@
1
+ export function parseContextPreviewRequest(args) {
2
+ if (args.length === 0)
3
+ return { code: "context-target-required", status: "blocked" };
4
+ const targetPath = parseTargetPath(args[0]);
5
+ if (targetPath === undefined)
6
+ return { code: "context-target-invalid", status: "blocked" };
7
+ let format = "text";
8
+ let projectKey;
9
+ let taskKey;
10
+ const topics = new Set();
11
+ for (let index = 1; index < args.length; index += 1) {
12
+ const option = args[index];
13
+ if (option === "--json") {
14
+ if (format === "json")
15
+ return invalidArguments();
16
+ format = "json";
17
+ continue;
18
+ }
19
+ if (option === "--project") {
20
+ const value = optionValue(args, index);
21
+ if (value === undefined || projectKey !== undefined)
22
+ return invalidArguments();
23
+ projectKey = value;
24
+ index += 1;
25
+ continue;
26
+ }
27
+ if (option === "--task") {
28
+ const value = optionValue(args, index);
29
+ if (value === undefined || taskKey !== undefined)
30
+ return invalidArguments();
31
+ taskKey = value;
32
+ index += 1;
33
+ continue;
34
+ }
35
+ if (option === "--topic") {
36
+ const value = optionValue(args, index);
37
+ if (value === undefined)
38
+ return invalidArguments();
39
+ topics.add(value);
40
+ index += 1;
41
+ continue;
42
+ }
43
+ return invalidArguments();
44
+ }
45
+ return {
46
+ request: { format, projectKey, targetPath, taskKey, topics: [...topics].sort() },
47
+ status: "ready",
48
+ };
49
+ }
50
+ function invalidArguments() {
51
+ return { code: "context-preview-arguments-invalid", status: "blocked" };
52
+ }
53
+ function optionValue(args, optionIndex) {
54
+ const value = args[optionIndex + 1];
55
+ return value !== undefined && !value.startsWith("--") && isSafeIdentifier(value) ? value : undefined;
56
+ }
57
+ function parseTargetPath(value) {
58
+ if (value === undefined || value.length === 0 || value.length > 240 || /[\u0000-\u001f\u007f]/u.test(value))
59
+ return undefined;
60
+ const normalized = value.replaceAll("\\\\", "/");
61
+ if (normalized.startsWith("/") || /^(?:[A-Za-z]:\/|https?:\/\/)/u.test(normalized))
62
+ return undefined;
63
+ const segments = normalized.split("/");
64
+ if (segments.some((segment) => segment.length === 0 || segment === "." || segment === ".."))
65
+ return undefined;
66
+ return normalized;
67
+ }
68
+ function isSafeIdentifier(value) {
69
+ return /^[A-Za-z0-9][A-Za-z0-9._-]{0,119}$/u.test(value);
70
+ }
71
+ //# sourceMappingURL=context-preview-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-preview-request.js","sourceRoot":"","sources":["../../src/cli/context-preview-request.ts"],"names":[],"mappings":"AAiBA,MAAM,UAAU,0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