greprag 5.49.12 → 5.49.14
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/dist/codex-steering.js +10 -1
- package/dist/codex-steering.js.map +1 -1
- package/dist/commands/checkpoint-helpers.js +3 -1
- package/dist/commands/checkpoint-helpers.js.map +1 -1
- package/dist/commands/codex-app-server-client.d.ts +46 -0
- package/dist/commands/codex-app-server-client.js +122 -0
- package/dist/commands/codex-app-server-client.js.map +1 -0
- package/dist/commands/codex-app-server.js +33 -89
- package/dist/commands/codex-app-server.js.map +1 -1
- package/dist/commands/codex-delivery.d.ts +33 -0
- package/dist/commands/codex-delivery.js +187 -0
- package/dist/commands/codex-delivery.js.map +1 -0
- package/dist/commands/codex-doctor.js +29 -1
- package/dist/commands/codex-doctor.js.map +1 -1
- package/dist/commands/codex-supervisor.d.ts +5 -0
- package/dist/commands/codex-supervisor.js +94 -15
- package/dist/commands/codex-supervisor.js.map +1 -1
- package/dist/commands/codex-wake-test.d.ts +27 -0
- package/dist/commands/codex-wake-test.js +135 -0
- package/dist/commands/codex-wake-test.js.map +1 -0
- package/dist/commands/codex.js +45 -19
- package/dist/commands/codex.js.map +1 -1
- package/dist/commands/fix.js +3 -2
- package/dist/commands/fix.js.map +1 -1
- package/dist/commands/inbox-primer-reminder.d.ts +1 -1
- package/dist/commands/inbox-primer-reminder.js +8 -2
- package/dist/commands/inbox-primer-reminder.js.map +1 -1
- package/dist/commands/opencode-interrupt.d.ts +15 -0
- package/dist/commands/opencode-interrupt.js +37 -0
- package/dist/commands/opencode-interrupt.js.map +1 -0
- package/dist/commands/reminder-types.d.ts +2 -0
- package/dist/hook.js +19 -12
- package/dist/hook.js.map +1 -1
- package/dist/index.js +11 -9
- package/dist/index.js.map +1 -1
- package/dist/opencode-plugin.bundle.js +416 -6
- package/dist/opencode-plugin.js +34 -0
- package/dist/opencode-plugin.js.map +1 -1
- package/dist/session-id.d.ts +7 -6
- package/dist/session-id.js +8 -6
- package/dist/session-id.js.map +1 -1
- package/package.json +1 -1
- package/skill/greprag/SKILL.md +1 -1
- package/skill/greprag/docs/setup.md +12 -7
- package/skill/templates/chip-bootloader.md +107 -0
- package/skill/templates/chip-spawn.md +15 -2
- package/dist/commands/procedure.d.ts +0 -15
- package/dist/commands/procedure.js +0 -167
- package/dist/commands/procedure.js.map +0 -1
- package/dist/procedure.d.ts +0 -88
- package/dist/procedure.js +0 -269
- package/dist/procedure.js.map +0 -1
package/dist/session-id.js
CHANGED
|
@@ -71,14 +71,16 @@ function truncateSessionId(sessionId) {
|
|
|
71
71
|
}
|
|
72
72
|
/** THE single source of truth for THIS session's id outside a hook payload.
|
|
73
73
|
* Claude Code exports the live id as `CLAUDE_CODE_SESSION_ID` (verified on
|
|
74
|
-
* desktop 2.1.x — `CLAUDE_SESSION_ID` is NOT set).
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* here — reading the wrong name
|
|
78
|
-
* + mark-read (it
|
|
79
|
-
* or 8-hex) or null; callers
|
|
74
|
+
* desktop 2.1.x — `CLAUDE_SESSION_ID` is NOT set). Codex hook/session contexts
|
|
75
|
+
* expose `CODEX_THREAD_ID`. `CLAUDE_SESSION_ID` is kept only for older/terminal
|
|
76
|
+
* builds; `GREPRAG_SESSION_ID` is a deliberate manual override. A CLI invocation
|
|
77
|
+
* (no stdin hook payload) MUST resolve its session here — reading the wrong name
|
|
78
|
+
* silently widens `greprag inbox` to tenant-wide + mark-read (it consumes every
|
|
79
|
+
* session's mail). Returns the raw id (full UUID or 8-hex) or null; callers
|
|
80
|
+
* truncate via truncateSessionId. */
|
|
80
81
|
function readSessionEnv() {
|
|
81
82
|
return (process.env.CLAUDE_CODE_SESSION_ID
|
|
83
|
+
|| process.env.CODEX_THREAD_ID
|
|
82
84
|
|| process.env.CLAUDE_SESSION_ID
|
|
83
85
|
|| process.env.GREPRAG_SESSION_ID
|
|
84
86
|
|| null);
|
package/dist/session-id.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-id.js","sourceRoot":"","sources":["../src/session-id.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcH,8CAKC;
|
|
1
|
+
{"version":3,"file":"session-id.js","sourceRoot":"","sources":["../src/session-id.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcH,8CAKC;AAWD,wCAQC;AAaD,oCAIC;AASD,8CAaC;AAWD,sDAUC;AAuBD,8CAaC;AAWD,kDAaC;AA5JD,2CAA6B;AAC7B,uCAAyB;AAEzB;;;;;;;;kDAQkD;AAClD,SAAgB,iBAAiB,CAAC,SAAoC;IACpE,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC7D,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAC/D,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACzB,CAAC;AAED;;;;;;;;sCAQsC;AACtC,SAAgB,cAAc;IAC5B,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,sBAAsB;WAC/B,OAAO,CAAC,GAAG,CAAC,eAAe;WAC3B,OAAO,CAAC,GAAG,CAAC,iBAAiB;WAC7B,OAAO,CAAC,GAAG,CAAC,kBAAkB;WAC9B,IAAI,CACR,CAAC;AACJ,CAAC;AAED;;;;;;;;;;yDAUyD;AACzD,SAAgB,YAAY,CAAC,SAAoC;IAC/D,OAAO,SAAS;QACd,CAAC,CAAC,yEAAyE;QAC3E,CAAC,CAAC,6CAA6C,CAAC;AACpD,CAAC;AAED;;;;;;0CAM0C;AAC1C,SAAgB,iBAAiB;IA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CAAC,CAAC,CAAC,gBAAgB,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACzD,0EAA0E;IAC1E,+EAA+E;IAC/E,0EAA0E;IAC1E,6BAA6B;IAC7B,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7C,MAAM,KAAK,GAAG,iCAAiC,KAAK,UAAU,KAAK,GAAG,IAAI,EAAE,CAAC;IAC7E,iFAAiF;IACjF,gFAAgF;IAChF,sDAAsD;IACtD,OAAO,kBAAkB,KAAK,gDAAgD,CAAC;AACjF,CAAC;AAED;;;;;;;;qDAQqD;AACrD,SAAgB,mBAAmB,CACjC,KAA8B;IAE9B,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAClD,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,MAAM,KAAK,GAAG,iBAAiB,EAAE,CAAC;IAClC,MAAM,OAAO,GAAG;QACd,kBAAkB,EAAE;YAClB,aAAa,EAAE,cAAc;YAC7B,iBAAiB,EAAE,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC;SACvD;KACF,CAAC;IACF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;AACvD,CAAC"}
|
package/package.json
CHANGED
package/skill/greprag/SKILL.md
CHANGED
|
@@ -127,7 +127,7 @@ Aliases (silent back-compat): `greprag memory briefing` → `recap` (renamed v5.
|
|
|
127
127
|
|
|
128
128
|
**Codex: DO NOT CLAIM HOOKS ARE ACTIVE JUST BECAUSE `~/.codex/hooks.json` EXISTS.** Codex Desktop requires Settings -> Settings -> Hooks trust review before command hooks run automatically. If turn capture is missing after `greprag init --codex`, tell the user: open Codex Desktop Settings -> Settings -> Hooks, trust the 6 GrepRAG hooks, then start a fresh Codex session.
|
|
129
129
|
|
|
130
|
-
**Codex live inbox push requires the startup watcher.** Hooks only fire at Codex turn/tool/session boundaries. Public installs should use `greprag init --codex --tenant-id <handle> --install-watcher`; run `greprag codex doctor --wake-test` to inspect state, and use `greprag codex watch --session <id>` only for foreground testing. The sidecar listens to GrepRAG inbox SSE
|
|
130
|
+
**Codex live inbox push requires the startup watcher.** Hooks only fire at Codex turn/tool/session boundaries. Public installs should use `greprag init --codex --tenant-id <handle> --install-watcher`; run `greprag codex doctor --wake-test` to inspect state, and use `greprag codex watch --session <id>` only for foreground testing. The sidecar listens to GrepRAG inbox SSE; the proven Desktop-visible wake path is Codex app-layer thread continuation (`send_message_to_thread` shape, visible `codex_delegation` turn). `codex exec resume` is only fallback/diagnostic because it can append to history without surfacing in the active Desktop pane. If wake-test reports only fallback, describe live push as unconfirmed/non-visible and rely on turn-bound inbox steering for reliable delivery.
|
|
131
131
|
|
|
132
132
|
**ABOUT TO `greprag send` TO A `@gmail.com` / `@anthropic.com` / REAL EMAIL ADDRESS? STOP — for `inbox`/`send` (internal cross-session messaging), `users.email` IS NEVER A ROUTING ADDRESS.** Use the numeric handle (`1834729@greprag.com`) or claimed vanity alias (`travis@greprag.com`). If you don't know the recipient's handle, ASK — don't guess from their email. adr: adr/numeric-handles.md. Full grammar: `docs/inbox.md § address`.
|
|
133
133
|
|
|
@@ -64,7 +64,12 @@ greprag codex watch --session <8hex-or-full-codex-session-id>
|
|
|
64
64
|
|
|
65
65
|
If `--session` is omitted, it uses the latest Codex session recorded in
|
|
66
66
|
`~/.codex/session_index.jsonl`. The sidecar stays attached to GrepRAG inbox SSE
|
|
67
|
-
and
|
|
67
|
+
and should wake Codex through the Desktop app-layer thread continuation path,
|
|
68
|
+
equivalent to Codex's `send_message_to_thread` tool. The successful visible
|
|
69
|
+
shape is a delegated turn in the target thread (`codex_delegation` with the
|
|
70
|
+
source thread id). `codex exec resume <session> -` can append to Codex's thread
|
|
71
|
+
store, but it is not a reliable visible wake in the active Desktop pane and
|
|
72
|
+
must be treated as fallback/diagnostic only.
|
|
68
73
|
Use `greprag codex startup status` to inspect the login entry and
|
|
69
74
|
`greprag codex startup remove` to uninstall it.
|
|
70
75
|
|
|
@@ -81,13 +86,13 @@ live at `~/.greprag/logs/codex-watch.log`.
|
|
|
81
86
|
running, messages are stored and can surface on the next user prompt or after a
|
|
82
87
|
later tool call, but they do not wake idle Codex.
|
|
83
88
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Codex sandbox is unhealthy. On native Windows, this can appear as
|
|
89
|
+
Visible wake and live action are different checks. The sidecar may deliver a
|
|
90
|
+
visible delegated turn to Codex, while that turn still fails to run commands if
|
|
91
|
+
the local Codex sandbox is unhealthy. On native Windows, this can appear as
|
|
87
92
|
`windows sandbox: spawn setup refresh`. If `greprag codex doctor --wake-test`
|
|
88
|
-
reports wake action as unsupported, describe live
|
|
89
|
-
on turn-bound inbox steering until the
|
|
90
|
-
|
|
93
|
+
reports only CLI-resume fallback or wake action as unsupported, describe live
|
|
94
|
+
push as unconfirmed/non-visible and rely on turn-bound inbox steering until the
|
|
95
|
+
app-layer path is available. Do not enable unsafe sandbox bypass as a public
|
|
91
96
|
default.
|
|
92
97
|
|
|
93
98
|
## claude-code
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Chip Bootloader
|
|
2
|
+
|
|
3
|
+
No `spawn_task`? The lead creates a git worktree, the user opens a new session
|
|
4
|
+
there, and the bootloader takes over. greprag inbox is the back-channel.
|
|
5
|
+
|
|
6
|
+
## Multi-chip?
|
|
7
|
+
|
|
8
|
+
If this task needs ≥2 chips, STOP and run `greprag load chip-leader-opencode` FIRST.
|
|
9
|
+
The leader plans the integration branch, labels, seams, and merge order before
|
|
10
|
+
any chip launches. A lone chip proceeds directly below.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
## Lead: before presenting the bootloader
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
if [ -d "C:\chip-<slug>" ]; then
|
|
17
|
+
cd "C:\chip-<slug>"
|
|
18
|
+
current=$(git branch --show-current)
|
|
19
|
+
if [ "$current" = "chip/<slug>" ]; then
|
|
20
|
+
echo "Worktree already exists on correct branch — reusing"
|
|
21
|
+
else
|
|
22
|
+
echo "ERROR: Worktree dir exists but branch is '$current', not 'chip/<slug>'. Remove and retry." >&2
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
else
|
|
26
|
+
git worktree add C:\chip-<slug> -b chip/<slug>
|
|
27
|
+
fi
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The worktree IS the isolation — same pattern as Claude Code's `spawn_task` worktree
|
|
31
|
+
landing. Branch already exists, directory already isolated. Now present the
|
|
32
|
+
bootloader below and tell the user: **"Open a new session here: C:\chip-<slug>"**
|
|
33
|
+
|
|
34
|
+
## After chip reports DONE
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
git checkout <target-branch> # main or integration branch
|
|
38
|
+
git merge chip/<slug>
|
|
39
|
+
git worktree remove C:\chip-<slug>
|
|
40
|
+
git branch -d chip/<slug>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
## Bootloader template
|
|
45
|
+
|
|
46
|
+
Substitute the bracketed placeholders and present as a copyable code block.
|
|
47
|
+
|
|
48
|
+
````
|
|
49
|
+
Chip <Label>: <verb-phrase>
|
|
50
|
+
|
|
51
|
+
You are inside C:\chip-<slug> — a git worktree on branch chip/<slug>,
|
|
52
|
+
created for you by the lead. Verify:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
git branch --show-current # should output: chip/<slug>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
## Block 1 — Setup
|
|
60
|
+
|
|
61
|
+
1. Get your session ID:
|
|
62
|
+
```bash
|
|
63
|
+
greprag status 2>&1 | grep -oP '(?<=greprag session id: )[0-9a-f]+'
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
2. Announce you're alive:
|
|
67
|
+
```bash
|
|
68
|
+
greprag send "IN-FLIGHT: chip/<slug> launched — <task-summary>" \
|
|
69
|
+
--to <handle>@greprag.com/<parent-8hex> \
|
|
70
|
+
--from-session <your-8hex>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
IN-FLIGHT ping is mandatory. No ping = lead assumes chip never launched.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
## Task
|
|
77
|
+
|
|
78
|
+
<your instructions here>
|
|
79
|
+
|
|
80
|
+
Commit milestones on chip/<slug>. At each turn start, run
|
|
81
|
+
`greprag inbox --peek` — the lead may send new instructions.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
## Block 2 — Report when done
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
greprag send "<status>: <result>" \
|
|
88
|
+
--to <handle>@greprag.com/<parent-8hex> \
|
|
89
|
+
--from-session <your-8hex>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
After reporting, wait for the lead — there may be follow-up.
|
|
93
|
+
The lead will merge chip/<slug> and remove this worktree when finished.
|
|
94
|
+
````
|
|
95
|
+
|
|
96
|
+
### Placeholder reference
|
|
97
|
+
|
|
98
|
+
| Placeholder | Substitute |
|
|
99
|
+
|---|---|
|
|
100
|
+
| `<Label>` | Single-letter (A, B...) or omit for single-chip |
|
|
101
|
+
| `<verb-phrase>` | Short name, e.g. `Fix synthesis loop` |
|
|
102
|
+
| `<slug>` | Slugified — `fix-synthesis-loop` |
|
|
103
|
+
| `<parent-8hex>` | Your own session id (first 8 hex) |
|
|
104
|
+
| `<handle>` | Operator's greprag handle |
|
|
105
|
+
| `<task-summary>` | One-liner for the IN-FLIGHT ping |
|
|
106
|
+
| `<status>` | `DONE`, `BLOCKED`, `PARTIAL` |
|
|
107
|
+
| `<result>` | Summary of what was done |
|
|
@@ -22,8 +22,21 @@ Add `mode: interactive` as the first line of the task body to pause the chip for
|
|
|
22
22
|
```bash
|
|
23
23
|
main_root=$(git rev-parse --git-common-dir | xargs dirname)
|
|
24
24
|
cd "$main_root"
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
|
|
26
|
+
if [ -d ".claude/worktrees/<slug>" ]; then
|
|
27
|
+
cd ".claude/worktrees/<slug>"
|
|
28
|
+
current_branch=$(git branch --show-current)
|
|
29
|
+
if [ "$current_branch" = "chip/<slug>" ]; then
|
|
30
|
+
echo "Worktree already exists on correct branch — reusing"
|
|
31
|
+
else
|
|
32
|
+
echo "ERROR: Worktree dir exists but is on branch '$current_branch', not 'chip/<slug>'. Remove it and retry." >&2
|
|
33
|
+
exit 1
|
|
34
|
+
fi
|
|
35
|
+
else
|
|
36
|
+
git worktree add ".claude/worktrees/<slug>" -b chip/<slug>
|
|
37
|
+
cd ".claude/worktrees/<slug>"
|
|
38
|
+
fi
|
|
39
|
+
|
|
27
40
|
greprag send "IN-FLIGHT: chip/<slug> launched — working" \
|
|
28
41
|
--to <handle>@greprag.com/<8-hex-parent> --from-session <own-session-id>
|
|
29
42
|
```
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/** `greprag procedure` — manage the project's operational recipes
|
|
2
|
-
* (docs/procedure-system.md). PROOF slice: seed + inspect + dry-run match.
|
|
3
|
-
*
|
|
4
|
-
* Subcommands:
|
|
5
|
-
* list — show this project's procedures
|
|
6
|
-
* show <verb> — print one procedure + its injection text
|
|
7
|
-
* seed [--git] — write the git-ecosystem seed set (commit/merge/push/deploy/release)
|
|
8
|
-
* register --verb V --steps "..." [--caveats "..."] [--endpoint "..."] [--trigger T ...] [--destructive]
|
|
9
|
-
* rm <verb> — remove a procedure
|
|
10
|
-
* match "<text>" — dry-run: what would inject for this prompt
|
|
11
|
-
*
|
|
12
|
-
* Identity comes from the project anchor (git-root-derived), same key the
|
|
13
|
-
* hot-path hook uses. Zero network — the store is the local file beside the
|
|
14
|
-
* matchset cache. */
|
|
15
|
-
export declare function runProcedure(args: string[]): Promise<void>;
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** `greprag procedure` — manage the project's operational recipes
|
|
3
|
-
* (docs/procedure-system.md). PROOF slice: seed + inspect + dry-run match.
|
|
4
|
-
*
|
|
5
|
-
* Subcommands:
|
|
6
|
-
* list — show this project's procedures
|
|
7
|
-
* show <verb> — print one procedure + its injection text
|
|
8
|
-
* seed [--git] — write the git-ecosystem seed set (commit/merge/push/deploy/release)
|
|
9
|
-
* register --verb V --steps "..." [--caveats "..."] [--endpoint "..."] [--trigger T ...] [--destructive]
|
|
10
|
-
* rm <verb> — remove a procedure
|
|
11
|
-
* match "<text>" — dry-run: what would inject for this prompt
|
|
12
|
-
*
|
|
13
|
-
* Identity comes from the project anchor (git-root-derived), same key the
|
|
14
|
-
* hot-path hook uses. Zero network — the store is the local file beside the
|
|
15
|
-
* matchset cache. */
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.runProcedure = runProcedure;
|
|
18
|
-
const procedure_1 = require("../procedure");
|
|
19
|
-
const project_anchor_1 = require("../project-anchor");
|
|
20
|
-
function getFlag(args, flag) {
|
|
21
|
-
const idx = args.indexOf(flag);
|
|
22
|
-
if (idx === -1 || idx + 1 >= args.length)
|
|
23
|
-
return undefined;
|
|
24
|
-
return args[idx + 1];
|
|
25
|
-
}
|
|
26
|
-
/** Collect every `--trigger X` occurrence (repeatable flag). */
|
|
27
|
-
function collectFlags(args, flag) {
|
|
28
|
-
const out = [];
|
|
29
|
-
for (let i = 0; i < args.length - 1; i++) {
|
|
30
|
-
if (args[i] === flag)
|
|
31
|
-
out.push(args[i + 1]);
|
|
32
|
-
}
|
|
33
|
-
return out;
|
|
34
|
-
}
|
|
35
|
-
function resolveProjectId() {
|
|
36
|
-
const anchor = (0, project_anchor_1.readAnchor)(process.cwd());
|
|
37
|
-
return { projectId: anchor.projectId, projectName: anchor.projectName };
|
|
38
|
-
}
|
|
39
|
-
function printProcedure(p) {
|
|
40
|
-
const tag = p.destructive ? ' [DESTRUCTIVE — seed-only]' : '';
|
|
41
|
-
console.log(` ${p.verb} (${p.status})${tag}`);
|
|
42
|
-
console.log(` triggers: ${p.triggers.join(', ')}`);
|
|
43
|
-
console.log(` steps: ${p.steps}`);
|
|
44
|
-
if (p.caveats)
|
|
45
|
-
console.log(` gate: ${p.caveats}`);
|
|
46
|
-
if (p.endpoint)
|
|
47
|
-
console.log(` endpoint: ${p.endpoint}`);
|
|
48
|
-
}
|
|
49
|
-
async function runProcedure(args) {
|
|
50
|
-
const sub = args[0];
|
|
51
|
-
const rest = args.slice(1);
|
|
52
|
-
const { projectId, projectName } = resolveProjectId();
|
|
53
|
-
switch (sub) {
|
|
54
|
-
case 'list': {
|
|
55
|
-
const store = (0, procedure_1.readProcedureStore)(projectId);
|
|
56
|
-
if (store.procedures.length === 0) {
|
|
57
|
-
console.log(`No procedures for ${projectName}. Seed the git set: greprag procedure seed --git`);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
console.log(`Procedures for ${projectName} (${store.procedures.length}):`);
|
|
61
|
-
for (const p of store.procedures)
|
|
62
|
-
printProcedure(p);
|
|
63
|
-
console.log(`\n store: ${(0, procedure_1.procedureStorePath)(projectId)}`);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
case 'show': {
|
|
67
|
-
const verb = rest[0];
|
|
68
|
-
if (!verb) {
|
|
69
|
-
console.error('Usage: greprag procedure show <verb>');
|
|
70
|
-
process.exit(1);
|
|
71
|
-
}
|
|
72
|
-
const store = (0, procedure_1.readProcedureStore)(projectId);
|
|
73
|
-
const p = store.procedures.find(x => x.verb === verb);
|
|
74
|
-
if (!p) {
|
|
75
|
-
console.error(`No procedure "${verb}" for ${projectName}.`);
|
|
76
|
-
process.exit(1);
|
|
77
|
-
}
|
|
78
|
-
printProcedure(p);
|
|
79
|
-
console.log(`\n --- injection text (what the agent sees) ---`);
|
|
80
|
-
console.log((0, procedure_1.buildProcedureInjection)(p));
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
case 'seed': {
|
|
84
|
-
// --git is the only seed set today; default to it so bare `seed` works.
|
|
85
|
-
const store = (0, procedure_1.readProcedureStore)(projectId);
|
|
86
|
-
let next = store;
|
|
87
|
-
for (const p of procedure_1.GIT_SEED_SET) {
|
|
88
|
-
next = (0, procedure_1.upsertProcedure)(next, p, /* force */ true);
|
|
89
|
-
}
|
|
90
|
-
(0, procedure_1.writeProcedureStore)(projectId, next);
|
|
91
|
-
console.log(`Seeded ${procedure_1.GIT_SEED_SET.length} git-ecosystem procedures for ${projectName}:`);
|
|
92
|
-
for (const p of procedure_1.GIT_SEED_SET)
|
|
93
|
-
console.log(` • ${p.verb}${p.destructive ? ' (destructive — seed-only)' : ''}`);
|
|
94
|
-
console.log(`\n store: ${(0, procedure_1.procedureStorePath)(projectId)}`);
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
case 'register': {
|
|
98
|
-
const verb = getFlag(rest, '--verb');
|
|
99
|
-
const steps = getFlag(rest, '--steps');
|
|
100
|
-
if (!verb || !steps) {
|
|
101
|
-
console.error('Usage: greprag procedure register --verb <v> --steps "<...>" [--caveats "<...>"] [--endpoint "<...>"] [--trigger <t> ...] [--destructive]');
|
|
102
|
-
process.exit(1);
|
|
103
|
-
}
|
|
104
|
-
const triggers = collectFlags(rest, '--trigger');
|
|
105
|
-
const proc = {
|
|
106
|
-
verb,
|
|
107
|
-
triggers: triggers.length ? triggers : [verb],
|
|
108
|
-
steps,
|
|
109
|
-
caveats: getFlag(rest, '--caveats'),
|
|
110
|
-
endpoint: getFlag(rest, '--endpoint'),
|
|
111
|
-
status: 'seeded',
|
|
112
|
-
destructive: rest.includes('--destructive') || undefined,
|
|
113
|
-
};
|
|
114
|
-
const store = (0, procedure_1.readProcedureStore)(projectId);
|
|
115
|
-
(0, procedure_1.writeProcedureStore)(projectId, (0, procedure_1.upsertProcedure)(store, proc, /* force */ true));
|
|
116
|
-
console.log(`Registered procedure "${verb}" for ${projectName}.`);
|
|
117
|
-
printProcedure(proc);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
case 'rm': {
|
|
121
|
-
const verb = rest[0];
|
|
122
|
-
if (!verb) {
|
|
123
|
-
console.error('Usage: greprag procedure rm <verb>');
|
|
124
|
-
process.exit(1);
|
|
125
|
-
}
|
|
126
|
-
const store = (0, procedure_1.readProcedureStore)(projectId);
|
|
127
|
-
if (!store.procedures.some(p => p.verb === verb)) {
|
|
128
|
-
console.error(`No procedure "${verb}" for ${projectName}.`);
|
|
129
|
-
process.exit(1);
|
|
130
|
-
}
|
|
131
|
-
(0, procedure_1.writeProcedureStore)(projectId, (0, procedure_1.removeProcedure)(store, verb));
|
|
132
|
-
console.log(`Removed procedure "${verb}".`);
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
case 'match': {
|
|
136
|
-
const text = rest.join(' ').trim();
|
|
137
|
-
if (!text) {
|
|
138
|
-
console.error('Usage: greprag procedure match "<prompt text>"');
|
|
139
|
-
process.exit(1);
|
|
140
|
-
}
|
|
141
|
-
const store = (0, procedure_1.readProcedureStore)(projectId);
|
|
142
|
-
const m = (0, procedure_1.matchProcedure)(text, store);
|
|
143
|
-
if (!m) {
|
|
144
|
-
const raw = (0, procedure_1.matchProcedure)(text, store, { ignoreIntentGuard: true });
|
|
145
|
-
if (raw) {
|
|
146
|
-
console.log(`No injection — "${raw.procedure.verb}" matched on "${raw.trigger}" but the intent guard suppressed it (reads as a mention, not a request).`);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
console.log(`No procedure matches: "${text}"`);
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
console.log(`Matched "${m.procedure.verb}" via trigger "${m.trigger}". Would inject:\n`);
|
|
153
|
-
console.log((0, procedure_1.buildProcedureInjection)(m.procedure));
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
default:
|
|
157
|
-
console.log('greprag procedure — operational recipes for this repo (docs/procedure-system.md)');
|
|
158
|
-
console.log(' list list this project\'s procedures');
|
|
159
|
-
console.log(' show <verb> print one + its injection text');
|
|
160
|
-
console.log(' seed --git write the git-ecosystem seed set');
|
|
161
|
-
console.log(' register --verb ... hand-roll a procedure');
|
|
162
|
-
console.log(' rm <verb> remove a procedure');
|
|
163
|
-
console.log(' match "<text>" dry-run: what would inject for this prompt');
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
//# sourceMappingURL=procedure.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"procedure.js","sourceRoot":"","sources":["../../src/commands/procedure.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;sBAasB;;AAsCtB,oCA6GC;AAjJD,4CAIsB;AACtB,sDAA+C;AAE/C,SAAS,OAAO,CAAC,IAAc,EAAE,IAAY;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,GAAG,KAAK,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC3D,OAAO,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;AACvB,CAAC;AAED,gEAAgE;AAChE,SAAS,YAAY,CAAC,IAAc,EAAE,IAAY;IAChD,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI;YAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,gBAAgB;IACvB,MAAM,MAAM,GAAG,IAAA,2BAAU,EAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACzC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,WAAW,EAAE,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D,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;YACzD,OAAO,CAAC,GAAG,CAAC,mEAAmE,CAAC,CAAC;YACjF,OAAO;IACX,CAAC;AACH,CAAC"}
|
package/dist/procedure.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/** Procedure System — pure core + local store (docs/procedure-system.md).
|
|
2
|
-
*
|
|
3
|
-
* A *procedure* is the repo-specific recipe behind an operational intent
|
|
4
|
-
* (deploy / push / release / commit / merge). The system's job: when the user
|
|
5
|
-
* asks for one, inject the known recipe + its gate BEFORE the agent moves, so
|
|
6
|
-
* the operational verb runs cleanly instead of by trial-and-error.
|
|
7
|
-
*
|
|
8
|
-
* This module is the PROOF slice — Tier 1 (deterministic keyword trigger) +
|
|
9
|
-
* REPLAY (inject a seeded/learned recipe). It is intentionally local-file
|
|
10
|
-
* backed, mirroring guard.ts's matchset cache: the UserPromptSubmit hook reads
|
|
11
|
-
* it on the hot path, so there is NO network here (server persistence + the
|
|
12
|
-
* LEARN/Stop-hook capture leg land later — docs/procedure-system.md phases).
|
|
13
|
-
*
|
|
14
|
-
* Pure (matchProcedure / buildProcedureInjection / GIT_SEED_SET) is split from
|
|
15
|
-
* the I/O (read/writeProcedureStore) so the matcher + injection text are
|
|
16
|
-
* testable without touching disk — the coordinate-gate.ts shape.
|
|
17
|
-
*/
|
|
18
|
-
/** The status ladder IS the silent-reflex safety structure (docs/procedure-system.md):
|
|
19
|
-
* a recipe is a hypothesis until reuse confirms it, and self-heals when it fails.
|
|
20
|
-
* seeded — hand-authored before any failure; injects with confidence.
|
|
21
|
-
* discovered — Tier-2 only: a new procedure the judge proposed; below learned.
|
|
22
|
-
* learned — captured from one cold-start floundering→success span.
|
|
23
|
-
* confirmed — a clean injected REPLAY proved the recipe.
|
|
24
|
-
* stale — injection floundered → re-enter LEARN (overwrite). */
|
|
25
|
-
export type ProcedureStatus = 'seeded' | 'discovered' | 'learned' | 'confirmed' | 'stale';
|
|
26
|
-
export interface Procedure {
|
|
27
|
-
/** Normalized intent key (one per repo). */
|
|
28
|
-
verb: string;
|
|
29
|
-
/** Phrases in the user message that fire this procedure. Lowercased; matched
|
|
30
|
-
* whole-word for single tokens, substring for multi-word phrases. */
|
|
31
|
-
triggers: string[];
|
|
32
|
-
/** The recipe — the winning command path. */
|
|
33
|
-
steps: string;
|
|
34
|
-
/** The gate / guardrail surfaced alongside the steps (load-bearing for
|
|
35
|
-
* destructive verbs — a procedure carries gates, not just steps). */
|
|
36
|
-
caveats?: string;
|
|
37
|
-
/** The linked exit condition — how we know the procedure is done. */
|
|
38
|
-
endpoint?: string;
|
|
39
|
-
status: ProcedureStatus;
|
|
40
|
-
/** Destructive verbs (push → prod) MUST stay seeded and are never overwritten
|
|
41
|
-
* by the LEARN leg — the one failure you can't afford even once. */
|
|
42
|
-
destructive?: boolean;
|
|
43
|
-
updatedAt?: string;
|
|
44
|
-
}
|
|
45
|
-
export interface ProcedureStore {
|
|
46
|
-
version: string;
|
|
47
|
-
procedures: Procedure[];
|
|
48
|
-
}
|
|
49
|
-
export interface ProcedureMatch {
|
|
50
|
-
procedure: Procedure;
|
|
51
|
-
/** Which trigger phrase fired — for diagnostics / the dry-run `match` command. */
|
|
52
|
-
trigger: string;
|
|
53
|
-
}
|
|
54
|
-
export declare const PROCEDURE_STORE_VERSION = "1";
|
|
55
|
-
/** Beside the matchset cache (guard.ts), keyed by project_id so it survives
|
|
56
|
-
* renames/worktrees and stays per-project. */
|
|
57
|
-
export declare function procedureStorePath(projectId: string): string;
|
|
58
|
-
/** Read the project's procedure store. Returns an empty store on any miss —
|
|
59
|
-
* fail-open, so a read error never blocks the hot path. */
|
|
60
|
-
export declare function readProcedureStore(projectId: string): ProcedureStore;
|
|
61
|
-
export declare function writeProcedureStore(projectId: string, store: ProcedureStore): void;
|
|
62
|
-
/** Insert-or-replace by verb. Destructive existing procedures are NOT silently
|
|
63
|
-
* downgraded: a learned/auto write can't overwrite a destructive=true seed
|
|
64
|
-
* (callers pass `force` for an explicit operator re-seed). Returns the store. */
|
|
65
|
-
export declare function upsertProcedure(store: ProcedureStore, proc: Procedure, force?: boolean): ProcedureStore;
|
|
66
|
-
export declare function removeProcedure(store: ProcedureStore, verb: string): ProcedureStore;
|
|
67
|
-
/** True if a raw trigger hit should be SUPPRESSED — it reads as a mention, not
|
|
68
|
-
* a request. PURE. (1) the trigger only appears inside a collision phrase;
|
|
69
|
-
* (2) a negation sits within 3 tokens before the trigger. */
|
|
70
|
-
export declare function intentSuppressed(promptLower: string, triggerLower: string): boolean;
|
|
71
|
-
/** Match a user prompt against the store. Returns the procedure whose
|
|
72
|
-
* LONGEST trigger phrase hits (most-specific wins — `git push` beats `push`,
|
|
73
|
-
* `ship a release` beats `ship`), or null. PURE — no I/O. The Tier-1 intent
|
|
74
|
-
* guard filters mention-not-request hits unless `ignoreIntentGuard` is set
|
|
75
|
-
* (the `match` dry-run uses it to explain a suppression). */
|
|
76
|
-
export declare function matchProcedure(prompt: string, store: ProcedureStore, opts?: {
|
|
77
|
-
ignoreIntentGuard?: boolean;
|
|
78
|
-
}): ProcedureMatch | null;
|
|
79
|
-
/** The additionalContext block injected at UserPromptSubmit when a procedure
|
|
80
|
-
* matches. Leads with the gate for destructive verbs (the guardrail is the
|
|
81
|
-
* point); otherwise leads with the steps. Bounded + labeled so the agent reads
|
|
82
|
-
* it as a known recipe, not a new instruction to reason about. */
|
|
83
|
-
export declare function buildProcedureInjection(proc: Procedure): string;
|
|
84
|
-
/** The five operational verbs Travis conflates, encoded with their real recipes
|
|
85
|
-
* + gates (docs/procedure-system.md). The deliberate contradiction —
|
|
86
|
-
* deploy = don't-ask, push = always-ask — is exactly what trips a learning
|
|
87
|
-
* dev; both gates ship on day one. `push` is destructive → seed-only. */
|
|
88
|
-
export declare const GIT_SEED_SET: Procedure[];
|