@lore-co/cli 0.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.
Files changed (55) hide show
  1. package/LICENSE +110 -0
  2. package/README.md +218 -0
  3. package/dist/cli.d.ts +28 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +792 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/devin-client.d.ts +63 -0
  8. package/dist/devin-client.d.ts.map +1 -0
  9. package/dist/devin-client.js +231 -0
  10. package/dist/devin-client.js.map +1 -0
  11. package/dist/devin.d.ts +2 -0
  12. package/dist/devin.d.ts.map +1 -0
  13. package/dist/devin.js +479 -0
  14. package/dist/devin.js.map +1 -0
  15. package/dist/generated-assets.d.ts +7 -0
  16. package/dist/generated-assets.d.ts.map +1 -0
  17. package/dist/generated-assets.js +8 -0
  18. package/dist/generated-assets.js.map +1 -0
  19. package/dist/github.d.ts +13 -0
  20. package/dist/github.d.ts.map +1 -0
  21. package/dist/github.js +559 -0
  22. package/dist/github.js.map +1 -0
  23. package/dist/host.d.ts +24 -0
  24. package/dist/host.d.ts.map +1 -0
  25. package/dist/host.js +337 -0
  26. package/dist/host.js.map +1 -0
  27. package/dist/index.d.ts +8 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +8 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/main.d.ts +2 -0
  32. package/dist/main.d.ts.map +1 -0
  33. package/dist/main.js +10 -0
  34. package/dist/main.js.map +1 -0
  35. package/dist/repository.d.ts +3 -0
  36. package/dist/repository.d.ts.map +1 -0
  37. package/dist/repository.js +60 -0
  38. package/dist/repository.js.map +1 -0
  39. package/dist/review-output.d.ts +59 -0
  40. package/dist/review-output.d.ts.map +1 -0
  41. package/dist/review-output.js +112 -0
  42. package/dist/review-output.js.map +1 -0
  43. package/dist/runtime.d.ts +63 -0
  44. package/dist/runtime.d.ts.map +1 -0
  45. package/dist/runtime.js +612 -0
  46. package/dist/runtime.js.map +1 -0
  47. package/dist/update.d.ts +2 -0
  48. package/dist/update.d.ts.map +1 -0
  49. package/dist/update.js +97 -0
  50. package/dist/update.js.map +1 -0
  51. package/dist/version.d.ts +3 -0
  52. package/dist/version.d.ts.map +1 -0
  53. package/dist/version.js +6 -0
  54. package/dist/version.js.map +1 -0
  55. package/package.json +47 -0
