estimetry 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +41 -11
- package/dist/application/contracts/skill-mention.js +20 -0
- package/dist/application/estimetry.js +2 -0
- package/dist/application/hooks/context-limit.js +10 -2
- package/dist/application/hooks/hook-context.js +12 -4
- package/dist/application/hooks/receive-session-hook.js +15 -4
- package/dist/application/hooks/session-end-import.js +6 -7
- package/dist/application/project/init-defaults.js +17 -4
- package/dist/application/project/init-project.js +4 -1
- package/dist/application/project/install-copy.js +8 -1
- package/dist/application/project/show-init-choices.js +1 -1
- package/dist/application/project/tool-notices.js +8 -0
- package/dist/application/task/import-session-logs.js +4 -1
- package/dist/bootstrap/container.js +23 -6
- package/dist/bootstrap/hook-receiver.js +7 -14
- package/dist/bootstrap/main.js +1 -1
- package/dist/domain/code/code-classes.js +1 -1
- package/dist/domain/progress/progress-record-parser.js +6 -0
- package/dist/domain/progress/session-log.js +2 -1
- package/dist/domain/usage/task-usage.js +24 -7
- package/dist/integrations/tools/claude-code/claude-code-adapter.js +29 -48
- package/dist/integrations/tools/claude-code/hook-events.js +4 -0
- package/dist/integrations/tools/claude-code/hook-translation.js +16 -34
- package/dist/integrations/tools/claude-code/importer/claude-code-logs.js +1 -1
- package/dist/integrations/tools/claude-code/skill-file.js +7 -19
- package/dist/integrations/tools/codex/codex-adapter.js +161 -0
- package/dist/integrations/tools/codex/hook-events.js +23 -0
- package/dist/integrations/tools/codex/hook-translation.js +76 -0
- package/dist/integrations/tools/codex/hook-trust.js +69 -0
- package/dist/integrations/tools/codex/importer/codex-logs.js +208 -0
- package/dist/integrations/tools/codex/importer/rollout-parser.js +163 -0
- package/dist/integrations/tools/codex/sandbox-rules.js +38 -0
- package/dist/integrations/tools/codex/skill-file.js +22 -0
- package/dist/integrations/tools/codex/trust-tables.js +96 -0
- package/dist/integrations/tools/content/commands.js +27 -20
- package/dist/integrations/tools/shared/generated-file.js +26 -0
- package/dist/integrations/tools/shared/hook-payload.js +33 -0
- package/dist/integrations/tools/{claude-code → shared}/hook-settings.js +37 -22
- package/dist/integrations/tools/shared/instructions-block.js +39 -0
- package/dist/integrations/tools/shared/skills-plan.js +39 -0
- package/dist/interface/cli/commands/hook-command.js +1 -1
- package/dist/interface/cli/commands/init-command.js +16 -7
- package/dist/interface/cli/commands/status-command.js +5 -2
- package/dist/interface/cli/presenters/text/closing-text.js +7 -3
- package/dist/interface/cli/presenters/text/notices-text.js +1 -0
- package/dist/interface/cli/presenters/text/task-text.js +1 -1
- package/dist/interface/cli/presenters/text-presenter.js +3 -3
- package/package.json +1 -1
- package/dist/integrations/tools/claude-code/claude-md.js +0 -28
- /package/dist/integrations/tools/{claude-code/importer → shared}/log-lines.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@ All notable changes to estimetry. Versions follow [semantic versioning](https://
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## 0.2.0 — 2026-11-21
|
|
8
|
+
|
|
9
|
+
- **Codex.** `estimetry init --tools codex`, or picking Codex in `init`, sets up the hooks of Codex (in `~/.codex/hooks.json`, or `.codex/hooks.json` of the project with `--shared-hooks`) and the `emt-…` skills (in `~/.agents/skills`, or `.agents/skills`), called as `$emt-…`. Sessions of Codex are measured like those of Claude Code, and both tools may serve one task. Codex runs a hook only once you trust it, and the agent's commands in a sandbox: in a terminal `init` asks whether to trust the estimetry hooks and to let the task commands (`emt start`, `extra`, `close`…) out of the sandbox, and records both with yes or `--trust-hooks` (`~/.codex/config.toml`, `~/.codex/rules/estimetry.rules`). `emt upgrade` trusts again the hooks it changes when you trusted them before; `emt status` warns while they are not trusted. Requires Codex 0.145 or newer.
|
|
10
|
+
- The rollouts of Codex sessions are imported at the session end and before a task closes: turns, subagents and tokens by model. Codex records no cost, so its sessions count in tokens only, and the cost of a task says by how many sessions it is counted (`cost from 1 of 2 sessions`, or `not reported`). Cards get `usage.withCost`.
|
|
11
|
+
- `init` without `--tools` now sets up the tools found on this machine (`~/.claude`, `~/.codex`) when none is installed in the project yet, instead of every tool.
|
|
12
|
+
- The texts outside an agent name the skills without the slash of Claude Code (`skill emt-retro`); the context the hooks give an agent names them as its tool calls them.
|
|
13
|
+
- The journal: `log.session` records may carry `costReported: false` and a `cacheWrite` count; records of 0.1 read as before, and 0.1 reads the new ones, though it counts a Codex session as costing nothing.
|
|
14
|
+
- Run `emt upgrade` once: the skills are written again.
|
|
15
|
+
|
|
7
16
|
## 0.1.2 — 2026-11-12
|
|
8
17
|
|
|
9
18
|
- The hooks `init` writes run the installation of estimetry that ran it, by the paths of its Node.js and entry point, and fall back to `estimetry` on `PATH`. A version manager (asdf, nvm) that picks another Node.js for a project, or one without estimetry, no longer stops the Claude Code hooks or the `post-commit` hook. Settings and hooks the project commits keep the plain `estimetry hook …`. Run `emt upgrade` once to rewrite the hooks.
|
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ The CLI is `estimetry`, with the short alias `emt`.
|
|
|
11
11
|
You need:
|
|
12
12
|
- Node.js 22.12 or newer;
|
|
13
13
|
- git;
|
|
14
|
-
- [Claude Code](https://docs.claude.com/en/docs/claude-code)
|
|
14
|
+
- an AI tool: [Claude Code](https://docs.claude.com/en/docs/claude-code), [Codex](https://github.com/openai/codex) 0.145 or newer, or both.
|
|
15
15
|
|
|
16
16
|
```sh
|
|
17
17
|
npm install -g estimetry
|
|
@@ -26,11 +26,13 @@ To update later: `npm install -g estimetry@latest`, then `emt upgrade` once (see
|
|
|
26
26
|
|
|
27
27
|
## Getting started
|
|
28
28
|
|
|
29
|
-
1. In the root of a repository, run `estimetry init`. It sets up the
|
|
30
|
-
2. Start a new
|
|
29
|
+
1. In the root of a repository, run `estimetry init`. It sets up the hooks and the `emt-…` skills of the AI tools it finds on your machine. Codex runs a hook only once you trust it: init asks whether to trust the estimetry hooks for you.
|
|
30
|
+
2. Start a new session there and ask how long a task will take, or run `/emt-estimate`. The agent creates the task, estimates it by parts and saves the estimate once you approve it.
|
|
31
31
|
3. Run `/emt-start` and work as usual. The hooks measure the time of the agents and your own time; `emt status` shows it.
|
|
32
32
|
4. When the work is done, run `/emt-close`. The agent closes the task and asks you why the fact differs from the estimate.
|
|
33
33
|
|
|
34
|
+
The skills are the same in both tools: Claude Code calls them as `/emt-…`, Codex as `$emt-…` (`$emt-estimate`, `$emt-start`). This README names them the Claude Code way.
|
|
35
|
+
|
|
34
36
|
Every closed task makes the next estimate more grounded: `emt similar` finds past tasks like the new one, and `emt calibrate` gives your own coefficient once there are enough of them.
|
|
35
37
|
|
|
36
38
|
## Help
|
|
@@ -50,7 +52,7 @@ estimetry init
|
|
|
50
52
|
```
|
|
51
53
|
|
|
52
54
|
In a terminal it asks a few questions:
|
|
53
|
-
- which AI tools to set up
|
|
55
|
+
- which AI tools to set up: Claude Code, Codex, or both;
|
|
54
56
|
- the development process (OpenSpec or none);
|
|
55
57
|
- how to share data with your team;
|
|
56
58
|
- whether to install a git hook.
|
|
@@ -59,14 +61,34 @@ In a terminal it asks a few questions:
|
|
|
59
61
|
|
|
60
62
|
### What it installs
|
|
61
63
|
|
|
64
|
+
By default init sets up the tools already installed in the project, else those it finds on this machine (`~/.claude`, `~/.codex`), else all of them.
|
|
65
|
+
|
|
66
|
+
**Claude Code:**
|
|
67
|
+
|
|
62
68
|
| What | Where | Who gets it |
|
|
63
69
|
|---|---|---|
|
|
64
70
|
| Hooks for 12 Claude Code events, each running this installation (`<node> <estimetry> hook claude-code <event>`, else `estimetry hook claude-code <event>` from `PATH`) | `.claude/settings.local.json` | you |
|
|
65
71
|
| Skills `estimetry`, `emt-estimate`, `emt-start`, `emt-extra`, `emt-parallel`, `emt-manual`, `emt-close`, `emt-retro` (also the `/emt-…` commands) | `~/.claude/skills/` (or `$CLAUDE_CONFIG_DIR/skills/`) | you, in every project |
|
|
66
|
-
| Project id and development process | `.estimetry/config.yaml` | the team; commit it so clones of the repository are one project |
|
|
67
72
|
|
|
68
73
|
With `--shared-hooks` the hooks go to `.claude/settings.json` and the skills to `.claude/skills/` of the project. A reminder to run `/emt-estimate` before naming a deadline is added to `CLAUDE.md`, between `<!-- estimetry:start -->` and `<!-- estimetry:end -->`. These are files the project commits, so the whole team gets them.
|
|
69
74
|
|
|
75
|
+
**Codex:**
|
|
76
|
+
|
|
77
|
+
| What | Where | Who gets it |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| Hooks for 10 Codex events, each running this installation (`<node> <estimetry> hook codex <event>`, else `estimetry hook codex <event>` from `PATH`) | `~/.codex/hooks.json` (or `$CODEX_HOME/hooks.json`) | you, in every project |
|
|
80
|
+
| The same skills, called as `$emt-…` | `~/.agents/skills/` | you, in every project |
|
|
81
|
+
| With your consent: a trust of each hook | `~/.codex/config.toml`, `[hooks.state."…"]` | you |
|
|
82
|
+
| With your consent: a rule that lets the task commands (`emt start`, `extra`, `close`…) run outside the sandbox of Codex | `~/.codex/rules/estimetry.rules`, also with `--shared-hooks` | you |
|
|
83
|
+
|
|
84
|
+
Codex has no personal settings inside a project, so the hooks of a personal install serve every project on the machine; in a project without estimetry they do nothing. With `--shared-hooks` the hooks go to `.codex/hooks.json` and the skills to `.agents/skills/` of the project, and the reminder to run `$emt-estimate` goes to `AGENTS.md`. Codex reads the hooks of a project only once you trust the project.
|
|
85
|
+
|
|
86
|
+
**Both:**
|
|
87
|
+
|
|
88
|
+
| What | Where | Who gets it |
|
|
89
|
+
|---|---|---|
|
|
90
|
+
| Project id and development process | `.estimetry/config.yaml` | the team; commit it so clones of the repository are one project |
|
|
91
|
+
|
|
70
92
|
With `--track-commits` a `post-commit` hook is installed into the repository's hooks directory. This respects `core.hooksPath`, worktrees and husky (`.husky/post-commit`). An existing hook keeps its content: estimetry adds its own block between `# >>> estimetry >>>` and `# <<< estimetry <<<`. The hook runs estimetry in the background, so commits never wait for it. Colleagues without estimetry see nothing. A personal hook (in `.git`, or a hooks directory outside the repository) runs this installation by its paths, like the Claude Code hooks, so a commit from an IDE started from the Dock is recorded too. A hook the project commits (husky, `core.hooksPath` inside the repository) holds no paths of your machine and needs `estimetry` on `PATH`.
|
|
71
93
|
|
|
72
94
|
No task data ever goes into the repository. Tasks, estimates and the event journal live in `~/.local/share/estimetry/`, or in `ESTIMETRY_HOME` if set.
|
|
@@ -75,11 +97,12 @@ No task data ever goes into the repository. Tasks, estimates and the event journ
|
|
|
75
97
|
|
|
76
98
|
| Flag | Meaning |
|
|
77
99
|
|---|---|
|
|
78
|
-
| `--tools <ids>` | AI tools, comma-separated: `claude-code` (alias `claude`) |
|
|
100
|
+
| `--tools <ids>` | AI tools, comma-separated: `claude-code` (alias `claude`), `codex` (alias `openai-codex`) |
|
|
79
101
|
| `--flow <id>` | `openspec` or `none`; detected by default (`openspec/` in the root means OpenSpec) |
|
|
80
102
|
| `--share <mode>` | `none`, `calibration` or `cards`; only saved for now |
|
|
81
103
|
| `--track-commits` / `--no-track-commits` | install or remove the git hook |
|
|
82
104
|
| `--shared-hooks` / `--no-shared-hooks` | install for the whole team or for yourself only |
|
|
105
|
+
| `--trust-hooks` / `--no-trust-hooks` | trust the hooks in tools that ask for it (Codex) and let the task commands run outside their sandbox; asked in a terminal, not done without one |
|
|
83
106
|
| `--force` | overwrite generated skills you have edited |
|
|
84
107
|
| `--no-interactive` | do not ask questions |
|
|
85
108
|
| `--json` | print the report as JSON |
|
|
@@ -89,7 +112,10 @@ A repeated run keeps what is installed: once the git hook or the shared install
|
|
|
89
112
|
### Good to know
|
|
90
113
|
|
|
91
114
|
- **Your edits to generated skills are kept.** Every generated skill carries `metadata.generatedBy` and a hash of its content. If you edit one, init keeps your version and reports it as `skipped`; `--force` overwrites it. A file of the same name that estimetry did not create is never touched.
|
|
92
|
-
- **
|
|
115
|
+
- **Codex runs a hook only once you trust it, and the agent's commands in a sandbox.** Neither the CLI nor the VS Code extension of Codex always asks, so the hooks may stay silent. In a terminal init asks whether to trust them; with yes (or `--trust-hooks`) it records the trust in `~/.codex/config.toml`, as `/hooks` in Codex would, and adds a rule that lets the task commands write to the store of estimetry without asking: the sandbox allows writes only inside the project. `init`, `upgrade` and `rebuild` stay outside the rule; `close` and `renegotiate` are in it, so the agent closes a task without a prompt of Codex, only after you agree in the conversation. The rule is yours even with a shared install, and it is also the mark of your consent: `emt upgrade` trusts again the hooks it changes while the rule is there, and `--no-trust-hooks` takes it away (the trusts Codex keeps stay; take them back in `/hooks`). Without a terminal nothing is trusted unless you pass `--trust-hooks`. A `config.toml` with an inline or dotted `hooks` table or a multi-line string is not changed: then trust the hooks in `/hooks`. The rule allows `emt` by name: keep project directories (direnv `./bin`, `node_modules/.bin`) out of your `PATH` in Codex, or the agent could put an `emt` of its own there. `emt status` warns while they are not trusted.
|
|
116
|
+
- **Personal and shared Codex hooks together run twice.** Codex adds up the hooks of every file. The fact stays right, since repeated events are dropped, but init warns and you may remove the estimetry hooks from `~/.codex/hooks.json`.
|
|
117
|
+
- **Codex may copy Claude Code settings.** Its migration of Claude Code settings (hooks, skills) can bring the Claude Code hooks of estimetry into Codex. Set up Codex with `estimetry init --tools codex` instead, and remove such copies.
|
|
118
|
+
- **A rewritten hook is yours.** estimetry recognises its hooks by the command it writes: the paths of the installation that fall back to `estimetry hook claude-code` (or `hook codex`), or that prefix alone. If you change that command, init treats the hook as yours and adds its own next to it.
|
|
93
119
|
- **`settings.local.json` may not be ignored by git.** Claude Code adds `**/.claude/settings.local.json` to your global git excludes only when it writes that file itself. If init creates it and git does not ignore it, init offers to add the same line. With `--no-interactive` it only warns.
|
|
94
120
|
- **Hooks run the installation that ran `init`.** `npm install -g` under the same Node.js replaces it in place. After installing estimetry under another Node.js, or removing the one that ran `init`, run `emt upgrade`: until then the hooks run the old installation or fall back to `estimetry` on `PATH`. Run through `npx`, or on Windows, init writes no paths, and the hooks need `estimetry` on `PATH`. The hooks also keep the data directory of that `init` unless `ESTIMETRY_HOME` is set where they run: an `init` with a temporary `ESTIMETRY_HOME` sends the hooks of the project there too.
|
|
95
121
|
|
|
@@ -121,7 +147,7 @@ emt calibrate --type feature --revise # for a revision of a task in progress
|
|
|
121
147
|
|
|
122
148
|
## Measuring a task
|
|
123
149
|
|
|
124
|
-
Once a task is started (`emt start`), the Claude Code
|
|
150
|
+
Once a task is started (`emt start`), the hooks of Claude Code and Codex record its sessions into the task's journal; sessions of both tools may serve one task. `emt status` shows the fact measured so far: the time of the agents, your own time, and how certain the numbers are.
|
|
125
151
|
|
|
126
152
|
### What counts
|
|
127
153
|
|
|
@@ -157,6 +183,8 @@ The cost is the total Claude Code itself records in the session log, at API pric
|
|
|
157
183
|
|
|
158
184
|
Sessions that ended before you installed this version are read when the task closes. Claude Code deletes logs after 30 days; for longer tasks raise `cleanupPeriodDays` in its settings.
|
|
159
185
|
|
|
186
|
+
**Codex** keeps a rollout of every session in `~/.codex/sessions/`. estimetry reads it in the same way: turns, subagents and tokens by model. Codex records no cost, so its sessions count in tokens only. The cost of a task then stands for its Claude Code sessions, and the status says by how many: `cost from 1 of 2 sessions`, or `not reported` when there are none. Codex compresses rollouts older than a week, and those are not read; the end of a session imports its rollout long before that. The internal subagents of Codex (such as the review of commands before you approve them) leave no hooks and are not counted.
|
|
187
|
+
|
|
160
188
|
### Which task a session serves
|
|
161
189
|
|
|
162
190
|
- **One task in progress** — a session binds to it by itself.
|
|
@@ -165,7 +193,7 @@ Sessions that ended before you installed this version are read when the task clo
|
|
|
165
193
|
|
|
166
194
|
### Restarts and parallel sessions
|
|
167
195
|
|
|
168
|
-
The hooks find the project by the directory
|
|
196
|
+
The hooks find the project by the directory the AI tool runs in, not by the session id. In Codex a session begins with its first prompt, not when Codex starts: Codex tells the hooks of a session only then.
|
|
169
197
|
|
|
170
198
|
- **After a restart** (VS Code, a crash, a reboot) the new session has a new id and binds again by the rules above: with one task in progress, time goes on into it without anything to do. With several, answer the agent which task it is: once attached, the work the new session did since the task started counts too.
|
|
171
199
|
- **A turn cut off by a crash** gets no end. Its tail is closed by the idle threshold and shows as uncertainty (`± …` in `emt status`). The time between the crash and the restart does not count.
|
|
@@ -307,7 +335,7 @@ The journal keeps when things happened, not what was said or done: no prompt tex
|
|
|
307
335
|
|
|
308
336
|
Run `emt upgrade` once, from any directory. It sets estimetry up again in every working copy of every registered project on this machine (worktrees included), each with the choices it already has: tools, flow, a personal or shared install, the commit hook. It shows what will change and asks first; without a terminal it needs `--yes`. A copy where estimetry was never set up is skipped, and so is one that is not on this machine. With a shared install the plan warns that the files it changes are committed by the project. To update a single project instead, run `emt init` inside it.
|
|
309
337
|
|
|
310
|
-
Until then the hooks keep working: an update under the same Node.js replaces the installation they run; only what `init` wrote is old — the hook settings in each project, the skills and, with a shared install, the reminder in `CLAUDE.md`. At the start of a session in a project set up by an older version, the agent is told to suggest `emt upgrade`; it never runs it on its own.
|
|
338
|
+
Until then the hooks keep working: an update under the same Node.js replaces the installation they run; only what `init` wrote is old — the hook settings in each project, the skills and, with a shared install, the reminder in `CLAUDE.md` or `AGENTS.md`. Codex asks to trust its hooks again after `emt upgrade` changes them. At the start of a session in a project set up by an older version, the agent is told to suggest `emt upgrade`; it never runs it on its own.
|
|
311
339
|
|
|
312
340
|
Update every installed copy of estimetry at once. Cards written by an older version are rebuilt from the journals on the next closing, `emt task show` or `emt rebuild`. A newer card stops an older estimetry from rewriting `calibration.json` and is reported instead; versions before this check skip such cards silently, so close no task with them.
|
|
313
341
|
|
|
@@ -320,13 +348,15 @@ Every command and flag, by stage, as `emt --help` lists them. `estimetry` and `e
|
|
|
320
348
|
### Setup
|
|
321
349
|
|
|
322
350
|
- **`emt init`** — set up estimetry in this project: hooks, skills and commands of the AI tool, project config
|
|
323
|
-
- `--tools <ids>` — AI tools, comma-separated
|
|
351
|
+
- `--tools <ids>` — AI tools, comma-separated: claude-code, codex (default: installed, else found on this machine)
|
|
324
352
|
- `--flow <id>` — development process: openspec or none (default: detected)
|
|
325
353
|
- `--share <mode>` — sharing with the team: none, calibration, cards
|
|
326
354
|
- `--track-commits` — install a git post-commit hook
|
|
327
355
|
- `--no-track-commits` — remove the git post-commit hook
|
|
328
356
|
- `--shared-hooks` — install for the whole team, into files the project commits
|
|
329
357
|
- `--no-shared-hooks` — install for yourself only (default)
|
|
358
|
+
- `--trust-hooks` — trust the hooks in tools that ask for it (Codex) and let its task commands run outside their sandbox
|
|
359
|
+
- `--no-trust-hooks` — trust nothing, take away the rule for the task commands (without either flag: kept as it is)
|
|
330
360
|
- `--force` — overwrite generated skills you have edited
|
|
331
361
|
- `--no-interactive` — do not ask; use flags and defaults
|
|
332
362
|
- **`emt upgrade`** — after updating estimetry: set it up again in every project on this machine, each with its own choices
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A skill of estimetry named in a text for the agent, before the tool is known: the context of hooks and the
|
|
3
|
+
* bodies of skills mention a skill with this mark, and the tool's adapter turns it into the way its agent calls
|
|
4
|
+
* skills (`/emt-extra` in Claude Code, `$emt-extra` in Codex). One rule for every text.
|
|
5
|
+
*/
|
|
6
|
+
export function skillMention(id) {
|
|
7
|
+
return `{{skill:${id}}}`;
|
|
8
|
+
}
|
|
9
|
+
const MENTION = /\{\{skill:([a-z][a-z0-9-]*)\}\}/g;
|
|
10
|
+
/** The text with every mention of a skill named by `skillRef`. */
|
|
11
|
+
export function nameSkills(text, skillRef) {
|
|
12
|
+
return text.replace(MENTION, (_mark, id) => skillRef(id));
|
|
13
|
+
}
|
|
14
|
+
/** Where a body of a skill takes the arguments the user gave with it. */
|
|
15
|
+
export const ARGUMENTS_MENTION = '{{arguments}}';
|
|
16
|
+
/** A body of a skill in a tool's form: its skills named by `skillRef`, its arguments as `args`. */
|
|
17
|
+
export function renderBody(body, skillRef, args) {
|
|
18
|
+
return nameSkills(body, skillRef).replaceAll(ARGUMENTS_MENTION, args);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=skill-mention.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ImportSessionLogs } from './task/import-session-logs.js';
|
|
2
2
|
import { InitProject } from './project/init-project.js';
|
|
3
3
|
import { ShowInitChoices } from './project/show-init-choices.js';
|
|
4
|
+
import { toolNotices } from './project/tool-notices.js';
|
|
4
5
|
import { InstallCopy } from './project/install-copy.js';
|
|
5
6
|
import { UpgradePlanner } from './project/upgrade-plan.js';
|
|
6
7
|
import { ShowUpgradePlan } from './project/show-upgrade-plan.js';
|
|
@@ -92,6 +93,7 @@ function projectGroup(deps, core) {
|
|
|
92
93
|
init: (input) => initProject.execute(input),
|
|
93
94
|
upgradePlan: () => showUpgradePlan.execute(),
|
|
94
95
|
upgrade: () => upgradeProjects.execute(),
|
|
96
|
+
notices: () => toolNotices(deps.install, deps.workspace.currentRoot()),
|
|
95
97
|
};
|
|
96
98
|
}
|
|
97
99
|
function tasksGroup(deps, core) {
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
/** The agent reads this; the tool shows it among system messages, so it stays short. */
|
|
2
2
|
export const MAX_CONTEXT_LENGTH = 1000;
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Text for the agent cut to the limit, with an ellipsis when it was longer. A mention of a skill (`{{skill:…}}`) is
|
|
5
|
+
* named only after the cut, so a cut inside one drops the whole mark rather than leave a piece of it to the agent.
|
|
6
|
+
*/
|
|
4
7
|
export function cut(text, limit = MAX_CONTEXT_LENGTH) {
|
|
5
|
-
|
|
8
|
+
if (text.length <= limit) {
|
|
9
|
+
return text;
|
|
10
|
+
}
|
|
11
|
+
const head = text.slice(0, Math.max(0, limit - 1));
|
|
12
|
+
const open = head.lastIndexOf('{{');
|
|
13
|
+
return `${open > head.lastIndexOf('}}') ? head.slice(0, open) : head}…`;
|
|
6
14
|
}
|
|
7
15
|
//# sourceMappingURL=context-limit.js.map
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
import { skillMention } from '../contracts/skill-mention.js';
|
|
1
2
|
import { cut, MAX_CONTEXT_LENGTH } from './context-limit.js';
|
|
2
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Texts for the agent name skills with `skillMention`: the receiver names them the way the tool calls them.
|
|
5
|
+
* A mention is longer than any name it becomes, so a text cut to the limit stays within it.
|
|
6
|
+
*/
|
|
7
|
+
export const EXTRA_REMINDER = `estimetry: if the work has gone beyond the plan, record it with ${skillMention('emt-extra')}.`;
|
|
3
8
|
/** First line of every session start: estimates go through the protocol, never a guess (estimate mode, design §5.1). */
|
|
4
|
-
export const ESTIMATE_REMINDER =
|
|
9
|
+
export const ESTIMATE_REMINDER = `estimetry: before you name an effort or a deadline for a task, run ${skillMention('emt-estimate')}.`;
|
|
10
|
+
const START = skillMention('emt-start');
|
|
11
|
+
const CLOSE = skillMention('emt-close');
|
|
12
|
+
const NO_TASK = `estimetry: no task is in progress in this project, so the time of this session is not counted. Start one with ${START}.`;
|
|
5
13
|
/** The copy of the session was set up by an older estimetry (claude-code-hooks spec): the agent suggests, never runs, `emt upgrade`. */
|
|
6
14
|
export function upgradeText(current, installed) {
|
|
7
15
|
return (`estimetry: estimetry ${current} is installed, but this project was set up by ${installed ?? 'an older version'}. ` +
|
|
@@ -28,7 +36,7 @@ export function sessionStartContext(input) {
|
|
|
28
36
|
}
|
|
29
37
|
return cut(`${head}${list()}${ask}`, budget);
|
|
30
38
|
}
|
|
31
|
-
return
|
|
39
|
+
return NO_TASK;
|
|
32
40
|
}
|
|
33
41
|
/**
|
|
34
42
|
* A change of the task was completed (task-closing spec). The agent asks; the
|
|
@@ -42,7 +50,7 @@ export function closeProposalText(input) {
|
|
|
42
50
|
];
|
|
43
51
|
return cut(`estimetry: change ${input.change} of task ${input.task} was completed at ${when}` +
|
|
44
52
|
(plan.length === 0 ? '' : `; ${plan.join(', ')}`) +
|
|
45
|
-
`. If it was the last change of the task, ask the user whether to close it (
|
|
53
|
+
`. If it was the last change of the task, ask the user whether to close it (${CLOSE}); close only after they agree.`);
|
|
46
54
|
}
|
|
47
55
|
function duration(minutes) {
|
|
48
56
|
const whole = Math.round(minutes);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InvalidValue } from '../../domain/shared/domain-error.js';
|
|
2
|
+
import { nameSkills } from '../contracts/skill-mention.js';
|
|
2
3
|
/**
|
|
3
4
|
* A hook of an AI tool's session: the call becomes activity of the session's
|
|
4
5
|
* task, then its kind decides what follows — the context of a session start or
|
|
@@ -29,7 +30,7 @@ export class ReceiveSessionHook {
|
|
|
29
30
|
throw new InvalidValue(`${adapter.id} ${event}: stdin is not JSON`); // its content is never repeated
|
|
30
31
|
}
|
|
31
32
|
const translation = adapter.translate(event, payload);
|
|
32
|
-
const located = this.locator.locate(call
|
|
33
|
+
const located = this.locator.locate(projectDirOf(adapter, call) ?? translation.cwd ?? call.cwd);
|
|
33
34
|
const resolved = this.sessionTask.resolve(translation.session, located, translation.kind, now);
|
|
34
35
|
if (resolved === undefined) {
|
|
35
36
|
return undefined; // not an estimetry project
|
|
@@ -37,17 +38,27 @@ export class ReceiveSessionHook {
|
|
|
37
38
|
this.recorder.record(adapter.id, translation, resolved, now);
|
|
38
39
|
switch (translation.kind) {
|
|
39
40
|
case 'session-start':
|
|
40
|
-
return adapter
|
|
41
|
+
return render(adapter, event, await this.start.text(translation.session, resolved, now));
|
|
41
42
|
case 'session-end':
|
|
42
|
-
await this.end.run(adapter
|
|
43
|
+
await this.end.run(adapter, translation.session, translation.transcript);
|
|
43
44
|
return undefined;
|
|
44
45
|
case 'prompt': {
|
|
45
46
|
const text = await this.prompt.text(translation.session, resolved, now);
|
|
46
|
-
return text === undefined ? undefined : adapter
|
|
47
|
+
return text === undefined ? undefined : render(adapter, event, text);
|
|
47
48
|
}
|
|
48
49
|
default:
|
|
49
50
|
return undefined;
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
}
|
|
54
|
+
/** The project root the tool names in its own environment variable; an empty one names none. */
|
|
55
|
+
function projectDirOf(adapter, call) {
|
|
56
|
+
const variable = adapter.projectDirVariable;
|
|
57
|
+
const value = variable === undefined ? undefined : call.environment?.(variable);
|
|
58
|
+
return value === '' ? undefined : value;
|
|
59
|
+
}
|
|
60
|
+
/** The context in the tool's format, with the skills named the way its agent calls them. */
|
|
61
|
+
function render(adapter, event, text) {
|
|
62
|
+
return adapter.renderContext(event, nameSkills(text, (id) => adapter.skillRef(id)));
|
|
63
|
+
}
|
|
53
64
|
//# sourceMappingURL=receive-session-hook.js.map
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { isInProgress } from '../../domain/task/task-status.js';
|
|
2
2
|
import { servedTasks } from '../ports/session-bindings.js';
|
|
3
|
-
/** The session end imports the session's log in the hook itself, within this time (claude-code-hooks spec). */
|
|
4
|
-
export const SESSION_END_IMPORT_BUDGET_MS = 5_000;
|
|
5
3
|
/**
|
|
6
|
-
* The log of an ended session goes into every task in progress it served
|
|
7
|
-
*
|
|
4
|
+
* The log of an ended session goes into every task in progress it served, in the hook itself, within the budget
|
|
5
|
+
* of the tool (it waits for the session end hook only so long). Past it the import gives up; the closing of the task
|
|
6
|
+
* catches up.
|
|
8
7
|
*/
|
|
9
8
|
export class SessionEndImport {
|
|
10
9
|
bindings;
|
|
@@ -17,7 +16,7 @@ export class SessionEndImport {
|
|
|
17
16
|
this.tasks = tasks;
|
|
18
17
|
this.logs = logs;
|
|
19
18
|
}
|
|
20
|
-
async run(
|
|
19
|
+
async run(tool, session, transcript) {
|
|
21
20
|
if (this.logs === undefined) {
|
|
22
21
|
return;
|
|
23
22
|
}
|
|
@@ -33,10 +32,10 @@ export class SessionEndImport {
|
|
|
33
32
|
const path = transcript ?? binding?.transcript;
|
|
34
33
|
(await this.logs()).execute({
|
|
35
34
|
session,
|
|
36
|
-
source,
|
|
35
|
+
source: tool.id,
|
|
37
36
|
...(path === undefined ? {} : { path }),
|
|
38
37
|
tasks,
|
|
39
|
-
budgetMs:
|
|
38
|
+
budgetMs: tool.sessionEndBudgetMs,
|
|
40
39
|
});
|
|
41
40
|
}
|
|
42
41
|
}
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* The tools installed in the copy now. An install of the user outside the copy (`machineWide`) is there for every
|
|
3
|
+
* copy, so it counts only for a copy without a shared install: it must not make a team's copy install it for the team.
|
|
4
|
+
*/
|
|
2
5
|
export function installedTools(deps, root) {
|
|
3
|
-
|
|
6
|
+
const states = deps.registries.tools.all().map((tool) => ({ tool, state: tool.state(root, deps.files) }));
|
|
7
|
+
const sharedHere = states.some(({ state }) => state.installed && state.shared);
|
|
8
|
+
return states.filter(({ state }) => state.installed && !(state.machineWide === true && sharedHere)).map(({ tool }) => tool);
|
|
4
9
|
}
|
|
5
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* The tools already installed in the project, else the tools found on this machine, else every tool. An install of
|
|
12
|
+
* the user outside the copy alone does not make the copy's choice: then the tools found on the machine join it.
|
|
13
|
+
*/
|
|
6
14
|
export function defaultTools(deps, root) {
|
|
7
15
|
const installed = installedTools(deps, root);
|
|
8
|
-
|
|
16
|
+
if (installed.some((tool) => tool.state(root, deps.files).machineWide !== true)) {
|
|
17
|
+
return installed;
|
|
18
|
+
}
|
|
19
|
+
const all = deps.registries.tools.all();
|
|
20
|
+
const found = all.filter((tool) => tool.present(deps.files) || installed.includes(tool));
|
|
21
|
+
return found.length > 0 ? found : [...all];
|
|
9
22
|
}
|
|
10
23
|
/** Whether these tools have a shared install in the copy: then it stays shared. */
|
|
11
24
|
export function isSharedInstall(deps, root, tools) {
|
|
@@ -24,7 +24,9 @@ export class InitProject {
|
|
|
24
24
|
*/
|
|
25
25
|
execute(input) {
|
|
26
26
|
const root = this.workspace.currentRoot();
|
|
27
|
-
|
|
27
|
+
// A shared install puts the files into the team's repository: an install of the user's own does not go there by itself.
|
|
28
|
+
const defaults = defaultTools(this.deps, root).filter((tool) => input.shared !== true || tool.state(root, this.deps.files).machineWide !== true);
|
|
29
|
+
const tools = input.tools === undefined ? defaults : this.toolsById(input.tools);
|
|
28
30
|
const flow = this.flowById(input.flow ?? defaultFlow(this.deps, this.projectConfig, root));
|
|
29
31
|
const share = this.shareMode(input.share ?? this.deps.sharing.mode() ?? 'none');
|
|
30
32
|
const shared = input.shared ?? isSharedInstall(this.deps, root, tools);
|
|
@@ -53,6 +55,7 @@ export class InitProject {
|
|
|
53
55
|
trackCommits,
|
|
54
56
|
force: input.force ?? false,
|
|
55
57
|
...(input.excludePersonalFiles === undefined ? {} : { excludePersonalFiles: input.excludePersonalFiles }),
|
|
58
|
+
...(input.trustHooks === undefined ? {} : { trust: input.trustHooks }),
|
|
56
59
|
});
|
|
57
60
|
const project = this.projects.update(this.currentProject.register(registration).id, (registered) => {
|
|
58
61
|
const fingerprint = this.workspace.fingerprint();
|
|
@@ -17,7 +17,14 @@ export class InstallCopy {
|
|
|
17
17
|
plan(choices) {
|
|
18
18
|
const { root } = choices;
|
|
19
19
|
const { version, runner } = this.deps.installation;
|
|
20
|
-
const context = {
|
|
20
|
+
const context = {
|
|
21
|
+
projectRoot: root,
|
|
22
|
+
files: this.deps.files,
|
|
23
|
+
shared: choices.shared,
|
|
24
|
+
force: choices.force,
|
|
25
|
+
version,
|
|
26
|
+
...(choices.trust === undefined ? {} : { trust: choices.trust }),
|
|
27
|
+
};
|
|
21
28
|
const plan = mergePlans([
|
|
22
29
|
...choices.tools.map((tool) => tool.plan(runner === undefined ? context : { ...context, runner })),
|
|
23
30
|
this.deps.git.commitHook.plan(root, choices.trackCommits, runner),
|
|
@@ -14,7 +14,7 @@ export class ShowInitChoices {
|
|
|
14
14
|
const tools = defaultTools(this.deps, root);
|
|
15
15
|
return {
|
|
16
16
|
projectRoot: root,
|
|
17
|
-
tools: this.deps.registries.tools.all().map(({ id, title }) => ({ id, title })),
|
|
17
|
+
tools: this.deps.registries.tools.all().map(({ id, title, asksTrust }) => ({ id, title, asksTrust })),
|
|
18
18
|
flows: this.deps.registries.flows.all().map(({ id, title }) => ({ id, title })),
|
|
19
19
|
defaults: {
|
|
20
20
|
tools: tools.map((tool) => tool.id),
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** What the tools installed in the copy still need from the user for their hooks to run (trust them in Codex). */
|
|
2
|
+
export function toolNotices(deps, root) {
|
|
3
|
+
return deps.registries.tools.all().flatMap((tool) => {
|
|
4
|
+
const state = tool.state(root, deps.files);
|
|
5
|
+
return state.installed && state.notice !== undefined ? [state.notice] : [];
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=tool-notices.js.map
|
|
@@ -63,7 +63,8 @@ export class ImportSessionLogs {
|
|
|
63
63
|
from: offset,
|
|
64
64
|
turns,
|
|
65
65
|
agents,
|
|
66
|
-
cost: read.cost,
|
|
66
|
+
cost: read.cost ?? [],
|
|
67
|
+
costReported: read.cost !== undefined,
|
|
67
68
|
skipped: read.skipped,
|
|
68
69
|
});
|
|
69
70
|
this.deps.state.write(request.session, task.id, { fingerprint: read.fingerprint, next: read.next });
|
|
@@ -118,6 +119,8 @@ export class ImportSessionLogs {
|
|
|
118
119
|
turns: part.turns,
|
|
119
120
|
agents: part.agents,
|
|
120
121
|
cost: i === 0 ? content.cost : [],
|
|
122
|
+
// Written only when false: records of a tool with a cost stay as before, and old readers read them.
|
|
123
|
+
...(content.costReported === false ? { costReported: false } : {}),
|
|
121
124
|
skipped: i === 0 ? content.skipped : 0,
|
|
122
125
|
};
|
|
123
126
|
this.deps.journal.appendRecord(journalEntry('log.session', data, { ...this.deps.meta.at(at), project: task.project, task: task.id }));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
1
|
+
import { existsSync, realpathSync } from 'node:fs';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
3
|
import { homedir, userInfo } from 'node:os';
|
|
4
4
|
import { basename, dirname, join, sep } from 'node:path';
|
|
@@ -33,6 +33,16 @@ function claudeConfigDir(environment) {
|
|
|
33
33
|
const configured = environment.env['CLAUDE_CONFIG_DIR'];
|
|
34
34
|
return configured !== undefined && configured !== '' ? configured : join(environment.homeDir, '.claude');
|
|
35
35
|
}
|
|
36
|
+
/** Codex keeps the user's hooks and config in `$CODEX_HOME`, else `~/.codex`; its skills in `~/.agents/skills`. */
|
|
37
|
+
export function codexDirs(environment) {
|
|
38
|
+
const configured = environment.env['CODEX_HOME'];
|
|
39
|
+
const home = configured !== undefined && configured !== '' ? configured : join(environment.homeDir, '.codex');
|
|
40
|
+
return {
|
|
41
|
+
// Codex keys the trust of a hook by the canonical path of its file: a symlinked CODEX_HOME must give the same key.
|
|
42
|
+
home: existsSync(home) ? realpathSync(home) : home,
|
|
43
|
+
userSkills: join(environment.homeDir, '.agents', 'skills'),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
36
46
|
/** Composition root: the only place that knows which implementation backs which port. */
|
|
37
47
|
export function createContainer(environment, options = {}) {
|
|
38
48
|
const layout = StorageLayout.resolve(environment);
|
|
@@ -44,17 +54,21 @@ export function createContainer(environment, options = {}) {
|
|
|
44
54
|
app: () => (app ??= buildApp(layout, environment, errors)),
|
|
45
55
|
hooks: async () => {
|
|
46
56
|
const { buildHookReceiver } = await import('./hook-receiver.js');
|
|
47
|
-
const
|
|
57
|
+
const toolDirs = { claude: claudeConfigDir(environment), codex: codexDirs(environment).home };
|
|
58
|
+
const receiver = buildHookReceiver(layout, errors, options.startedAt ?? Date.now(), toolDirs);
|
|
48
59
|
return { receive: (call) => receiver.execute(call) };
|
|
49
60
|
},
|
|
50
61
|
};
|
|
51
62
|
}
|
|
52
63
|
async function toolRegistry(environment) {
|
|
53
|
-
const [{ ToolAdapterRegistry }, { ClaudeCodeAdapter }] = await Promise.all([
|
|
64
|
+
const [{ ToolAdapterRegistry }, { ClaudeCodeAdapter }, { CodexAdapter }] = await Promise.all([
|
|
54
65
|
import('../integrations/tools/registry.js'),
|
|
55
66
|
import('../integrations/tools/claude-code/claude-code-adapter.js'),
|
|
67
|
+
import('../integrations/tools/codex/codex-adapter.js'),
|
|
56
68
|
]);
|
|
57
|
-
return new ToolAdapterRegistry()
|
|
69
|
+
return new ToolAdapterRegistry()
|
|
70
|
+
.register(new ClaudeCodeAdapter(claudeConfigDir(environment)))
|
|
71
|
+
.register(new CodexAdapter(codexDirs(environment)));
|
|
58
72
|
}
|
|
59
73
|
async function installDependencies(environment, sharing, layout) {
|
|
60
74
|
const [tools, { FlowRegistry }, { openSpecFlow }, { noneFlow }, { StackDetectorRegistry }, { nodeDetector }, { dartDetector }, { mavenDetector, gradleDetector }, { pythonDetector }, { goDetector }, { composeDetector }, { NodeProjectFiles }, { GitCommitHookInstaller }, { GitExcludesFile }, { PathCommandLocator },] = await Promise.all([
|
|
@@ -139,7 +153,7 @@ async function buildApp(layout, environment, errors) {
|
|
|
139
153
|
}
|
|
140
154
|
/** What closing a task needs besides the task: cards, calibration, proposals, the code volume, `HEAD` and the session logs. */
|
|
141
155
|
async function closingPorts(layout, environment) {
|
|
142
|
-
const [{ YamlCardStore }, { JsonCalibrationStore }, { FileCloseProposals }, { GitCodeMeasurer }, { FsGitHead }, { SessionLogReaderRegistry }, { ClaudeCodeLogs }, { YamlLogImportState },] = await Promise.all([
|
|
156
|
+
const [{ YamlCardStore }, { JsonCalibrationStore }, { FileCloseProposals }, { GitCodeMeasurer }, { FsGitHead }, { SessionLogReaderRegistry }, { ClaudeCodeLogs }, { CodexLogs }, { YamlLogImportState },] = await Promise.all([
|
|
143
157
|
import('../infrastructure/persistence/yaml-card-store.js'),
|
|
144
158
|
import('../infrastructure/persistence/json-calibration-store.js'),
|
|
145
159
|
import('../infrastructure/persistence/file-close-proposals.js'),
|
|
@@ -147,6 +161,7 @@ async function closingPorts(layout, environment) {
|
|
|
147
161
|
import('../infrastructure/git/fs-git-head.js'),
|
|
148
162
|
import('../integrations/tools/session-log-readers.js'),
|
|
149
163
|
import('../integrations/tools/claude-code/importer/claude-code-logs.js'),
|
|
164
|
+
import('../integrations/tools/codex/importer/codex-logs.js'),
|
|
150
165
|
import('../infrastructure/persistence/yaml-log-import-state.js'),
|
|
151
166
|
]);
|
|
152
167
|
return {
|
|
@@ -155,7 +170,9 @@ async function closingPorts(layout, environment) {
|
|
|
155
170
|
proposals: new FileCloseProposals(layout),
|
|
156
171
|
codeMeasurer: new GitCodeMeasurer(),
|
|
157
172
|
gitHead: new FsGitHead(),
|
|
158
|
-
logReaders: new SessionLogReaderRegistry()
|
|
173
|
+
logReaders: new SessionLogReaderRegistry()
|
|
174
|
+
.register(new ClaudeCodeLogs(claudeConfigDir(environment)))
|
|
175
|
+
.register(new CodexLogs(codexDirs(environment).home)),
|
|
159
176
|
logImportState: new YamlLogImportState(layout),
|
|
160
177
|
};
|
|
161
178
|
}
|
|
@@ -36,19 +36,11 @@ import { noneFlow } from '../integrations/flows/none/none-flow.js';
|
|
|
36
36
|
import { openSpecFlow } from '../integrations/flows/openspec/openspec-flow.js';
|
|
37
37
|
import { FlowRegistry } from '../integrations/flows/registry.js';
|
|
38
38
|
import { claudeCodeHooks } from '../integrations/tools/claude-code/hook-translation.js';
|
|
39
|
+
import { codexHooks } from '../integrations/tools/codex/hook-translation.js';
|
|
39
40
|
import { gitHooks } from '../integrations/tools/git/git-hooks.js';
|
|
40
41
|
import { HookAdapterRegistry } from '../integrations/tools/hook-adapters.js';
|
|
41
42
|
import { SessionWindow } from '../application/task/session-window.js';
|
|
42
|
-
|
|
43
|
-
* The hook receiver, apart from the composition of the facade: the container
|
|
44
|
-
* loads this module only for a hook, and a hook loads nothing of the other
|
|
45
|
-
* commands. What only one kind of call needs loads lazily within it.
|
|
46
|
-
*/
|
|
47
|
-
/**
|
|
48
|
-
* Only what a hook needs. The author comes from config.yaml alone: detecting it
|
|
49
|
-
* would run git, and init has written the profile already.
|
|
50
|
-
*/
|
|
51
|
-
export function buildHookReceiver(layout, errors, startedAt, claudeConfig) {
|
|
43
|
+
export function buildHookReceiver(layout, errors, startedAt, toolDirs) {
|
|
52
44
|
const config = new YamlConfigStore(layout, () => {
|
|
53
45
|
throw new Error(`no author profile in ${layout.configFile}; run estimetry init`);
|
|
54
46
|
});
|
|
@@ -75,8 +67,8 @@ export function buildHookReceiver(layout, errors, startedAt, claudeConfig) {
|
|
|
75
67
|
// Only the session start needs the fact, and only it loads the task repository and the calculator.
|
|
76
68
|
new SessionStartContext(() => hookFacts(layout, journal, config, plans), checkpoints, proposal, new UpgradeNotice(new YamlInstallVersions(layout), packageVersion)), new PromptContext(checkpoints, proposal),
|
|
77
69
|
// Only the session end parses a log, and only it loads the reader.
|
|
78
|
-
new SessionEndImport(bindings, tasks, () => hookLogs({ layout,
|
|
79
|
-
const adapters = new HookAdapterRegistry().register(claudeCodeHooks).register(gitHooks);
|
|
70
|
+
new SessionEndImport(bindings, tasks, () => hookLogs({ layout, toolDirs, journal, ids, config, errors })));
|
|
71
|
+
const adapters = new HookAdapterRegistry().register(claudeCodeHooks).register(codexHooks).register(gitHooks);
|
|
80
72
|
return new ReceiveHook(adapters, clock, new CommitRecords(locator, git, new CommitTask(bindings, tasks, recent), journal, meta), sessions);
|
|
81
73
|
}
|
|
82
74
|
/** The plan of a task for the text of a pending proposal to close it: percent done and unfinished groups. */
|
|
@@ -112,15 +104,16 @@ async function hookFacts(layout, journal, settings, plans) {
|
|
|
112
104
|
}
|
|
113
105
|
/** The importer of session logs for a session end. */
|
|
114
106
|
async function hookLogs(c) {
|
|
115
|
-
const [{ ImportSessionLogs }, { SessionLogReaderRegistry }, { ClaudeCodeLogs }, { YamlLogImportState }, { SystemClock }] = await Promise.all([
|
|
107
|
+
const [{ ImportSessionLogs }, { SessionLogReaderRegistry }, { ClaudeCodeLogs }, { CodexLogs }, { YamlLogImportState }, { SystemClock }] = await Promise.all([
|
|
116
108
|
import('../application/task/import-session-logs.js'),
|
|
117
109
|
import('../integrations/tools/session-log-readers.js'),
|
|
118
110
|
import('../integrations/tools/claude-code/importer/claude-code-logs.js'),
|
|
111
|
+
import('../integrations/tools/codex/importer/codex-logs.js'),
|
|
119
112
|
import('../infrastructure/persistence/yaml-log-import-state.js'),
|
|
120
113
|
import('../infrastructure/system/system-clock.js'),
|
|
121
114
|
]);
|
|
122
115
|
return new ImportSessionLogs({
|
|
123
|
-
readers: new SessionLogReaderRegistry().register(new ClaudeCodeLogs(c.
|
|
116
|
+
readers: new SessionLogReaderRegistry().register(new ClaudeCodeLogs(c.toolDirs.claude)).register(new CodexLogs(c.toolDirs.codex)),
|
|
124
117
|
state: new YamlLogImportState(c.layout),
|
|
125
118
|
journal: c.journal,
|
|
126
119
|
meta: new EventMetaSource(new SystemClock(), c.ids, c.config),
|
package/dist/bootstrap/main.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export const CODE_CLASSES = ['generated', 'tests', 'docs', 'config', 'production'];
|
|
6
6
|
const GENERATED_FILES = /(^|\/)(package-lock\.json|pnpm-lock\.yaml|go\.sum)$|\.lock$|\.lockb$|\.g\.dart$|\.freezed\.dart$|\.pb\.go$|_pb2\.py$|\.min\.js$|\.map$|\.snap$/;
|
|
7
|
-
const GENERATED_DIRS = /(^|\/)(node_modules|__snapshots__|generated)\/|^\.(estimetry|claude)\//;
|
|
7
|
+
const GENERATED_DIRS = /(^|\/)(node_modules|__snapshots__|generated)\/|^\.(estimetry|claude|codex|agents)\//;
|
|
8
8
|
const GENERATED_ROOT_DIRS = /^(dist|build)\//;
|
|
9
9
|
const TEST_DIRS = /(^|\/)(test|tests|__tests__|spec|integration_test)\/|(^|\/)src\/test\//;
|
|
10
10
|
const TEST_FILES = /\.(test|spec)\.[^/]+$|_test\.[^/]+$|(^|\/)test_[^/]*\.py$/;
|