@cratylus/canon 0.13.3 → 0.13.4

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.
@@ -18,7 +18,6 @@
18
18
  // exist before any adapter was chosen — so every cell spelled out a claude path.
19
19
  // The lift is the projector's, per adapter, from `HarnessAdapter.hookCommand`.
20
20
  import { deployDriftNotice } from './hooks/deploy-drift-notice.js';
21
- import { lineWorktree } from './hooks/line-worktree.js';
22
21
  import { stanceGuardrailPre } from './hooks/stance-guardrail-pre.js';
23
22
  import { stanceGuardrail } from './hooks/stance-guardrail.js';
24
23
  /** The harness-substrate hook cells forge projects into settings.json + hooks/<id>/. */
@@ -26,6 +25,5 @@ export const harnessHookCells = [
26
25
  stanceGuardrail,
27
26
  stanceGuardrailPre,
28
27
  deployDriftNotice,
29
- lineWorktree,
30
28
  ];
31
29
  //# sourceMappingURL=hook-cells.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hook-cells.js","sourceRoot":"","sources":["../src/hook-cells.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,2EAA2E;AAC3E,kFAAkF;AAClF,mFAAmF;AACnF,4EAA4E;AAC5E,kDAAkD;AAClD,kFAAkF;AAClF,gFAAgF;AAChF,kFAAkF;AAClF,oFAAoF;AACpF,oFAAoF;AACpF,oFAAoF;AACpF,qEAAqE;AACrE,EAAE;AACF,0EAA0E;AAC1E,iFAAiF;AACjF,oFAAoF;AACpF,iFAAiF;AACjF,+EAA+E;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,wFAAwF;AACxF,MAAM,CAAC,MAAM,gBAAgB,GAAwB;IACnD,eAAe;IACf,kBAAkB;IAClB,iBAAiB;IACjB,YAAY;CACb,CAAC"}
