@rarog/server 1.0.1 → 1.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +4 -3
  2. package/node_modules/@rarog/shared/package.json +1 -1
  3. package/node_modules/@rarog/shared/src/decode.js +49 -3
  4. package/node_modules/@rarog/shared/src/protocol/files.js +33 -0
  5. package/node_modules/@rarog/shared/src/protocol/inbox.js +38 -0
  6. package/node_modules/@rarog/shared/src/protocol.js +16 -17
  7. package/node_modules/@rarog/shared/src/rest.js +106 -12
  8. package/node_modules/@rarog/shared/src/sentences/rest.js +13 -0
  9. package/package.json +3 -3
  10. package/server/src/bootstrap/consent.js +88 -2
  11. package/server/src/bootstrap/http.js +3 -2
  12. package/server/src/bootstrap/inbox.js +29 -4
  13. package/server/src/bootstrap/sse.js +2 -1
  14. package/server/src/cli/doctor-no-hook.js +162 -0
  15. package/server/src/cli/doctor.js +2 -0
  16. package/server/src/cli/update-channel.js +100 -0
  17. package/server/src/cli/update-registry.js +160 -62
  18. package/server/src/cli/update.js +13 -3
  19. package/server/src/companion/turns-settle.js +4 -1
  20. package/server/src/companion/turns.js +36 -5
  21. package/server/src/config/files.js +32 -0
  22. package/server/src/config/flags.js +10 -1
  23. package/server/src/config-env.js +24 -0
  24. package/server/src/config.js +6 -2
  25. package/server/src/demo/files.js +49 -0
  26. package/server/src/demo/inbox.js +73 -0
  27. package/server/src/demo/review-routes.js +6 -1
  28. package/server/src/device-effects.js +3 -1
  29. package/server/src/drivers/herdr/consent-no-hook-io.js +89 -0
  30. package/server/src/drivers/herdr/consent-no-hook.js +316 -0
  31. package/server/src/drivers/herdr/refusals.js +226 -0
  32. package/server/src/drivers/herdr/returned-prompt.js +172 -0
  33. package/server/src/drivers/herdr-driver.js +116 -287
  34. package/server/src/files/file-index.js +246 -0
  35. package/server/src/files/ignored.js +119 -0
  36. package/server/src/files/listing.js +76 -0
  37. package/server/src/files/path-rule.js +145 -0
  38. package/server/src/files/refusals.js +36 -0
  39. package/server/src/files/send-file.js +115 -0
  40. package/server/src/files/session-download.js +51 -0
  41. package/server/src/files/session-files.js +38 -0
  42. package/server/src/files/session-gate.js +48 -0
  43. package/server/src/git-status.js +3 -2
  44. package/server/src/herdr/audit.js +1 -1
  45. package/server/src/herdr/dialogs/hook/contract.js +16 -9
  46. package/server/src/herdr/dialogs/index.js +6 -1
  47. package/server/src/herdr/dialogs/layer1/hook-list/hook-list.js +132 -59
  48. package/server/src/herdr/dialogs/layer1/hook-list/session-facts.js +135 -0
  49. package/server/src/herdr/dialogs/layer1/version-gate.js +13 -5
  50. package/server/src/herdr/dialogs/no-hook.js +63 -0
  51. package/server/src/herdr/dialogs/screen/block.js +10 -0
  52. package/server/src/herdr/dialogs/screen/parse.js +10 -1
  53. package/server/src/herdr/jsonl-pending.js +25 -1
  54. package/server/src/inbox/card.js +18 -9
  55. package/server/src/inbox/dialogs.js +40 -12
  56. package/server/src/inbox/heads.js +55 -0
  57. package/server/src/inbox/inbox.js +24 -2
  58. package/server/src/inbox/index.js +3 -1
  59. package/server/src/index.js +22 -18
  60. package/server/src/install/repair.js +8 -0
  61. package/server/src/log-timestamps.js +9 -4
  62. package/server/src/router.js +7 -1
  63. package/server/src/routes/devices.js +2 -2
  64. package/server/src/routes/inbox.js +91 -0
  65. package/server/src/routes/sessions.js +135 -14
  66. package/server/src/routes/system.js +5 -4
  67. package/server/src/safe-read.js +86 -1
  68. package/server/src/sessions/companion-scope.js +6 -2
  69. package/server/src/sessions/demo-modules.js +16 -0
  70. package/server/src/sessions/diff-measure.js +30 -0
  71. package/server/src/sessions/manager.js +64 -152
  72. package/server/src/sessions/ring-buffer.js +18 -3
  73. package/server/src/sessions/seen-marks.js +9 -6
  74. package/server/src/sessions/session-scope.js +30 -0
  75. package/server/src/sessions/session.js +20 -1
  76. package/server/src/sessions/waiting-line.js +72 -0
  77. package/server/src/sse.js +40 -6
  78. package/server/src/version.js +30 -0
