p-backlog 0.2.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 (36) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +201 -0
  3. package/README.md +218 -0
  4. package/README.ru.md +213 -0
  5. package/dist/cli.js +6712 -0
  6. package/dist/server.js +3887 -0
  7. package/dist/web/assets/ChartTooltip-BYCfK3J2.js +55 -0
  8. package/dist/web/assets/ChartTooltip-tQC8-pw2.css +1 -0
  9. package/dist/web/assets/CodeTab-CfG0h41u.css +1 -0
  10. package/dist/web/assets/CodeTab-LYNoYtUt.js +1 -0
  11. package/dist/web/assets/CostTab-BNukfYQ_.js +1 -0
  12. package/dist/web/assets/CostTab-CtmH2WbT.css +1 -0
  13. package/dist/web/assets/EffectTab-Bk8BtfaR.js +1 -0
  14. package/dist/web/assets/EffectTab-DCTwmWXb.css +1 -0
  15. package/dist/web/assets/Figure-BcMtR7CN.js +1 -0
  16. package/dist/web/assets/OverviewTab-Bv0rKc6p.js +1 -0
  17. package/dist/web/assets/OverviewTab-C-NPX9JB.css +1 -0
  18. package/dist/web/assets/QualityTab-N81paNFO.js +1 -0
  19. package/dist/web/assets/StatsPage-D4P63bqv.js +1 -0
  20. package/dist/web/assets/StatsPage-gITQDSrz.css +1 -0
  21. package/dist/web/assets/StatsPage.module-D8dvB8Va.js +1 -0
  22. package/dist/web/assets/StatsTabState-B6PD1sC0.css +1 -0
  23. package/dist/web/assets/StatsTabState-BcFrx-N3.js +1 -0
  24. package/dist/web/assets/StatsTable-C8h-1NJ7.js +1 -0
  25. package/dist/web/assets/StatsTable-Z9x-Xaha.css +1 -0
  26. package/dist/web/assets/UnavailableRepos-COXy5-Dn.js +1 -0
  27. package/dist/web/assets/i18n-BO0kwLac.js +58 -0
  28. package/dist/web/assets/i18n-BlPq0Oql.css +1 -0
  29. package/dist/web/assets/index-C-8JzRpY.js +38 -0
  30. package/dist/web/assets/index-DyGLN1aL.css +1 -0
  31. package/dist/web/assets/rolldown-runtime-hePW80VL.js +1 -0
  32. package/dist/web/assets/value-dot-X354sZLx.js +1 -0
  33. package/dist/web/index.html +16 -0
  34. package/package.json +90 -0
  35. package/skill/backlog/SKILL.md +182 -0
  36. package/skill/backlog-en/SKILL.md +194 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0
