Skip to content

Commit e851df7

Browse files
committed
chore(ci): align local lint checks with CI
1 parent 48aaa90 commit e851df7

7 files changed

Lines changed: 38 additions & 22 deletions

File tree

.githooks/pre-commit

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if ! command -v bun >/dev/null 2>&1; then
5+
echo "bun is required to run pre-commit checks." >&2
6+
exit 1
7+
fi
8+
9+
echo "Running pre-commit checks..."
10+
bun run lint
11+
bun run check-types

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.3.14/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.4.6/schema.json",
33
"assist": {
44
"actions": {
55
"source": {

context-engine/basic-memory-context-engine.test.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ import {
77
MAX_ASSEMBLE_RECALL_CHARS,
88
} from "./basic-memory-context-engine.ts"
99

10-
function makeConfig(
11-
overrides?: Partial<BasicMemoryConfig>,
12-
): BasicMemoryConfig {
10+
function makeConfig(overrides?: Partial<BasicMemoryConfig>): BasicMemoryConfig {
1311
return {
1412
project: "test-project",
1513
bmPath: "bm",
@@ -26,7 +24,9 @@ function makeConfig(
2624
}
2725
}
2826

29-
function makeMessages(messages: Array<Record<string, unknown>>): AgentMessage[] {
27+
function makeMessages(
28+
messages: Array<Record<string, unknown>>,
29+
): AgentMessage[] {
3030
return messages as AgentMessage[]
3131
}
3232

@@ -61,21 +61,24 @@ describe("BasicMemoryContextEngine", () => {
6161
indexConversation: jest.fn().mockResolvedValue(undefined),
6262
writeNote: jest.fn().mockResolvedValue({
6363
title: "subagent-handoff-agent-test-subagent-child-1",
64-
permalink: "agent/subagents/subagent-handoff-agent-test-subagent-child-1",
64+
permalink:
65+
"agent/subagents/subagent-handoff-agent-test-subagent-child-1",
6566
file_path:
6667
"memory/agent/subagents/subagent-handoff-agent-test-subagent-child-1.md",
6768
content: "",
6869
}),
6970
editNote: jest.fn().mockResolvedValue({
7071
title: "subagent-handoff-agent-test-subagent-child-1",
71-
permalink: "agent/subagents/subagent-handoff-agent-test-subagent-child-1",
72+
permalink:
73+
"agent/subagents/subagent-handoff-agent-test-subagent-child-1",
7274
file_path:
7375
"memory/agent/subagents/subagent-handoff-agent-test-subagent-child-1.md",
7476
operation: "append",
7577
}),
7678
deleteNote: jest.fn().mockResolvedValue({
7779
title: "subagent-handoff-agent-test-subagent-child-1",
78-
permalink: "agent/subagents/subagent-handoff-agent-test-subagent-child-1",
80+
permalink:
81+
"agent/subagents/subagent-handoff-agent-test-subagent-child-1",
7982
file_path:
8083
"memory/agent/subagents/subagent-handoff-agent-test-subagent-child-1.md",
8184
}),
@@ -226,7 +229,9 @@ describe("BasicMemoryContextEngine", () => {
226229
expect(first.systemPromptAddition?.length).toBeLessThanOrEqual(
227230
MAX_ASSEMBLE_RECALL_CHARS,
228231
)
229-
expect(first.systemPromptAddition).toContain("[Basic Memory recall truncated]")
232+
expect(first.systemPromptAddition).toContain(
233+
"[Basic Memory recall truncated]",
234+
)
230235
expect(second.systemPromptAddition).toBe(first.systemPromptAddition)
231236
})
232237

@@ -297,7 +302,9 @@ describe("BasicMemoryContextEngine", () => {
297302
expect(mockClient.editNote).toHaveBeenCalledWith(
298303
"agent/subagents/subagent-handoff-agent-test-subagent-child-1",
299304
"append",
300-
expect.stringContaining("Durable conversation capture continues through the normal afterTurn path."),
305+
expect.stringContaining(
306+
"Durable conversation capture continues through the normal afterTurn path.",
307+
),
301308
)
302309
})
303310

context-engine/basic-memory-context-engine.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ export class BasicMemoryContextEngine implements ContextEngine {
144144

145145
private readonly sessionState = new Map<string, SessionMemoryState>()
146146
private readonly subagentState = new Map<string, SubagentHandoffState>()
147-
private legacyContextEnginePromise:
148-
| Promise<InstanceType<LegacyContextEngineModule["LegacyContextEngine"]>>
149-
| null = null
147+
private legacyContextEnginePromise: Promise<
148+
InstanceType<LegacyContextEngineModule["LegacyContextEngine"]>
149+
> | null = null
150150

151151
constructor(
152152
private readonly client: BmClient,

hooks/capture.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ export function selectCaptureTurn(
6666
): { userText: string; assistantText: string } | null {
6767
const turn = getLastTurn(messages)
6868
if (!turn.userText && !turn.assistantText) return null
69-
if (
70-
turn.userText.length < minChars &&
71-
turn.assistantText.length < minChars
72-
) {
69+
if (turn.userText.length < minChars && turn.assistantText.length < minChars) {
7370
return null
7471
}
7572

justfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,27 @@ install:
99
bun install
1010
bash scripts/setup-bm.sh
1111
bun scripts/fetch-skills.ts
12+
git config core.hooksPath .githooks
1213

1314
# Setup Basic Memory project
1415
setup:
1516
bm project add openclaw ~/.basic-memory/openclaw/
1617

1718
# Type check
1819
check-types:
19-
npx tsc --noEmit
20+
bun run check-types
2021

2122
# Lint
2223
lint:
23-
npx @biomejs/biome check .
24+
bun run lint
2425

2526
# Lint fix (safe + unsafe)
2627
lint-fix:
27-
npx @biomejs/biome check --write --unsafe .
28+
bun run lint:fix
2829

2930
# Format and fix
3031
fix:
31-
npx @biomejs/biome check --write --unsafe .
32+
bun run lint:fix
3233

3334
# Run tests
3435
test:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
]
7070
},
7171
"devDependencies": {
72-
"@biomejs/biome": "^2.3.8",
72+
"@biomejs/biome": "^2.4.6",
7373
"@types/node": "^20.0.0",
7474
"openclaw": "^2026.3.8",
7575
"typescript": "^5.9.3"

0 commit comments

Comments
 (0)