@primitive.ai/prim 0.1.0-alpha.120 → 0.1.0-alpha.122
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/README.md +45 -9
- package/SKILL.md +7 -2
- package/dist/{chunk-P2O7NLVN.js → chunk-4GYJHN26.js} +117 -18
- package/dist/{chunk-VOC4KOOP.js → chunk-4M23K2KZ.js} +2 -2
- package/dist/{chunk-NQFRQ56V.js → chunk-4NUGCUQC.js} +2 -2
- package/dist/{chunk-GYQOZGGF.js → chunk-5ME3WD3P.js} +2 -2
- package/dist/{chunk-CCGFRNAA.js → chunk-7LXRFXZG.js} +248 -127
- package/dist/{chunk-MWNRXAEB.js → chunk-AKGRY7OU.js} +1 -1
- package/dist/{chunk-D235RJNO.js → chunk-DQ4I3FLF.js} +3 -3
- package/dist/{chunk-R2NUH4B7.js → chunk-FT673ALA.js} +2 -2
- package/dist/{chunk-TC4FTRYO.js → chunk-HG7FJK7R.js} +2 -2
- package/dist/{chunk-5BQ2NEMP.js → chunk-HLMC7VS4.js} +2615 -941
- package/dist/{chunk-L52OD62C.js → chunk-JYPVPYW3.js} +14 -8
- package/dist/{chunk-2AKDX4RU.js → chunk-JZC2LHS6.js} +1 -1
- package/dist/{chunk-SLDZJD6Q.js → chunk-NMZSCSMY.js} +1 -1
- package/dist/{chunk-LTTF4MBE.js → chunk-OXW6PSPT.js} +2 -2
- package/dist/{chunk-EYBE724K.js → chunk-QG3GASJO.js} +4 -4
- package/dist/{chunk-A6M2M5A2.js → chunk-RRAC76LJ.js} +1 -1
- package/dist/{chunk-U67RBNIZ.js → chunk-S3ZIMGXV.js} +1 -1
- package/dist/{chunk-HXICZG5J.js → chunk-T2T45KF6.js} +4 -4
- package/dist/{chunk-LBCPRHNG.js → chunk-WN7OURQ3.js} +1 -1
- package/dist/{chunk-YTF6OCF3.js → chunk-ZQ7UK5US.js} +5 -5
- package/dist/daemon/server.js +2603 -867
- package/dist/hook-runtime/daemon/server.js +2603 -867
- package/dist/hook-runtime/hooks/post-commit.js +2671 -935
- package/dist/hook-runtime/hooks/post-rewrite.js +2664 -928
- package/dist/hook-runtime/hooks/post-tool-use.js +2606 -870
- package/dist/hook-runtime/hooks/pre-commit.js +9 -5
- package/dist/hook-runtime/hooks/pre-tool-use-worker.js +2625 -947
- package/dist/hook-runtime/hooks/prim-hook.js +2609 -873
- package/dist/hook-runtime/hooks/session-end.js +75 -13
- package/dist/hook-runtime/hooks/session-start.js +2801 -1056
- package/dist/hook-runtime/index.js +3741 -1556
- package/dist/hook-runtime/statusline-main.js +76 -14
- package/dist/hooks/post-commit.js +7 -7
- package/dist/hooks/post-rewrite.js +6 -6
- package/dist/hooks/post-tool-use.js +15 -15
- package/dist/hooks/pre-commit.js +4 -4
- package/dist/hooks/pre-tool-use-worker.js +9 -9
- package/dist/hooks/prim-hook.js +17 -17
- package/dist/hooks/session-end.js +4 -4
- package/dist/hooks/session-start.js +11 -11
- package/dist/index.js +419 -112
- package/dist/statusline-main.js +76 -14
- package/package.json +4 -2
- package/skills/prim-welcome/SKILL.md +197 -0
package/README.md
CHANGED
|
@@ -89,12 +89,16 @@ Use `prim setup --skip-demo` to remember a skip, or
|
|
|
89
89
|
`prim demo --agent <claude|codex|cursor|hermes>` to replay. Direct terminal `prim demo`
|
|
90
90
|
uses the same prompts. Setup defaults to compact diagnostics; `prim setup --details`
|
|
91
91
|
shows full child output. Default agent setup returns one JSON result with `welcome`,
|
|
92
|
-
`onboarding`, and its `nextAction`.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
`onboarding`, and its `nextAction`. In Claude Code and user-scope Codex sessions,
|
|
93
|
+
setup instead returns `welcomeSkill`, the path of the prim-welcome skill that runs
|
|
94
|
+
the welcome and demo (see below).
|
|
95
|
+
Existing completed tours do not replay automatically.
|
|
96
|
+
|
|
97
|
+
In the earlier tour used by other agents and project-scope Codex, agent hooks
|
|
98
|
+
acknowledge isolation before any sample is shown; capture resumes in a new session.
|
|
99
|
+
The prim-welcome tour pauses capture for the repository and resumes at the next
|
|
100
|
+
user prompt after the demo when its hooks are running. Synthetic records never
|
|
101
|
+
join the team's graph.
|
|
98
102
|
This exercises a real evaluator and demo-only blocking policy, not native production
|
|
99
103
|
Enforcement or live ingestion. Backend/email unavailability leaves the optional
|
|
100
104
|
story pending while successful setup remains successful.
|
|
@@ -123,9 +127,15 @@ classifier treats prim as trusted tooling rather than untrusted downloaded code.
|
|
|
123
127
|
|
|
124
128
|
### Set up with your coding agent
|
|
125
129
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
In Claude Code or Codex, paste this. The command is in **your** message, so the agent runs it
|
|
131
|
+
directly — instead of fetching a doc and executing a command from it, which an
|
|
132
|
+
auto-mode safety classifier blocks as untrusted-origin code:
|
|
133
|
+
|
|
134
|
+
```text
|
|
135
|
+
Set up Primitive for this repo: run `npx --yes @primitive.ai/prim@latest setup`, then read the file at its `welcomeSkill` path and follow it. If setup fails, show me its actual error.
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
In any other coding agent, paste this:
|
|
129
139
|
|
|
130
140
|
```text
|
|
131
141
|
Install the Primitive CLI and activate passive decision capture for this repository: run `npx --yes @primitive.ai/prim@latest setup` and show concise progress plus actionable warnings. Drive setup and its onboarding nextAction yourself; I'll handle browser authorization and any hook-trust review the agent requires. This request authorizes setup's built-in activation of this repository and an idempotent retry of that step, but not activation in another repository or creation of a Decision. If enable or health fails, surface the actual error; do not claim fresh activation approval is required. Then show me the welcome.
|
|
@@ -373,6 +383,14 @@ prim decisions unlink <child> --on <parent> # Remove that dependency
|
|
|
373
383
|
`<id>` uses the canonical `dec_<8 hex>` Decision ID; bare short IDs and legacy full IDs remain accepted as inputs. STDOUT is machine-readable
|
|
374
384
|
JSON; human-readable status goes to STDERR.
|
|
375
385
|
|
|
386
|
+
`decisions show` prints the maker and decided date. Imported seeds retain the
|
|
387
|
+
historical date's qualification (`on or about` or `no later than`) and precision;
|
|
388
|
+
day-only evidence stays on its original calendar day in every timezone. Missing
|
|
389
|
+
metadata, including seeds from older servers, reads `Decision maker unknown` or
|
|
390
|
+
`date unknown`. When available, the import timestamp and operational importer
|
|
391
|
+
appear separately. `decisions recent` uses calendar dates for older rows and
|
|
392
|
+
keeps the server's existing ordering and recency-window behavior.
|
|
393
|
+
|
|
376
394
|
`decisions check` uses the checkout's current Primitive repository binding and
|
|
377
395
|
Git branch. Paths are relative to the repository root, including from a
|
|
378
396
|
subdirectory; paths for files that do not exist yet are supported. Discovery
|
|
@@ -576,6 +594,24 @@ pnpm typecheck # Type-check
|
|
|
576
594
|
pnpm lint # Lint
|
|
577
595
|
```
|
|
578
596
|
|
|
597
|
+
Validate seed metadata presentation and real CLI output against a local fixture
|
|
598
|
+
server after building:
|
|
599
|
+
|
|
600
|
+
```bash
|
|
601
|
+
pnpm check:seed-metadata-golden --cli dist/index.js
|
|
602
|
+
pnpm check:seed-metadata-golden --cli dist/index.js --server-dir /path/to/client
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
The second form also checks the candidate server's response fixtures against
|
|
606
|
+
the currently locked CLI validators, and old response fixtures against the
|
|
607
|
+
candidate server schema. It does not change contract provenance. The lock pins
|
|
608
|
+
the published backend commit containing the additive seed metadata contract.
|
|
609
|
+
For future contract changes, refresh the locked artifacts with
|
|
610
|
+
`pnpm contracts:update --revision <full-client-commit>`, then run
|
|
611
|
+
`pnpm contracts:generate`, `pnpm contracts:check`, and
|
|
612
|
+
`pnpm contracts:provenance`. Do not point the lock at a revision that lacks the
|
|
613
|
+
vendored bytes.
|
|
614
|
+
|
|
579
615
|
### Actual host validation
|
|
580
616
|
|
|
581
617
|
After `pnpm build`, optional E2E checks drive a real host's tool loop against a
|
package/SKILL.md
CHANGED
|
@@ -152,6 +152,11 @@ Apply the same attention during non-code deliberation: planning or “grill me
|
|
|
152
152
|
|
|
153
153
|
### Onboarding: experience your Decision protecting a teammate
|
|
154
154
|
|
|
155
|
+
**Claude Code and Codex at user scope:** `prim setup` returns `welcomeSkill`
|
|
156
|
+
(a file path) instead of `nextAction`. Read that file and follow it; it replaces
|
|
157
|
+
the rest of this section, which applies to project-scope setup, Cursor and Hermes.
|
|
158
|
+
It hands seeding to the next section.
|
|
159
|
+
|
|
155
160
|
After successful `prim setup`, follow its `nextAction` automatically; the `onboarding`
|
|
156
161
|
object contains the preparation instructions.
|
|
157
162
|
Pass your agent explicitly: Claude, Codex, Cursor and Hermes use the same sequence.
|
|
@@ -211,7 +216,7 @@ adopt the prior Decision, or implement the feature yourself.
|
|
|
211
216
|
|
|
212
217
|
At the actual block, show the returned unchanged file and **Accept / Supercede** choices.
|
|
213
218
|
Accept uses `choices.adhere`; Supercede uses `choices.supersede`. Supercede approves the replacement,
|
|
214
|
-
**Allow
|
|
219
|
+
**Allow user names and email addresses in CSV exports**, and requires a short
|
|
215
220
|
reason in the user's own words. If missing, ask `choices.supersede.prompt` exactly;
|
|
216
221
|
if already supplied, do not ask again. The exploration prompts in the success message
|
|
217
222
|
are suggestions for the participant, not actions to execute automatically.
|
|
@@ -248,7 +253,7 @@ remains successful. Surface the returned remedy or offer its skip action.
|
|
|
248
253
|
|
|
249
254
|
When onboarding or `prim welcome` reports `"org": "seed"`, seed the viewer's graph by proposing decisions mined from memory. There is no open goals question: the proposals are the whole seeding pass. Propose **one decision per message**, wait for the user's verdict, and only then present the next — never present the candidates as a batch.
|
|
250
255
|
|
|
251
|
-
1. Gather candidates from the repo's Git-tracked shared memory and agent-instruction files (`git ls-files -- 'MEMORY.md' ':(glob)**/MEMORY.md' 'AGENTS.md' ':(glob)**/AGENTS.md' 'CLAUDE.md' ':(glob)**/CLAUDE.md'` from the repository root; read every path returned) and from your own memory and conversation context — positions the user has already *stated*; the setup guide names each agent's memory surface. Never automatically read an untracked, gitignored, or un-shared memory source; use one only when the user explicitly asks to promote it. Only their words count: never infer a position from the repo's code or history, and never invent one they didn't state.
|
|
256
|
+
1. Gather candidates from the repo's Git-tracked shared memory and agent-instruction files (`git ls-files -- 'MEMORY.md' ':(glob)**/MEMORY.md' 'AGENTS.md' ':(glob)**/AGENTS.md' 'CLAUDE.md' ':(glob)**/CLAUDE.md'` from the repository root; read every path returned) and from your own memory and conversation context — positions the user has already *stated*; the setup guide names each agent's memory surface. Never automatically read an untracked, gitignored, or un-shared memory source; use one only when the user explicitly asks to promote it. Only their words count: never infer a position from the repo's code or history, and never invent one they didn't state. Never use anything from the onboarding demo's fictional story, including the user's adhere/supersede choice and reason.
|
|
252
257
|
2. A candidate must state an explicit, durable position that appears to remain in force — a genuine fork in the road such as a goal, priority, principle, invariant, constraint, default, commitment, tradeoff, or exception. Do not infer decisions from code, repository structure, or unstated implications, and do not bulk-import the documents. The personal-environment exclusion above applies: never propose a position that binds no teammate.
|
|
253
258
|
3. Run `npx --yes @primitive.ai/prim decisions recent --limit 20` and drop candidates equivalent to existing decisions. If the result is unavailable or too incomplete to rule out a duplicate confidently, drop the uncertain candidate; explain the limitation.
|
|
254
259
|
4. Propose the strongest candidates one at a time — **at most six in total**, fewer when the material runs out (never invent a proposal to fill the quota), stopping early if the user declines to continue. Each proposal carries the proposed decision, its source (file path or the stated context), and only rationale or alternatives explicitly supported by that source; when the source yields no rationale, fold the single rationale question into the same prompt. In this and any user-facing presentation, label the position **Decision**, never "Intent" — intent is `--intent` flag vocabulary, not user copy — and label the rejected options **Alternatives rejected**, never "alternatives considered". Make clear, at least on the first proposal, that approved decisions join the team's shared decision graph, visible to any teammates — not a private list. Ask the user to approve, revise, or reject it — do not silently attribute a historical repository position to the onboarding user — and create each approved decision (per the wording and flag rules below) before presenting the next.
|
|
@@ -230,25 +230,117 @@ function canonicalRepositoryPath(filePath, contextOrCwd, baseDirOrRoot) {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
// src/lib/activation.ts
|
|
233
|
-
import { execFileSync as
|
|
233
|
+
import { execFileSync as execFileSync3 } from "child_process";
|
|
234
234
|
import { existsSync, readFileSync } from "fs";
|
|
235
235
|
import { homedir } from "os";
|
|
236
236
|
import { join } from "path";
|
|
237
|
+
|
|
238
|
+
// src/lib/demo-pause.ts
|
|
239
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
240
|
+
var DEMO_PAUSE_MS = 30 * 6e4;
|
|
241
|
+
var PAUSE_KEY = "prim.demoPause";
|
|
242
|
+
var GIT_TIMEOUT_MS2 = 1e3;
|
|
243
|
+
function git(cwd, args) {
|
|
244
|
+
try {
|
|
245
|
+
return execFileSync2("git", args, {
|
|
246
|
+
cwd,
|
|
247
|
+
encoding: "utf-8",
|
|
248
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
249
|
+
timeout: GIT_TIMEOUT_MS2
|
|
250
|
+
});
|
|
251
|
+
} catch {
|
|
252
|
+
return void 0;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function setLocal(cwd, key, value) {
|
|
256
|
+
try {
|
|
257
|
+
execFileSync2(
|
|
258
|
+
"git",
|
|
259
|
+
value === null ? ["config", "--local", "--unset", key] : ["config", "--local", key, value],
|
|
260
|
+
{ cwd, stdio: ["ignore", "ignore", "pipe"], timeout: GIT_TIMEOUT_MS2 }
|
|
261
|
+
);
|
|
262
|
+
} catch (error) {
|
|
263
|
+
if (value !== null || error.status !== 5) throw error;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function parsePause(value) {
|
|
267
|
+
const [runId = "", until, previous, state] = value.trim().split(" ");
|
|
268
|
+
const flag = previous === "true" || previous === "false" ? previous : "unset";
|
|
269
|
+
return { runId, until: Number(until) || 0, previous: flag, ending: state !== "active" };
|
|
270
|
+
}
|
|
271
|
+
function writePause(cwd, pause) {
|
|
272
|
+
setLocal(
|
|
273
|
+
cwd,
|
|
274
|
+
PAUSE_KEY,
|
|
275
|
+
`${pause.runId} ${pause.until} ${pause.previous} ${pause.ending ? "ending" : "active"}`
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
function readCaptureConfig(cwd) {
|
|
279
|
+
let active;
|
|
280
|
+
let pause;
|
|
281
|
+
const out = git(cwd, ["config", "--get-regexp", "^prim\\.(active|demopause)$"]) ?? "";
|
|
282
|
+
for (const line of out.split("\n")) {
|
|
283
|
+
const space = line.indexOf(" ");
|
|
284
|
+
const key = line.slice(0, space).toLowerCase();
|
|
285
|
+
const value = line.slice(space + 1);
|
|
286
|
+
if (key === "prim.active") active = value === "true" || value === "false" ? value : void 0;
|
|
287
|
+
if (key === "prim.demopause") pause = parsePause(value);
|
|
288
|
+
}
|
|
289
|
+
return { active, pause };
|
|
290
|
+
}
|
|
291
|
+
function readDemoPause(cwd) {
|
|
292
|
+
const value = git(cwd, ["config", "--local", "--get", PAUSE_KEY]);
|
|
293
|
+
return value === void 0 ? void 0 : parsePause(value);
|
|
294
|
+
}
|
|
295
|
+
function pauseCaptureForDemo(cwd, runId, now = Date.now()) {
|
|
296
|
+
const local = git(cwd, ["config", "--local", "--get", "prim.active"])?.trim();
|
|
297
|
+
const previous = readDemoPause(cwd)?.previous ?? (local === "true" || local === "false" ? local : "unset");
|
|
298
|
+
writePause(cwd, { runId, until: now + DEMO_PAUSE_MS, previous, ending: false });
|
|
299
|
+
setLocal(cwd, "prim.active", "false");
|
|
300
|
+
}
|
|
301
|
+
function extendDemoPause(cwd, runId, now = Date.now()) {
|
|
302
|
+
const pause = readDemoPause(cwd);
|
|
303
|
+
if (pause?.runId === runId) writePause(cwd, { ...pause, until: now + DEMO_PAUSE_MS });
|
|
304
|
+
}
|
|
305
|
+
function endDemoPause(cwd, runId, now = Date.now()) {
|
|
306
|
+
const pause = readDemoPause(cwd);
|
|
307
|
+
if (pause?.runId === runId)
|
|
308
|
+
writePause(cwd, { ...pause, until: now + DEMO_PAUSE_MS, ending: true });
|
|
309
|
+
}
|
|
310
|
+
function resumeCapture(cwd, pause) {
|
|
311
|
+
setLocal(cwd, "prim.active", pause.previous === "unset" ? null : pause.previous);
|
|
312
|
+
setLocal(cwd, PAUSE_KEY, null);
|
|
313
|
+
}
|
|
314
|
+
function clearDemoPause(cwd) {
|
|
315
|
+
setLocal(cwd, PAUSE_KEY, null);
|
|
316
|
+
}
|
|
317
|
+
function healDemoPause(cwd, pause, options = {}) {
|
|
318
|
+
if (pause.until > (options.now ?? Date.now()) && !(pause.ending && options.userPrompt))
|
|
319
|
+
return false;
|
|
320
|
+
try {
|
|
321
|
+
resumeCapture(cwd, pause);
|
|
322
|
+
return true;
|
|
323
|
+
} catch {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// src/lib/activation.ts
|
|
237
329
|
var PRIM_ACTIVE_KEY = "prim.active";
|
|
238
330
|
var PRIM_REPO_SYNC_ID_KEY = "prim.repoSyncId";
|
|
239
331
|
var PRIM_REPO_SYNC_REPOSITORY_KEY = "prim.repoSyncRepository";
|
|
240
332
|
var PRIM_REPO_BINDING_STATE_KEY = "prim.repoBindingState";
|
|
241
|
-
var
|
|
333
|
+
var GIT_TIMEOUT_MS3 = 1e3;
|
|
242
334
|
var REPO_SYNC_ID_RE = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
|
|
243
335
|
var PROJECT_INSTALL_FILES = [".claude/settings.json", ".codex/hooks.json", ".cursor/hooks.json"];
|
|
244
336
|
var PRIM_HOOK_BINS = ["prim-hook", "prim-pre-tool-use", "prim-post-tool-use"];
|
|
245
337
|
function repoActiveFlag(cwd, strict = false) {
|
|
246
338
|
try {
|
|
247
|
-
const value =
|
|
339
|
+
const value = execFileSync3("git", ["config", "--get", PRIM_ACTIVE_KEY], {
|
|
248
340
|
cwd,
|
|
249
341
|
encoding: "utf-8",
|
|
250
342
|
stdio: ["ignore", "pipe", "ignore"],
|
|
251
|
-
timeout:
|
|
343
|
+
timeout: GIT_TIMEOUT_MS3
|
|
252
344
|
}).trim();
|
|
253
345
|
if (value === "true") return "true";
|
|
254
346
|
if (value === "false") return "false";
|
|
@@ -261,10 +353,10 @@ function repoActiveFlag(cwd, strict = false) {
|
|
|
261
353
|
}
|
|
262
354
|
}
|
|
263
355
|
function setRepoActive(cwd, active) {
|
|
264
|
-
|
|
356
|
+
execFileSync3("git", ["config", "--local", PRIM_ACTIVE_KEY, active ? "true" : "false"], {
|
|
265
357
|
cwd,
|
|
266
358
|
stdio: ["ignore", "ignore", "pipe"],
|
|
267
|
-
timeout:
|
|
359
|
+
timeout: GIT_TIMEOUT_MS3
|
|
268
360
|
});
|
|
269
361
|
}
|
|
270
362
|
function isValidRepoSyncId(value) {
|
|
@@ -272,11 +364,11 @@ function isValidRepoSyncId(value) {
|
|
|
272
364
|
}
|
|
273
365
|
function localGitConfigValue(cwd, key) {
|
|
274
366
|
try {
|
|
275
|
-
const value =
|
|
367
|
+
const value = execFileSync3("git", ["config", "--local", "--get", key], {
|
|
276
368
|
cwd,
|
|
277
369
|
encoding: "utf-8",
|
|
278
370
|
stdio: ["ignore", "pipe", "ignore"],
|
|
279
|
-
timeout:
|
|
371
|
+
timeout: GIT_TIMEOUT_MS3
|
|
280
372
|
}).trim();
|
|
281
373
|
return value || void 0;
|
|
282
374
|
} catch {
|
|
@@ -284,10 +376,10 @@ function localGitConfigValue(cwd, key) {
|
|
|
284
376
|
}
|
|
285
377
|
}
|
|
286
378
|
function setLocalGitConfigValue(cwd, key, value) {
|
|
287
|
-
|
|
379
|
+
execFileSync3("git", ["config", "--local", key, value], {
|
|
288
380
|
cwd,
|
|
289
381
|
stdio: ["ignore", "ignore", "pipe"],
|
|
290
|
-
timeout:
|
|
382
|
+
timeout: GIT_TIMEOUT_MS3
|
|
291
383
|
});
|
|
292
384
|
}
|
|
293
385
|
function repoSyncId(cwd) {
|
|
@@ -300,25 +392,25 @@ function setRepoSyncId(cwd, value, repositoryFullName) {
|
|
|
300
392
|
if (!isValidRepoSyncId(value)) {
|
|
301
393
|
throw new Error("invalid repository binding returned by server");
|
|
302
394
|
}
|
|
303
|
-
|
|
395
|
+
execFileSync3("git", ["config", "--local", PRIM_REPO_SYNC_ID_KEY, value], {
|
|
304
396
|
cwd,
|
|
305
397
|
stdio: ["ignore", "ignore", "pipe"],
|
|
306
|
-
timeout:
|
|
398
|
+
timeout: GIT_TIMEOUT_MS3
|
|
307
399
|
});
|
|
308
|
-
|
|
400
|
+
execFileSync3("git", ["config", "--local", PRIM_REPO_SYNC_REPOSITORY_KEY, repositoryFullName], {
|
|
309
401
|
cwd,
|
|
310
402
|
stdio: ["ignore", "ignore", "pipe"],
|
|
311
|
-
timeout:
|
|
403
|
+
timeout: GIT_TIMEOUT_MS3
|
|
312
404
|
});
|
|
313
405
|
}
|
|
314
406
|
function setRepositoryBindingState(cwd, state) {
|
|
315
407
|
if (state !== "connected" && state !== "unbound" && state !== "invalid") {
|
|
316
408
|
throw new Error("invalid repository binding state");
|
|
317
409
|
}
|
|
318
|
-
|
|
410
|
+
execFileSync3("git", ["config", "--local", PRIM_REPO_BINDING_STATE_KEY, state], {
|
|
319
411
|
cwd,
|
|
320
412
|
stdio: ["ignore", "ignore", "pipe"],
|
|
321
|
-
timeout:
|
|
413
|
+
timeout: GIT_TIMEOUT_MS3
|
|
322
414
|
});
|
|
323
415
|
}
|
|
324
416
|
function repositoryBindingState(cwd) {
|
|
@@ -345,8 +437,9 @@ function hasProjectPrimInstall(cwd) {
|
|
|
345
437
|
}
|
|
346
438
|
return false;
|
|
347
439
|
}
|
|
348
|
-
function isRepoActiveForCapture(cwd) {
|
|
349
|
-
|
|
440
|
+
function isRepoActiveForCapture(cwd, options = {}) {
|
|
441
|
+
let { active: flag, pause } = readCaptureConfig(cwd);
|
|
442
|
+
if (pause && healDemoPause(cwd, pause, options)) flag = repoActiveFlag(cwd);
|
|
350
443
|
if (flag === "true") return true;
|
|
351
444
|
if (flag === "false") return false;
|
|
352
445
|
return hasProjectPrimInstall(cwd);
|
|
@@ -1297,6 +1390,12 @@ export {
|
|
|
1297
1390
|
decodeJwtPayload,
|
|
1298
1391
|
jwtExpiresAt,
|
|
1299
1392
|
jwtOrganizationId,
|
|
1393
|
+
readDemoPause,
|
|
1394
|
+
pauseCaptureForDemo,
|
|
1395
|
+
extendDemoPause,
|
|
1396
|
+
endDemoPause,
|
|
1397
|
+
clearDemoPause,
|
|
1398
|
+
healDemoPause,
|
|
1300
1399
|
gitToplevel,
|
|
1301
1400
|
mainWorktreeRoot,
|
|
1302
1401
|
currentBranch,
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-EZXEWFDG.js";
|
|
4
4
|
import {
|
|
5
5
|
scrubEnvironmentPaths
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4NUGCUQC.js";
|
|
7
7
|
import {
|
|
8
8
|
isValidRepoSyncId
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4GYJHN26.js";
|
|
10
10
|
|
|
11
11
|
// src/hooks/prim-hook-core.ts
|
|
12
12
|
import { createHash, randomUUID } from "crypto";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
boundedHealthError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HLMC7VS4.js";
|
|
4
4
|
import {
|
|
5
5
|
terminalSafeLine
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-S3ZIMGXV.js";
|
|
7
7
|
|
|
8
8
|
// src/hooks/redact.ts
|
|
9
9
|
import { existsSync, readFileSync, statSync } from "fs";
|