@loonglab/loongcode-cli 0.0.0-stage → 0.1.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,173 @@
1
+ # Changelog
2
+
3
+ All notable changes to LoongCode will be documented in this file.
4
+
5
+ ## [Unreleased]
6
+
7
+ ### Added
8
+
9
+ - An empty transcript now opens with a large `LOONGCODE` block wordmark and the
10
+ descriptor "an opinionated coding agent", followed by the existing keyboard
11
+ hints. The hero is a true empty state: it is centered as a group in the
12
+ transcript viewport — horizontally, and vertically within the available
13
+ transcript height (never against the whole terminal, so it cannot overlap the
14
+ composer/footer) — and it renders only while the session has no conversation
15
+ messages. The first submitted message replaces it outright, so the
16
+ conversation never appears beneath persistent branding and the hero cannot be
17
+ reached again through scrollback; `/new` or a switch to an empty session
18
+ brings it back. It scales to the terminal (5-row wordmark, then 3-row, then a
19
+ single-line fallback) and never blocks the composer, which stays focused and
20
+ usable immediately.
21
+
22
+ ### Changed
23
+
24
+ - **The product is now LoongCode.** The rename is complete across the CLI,
25
+ its runtime, its configuration and its documentation. Command, package,
26
+ binary and configuration names are all `loongcode`: the CLI is published as
27
+ `@loonglab/loongcode-cli`, the executable is `loongcode`, and the user-scope
28
+ configuration directory is `~/.loongcode/` (project-scope configuration is
29
+ `.loongcode/`). The `MINICODE_CONFIG_DIR` override is replaced by
30
+ `LOONGCODE_CONFIG_DIR`. The wordmark, help text, and agent identity all read
31
+ LoongCode. There is no compatibility shim for the previous names: the old
32
+ configuration directory and environment variable are no longer read, so an
33
+ existing installation starts from its defaults and must be pointed at its
34
+ configuration again.
35
+ - Prompt templates are now discovered live. The editor's `/` autocomplete and
36
+ template invocation read `.loongcode/prompts/*.md` (and `~/.loongcode/prompts/`)
37
+ from disk as needed, so a template added, edited, or removed while LoongCode
38
+ is running takes effect immediately with no manual refresh. Prompt contents
39
+ were already resolved from disk at invocation time.
40
+ - Project-local prompts (`.loongcode/prompts/*.md`) and skills
41
+ (`.loongcode/skills/<name>/SKILL.md`) now load unconditionally. The
42
+ per-project trust decision was removed, so no consent step is required
43
+ before these resources reach the model. Global resources under
44
+ `~/.loongcode/` are unchanged.
45
+ - `/model` is now a single command with no subcommands or argument forms. It
46
+ opens one picker that selects an existing configured model or offers
47
+ `Add model…`, which launches the guided configuration wizard. Model
48
+ selection still activates and persists through the runtime `ModelManager`;
49
+ Ctrl+P still cycles configured models. The `add`, `edit <id>`,
50
+ `remove <id>`, direct `<model-id>` activation, and `Configure models…`
51
+ forms are gone, and `/help` no longer advertises arguments.
52
+ - `/session` is now the single interactive session-management surface. It
53
+ opens a workspace-scoped manager for the current session's `cwd`, where
54
+ sessions can be opened/switched, searched, renamed, deleted, forked,
55
+ cloned, and browsed by lineage. `/new` remains the direct way to create a
56
+ session. Session management is blocked while a task or compaction is
57
+ running. `--resume <id>` and `--continue` are unchanged.
58
+
59
+ ### Removed
60
+
61
+ - Slash command `/reload`. Prompt templates are discovered live, `AGENTS.md` /
62
+ `CLAUDE.md` and agent-facing resources load on every run, so there is nothing
63
+ left to refresh manually.
64
+ - Slash command `/trust` and the project-trust mechanism behind it
65
+ (`isProjectTrusted`, `trustProject`, and the `projectTrusted` settings
66
+ key). Existing `.loongcode/settings.json` files that still contain
67
+ `projectTrusted` remain valid; the key is simply ignored.
68
+ - Slash commands `/import` and `/export`. Session portability is not a
69
+ current product need; sessions are still persisted and recovered through
70
+ `--continue`, `--resume`, and `/session`.
71
+ - Slash command `/hotkeys`. The always-visible header and `/help` already
72
+ describe the keyboard shortcuts.
73
+ - Slash commands `/login` and `/logout`. They were never authentication —
74
+ they configured and removed local models. `/model` is now the sole model
75
+ surface (select or add).
76
+ - Slash commands `/resume`, `/name`, `/tree`, `/fork`, and `/clone`. Their
77
+ capabilities now live inside the `/session` manager; they are not retained
78
+ as aliases.
79
+
80
+ ## [0.1.1] - 2026-10-12
81
+
82
+ Fixes Backspace in the terminal environments where the key arrives as a raw
83
+ `0x08` byte. It was decoded as Ctrl+Backspace whenever `WT_SESSION` was set —
84
+ an inherited environment variable, not a property of the byte stream — and no
85
+ binding wanted that key, so the editor discarded the byte and nothing was
86
+ deleted. A raw `0x08` now means plain Backspace everywhere; Ctrl+Backspace
87
+ remains distinguishable wherever the terminal encodes it explicitly.
88
+
89
+ ### Fixed
90
+
91
+ - Backspace deletes the character before the cursor when the terminal sends
92
+ `0x08` (Windows consoles, mintty/Git Bash, multiplexers, terminals started
93
+ from a Windows Terminal shell), not only when it sends `0x7F`.
94
+ - Ctrl+Backspace is bound to delete-word-backward for terminals that encode it
95
+ unambiguously (Kitty CSI-u, modifyOtherKeys). It previously matched nothing
96
+ at all, on every terminal.
97
+
98
+ ### Added
99
+
100
+ - Regression coverage for Backspace across terminal environments
101
+ (`packages/cli/src/interactive/input/backspace.test.ts`): the `0x08`/`0x7F`
102
+ matrix with `WT_SESSION` and the SSH variables present and absent, empty
103
+ input, deletion before the cursor, start-of-line merging, and both
104
+ Alt+Backspace encodings.
105
+
106
+ ## [0.1.0] - 2026-09-27
107
+
108
+ First working MiniCode coding-agent baseline: point the terminal UI at a
109
+ repository, describe a task, and the agent explores the code, edits files,
110
+ runs tests, and repairs failures until the work is verified.
111
+
112
+ ### Added
113
+
114
+ #### Core
115
+
116
+ - Coding-agent runtime: `MiniCode` root with autonomous task execution over
117
+ durable, auto-persisted sessions stored as atomic JSON snapshots.
118
+ - Agent loop with repeated model/tool interaction, maximum-iteration and
119
+ repeated-call (doom-loop) guards, and deterministic finish reasons.
120
+ - Tool execution ledger with explicit `pending → running → succeeded/failed`
121
+ lifecycle, crash-safe checkpoint ordering, and deterministic recovery of
122
+ interrupted runs (safe reissue of idempotent tools, explicit
123
+ unknown-outcome reporting otherwise).
124
+ - Orphan-process supervision and a recovery note for the model after
125
+ interrupted sessions.
126
+ - Reactive context compaction against a fixed 75/25 input/output budget
127
+ split, plus serialization-time pruning of old tool outputs.
128
+ - Runtime events (`RunEvent`) covering iterations, tool calls, results,
129
+ progress, compaction, retries, recovery, and run completion.
130
+
131
+ #### Model layer
132
+
133
+ - `ModelManager` for model configuration with atomic local JSON persistence.
134
+ - `Model` invocation over `openai` and `anthropic` protocol endpoints with
135
+ normalized streaming events, tool calls, usage, finish reasons, and errors.
136
+ - Transient-failure retry with backoff, provider-overload detection, and
137
+ cancellation propagation.
138
+ - Canonical structured message model: assistant tool-call parts and tool
139
+ results correlated by `toolCallId`, with text/JSON/error outputs.
140
+
141
+ #### Coding tools
142
+
143
+ - `read`, `write`, `edit` (whitespace/fuzzy-tolerant replacement with diffs),
144
+ `grep`, `find`, `ls`, and `bash` tools with output truncation, binary
145
+ detection, and live streaming output for long-running commands.
146
+
147
+ #### Terminal UI
148
+
149
+ - Interactive main-screen terminal UI: streaming markdown assistant output,
150
+ tool call/result rendering with live progress, working spinner, status
151
+ footer (model, context usage, workspace), input editor with history,
152
+ multiline input, and `@file` path completion with content embedding.
153
+ - Interaction semantics: Enter submits (and steers a running task),
154
+ Alt+Enter queues follow-ups, Esc interrupts, Ctrl+C/Ctrl+D exit,
155
+ Ctrl+O toggles tool output, Ctrl+P cycles models.
156
+ - Slash commands: `/help`, `/model`, `/login`, `/logout`, `/new`, `/resume`,
157
+ `/name`, `/session`, `/compact`, `/copy`, `/export`, `/import`, `/trust`,
158
+ `/reload`, `/fork`, `/clone`, `/tree`, `/hotkeys`, `/quit`.
159
+ - Session replay on load; session persistence survives interruption.
160
+
161
+ #### Non-interactive
162
+
163
+ - Print mode (`-p`) and JSON event mode (`--mode json`) for single-shot and
164
+ scripted usage.
165
+ - Session continuation flags (`--continue`, `--resume`).
166
+
167
+ #### Project & resources
168
+
169
+ - Project instruction loading (`AGENTS.md` / `CLAUDE.md`) into the system
170
+ prompt.
171
+ - Global and project settings with deterministic deep-merge precedence.
172
+ - Prompt templates and skills as user/project resources, gated behind an
173
+ explicit project-trust decision for project-local content.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,47 @@
1
- # Temporary Holding Version
1
+ # LoongCode
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ An opinionated coding agent that works directly in your repository. Give it a
4
+ software task — fix a failing test, refactor a module, track down a bug — and
5
+ it explores the code, makes changes, runs commands, and verifies its own work
6
+ in an interactive terminal UI.
7
+
8
+ ## Install
9
+
10
+ [Node.js](https://nodejs.org) 22 or newer is required (npm ships with it).
11
+ LoongCode is a single platform-independent package: the same install works on
12
+ Windows, macOS, and Linux, on both x64 and arm64.
13
+
14
+ ```sh
15
+ npm install -g @loonglab/loongcode-cli
16
+ cd my-project
17
+ loongcode
18
+ ```
19
+
20
+ On first launch no model is active, and LoongCode says so: it opens the setup
21
+ flow (protocol `openai` or `anthropic`, endpoint, model name, API key) before
22
+ the workspace appears, and the normal interface is not reachable until a model
23
+ is active. `/model` is that same flow — it lists the models you have configured
24
+ and offers `Add model…` for a new one. Context and output limits are defaulted,
25
+ and only exposed under an optional *Configure limits…* step. Cancelling setup
26
+ exits; a task you had already typed is not run and is not saved.
27
+
28
+ ## Scripting
29
+
30
+ ```sh
31
+ loongcode -p "run the tests and report failures" # print mode
32
+ loongcode --mode json -p "find TODO comments" # JSON event stream
33
+ loongcode -c -p "now fix what you found" # continue last session
34
+ ```
35
+
36
+ ## Project instructions
37
+
38
+ `AGENTS.md` (or `CLAUDE.md`) in the repository root is loaded into the
39
+ agent's system prompt. `.loongcode/settings.json`, `.loongcode/prompts/*.md`
40
+ and `.loongcode/skills/<name>/SKILL.md` add project settings, prompt
41
+ templates, and skills (loaded automatically).
42
+
43
+ Configuration and sessions live under your user config directory
44
+ (`~/.loongcode/`) — never inside
45
+ this package.
46
+
47
+ See the repository README for the full product documentation.