@litfamily/litclaude 1.0.42 → 1.0.43
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 +24 -0
- package/README.md +8 -8
- package/README_ko-KR.md +8 -8
- package/TRADEMARK.md +12 -0
- package/bin/litclaude-ai.js +29 -3
- package/docs/assets/readme/badge-version.svg +1 -1
- package/docs/hooks.md +35 -6
- package/package.json +2 -1
- package/plugins/litclaude/.claude-plugin/plugin.json +7 -1
- package/plugins/litclaude/bin/litclaude-hook.js +14 -0
- package/plugins/litclaude/bin/litclaude-mcp.js +1 -1
- package/plugins/litclaude/hooks/lit-band-client.mjs +9 -4
- package/plugins/litclaude/hooks/lit-mod.mjs +9 -1
- package/plugins/litclaude/lib/canonical-skill-resources.mjs +2 -2
- package/plugins/litclaude/lib/invite.mjs +131 -0
- package/plugins/litclaude/lib/mod/frame.mjs +88 -19
- package/plugins/litclaude/lib/mod/looks.mjs +13 -0
- package/plugins/litclaude/lib/mod/motion.mjs +5 -0
- package/plugins/litclaude/lib/mod/settings.mjs +5 -2
- package/plugins/litclaude/lib/mod/state.mjs +18 -0
- package/plugins/litclaude/lib/mod/svg-card.mjs +61 -16
- package/plugins/litclaude/lib/mod/timeline.mjs +32 -0
- package/plugins/litclaude/lib/mod/view.mjs +8 -3
- package/plugins/litclaude/lib/owner-lock.mjs +11 -1
- package/plugins/litclaude/lib/plan-task-rows.mjs +17 -4
- package/plugins/litclaude/lib/start-work-lifecycle.mjs +43 -8
- package/plugins/litclaude/skills/start-work/SKILL.md +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.43 - 2026-10-28
|
|
4
|
+
|
|
5
|
+
- Releases are now built and published from GitHub Actions with npm provenance. The npm page shows a green check that links each version to this repository and the commit it was built from. The CI check still refuses publish tokens, pushes and tags in every workflow; only the hand-run `publish.yml` may request the OIDC token, and it can only stage a version that the maintainer then approves on npmjs.com.
|
|
6
|
+
- `lit invite @<github-id>`, typed as the whole prompt, records who invited you and answers without
|
|
7
|
+
a Claude turn; `lit invite` alone prints the line to share. The id is saved only in
|
|
8
|
+
`~/.litclaude/invite.json` on this machine, the first inviter stays, and nothing is sent anywhere.
|
|
9
|
+
The answer points to the LitFamily Discussions thread, where invites are counted by hand.
|
|
10
|
+
`litclaude-ai invite` does the same from a terminal.
|
|
11
|
+
- An invited card wears the club look while it rests: a gold → rose → violet ring round all four
|
|
12
|
+
borders, sparkles at the title's corners, `CLUB ✦` on a gold-gradient pill and a quiet
|
|
13
|
+
`invited by @<id>` chip. Under full motion a slow gold glint crosses the top edge every few
|
|
14
|
+
seconds; otherwise the ring stands still. The new `club` card option
|
|
15
|
+
(`litclaude-ai config club off`) keeps the plain card.
|
|
16
|
+
- Both READMEs link the new trademark policy for the LitClaude and LitFamily names.
|
|
17
|
+
- During start-work, a session can read its own spilled tool output under
|
|
18
|
+
`~/.claude/projects/<project>/<session>/tool-results/`. Writing there, and reading another
|
|
19
|
+
session's folder, are still refused.
|
|
20
|
+
- Read-only version commands such as `npm run check:version` and `npm view <package> version` are
|
|
21
|
+
no longer refused as a version bump. `npm version patch` and every other real bump still are.
|
|
22
|
+
- A plan task marked `BLOCKED: <reason>` no longer keeps start-work re-prompting. The run skips it,
|
|
23
|
+
and when every open task is blocked it tells you once and lets the session stop.
|
|
24
|
+
- When several processes take over an abandoned state lock at once, the ones that lose the race
|
|
25
|
+
now wait and try again instead of failing with `stale lock takeover failed`.
|
|
26
|
+
|
|
3
27
|
## 1.0.42 - 2026-10-27
|
|
4
28
|
|
|
5
29
|
- While one session runs start-work, other sessions of the same project can now look around: herdr
|
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
1
|
+
<p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/docs/assets/cover-motion-still.webp" /><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/docs/assets/cover-motion.webp" width="100%" alt="LitFamily motion cover: seven armored robots power on one by one, the LitClaude robot wakes with glowing eyes and a lit frame, then LITFAMILY and KEEP THE WORK LIT. light up." /></picture></p>
|
|
2
2
|
|
|
3
3
|
<h1 align="center">LitClaude</h1>
|
|
4
4
|
<p align="center"><strong>Keep the work lit.</strong></p>
|
|
5
5
|
<p align="center">A Claude Code plugin that helps every session plan the work, build it, check it, and leave a note the next session can pick up.</p>
|
|
6
6
|
<p align="center">
|
|
7
|
-
<img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
8
|
-
<a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
7
|
+
<img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/docs/assets/readme/badge-version.svg" alt="1.0.43" />
|
|
8
|
+
<a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/docs/assets/readme/badge-license.svg" alt="MIT license" /></a>
|
|
9
9
|
</p>
|
|
10
10
|
<p align="center">
|
|
11
|
-
<a href="https://github.com/wjgoarxiv/litclaude#readme">Full guide and skills gallery on GitHub</a> · <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
11
|
+
<a href="https://github.com/wjgoarxiv/litclaude#readme">Full guide and skills gallery on GitHub</a> · <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/README_ko-KR.md">한국어</a>
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
14
|
Add `lit` to a Claude Code prompt and Claude pins the goal, writes a failing test first,
|
|
@@ -77,7 +77,7 @@ the `/plugin` menu.
|
|
|
77
77
|
## More
|
|
78
78
|
|
|
79
79
|
- [Full guide and skills gallery on GitHub](https://github.com/wjgoarxiv/litclaude#readme)
|
|
80
|
-
- [Privacy and network behavior](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
81
|
-
- [Migration and ownership conflicts](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
82
|
-
- [Release history](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
83
|
-
- [MIT license](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
80
|
+
- [Privacy and network behavior](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/docs/privacy.md)
|
|
81
|
+
- [Migration and ownership conflicts](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/docs/migration.md)
|
|
82
|
+
- [Release history](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/CHANGELOG.md)
|
|
83
|
+
- [MIT license](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/LICENSE)
|
package/README_ko-KR.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
1
|
+
<p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/docs/assets/cover-motion-still.webp" /><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/docs/assets/cover-motion.webp" width="100%" alt="LitFamily 모션 커버: 일곱 로봇 패널이 차례로 켜지고, LitClaude 로봇의 눈과 테두리가 빛난 뒤 LITFAMILY와 KEEP THE WORK LIT. 문구가 밝아지는 영상" /></picture></p>
|
|
2
2
|
|
|
3
3
|
<h1 align="center">LitClaude</h1>
|
|
4
4
|
<p align="center"><strong>Keep the work lit.</strong></p>
|
|
5
5
|
<p align="center">Claude Code에서 세션마다 계획하고, 만들고, 확인한 뒤 다음 세션이 이어받을 기록을 남기게 돕는 플러그인입니다.</p>
|
|
6
6
|
<p align="center">
|
|
7
|
-
<img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
8
|
-
<a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
7
|
+
<img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/docs/assets/readme/badge-version.svg" alt="1.0.43" />
|
|
8
|
+
<a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/docs/assets/readme/badge-license.svg" alt="MIT license" /></a>
|
|
9
9
|
</p>
|
|
10
10
|
<p align="center">
|
|
11
|
-
<a href="https://github.com/wjgoarxiv/litclaude/blob/main/README_ko-KR.md">전체 안내와 스킬 갤러리는 GitHub에서</a> · <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
11
|
+
<a href="https://github.com/wjgoarxiv/litclaude/blob/main/README_ko-KR.md">전체 안내와 스킬 갤러리는 GitHub에서</a> · <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/README.md">English</a>
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
14
|
Claude Code 프롬프트에 `lit`을 붙이면 Claude가 목표를 고정하고, 실패하는 테스트를 먼저 쓰고,
|
|
@@ -75,7 +75,7 @@ npx @litfamily/litclaude@latest uninstall
|
|
|
75
75
|
## 더 보기
|
|
76
76
|
|
|
77
77
|
- [전체 안내와 스킬 갤러리 (GitHub)](https://github.com/wjgoarxiv/litclaude/blob/main/README_ko-KR.md)
|
|
78
|
-
- [개인정보와 네트워크 동작](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
79
|
-
- [이전과 소유권 충돌](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
80
|
-
- [변경 이력](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
81
|
-
- [MIT 라이선스](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
78
|
+
- [개인정보와 네트워크 동작](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/docs/privacy.md)
|
|
79
|
+
- [이전과 소유권 충돌](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/docs/migration.md)
|
|
80
|
+
- [변경 이력](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/CHANGELOG.md)
|
|
81
|
+
- [MIT 라이선스](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.43/LICENSE)
|
package/TRADEMARK.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Trademark policy
|
|
2
|
+
|
|
3
|
+
The code in this repository is free to use under the MIT License (see `LICENSE`). The names **LitClaude**
|
|
4
|
+
and **LitFamily**, and the logos and mascot art, are not part of that license.
|
|
5
|
+
|
|
6
|
+
- You can fork, change and share the code under MIT.
|
|
7
|
+
- If you publish a changed version, give it a different name and logo, and do not suggest that the
|
|
8
|
+
LitClaude maintainers made or endorse it.
|
|
9
|
+
- You can say in plain text that your project is "based on LitClaude" or "a fork of LitClaude".
|
|
10
|
+
- Unchanged copies, such as mirrors and package caches, may keep the name.
|
|
11
|
+
|
|
12
|
+
Questions: open an issue at https://github.com/wjgoarxiv/litclaude/issues.
|
package/bin/litclaude-ai.js
CHANGED
|
@@ -44,6 +44,7 @@ import { runWorkflowStageCli } from "../plugins/litclaude/lib/workflow-stage.mjs
|
|
|
44
44
|
import { runWikifyKnowledgeCli } from "../plugins/litclaude/lib/wikify-knowledge-cli.mjs";
|
|
45
45
|
import { automaticUpdateDoctorLines, automaticUpdateRoot, runAutomaticUpdate } from "../plugins/litclaude/lib/automatic-update.mjs";
|
|
46
46
|
import { autoHandoffDoctorLines } from "../plugins/litclaude/lib/auto-handoff.mjs";
|
|
47
|
+
import { DISCUSSIONS_URL, inviteMessage, recordInvite, shareLine } from "../plugins/litclaude/lib/invite.mjs";
|
|
47
48
|
import { resolveProjectStateRoot } from "../plugins/litclaude/lib/project-state-root.mjs";
|
|
48
49
|
import { runUpdateNotifier } from "./update-notifier.mjs";
|
|
49
50
|
import { assertInstallPath, assertOwnedTree, assertCurrentPointer, assertOwnedRegistrations, migrateLegacyVendorPaths, planModifiedLegacySkill, preserveModifiedLegacySkill, registeredPluginInstallation, writeOwnershipReceipt, removeEmptyDirectory, clearOwnedTree } from "./install-ownership.mjs";
|
|
@@ -82,17 +83,22 @@ const prewarmMotionRuntime = () => {
|
|
|
82
83
|
};
|
|
83
84
|
const version = packageJson.version;
|
|
84
85
|
|
|
85
|
-
const usage = `Usage: litclaude-ai [--dry-run] <install|doctor|config|path|run|update|uninstall|litgoal|wikify|workflow-check|workflow-stage|start-work|start-work-next|public-read|motion-runtime> [...args]
|
|
86
|
+
const usage = `Usage: litclaude-ai [--dry-run] <install|doctor|config|invite|path|run|update|uninstall|litgoal|wikify|workflow-check|workflow-stage|start-work|start-work-next|public-read|motion-runtime> [...args]
|
|
86
87
|
litclaude-ai --version
|
|
87
88
|
|
|
88
89
|
Commands:
|
|
89
90
|
install Register the packaged LitClaude plugin in Claude Code.
|
|
90
91
|
doctor Validate the installed LitClaude plugin path.
|
|
91
92
|
config [<option> <value>]
|
|
92
|
-
Show or change the LIT card options (motion, glyphs, band, notify) in
|
|
93
|
+
Show or change the LIT card options (motion, glyphs, band, notify, club) in
|
|
93
94
|
pluginConfigs, the same values /config edits. Works for the
|
|
94
95
|
desktop app too, which shows no editor for them.
|
|
95
|
-
|
|
96
|
+
invite [@<github-id>] [--json]
|
|
97
|
+
Record who invited you (the same as typing \`lit invite @<id>\`);
|
|
98
|
+
the LIT card gets its club look. Saved in ~/.litclaude/invite.json
|
|
99
|
+
on this machine only; nothing is sent. Without an id, print the
|
|
100
|
+
line to share with friends.
|
|
101
|
+
path Print the installed Claude plugin path.
|
|
96
102
|
run -- ... Run Claude Code after the global plugin install.
|
|
97
103
|
litgoal Manage litgoal runtime state and evidence.
|
|
98
104
|
wikify Manage user-owned local knowledge with cooperative writers; same uid is not a tamper-proof or confidential boundary.
|
|
@@ -805,6 +811,23 @@ const configModOptions = (rest, home = claudeHome()) => {
|
|
|
805
811
|
process.stdout.write(`MOD_OPTIONS: ${modOptionsLine(settings)}\n`);
|
|
806
812
|
};
|
|
807
813
|
|
|
814
|
+
// `invite @<id>` records who invited this machine (lib/invite.mjs) and unlocks the card's club look;
|
|
815
|
+
// bare `invite` prints the line to share. Nothing is sent anywhere. An invalid id exits 2.
|
|
816
|
+
const runInvite = (rest) => {
|
|
817
|
+
const json = rest.includes("--json");
|
|
818
|
+
const args = rest.filter((arg) => arg !== "--json");
|
|
819
|
+
if (args.length > 1) fail("invite takes one GitHub id: litclaude-ai invite @<github-id>", 2);
|
|
820
|
+
if (args.length === 0) {
|
|
821
|
+
process.stdout.write(json ? `${JSON.stringify({ status: "share", line: shareLine(), discussions: DISCUSSIONS_URL })}\n` : `${shareLine()}\n`);
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
const result = recordInvite(args[0]);
|
|
825
|
+
if (json) process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
826
|
+
if (result.status === "invalid") fail(json ? "" : inviteMessage(result), 2);
|
|
827
|
+
if (result.status === "failed") fail(json ? "" : inviteMessage(result), 1);
|
|
828
|
+
if (!json) process.stdout.write(`${inviteMessage(result)}\n`);
|
|
829
|
+
};
|
|
830
|
+
|
|
808
831
|
const ownsHudStatusLine = (settings, ownership) =>
|
|
809
832
|
settings.statusLine?.type === "command" && settings.statusLine.command === ownership.statusLineCommand &&
|
|
810
833
|
Object.keys(settings.statusLine).every((key) => key === "type" || key === "command");
|
|
@@ -1835,6 +1858,9 @@ const main = async () => {
|
|
|
1835
1858
|
case "config":
|
|
1836
1859
|
configModOptions(parsed.rest);
|
|
1837
1860
|
break;
|
|
1861
|
+
case "invite":
|
|
1862
|
+
runInvite(parsed.rest);
|
|
1863
|
+
break;
|
|
1838
1864
|
case "path":
|
|
1839
1865
|
printPath(parsed);
|
|
1840
1866
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="146" height="20" role="img" aria-label="release: 1.0.
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="146" height="20" role="img" aria-label="release: 1.0.43"><title>release: 1.0.43</title><g shape-rendering="crispEdges"><rect width="49" height="20" fill="#080d14"/><rect x="49" width="97" height="20" fill="#ff6337"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text x="255" y="140" textLength="390" transform="scale(.1)">release</text><text x="965" y="140" textLength="870" transform="scale(.1)" fill="#080D14">1.0.43</text></g></svg>
|
package/docs/hooks.md
CHANGED
|
@@ -103,7 +103,7 @@ silent no-op for callers that still invoke it directly.
|
|
|
103
103
|
| Event | Runner | Purpose |
|
|
104
104
|
| --- | --- | --- |
|
|
105
105
|
| `SessionStart` | `plugins/litclaude/bin/litclaude-hook.js session-start` | Runs the bounded foreground automatic-update barrier on a fresh session (or starts the detached version-cache refresh when the cache is stale), discovers repo-local rule files, names the newest valid `plans/<slug>.md`, and on `source: compact` spends one of two durable re-injection reservations at reduced caps and, with automatic handoff on, reloads the fresh handoff once. |
|
|
106
|
-
| `UserPromptSubmit` | `plugins/litclaude/bin/litclaude-hook.js user-prompt-submit` | Detects prompt routes and injects workflow context; independently delivers static rules not already recorded for this session; answers the exact prompts `lit-handoff auto on <percent>`, `lit-handoff auto off` and `lit-handoff auto status` by changing or reporting the automatic handoff setting. |
|
|
106
|
+
| `UserPromptSubmit` | `plugins/litclaude/bin/litclaude-hook.js user-prompt-submit` | Detects prompt routes and injects workflow context; independently delivers static rules not already recorded for this session; answers the exact prompts `lit-handoff auto on <percent>`, `lit-handoff auto off` and `lit-handoff auto status` by changing or reporting the automatic handoff setting; answers a whole-prompt `lit invite [@<github-id>]` itself and blocks the turn (see [Invite](#invite-lit-invite)). |
|
|
107
107
|
| `PreToolUse` | `plugins/litclaude/bin/litclaude-hook.js pre-tool-use` | Enforces semantic action/root grants before Write, Edit, MultiEdit, NotebookEdit, Bash, Agent, and bounded read tools execute; denies supported reader-facing text writes with a humanizer block-tier finding. |
|
|
108
108
|
| `PostToolUse` | `plugins/litclaude/bin/litclaude-hook.js post-tool-use` | Moves the LIT card's stage record on from what the tool did (plan saved, task checked, lit-loop step, a reviewer's verdict from an `Agent` result). Names the post-edit checks the edit actually earned, injects any glob-scoped rule matching the edited paths, and checks successfully created DOCX/PPTX/PDF files for humanizer findings, including paths reported by Bash output. |
|
|
109
109
|
| `PostToolUseFailure` | `plugins/litclaude/bin/litclaude-hook.js post-tool-use-failure` | For a Bash command that exits non-zero, such as a bare failing `npm test`, moves the LIT card's lit-loop map from what the command wrote and from its failing test run, which never counts as VERIFY. Nothing else runs on a failed tool. |
|
|
@@ -494,7 +494,7 @@ a change too; its step and lane clocks keep counting on their own.
|
|
|
494
494
|
|
|
495
495
|
Options, in `/config` under LitClaude (stored in `pluginConfigs` in `~/.claude/settings.json`,
|
|
496
496
|
which the terminal and the desktop app's Code tab both read). The installer writes each default
|
|
497
|
-
you have not set, so the desktop app, which has no editor for them, starts with all
|
|
497
|
+
you have not set, so the desktop app, which has no editor for them, starts with all five;
|
|
498
498
|
`litclaude-ai config` prints them and `litclaude-ai config <option> <value>` changes one.
|
|
499
499
|
Uninstall removes only the defaults it wrote that are still unchanged.
|
|
500
500
|
|
|
@@ -504,13 +504,14 @@ Uninstall removes only the defaults it wrote that are still unchanged.
|
|
|
504
504
|
| `glyphs` | `auto` (Nerd glyphs when the icon font is installed), `nerd`, or `basic` | `auto` |
|
|
505
505
|
| `band` | `always` (the whole session, idle included), `auto` (only while work is active or a skill of this request is lit), `off` | `always` |
|
|
506
506
|
| `notify` | `off`, `finish` (a notification through your own notification channel, `$.ui.notify`, when LIT work completes or a LIT turn longer than three minutes ends), `finish+sound` (the same; a sound is added once LitClaude ships one, and none ships yet) | `off` |
|
|
507
|
+
| `club` | `on` (the idle card wears the club look once `lit invite` recorded an inviter), `off` (the plain ready card, byte for byte) | `on` |
|
|
507
508
|
|
|
508
509
|
Unknown values fall back to the default. The fields are plain strings with no `options` list on
|
|
509
510
|
purpose: Claude Code 2.1.270 and older refuse to load a plugin whose `userConfig` has one, and
|
|
510
511
|
that would take every LitClaude hook down with it. Nerd glyphs reach only the terminal; the
|
|
511
512
|
desktop app and the other surfaces always get the basic set.
|
|
512
513
|
|
|
513
|
-
The card takes one of
|
|
514
|
+
The card takes one of five looks (`lib/mod/looks.mjs`), checked in this order. **done**: when a
|
|
514
515
|
plan's tasks are all checked, a litgoal goal is met, review-work's five lanes have all passed, or a
|
|
515
516
|
main-loop `npm publish` (not `--dry-run`) succeeds, the chips row plays one 1.2 s spray of rainbow
|
|
516
517
|
embers and `DONE ✓`, then settles; it never loops. **YOUR TURN**: while the session waits on you
|
|
@@ -524,7 +525,14 @@ a darker shade of its colour while it runs, its own colour once it passes and re
|
|
|
524
525
|
and the corner counts the lanes that reported (`REVIEW 2/5`). The look holds into later turns
|
|
525
526
|
while a lane is still running, since background lanes report in the turns their notifications
|
|
526
527
|
start. **rewind**: lit-adhd and lit-rewind
|
|
527
|
-
by any route, as above.
|
|
528
|
+
by any route, as above. **club**: only on a resting card, with no other look and no work or lit
|
|
529
|
+
skill, once `lit invite @<github-id>` saved an inviter and the `club` option is on: a ring laid
|
|
530
|
+
clockwise round all four borders from gold through rose to violet and back to gold, a `✧` before the
|
|
531
|
+
gold LIT pill and a `✦` after the title, `CLUB ✦` on a gold-to-rose pill in the corner and a quiet
|
|
532
|
+
`invited by @<id>` chip at the right of the skills row (dropped when the row has no room). Under full
|
|
533
|
+
motion a warm light crosses the top edge once every 3.6 s (each pass 1.4 s, the first after 1.2 s);
|
|
534
|
+
between passes the card draws no frames. With `subtle` or `off` motion the ring stands still. It
|
|
535
|
+
never makes a band show that `band: auto` would hide. No look flips more than a quarter of the card's brightness more than three
|
|
528
536
|
times a second; with `motion` off or reduced motion each look is one still frame, and with
|
|
529
537
|
`NO_COLOR` set the card keeps its labels and draws no colour (basic glyphs, no motion). The desktop
|
|
530
538
|
drawing shows the labels of these looks, not the lane segments or the embers.
|
|
@@ -547,8 +555,9 @@ The mod is read-only. It reads LitClaude's own state, the Git `HEAD` of the work
|
|
|
547
555
|
the merged settings (for the status line's accent) and nothing else: the ignition record in the
|
|
548
556
|
per-user temp folder, `.litclaude/boulder.json` (found the way the hooks find it, across a
|
|
549
557
|
linked worktree), and under the outermost Git root's `.litclaude/` the litgoal goal, autoloop
|
|
550
|
-
counter and ledger, the lit-plan, interface-probe and motion turn records,
|
|
551
|
-
settings and session record
|
|
558
|
+
counter and ledger, the lit-plan, interface-probe and motion turn records, the auto-handoff
|
|
559
|
+
settings and session record, and `invite.json` under `LITCLAUDE_HOME` (else `~/.litclaude`) while
|
|
560
|
+
the `club` option is on. Each file must be a regular file under its size cap that resolves
|
|
552
561
|
exactly where its path says, so a symlinked file or state folder is skipped. It writes nothing,
|
|
553
562
|
starts no process, uses no network and calls no model. Its pure parts live in
|
|
554
563
|
`plugins/litclaude/lib/mod/` and are tested under Node.
|
|
@@ -556,6 +565,26 @@ starts no process, uses no network and calls no model. Its pure parts live in
|
|
|
556
565
|
On Claude Code releases before 2.1.287 the `modules` key is ignored and every settings hook runs
|
|
557
566
|
as before; there is no band.
|
|
558
567
|
|
|
568
|
+
## Invite (`lit invite`)
|
|
569
|
+
|
|
570
|
+
`UserPromptSubmit` answers two whole prompts itself, before any other route, with
|
|
571
|
+
`{"decision":"block","reason":…}`, so the host shows the reason and no model turn runs. As with
|
|
572
|
+
`lit approve`, only the whole prompt counts once trimmed (`lit` in any case, spaces or tabs between
|
|
573
|
+
words); a longer, quoted or relayed message that mentions `lit invite` keeps its ordinary route.
|
|
574
|
+
|
|
575
|
+
| Prompt | What happens |
|
|
576
|
+
| --- | --- |
|
|
577
|
+
| `lit invite @<github-id>` | Saves `{version: 1, invitedBy, at}` in `$LITCLAUDE_HOME/invite.json` (`~/.litclaude/invite.json` by default) and thanks the user, with the [Discussions](https://github.com/wjgoarxiv/litfamily/discussions) link where invites are counted. The same id again changes nothing and says so; another id keeps the first inviter and says so. |
|
|
578
|
+
| `lit invite` | Prints the line to share: friends type `lit invite @<your GitHub id>`. Writes nothing. |
|
|
579
|
+
|
|
580
|
+
The id must match `^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$` after one leading `@` is stripped; any
|
|
581
|
+
other text is refused in one line and nothing is written. The write (`lib/invite.mjs`) goes to a
|
|
582
|
+
fresh temporary file that is renamed into place; a symlinked home folder or `invite.json` is
|
|
583
|
+
refused. `litclaude-ai invite [@<github-id>] [--json]` is the same from a terminal and exits 2 on
|
|
584
|
+
an invalid id. The invite path imports no network module and opens no browser; posting in the
|
|
585
|
+
thread is up to the user. The card shows the club look from the next refresh, unless the `club`
|
|
586
|
+
option is off.
|
|
587
|
+
|
|
559
588
|
## Bounded-authority start-work lifecycle
|
|
560
589
|
|
|
561
590
|
The hook and CLI share `plugins/litclaude/lib/start-work-lifecycle.mjs`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@litfamily/litclaude",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.43",
|
|
4
4
|
"description": "Claude Code plugin: add lit to a prompt and Claude plans, tests, checks and reviews the work, then leaves a handoff for the next session.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"SECURITY.md",
|
|
49
49
|
"CODE_OF_CONDUCT.md",
|
|
50
50
|
"SUPPORT.md",
|
|
51
|
+
"TRADEMARK.md",
|
|
51
52
|
"docs/privacy.md"
|
|
52
53
|
],
|
|
53
54
|
"scripts": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "litclaude",
|
|
3
3
|
"description": "Claude Code-native workflow plugin with a bounded-authority start-work lifecycle.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.43",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "LitClaude contributors"
|
|
7
7
|
},
|
|
@@ -38,6 +38,12 @@
|
|
|
38
38
|
"title": "LIT finish notification",
|
|
39
39
|
"description": "off, or finish: a notification through your own notification channel when LIT work completes or a LIT turn longer than three minutes ends. finish+sound also plays a sound once LitClaude ships one; until then it notifies like finish.",
|
|
40
40
|
"default": "off"
|
|
41
|
+
},
|
|
42
|
+
"club": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"title": "LIT club look",
|
|
45
|
+
"description": "on: once you typed `lit invite @<github-id>`, the idle card wears the gold club look. off keeps the plain ready card. Nothing is sent anywhere.",
|
|
46
|
+
"default": "on"
|
|
41
47
|
}
|
|
42
48
|
}
|
|
43
49
|
}
|
|
@@ -57,6 +57,7 @@ import { clearLitPlanTurn, evaluateLitPlanStop, recordLitPlanTurn } from "../lib
|
|
|
57
57
|
import { evaluateInterfaceProbeStop, observeInterfaceProbeTool, recordInterfaceProbeTurn } from "../lib/interface-probe-gate.mjs";
|
|
58
58
|
import { evaluateMotionStop, observeMotionTool, recordMotionTurn } from "../lib/motion-render-gate.mjs";
|
|
59
59
|
import { applyAutoHandoffRoute, autoHandoffReloadContext, evaluateAutoHandoffStop, parseAutoHandoffRoute } from "../lib/auto-handoff.mjs";
|
|
60
|
+
import { inviteMessage, parseInvitePrompt, recordInvite, shareLine } from "../lib/invite.mjs";
|
|
60
61
|
|
|
61
62
|
const formatDurablePlanNotice = (cwd) => {
|
|
62
63
|
try {
|
|
@@ -1662,6 +1663,19 @@ switch (eventName) {
|
|
|
1662
1663
|
}
|
|
1663
1664
|
case "user-prompt-submit": {
|
|
1664
1665
|
const prompt = typeof input.prompt === "string" ? input.prompt : "";
|
|
1666
|
+
// A whole-prompt `lit invite [@id]` is answered here and blocks the turn, so no model turn
|
|
1667
|
+
// runs for it. The host puts its own label before the reason, hence the leading newline.
|
|
1668
|
+
const invite = parseInvitePrompt(prompt);
|
|
1669
|
+
if (invite) {
|
|
1670
|
+
let reason;
|
|
1671
|
+
try {
|
|
1672
|
+
reason = invite.id === null ? shareLine() : inviteMessage(recordInvite(invite.id));
|
|
1673
|
+
} catch {
|
|
1674
|
+
reason = inviteMessage({ status: "failed" });
|
|
1675
|
+
}
|
|
1676
|
+
console.log(JSON.stringify({ decision: "block", reason: `\n${reason}` }));
|
|
1677
|
+
break;
|
|
1678
|
+
}
|
|
1665
1679
|
// Prompt-time static injection is the straggler lane: SessionStart already recorded
|
|
1666
1680
|
// what it injected, so this is normally empty and only speaks when a rule file
|
|
1667
1681
|
// appeared mid-session. Reduced budget, because it can fire on every turn.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { composeBand } from "../lib/mod/frame.mjs";
|
|
10
10
|
import { TIMINGS, motionProfile } from "../lib/mod/motion.mjs";
|
|
11
11
|
import { renderBand } from "../lib/mod/render.mjs";
|
|
12
|
-
import { advanceTimeline, ambientActive, clockShown, createTimeline, sampleTimeline, timelineBusy } from "../lib/mod/timeline.mjs";
|
|
12
|
+
import { advanceTimeline, ambientActive, clockShown, createTimeline, glintWait, sampleTimeline, timelineBusy } from "../lib/mod/timeline.mjs";
|
|
13
13
|
|
|
14
14
|
// The timeline lives in one holder object that the frame timer and every draw share. The timer
|
|
15
15
|
// never reads `surface.state` back, so a draw that folded in a new model is never overwritten by a
|
|
@@ -29,9 +29,14 @@ export default function LitBand(props, surface) {
|
|
|
29
29
|
holder.model = model;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
// The club look's glint ticks only during a pass and otherwise sleeps until the next one.
|
|
33
|
+
const interval = () => {
|
|
34
|
+
if (timelineBusy(holder.timeline, holder.now, profile)) return TIMINGS.frame;
|
|
35
|
+
if (ambientActive(holder.timeline, profile)) return TIMINGS.ambientFrame;
|
|
36
|
+
const glint = glintWait(holder.timeline, holder.now, profile);
|
|
37
|
+
const clock = clockShown(holder.timeline) ? TIMINGS.clock : null;
|
|
38
|
+
return glint !== null && (clock === null || glint < clock) ? glint : clock;
|
|
39
|
+
};
|
|
35
40
|
const schedule = () => {
|
|
36
41
|
const wanted = interval();
|
|
37
42
|
if (wanted === holder.interval) return;
|
|
@@ -22,7 +22,7 @@ import { accentFromSettings, effectiveMotion, normalizeModSettings, resolveGlyph
|
|
|
22
22
|
import { composeSvgCard } from "../lib/mod/svg-card.mjs";
|
|
23
23
|
import { chipStates, litSkillId, noteSkill } from "../lib/mod/skills.mjs";
|
|
24
24
|
import { TOAST_GAP_MS, gateToast, statusChanges, statusOf } from "../lib/mod/toasts.mjs";
|
|
25
|
-
import { detectIconFont, readGitBranch, readLedgerTail, readLitSnapshot, readPluginVersions } from "../lib/mod/state.mjs";
|
|
25
|
+
import { detectIconFont, readGitBranch, readInvited, readLedgerTail, readLitSnapshot, readPluginVersions } from "../lib/mod/state.mjs";
|
|
26
26
|
import { settledSample } from "../lib/mod/timeline.mjs";
|
|
27
27
|
import {
|
|
28
28
|
EMPTY_ACTIVITY,
|
|
@@ -64,6 +64,9 @@ const LONG_TURN_MS = 3 * 60 * 1000;
|
|
|
64
64
|
const createLive = (options) => ({
|
|
65
65
|
band: normalizeModSettings(options).band,
|
|
66
66
|
motion: normalizeModSettings(options).motion,
|
|
67
|
+
club: normalizeModSettings(options).club === "on",
|
|
68
|
+
// The inviter `lit invite` recorded on this machine, or null (state.mjs readInvited).
|
|
69
|
+
invited: null,
|
|
67
70
|
drawnOn: {},
|
|
68
71
|
iconFont: { present: false, path: null, note: "basic: not checked yet" },
|
|
69
72
|
env: {},
|
|
@@ -205,6 +208,8 @@ async function rebuild($, live) {
|
|
|
205
208
|
turnStartedAt: live.turnStartedAt,
|
|
206
209
|
waiting: waitingOf(live),
|
|
207
210
|
versions: live.versions,
|
|
211
|
+
club: live.club && live.invited !== null,
|
|
212
|
+
invitedBy: live.club ? live.invited : null,
|
|
208
213
|
// The thread rows stay reserved while threads are live, so the card does not shrink between repaints.
|
|
209
214
|
threadReserve: previous?.threads?.reserve ?? 0,
|
|
210
215
|
});
|
|
@@ -299,6 +304,7 @@ async function refresh($, live, options) {
|
|
|
299
304
|
const [cwd, sessionId] = await Promise.all([$.session.cwd(), $.session.id()]);
|
|
300
305
|
const fresh = await readLitSnapshot(stateIo($), { cwd, sessionId, env: live.env });
|
|
301
306
|
live.git = await readGitBranch(stateIo($), cwd).catch(() => live.git);
|
|
307
|
+
if (live.club) live.invited = await readInvited(stateIo($), live.env).catch(() => live.invited);
|
|
302
308
|
const listed = await $.agent.list().catch(() => []);
|
|
303
309
|
live.usage = await $.session.usage().catch(() => live.usage);
|
|
304
310
|
const now = await $.clock.now();
|
|
@@ -350,6 +356,8 @@ export const register = (on, options) => {
|
|
|
350
356
|
LITCLAUDE_HUD_STATE_ROOT: await $.env.get("LITCLAUDE_HUD_STATE_ROOT"),
|
|
351
357
|
LITCLAUDE_AUTO_HANDOFF: await $.env.get("LITCLAUDE_AUTO_HANDOFF"),
|
|
352
358
|
LITCLAUDE_AUTO_HANDOFF_PERCENT: await $.env.get("LITCLAUDE_AUTO_HANDOFF_PERCENT"),
|
|
359
|
+
LITCLAUDE_HOME: await $.env.get("LITCLAUDE_HOME"),
|
|
360
|
+
HOME: await $.env.get("HOME"),
|
|
353
361
|
};
|
|
354
362
|
live.iconFont = await detectIconFont(stateIo($), {
|
|
355
363
|
HOME: await $.env.get("HOME"),
|
|
@@ -19,8 +19,8 @@ export const canonicalSkillResourceManifest = Object.freeze(
|
|
|
19
19
|
["lib/office_data.py", "0f4c2449622b6d59630e60508594d181279052c41918df4370e11a68df1ee239"],
|
|
20
20
|
["lib/office_runtime_bootstrap.py", "6b32ab8d9ae46963770310c559825c83aa6ff80752df7de497c6cf0148d9f48e"],
|
|
21
21
|
["lib/ooxml_integrity.py", "85e5cba28aa3b9f4f4c28f59c6118439a985fe4f29e25274ae63e9ef1edf15e3"],
|
|
22
|
-
["lib/owner-lock.mjs", "
|
|
23
|
-
["lib/plan-task-rows.mjs", "
|
|
22
|
+
["lib/owner-lock.mjs", "d70c57b603987f0865add60dad442489acb42541a8dedeb3fe254429f4bfa7b6"],
|
|
23
|
+
["lib/plan-task-rows.mjs", "ca45412631cdfa805102a42dbb3cfc9a43f6f1ecbcdabe1cc5059d2dcb5e58df"],
|
|
24
24
|
["lib/rename-aliases.mjs", "3ee93aec10d0dbe785c554ab3040173ee94fde27da1b440a54b0513e5d11a508"],
|
|
25
25
|
["lib/render_pages.py", "69e20951dff5af47cff074b699ad992f489f5ac14559a5c114e17aa4dbaa5db7"],
|
|
26
26
|
["lib/rewind/brief.mjs", "e21bb31476ea38a87ef0a5042f688bde7ab1028dead61f32d2d7502a9271964f"],
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// `lit invite @<github-id>` (plans/invite-pilot.md): the invitee records who invited them, and the
|
|
2
|
+
// LIT card shows its `club` look from then on. Honor system and cosmetic only: the record lives in
|
|
3
|
+
// `$LITCLAUDE_HOME/invite.json` (`~/.litclaude/invite.json` by default) on this machine, nothing is
|
|
4
|
+
// sent anywhere, and the messages only print the Discussions link where invites are counted.
|
|
5
|
+
//
|
|
6
|
+
// The home folder and `invite.json` must be real (a symlink at either is refused), the record is
|
|
7
|
+
// written to a fresh temporary file and renamed into place, and the first inviter is kept.
|
|
8
|
+
|
|
9
|
+
import { closeSync, constants, lstatSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, writeSync } from "node:fs";
|
|
10
|
+
import { homedir } from "node:os";
|
|
11
|
+
import { join } from "node:path";
|
|
12
|
+
|
|
13
|
+
export const DISCUSSIONS_URL = "https://github.com/wjgoarxiv/litfamily/discussions";
|
|
14
|
+
export const INVITE_FILE = "invite.json";
|
|
15
|
+
|
|
16
|
+
const ID = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/u;
|
|
17
|
+
const MAX_RECORD_BYTES = 4096;
|
|
18
|
+
const NO_FOLLOW = constants.O_NOFOLLOW ?? 0;
|
|
19
|
+
|
|
20
|
+
/** The GitHub id after stripping one leading `@`, or null when it is not one. */
|
|
21
|
+
export const parseInviteId = (raw) => {
|
|
22
|
+
if (typeof raw !== "string") return null;
|
|
23
|
+
const id = raw.startsWith("@") ? raw.slice(1) : raw;
|
|
24
|
+
return ID.test(id) ? id : null;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// Only a whole prompt counts, spelled like `lit approve` (start-work-lifecycle.mjs APPROVE_TOKEN):
|
|
28
|
+
// a longer, quoted or relayed message that merely mentions `lit invite` keeps its ordinary route.
|
|
29
|
+
const INVITE_PROMPT = /^lit[ \t]+invite(?:[ \t]+(\S+))?$/iu;
|
|
30
|
+
|
|
31
|
+
/** `{ id }` (null for a bare `lit invite`) when the whole prompt is an invite, else null. */
|
|
32
|
+
export const parseInvitePrompt = (prompt) => {
|
|
33
|
+
if (typeof prompt !== "string" || prompt.length > 512) return null;
|
|
34
|
+
const match = INVITE_PROMPT.exec(prompt.trim());
|
|
35
|
+
return match ? { id: match[1] ?? null } : null;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** Same rule as automatic-update.mjs resolveHome: LITCLAUDE_HOME, else ~/.litclaude. */
|
|
39
|
+
export const inviteHome = (env = process.env) => (env.LITCLAUDE_HOME ? env.LITCLAUDE_HOME : join(homedir(), ".litclaude"));
|
|
40
|
+
|
|
41
|
+
const validRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value)
|
|
42
|
+
&& value.version === 1 && parseInviteId(value.invitedBy) === value.invitedBy && typeof value.at === "string" && Number.isFinite(Date.parse(value.at));
|
|
43
|
+
|
|
44
|
+
const realFolder = (path) => {
|
|
45
|
+
try {
|
|
46
|
+
return lstatSync(path).isDirectory();
|
|
47
|
+
} catch {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** The stored record, or null when there is none or it is not a real, well-formed file. */
|
|
53
|
+
export const readInvite = ({ home = inviteHome() } = {}) => {
|
|
54
|
+
if (!realFolder(home)) return null;
|
|
55
|
+
const path = join(home, INVITE_FILE);
|
|
56
|
+
try {
|
|
57
|
+
const stat = lstatSync(path);
|
|
58
|
+
if (!stat.isFile() || stat.size > MAX_RECORD_BYTES) return null;
|
|
59
|
+
const value = JSON.parse(readFileSync(path, "utf8"));
|
|
60
|
+
return validRecord(value) ? { version: 1, invitedBy: value.invitedBy, at: value.at } : null;
|
|
61
|
+
} catch {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const writeRecord = (home, record) => {
|
|
67
|
+
mkdirSync(home, { recursive: true, mode: 0o700 });
|
|
68
|
+
if (!realFolder(home)) throw new Error("the LitClaude home is not a real folder");
|
|
69
|
+
const target = join(home, INVITE_FILE);
|
|
70
|
+
try {
|
|
71
|
+
if (!lstatSync(target).isFile()) throw new Error("invite.json is not a regular file");
|
|
72
|
+
} catch (error) {
|
|
73
|
+
if (error?.code !== "ENOENT") throw error;
|
|
74
|
+
}
|
|
75
|
+
const temporary = join(home, `.${INVITE_FILE}.${process.pid}.${Date.now()}.tmp`);
|
|
76
|
+
const fd = openSync(temporary, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | NO_FOLLOW, 0o600);
|
|
77
|
+
try {
|
|
78
|
+
try {
|
|
79
|
+
writeSync(fd, `${JSON.stringify(record)}\n`);
|
|
80
|
+
} finally {
|
|
81
|
+
closeSync(fd);
|
|
82
|
+
}
|
|
83
|
+
renameSync(temporary, target);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
rmSync(temporary, { force: true });
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Records `raw` as this machine's inviter. `{ status }` is `invalid` (nothing written), `recorded`,
|
|
92
|
+
* `same` (that id is already the inviter), `kept` (another id already is; `requested` is the one
|
|
93
|
+
* refused) or `failed` (the home or the file could not be written safely; nothing written).
|
|
94
|
+
*/
|
|
95
|
+
export const recordInvite = (raw, { home = inviteHome(), now = () => new Date() } = {}) => {
|
|
96
|
+
const id = parseInviteId(raw);
|
|
97
|
+
if (!id) return { status: "invalid", input: typeof raw === "string" ? raw : "" };
|
|
98
|
+
const existing = readInvite({ home });
|
|
99
|
+
if (existing) {
|
|
100
|
+
return existing.invitedBy.toLowerCase() === id.toLowerCase()
|
|
101
|
+
? { status: "same", record: existing }
|
|
102
|
+
: { status: "kept", record: existing, requested: id };
|
|
103
|
+
}
|
|
104
|
+
const record = { version: 1, invitedBy: id, at: now().toISOString() };
|
|
105
|
+
try {
|
|
106
|
+
writeRecord(home, record);
|
|
107
|
+
} catch (error) {
|
|
108
|
+
return { status: "failed", reason: error?.code ?? (error instanceof Error ? error.message : "write failed") };
|
|
109
|
+
}
|
|
110
|
+
return { status: "recorded", record };
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/** What to tell friends: the line they type, and where invites are counted. */
|
|
114
|
+
export const shareLine = () =>
|
|
115
|
+
`Invite a friend: ask them to type \`lit invite @<your GitHub id>\` in Claude Code with LitClaude. They get the club card look, and you both can say hi in ${DISCUSSIONS_URL}`;
|
|
116
|
+
|
|
117
|
+
/** The message one recordInvite result prints, in the CLI and as the prompt hook's answer. */
|
|
118
|
+
export const inviteMessage = (result) => {
|
|
119
|
+
switch (result?.status) {
|
|
120
|
+
case "recorded":
|
|
121
|
+
return `Thanks for joining through @${result.record.invitedBy}. The club look is on for your LIT card (turn it off with \`litclaude-ai config club off\`). Nothing was sent anywhere; if you like, post "invited by @${result.record.invitedBy}" in ${DISCUSSIONS_URL}`;
|
|
122
|
+
case "same":
|
|
123
|
+
return `You were already invited by @${result.record.invitedBy}; nothing changed. The thread: ${DISCUSSIONS_URL}`;
|
|
124
|
+
case "kept":
|
|
125
|
+
return `You were already invited by @${result.record.invitedBy}, and the first invite stays; @${result.requested} was not recorded. The thread: ${DISCUSSIONS_URL}`;
|
|
126
|
+
case "invalid":
|
|
127
|
+
return "That is not a GitHub id: use letters, digits and single hyphens, up to 39 characters, not starting with a hyphen (for example `lit invite @octocat`). Nothing was recorded.";
|
|
128
|
+
default:
|
|
129
|
+
return `The invite could not be saved (${result?.reason ?? "unknown error"}): the LitClaude home folder or invite.json is not a plain, writable file. Nothing was recorded.`;
|
|
130
|
+
}
|
|
131
|
+
};
|