@@ -1,18 +1,21 @@
1
1
  /**
2
2
  * Server start: the Inbox (`server/src/inbox/`). It joins the session manager's event stream and conversation
3
- * changes to the card tracker and reads every session's card once after the manager is ready. It works without push
4
- * notifications; `main()` in `server/src/index.ts` calls it after creating the manager and before `ready` settles.
3
+ * changes to the card tracker, reads every session's card once after the manager is ready, and puts the heads
4
+ * publisher for the stream on the tracker. In demo mode the segments come from the demo sessions' events
5
+ * (`demo/inbox.ts`) and the removals go to `inbox.json` of the demo data directory. It works without push
6
+ * notifications; `main()` in `server/src/index.ts` calls {@link assembleInbox} after creating the manager and before
7
+ * `ready` settles.
5
8
  */
6
9
  import { defaultStoreRoot } from '../cli-store.js';
7
10
  import { HERDR_HISTORY_MESSAGES } from '../config.js';
8
11
  import { HISTORY_MAX_BYTES } from '../herdr/jsonl-follow.js';
9
12
  import { locateTranscript } from '../herdr/transcript-path.js';
10
- import { Inbox, createSegmentReader } from '../inbox/index.js';
13
+ import { Inbox, InboxHeads, createSegmentReader } from '../inbox/index.js';
11
14
  export function startInbox(deps) {
12
15
  const { manager } = deps;
13
16
  const inbox = new Inbox({
14
17
  dataDir: deps.dataDir,
15
- readSegments: createSegmentReader({
18
+ readSegments: deps.readSegments ?? createSegmentReader({
16
19
  locate: deps.locate ?? ((cwd, agentSessionId) => locateTranscript(defaultStoreRoot(), cwd, agentSessionId)),
17
20
  promptBlock: deps.promptBlock,
18
21
  limit: HERDR_HISTORY_MESSAGES,
@@ -27,3 +30,25 @@ export function startInbox(deps) {
27
30
  void deps.ready.then(() => { inbox.refreshAll(); }, () => undefined);
28
31
  return inbox;
29
32
  }
33
+ /**
34
+ * The Inbox of this start: `null` with `RAROG_INBOX=0` (no tracker, no heads, the routes answer 503, `inbox.json`
35
+ * untouched). The heads publisher subscribes to the tracker at once, before the first card read, so it holds every
36
+ * visible card when the first stream opens.
37
+ */
38
+ export async function assembleInbox(deps) {
39
+ const { config, manager } = deps;
40
+ if (!config.inboxEnabled)
41
+ return null;
42
+ const demo = config.demo ? await import('../demo/inbox.js') : null;
43
+ const port = demo === null ? manager : demo.demoInboxManager(manager);
44
+ const inbox = startInbox({
45
+ manager: port, ready: deps.ready, dataDir: config.dataDir, promptBlock: config.promptBlock, log: deps.log,
46
+ ...(demo === null ? {} : { readSegments: demo.createDemoSegmentReader(port) }),
47
+ ...(deps.locate === undefined ? {} : { locate: deps.locate }),
48
+ ...(deps.debounceMs === undefined ? {} : { debounceMs: deps.debounceMs }),
49
+ });
50
+ const heads = new InboxHeads(inbox);
51
+ if (demo !== null)
52
+ void deps.ready.then(() => { demo.replayDemoDialogs(port, inbox); }, () => undefined);
53
+ return { inbox, heads };
54
+ }
@@ -6,7 +6,7 @@ import { projectsWithNotes } from '../notes/store.js';
6
6
  import { SseHub } from '../sse.js';
7
7
  /** The hub, not started yet: `main()` calls `start()`. */
8
8
  export function createSseHub(deps) {
9
- const { config, manager, serverStartId, log, demoNotes, onClientCount } = deps;
9
+ const { config, manager, serverStartId, log, demoNotes, onClientCount, inbox } = deps;
10
10
  return new SseHub({
11
11
  manager, serverStartId, protocolVersion: PROTOCOL_VERSION,
12
12
  // Linia `sse: powtórka … → snapshot` — koszt bajtów zamiany powtórki na snapshot.
@@ -14,6 +14,7 @@ export function createSseHub(deps) {
14
14
  // Stream compression with gzip, only for a client with `Accept-Encoding: gzip`; on unless `RAROG_SSE_GZIP=0`.
15
15
  gzip: config.sseGzip,
16
16
  ...(onClientCount === undefined ? {} : { onClientCount }),
17
+ ...(inbox === undefined ? {} : { inbox }),
17
18
  // Próg builda apki natywnej; brak w configu = brak pola w `hello`.
18
19
  ...(config.minClientBuild === undefined ? {} : { minClientBuild: config.minClientBuild }),
19
20
  /*
@@ -0,0 +1,162 @@
1
+ /**
2
+ * `rarog doctor`: consents without a hook. Reads the `consent: no hook — …` lines (`docs/dialogs.md`, "Refusal
3
+ * diagnostics") from the end of `<dataDir>/server.log`, keeps those of the last 7 days and prints one line per cause:
4
+ * `hooks-disabled`, `outside-work-area` and `not-in-session-hooks` are `warn` with a fix, `hook-running`,
5
+ * `unexplained` and a cause it does not know are `info`; none is one `info` line. No data directory or an unreadable
6
+ * log is `unknown`. Reads only; values reach the screen only from a closed character class.
7
+ */
8
+ import path from 'node:path';
9
+ import { HERDR_ROOTS_ENV } from '../config-env.js';
10
+ import { rarogCli } from '../install/repair.js';
11
+ import { LOG_TIME_PREFIX } from '../log-timestamps.js';
12
+ import { openRegularFile } from '../safe-read.js';
13
+ export const NO_HOOK_WINDOW_MS = 7 * 24 * 60 * 60 * 1000;
14
+ /** The end of `server.log` that doctor reads; under the service the log only grows. */
15
+ export const NO_HOOK_READ_BYTES = 32 * 1024 * 1024;
16
+ const SERVER_LOG_FILENAME = 'server.log';
17
+ const TITLE = 'consent without a hook';
18
+ const LINE_HEAD = 'consent: no hook — ';
19
+ const LOG_TIME = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z) /u;
20
+ /** A value doctor prints: anything else (terminal escapes, spaces) becomes `?`. */
21
+ const SAFE_VALUE = /^[A-Za-z0-9_.:@+-]{1,80}$/u;
22
+ const safe = (value) => (value !== undefined && SAFE_VALUE.test(value) ? value : '?');
23
+ /**
24
+ * The `no hook` lines of `text`; a line without the server's time prefix has no age, so it does not count, and
25
+ * neither does a continuation line of another log call (time, then `LOG_CONTINUATION_MARK`).
26
+ */
27
+ export function parseNoHookLog(text) {
28
+ const entries = [];
29
+ for (const raw of text.split('\n')) {
30
+ const time = LOG_TIME.exec(raw);
31
+ if (time === null)
32
+ continue;
33
+ const rest = raw.replace(LOG_TIME_PREFIX, '').trimEnd();
34
+ if (!rest.startsWith(LINE_HEAD))
35
+ continue;
36
+ const fields = new Map();
37
+ for (const part of rest.slice(LINE_HEAD.length).split(', ')) {
38
+ const space = part.indexOf(' ');
39
+ if (space > 0 && !fields.has(part.slice(0, space)))
40
+ fields.set(part.slice(0, space), part.slice(space + 1));
41
+ }
42
+ entries.push({
43
+ at: Date.parse(time[1] ?? ''), session: safe(fields.get('session')), cause: safe(fields.get('cause')),
44
+ tool: safe(fields.get('tool')), cli: safe(fields.get('cli')), thread: safe(fields.get('thread')),
45
+ });
46
+ }
47
+ return entries;
48
+ }
49
+ /** The causes in the order the detector checks them. */
50
+ const CAUSES = new Map([
51
+ ['hook-running', { verdict: 'info', why: 'the hook process ran without registering' }],
52
+ ['outside-work-area', {
53
+ verdict: 'warn', why: 'the session works in a directory outside Rarog\'s work area, where the hook does not write',
54
+ repair: () => `start the session in a directory under a root of the work area, or add its root to`
55
+ + ` ${HERDR_ROOTS_ENV} in config.json and run ${rarogCli('restart')}`,
56
+ }],
57
+ ['hooks-disabled', {
58
+ verdict: 'warn', why: 'the session\'s Claude Code settings turn hooks off (disableAllHooks)',
59
+ repair: () => 'remove "disableAllHooks": true from the settings the session reads (~/.claude/settings.json, the'
60
+ + ' project\'s .claude/settings.json or .claude/settings.local.json), or allowManagedHooksOnly from the managed'
61
+ + ' settings',
62
+ }],
63
+ ['not-in-session-hooks', {
64
+ verdict: 'warn', why: 'the settings the session reads have no Rarog hook entry',
65
+ repair: () => `${rarogCli('hooks doctor')} shows the entry in ~/.claude/settings.json and ${rarogCli('setup')}`
66
+ + ' installs it; with the entry in place, restart the Claude Code session',
67
+ }],
68
+ ['unexplained', { verdict: 'info', why: 'the hook did not register and the server sees no reason' }],
69
+ ]);
70
+ const UNKNOWN_CAUSE = { verdict: 'info', why: 'a cause this doctor does not know' };
71
+ /** `a (2), b (1)`: values by count, then by name. */
72
+ function counted(values) {
73
+ const counts = new Map();
74
+ for (const value of values)
75
+ counts.set(value, (counts.get(value) ?? 0) + 1);
76
+ return [...counts].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))
77
+ .map(([value, count]) => `${value} (${String(count)})`).join(', ');
78
+ }
79
+ /** The doctor lines for a read of the log at `now`. */
80
+ export function noHookLinesOf(read, now) {
81
+ if (read === null) {
82
+ return [{ verdict: 'unknown', text: `${TITLE}: data directory in conflict — server.log location unknown` }];
83
+ }
84
+ if ('failure' in read)
85
+ return [{ verdict: 'unknown', text: `${TITLE}: ${read.file} unreadable (${read.failure})` }];
86
+ const from = now - NO_HOOK_WINDOW_MS;
87
+ const entries = parseNoHookLog(read.text).filter((entry) => entry.at >= from);
88
+ const firstTime = LOG_TIME.exec(read.text.split('\n').find((raw) => LOG_TIME.test(raw)) ?? '')?.[1];
89
+ const shortened = read.truncated && firstTime !== undefined && Date.parse(firstTime) > from
90
+ ? [`only the end of ${read.file} was read, from ${firstTime}`] : [];
91
+ if (entries.length === 0) {
92
+ return [{
93
+ verdict: 'info', text: `${TITLE}: none in the last 7 days (${read.file})`,
94
+ ...(shortened.length > 0 ? { details: shortened } : {}),
95
+ }];
96
+ }
97
+ const causes = [...new Set(entries.map((entry) => entry.cause))].sort((a, b) => {
98
+ const order = [...CAUSES.keys()];
99
+ const rank = (cause) => (order.includes(cause) ? order.indexOf(cause) : order.length);
100
+ return rank(a) - rank(b) || a.localeCompare(b);
101
+ });
102
+ return causes.map((cause) => {
103
+ const mine = entries.filter((entry) => entry.cause === cause);
104
+ const text = CAUSES.get(cause) ?? UNKNOWN_CAUSE;
105
+ const versions = [...new Set(mine.map((entry) => entry.cli))].sort().join(', ');
106
+ const sessions = new Set(mine.map((entry) => entry.session)).size;
107
+ return {
108
+ verdict: text.verdict,
109
+ text: `${TITLE}: ${String(mine.length)} in the last 7 days, cause ${cause} — ${text.why}`,
110
+ details: [
111
+ `Claude Code ${versions}; tools ${counted(mine.map((entry) => entry.tool))}; sessions ${String(sessions)}`,
112
+ ...shortened,
113
+ ],
114
+ ...(text.repair !== undefined ? { repair: text.repair() } : {}),
115
+ };
116
+ });
117
+ }
118
+ const errnoCode = (failure) => {
119
+ const code = failure !== null && typeof failure === 'object' ? failure.code : undefined;
120
+ return typeof code === 'string' && code !== '' ? code : String(failure);
121
+ };
122
+ /**
123
+ * The end of `<dataDir>/server.log`, at most `maxBytes`, starting at a whole line. The byte before the cut is read
124
+ * too, so a cut that falls on a line start keeps that line.
125
+ */
126
+ async function readLogEnd(file, maxBytes) {
127
+ try {
128
+ const opened = await openRegularFile(file, { followSymlink: true });
129
+ if (opened === null)
130
+ return { file, failure: 'not a regular file' };
131
+ try {
132
+ const size = Number(opened.stats.size);
133
+ const start = Math.max(0, size - maxBytes - 1);
134
+ const buffer = Buffer.alloc(size - start);
135
+ let filled = 0;
136
+ while (filled < buffer.length) {
137
+ const { bytesRead } = await opened.handle.read(buffer, filled, buffer.length - filled, start + filled);
138
+ if (bytesRead === 0)
139
+ break;
140
+ filled += bytesRead;
141
+ }
142
+ let text = buffer.subarray(0, filled).toString('utf8');
143
+ if (start > 0) {
144
+ const cut = text.indexOf('\n');
145
+ text = cut === -1 ? '' : text.slice(cut + 1);
146
+ }
147
+ return { file, text, truncated: start > 0 };
148
+ }
149
+ finally {
150
+ await opened.handle.close();
151
+ }
152
+ }
153
+ catch (failure) {
154
+ return { file, failure: errnoCode(failure) };
155
+ }
156
+ }
157
+ /** The lines for the data directory `doctor` resolved (`null` = directories in conflict). */
158
+ export async function noHookLines(dataDir, now, opts = {}) {
159
+ const read = dataDir === null
160
+ ? null : await readLogEnd(path.join(dataDir, SERVER_LOG_FILENAME), opts.maxBytes ?? NO_HOOK_READ_BYTES);
161
+ return noHookLinesOf(read, now);
162
+ }
@@ -50,6 +50,7 @@ import { RAROG_BIN } from '../install/service-target.js';
50
50
  import { IROH_PACKAGE, irohModuleInfo, irohPlatform } from '../iroh/adapter.js';
51
51
  import { readRegularFileSync } from '../safe-read.js';
52
52
  import { RAROG_VERSION } from '../version.js';
53
+ import { noHookLines } from './doctor-no-hook.js';
53
54
  import { prStatusLine } from './doctor-pr-status.js';
54
55
  import { writeBlockLine } from './doctor-write-block.js';
55
56
  import { HOOK_CHECKOUT_REASON, HOOK_REPAIR_COPY, HOOK_REPAIR_ENTRY, seenByFileLines, } from './hooks.js';
@@ -1510,6 +1511,7 @@ export async function doctorCommand(argv, io) {
1510
1511
  hookLine(home, health, dataDir),
1511
1512
  consentLineOf(health, thresholdOf(built?.env ?? null)),
1512
1513
  channelSettingsLine(home, dataDir),
1514
+ ...await noHookLines(dataDir, Date.now()),
1513
1515
  writeBlockLine(io, home, platform, manager, flags.dataDir),
1514
1516
  statusLineLine(home, Date.now()),
1515
1517
  // A loaded herdr agent starts herdr with `launchctl kickstart` (`setup-herdr-agent.ts`).
@@ -0,0 +1,100 @@
1
+ /**
2
+ * The channel rules of `rarog update`: the shapes of a release and a beta version, which version `rarog update --beta`
3
+ * targets from the npm dist-tags (the higher of `beta` and `latest`), and whether npm's `min-release-age-exclude`
4
+ * lets this package past the release age gate. Pure functions over what npm prints; the npm calls stay in
5
+ * `update-registry.ts`.
6
+ */
7
+ const STABLE = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/u;
8
+ const BETA = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)-beta\.(?:0|[1-9]\d*)$/u;
9
+ /** A release: `X.Y.Z`, numbers without leading zeros. */
10
+ export function isStableVersion(value) {
11
+ return typeof value === 'string' && STABLE.test(value);
12
+ }
13
+ /** A beta: a release followed by `-beta.N`, `N` without leading zeros, and nothing after it. */
14
+ export function isBetaVersion(value) {
15
+ return typeof value === 'string' && BETA.test(value);
16
+ }
17
+ /** A version with a pre-release part (`1.1.0-beta.2`, `1.1.0-rc.0`): `X.Y.Z` followed by `-`. */
18
+ export function isPrerelease(version) {
19
+ return /^\d+\.\d+\.\d+-/u.test(version);
20
+ }
21
+ /** `X.Y.Z` and `X.Y.Z-beta.N` in semver order (a beta below its release). */
22
+ function order(a, b) {
23
+ const parts = (version) => {
24
+ const [core = '', beta] = version.split('-beta.');
25
+ return [...core.split('.').map(Number), beta === undefined ? Number.POSITIVE_INFINITY : Number(beta)];
26
+ };
27
+ const x = parts(a);
28
+ const y = parts(b);
29
+ for (let i = 0; i < 4; i += 1) {
30
+ const diff = (x[i] ?? 0) - (y[i] ?? 0);
31
+ if (diff !== 0)
32
+ return diff;
33
+ }
34
+ return 0;
35
+ }
36
+ /**
37
+ * The target of `rarog update --beta` from the value of `npm view @rarog/server dist-tags --json`: `latest` must be a
38
+ * release, and the `beta` tag counts when it names a beta, because nobody moves it after a release and a release above
39
+ * it is the newer code. `null` = another shape or no release under `latest`.
40
+ */
41
+ export function channelTarget(tags) {
42
+ if (tags === null || typeof tags !== 'object' || Array.isArray(tags))
43
+ return null;
44
+ const { latest, beta } = tags;
45
+ if (!isStableVersion(latest))
46
+ return null;
47
+ if (!isBetaVersion(beta)) {
48
+ return { latest, beta: null, target: latest, note: beta === undefined ? 'npm has no beta tag'
49
+ : 'npm\'s beta tag is not a beta version' };
50
+ }
51
+ return { latest, beta, target: order(beta, latest) > 0 ? beta : latest, note: null };
52
+ }
53
+ /**
54
+ * A pattern of `min-release-age-exclude` as npm matches it against a package name (a name, or a glob in which `*` and
55
+ * `?` stay inside one path segment and `**` crosses them, also zero of them; a leading `!` or `#` is a plain
56
+ * character). A pattern with a character class or braces counts as a match: this module does not evaluate those, and
57
+ * a wrong "no" would print an admission date for a package npm does not hold back.
58
+ */
59
+ function globMatches(pattern, name) {
60
+ if (pattern === name)
61
+ return true;
62
+ if (/[[\]{}]/u.test(pattern))
63
+ return true;
64
+ let source = '';
65
+ for (let i = 0; i < pattern.length; i += 1) {
66
+ const char = pattern[i] ?? '';
67
+ if (char === '*' && pattern[i + 1] === '*') {
68
+ if (pattern[i + 2] === '/') {
69
+ source += '(?:.*/)?';
70
+ i += 2;
71
+ }
72
+ else {
73
+ source += '.*';
74
+ i += 1;
75
+ }
76
+ }
77
+ else if (char === '*') {
78
+ source += '[^/]*';
79
+ }
80
+ else if (char === '?') {
81
+ source += '[^/]';
82
+ }
83
+ else {
84
+ source += char.replace(/[\\^$.|+()[\]{}]/gu, '\\$&');
85
+ }
86
+ }
87
+ return new RegExp(`^${source}$`, 'u').test(name);
88
+ }
89
+ /**
90
+ * Whether `npm config get … min-release-age-exclude …` (`key=value` lines; npm prints the list joined with commas)
91
+ * names `name`: npm then installs it however young, so a release age gate stop is a dependency's.
92
+ */
93
+ export function gateExcludes(stdout, name) {
94
+ const line = stdout.split('\n').map((text) => text.trim())
95
+ .find((text) => text.startsWith('min-release-age-exclude='));
96
+ if (line === undefined)
97
+ return false;
98
+ return line.slice('min-release-age-exclude='.length).split(',').map((pattern) => pattern.trim())
99
+ .filter((pattern) => pattern !== '' && pattern !== 'null').some((pattern) => globMatches(pattern, name));
100
+ }