@lore-co/cli 0.1.3 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # Lore CLI
2
2
 
3
- The Lore connector installs native Codex and Claude Code lifecycle hooks. For
4
- each supported prompt, Lore attempts to retrieve relevant engineering context.
5
- A first prompt is observed on its own; later prompts are paired with the
6
- previous assistant response when valid pending state is available. Hook and
7
- network failures fail open so they do not block the agent.
3
+ The Lore connector installs native Codex and Claude Code lifecycle hooks and
4
+ the Lore OpenCode plugin. For each supported prompt, Lore attempts to retrieve
5
+ relevant engineering context. A first prompt is observed on its own; later
6
+ prompts are paired with the previous assistant response when valid pending
7
+ state is available. Integration and network failures fail open so they do not
8
+ block the agent.
8
9
 
9
10
  ## Install and connect
10
11
 
@@ -15,21 +16,46 @@ lore connect \
15
16
  --url https://lore.example.com \
16
17
  --token "$LORE_WORKSPACE_TOKEN" \
17
18
  --agent claude \
18
- --agent codex
19
+ --agent codex \
20
+ --agent opencode
19
21
 
20
22
  lore doctor
21
23
  ```
22
24
 
23
25
  The package requires Node.js 22 or newer and installs the `lore` command.
24
26
 
25
- `connect` auto-detects `codex` and `claude`. Use `--agent codex` or
26
- `--agent claude` for an explicit headless install. Configuration is stored in
27
- `~/.lore/config.json` with mode `0600`.
27
+ `connect` auto-detects the `codex`, `claude`, and `opencode` executables and an
28
+ existing `~/.config/opencode/opencode.json`. Repeat `--agent claude`,
29
+ `--agent codex`, or `--agent opencode` for an explicit headless install.
30
+ Configuration is stored in `~/.lore/config.json` with mode `0600`.
31
+ Before writing that file or any agent integration, `connect` calls the
32
+ authenticated workspace identity endpoint and validates the strict response
33
+ and server version. Revoked credentials, unreachable servers, timeouts, and
34
+ incompatible servers leave local configuration untouched. Either
35
+ `LORE_WORKSPACE_TOKEN` or the legacy `LORE_TOKEN` can provide the token; if
36
+ both are set, they must match.
37
+ For a review-first rollout in a personal vault or component catalog, follow the
38
+ [OpenCode pilot runbook](../../docs/opencode-pilot.md).
39
+
40
+ ## Update the standalone CLI
41
+
42
+ ```sh
43
+ lore update
44
+ lore update --version v0.1.8
45
+ ```
46
+
47
+ `update` resolves the latest release to an exact tag, or uses the exact
48
+ v-prefixed semantic version passed with `--version`. It verifies the selected
49
+ binary against that release's `SHA256SUMS` and checks the staged binary's
50
+ version before replacing the current target. `LORE_REPO` selects another
51
+ GitHub repository and `LORE_RELEASE_BASE_URL` selects an HTTPS release mirror;
52
+ `LORE_BIN_DIR` overrides the standalone install directory.
28
53
 
29
54
  The command merges Lore-owned entries into `~/.codex/hooks.json` and
30
- `~/.claude/settings.json`. Existing settings and hooks are retained, changed
31
- files receive timestamped backups, and rerunning `connect` does not duplicate
32
- entries.
55
+ `~/.claude/settings.json`, and merges `@lore-co/opencode` into the
56
+ `plugin` array in `~/.config/opencode/opencode.json`. Existing settings, hooks,
57
+ keys, and plugins are retained. Changed agent config files receive timestamped
58
+ backups, and rerunning `connect` does not duplicate entries or backups.
33
59
 
34
60
  ## Inspect or remove
35
61
 
@@ -39,14 +65,44 @@ lore doctor
39
65
  lore disconnect
40
66
  ```
41
67
 
42
- The three commands above also support `--json`. `disconnect` removes only hook handlers
43
- marked as Lore-owned, then deletes Lore's credential, legacy hook runtime,
44
- pending state, and retry queue. It does not remove the installed `lore` binary
45
- or restore a whole backup over newer agent settings.
68
+ The three commands above also support `--json`. `doctor` checks public
69
+ `/health/ready` separately from authenticated workspace identity so unreachable,
70
+ unready, and unauthorized states remain distinct. `disconnect` removes only hook
71
+ handlers marked as Lore-owned and Lore's OpenCode plugin entry, then deletes
72
+ Lore's credential, legacy hook runtime, pending state, and retry queue. It does
73
+ not remove the installed `lore` binary or restore a whole backup over newer
74
+ agent settings.
75
+
76
+ ## One-command self-hosting
77
+
78
+ The published CLI embeds the canonical production Compose asset, so no
79
+ repository clone is needed:
80
+
81
+ ```sh
82
+ lore self-host up
83
+ lore self-host status --json
84
+ lore self-host down
85
+ ```
86
+
87
+ `up` creates `~/.lore/self-host` with mode `0700` and stores its Compose,
88
+ environment, and state files with mode `0600`. It generates a PostgreSQL secret,
89
+ starts semver-pinned images, waits for `/health/ready`, and prints the signup and
90
+ login URLs. Sign up normally, then create connector tokens on **Connect**.
91
+ Loopback deployments write magic links to the API container logs; public origins
92
+ require `RESEND_API_KEY` and `AUTH_EMAIL_FROM`. Retries reuse all state and
93
+ secrets. `--headless` additionally generates an environment-provisioned
94
+ workspace token because no dashboard is available. Use `--state-dir`,
95
+ `--image-tag`, `--api-port`, `--dashboard-port`, and `--origin` for dashboard
96
+ deployments; `--organization` and `--name` configure headless workspaces. Every
97
+ command has subcommand-specific `--help`, and `up`, `down`, and `status` support
98
+ `--json`.
99
+
100
+ `down` preserves the PostgreSQL volume. Destructive removal requires both
101
+ `--volumes --yes`.
46
102
 