package/LICENSE ADDED
@@ -0,0 +1,110 @@
1
+ # Functional Source License, Version 1.1
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-MIT
6
+
7
+ ## Notice
8
+
9
+ Copyright (c) 2026 Treadie, Inc
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the MIT license that is effective on the second anniversary of the date we make
91
+ the Software available. On or after that date, you may use the Software under
92
+ the MIT license, in which case the following will apply:
93
+
94
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
95
+ this software and associated documentation files (the "Software"), to deal in
96
+ the Software without restriction, including without limitation the rights to
97
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
98
+ of the Software, and to permit persons to whom the Software is furnished to do
99
+ so, subject to the following conditions:
100
+
101
+ The above copyright notice and this permission notice shall be included in all
102
+ copies or substantial portions of the Software.
103
+
104
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
105
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
106
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
107
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
108
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
109
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
110
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,218 @@
1
+ # Lore CLI
2
+
3
+ The Lore connector installs native Codex and Claude Code lifecycle hooks. Every
4
+ prompt retrieves relevant engineering context. A first prompt is observed on
5
+ its own; later prompts are paired with the previous assistant response so Lore
6
+ can capture explicit corrections.
7
+
8
+ ## Connect
9
+
10
+ ```sh
11
+ curl -fsSL https://raw.githubusercontent.com/treadiehq/lore/main/scripts/install.sh | bash
12
+ lore connect \
13
+ --url https://lore.example.com \
14
+ --token "$LORE_TOKEN"
15
+ ```
16
+
17
+ The standalone binary supports macOS and Linux on x64 and arm64. Downloads are
18
+ verified against the release SHA-256 manifest and do not require a JavaScript
19
+ runtime. Use `lore update` to install a newer release.
20
+
21
+ The npm package remains available for JavaScript-based environments:
22
+
23
+ ```sh
24
+ npx @lore-co/cli connect \
25
+ --url https://lore.example.com \
26
+ --token "$LORE_TOKEN"
27
+ ```
28
+
29
+ Only the npm package scope is `@lore-co`; the installed executable and every
30
+ command remain `lore`.
31
+
32
+ `connect` auto-detects `codex` and `claude`. Use `--agent codex` or
33
+ `--agent claude` for an explicit headless install. Configuration is stored in
34
+ `~/.lore/config.json` with mode `0600`.
35
+
36
+ The command merges Lore-owned entries into `~/.codex/hooks.json` and
37
+ `~/.claude/settings.json`. Existing settings and hooks are retained, changed
38
+ files receive timestamped backups, and rerunning `connect` does not duplicate
39
+ entries.
40
+
41
+ ## Inspect or remove
42
+
43
+ ```sh
44
+ lore status
45
+ lore doctor
46
+ lore disconnect
47
+ ```
48
+
49
+ All commands also support `--json`. `disconnect` removes only hook handlers
50
+ marked as Lore-owned, then deletes Lore's credential, legacy hook runtime,
51
+ pending state, and retry queue. It does not remove the installed `lore` binary
52
+ or restore a whole backup over newer agent settings.
53
+
54
+ ## Runtime behavior
55
+
56
+ The hook handler:
57
+
58
+ - reads native hook JSON from standard input;
59
+ - observes and enriches the first prompt in a new session;
60
+ - uses `last_assistant_message`, not a potentially stale transcript;
61
+ - stores pending state and failed turn requests under `~/.lore`;
62
+ - retries one queued request on a later prompt;
63
+ - redacts common API keys, bearer tokens, passwords, and private keys;
64
+ - times out network calls and always fails open without writing hook errors.
65
+
66
+ First prompts use `POST /v1/observations` and audited
67
+ `POST /v1/context/deliveries`. Paired turns use `POST /v1/turns` with a
68
+ workspace bearer token and an `Idempotency-Key` header. Teachings default to
69
+ workspace scope so connected agents can share them; the inferred repository
70
+ still guides task retrieval. A correction made in one native repository is
71
+ therefore workspace-global by default; only an integration that supplies a
72
+ narrower learning scope changes that behavior. Observations, paired turns, and
73
+ deliveries are visible through Lore activity.
74
+
75
+ ## External hosts
76
+
77
+ `lore host` gives local services and CI jobs a noninteractive bridge to the
78
+ strict audited endpoints:
79
+
80
+ ```sh
81
+ LORE_API_URL=http://localhost:3004 \
82
+ LORE_WORKSPACE_TOKEN=... \
83
+ lore host deliver --input delivery.json --output prompt
84
+
85
+ cat webhook-observation.json |
86
+ lore host observe --input - --output json
87
+
88
+ lore host turn --input incident-turn.json \
89
+ --idempotency-key incident-42:reply-3 \
90
+ --output prompt
91
+ ```
92
+
93
+ `deliver`, `observe`, and `turn` accept the exact JSON bodies for
94
+ `POST /v1/context/deliveries`, `POST /v1/observations`, and `POST /v1/turns`.
95
+ There is no interactive or implicit-stdin fallback: pass `--input <file|->`.
96
+ `json` output contains the complete audited response; `context` prints only
97
+ returned context; `prompt` safely places that context before the original task
98
+ or current user prompt. Standard output contains only the selected result.
99
+
100
+ Authentication comes from `LORE_API_URL` plus `LORE_WORKSPACE_TOKEN` (or
101
+ `LORE_TOKEN`), or `~/.lore/config.json`. Secret command-line flags are
102
+ intentionally unavailable. Requests have a bounded timeout. Run
103
+ `lore host --help` and `lore host turn --help` for endpoint-specific examples.
104
+ Use stable connector, event, and session IDs from the calling model service,
105
+ CI run, webhook, or incident; do not generate a new event ID when retrying.
106
+ This bridge is a one-time host integration: the host must call it before and
107
+ after model turns. `lore connect` cannot intercept an arbitrary external model
108
+ API or bot by itself. The Lore web/wiki service is optional; the bridge needs
109
+ only a reachable headless Lore API.
110
+
111
+ ## Devin sessions
112
+
113
+ Create a Lore-enriched Devin session, then send later prompts through the same
114
+ audited context-delivery path:
115
+
116
+ ```sh
117
+ DEVIN_API_KEY=... DEVIN_ORG_ID=... \
118
+ lore devin start \
119
+ --repo owner/repository \
120
+ --prompt "Fix the failing tests"
121
+
122
+ DEVIN_API_KEY=... DEVIN_ORG_ID=... \
123
+ lore devin prompt \
124
+ --session devin-session-id \
125
+ --repo owner/repository \
126
+ --prompt "Apply the reviewer correction"
127
+ ```
128
+
129
+ Both commands retrieve Lore context with a stable delivery event and receipt.
130
+ `devin start` registers the created session for transcript polling.
131
+ `devin prompt` re-registers the session before sending, so a paused poller can
132
+ capture the later correction. Prompts can also come from `--prompt-file` or
133
+ explicit `--stdin`; `--project` narrows retrieval and polling. Use
134
+ `--message-as-user-id` on `devin prompt` when Devin impersonation is configured.
135
+ Later prompts entered directly in Devin's UI do not pass through Lore delivery
136
+ and are not enriched. If the session was registered, transcript polling can
137
+ still capture a correction after the fact.
138
+
139
+ Lore credentials come from `LORE_API_URL` plus `LORE_WORKSPACE_TOKEN`, or from
140
+ the stored `~/.lore/config.json`. Devin credentials come from `DEVIN_API_KEY`
141
+ and `DEVIN_ORG_ID`. Credential flags are intentionally unavailable. Run
142
+ `lore devin start --help` or `lore devin prompt --help` for copy-pasteable
143
+ examples.
144
+
145
+ ## GitHub reviews
146
+
147
+ Install Lore-owned Codex and Devin review workflows into the current
148
+ repository:
149
+
150
+ ```sh
151
+ OPENAI_API_KEY=... DEVIN_API_KEY=... DEVIN_ORG_ID=org-... \
152
+ lore connect github \
153
+ --repo owner/repository \
154
+ --configure-secrets
155
+ ```
156
+
157
+ The installer copies trusted workflow and output-schema templates without
158
+ committing them. Codex uses the official Codex action. Devin uses a normal v3
159
+ session because the dedicated Devin Review API cannot accept dynamic Lore
160
+ context. Reviews run only for same-repository, non-draft pull requests bearing
161
+ the corresponding `lore:codex-review` or `lore:devin-review` label.
162
+
163
+ Generated jobs download a pinned standalone release. Set repository variable
164
+ `LORE_CLI_VERSION` to the release tag and, when using a fork, set
165
+ `LORE_CLI_REPOSITORY` to its `owner/repository` value. The installer verifies
166
+ the downloaded binary before each job invokes `lore` directly.
167
+
168
+ The workflows require secret `LORE_WORKSPACE_TOKEN` and variable
169
+ `LORE_API_URL`. Codex additionally requires secret `OPENAI_API_KEY`. Devin
170
+ additionally requires secret `DEVIN_API_KEY` and variable `DEVIN_ORG_ID`.
171
+ Review jobs use `contents: read` plus `pull-requests: write` so the workflow
172
+ token can inspect and publish PR comments; the correction workflow has
173
+ read-only GitHub permissions.
174
+ Native `/devin review` cannot accept dynamic Lore context; the generated Lore
175
+ workflow uses a normal capped Devin session instead. The optional managed
176
+ plugin remains a closed-beta path controlled by Devin availability.
177
+
178
+ An authorized maintainer can turn a false-positive bot comment into shared
179
+ knowledge with:
180
+
181
+ ```text
182
+ /lore correct <Lore bot comment URL>
183
+
184
+ The correction and current behavior go here.
185
+ ```
186
+
187
+ ## Release acceptance
188
+
189
+ From the repository root, deterministic unit/integration checks, browser
190
+ acceptance, and package-consumer smoke are:
191
+
192
+ ```sh
193
+ pnpm test
194
+ pnpm typecheck
195
+ pnpm build
196
+ pnpm test:browser
197
+ pnpm test:pack
198
+ pnpm build:binary
199
+ pnpm test:binary
200
+ ```
201
+
202
+ Credential-gated live commands are explicit and separate:
203
+
204
+ ```sh
205
+ RUN_NATIVE_AGENT_LIVE_TESTS=1 pnpm test:agents:live
206
+ RUN_DEVIN_LIVE_TESTS=1 pnpm test:devin:live
207
+ RUN_THREE_AGENT_CHAIN_LIVE_TESTS=RUN pnpm test:chain:live
208
+ RUN_GITHUB_PR_LIVE_TESTS=1 pnpm test:github:live
209
+ ```
210
+
211
+ The native command covers first prompts and real resumed later turns in both
212
+ Claude and Codex. The chain command covers Claude → Devin → fresh Codex and
213
+ Claude. Both paths, plus standalone Devin acceptance, have passed with real
214
+ authenticated clients. Both GitHub review/correction paths passed target
215
+ preflight and exact-head acceptance with a packed current artifact on August
216
+ 13, 2026. The current acceptance gate preflights a published standalone release.
217
+ Rerun all live gates with customer credentials before rollout.
218
+ Lore has no dream mode or company-wide search.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+ import { type AgentName } from "./runtime.js";
3
+ export interface LorePaths {
4
+ home: string;
5
+ loreDirectory: string;
6
+ config: string;
7
+ runtime: string;
8
+ runtimeRepository: string;
9
+ runtimePackage: string;
10
+ state: string;
11
+ queue: string;
12
+ codexHooks: string;
13
+ claudeSettings: string;
14
+ }
15
+ export interface ConnectorConfig {
16
+ version: 1;
17
+ apiUrl: string;
18
+ token: string;
19
+ agents: AgentName[];
20
+ connectedAt: string;
21
+ timeoutMs: number;
22
+ }
23
+ export declare function getLorePaths(home?: string): LorePaths;
24
+ export declare function mergeLoreHooks(input: Record<string, unknown>, agent: AgentName, paths: LorePaths): Record<string, unknown>;
25
+ export declare function removeLoreHooks(input: Record<string, unknown>): Record<string, unknown>;
26
+ export declare function countLoreHooks(input: Record<string, unknown>): number;
27
+ export declare function runCli(args?: readonly string[]): Promise<void>;
28
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAmBA,OAAO,EACL,KAAK,SAAS,EAEf,MAAM,cAAc,CAAC;AAWtB,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,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AA2HD,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAerD;AA2DD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,SAAS,GACf,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBzB;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsBzB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAiBrE;AA6mBD,wBAAsB,MAAM,CAC1B,IAAI,GAAE,SAAS,MAAM,EAA0B,GAC9C,OAAO,CAAC,IAAI,CAAC,CA8Cf"}