@phyzess/pappra 0.1.0-beta.2 → 0.1.0-beta.4

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 (36) hide show
  1. package/README.md +24 -7
  2. package/dist/app/doctor.js +2 -2
  3. package/dist/app/init.d.ts +28 -0
  4. package/dist/app/init.js +419 -88
  5. package/dist/cli/commands/docs.d.ts +1 -0
  6. package/dist/cli/commands/docs.js +104 -3
  7. package/dist/cli/commands/host.d.ts +3 -1
  8. package/dist/cli/commands/host.js +50 -2
  9. package/dist/cli/commands/init.d.ts +8 -0
  10. package/dist/cli/commands/init.js +186 -9
  11. package/dist/cli/commands/runtime.d.ts +14 -0
  12. package/dist/cli/commands/runtime.js +263 -0
  13. package/dist/cli/run.js +134 -7
  14. package/dist/hosts/detect.d.ts +1 -0
  15. package/dist/hosts/detect.js +1 -1
  16. package/dist/hosts/integration/bundle-export.d.ts +22 -0
  17. package/dist/hosts/integration/bundle-export.js +114 -0
  18. package/dist/hosts/integration/bundle.d.ts +4 -1
  19. package/dist/hosts/integration/bundle.js +20 -2
  20. package/dist/hosts/integration/pappra-extension-runtime.mjs +24605 -0
  21. package/dist/hosts/integration/pappra-hook.mjs +24723 -0
  22. package/dist/hosts/integration/service.d.ts +8 -0
  23. package/dist/hosts/integration/service.js +62 -30
  24. package/dist/hosts/integration/templates.d.ts +3 -3
  25. package/dist/hosts/integration/templates.js +15 -10
  26. package/dist/hosts/pilot.d.ts +77 -77
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.js +1 -1
  29. package/dist/install/runtime.d.ts +1 -1
  30. package/dist/install/runtime.js +117 -10
  31. package/dist/package-info.d.ts +2 -0
  32. package/dist/package-info.js +6 -0
  33. package/dist/schemas/host.js +4 -2
  34. package/dist/schemas/install.d.ts +14 -0
  35. package/dist/schemas/install.js +8 -0
  36. package/package.json +8 -2
package/README.md CHANGED
@@ -27,14 +27,31 @@ npx @phyzess/pappra@beta doctor --json
27
27
 
28
28
  `examples/minimal-choices.json` is complete for a host-free, no-graph, single-directory workspace. The example intentionally has no repositories or optional hosts.
29
29
 
30
- `init --json` without `--config` fails closed because JSON mode does not open the interactive wizard; run `npx @phyzess/pappra@beta init` without `--json` in a TTY if you want to enter selections interactively. `--config` and `--json` never prompt.
30
+ For a non-interactive derived setup, `npx @phyzess/pappra@beta init --yes --apply --json` derives repositories, knowledge sources, code engine, validation commands, excludes and hosts from discovery. `--print-choices` prints that `pappra/init-choices/1` document and writes nothing, and `init --json` without selections returns the discovery candidates plus the suggested document. JSON mode never prompts; only a TTY without selections opens the wizard.
31
31
 
32
32
  Development from a checkout works the same way: `pnpm install --frozen-lockfile`, `pnpm build`, then invoke `dist/cli/main.js` by absolute path from the target workspace.
33
33
 
34
- An apply result can be `ok:true` with `status:"external-actions-pending"` and a
35
- nonzero process exit. That is a successful, partial configuration write, not a
36
- claim that a runtime or external tool was installed. Inspect `pendingExternalActions`
37
- and run `doctor` before adding optional integrations.
34
+ `init --apply` also installs a durable runtime copy of the executing package under the
35
+ Pappra data directory and binds it in `machine.json`, so an npx/dlx bootstrap survives
36
+ cache eviction and the command converges with exit code `0`. Pass `--no-runtime` to leave
37
+ that action pending instead; the result is then `ok:true` with
38
+ `status:"external-actions-pending"` and a nonzero exit, which is a partial configuration
39
+ write rather than a claim that a runtime exists.
40
+
41
+ The runtime copy can be managed directly:
42
+
43
+ ```sh
44
+ npx @phyzess/pappra@beta runtime install --apply [--from self|tarball|registry]
45
+ npx @phyzess/pappra@beta runtime status --json
46
+ npx @phyzess/pappra@beta runtime verify --json
47
+ ```
48
+
49
+ A workspace that already has a valid `.pappra/workspace.json` is never rewritten silently.
50
+ `init --yes --reconfigure --apply` rebuilds it from discovery (for example to move the
51
+ recorded runtime version to the running package), backing the previous file up under
52
+ `.pappra/local/backups`. Apply also reports advisory `nextActions`: `pappra code prepare`
53
+ for a selected code engine and `pappra docs scan --apply` to register documents from the
54
+ configured knowledge sources.
38
55
 
39
56
  Optional examples have prerequisites rather than generated files: code-graph and
40
57
  host commands require the selected external CLI/support, and collaboration
@@ -46,7 +63,7 @@ requires an explicit controller. They are not needed for the core workflow above
46
63
  - **Knowledge:** workspace and private document catalogs with explicit preview/apply operations.
47
64
  - **Continuity:** private task checkpoints and bounded advisory resume packets. Resume never grants execution by itself.
48
65
  - **Code intelligence:** status, explicit preparation and bounded query for selected repositories. Text/structure fallback is available when the optional graph engine is absent.