4
+
5
+ - Two interface languages: Russian and English (`backlog config language`, RU/EN switch in the web UI).
6
+ - Installable as an npm package: `npm i -g p-backlog`.
7
+ - `backlog setup` installs the agent skill and the Stop hook (replaces `npm run install-skill` from a clone).
8
+ - `backlog serve` runs the web UI; `backlog service install|uninstall|status` starts it at login on macOS (launchd), Linux (systemd --user) and Windows (Startup folder).
9
+ - Claude Code directory respects `CLAUDE_CONFIG_DIR`.
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 ADDED
@@ -0,0 +1,218 @@
1
+ # p-backlog
2
+
3
+ **[Русская версия](README.ru.md)**
4
+
5
+ A task backlog that lives as markdown files: an AI agent creates them while working on code, and a human
6
+ triages them in a local web app.
7
+
8
+ - **`backlog` CLI** — creates tasks, takes them into progress, changes their status.
9
+ - **`backlog` skill** for Claude Code — tells the agent when and how to call the CLI.
10
+ - **Web app** — project list, search, filters, epics, links, progress; doesn't create tasks.
11
+ - **Backlog hygiene** — the agent re-checks tasks whose code changed and closes the ones no longer needed;
12
+ closed tasks are deleted after 7 days.
13
+
14
+ ## Getting started
15
+
16
+ 1. **Install** (needs Node.js 22.13 or newer):
17
+
18
+ ```bash
19
+ npm i -g p-backlog
20
+ backlog setup --service
21
+ ```
22
+
23
+ `npm i -g p-backlog` installs the CLI globally; `backlog setup --service` installs the skill and the
24
+ Stop hook for Claude Code and starts the web app as an autostart service.
25
+
26
+ 2. **Language** — defaults to Russian if a backlog already exists, otherwise to the system locale.
27
+ Change it any time:
28
+
29
+ ```bash
30
+ backlog config language en # or ru
31
+ ```
32
+
33
+ 3. **First project and task** — open Claude Code in your repository and ask it to log something to the
34
+ backlog, or create a task yourself:
35
+
36
+ ```bash
37
+ backlog new --title "Upload timeout ignores file size" --category bug <<<'Problem description'
38
+ ```
39
+
40
+ `backlog new` creates the project for the current repository itself if it doesn't exist yet.
41
+
42
+ 4. **Web app** — already running at `http://localhost:4317`; check with:
43
+
44
+ ```bash
45
+ backlog service status
46
+ ```
47
+
48
+ 5. **The Stop hook and alerts** — after each of the agent's turns in a repository, the Stop hook checks
49
+ whether the code behind that project's open tasks changed, and if so asks the agent to re-check them.
50
+ It also surfaces alerts — signals about the backlog's health (growing debt, stuck tasks, stale
51
+ low-priority tasks, and so on); `backlog stats` shows the same summary.
52
+
53
+ ## Where tasks live
54
+
55
+ The backlog directory is `~/backlog`, or the path from the `BACKLOG_DIR` variable. Inside it, one
56
+ directory per project:
57
+
58
+ ```
59
+ ~/backlog/spa/project.md # name, prefix, repos
60
+ ~/backlog/spa/SPA-12.md # task: frontmatter + markdown
61
+ ```
62
+
63
+ The project for the current directory is resolved by the git root and the `repos` field in `project.md`.
64
+ If there's no project yet, `backlog new` creates it.
65
+
66
+ ## CLI commands
67
+
68
+ | Command | What it does |
69
+ |---|---|
70
+ | `backlog new --title <t> --category <category> [--type task\|epic] [--priority low\|medium\|high\|critical] [--tags a,b] [--found review\|incidental] [--source file:line] [--epic ID] [--blocked-by ID,…] [--related ID,…] [--project id] [--force] [--json]` | Creates a task, the description is read from stdin; a similar open task refuses the command (code 3), `--force` creates it anyway; `--found review` marks a review finding, the default is `incidental` (noticed in passing) |
71
+ | `backlog list [--query q] [--status s,…] [--tag t,…] [--project id \| --all-projects] [--json]` | Lists tasks, by default the open tasks of the current project |
72
+ | `backlog show <ID> [--json]` | The full task: links, blockers, warnings |
73
+ | `backlog take <ID> \| --next [--project id] [--force] [--json]` | Takes a task into progress, checking blockers |
74
+ | `backlog take --path <file\|directory> [--project id] [--json]` | Takes into progress every open task inside the path |
75
+ | `backlog status <ID> <backlog\|in-progress\|blocked\|done\|cancelled>` | Changes the status |
76
+ | `backlog priority <ID> <low\|medium\|high\|critical>` | Changes the priority |
77
+ | `backlog category <ID> <category\|none>` | Changes the category or clears it |
78
+ | `backlog epic <ID> [<ID> …] --to <epic ID\|none>` | Moves tasks into an epic or takes them out of it |
79
+ | `backlog check [--changed] [--project id \| --all-projects] [--json]` | Fixes dangling links and completed epics, finds tasks that are due for a re-check |
80
+ | `backlog close <ID> --as fixed\|obsolete\|duplicate --reason <evidence> [--duplicate-of ID]` | Closes a task with a reason; `fixed` only with a commit hash from the project's repository |
81
+ | `backlog verify <ID> [<ID> …] [--source file:line]` | Marks tasks as still relevant and remembers the code snippet |
82
+ | `backlog prune [--project id \| --all-projects] [--apply]` | Low-priority tasks older than 30 days; `--apply` cancels them |
83
+ | `backlog stats [--project id \| --all-projects] [--json]` | Statistics summary and alerts |
84
+ | `backlog project list \| status <id> active\|inactive \| delete <id> --confirm <id>` | Project activity and deleting a project with its tasks |
85
+ | `backlog hook stop` | The Stop hook for Claude Code: asks the agent to re-check tasks whose code changed |
86
+ | `backlog config language [ru\|en]` | With no value, prints the current backlog language; with a value, changes it |
87
+ | `backlog setup [--service]` | Install the skill and the Stop hook; with `--service`, also the autostart service |
88
+ | `backlog serve [--port N]` | Runs the web server in the current process, on `PORT` or 4317 by default |
89
+ | `backlog service install \| uninstall \| status` | Autostarts the web server at login: launchd on macOS, systemd --user on Linux, a Startup-folder script on Windows; `status` shows whether it is installed and responding |
90
+
91
+ Exit codes: `0` success, `1` argument or rule error, `2` not found, `3` refused (the task is closed,
92
+ blocked, or every matching task is blocked), `4` the command failed, `5` `check` found something to
93
+ re-check.
94
+
95
+ A project that's no longer maintained is marked inactive: its tasks drop out of the combined "Projects"
96
+ scope's list and statistics, but the project's own page works as usual. Checks (`backlog check`), the Stop
97
+ hook, and deleting old closed tasks run across all projects, including inactive ones. Deleting a project
98
+ removes the `~/backlog/<id>` directory with all its tasks and journal — both in the UI and the CLI it
99
+ requires typing the project id to confirm.
100
+
101
+ ## Backlog hygiene
102
+
103
+ - When the agent finishes a turn in a repository where open tasks reference code that changed, the Stop
104
+ hook asks it to re-check those tasks. On request ("check the backlog"), it goes through the whole
105
+ project.
106
+ - The agent closes a task that's no longer needed with `backlog close` and evidence; in the UI such tasks
107
+ are visible under the "Closed by agent" link, and can be reopened.
108
+ - An epic whose tasks are all closed is closed by the server on its own, at startup and once an hour; such
109
+ epics are also visible under "Closed by agent".
110
+ - Any closed task is deleted after 7 days along with its file — the server does this at startup and once
111
+ an hour. The server keeps a completed epic's task around until the epic itself closes (for example, while
112
+ the backlog still has unprocessed files) — the countdown then shows "deletion delayed" instead.
113
+ Deleted task numbers are never reused.
114
+
115
+ ## Web app
116
+
117
+ ```bash
118
+ backlog serve # runs the web server in the current process, on PORT or 4317 by default
119
+ backlog serve --port 5000
120
+ ```
121
+
122
+ The server listens on `127.0.0.1` only and reflects directory changes immediately: a task created by the
123
+ agent shows up in an open tab without a reload.
124
+
125
+ To have it start automatically on login instead, install it as a service (macOS, Linux, and Windows are
126
+ supported):
127
+
128
+ ```bash
129
+ backlog service install # macOS: launchd, Linux: systemd --user, Windows: script in the Startup folder
130
+ backlog service status # is it installed, is the server responding
131
+ backlog service uninstall
132
+ ```
133
+
134
+ Logs:
135
+
136
+ - macOS — `~/Library/Logs/p-backlog.log`
137
+ - Linux — `journalctl --user -u p-backlog`
138
+ - Windows — `%LOCALAPPDATA%\p-backlog\p-backlog.log`
139
+
140
+ ## Migrating from a clone
141
+
142
+ If you installed p-backlog by cloning the repository, switch to the package:
143
+
144
+ ```bash
145
+ npm i -g p-backlog # or, from the clone: npm link
146
+ backlog setup --service
147
+ ```
148
+
149
+ `setup` relinks the skill from the clone to the installed package and doesn't add a second copy of the
150
+ Stop hook; with `--service`, `install` overwrites the autostart service in place, so it also replaces a
151
+ `local.p-backlog` LaunchAgent set up by hand from the old plist template.
152
+
153
+ ## Updating
154
+
155
+ ```bash
156
+ npm update -g p-backlog
157
+ backlog service install
158
+ ```
159
+
160
+ The running service keeps executing the old `cli.js` until reinstalled — the web assets on disk are
161
+ already new, but `backlog service install` is what points the service at the new code.
162
+
163
+ After upgrading Node itself (for example via Homebrew), run `backlog service install` again too: the
164
+ service stores the path to the Node binary it was installed with.
165
+
166
+ ## Uninstalling
167
+
168
+ ```bash
169
+ backlog service uninstall
170
+ npm uninstall -g p-backlog
171
+ ```
172
+
173
+ Run `backlog service uninstall` before removing the package — otherwise launchd's `KeepAlive` (or systemd's
174
+ `Restart=on-failure`) keeps relaunching a `cli.js` that no longer exists. Then remove the skill link and
175
+ the Stop hook by hand:
176
+
177
+ ```bash
178
+ rm ~/.claude/skills/backlog # or $CLAUDE_SKILLS_DIR / $CLAUDE_CONFIG_DIR/skills, if set
179
+ ```
180
+
181
+ and delete the `Stop` hook entry from `~/.claude/settings.json` (or `$CLAUDE_SETTINGS_PATH`) — on
182
+ macOS/Linux it's the command `command -v backlog >/dev/null && backlog hook stop || true`, on Windows a
183
+ PowerShell command starting with `if (Get-Command backlog.cmd ...)`.
184
+
185
+ On Windows, the Startup-folder script does not restart a crashed server the way launchd `KeepAlive` or
186
+ systemd `Restart=on-failure` do — after a crash, run `backlog service install` again or start it with
187
+ `backlog serve`.
188
+
189
+ ## Development
190
+
191
+ ```bash
192
+ npm install
193
+ npm run build
194
+ npm link # global backlog command
195
+ npm run install-skill # ~/.claude/skills/backlog → skill/backlog and the Stop hook in ~/.claude/settings.json
196
+ ```
197
+
198
+ ```bash
199
+ npm start # builds and serves on http://localhost:4317
200
+ npm run dev # server and Vite with hot reload
201
+ ```
202
+
203
+ ```bash
204
+ npm test # unit, server, and UI tests
205
+ npm run typecheck
206
+ npm run lint
207
+
208
+ npx playwright install chromium # once, before the first e2e run
209
+ npm run test:e2e # Playwright: live list update
210
+
211
+ npm run test:package # the tarball install path end to end on this OS (slow)
212
+ ```
213
+
214
+ To try a build the way a published package would install, without publishing it:
215
+
216
+ ```bash
217
+ npm pack && npm i -g ./p-backlog-0.2.0.tgz
218
+ ```
package/README.ru.md ADDED
@@ -0,0 +1,213 @@
1
+ # p-backlog
2
+
3
+ **[English version](README.md)**
4
+
5
+ Беклог задач, который живёт markdown-файлами: их создаёт ИИ-агент во время работы над кодом, а человек
6
+ разбирает в локальном веб-приложении.
7
+
8
+ - **CLI `backlog`** — создаёт задачи, берёт их в работу, меняет статусы.
9
+ - **Скилл `backlog`** для Claude Code — объясняет агенту, когда и как звать CLI.
10
+ - **Веб-приложение** — список проектов, поиск, фильтры, эпики, связи, прогресс; задачи не создаёт.
11
+ - **Порядок в беклоге** — агент перепроверяет задачи, чей код изменился, и закрывает ненужные; закрытые
12
+ задачи удаляются через 7 дней.
13
+
14
+ ## Как начать
15
+
16
+ 1. **Установка** (нужен Node.js 22.13 или новее):
17
+
18
+ ```bash
19
+ npm i -g p-backlog
20
+ backlog setup --service
21
+ ```
22
+
23
+ `npm i -g p-backlog` ставит CLI глобально; `backlog setup --service` ставит скилл и хук Stop для Claude
24
+ Code и запускает веб как службу автозапуска.
25
+
26
+ 2. **Язык** — по умолчанию русский, если беклог уже есть, иначе язык берётся из локали системы. Сменить
27
+ можно в любой момент:
28
+
29
+ ```bash
30
+ backlog config language en # или ru
31
+ ```
32
+
33
+ 3. **Первый проект и первая задача** — откройте Claude Code в своём репозитории и попросите «запиши в
34
+ беклог …», либо создайте задачу сами:
35
+
36
+ ```bash
37
+ backlog new --title "Таймаут загрузки не учитывает размер файла" --category bug <<<'Описание проблемы'
38
+ ```
39
+
40
+ Проект для текущего репозитория `backlog new` создаст сам, если его ещё нет.
41
+
42
+ 4. **Веб-приложение** — уже работает на `http://localhost:4317`; проверить можно так:
43
+
44
+ ```bash
45
+ backlog service status
46
+ ```
47
+
48
+ 5. **Хук Stop и тревоги** — после каждого ответа агента в репозитории хук Stop проверяет, не изменился ли
49
+ код у открытых задач этого проекта, и просит агента перепроверить их, если да. Он же показывает
50
+ тревоги — сигналы о состоянии беклога (растущий долг, зависшие задачи, старые задачи с низким
51
+ приоритетом и т. п.); их сводку показывает и `backlog stats`.
52
+
53
+ ## Где лежат задачи
54
+
55
+ Каталог беклога — `~/backlog` или путь из переменной `BACKLOG_DIR`. Внутри — по каталогу на проект:
56
+
57
+ ```
58
+ ~/backlog/spa/project.md # name, prefix, repos
59
+ ~/backlog/spa/SPA-12.md # задача: frontmatter + markdown
60
+ ```
61
+
62
+ Проект для текущей директории определяется по git-корню и полю `repos` в `project.md`. Если проекта нет,
63
+ `backlog new` создаёт его сам.
64
+
65
+ ## Команды CLI
66
+
67
+ | Команда | Что делает |
68
+ |---|---|
69
+ | `backlog new --title <t> --category <категория> [--type task\|epic] [--priority low\|medium\|high\|critical] [--tags a,b] [--found review\|incidental] [--source файл:строка] [--epic ID] [--blocked-by ID,…] [--related ID,…] [--project id] [--force] [--json]` | Создаёт задачу, описание читается из stdin; похожая открытая задача — отказ (код 3), `--force` создаёт всё равно; `--found review` — находка ревью, по умолчанию `incidental` (замечено попутно) |
70
+ | `backlog list [--query q] [--status s,…] [--tag t,…] [--project id \| --all-projects] [--json]` | Список задач, по умолчанию открытые задачи текущего проекта |
71
+ | `backlog show <ID> [--json]` | Задача целиком: связи, блокеры, предупреждения |
72
+ | `backlog take <ID> \| --next [--project id] [--force] [--json]` | Берёт задачу в работу, проверяя блокеры |
73
+ | `backlog take --path <файл\|каталог> [--project id] [--json]` | Берёт в работу все открытые задачи внутри пути |
74
+ | `backlog status <ID> <backlog\|in-progress\|blocked\|done\|cancelled>` | Меняет статус |
75
+ | `backlog priority <ID> <low\|medium\|high\|critical>` | Меняет приоритет |
76
+ | `backlog category <ID> <категория\|none>` | Меняет категорию или убирает её |
77
+ | `backlog epic <ID> [<ID> …] --to <ID эпика\|none>` | Переносит задачи в эпик или вынимает из него |
78
+ | `backlog check [--changed] [--project id \| --all-projects] [--json]` | Чинит висячие ссылки и завершённые эпики, находит задачи, которые пора перепроверить |
79
+ | `backlog close <ID> --as fixed\|obsolete\|duplicate --reason <улика> [--duplicate-of ID]` | Закрывает задачу с причиной; `fixed` — только с хешем коммита из репозитория проекта |
80
+ | `backlog verify <ID> [<ID> …] [--source файл:строка]` | Отмечает, что задачи ещё актуальны, и запоминает фрагмент кода |
81
+ | `backlog prune [--project id \| --all-projects] [--apply]` | Задачи с низким приоритетом старше 30 дней; `--apply` отменяет их |
82
+ | `backlog stats [--project id \| --all-projects] [--json]` | Сводка статистики и тревоги |
83
+ | `backlog project list \| status <id> active\|inactive \| delete <id> --confirm <id>` | Активность проектов и удаление проекта вместе с задачами |
84
+ | `backlog hook stop` | Хук Stop для Claude Code: просит агента перепроверить задачи, чей код изменился |
85
+ | `backlog config language [ru\|en]` | Без значения — печатает текущий язык беклога; со значением — меняет его |
86
+ | `backlog setup [--service]` | Поставить скилл и Stop-хук; с `--service` — ещё и службу автозапуска |
87
+ | `backlog serve [--port N]` | Запускает веб-сервер в текущем процессе, порт — из `PORT`, иначе 4317 |
88
+ | `backlog service install \| uninstall \| status` | Автозапуск веб-сервера при входе: launchd на macOS, systemd --user на Linux, скрипт в папке «Автозагрузка» на Windows; `status` — установлена ли служба и отвечает ли сервер |
89
+
90
+ Коды выхода: `0` — успех, `1` — ошибка аргументов или правил, `2` — не найдено, `3` — отказ (задача
91
+ закрыта, заблокирована или все подходящие заблокированы), `4` — команда не выполнилась, `5` — у `check`
92
+ есть что перепроверить.
93
+
94
+ Проект, который больше не ведётся, помечается неактивным: его задачи не попадают в список и статистику
95
+ режима «Проекты», но страница проекта работает как обычно. Проверки (`backlog check`), Stop-хук и
96
+ удаление старых закрытых задач идут по всем проектам, включая неактивные. Удаление проекта сносит каталог
97
+ `~/backlog/<id>` со всеми задачами и журналом — и в интерфейсе, и в CLI оно требует ввести id проекта.
98
+
99
+ ## Порядок в беклоге
100
+
101
+ - Агент заканчивает ответ в репозитории, где открытые задачи ссылаются на изменившийся код, — хук Stop
102
+ просит его перепроверить эти задачи. По просьбе «проверь беклог» он проходит весь проект.
103
+ - Ненужную задачу агент закрывает через `backlog close` с уликой; в интерфейсе такие задачи видны по
104
+ ссылке «Закрыты агентом», их можно вернуть в беклог.
105
+ - Эпик, все задачи которого закрыты, сервер при старте и раз в час закрывает сам; такие эпики тоже видны
106
+ по ссылке «Закрыты агентом».
107
+ - Любая закрытая задача удаляется через 7 дней вместе с файлом: это делает сервер при старте и раз в час. Задачу завершённого эпика сервер держит, пока эпик не закроется (например, пока в беклоге есть неразобранные файлы), — тогда вместо отсчёта видно «удаление задержано».
108
+ Номера удалённых задач повторно не выдаются.
109
+
110
+ ## Веб-приложение
111
+
112
+ ```bash
113
+ backlog serve # запускает веб-сервер в текущем процессе, порт — из PORT, иначе 4317
114
+ backlog serve --port 5000
115
+ ```
116
+
117
+ Сервер слушает только `127.0.0.1` и показывает изменения каталога сразу: задача, созданная агентом,
118
+ появляется в открытой вкладке без перезагрузки.
119
+
120
+ Чтобы сервер поднимался сам при входе в систему, установите его как службу (поддерживаются macOS, Linux
121
+ и Windows):
122
+
123
+ ```bash
124
+ backlog service install # macOS: launchd, Linux: systemd --user, Windows: скрипт в папке «Автозагрузка»
125
+ backlog service status # установлена ли служба, отвечает ли сервер
126
+ backlog service uninstall
127
+ ```
128
+
129
+ Логи:
130
+
131
+ - macOS — `~/Library/Logs/p-backlog.log`
132
+ - Linux — `journalctl --user -u p-backlog`
133
+ - Windows — `%LOCALAPPDATA%\p-backlog\p-backlog.log`
134
+
135
+ ## Переход с установки из клона
136
+
137
+ Если p-backlog был установлен из клона репозитория, переходите на пакет:
138
+
139
+ ```bash
140
+ npm i -g p-backlog # или, из клона: npm link
141
+ backlog setup --service
142
+ ```
143
+
144
+ `setup` переставит ссылку скилла с клона на установленный пакет и не задублирует хук Stop; с
145
+ `--service` `install` перезаписывает службу автозапуска на месте, поэтому заодно заменяет и
146
+ LaunchAgent `local.p-backlog`, настроенный вручную по старому шаблону plist.
147
+
148
+ ## Обновление
149
+
150
+ ```bash
151
+ npm update -g p-backlog
152
+ backlog service install
153
+ ```
154
+
155
+ Запущенная служба продолжает работать со старым `cli.js`, пока её не переустановят, — веб-ресурсы на
156
+ диске уже новые, но именно `backlog service install` переключает службу на новый код.
157
+
158
+ После обновления самого Node (например, через Homebrew) тоже запустите `backlog service install` —
159
+ служба хранит путь к бинарнику Node, с которым была установлена.
160
+
161
+ ## Удаление
162
+
163
+ ```bash
164
+ backlog service uninstall
165
+ npm uninstall -g p-backlog
166
+ ```
167
+
168
+ Перед удалением пакета выполните `backlog service uninstall` — иначе `KeepAlive` у launchd (или
169
+ `Restart=on-failure` у systemd) продолжит перезапускать несуществующий `cli.js`. Затем вручную уберите
170
+ ссылку на скилл и хук Stop:
171
+
172
+ ```bash
173
+ rm ~/.claude/skills/backlog # или $CLAUDE_SKILLS_DIR / $CLAUDE_CONFIG_DIR/skills, если заданы
174
+ ```
175
+
176
+ и удалите запись хука `Stop` из `~/.claude/settings.json` (или `$CLAUDE_SETTINGS_PATH`) — на
177
+ macOS/Linux это команда `command -v backlog >/dev/null && backlog hook stop || true`, на Windows —
178
+ команда PowerShell, начинающаяся с `if (Get-Command backlog.cmd ...)`.
179
+
180
+ На Windows скрипт в папке «Автозагрузка» не перезапускает сервер после падения — в отличие от `KeepAlive`
181
+ у launchd или `Restart=on-failure` у systemd; после сбоя запустите `backlog service install` заново или
182
+ `backlog serve`.
183
+
184
+ ## Разработка
185
+
186
+ ```bash
187
+ npm install
188
+ npm run build
189
+ npm link # глобальная команда backlog
190
+ npm run install-skill # ~/.claude/skills/backlog → skill/backlog и хук Stop в ~/.claude/settings.json
191
+ ```
192
+
193
+ ```bash
194
+ npm start # сборка и сервер на http://localhost:4317
195
+ npm run dev # сервер и Vite с горячей перезагрузкой
196
+ ```
197
+
198
+ ```bash
199
+ npm test # модульные, серверные и интерфейсные тесты
200
+ npm run typecheck
201
+ npm run lint
202
+
203
+ npx playwright install chromium # один раз, перед первым запуском e2e
204
+ npm run test:e2e # Playwright: живое обновление списка
205
+
206
+ npm run test:package # весь путь установки из tarball на этой ОС (медленный)
207
+ ```
208
+
209
+ Чтобы попробовать сборку так, будто это опубликованный пакет, без публикации:
210
+
211
+ ```bash
212
+ npm pack && npm i -g ./p-backlog-0.2.0.tgz
213
+ ```