layrith 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.
- package/LICENSE +60 -0
- package/README.md +339 -0
- package/layrith.js +223 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
Layrith Proprietary License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Codevaani. All rights reserved.
|
|
4
|
+
|
|
5
|
+
This software, including all source code, binaries, prompts, documentation, assets,
|
|
6
|
+
configuration, names, branding, and related materials in this repository, is proprietary
|
|
7
|
+
and confidential.
|
|
8
|
+
|
|
9
|
+
1. Ownership
|
|
10
|
+
|
|
11
|
+
The Software is licensed, not sold. Codevaani and its licensors retain all right, title,
|
|
12
|
+
and interest in and to the Software.
|
|
13
|
+
|
|
14
|
+
2. Permitted use
|
|
15
|
+
|
|
16
|
+
You may install and use an authorized copy of the Software only as expressly permitted by
|
|
17
|
+
Codevaani.
|
|
18
|
+
|
|
19
|
+
3. Restrictions
|
|
20
|
+
|
|
21
|
+
Except with prior written permission from Codevaani, you may not:
|
|
22
|
+
|
|
23
|
+
- copy, modify, adapt, translate, or create derivative works of the Software;
|
|
24
|
+
- distribute, sublicense, lease, rent, lend, sell, assign, publish, or otherwise make the
|
|
25
|
+
Software available to any third party;
|
|
26
|
+
- reverse engineer, decompile, disassemble, or attempt to derive source code, underlying
|
|
27
|
+
ideas, algorithms, or trade secrets from the Software, except where such restriction is
|
|
28
|
+
prohibited by applicable law;
|
|
29
|
+
- use any part of the Software, including its prompts, output formatting, branding, or
|
|
30
|
+
implementation, to build, train, improve, or offer a competing product or service;
|
|
31
|
+
- remove or alter any proprietary notices, labels, or branding;
|
|
32
|
+
- use the Software except through an authorized distribution channel approved by Codevaani.
|
|
33
|
+
|
|
34
|
+
4. No redistribution
|
|
35
|
+
|
|
36
|
+
Redistribution of the Software, whether in source or binary form, is prohibited.
|
|
37
|
+
|
|
38
|
+
5. No open source grant
|
|
39
|
+
|
|
40
|
+
No open source license is granted. No implied licenses are granted under this License.
|
|
41
|
+
|
|
42
|
+
6. Termination
|
|
43
|
+
|
|
44
|
+
Any breach of this License automatically terminates your rights under it. Upon termination,
|
|
45
|
+
you must stop using the Software and delete all copies in your possession or control.
|
|
46
|
+
|
|
47
|
+
7. Disclaimer
|
|
48
|
+
|
|
49
|
+
THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, TO
|
|
50
|
+
THE MAXIMUM EXTENT PERMITTED BY LAW.
|
|
51
|
+
|
|
52
|
+
8. Limitation of liability
|
|
53
|
+
|
|
54
|
+
TO THE MAXIMUM EXTENT PERMITTED BY LAW, CODEVAANI SHALL NOT BE LIABLE FOR ANY INDIRECT,
|
|
55
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ARISING FROM OR RELATED TO THE
|
|
56
|
+
SOFTWARE OR THIS LICENSE.
|
|
57
|
+
|
|
58
|
+
9. Reservation of rights
|
|
59
|
+
|
|
60
|
+
All rights not expressly granted are reserved by Codevaani.
|
package/README.md
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
# LAYRITH CLI
|
|
2
|
+
|
|
3
|
+
LAYRITH CLI is a Bun-based natural language coding assistant that runs inside your terminal. It is built for interactive project work: reading code, editing files, resuming sessions, switching models, and working against OpenAI-compatible or Anthropic-compatible runtimes from a local configuration file.
|
|
4
|
+
|
|
5
|
+
## What It Does
|
|
6
|
+
|
|
7
|
+
- Starts an interactive coding REPL with a custom terminal UI
|
|
8
|
+
- Guides first-time users through runtime setup when required config is missing
|
|
9
|
+
- Supports both browser-based Layrith login and direct API-key setup
|
|
10
|
+
- Supports OpenAI-compatible and Anthropic-compatible providers
|
|
11
|
+
- Lets users switch models from inside the CLI with `/model`
|
|
12
|
+
- Stores chat history in user-level SQLite for resume flows
|
|
13
|
+
- Includes slash commands for help, clear, resume, model switching, MCP inspection, compaction, agent management, project initialization, and exit
|
|
14
|
+
- Exposes local file tools and web search, with unsafe shell execution disabled by default
|
|
15
|
+
|
|
16
|
+
## Current Status
|
|
17
|
+
|
|
18
|
+
This project is an active local CLI app, not a polished package release yet. The codebase already includes the REPL, setup wizard, runtime client, session storage, tools manifest, and documentation, but the primary development flow is still local:
|
|
19
|
+
|
|
20
|
+
- install dependencies
|
|
21
|
+
- configure runtime credentials
|
|
22
|
+
- run `bun run dev`
|
|
23
|
+
|
|
24
|
+
## Requirements
|
|
25
|
+
|
|
26
|
+
- [Bun](https://bun.sh) installed
|
|
27
|
+
- A compatible model backend
|
|
28
|
+
- API credentials for that backend
|
|
29
|
+
|
|
30
|
+
Supported runtime modes:
|
|
31
|
+
|
|
32
|
+
- `openai-compatible`
|
|
33
|
+
- `anthropic-compatible`
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
bun install
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Run
|
|
42
|
+
|
|
43
|
+
Development entrypoint:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
bun run dev
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Direct chat command:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
bun run chat
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Run the Next.js web app used by browser auth:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
bun run web:dev
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Explicit command form:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
bun run index.ts chat
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Full CLI help:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
bun run index.ts --help
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## First Run Setup
|
|
74
|
+
|
|
75
|
+
When you start chat without runtime config, LAYRITH CLI opens an interactive setup wizard in TTY mode. The wizard now lets you:
|
|
76
|
+
|
|
77
|
+
1. choose `Continue with Layrith CLI` or `Use own API key`
|
|
78
|
+
2. for browser auth, open the Next.js web app and approve the waiting CLI session
|
|
79
|
+
3. for direct setup, choose a provider and enter `baseUrl`, `apiKey`, and `model`
|
|
80
|
+
4. test the direct configuration with a simple request
|
|
81
|
+
5. save the working configuration
|
|
82
|
+
|
|
83
|
+
Saved user runtime settings go to:
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
%USERPROFILE%\.layrith\settings.json
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Saved MCP server entries go to:
|
|
90
|
+
|
|
91
|
+
```text
|
|
92
|
+
%USERPROFILE%\.layrith\mcp.json
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
If the app is started in a non-interactive context and config is missing, it exits early with a clear runtime configuration error instead of trying to open the wizard.
|
|
96
|
+
|
|
97
|
+
Browser auth notes:
|
|
98
|
+
|
|
99
|
+
- the web app route is `/auth/cli`
|
|
100
|
+
- by default the CLI opens `http://127.0.0.1:3000/auth/cli`
|
|
101
|
+
- override the site origin with `LAYRITH_WEB_AUTH_URL`
|
|
102
|
+
- optionally lock hosted runtime defaults with `LAYRITH_HOSTED_PROVIDER`, `LAYRITH_HOSTED_BASE_URL`, `LAYRITH_HOSTED_MODEL`, and `LAYRITH_HOSTED_API_KEY`
|
|
103
|
+
|
|
104
|
+
## Configuration
|
|
105
|
+
|
|
106
|
+
Settings can be read from:
|
|
107
|
+
|
|
108
|
+
- workspace: `.layrith/settings.json`
|
|
109
|
+
- user runtime settings: `%USERPROFILE%\.layrith\settings.json`
|
|
110
|
+
- user MCP servers: `%USERPROFILE%\.layrith\mcp.json`
|
|
111
|
+
|
|
112
|
+
Priority order:
|
|
113
|
+
|
|
114
|
+
1. default values
|
|
115
|
+
2. user runtime settings
|
|
116
|
+
3. user MCP settings
|
|
117
|
+
4. workspace settings
|
|
118
|
+
5. environment variables
|
|
119
|
+
|
|
120
|
+
Required runtime fields before chat can start:
|
|
121
|
+
|
|
122
|
+
- `runtime.baseUrl`
|
|
123
|
+
- `runtime.apiKey`
|
|
124
|
+
- `runtime.model`
|
|
125
|
+
|
|
126
|
+
`runtime.provider` is still important, but it defaults to `openai-compatible` when not explicitly set.
|
|
127
|
+
|
|
128
|
+
Example:
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"runtime": {
|
|
133
|
+
"provider": "openai-compatible",
|
|
134
|
+
"baseUrl": "http://localhost:20128/v1",
|
|
135
|
+
"apiKey": "your-api-key",
|
|
136
|
+
"model": "your-model-name"
|
|
137
|
+
},
|
|
138
|
+
"shell": {
|
|
139
|
+
"enableUnsafeCommands": false
|
|
140
|
+
},
|
|
141
|
+
"webSearch": {
|
|
142
|
+
"endpoint": "https://html.duckduckgo.com/html/",
|
|
143
|
+
"maxResults": 5
|
|
144
|
+
},
|
|
145
|
+
"ui": {
|
|
146
|
+
"showShellStatusLine": true,
|
|
147
|
+
"animateNonInteractiveThinking": true,
|
|
148
|
+
"ctrlCConfirmTimeoutMs": 2000
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
User-level MCP servers live in a separate file:
|
|
154
|
+
|
|
155
|
+
```json
|
|
156
|
+
{
|
|
157
|
+
"servers": {
|
|
158
|
+
"filesystem": {
|
|
159
|
+
"command": "npx",
|
|
160
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."],
|
|
161
|
+
"env": {},
|
|
162
|
+
"enabled": true
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Supported environment variable overrides:
|
|
169
|
+
|
|
170
|
+
- `LAYRITH_BASE_URL`
|
|
171
|
+
- `LAYRITH_API_KEY`
|
|
172
|
+
- `LAYRITH_MODEL`
|
|
173
|
+
- `LAYRITH_ENABLE_UNSAFE_COMMAND_TOOL`
|
|
174
|
+
- `LAYRITH_WEB_SEARCH_ENDPOINT`
|
|
175
|
+
- `LAYRITH_WEB_SEARCH_MAX_RESULTS`
|
|
176
|
+
|
|
177
|
+
Compatibility aliases also exist for some OpenAI-style env vars in runtime settings resolution.
|
|
178
|
+
|
|
179
|
+
## Slash Commands
|
|
180
|
+
|
|
181
|
+
The interactive REPL currently supports:
|
|
182
|
+
|
|
183
|
+
- `/help` to show available commands
|
|
184
|
+
- `/clear` to clear the terminal view
|
|
185
|
+
- `/resume` to open the session picker and restore a saved conversation
|
|
186
|
+
- `/model` to pick or switch the active model
|
|
187
|
+
- `/mcp` to inspect configured MCP servers, list tools, or reload discovery
|
|
188
|
+
- `/compact` to ask the active model to summarize older conversation history into a compact continuation summary while keeping recent turns available
|
|
189
|
+
- `/exit` to close the session
|
|
190
|
+
- `/quit` to close the session
|
|
191
|
+
|
|
192
|
+
The input UI also supports:
|
|
193
|
+
|
|
194
|
+
- arrow key navigation for command and picker flows
|
|
195
|
+
- tab completion for slash commands
|
|
196
|
+
- double `Ctrl+C` confirmation before closing
|
|
197
|
+
- `@{relative/path/to/file}` to attach a workspace file directly into the prompt
|
|
198
|
+
- `@` file suggestions with arrow-key selection and `Tab` completion in the interactive REPL
|
|
199
|
+
|
|
200
|
+
## Top-Level Commands
|
|
201
|
+
|
|
202
|
+
LAYRITH CLI now exposes a larger command surface from the root binary:
|
|
203
|
+
|
|
204
|
+
- `chat` starts the interactive coding REPL
|
|
205
|
+
- `login` opens the runtime setup flow, including browser auth
|
|
206
|
+
- `logout` removes saved user runtime credentials
|
|
207
|
+
- `mcp` lets you add, list, remove, and inspect external MCP servers
|
|
208
|
+
|
|
209
|
+
MCP entries saved by the CLI are written to `%USERPROFILE%\.layrith\mcp.json`.
|
|
210
|
+
|
|
211
|
+
Useful MCP commands:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
bun run index.ts mcp list
|
|
215
|
+
bun run index.ts mcp add github npx -y @modelcontextprotocol/server-github
|
|
216
|
+
bun run index.ts mcp tools github
|
|
217
|
+
bun run index.ts mcp remove github
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Sessions And Resume
|
|
221
|
+
|
|
222
|
+
Conversation data is stored at the user level, not inside workspace settings:
|
|
223
|
+
|
|
224
|
+
```text
|
|
225
|
+
%USERPROFILE%\.layrith\sessions.sqlite
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
This allows:
|
|
229
|
+
|
|
230
|
+
- resuming old conversations
|
|
231
|
+
- workspace-aware session filtering
|
|
232
|
+
- a session picker for `/resume`
|
|
233
|
+
|
|
234
|
+
The runtime settings file stays JSON, while session data uses SQLite.
|
|
235
|
+
|
|
236
|
+
## Tools And Safety
|
|
237
|
+
|
|
238
|
+
The tool layer is manifest-driven. The active manifest used by the runtime lives at:
|
|
239
|
+
|
|
240
|
+
```text
|
|
241
|
+
src/tools/tools.json
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Core tool behavior includes:
|
|
245
|
+
|
|
246
|
+
- file read, edit, replace, and delete operations scoped to the workspace
|
|
247
|
+
- web search support
|
|
248
|
+
- optional unsafe shell tool gating
|
|
249
|
+
|
|
250
|
+
Unsafe shell execution is off by default. It only becomes available when explicitly enabled through configuration or environment overrides.
|
|
251
|
+
|
|
252
|
+
## Web Search
|
|
253
|
+
|
|
254
|
+
The CLI includes a `web_search` tool backed by a configurable endpoint. By default it uses DuckDuckGo HTML search. Search settings are controlled through:
|
|
255
|
+
|
|
256
|
+
- `webSearch.endpoint`
|
|
257
|
+
- `webSearch.maxResults`
|
|
258
|
+
|
|
259
|
+
This is intended for quick result fetching inside the agent loop, not full browser automation.
|
|
260
|
+
|
|
261
|
+
## Project Structure
|
|
262
|
+
|
|
263
|
+
High-level layout:
|
|
264
|
+
|
|
265
|
+
```text
|
|
266
|
+
src/
|
|
267
|
+
agent/ orchestration loop and tool execution flow
|
|
268
|
+
config/ settings loading, merge, validation, and persistence helpers
|
|
269
|
+
repl/ interactive UI, output rendering, command handling, session picker
|
|
270
|
+
runtime/ provider-specific request handling
|
|
271
|
+
setup/ first-run setup wizard
|
|
272
|
+
system-prompts/ modular default prompt files
|
|
273
|
+
tools/ tool loading, manifest, and executor
|
|
274
|
+
docs/ public-facing product docs
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Main entrypoints:
|
|
278
|
+
|
|
279
|
+
- `index.ts`
|
|
280
|
+
- `src/index.ts`
|
|
281
|
+
|
|
282
|
+
## Development Notes
|
|
283
|
+
|
|
284
|
+
- The package is Bun-first and uses TypeScript
|
|
285
|
+
- The app is launched through Commander
|
|
286
|
+
- The REPL is custom-rendered for terminal interaction instead of using a browser UI
|
|
287
|
+
- Session persistence and setup are already integrated into the runtime flow
|
|
288
|
+
|
|
289
|
+
Useful commands:
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
bun install
|
|
293
|
+
bun run dev
|
|
294
|
+
bun run chat
|
|
295
|
+
bun x tsc --noEmit
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## Documentation Map
|
|
299
|
+
|
|
300
|
+
Detailed docs live in `docs/`:
|
|
301
|
+
|
|
302
|
+
- `docs/01-overview.md`
|
|
303
|
+
- `docs/02-getting-started.md`
|
|
304
|
+
- `docs/03-configuration.md`
|
|
305
|
+
- `docs/04-first-run-setup.md`
|
|
306
|
+
- `docs/05-slash-commands.md`
|
|
307
|
+
- `docs/06-model-selection.md`
|
|
308
|
+
- `docs/07-sessions-and-history.md`
|
|
309
|
+
- `docs/08-tools-and-safety.md`
|
|
310
|
+
- `docs/09-web-search.md`
|
|
311
|
+
- `docs/10-architecture.md`
|
|
312
|
+
- `docs/11-troubleshooting.md`
|
|
313
|
+
|
|
314
|
+
## Troubleshooting
|
|
315
|
+
|
|
316
|
+
If chat does not start:
|
|
317
|
+
|
|
318
|
+
- check that `runtime.baseUrl`, `runtime.apiKey`, and `runtime.model` are set
|
|
319
|
+
- verify the selected provider matches the backend you are calling
|
|
320
|
+
- run `bun x tsc --noEmit` to catch TypeScript issues
|
|
321
|
+
- confirm your user settings file exists at `%USERPROFILE%\.layrith\settings.json`
|
|
322
|
+
|
|
323
|
+
If `/resume` does not show expected conversations:
|
|
324
|
+
|
|
325
|
+
- confirm session data exists in `%USERPROFILE%\.layrith\sessions.sqlite`
|
|
326
|
+
- make sure the saved session belongs to the current workspace
|
|
327
|
+
|
|
328
|
+
If the shell tool does not appear:
|
|
329
|
+
|
|
330
|
+
- that is expected unless unsafe commands are explicitly enabled
|
|
331
|
+
|
|
332
|
+
## License / Release Notes
|
|
333
|
+
|
|
334
|
+
No formal package publishing or release workflow is documented in this repository yet. If this project is going public, the next recommended steps are:
|
|
335
|
+
|
|
336
|
+
1. add a license
|
|
337
|
+
2. clean generated session data from version control
|
|
338
|
+
3. add contribution and release notes
|
|
339
|
+
4. tighten README examples around safe public setup
|