49
- - **Host integrations:** optional Pi, Codex and Claude Code adapters that merge Pappra-owned entries without taking over user configuration.
66
+ - **Host integrations:** optional Pi, Codex and Claude Code adapters that merge Pappra-owned entries without taking over user configuration. Hooks are copied as a dependency-free bundle into the host root; `host bundle` exports a native plugin/package directory without registering it. `host install --mode plugin` fails closed until plugin registration and callability are verified.
50
67
  - **Bounded collaboration:** an optional, explicitly controlled one-request workflow. It is not a scheduler or daemon.
51
68
 
52
69
  ## Optional integrations and support
@@ -70,7 +87,7 @@ The check runs the source policy, type checks, formatting, deterministic tests a
70
87
 
71
88
  ## Status and limits
72
89
 
73
- Pappra is development software (`0.1.0-beta.2`) published as `@phyzess/pappra` under the `beta` dist-tag. Releases are published from GitHub Actions with npm trusted publishing (OIDC), so no npm token is stored in this repository. Pin either the moving `beta` tag or an exact version such as `@phyzess/pappra@0.1.0-beta.2`, because pre-release versions are never republished.
90
+ Pappra is development software (`0.1.0-beta.4`) published as `@phyzess/pappra` under the `beta` dist-tag. Releases are published from GitHub Actions with npm trusted publishing (OIDC), so no npm token is stored in this repository. Pin either the moving `beta` tag or an exact version such as `@phyzess/pappra@0.1.0-beta.4`, because pre-release versions are never republished.
74
91
 
75
92
  The deterministic suite covers synthetic workspaces, fixtures and local process boundaries. It does not establish real-model behavior, native host callability on every platform, CodeGraph completeness, Windows/Linux parity or production performance. A host adapter version pin is an observed support claim, not proof that a particular native installation will load or run correctly.
76
93
 
@@ -259,7 +259,7 @@ function runtimeCheck(targetVersion, machineRuntime, passive, machinePath, obser
259
259
  source: machinePath ?? dataDir,
260
260
  observedAt,
261
261
  nextActions: [
262
- 'Run an explicit pappra init --apply --install-runtime with a chosen local tarball or exact version when authorized.',
262
+ 'Run pappra runtime install --apply (from self, tarball, or an exact version) or pappra init --apply when authorized.',
263
263
  ],
264
264
  });
265
265
  }
@@ -335,7 +335,7 @@ function runtimeCheck(targetVersion, machineRuntime, passive, machinePath, obser
335
335
  ]
336
336
  : [],
337
337
  nextActions: [
338
- 'Run an explicit pappra init --apply --install-runtime with a chosen local tarball or exact version when authorized.',
338
+ 'Run pappra runtime install --apply (from self, tarball, or an exact version) or pappra init --apply when authorized.',
339
339
  ],
340
340
  });
341
341
  }
@@ -14,6 +14,8 @@ export interface InitFailure {
14
14
  readonly message: string;
15
15
  readonly diagnostics: readonly Diagnostic[];
16
16
  readonly nextAction: string | null;
17
+ /** Machine-readable payload for callers that cannot prompt. */
18
+ readonly details?: Readonly<Record<string, unknown>>;
17
19
  }
18
20
  export interface InitRootResolution {
19
21
  readonly requestedRoot: string;
@@ -114,6 +116,8 @@ export interface PlanInitOptions {
114
116
  readonly root: string;
115
117
  readonly choices?: InitChoices | null;
116
118
  readonly runtimeVersion?: string;
119
+ /** Rebuilds workspace.json from selections even when a valid config exists. */
120
+ readonly reconfigure?: boolean;
117
121
  readonly planId?: string;
118
122
  readonly discoveredAt?: string;
119
123
  /** Reuse an immediately preceding inspectInitContext result. */
@@ -130,6 +134,30 @@ export declare function inspectInitContext(rootPath: string): Promise<InitContex
130
134
  export declare function listRepositoryCandidates(discovery: WorkspaceDiscovery): readonly RepositoryCandidate[];
131
135
  /** Lists knowledge source choices derived only from current discovery. */
132
136
  export declare function listKnowledgeCandidates(discovery: WorkspaceDiscovery): readonly KnowledgeCandidate[];
137
+ export interface InitChoiceRule {
138
+ readonly field: string;
139
+ readonly value: string;
140
+ readonly reason: string;
141
+ }
142
+ export interface InitChoiceCandidates {
143
+ readonly repositories: readonly string[];
144
+ readonly knowledge: readonly string[];
145
+ readonly validation: readonly string[];
146
+ readonly hosts: readonly string[];
147
+ }
148
+ export interface DerivedInitChoices {
149
+ readonly choices: InitChoices;
150
+ readonly rules: readonly InitChoiceRule[];
151
+ readonly candidates: InitChoiceCandidates;
152
+ }
153
+ /**
154
+ * Derives deterministic init selections from discovery alone. Every value is
155
+ * reported with the rule that produced it so a caller can audit the choice
156
+ * before applying it; nothing here writes, installs or prompts.
157
+ */
158
+ export declare function deriveInitChoices(discovery: WorkspaceDiscovery, options?: {
159
+ readonly pathEnv?: string;
160
+ }): Promise<DerivedInitChoices>;
133
161
  /**
134
162
  * Produces a strict plan and exact in-memory writes. No target file is created
135
163
  * or modified by this function.