@forwardimpact/libutil 0.1.90 → 0.1.92
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/package.json +2 -1
- package/src/git-client.js +25 -6
- package/src/models.js +46 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forwardimpact/libutil",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.92",
|
|
4
4
|
"description": "Cross-cutting utilities: retry, hashing, token counting, and project discovery.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"util",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"main": "./src/index.js",
|
|
22
22
|
"exports": {
|
|
23
23
|
".": "./src/index.js",
|
|
24
|
+
"./models": "./src/models.js",
|
|
24
25
|
"./runtime": "./src/runtime.js",
|
|
25
26
|
"./trusted-origins": "./src/trusted-origins.js",
|
|
26
27
|
"./completion-ticket": "./src/completion-ticket.js",
|
package/src/git-client.js
CHANGED
|
@@ -56,14 +56,17 @@ export class GitClient {
|
|
|
56
56
|
return this.#runRaw(args, { cwd });
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
/** Return `git status --porcelain` output
|
|
60
|
-
async status({ cwd }) {
|
|
61
|
-
|
|
59
|
+
/** Return `git status --porcelain` output, optionally limited to `paths`. */
|
|
60
|
+
async status({ cwd, paths } = {}) {
|
|
61
|
+
const args = ["status", "--porcelain"];
|
|
62
|
+
if (paths?.length) args.push("--", ...paths);
|
|
63
|
+
return this.#runRaw(args, { cwd });
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
/** Rebase the current branch onto `upstream`, optionally with a merge strategy. */
|
|
65
|
-
async rebase(upstream, { cwd, strategy } = {}) {
|
|
67
|
+
async rebase(upstream, { cwd, strategy, autostash = false } = {}) {
|
|
66
68
|
const args = ["rebase"];
|
|
69
|
+
if (autostash) args.push("--autostash");
|
|
67
70
|
if (strategy) args.push("-X", strategy);
|
|
68
71
|
args.push(upstream);
|
|
69
72
|
return this.#runRaw(args, { cwd, allowFailure: true });
|
|
@@ -75,8 +78,11 @@ export class GitClient {
|
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
/** Merge `ref` into the current branch resolving conflicts with `-X ours`. */
|
|
78
|
-
async mergeOursStrategy({ cwd, ref }) {
|
|
79
|
-
|
|
81
|
+
async mergeOursStrategy({ cwd, ref, autostash = false }) {
|
|
82
|
+
const args = ["merge"];
|
|
83
|
+
if (autostash) args.push("--autostash");
|
|
84
|
+
args.push("-X", "ours", "--no-edit", ref);
|
|
85
|
+
return this.#runRaw(args, { cwd });
|
|
80
86
|
}
|
|
81
87
|
|
|
82
88
|
/** Stage all changes and commit with `message`. */
|
|
@@ -87,6 +93,19 @@ export class GitClient {
|
|
|
87
93
|
return this.#runRaw(args, { cwd });
|
|
88
94
|
}
|
|
89
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Stage and commit only `paths`, leaving the rest of the working tree
|
|
98
|
+
* untouched. The commit carries the same pathspec so content staged by
|
|
99
|
+
* other writers is never swept in.
|
|
100
|
+
*/
|
|
101
|
+
async commitPaths(message, paths, { cwd, author } = {}) {
|
|
102
|
+
await this.#runRaw(["add", "--", ...paths], { cwd });
|
|
103
|
+
const args = ["commit", "-m", message];
|
|
104
|
+
if (author) args.push("--author", author);
|
|
105
|
+
args.push("--", ...paths);
|
|
106
|
+
return this.#runRaw(args, { cwd });
|
|
107
|
+
}
|
|
108
|
+
|
|
90
109
|
/** Push `branch` to `remote`. */
|
|
91
110
|
async push(remote = "origin", branch, { cwd, force = false } = {}) {
|
|
92
111
|
const args = ["push", remote];
|
package/src/models.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical Claude model identifiers, named by role. One home for every
|
|
3
|
+
* model default in the monorepo — a model upgrade edits the values here
|
|
4
|
+
* (plus any docs flagged by `scripts/check-model-defaults.mjs`) and
|
|
5
|
+
* nothing else.
|
|
6
|
+
*
|
|
7
|
+
* Markdown docs cannot import these constants, so the invariant script
|
|
8
|
+
* cross-checks every model ID mentioned in docs and skills against the
|
|
9
|
+
* values exported below.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Long-horizon agents under direct evaluation (eval sessions) — most
|
|
14
|
+
* capable model with the 1M-context suffix.
|
|
15
|
+
*/
|
|
16
|
+
export const AGENT_MODEL = "claude-fable-5[1m]";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Lead roles — supervisor, facilitator, discussion lead, benchmark
|
|
20
|
+
* lead, and judge. Leads orchestrate whole multi-agent sessions, so
|
|
21
|
+
* they get the most capable model with the 1M-context suffix. The
|
|
22
|
+
* suffix is an Agent SDK identifier; use CHAT_MODEL or FAST_MODEL for
|
|
23
|
+
* direct Messages API calls.
|
|
24
|
+
*/
|
|
25
|
+
export const LEAD_MODEL = "claude-fable-5[1m]";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Benchmark agent-under-test — a pinned reference model so pass@k
|
|
29
|
+
* results stay comparable across runs. Deliberately separate from
|
|
30
|
+
* AGENT_MODEL: upgrading the agent tier must not silently move the
|
|
31
|
+
* benchmark baseline.
|
|
32
|
+
*/
|
|
33
|
+
export const BENCHMARK_AGENT_MODEL = "claude-sonnet-4-6";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Interactive chat (fit-guide) and direct Messages API calls — best
|
|
37
|
+
* speed/intelligence balance, valid both as an Agent SDK and a raw
|
|
38
|
+
* API model ID.
|
|
39
|
+
*/
|
|
40
|
+
export const CHAT_MODEL = "claude-sonnet-4-6";
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Cheap mechanical tasks (wiki prose fixes, synthetic-data generation)
|
|
44
|
+
* — fastest and most cost-effective model.
|
|
45
|
+
*/
|
|
46
|
+
export const FAST_MODEL = "claude-haiku-4-5";
|