@lumpcode/cli 0.0.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 ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Lumpcode
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,192 @@
1
+ # Lumpcode CLI
2
+
3
+ **Lumpcode is a tool to automate batched coding work** — large refactors, codemods, ticket queues, doc sweeps — by running your CLI coding agent (Claude Code, Aider, Codex, …) over many similar units of work in your repo, **one git branch per batch** for normal review.
4
+
5
+ > *Named after the **lumpfish**: a small cleaner fish that salmon farmers add to their pens to quietly pick parasites off the salmon. Lumpcode plays the same role in your codebase — steadily working through the long tail of repetitive coding chores (codemods, doc updates, missing tests) one batch at a time, not overflowing you with PRs, while you stay focused on you code.*
6
+
7
+ A **lump** is one such campaign (e.g. "migrate every component to Vue"). It contains many **contexts** — Lumpcode's word for *units of work*: one component, one ticket, or a group of related files each — plus a prompt (or list of prompts) and an agent command. Each finished context is recorded with a fixed **marker commit** subject `LUMP: <lumpName> - <contextName>`, so repeated runs are **resumable** from remote git history after merges and reviews.
8
+
9
+ **Use Lumpcode when** you have many similar edits (migrations, tests, docs), an ordered ticket queue, or a long-running refactor you want to tick forward on a schedule. However, Lumpcode is highly configurable and you can shape it easily to your custom needs.
10
+
11
+ **New here?** Read [DOCS/concepts.md](DOCS/concepts.md) (two minutes), then [DOCS/get-started.md](DOCS/get-started.md).
12
+
13
+ ## Install
14
+
15
+ Pick the option that fits your setup (see [lumpcode.com](https://lumpcode.com) for current installers):
16
+
17
+ - **macOS (Homebrew):** `brew install lumpcode`
18
+ - **Linux / macOS (curl):** follow the one-liner on the website
19
+ - **Windows:** download the installer or binary from the website
20
+ - **npm (Node 22+):** `npm install -g @lumpcode/cli@beta`
21
+
22
+ During pre-launch, npm packages use the `beta` dist-tag. Omit `@beta` once `latest` is promoted.
23
+
24
+ The npm package installs a `lumpcode` command that uses a **native binary for your OS when one is available** from the matching release; otherwise it runs the bundled CLI with Node. No extra steps are required.
25
+
26
+ Operators can set `LUMPCODE_SKIP_BINARY=1` to skip the native download, `LUMPCODE_INSTALL_VERBOSE=1` for install diagnostics, or `LUMPCODE_INSTALL_REPO` to override the GitHub release source when configuring downloads.
27
+
28
+ ## Before you run anything
29
+
30
+ You will need:
31
+
32
+ - **A Lumpcode account** — sign up at [lumpcode.com](https://lumpcode.com); `lumpcode login` will prompt for credentials.
33
+ - A project on your machine **with git push access to `origin`** for the repository you want to automate. The `baseBranch` you pick (e.g. `main`) must already exist on the remote — Lumpcode reads it via `origin/<baseBranch>`.
34
+ - **A CLI coding agent on your `PATH`** — verify with e.g. `claude --version` or `aider --version`. Lumpcode invokes the agent through a **command module** registered by name (e.g. `claude`, `aider`) under `.lumpcode/commands/<name>.js` or `~/.lumpcode/commands/<name>.js`. See [DOCS/advanced-config.md](DOCS/advanced-config.md#custom-agent-commands).
35
+ - **An understanding that `lumpcode run` calls your agent**, which usually means real LLM cost. Start with one context, review the resulting branch, then scale up.
36
+
37
+ ## 60-second tour
38
+
39
+ From the root of a git repository:
40
+
41
+ ```bash
42
+ lumpcode login
43
+ lumpcode project-setup
44
+ lumpcode lump-create myFirstLump
45
+ ```
46
+
47
+ Edit `.lumpcode/lumps/myFirstLump/config.json` (see the [React-component example below](#configjson-example-one-branch-per-react-component)), then:
48
+
49
+ ```bash
50
+ lumpcode run myFirstLump
51
+ ```
52
+
53
+ This runs your agent on **one** context, commits a `LUMP: myFirstLump - …` marker, and pushes a `lump/myFirstLump/…` branch to `origin` for review.
54
+
55
+ Step-by-step: [DOCS/get-started.md](DOCS/get-started.md).
56
+
57
+ ### Run continuously as a deamon
58
+
59
+ Once a one-off `run` works end to end, have a background daemon tick every lump on a cron (default: every 5 minutes):
60
+
61
+ ```bash
62
+ lumpcode start # detached background daemon
63
+ lumpcode daemon-status # is it running?
64
+ lumpcode stop # SIGTERM + cleanup
65
+ ```
66
+
67
+ Because the daemon keeps invoking your agent on every tick, **cap parallel work** with `maximumNumberOfConcurrentBranches` (per lump or in `project.json`) and set `"disabled": true` on a lump to take it out of the rotation without stopping the scheduler.
68
+
69
+ Sporadic `run` vs sustained `start`: [DOCS/concepts.md#when-to-use-run-vs-start-daemon](DOCS/concepts.md#when-to-use-run-vs-start-daemon).
70
+
71
+ ## How one `run` fits together
72
+
73
+ ```mermaid
74
+ flowchart LR
75
+ start["lumpcode run myFirstLump"]
76
+ discover["Discover contexts"]
77
+ checkout["Work branch<br/>lump/myFirstLump/..."]
78
+ agent["Run agent"]
79
+ commit["Commit LUMP: myFirstLump - ..."]
80
+ push["Push origin"]
81
+ refresh["Update context status cache"]
82
+ start --> discover --> checkout --> agent --> commit --> push --> refresh
83
+ ```
84
+
85
+
86
+
87
+ ## `config.json` example: one branch per React component
88
+
89
+ Suppose your repo has one folder per React component, each with the same three related files:
90
+
91
+ ```text
92
+ src/components/
93
+ ├── Button/
94
+ │ ├── Button.tsx
95
+ │ ├── Button.types.ts
96
+ │ └── Button.test.tsx
97
+ ├── Card/
98
+ │ ├── Card.tsx
99
+ │ ├── Card.types.ts
100
+ │ └── Card.test.tsx
101
+ └── Modal/
102
+ ├── Modal.tsx
103
+ ├── Modal.types.ts
104
+ └── Modal.test.tsx
105
+ ```
106
+
107
+ `.lumpcode/lumps/myFirstLump/config.json`:
108
+
109
+ ```json
110
+ {
111
+ "$schema": "https://lumpcode.com/schemas/lumpConfig.schema.json",
112
+ "baseBranch": "main",
113
+ "contextListJson": {
114
+ "COMPONENT": "src/components/{COMPONENT_NAME}/{COMPONENT_NAME}.tsx",
115
+ "TYPES": "src/components/{COMPONENT_NAME}/{COMPONENT_NAME}.types.ts",
116
+ "TEST": "src/components/{COMPONENT_NAME}/{COMPONENT_NAME}.test.tsx"
117
+ },
118
+ "prompt": {
119
+ "promptTemplate": "Tighten the prop types in @{COMPONENT} (declared in @{TYPES}) and add any missing assertions to @{TEST}.",
120
+ "command": "claude"
121
+ }
122
+ }
123
+ ```
124
+
125
+ Lumpcode scans the tree and finds every value `{COMPONENT_NAME}` can take such that **all three rows resolve to a real file**. With the tree above, that's three contexts — one per component:
126
+
127
+
128
+ | Context name | `{COMPONENT}` | `{TYPES}` | `{TEST}` |
129
+ | ------------ | ---------------------------------- | --------------------------------------- | --------------------------------------- |
130
+ | `Button` | `src/components/Button/Button.tsx` | `src/components/Button/Button.types.ts` | `src/components/Button/Button.test.tsx` |
131
+ | `Card` | `src/components/Card/Card.tsx` | `src/components/Card/Card.types.ts` | `src/components/Card/Card.test.tsx` |
132
+ | `Modal` | `src/components/Modal/Modal.tsx` | `src/components/Modal/Modal.types.ts` | `src/components/Modal/Modal.test.tsx` |
133
+
134
+
135
+ Each context becomes one work branch (`lump/myFirstLump/Button`, …) and one marker commit (`LUMP: myFirstLump - Button`, …) on `origin`. A component missing any of the three files is silently skipped — that row would fail to match.
136
+
137
+ - `contextListJson` — Each value is a **path template** with `{PLACEHOLDER}` captures; each key (here `COMPONENT`, `TYPES`, `TEST`) becomes a variable usable in the prompt as `{COMPONENT}`, `{TYPES}`, `{TEST}`. See [DOCS/lump-config.md#contextlistjson](DOCS/lump-config.md#contextlistjson).
138
+ - `promptTemplate` — `{VAR}` substitutes the literal value; e.g you can safely use `@{VAR}` to have the same value with a leading `@` for agents that treat `@path` as file context. See [DOCS/lump-config.md#prompt-template-syntax](DOCS/lump-config.md#prompt-template-syntax).
139
+ - `command` — Registered [command name](DOCS/lump-config.md#command-names) only (`"claude"`, `"aider"`, …), not shell flags ([DOCS/advanced-config.md#custom-agent-commands](DOCS/advanced-config.md#custom-agent-commands)).
140
+ - `$schema` — Optional but recommended: most editors will then autocomplete and validate every field above.
141
+
142
+ ## TypeScript hints for `config.js` and command modules
143
+
144
+ Optional npm package `[@lumpcode/cli-types](https://www.npmjs.com/package/@lumpcode/cli-types)` ships `defineConfig`, `defineCommand`, and other thin helpers plus the same types the CLI uses for lump config and `.lumpcode/commands/*.js`. See [DOCS/lump-config.md — Typed JavaScript config](DOCS/lump-config.md#typed-javascript-config-optional).
145
+
146
+ ## Where to next
147
+
148
+
149
+ | Doc | Contents |
150
+ | -------------------------------------------------- | ---------------------------------------------------------------------------------- |
151
+ | [DOCS/concepts.md](DOCS/concepts.md) | Project, lump, context, branch, context status; `run` vs `start`; workspace copies |
152
+ | [DOCS/get-started.md](DOCS/get-started.md) | Zero → first successful `lumpcode run` |
153
+ | [DOCS/commands.md](DOCS/commands.md) | Every subcommand and flag |
154
+ | [DOCS/project-config.md](DOCS/project-config.md) | `.lumpcode/project.json` |
155
+ | [DOCS/lump-config.md](DOCS/lump-config.md) | `config.json` / `config.js` fields |
156
+ | [DOCS/advanced-config.md](DOCS/advanced-config.md) | Hooks, dynamic `steps`, custom commands |
157
+ | [DOCS/examples.md](DOCS/examples.md) | Ready-made lump shapes (smoke test, migration, tickets, codemods, docs, …) |
158
+ | [DOCS/types.md](DOCS/types.md) | Hook and JSON type shapes |
159
+
160
+ ## Running E2E
161
+
162
+ Scenario tests invoke the CLI in a subprocess (not Vitest `handlerMaker`). They cover `run`, `start`, `lump-status`, and `clean` with a harness-generated Node mock agent command.
163
+
164
+ From `packages/apps/cli`:
165
+
166
+ ```bash
167
+ npm run test:e2e # SEA: lazy build if binary missing, then scenarios
168
+ npm run test:e2e:node # Node: lazy build:bundle if missing, then same scenarios
169
+ npm run test:e2e:ci # SEA: always build:sea first (CI parity)
170
+ npm run test:e2e:ci:node # Node: always build:bundle first
171
+ ```
172
+
173
+ All four use `scripts/run-e2e.mjs` (`--node` for the Node launcher, `--ci` to force a full build).
174
+
175
+ On Windows (PowerShell), after building:
176
+
177
+ ```powershell
178
+ npm run build:sea:windows
179
+ $env:LUMPCODE_E2E_BINARY = ".\bin\lumpcode-windows-x64.exe"
180
+ npm run test:e2e
181
+ ```
182
+
183
+ `npm run test:e2e` auto-detects `bin/lumpcode-windows-x64.exe` on `win32` and runs `build:sea:windows` when the binary is missing. `npm run test:e2e:node` uses the npm launcher (`bin/lumpcode.js` → `node dist/index.js` when no `vendor/` binary is present). E2E subprocesses use an isolated temp profile (`USERPROFILE` and `HOME` on Windows) so daemon files and `project-copies` do not touch your real `%USERPROFILE%\.lumpcode`.
184
+
185
+ Optional env overrides:
186
+
187
+ - `LUMPCODE_E2E_BINARY` — path to an existing SEA binary (default runner)
188
+ - `LUMPCODE_E2E_RUNNER=node` with `LUMPCODE_E2E_CLI_ENTRY` — Node launcher path (set automatically by `test:e2e:node`)
189
+
190
+ Unit tests stay on `npm test` (E2E excluded via `vitest.config.ts`).
191
+
192
+
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require('node:child_process');
4
+ const fs = require('node:fs');
5
+ const path = require('node:path');
6
+
7
+ const pkgRoot = path.join(__dirname, '..');
8
+ const vendorDir = path.join(pkgRoot, 'vendor');
9
+ const markerPath = path.join(vendorDir, '.installed');
10
+ const nativeBinary =
11
+ process.platform === 'win32'
12
+ ? path.join(vendorDir, 'lumpcode.exe')
13
+ : path.join(vendorDir, 'lumpcode');
14
+ const distEntry = path.join(pkgRoot, 'dist', 'index.js');
15
+ const args = process.argv.slice(2);
16
+
17
+ function run(executable, executableArgs) {
18
+ const child = spawn(executable, executableArgs, {
19
+ stdio: 'inherit',
20
+ cwd: process.cwd(),
21
+ windowsHide: true,
22
+ });
23
+
24
+ child.on('error', (error) => {
25
+ console.error(error);
26
+ process.exit(1);
27
+ });
28
+
29
+ child.on('close', (code, signal) => {
30
+ if (signal) {
31
+ process.kill(process.pid, signal);
32
+ return;
33
+ }
34
+ process.exit(code ?? 1);
35
+ });
36
+ }
37
+
38
+ if (fs.existsSync(markerPath) && fs.existsSync(nativeBinary)) {
39
+ run(nativeBinary, args);
40
+ } else {
41
+ run(process.execPath, [distEntry, ...args]);
42
+ }