1
+ {"version":3,"file":"hook-cells.js","sourceRoot":"","sources":["../src/hook-cells.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,2EAA2E;AAC3E,kFAAkF;AAClF,mFAAmF;AACnF,4EAA4E;AAC5E,kDAAkD;AAClD,kFAAkF;AAClF,gFAAgF;AAChF,kFAAkF;AAClF,oFAAoF;AACpF,oFAAoF;AACpF,oFAAoF;AACpF,qEAAqE;AACrE,EAAE;AACF,0EAA0E;AAC1E,iFAAiF;AACjF,oFAAoF;AACpF,iFAAiF;AACjF,+EAA+E;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,wFAAwF;AACxF,MAAM,CAAC,MAAM,gBAAgB,GAAwB;IACnD,eAAe;IACf,kBAAkB;IAClB,iBAAiB;CAClB,CAAC"}
package/dist/practices.js CHANGED
@@ -15,9 +15,7 @@
15
15
  // travels with it. A guard (a hook cell that binds a composition) is listed nowhere:
16
16
  // it is registered exactly when a rendered agent composes what it binds. A hook cell
17
17
  // that binds no composition but serves what an agent DECLARES is listed by the
18
- // practices that place that agent: the worktree the implementer is started in is cut
19
- // from the plan's line by `line-worktree`, so every practice that places the
20
- // implementer lists it.
18
+ // practices that place that agent.
21
19
  //
22
20
  // The practice names are signs of THIS corpus's own making; the consumer-facing
23
21
  // description is the one line an install shows beside each.
@@ -25,22 +23,17 @@
25
23
  /** The architect role's dispatch, as agent names: what a practice that places an
26
24
  * architect-holder must also place. */
27
25
  const WRITERS = ['planner', 'implementer', 'assayer', 'integrator'];
28
- /** The hook cells every practice placing the `WRITERS` lists: the implementer declares
29
- * that it runs in a worktree of its own, and this cell makes that worktree off the line. */
30
- const WRITER_HOOKS = ['line-worktree'];
31
26
  export const PRACTICES = [
32
27
  {
33
28
  name: 'cdd',
34
29
  description: 'Concept-driven development: an architect holds the design and hands it out, a planner cuts it into units, an implementer builds each one, an assayer judges it against the design, and an integrator makes the approved work whole.',
35
30
  agents: ['mav', 'architect', ...WRITERS],
36
- hooks: WRITER_HOOKS,
37
31
  preselected: true,
38
32
  },
39
33
  {
40
34
  name: 'corpus-authoring',
41
35
  description: 'Author the corpus of named concepts itself: discover the signs a model already holds, canonize them, and write the agents and skills that carry them.',
42
36
  agents: ['nico', ...WRITERS],
43
- hooks: WRITER_HOOKS,
44
37
  skills: [
45
38
  'signify',
46
39
  'probe',
@@ -58,7 +51,6 @@ export const PRACTICES = [
58
51
  name: 'film-production',
59
52
  description: 'Make films with software: a film-floor architect holds what the craft requires and hands the building to the same planner-to-integrator line.',
60
53
  agents: ['kino', ...WRITERS],
61
- hooks: WRITER_HOOKS,
62
54
  },
63
55
  {
64
56
  name: 'carry-on',
@@ -1 +1 @@
1
- {"version":3,"file":"practices.js","sourceRoot":"","sources":["../src/practices.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,yEAAyE;AACzE,EAAE;AACF,qFAAqF;AACrF,iFAAiF;AACjF,mFAAmF;AACnF,kDAAkD;AAClD,EAAE;AACF,mFAAmF;AACnF,oFAAoF;AACpF,oFAAoF;AACpF,kFAAkF;AAClF,kFAAkF;AAClF,gFAAgF;AAChF,qFAAqF;AACrF,qFAAqF;AACrF,+EAA+E;AAC/E,qFAAqF;AACrF,6EAA6E;AAC7E,wBAAwB;AACxB,EAAE;AACF,gFAAgF;AAChF,4DAA4D;AAC5D,gFAAgF;AAIhF;wCACwC;AACxC,MAAM,OAAO,GAAG,CAAC,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,CAAU,CAAC;AAE7E;6FAC6F;AAC7F,MAAM,YAAY,GAAG,CAAC,eAAe,CAAU,CAAC;AAEhD,MAAM,CAAC,MAAM,SAAS,GAAwB;IAC5C;QACE,IAAI,EAAE,KAAK;QACX,WAAW,EACT,qOAAqO;QACvO,MAAM,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;QACxC,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,IAAI;KAClB;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,WAAW,EACT,uJAAuJ;QACzJ,MAAM,EAAE,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC;QAC5B,KAAK,EAAE,YAAY;QACnB,MAAM,EAAE;YACN,SAAS;YACT,OAAO;YACP,QAAQ;YACR,eAAe;YACf,WAAW;YACX,aAAa;YACb,WAAW;YACX,cAAc;YACd,cAAc;YACd,YAAY;SACb;KACF;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,+IAA+I;QACjJ,MAAM,EAAE,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC;QAC5B,KAAK,EAAE,YAAY;KACpB;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,mIAAmI;QACrI,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,CAAC,UAAU,CAAC;KACrB;CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAa;IAChC,MAAM,EAAE,CAAC,WAAW,CAAC;IACrB,KAAK,EAAE,CAAC,qBAAqB,CAAC;CAC/B,CAAC"}
1
+ {"version":3,"file":"practices.js","sourceRoot":"","sources":["../src/practices.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,yEAAyE;AACzE,EAAE;AACF,qFAAqF;AACrF,iFAAiF;AACjF,mFAAmF;AACnF,kDAAkD;AAClD,EAAE;AACF,mFAAmF;AACnF,oFAAoF;AACpF,oFAAoF;AACpF,kFAAkF;AAClF,kFAAkF;AAClF,gFAAgF;AAChF,qFAAqF;AACrF,qFAAqF;AACrF,+EAA+E;AAC/E,mCAAmC;AACnC,EAAE;AACF,gFAAgF;AAChF,4DAA4D;AAC5D,gFAAgF;AAIhF;wCACwC;AACxC,MAAM,OAAO,GAAG,CAAC,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,CAAU,CAAC;AAE7E,MAAM,CAAC,MAAM,SAAS,GAAwB;IAC5C;QACE,IAAI,EAAE,KAAK;QACX,WAAW,EACT,qOAAqO;QACvO,MAAM,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;QACxC,WAAW,EAAE,IAAI;KAClB;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,WAAW,EACT,uJAAuJ;QACzJ,MAAM,EAAE,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC;QAC5B,MAAM,EAAE;YACN,SAAS;YACT,OAAO;YACP,QAAQ;YACR,eAAe;YACf,WAAW;YACX,aAAa;YACb,WAAW;YACX,cAAc;YACd,cAAc;YACd,YAAY;SACb;KACF;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,+IAA+I;QACjJ,MAAM,EAAE,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC;KAC7B;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,mIAAmI;QACrI,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,CAAC,UAAU,CAAC;KACrB;CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAa;IAChC,MAAM,EAAE,CAAC,WAAW,CAAC;IACrB,KAAK,EAAE,CAAC,qBAAqB,CAAC;CAC/B,CAAC"}
@@ -47,9 +47,10 @@ export const implementerRole = {
47
47
  skills: ['note'],
48
48
  // Dispatches no role: it builds its one unit and returns a name.
49
49
  dispatches: [],
50
- // Runs in a git worktree of its own, started there by the harness: the rule that its
51
- // unit is built off the plan's line, and never in the operator's main checkout, then
52
- // holds from the first instruction and does not wait on the agent's own care.
50
+ // Runs in a git worktree of its own, which the harness provides by its own means: that
51
+ // keeps it out of the operator's main checkout from the first instruction. Starting the
52
+ // work from the plan's line is the implementer's own move, and `plan land` refuses a
53
+ // commit not built off the line.
53
54
  isolation: 'worktree',
54
55
  vector: {
55
56
  form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A8B;QAClD,+EAA+E;QAC/E,kFAAkF;QAClF,4EAA4E;QAC5E,iFAAiF;QACjF,8EAA8E;QAC9E,oDAAoD;QACpD,YAAY,EAAE,iCAAiC;QAC/C,sFAAsF;QACtF,oFAAoF;QACpF,QAAQ,EAAE,CAAC,cAAc,CAAC;QAC1B,SAAS,EAAE,qBAAqB;QAChC,qBAAqB,EAAE;YACrB,+BAA+B;YAC/B,qCAAqC;YACrC,gCAAgC;YAChC,yBAAyB;SAC1B;QACD,UAAU,EAAE,CAAC,kBAAkB,CAAC;QAChC,YAAY,EAAE;YACZ,gCAAgC;YAChC,gCAAgC;SACjC;QACD,OAAO,EAAE,CAAC,eAAe,CAAC;QAC1B,QAAQ,EAAE,gCAAgC;QAC1C,kBAAkB,EAAE,6BAA6B;QACjD,OAAO,EAAE,2BAA2B;QACpC,iBAAiB,EAAE,uBAAuB;QAC1C,0EAA0E;QAC1E,6EAA6E;QAC7E,yCAAyC;QACzC,WAAW,EAAE,qBAAqB;QAClC,mFAAmF;QACnF,8EAA8E;QAC9E,cAAc,EAAE,mCAAmC;KACpD;CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratylus/canon",
3
- "version": "0.13.3",
3
+ "version": "0.13.4",
4
4
  "description": "The canonical corpus of discovered optimal-signifiers — agents, skills, dimensions and rules as typed TS source. Markdown is a projection of these modules.",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -18,10 +18,10 @@
18
18
  ],
19
19
  "//test": "`test` builds FIRST because `test/runtime-shim.test.ts` drives the shipped `cratylus project` over the repository's own `cratylus.config.ts`, and that config extends `@cratylus/canon` — the PACKAGE, i.e. this package's `dist`. turbo's `test.dependsOn: [^build]` builds this package's DEPENDENCIES, never this package, so a cold clone would run the consumer path against a dist that does not exist.",
20
20
  "dependencies": {
21
- "@cratylus/schema": "0.9.0"
21
+ "@cratylus/schema": "0.9.1"
22
22
  },
23
23
  "devDependencies": {
24
- "@cratylus/forge": "0.14.3",
24
+ "@cratylus/forge": "0.14.4",
25
25
  "@cratylus/runtime": "0.9.4",
26
26
  "@cratylus/tooling": "0.0.0",
27
27
  "@types/node": "^22.0.0",
@@ -1,2 +0,0 @@
1
- import type { HookCell } from '../manifest.js';
2
- export declare const lineWorktree: HookCell;
@@ -1,251 +0,0 @@
1
- // line-worktree — the creation of the implementer's worktree, cut from the tip of the
2
- // bound plan's line.
3
- //
4
- // THE GAP IT CLOSES. The implementer declares that it runs in a worktree of its own
5
- // (`Agent.isolation`), and Claude Code honours that by making one. But Claude Code cuts
6
- // that worktree from origin's default branch, or from the HEAD of the session that
7
- // dispatched it — and the dispatcher runs in the main checkout on main. So the
8
- // implementer started in a worktree that was isolated and was nowhere near the plan's
9
- // line: its first commit ran from main, and moving it onto the line was left to
10
- // whatever care the agent had. A rule that depends on the agent remembering to follow it
11
- // is the rule that was broken in the first place. The agent definition has no base ref
12
- // to give, and a worktree's base is not the agent's to choose: it is the creation's.
13
- //
14
- // THE HOOK PERFORMS THE CREATION. `WorktreeCreate` is not a notification. Claude Code
15
- // hands the hook the new worktree's `name`, takes the absolute path the hook prints, and
16
- // uses that directory as the agent's working copy; a hook that prints none fails the
17
- // creation. So the cell is where the worktree's base can be decided, and this is the one
18
- // place it is decided: for the implementer's worktree, while a plan is bound, the
19
- // worktree is cut on a new branch from the tip of that plan's line, and the agent's
20
- // first commit already runs from the line.
21
- //
22
- // IT ACTS FOR THE IMPLEMENTER'S WORKTREE AND FOR NO OTHER. The plan places a unit's
23
- // worktree off its plan's line and says nothing about any other worktree, yet the hook is
24
- // registered on the host and Claude Code fires `WorktreeCreate` for every worktree it
25
- // makes there: a `claude --worktree` session, a background session isolated in a worktree
26
- // (`bridge-<id>`), and every subagent that declares `isolation: worktree`. Cutting an
27
- // architect's background session from a plan's line, or failing a session's creation
28
- // because `cratylus` is not installed, is the cell reaching past what the plan placed.
29
- // The input names no subagent — its `agent_type` is the dispatcher's — so the worker tells
30
- // the implementer's worktree by the name Claude Code gives a subagent's: `agent-a` and
31
- // 7 or 16 hex digits. In this corpus only the implementer declares `isolation: worktree`,
32
- // so that name is the implementer's; a worktree whose name is not that one is not the
33
- // implementer's, and where the worker cannot tell it passes through.
34
- //
35
- // WHICH PLAN, AND WHERE ITS LINE IS, IS THE RUNTIME'S TO SAY. The cell does not know
36
- // that plans exist, what a line is called or where it lives: it asks the host's
37
- // `cratylus plan show`, the way `deploy-drift-notice` asks `deploy --check`, and takes
38
- // from the answer the one fact it needs — the commit the bound plan's line stands at. It
39
- // spells no plan name, no branch and no path the runtime does not give it, so a rename of
40
- // the line's branch, or of the plan lifecycle's states, leaves it untouched.
41
- //
42
- // EVERYTHING ELSE IS LEFT AS THE HARNESS WOULD DO IT. For every worktree that is not the
43
- // implementer's, and for the implementer's when there is no line to cut from — no plan
44
- // bound, `cratylus` missing, a `plan show` answer the worker does not recognise
45
- // (`with nothing committed yet`) — the worker creates what Claude Code's own creation
46
- // would: a worktree at `<project>/.<harness>/worktrees/<name>` on a branch
47
- // `worktree-<name>`, cut from origin's default branch, or from the session's HEAD where
48
- // the host's `worktree.baseRef` is `head` or where there is no origin, and prints its
49
- // path. The hook has replaced that creation for every worktree on the host, so it owes
50
- // the same behaviour for every one it is not cutting from a line, and it never fails one
51
- // for want of a line. It says on stderr when the implementer's was made without one.
52
- //
53
- // `jq` IS NOT WHAT THE LINE NEEDS. It reads the request and the host's `baseRef`, and
54
- // where it is not installed the worker reads the one flat string each holds with `sed`;
55
- // finding the line's tip asks the runtime and uses no `jq`, so a host without `jq` still
56
- // has the implementer's worktree cut from the line.
57
- //
58
- // WHAT IT STILL REFUSES is a creation Claude Code's would refuse as well: a request that
59
- // names no readable `cwd` or an unusable `name`, a `cwd` inside no repository, a path that
60
- // is taken, a `git worktree add` that fails. There is no creation to pass through to, and
61
- // answering with the checkout the session is already in is a worktree that isolates
62
- // nothing and reads as one. That failure is a message on stderr, a non-zero exit, no path
63
- // on stdout and no worktree on disk.
64
- //
65
- // REMOVAL IS NOT BOUND, AND THAT IS THE CHOICE. With a `WorktreeCreate` hook and no
66
- // `WorktreeRemove` hook Claude Code keeps the worktree when the agent is done and says so.
67
- // The worktree holds the unit's commits, and a removal hook would have to decide whether
68
- // they are safe to discard; the unit's work is landed by recording its commit, and the
69
- // worktree outliving the agent is what keeps that commit reachable until it is. A
70
- // removal binding that deleted exactly what this cell created would be a second
71
- // mechanism owning a judgement the operator's `git worktree remove` already makes.
72
- //
73
- // THE WORKER SPEAKS NOTHING. Its stdout is the path and nothing else — Claude Code takes
74
- // the whole of it as the path — so everything it has to say goes to stderr.
75
- //
76
- // `workers[].content` is the TEMPLATE the committed worker at `targetPath` regenerates
77
- // from, byte-locked by `test/hook-rule-boundary.test.ts`. EDIT THE CELL AND REGENERATE
78
- // (`pnpm canon:project:targets`) — never the committed `.sh` alone.
79
- export const lineWorktree = {
80
- id: 'line-worktree',
81
- residue: 'creation-moment ↦ WorktreeCreate ⟨hook PERFORMS the creation ¬ observes it · prints path ∧ nothing else⟩ · acts ↾ implementer-copy ⟨name ≜ agent-a⟨hex⁷ ∨ hex¹⁶⟩ ¬ agent_type ∵ input names the dispatcher⟩ ∧ plan bound ⇒ cut(copy, tip(plan-integration)) ⟨new branch ∉ ⟨main · integration⟩ · tip ↦ runtime-answer ¬ spelled · ∄ plan-name ∧ ∄ branch-name ∧ ∄ path ∉ runtime⟩ · ∀ other copy ∨ ∀ failure ⟨∄ plan bound · runtime missing · answer unknown⟩ ⇒ create as host would ⟨origin-default ∨ HEAD ↾ baseRef · <project>/.<harness>/worktrees/<name> · ¬ fail⟩ · creation impossible ⟨¬ cwd · ¬ name · ¬ repository · path taken · git refuses⟩ ⇒ FAIL LOUD ⟨stderr ∧ non-zero ∧ ∅ path ∧ ∅ copy⟩ ⟨¬ fall back to main checkout ∵ isolates nothing ∧ reads as isolation⟩ · removal ≜ kept ⟨∄ WorktreeRemove ∵ copy holds the unit’s commits⟩ · ∄ speech',
82
- substrate: 'harness',
83
- events: ['worktree.create'],
84
- entry: 'line-worktree.sh',
85
- timeout: 60,
86
- refs: [],
87
- workers: [
88
- {
89
- filename: 'line-worktree.sh',
90
- targetPath: 'packages/canon/targets/guardrail/line-worktree.sh',
91
- executable: true,
92
- content: `#!/usr/bin/env sh
93
- # line-worktree — creates the worktree an agent runs in, and prints its path.
94
- #
95
- # This hook REPLACES the harness's own worktree creation for every worktree the harness
96
- # makes on the host: the harness gives it the worktree's name, takes the one path it
97
- # prints on stdout, and uses that directory as the agent's working copy. A hook that
98
- # prints none fails the creation.
99
- #
100
- # CONTRACT:
101
- # - THE IMPLEMENTER'S WORKTREE, WITH A PLAN BOUND: the worktree is cut, on a new
102
- # branch, from the commit the bound plan's line stands at, so the
103
- # agent's first commit runs from it. The implementer's is the one the
104
- # harness names agent-a<7 or 16 hex digits>; the input names no
105
- # subagent, so the name is what there is to tell it by.
106
- # - EVERY OTHER WORKTREE, AND THE IMPLEMENTER'S WHEN THERE IS NO LINE TO CUT FROM
107
- # (no plan bound, cratylus missing, a plan show answer this does not
108
- # know): the worktree is made as the harness would have made it,
109
- # at <project>/.<harness>/worktrees/<name> from the origin's default
110
- # branch, or from HEAD where the host's worktree.baseRef is "head", or
111
- # where there is no origin. This never fails one for want of a line.
112
- # - NEVER THE MAIN CHECKOUT. A worktree the harness's own creation could not make
113
- # either (no usable cwd or name, no repository, a path that is taken,
114
- # a git refusal) is a failure: a message on stderr, a non-zero exit,
115
- # no path on stdout, nothing on disk.
116
- # - STDOUT IS THE PATH AND NOTHING ELSE. Every other word goes to stderr.
117
- # - NOT REMOVED. No removal hook is bound, so the harness keeps the worktree when the
118
- # agent is done: it holds the unit's commits until they are landed.
119
- #
120
- # WHICH PLAN IS BOUND, AND WHERE ITS LINE STANDS, IS THE RUNTIME'S ANSWER. This names no
121
- # plan, no branch and no path the runtime does not give it.
122
- #
123
- # INPUT : WorktreeCreate hook JSON on stdin (cwd, name, session_id, ...).
124
- # OUTPUT : the new worktree's absolute path, on stdout, and nothing else.
125
-
126
- set -eu
127
-
128
- die() {
129
- printf 'line-worktree: %s\\n' "$*" >&2
130
- exit 1
131
- }
132
-
133
- note() {
134
- printf 'line-worktree: %s\\n' "$*" >&2
135
- }
136
-
137
- # ── WHAT PROJECTION TOLD US ────────────────────────────────────────────────────
138
- RUNTIME={{fact:runtime-bin}}
139
- HARNESS={{fact:harness-name}}
140
- HARNESS_SETTINGS={{fact:harness-hooks-file}}
141
-
142
- command -v git >/dev/null 2>&1 || die "git is required to create a worktree, and is not installed"
143
-
144
- have_jq=no
145
- if command -v jq >/dev/null 2>&1; then
146
- have_jq=yes
147
- fi
148
-
149
- # jstr KEY — the string KEY holds in the JSON on stdin, empty where it holds none. jq
150
- # reads it where jq is installed; without jq, the one flat string a request or a settings
151
- # file states plainly (a value with an escape in it is not read, and reads as empty).
152
- jstr() {
153
- if [ "$have_jq" = yes ]; then
154
- jq -r --arg k "$1" '[.. | objects | select(has($k)) | .[$k] | strings] | first // ""'
155
- else
156
- sed -n "s/.*\\"$1\\"[[:space:]]*:[[:space:]]*\\"\\([^\\"\\\\]*\\)\\".*/\\1/p" | sed -n 1p
157
- fi
158
- }
159
-
160
- # ── THE REQUEST ────────────────────────────────────────────────────────────────
161
- input="$(cat)"
162
- cwd="$(printf '%s' "$input" | jstr cwd 2>/dev/null)" || die "the worktree request is not JSON"
163
- name="$(printf '%s' "$input" | jstr name 2>/dev/null)" || die "the worktree request is not JSON"
164
-
165
- [ -n "$cwd" ] && [ -d "$cwd" ] || die "the worktree request names no existing cwd (got '$cwd')"
166
- # THE NAME BECOMES A PATH AND A BRANCH, so it is examined before it is used: plain
167
- # path segments only, none empty, none leading with a dash, none climbing out.
168
- case "$name" in
169
- '' | -* | /* | */ | *//* | *[!A-Za-z0-9._/-]* | *..*)
170
- die "refusing the worktree name '$name': it must be plain path segments, none empty or climbing out"
171
- ;;
172
- esac
173
-
174
- top="$(git -C "$cwd" rev-parse --show-toplevel 2>/dev/null)" || die "'$cwd' is not inside a git repository"
175
- path="$top/.$HARNESS/worktrees/$name"
176
- branch="worktree-$name"
177
- [ ! -e "$path" ] || die "'$path' already exists"
178
-
179
- # ── IS IT THE IMPLEMENTER'S? the name the harness gives a subagent's worktree ─────
180
- h='[0-9a-f]'
181
- implementer=no
182
- case "$name" in
183
- agent-a$h$h$h$h$h$h$h | agent-a$h$h$h$h$h$h$h$h$h$h$h$h$h$h$h$h) implementer=yes ;;
184
- esac
185
-
186
- # line_tip — the commit the bound plan's line stands at, or nothing and a non-zero status
187
- # where the runtime cannot say: it is not installed, it fails, no plan is bound, or its
188
- # answer is in a shape this does not know.
189
- line_tip() {
190
- command -v "$RUNTIME" >/dev/null 2>&1 || return 1
191
- answer="$(cd "$top" && "$RUNTIME" plan show 2>/dev/null)" || return 1
192
- first="$(printf '%s\\n' "$answer" | sed -n 1p)"
193
- case "$first" in
194
- 'plan '*' at '*:*)
195
- # "plan <name> (<state>) at <commit>: <counts>". More than one plan reads "plans".
196
- commit="$(printf '%s\\n' "$first" | sed -n 's/^plan .* at \\([0-9a-f][0-9a-f]*\\): .*$/\\1/p')"
197
- [ -n "$commit" ] || return 1
198
- git -C "$top" rev-parse --verify --quiet "$commit^{commit}"
199
- ;;
200
- *) return 1 ;;
201
- esac
202
- }
203
-
204
- # harness_start — what the harness cuts a worktree from: origin's default branch, where
205
- # there is one, or HEAD where the host's worktree.baseRef is "head".
206
- harness_start() {
207
- base="fresh"
208
- for f in \\
209
- "$top/.$HARNESS/\${HARNESS_SETTINGS%.json}.local.json" \\
210
- "$top/.$HARNESS/$HARNESS_SETTINGS" \\
211
- "\${HOME:-/nonexistent}/.$HARNESS/$HARNESS_SETTINGS"; do
212
- [ -f "$f" ] || continue
213
- set_to="$(jstr baseRef <"$f" 2>/dev/null || true)"
214
- if [ -n "$set_to" ]; then
215
- base="$set_to"
216
- break
217
- fi
218
- done
219
- if [ "$base" != "head" ]; then
220
- if remote="$(git -C "$top" symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null)"; then
221
- printf '%s\\n' "$remote"
222
- return 0
223
- fi
224
- fi
225
- printf 'HEAD\\n'
226
- }
227
-
228
- # ── WHERE FROM? the line, for the implementer's, if the runtime says there is one ──
229
- start=""
230
- if [ "$implementer" = yes ]; then
231
- if start="$(line_tip)" && [ -n "$start" ]; then
232
- :
233
- else
234
- start=""
235
- note "no plan's line to cut the implementer's worktree from: it is made as the harness would make it"
236
- fi
237
- fi
238
- if [ -z "$start" ]; then
239
- start="$(harness_start)"
240
- fi
241
-
242
- # ── THE WORKTREE ───────────────────────────────────────────────────────────────
243
- mkdir -p "\${path%/*}" || die "cannot create the directory for '$path'"
244
- git -C "$top" worktree add -q -b "$branch" "$path" "$start" >&2 || die "git could not create the worktree '$path' on branch '$branch' from '$start'"
245
-
246
- printf '%s\\n' "$path"
247
- `,
248
- },
249
- ],
250
- };
251
- //# sourceMappingURL=line-worktree.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"line-worktree.js","sourceRoot":"","sources":["../../src/hooks/line-worktree.ts"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,qBAAqB;AACrB,EAAE;AACF,oFAAoF;AACpF,wFAAwF;AACxF,mFAAmF;AACnF,+EAA+E;AAC/E,sFAAsF;AACtF,gFAAgF;AAChF,yFAAyF;AACzF,uFAAuF;AACvF,qFAAqF;AACrF,EAAE;AACF,sFAAsF;AACtF,yFAAyF;AACzF,qFAAqF;AACrF,yFAAyF;AACzF,kFAAkF;AAClF,oFAAoF;AACpF,2CAA2C;AAC3C,EAAE;AACF,oFAAoF;AACpF,0FAA0F;AAC1F,sFAAsF;AACtF,0FAA0F;AAC1F,sFAAsF;AACtF,qFAAqF;AACrF,uFAAuF;AACvF,2FAA2F;AAC3F,uFAAuF;AACvF,0FAA0F;AAC1F,sFAAsF;AACtF,qEAAqE;AACrE,EAAE;AACF,qFAAqF;AACrF,gFAAgF;AAChF,uFAAuF;AACvF,yFAAyF;AACzF,0FAA0F;AAC1F,6EAA6E;AAC7E,EAAE;AACF,yFAAy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