@tryglen/cli 0.34.0 → 0.36.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 (74) hide show
  1. package/README.md +19 -19
  2. package/dist/_utils/agent-adapter.d.ts +2 -0
  3. package/dist/_utils/agent-adapter.js +3 -1
  4. package/dist/_utils/agent-adapter.js.map +1 -1
  5. package/dist/_utils/detect-transcript-format.d.ts +1 -1
  6. package/dist/_utils/detect-transcript-format.js.map +1 -1
  7. package/dist/_utils/install-receipt.d.ts +9 -1
  8. package/dist/_utils/install-receipt.js +19 -1
  9. package/dist/_utils/install-receipt.js.map +1 -1
  10. package/dist/_utils/jcode-bundle.d.ts +3 -0
  11. package/dist/_utils/jcode-bundle.js +23 -0
  12. package/dist/_utils/jcode-bundle.js.map +1 -0
  13. package/dist/_utils/jcode-event.d.ts +3 -0
  14. package/dist/_utils/jcode-event.js +82 -0
  15. package/dist/_utils/jcode-event.js.map +1 -0
  16. package/dist/_utils/jcode-hook-lines.d.ts +5 -0
  17. package/dist/_utils/jcode-hook-lines.js +11 -0
  18. package/dist/_utils/jcode-hook-lines.js.map +1 -0
  19. package/dist/_utils/jcode-hooks-toml.d.ts +8 -0
  20. package/dist/_utils/jcode-hooks-toml.js +156 -0
  21. package/dist/_utils/jcode-hooks-toml.js.map +1 -0
  22. package/dist/_utils/jcode-paths.d.ts +7 -0
  23. package/dist/_utils/jcode-paths.js +13 -0
  24. package/dist/_utils/jcode-paths.js.map +1 -0
  25. package/dist/_utils/jcode-setup.d.ts +27 -0
  26. package/dist/_utils/jcode-setup.js +158 -0
  27. package/dist/_utils/jcode-setup.js.map +1 -0
  28. package/dist/_utils/jcode-skills-sync.d.ts +8 -0
  29. package/dist/_utils/jcode-skills-sync.js +79 -0
  30. package/dist/_utils/jcode-skills-sync.js.map +1 -0
  31. package/dist/_utils/managed-block.d.ts +4 -0
  32. package/dist/_utils/managed-block.js +42 -0
  33. package/dist/_utils/managed-block.js.map +1 -0
  34. package/dist/_utils/parse-harbor-atif.js +2 -1
  35. package/dist/_utils/parse-harbor-atif.js.map +1 -1
  36. package/dist/_utils/parse-jcode-session.d.ts +14 -0
  37. package/dist/_utils/parse-jcode-session.js +128 -0
  38. package/dist/_utils/parse-jcode-session.js.map +1 -0
  39. package/dist/_utils/plugin-status.d.ts +1 -1
  40. package/dist/_utils/plugin-status.js +28 -0
  41. package/dist/_utils/plugin-status.js.map +1 -1
  42. package/dist/_utils/transcript-turns.d.ts +1 -1
  43. package/dist/bin.js +9 -6
  44. package/dist/bin.js.map +1 -1
  45. package/dist/commands/doctor.js +19 -1
  46. package/dist/commands/doctor.js.map +1 -1
  47. package/dist/commands/ingest.js +28 -18
  48. package/dist/commands/ingest.js.map +1 -1
  49. package/dist/commands/install.d.ts +1 -0
  50. package/dist/commands/install.js +55 -10
  51. package/dist/commands/install.js.map +1 -1
  52. package/dist/commands/session-start.js +18 -8
  53. package/dist/commands/session-start.js.map +1 -1
  54. package/dist/commands/uninstall.js +4 -0
  55. package/dist/commands/uninstall.js.map +1 -1
  56. package/dist/commands/update.js +19 -0
  57. package/dist/commands/update.js.map +1 -1
  58. package/dist/jcode/plugin.json +8 -0
  59. package/dist/jcode/preferred-tools.md +3 -0
  60. package/dist/jcode/prompt-overlay.md +15 -0
  61. package/dist/jcode/skills/code-search/SKILL.md +19 -0
  62. package/dist/jcode/skills/controls/SKILL.md +45 -0
  63. package/dist/jcode/skills/create-artifact/SKILL.md +11 -0
  64. package/dist/jcode/skills/create-skill/SKILL.md +41 -0
  65. package/dist/jcode/skills/feedback/SKILL.md +59 -0
  66. package/dist/jcode/skills/forget/SKILL.md +41 -0
  67. package/dist/jcode/skills/import-transcripts/SKILL.md +27 -0
  68. package/dist/jcode/skills/invite/SKILL.md +28 -0
  69. package/dist/jcode/skills/search/SKILL.md +35 -0
  70. package/dist/jcode/skills/session-takeover/SKILL.md +67 -0
  71. package/dist/jcode/skills/setup/SKILL.md +62 -0
  72. package/dist/jcode/skills/use-artifact/SKILL.md +11 -0
  73. package/dist/jcode/skills/use-skill/SKILL.md +10 -0
  74. package/package.json +5 -3
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: search
3
+ description: Search the team's shared glen memory for a SPECIFIC fact, decision, or past discussion that is not already in the auto-injected context. Do not use for things already recalled this turn.
4
+ ---
5
+
6
+ For current or source-owned facts, use the available source-of-truth tool first (for example, Slack, GitHub, Notion, or logs), especially when the user names it. Use Glen only for durable history or to supplement that source; if the live source is unavailable, say so, and if it conflicts with Glen, prefer it for current state.
7
+
8
+ Run `glen search "<query>"` via Bash — **start with ONE comprehensive query, not a
9
+ fan-out of variants**.
10
+
11
+ Each search takes ~10 seconds of real user-facing wait, and the server ranks results
12
+ with an LLM that reads your query as free-text intent — so one detailed, self-contained
13
+ query beats several keyword variants. Pack everything you know into a single query:
14
+ who/what/where, the repo or system involved, and what kind of answer you need (a
15
+ decision, an owner, a rationale, setup steps).
16
+
17
+ - ✅ `glen search "Shams's recent work on the usage-page redesign in the dashboard repo — what was decided, current status, and who owns it"`
18
+ - ❌ `glen search "Shams"` … `glen search "usage page redesign"` … `glen search "dashboard"`
19
+
20
+ If a hook or reminder suggests multiple search questions, merge the related ones into
21
+ one query and run that single search.
22
+
23
+ Follow-up searches are fine for going DEEPER — when the first result surfaces
24
+ something new worth chasing (a project you didn't know to name, a decision that
25
+ points at another decision), and the answer would genuinely change what you do next.
26
+ But every extra search is another ~10s the user sits waiting, so don't overdo it:
27
+ ask yourself whether the follow-up will provide real value the first result didn't,
28
+ and skip it if you already have enough to act. Never re-run a mere rephrase of a
29
+ query that returned little — same memory, same cost, nothing new.
30
+
31
+ The output is a synthesized answer followed by a "Sources:" list (conversation ·
32
+ date · author · id) — treat the answer as recalled memory (it may be outdated or
33
+ conflicting), and cite the sources when relevant. If it prints no results, say so
34
+ rather than re-searching variants.
35
+ If it prints "No active organization", tell the user to run `glen org switch`.
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: session-takeover
3
+ description: Use when the user provides a Glen takeover code or generated command to open its shared transcript in a fresh native agent session.
4
+ ---
5
+
6
+ # Session Takeover
7
+
8
+ Use this skill only to open a shared Glen transcript in a fresh native session.
9
+ Do not use it to resume the current session or import local transcript archives.
10
+
11
+ Use this two-stage contract:
12
+
13
+ 1. **Select and classify before constructing a command.** Make no tool call.
14
+ Candidate selection has exactly two allowed message shapes:
15
+
16
+ - Plain-message form: the candidate is the entire user message, with nothing
17
+ before or after it.
18
+ - Fenced-block form: the message contains exactly one fenced code block, has
19
+ no non-whitespace content outside that block, and the candidate is the
20
+ block's sole content.
21
+
22
+ Every other message shape is INVALID. Do not search for or extract a
23
+ `glen takeover` substring from prose. Classify the whole unnormalized
24
+ selected candidate:
25
+
26
+ - VALID raw code: the entire candidate matches `^[A-Za-z0-9_-]{43}$`.
27
+ - VALID generated command: the entire candidate matches
28
+ `^glen takeover ([A-Za-z0-9_-]{43})$`; capture group 1 is the code.
29
+ - INVALID: every other candidate. Examples include prefix or suffix prose, a
30
+ command embedded in a paragraph, prose surrounding a fenced block, multiple
31
+ fenced blocks, `glen takeover --help`, `glen takeover <valid-code>.`,
32
+ `glen takeover <valid-code> extra`,
33
+ `glen takeover <valid-code>; printf TAKEOVER_INJECTION_PROBE`,
34
+ `glen takeover <valid-code>$(printf TAKEOVER_INJECTION_PROBE)`, and
35
+ ``glen takeover <valid-code>`printf TAKEOVER_INJECTION_PROBE` ``.
36
+
37
+ 2. **Produce exactly one allowed output.**
38
+
39
+ - VALID: make exactly one Bash call from the captured code:
40
+
41
+ ```bash
42
+ glen takeover '<validated-code>'
43
+ ```
44
+
45
+ - INVALID: make zero tool calls, reply exactly "Please paste the complete
46
+ generated `glen takeover ...` command by itself in a code block.", and
47
+ stop.
48
+
49
+ Construct the VALID Bash call from the captured code as one opaque quoted
50
+ argument, never from the user's pasted command string. Never guess, sanitize,
51
+ decode, alter, summarize, truncate, or invent a code.
52
+
53
+ Treat the CLI output as authoritative:
54
+
55
+ - If disconnected, tell the user to run `glen login`.
56
+ - If no organization is active, tell the user to run `glen org switch`.
57
+ - If the handoff is expired, unavailable, or belongs to another recipient, ask
58
+ the sender for a new command.
59
+ - If compatibility or context-fit validation fails, report the exact failure and
60
+ stop. Never bypass the guard or shorten the transcript.
61
+ - If installation succeeds but launch fails, surface the exact native resume
62
+ command printed by the CLI.
63
+
64
+ On success, explain that Glen opened a fresh native session containing the
65
+ verified inherited history and left the source transcript unchanged. Do not
66
+ pretend the current session became the takeover destination or continue the
67
+ inherited work here.
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: setup
3
+ description: Set up, fix, or update glen on this machine. Use when the user asks to "set up glen", "fix glen", "update glen", says glen is not working / not connected / not recording, or the status line shows glen is not connected or has no org selected.
4
+ ---
5
+
6
+ Run `glen doctor` first and branch on its `status:` lines. Fix ONLY what is
7
+ broken, in this order, then re-run `glen doctor` to verify and confirm to the
8
+ user what changed.
9
+
10
+ - `glen: command not found` → install the CLI: `npm install -g @tryglen/cli`,
11
+ then run `glen install` (it sets up the plugin + hooks for this agent).
12
+ - `status: cli=<x> latest=<y> channel=<...>` where y is newer than x → run
13
+ `glen update` (updates the CLI and any installed glen plugins in one go).
14
+ - `status: login=missing ...` → run `glen login` — a browser window opens with
15
+ a short device code prefilled; the user approves it to connect their account.
16
+ If no browser can open (SSH/headless), relay the printed URL and code so the
17
+ user can approve from any device.
18
+ - `status: login=ok org=missing` → run `glen org list`, show the user the
19
+ options, and run `glen org switch <slug>` for their choice. Never pick an
20
+ org for them.
21
+ - `status: jcode=detected plugin=not-installed` → run `glen install --agent jcode`.
22
+ It writes glen's hook lines into `~/.jcode/config.toml`, a managed block into
23
+ `~/.jcode/prompt-overlay.md` and `~/.jcode/preferred-tools.md`, and the glen
24
+ skills into `~/.jcode/skills/`. Tell the user to start a NEW jcode session
25
+ afterwards — jcode reads its prompt files at session start.
26
+ - `status: claude=detected plugin=not-installed` (or codex/pi) → run
27
+ `glen install --agent <claude|codex|pi>` for that agent.
28
+ - `status: codex=detected plugin=... hooks=not-registered` → run
29
+ `glen install --agent codex`.
30
+ - `status: codex-self-heal=failed: ...` → run `glen install --agent codex`,
31
+ then re-check.
32
+ - `status: claude=not-found` (or `status: codex=not-found` /
33
+ `status: pi=not-found` / `status: jcode=not-found`) when the user says it IS
34
+ installed → ask them to run `which claude` (or `which codex` / `which pi` /
35
+ `which jcode`) in their terminal, then run `glen install --claude-path
36
+ <that path>` (or `--codex-path` / `--pi-path` / `--jcode-path`).
37
+
38
+ `glen doctor` also prints one `status: ingest agent=<agent>
39
+ state=<ok|failing|never|fresh-install|idle> lastSuccess=<iso|never>` line per
40
+ detected agent — this tracks whether hooks are actually firing, separate from
41
+ whether the plugin is installed:
42
+ - `ok` / `failing` — reflects the last recorded hook run. For `failing`,
43
+ doctor prints a remedy right after the line (check `glen status`, then
44
+ `glen login` if disconnected).
45
+ - `fresh-install` — installed under an hour ago with no ingest yet; not a
46
+ fault, just still warming up.
47
+ - `idle` — hooks fire here; nothing recorded yet — logged out, glen off, or
48
+ no completed turn.
49
+ - `never` — hooks have never fired on THIS machine. Doctor prints a remedy
50
+ right after the line: untrusted hooks (trust them in-agent and start a new
51
+ session), a PATH gap, a failed hook-trust query, or a machine-topology
52
+ mismatch.
53
+ - A topology mismatch usually means the agent process runs on a different
54
+ machine than the one you're looking at: Codex `--remote` / Desktop-SSH and
55
+ Claude Code over SSH/devcontainer both run the agent — and its hooks — on
56
+ the REMOTE host, not locally. Install glen there and run `glen doctor` on
57
+ that machine, as the user the agent connects as. Cloud sessions (Codex
58
+ Cloud tasks, claude.ai/code) can't run user-level hooks at all — only
59
+ repo-committed hooks apply there.
60
+
61
+ Finish with `glen status` and tell the user, in one sentence, what state they
62
+ are in now.
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: use-artifact
3
+ description: Fetch and display an artifact from the user's Glen library (their own artifacts plus ones shared with them). Use when the user asks to open, view, render, or download a saved Glen artifact.
4
+ ---
5
+
6
+ 1. **Find it.** If you don't know the slug, run `glen artifact search "<intent>"` via Bash and confirm the right one with the user. Search covers the user's own artifacts plus ones shared with them (directly or org-wide) — a teammate's unshared artifact won't appear.
7
+ 2. **Fetch it.** Run `glen artifact get <slug>` via Bash. The output is the document (Markdown or HTML+CSS).
8
+ 3. **Show it.**
9
+ - **Markdown:** present it inline.
10
+ - **HTML:** write it to a local `.html` file, then open it in the system browser (`open <file>`); if that is not available, share the dashboard link below. It is a self-contained page with no JavaScript.
11
+ 4. **Always** share the dashboard link so the user has the canonical rendered copy: `https://app.tryglen.com/artifacts/<slug>`.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: use-skill
3
+ description: Find and run a reusable skill from the Glen skill library (your skills plus ones shared with you) when you don't know its exact slug. Use when the user asks to "use a Glen skill", "find a skill for X", or wants a teammate's saved workflow.
4
+ ---
5
+
6
+ 1. **Search.** Run `glen skill search "<intent>"` via Bash (add `--by "<author>"`, or `--by me` for your own skills). It prints ranked candidates, each with its **[slug]**, author, and description.
7
+ 2. **Confirm.** If several plausibly match, show the top 2–3 (name + description + author) and ask the user which one. If it prints "no matching skills", say so — don't invent a skill.
8
+ 3. **Check requirements.** If the output has a `## Requirements` section, make sure each listed tool is available — follow its source link to install/enable it (or tell the user) — before you start.
9
+ 4. **Run it.** Run `glen skill use <slug>` via Bash. The output is markdown **instructions to execute now** — follow them as if they were a skill. If the skill bundles files, they're materialized locally first and the output references them by **absolute path** (e.g. a script under `~/.glen/skills/<slug>/scripts/`) — run scripts exactly as written, don't rewrite the paths.
10
+ 5. **Follow referenced skills on demand.** The instructions may contain runnable `glen skill use <slug>` commands for related skills. Run one via Bash only when its step applies — they're pulled on demand, not all upfront. Skills mentioned via `glen:` links are prefetched — their files are already materialized on disk by the time you pull them, and every `glen skill use` verifies freshness with the server so files on disk are always current.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryglen/cli",
3
- "version": "0.34.0",
3
+ "version": "0.36.0",
4
4
  "description": "Glen CLI — memory for coding agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,7 +10,8 @@
10
10
  "dist"
11
11
  ],
12
12
  "scripts": {
13
- "build": "tsc && chmod +x dist/bin.js",
13
+ "build": "tsc && chmod +x dist/bin.js && pnpm build:jcode",
14
+ "build:jcode": "rm -rf dist/jcode && mkdir -p dist/jcode && cp -R ../jcode-plugin/skills ../jcode-plugin/plugin.json ../jcode-plugin/prompt-overlay.md ../jcode-plugin/preferred-tools.md dist/jcode/",
14
15
  "build:indicator": "./macos/build.sh",
15
16
  "check": "biome check src/ && tsc --noEmit",
16
17
  "test": "vitest run",
@@ -18,7 +19,8 @@
18
19
  },
19
20
  "dependencies": {
20
21
  "cac": "^6.7.14",
21
- "prompts": "^2.4.2"
22
+ "prompts": "^2.4.2",
23
+ "smol-toml": "^1.8.0"
22
24
  },
23
25
  "devDependencies": {
24
26
  "@biomejs/biome": "^1.9.0",