47
103
  ## Runtime behavior
48
104
 
49
- The hook handler:
105
+ The Claude/Codex command-hook handler:
50
106
 
51
107
  - reads native hook JSON from standard input;
52
108
  - observes and enriches the first prompt in a new session;
@@ -58,12 +114,19 @@ The hook handler:
58
114
 
59
115
  First prompts use `POST /v1/observations` and audited
60
116
  `POST /v1/context/deliveries`. Paired turns use `POST /v1/turns` with a
61
- workspace bearer token and an `Idempotency-Key` header. Teachings default to
62
- workspace scope so connected agents can share them; the inferred repository
63
- still guides task retrieval. A correction made in one native repository is
64
- therefore workspace-global by default; only an integration that supplies a
65
- narrower learning scope changes that behavior. Observations, paired turns, and
66
- deliveries are visible through Lore activity.
117
+ workspace bearer token and an `Idempotency-Key` header. Automatic teachings
118
+ default to repository scope and follow the workspace learning policy. In
119
+ `proposal_only` mode, every automatic capture remains proposed and cannot be
120
+ retrieved or injected until dashboard review activates it. Rejected,
121
+ suppressed, superseded, and deleted learnings are also excluded. Dirty files
122
+ and the current directory remain task relevance evidence and do not narrow
123
+ every learning. A reconciled correction inherits its target's scope. Only an
124
+ explicit correction with clear team-, company-, organization-, or
125
+ all-repositories evidence may become organization-only and apply across
126
+ repositories. Native retrieval still requires a strong lexical, structural,
127
+ symbol, or semantic match. Observations, paired turns, OpenCode plugin events,
128
+ and deliveries are visible through Lore activity. OpenCode uses its plugin
129
+ lifecycle and never runs through the Claude/Codex command-hook parser.
67
130
 
68
131
  ## External hosts
69
132
 
@@ -163,7 +226,7 @@ same-repository, non-draft pull requests bearing the corresponding
163
226
  `lore:codex-review` or `lore:devin-review` label.
164
227
 
165
228
  Generated jobs require a published standalone binary release and default to
166
- `treadiehq/lore` at `v0.1.3`. Set `LORE_CLI_REPOSITORY` to the publicly
229
+ `treadiehq/lore` at `v0.1.8`. Set `LORE_CLI_REPOSITORY` to the publicly
167
230
  readable `owner/repository` and `LORE_CLI_VERSION` to an existing release tag
168
231
  when using another release source.
169
232
 
package/dist/cli.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { type AgentName } from "./runtime.js";
2
+ import { type CommandHookAgentName } from "./runtime.js";
3
+ export declare const LORE_OPENCODE_PLUGIN = "@lore-co/opencode";
4
+ declare const CONFIGURED_AGENT_NAMES: readonly ["claude", "codex", "opencode"];
5
+ export type ConfiguredAgentName = (typeof CONFIGURED_AGENT_NAMES)[number];
3
6
  export interface LorePaths {
4
7
  home: string;
5
8
  loreDirectory: string;
@@ -11,19 +14,24 @@ export interface LorePaths {
11
14
  queue: string;
12
15
  codexHooks: string;
13
16
  claudeSettings: string;
17
+ openCodeConfig: string;
14
18
  }
15
19
  export interface ConnectorConfig {
16
20
  version: 1;
17
21
  apiUrl: string;
18
22
  dashboardUrl?: string;
19
23
  token: string;
20
- agents: AgentName[];
24
+ agents: ConfiguredAgentName[];
21
25
  connectedAt: string;
22
26
  timeoutMs: number;
23
27
  }
24
28
  export declare function getLorePaths(home?: string): LorePaths;
25
- export declare function mergeLoreHooks(input: Record<string, unknown>, agent: AgentName, paths: LorePaths): Record<string, unknown>;
29
+ export declare function mergeLoreHooks(input: Record<string, unknown>, agent: CommandHookAgentName, paths: LorePaths): Record<string, unknown>;
26
30
  export declare function removeLoreHooks(input: Record<string, unknown>): Record<string, unknown>;
27
31
  export declare function countLoreHooks(input: Record<string, unknown>): number;
32
+ export declare function mergeLoreOpenCodePlugin(input: Record<string, unknown>): Record<string, unknown>;
33
+ export declare function removeLoreOpenCodePlugin(input: Record<string, unknown>): Record<string, unknown>;
34
+ export declare function countLoreOpenCodePlugins(input: Record<string, unknown>): number;
28
35
  export declare function runCli(args?: readonly string[]): Promise<void>;
36
+ export {};
29
37
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAmBA,OAAO,EACL,KAAK,SAAS,EAEf,MAAM,cAAc,CAAC;AAYtB,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,CAAC,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AA+HD,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAerD;AA2DD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,KA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