claude-use 7.13.0 → 7.13.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.
- package/dist/cli.cjs +49 -5
- package/dist/index.cjs +39 -3
- package/dist/index.mjs +39 -3
- package/dist/types/launcher/farm.d.ts +3 -0
- package/dist/types/resolve/pipeline.d.ts +3 -0
- package/dist/types/resolve/walkPolicy.d.ts +15 -0
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -59065,6 +59065,43 @@ function planFarm(params) {
|
|
|
59065
59065
|
return { entries, materialised, links };
|
|
59066
59066
|
}
|
|
59067
59067
|
|
|
59068
|
+
// src/resolve/walkPolicy.ts
|
|
59069
|
+
var ENTER_EVERYTHING = () => true;
|
|
59070
|
+
function readsSubtreeAggregates(rule) {
|
|
59071
|
+
const when = rule.when;
|
|
59072
|
+
return when !== void 0 && (when.newerThan !== void 0 || when.olderThan !== void 0 || when.maxSizeBytes !== void 0);
|
|
59073
|
+
}
|
|
59074
|
+
function hasUnboundedDepth(pattern) {
|
|
59075
|
+
return pattern.includes("**") || /[{(]/.test(pattern);
|
|
59076
|
+
}
|
|
59077
|
+
function couldMatchBeneath(rule, dirRel) {
|
|
59078
|
+
if (rule.matches(dirRel)) {
|
|
59079
|
+
return rule.when !== void 0;
|
|
59080
|
+
}
|
|
59081
|
+
if (rule.isExact) {
|
|
59082
|
+
return rule.canonicalPattern.startsWith(`${dirRel}/`);
|
|
59083
|
+
}
|
|
59084
|
+
const depth = dirRel.split("/").length;
|
|
59085
|
+
if (!hasUnboundedDepth(rule.canonicalPattern) && rule.segmentCount <= depth) {
|
|
59086
|
+
return false;
|
|
59087
|
+
}
|
|
59088
|
+
const prefix = rule.literalPrefix;
|
|
59089
|
+
return prefix === "" || prefix.startsWith(`${dirRel}/`) || dirRel.startsWith(prefix);
|
|
59090
|
+
}
|
|
59091
|
+
function descendPolicy(rules) {
|
|
59092
|
+
const all = [...rules];
|
|
59093
|
+
if (all.some(readsSubtreeAggregates)) {
|
|
59094
|
+
return ENTER_EVERYTHING;
|
|
59095
|
+
}
|
|
59096
|
+
return (dirRel) => all.some((rule) => couldMatchBeneath(rule, dirRel));
|
|
59097
|
+
}
|
|
59098
|
+
function enterRulesAnd(policy, target) {
|
|
59099
|
+
if (target === void 0 || target === "") {
|
|
59100
|
+
return policy;
|
|
59101
|
+
}
|
|
59102
|
+
return (dirRel) => dirRel === target || target.startsWith(`${dirRel}/`) || policy(dirRel);
|
|
59103
|
+
}
|
|
59104
|
+
|
|
59068
59105
|
// src/resolve/pipeline.ts
|
|
59069
59106
|
function topLevelNames(facts) {
|
|
59070
59107
|
const names = /* @__PURE__ */ new Set();
|
|
@@ -59076,6 +59113,9 @@ function topLevelNames(facts) {
|
|
|
59076
59113
|
}
|
|
59077
59114
|
return [...names].sort();
|
|
59078
59115
|
}
|
|
59116
|
+
function descendPolicyFor(cascade, home) {
|
|
59117
|
+
return descendPolicy(flattenLayers(assembleCascade(cascade).layers, { home }).rules.values());
|
|
59118
|
+
}
|
|
59079
59119
|
function resolveDecisions(input2) {
|
|
59080
59120
|
const assembled = assembleCascade(input2.cascade);
|
|
59081
59121
|
const flattened = flattenLayers(assembled.layers, { home: input2.facts.home });
|
|
@@ -59136,7 +59176,7 @@ function buildEntryFacts(params) {
|
|
|
59136
59176
|
const isDirectory = stat.kind === "dir";
|
|
59137
59177
|
let latestMtimeMs = stat.mtimeMs;
|
|
59138
59178
|
let totalSizeBytes = stat.sizeBytes;
|
|
59139
|
-
if (isDirectory) {
|
|
59179
|
+
if (isDirectory && params.descend(rel)) {
|
|
59140
59180
|
for (const name of [...params.fs.readdir(absolute)].sort()) {
|
|
59141
59181
|
const child = visit2(`${rel}/${name}`);
|
|
59142
59182
|
if (child !== void 0) {
|
|
@@ -59483,7 +59523,8 @@ function resyncFarm(params) {
|
|
|
59483
59523
|
nowMs,
|
|
59484
59524
|
env: params.env,
|
|
59485
59525
|
...params.branch === void 0 ? {} : { branch: params.branch },
|
|
59486
|
-
...params.branchDetached === void 0 ? {} : { branchDetached: params.branchDetached }
|
|
59526
|
+
...params.branchDetached === void 0 ? {} : { branchDetached: params.branchDetached },
|
|
59527
|
+
descend: descendPolicyFor(params.cascade, params.home)
|
|
59487
59528
|
});
|
|
59488
59529
|
const resolved = resolveDecisions({ facts, cascade: params.cascade, classification: params.classification });
|
|
59489
59530
|
const manifest = {
|
|
@@ -59865,7 +59906,9 @@ function buildConfigureContext(deps, params) {
|
|
|
59865
59906
|
nowMs: Date.now(),
|
|
59866
59907
|
env: process.env,
|
|
59867
59908
|
...git.branch === void 0 ? {} : { branch: git.branch },
|
|
59868
|
-
...git.branchDetached === void 0 ? {} : { branchDetached: git.branchDetached }
|
|
59909
|
+
...git.branchDetached === void 0 ? {} : { branchDetached: git.branchDetached },
|
|
59910
|
+
// The picker lists the direct children of the path it was asked about, so the walk also enters that path and the directories on the way to it.
|
|
59911
|
+
descend: enterRulesAnd(descendPolicyFor(cascade, params.home), params.path)
|
|
59869
59912
|
});
|
|
59870
59913
|
const resolved = resolveDecisions({ facts, cascade, classification });
|
|
59871
59914
|
const levels = buildWriteTargetLevels(params.cwd, params.home, globalConfig2?.walkUpLimit);
|
|
@@ -60989,7 +61032,7 @@ function registerIdentityCommand(program2, deps) {
|
|
|
60989
61032
|
// package.json
|
|
60990
61033
|
var package_default = {
|
|
60991
61034
|
name: "claude-use",
|
|
60992
|
-
version: "7.13.
|
|
61035
|
+
version: "7.13.1",
|
|
60993
61036
|
description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
60994
61037
|
license: "MIT",
|
|
60995
61038
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -63017,7 +63060,8 @@ function runCheck(params) {
|
|
|
63017
63060
|
nowMs: params.nowMs,
|
|
63018
63061
|
env: params.env,
|
|
63019
63062
|
...params.branch === void 0 ? {} : { branch: params.branch },
|
|
63020
|
-
...params.branchDetached === void 0 ? {} : { branchDetached: params.branchDetached }
|
|
63063
|
+
...params.branchDetached === void 0 ? {} : { branchDetached: params.branchDetached },
|
|
63064
|
+
descend: descendPolicyFor(params.cascade, params.home)
|
|
63021
63065
|
});
|
|
63022
63066
|
const resolved = resolveDecisions({ facts, cascade: params.cascade, classification: params.classification });
|
|
63023
63067
|
const decisionLines = [...resolved.decisions.values()].slice().sort((a2, b) => a2.relPath < b.relPath ? -1 : a2.relPath > b.relPath ? 1 : 0).map(formatDecision);
|
package/dist/index.cjs
CHANGED
|
@@ -1389,6 +1389,37 @@ function planFarm(params) {
|
|
|
1389
1389
|
return { entries, materialised, links };
|
|
1390
1390
|
}
|
|
1391
1391
|
|
|
1392
|
+
// src/resolve/walkPolicy.ts
|
|
1393
|
+
var ENTER_EVERYTHING = () => true;
|
|
1394
|
+
function readsSubtreeAggregates(rule) {
|
|
1395
|
+
const when = rule.when;
|
|
1396
|
+
return when !== void 0 && (when.newerThan !== void 0 || when.olderThan !== void 0 || when.maxSizeBytes !== void 0);
|
|
1397
|
+
}
|
|
1398
|
+
function hasUnboundedDepth(pattern) {
|
|
1399
|
+
return pattern.includes("**") || /[{(]/.test(pattern);
|
|
1400
|
+
}
|
|
1401
|
+
function couldMatchBeneath(rule, dirRel) {
|
|
1402
|
+
if (rule.matches(dirRel)) {
|
|
1403
|
+
return rule.when !== void 0;
|
|
1404
|
+
}
|
|
1405
|
+
if (rule.isExact) {
|
|
1406
|
+
return rule.canonicalPattern.startsWith(`${dirRel}/`);
|
|
1407
|
+
}
|
|
1408
|
+
const depth = dirRel.split("/").length;
|
|
1409
|
+
if (!hasUnboundedDepth(rule.canonicalPattern) && rule.segmentCount <= depth) {
|
|
1410
|
+
return false;
|
|
1411
|
+
}
|
|
1412
|
+
const prefix = rule.literalPrefix;
|
|
1413
|
+
return prefix === "" || prefix.startsWith(`${dirRel}/`) || dirRel.startsWith(prefix);
|
|
1414
|
+
}
|
|
1415
|
+
function descendPolicy(rules) {
|
|
1416
|
+
const all = [...rules];
|
|
1417
|
+
if (all.some(readsSubtreeAggregates)) {
|
|
1418
|
+
return ENTER_EVERYTHING;
|
|
1419
|
+
}
|
|
1420
|
+
return (dirRel) => all.some((rule) => couldMatchBeneath(rule, dirRel));
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1392
1423
|
// src/resolve/walk.ts
|
|
1393
1424
|
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
1394
1425
|
|
|
@@ -1567,6 +1598,9 @@ function topLevelNames(facts) {
|
|
|
1567
1598
|
}
|
|
1568
1599
|
return [...names].sort();
|
|
1569
1600
|
}
|
|
1601
|
+
function descendPolicyFor(cascade, home) {
|
|
1602
|
+
return descendPolicy(flattenLayers(assembleCascade(cascade).layers, { home }).rules.values());
|
|
1603
|
+
}
|
|
1570
1604
|
function resolveDecisions(input) {
|
|
1571
1605
|
const assembled = assembleCascade(input.cascade);
|
|
1572
1606
|
const flattened = flattenLayers(assembled.layers, { home: input.facts.home });
|
|
@@ -1817,7 +1851,7 @@ function buildEntryFacts(params) {
|
|
|
1817
1851
|
const isDirectory = stat.kind === "dir";
|
|
1818
1852
|
let latestMtimeMs = stat.mtimeMs;
|
|
1819
1853
|
let totalSizeBytes = stat.sizeBytes;
|
|
1820
|
-
if (isDirectory) {
|
|
1854
|
+
if (isDirectory && params.descend(rel)) {
|
|
1821
1855
|
for (const name of [...params.fs.readdir(absolute)].sort()) {
|
|
1822
1856
|
const child = visit(`${rel}/${name}`);
|
|
1823
1857
|
if (child !== void 0) {
|
|
@@ -2164,7 +2198,8 @@ function resyncFarm(params) {
|
|
|
2164
2198
|
nowMs,
|
|
2165
2199
|
env: params.env,
|
|
2166
2200
|
...params.branch === void 0 ? {} : { branch: params.branch },
|
|
2167
|
-
...params.branchDetached === void 0 ? {} : { branchDetached: params.branchDetached }
|
|
2201
|
+
...params.branchDetached === void 0 ? {} : { branchDetached: params.branchDetached },
|
|
2202
|
+
descend: descendPolicyFor(params.cascade, params.home)
|
|
2168
2203
|
});
|
|
2169
2204
|
const resolved = resolveDecisions({ facts, cascade: params.cascade, classification: params.classification });
|
|
2170
2205
|
const manifest = {
|
|
@@ -6435,7 +6470,8 @@ function runCheck(params) {
|
|
|
6435
6470
|
nowMs: params.nowMs,
|
|
6436
6471
|
env: params.env,
|
|
6437
6472
|
...params.branch === void 0 ? {} : { branch: params.branch },
|
|
6438
|
-
...params.branchDetached === void 0 ? {} : { branchDetached: params.branchDetached }
|
|
6473
|
+
...params.branchDetached === void 0 ? {} : { branchDetached: params.branchDetached },
|
|
6474
|
+
descend: descendPolicyFor(params.cascade, params.home)
|
|
6439
6475
|
});
|
|
6440
6476
|
const resolved = resolveDecisions({ facts, cascade: params.cascade, classification: params.classification });
|
|
6441
6477
|
const decisionLines = [...resolved.decisions.values()].slice().sort((a, b) => a.relPath < b.relPath ? -1 : a.relPath > b.relPath ? 1 : 0).map(formatDecision);
|
package/dist/index.mjs
CHANGED
|
@@ -1223,6 +1223,37 @@ function planFarm(params) {
|
|
|
1223
1223
|
return { entries, materialised, links };
|
|
1224
1224
|
}
|
|
1225
1225
|
|
|
1226
|
+
// src/resolve/walkPolicy.ts
|
|
1227
|
+
var ENTER_EVERYTHING = () => true;
|
|
1228
|
+
function readsSubtreeAggregates(rule) {
|
|
1229
|
+
const when = rule.when;
|
|
1230
|
+
return when !== void 0 && (when.newerThan !== void 0 || when.olderThan !== void 0 || when.maxSizeBytes !== void 0);
|
|
1231
|
+
}
|
|
1232
|
+
function hasUnboundedDepth(pattern) {
|
|
1233
|
+
return pattern.includes("**") || /[{(]/.test(pattern);
|
|
1234
|
+
}
|
|
1235
|
+
function couldMatchBeneath(rule, dirRel) {
|
|
1236
|
+
if (rule.matches(dirRel)) {
|
|
1237
|
+
return rule.when !== void 0;
|
|
1238
|
+
}
|
|
1239
|
+
if (rule.isExact) {
|
|
1240
|
+
return rule.canonicalPattern.startsWith(`${dirRel}/`);
|
|
1241
|
+
}
|
|
1242
|
+
const depth = dirRel.split("/").length;
|
|
1243
|
+
if (!hasUnboundedDepth(rule.canonicalPattern) && rule.segmentCount <= depth) {
|
|
1244
|
+
return false;
|
|
1245
|
+
}
|
|
1246
|
+
const prefix = rule.literalPrefix;
|
|
1247
|
+
return prefix === "" || prefix.startsWith(`${dirRel}/`) || dirRel.startsWith(prefix);
|
|
1248
|
+
}
|
|
1249
|
+
function descendPolicy(rules) {
|
|
1250
|
+
const all = [...rules];
|
|
1251
|
+
if (all.some(readsSubtreeAggregates)) {
|
|
1252
|
+
return ENTER_EVERYTHING;
|
|
1253
|
+
}
|
|
1254
|
+
return (dirRel) => all.some((rule) => couldMatchBeneath(rule, dirRel));
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1226
1257
|
// src/resolve/walk.ts
|
|
1227
1258
|
import path4 from "node:path";
|
|
1228
1259
|
|
|
@@ -1401,6 +1432,9 @@ function topLevelNames(facts) {
|
|
|
1401
1432
|
}
|
|
1402
1433
|
return [...names].sort();
|
|
1403
1434
|
}
|
|
1435
|
+
function descendPolicyFor(cascade, home) {
|
|
1436
|
+
return descendPolicy(flattenLayers(assembleCascade(cascade).layers, { home }).rules.values());
|
|
1437
|
+
}
|
|
1404
1438
|
function resolveDecisions(input) {
|
|
1405
1439
|
const assembled = assembleCascade(input.cascade);
|
|
1406
1440
|
const flattened = flattenLayers(assembled.layers, { home: input.facts.home });
|
|
@@ -1651,7 +1685,7 @@ function buildEntryFacts(params) {
|
|
|
1651
1685
|
const isDirectory = stat.kind === "dir";
|
|
1652
1686
|
let latestMtimeMs = stat.mtimeMs;
|
|
1653
1687
|
let totalSizeBytes = stat.sizeBytes;
|
|
1654
|
-
if (isDirectory) {
|
|
1688
|
+
if (isDirectory && params.descend(rel)) {
|
|
1655
1689
|
for (const name of [...params.fs.readdir(absolute)].sort()) {
|
|
1656
1690
|
const child = visit(`${rel}/${name}`);
|
|
1657
1691
|
if (child !== void 0) {
|
|
@@ -1998,7 +2032,8 @@ function resyncFarm(params) {
|
|
|
1998
2032
|
nowMs,
|
|
1999
2033
|
env: params.env,
|
|
2000
2034
|
...params.branch === void 0 ? {} : { branch: params.branch },
|
|
2001
|
-
...params.branchDetached === void 0 ? {} : { branchDetached: params.branchDetached }
|
|
2035
|
+
...params.branchDetached === void 0 ? {} : { branchDetached: params.branchDetached },
|
|
2036
|
+
descend: descendPolicyFor(params.cascade, params.home)
|
|
2002
2037
|
});
|
|
2003
2038
|
const resolved = resolveDecisions({ facts, cascade: params.cascade, classification: params.classification });
|
|
2004
2039
|
const manifest = {
|
|
@@ -6269,7 +6304,8 @@ function runCheck(params) {
|
|
|
6269
6304
|
nowMs: params.nowMs,
|
|
6270
6305
|
env: params.env,
|
|
6271
6306
|
...params.branch === void 0 ? {} : { branch: params.branch },
|
|
6272
|
-
...params.branchDetached === void 0 ? {} : { branchDetached: params.branchDetached }
|
|
6307
|
+
...params.branchDetached === void 0 ? {} : { branchDetached: params.branchDetached },
|
|
6308
|
+
descend: descendPolicyFor(params.cascade, params.home)
|
|
6273
6309
|
});
|
|
6274
6310
|
const resolved = resolveDecisions({ facts, cascade: params.cascade, classification: params.classification });
|
|
6275
6311
|
const decisionLines = [...resolved.decisions.values()].slice().sort((a, b) => a.relPath < b.relPath ? -1 : a.relPath > b.relPath ? 1 : 0).map(formatDecision);
|
|
@@ -3,6 +3,7 @@ import { type FarmManifest } from "../resolve/reconcile";
|
|
|
3
3
|
import { type ResolvedState } from "../resolve/pipeline";
|
|
4
4
|
import type { CascadeInput } from "../resolve/walk";
|
|
5
5
|
import type { Diagnostic, EntryFacts } from "../resolve/types";
|
|
6
|
+
import type { DescendPolicy } from "../resolve/walkPolicy";
|
|
6
7
|
import type { FarmFs } from "./ports";
|
|
7
8
|
/** The manifest file each farm carries at its own root, recording what that resync built. Named distinctly from anything Claude Code itself writes into a config directory. A farm built under the former name carries `LEGACY_FARM_MANIFEST_FILENAME` instead, which is read as a fallback and never carried into the next farm, whose resync writes this name. */
|
|
8
9
|
export declare const FARM_MANIFEST_FILENAME = ".agent-shim-farm.json";
|
|
@@ -18,6 +19,8 @@ export interface BuildEntryFactsParams {
|
|
|
18
19
|
readonly env: Readonly<Record<string, string | undefined>>;
|
|
19
20
|
readonly branch?: string;
|
|
20
21
|
readonly branchDetached?: boolean;
|
|
22
|
+
/** Which directories the walk enters; see `descendPolicy`. A directory not entered is recorded as one entry with its own size and mtime only, so a caller that needs subtree aggregates passes a policy that enters everything. */
|
|
23
|
+
readonly descend: DescendPolicy;
|
|
21
24
|
}
|
|
22
25
|
/**
|
|
23
26
|
* Walks the canonical `~/.claude` and builds the `EntryFacts` manifest the pure resolver consumes.
|
|
@@ -2,6 +2,7 @@ import { type ClassifyResult } from "../config/classify";
|
|
|
2
2
|
import type { CategoryClassification, CategoryClassificationOverlay } from "../config/schema";
|
|
3
3
|
import { type ResolveAllResult } from "./decide";
|
|
4
4
|
import { type FarmPlan } from "./plan";
|
|
5
|
+
import { type DescendPolicy } from "./walkPolicy";
|
|
5
6
|
import { type AssembledCascade, type CascadeInput } from "./walk";
|
|
6
7
|
import type { Diagnostic, EntryFacts, FlattenedCascade } from "./types";
|
|
7
8
|
/** Everything one launch needs resolved, in one call. */
|
|
@@ -24,6 +25,8 @@ export interface ResolvedState {
|
|
|
24
25
|
}
|
|
25
26
|
/** The top-level `~/.claude` entry names present in a fact manifest, in sorted order. */
|
|
26
27
|
export declare function topLevelNames(facts: EntryFacts): string[];
|
|
28
|
+
/** The walk policy `buildEntryFacts` needs for `cascade`: which directories of `~/.claude` the fact walk must enter, derived from the flattened rules (see `descendPolicy`). */
|
|
29
|
+
export declare function descendPolicyFor(cascade: CascadeInput, home: string): DescendPolicy;
|
|
27
30
|
/**
|
|
28
31
|
* Runs the whole pipeline for one launch: assemble the ordered layer sequence, flatten it, classify the real `~/.claude` entries, decide every path, and plan the resulting farm.
|
|
29
32
|
*/
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CompiledRule } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Whether the walk that builds entry facts must enter the directory at `dirRel` (relative to `~/.claude`). A directory it does not enter is one entry: nothing recorded below it, because nothing below it can be decided differently from the directory itself.
|
|
4
|
+
*/
|
|
5
|
+
export type DescendPolicy = (dirRel: string) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* The walk policy for a flattened cascade. A directory is entered only when some rule can decide a path inside it differently from the directory itself, so a configuration with no rule below a top-level entry reads that entry with one `lstat`; with a rule that reads subtree aggregates anywhere, every directory is entered.
|
|
8
|
+
*
|
|
9
|
+
* Why this is safe: a rule matching a directory also matches everything beneath it (see `compileMatcher`), and the category toggles decide by top-level entry, so a subtree no rule reaches into resolves to one uniform decision, which the farm plan collapses to a single link either way.
|
|
10
|
+
*/
|
|
11
|
+
export declare function descendPolicy(rules: Readonly<Iterable<CompiledRule>>): DescendPolicy;
|
|
12
|
+
/**
|
|
13
|
+
* `policy`, widened to also enter `target` and every directory on the way to it, for a caller that needs the direct children of that path recorded (the interactive picker). With no `target` it is `policy` itself.
|
|
14
|
+
*/
|
|
15
|
+
export declare function enterRulesAnd(policy: DescendPolicy, target: string | undefined): DescendPolicy;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-use",
|
|
3
|
-
"version": "7.13.
|
|
3
|
+
"version": "7.13.1",
|
|
4
4
|
"description": "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Joseph Mearman <joseph@mearman.co.uk>",
|