Skip to content

Commit 180b7b6

Browse files
committed
fix: Some issues where the make precommit check fails
Signed-off-by: plotor <zhenchao.wang@hotmail.com>
1 parent 121695d commit 180b7b6

File tree

13 files changed

+59
-44
lines changed

13 files changed

+59
-44
lines changed

.github/workflows/python-tests.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,17 @@ jobs:
8686
pip install dist/*.tar.gz
8787
pip uninstall -y memoryos
8888
89-
# Ruff checks
90-
- name: Install test group dependencies
89+
# Ruff and Pre-commit checks
90+
- name: Install test and dev group dependencies
9191
run: |
92-
poetry install --no-interaction --with test
92+
poetry install --no-interaction --with test --with dev
9393
- name: Ruff checks
9494
run: |
9595
poetry run ruff check
9696
poetry run ruff format --check
97+
- name: Pre-commit checks
98+
run: |
99+
poetry run pre-commit run -a
97100
98101
# PyTest checks
99102
- name: Install all extra dependencies

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ repos:
1212
- id: check-toml
1313
exclude: tests/fixtures/invalid_lock/poetry\.lock
1414
- id: check-yaml
15+
exclude: ^deploy/helm/templates/
1516
- id: pretty-format-json
1617
args: [--autofix, --no-ensure-ascii, --no-sort-keys]
1718
- id: check-ast

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ format:
3535
pre_commit:
3636
poetry run pre-commit run -a
3737

38+
# Alias for pre_commit
39+
precommit: pre_commit
40+
3841
serve:
3942
poetry run uvicorn memos.api.server_api:app
4043

apps/MemOS-Cloud-OpenClaw-Plugin/lib/check-update.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,30 +95,30 @@ function compareVersions(v1, v2) {
9595
const split2 = v2.split("-");
9696
const parts1 = split1[0].split(".").map(Number);
9797
const parts2 = split2[0].split(".").map(Number);
98-
98+
9999
// Compare major.minor.patch
100100
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
101101
const p1 = parts1[i] || 0;
102102
const p2 = parts2[i] || 0;
103103
if (p1 > p2) return 1;
104104
if (p1 < p2) return -1;
105105
}
106-
106+
107107
// If base versions are equal, compare pre-release tags.
108108
// A version WITH a pre-release tag is LOWER than a version WITHOUT one.
109109
// e.g. 0.1.8-beta is less than 0.1.8. 0.1.8 is the final release.
110110
const hasPre1 = split1.length > 1;
111111
const hasPre2 = split2.length > 1;
112-
112+
113113
if (hasPre1 && !hasPre2) return -1; // v1 is a beta, v2 is a full release
114114
if (!hasPre1 && hasPre2) return 1; // v1 is a full release, v2 is a beta
115115
if (!hasPre1 && !hasPre2) return 0; // both are full releases and equal
116-
116+
117117
// If both are pre-releases, do a basic string compare on the tag
118118
// "alpha" < "beta" < "rc"
119119
if (split1[1] > split2[1]) return 1;
120120
if (split1[1] < split2[1]) return -1;
121-
121+
122122
return 0;
123123
}
124124

@@ -202,7 +202,7 @@ export function startUpdateChecker(log) {
202202
child.stdout.on("data", (data) => {
203203
const outText = data.toString();
204204
log.info?.(`${ANSI.CYAN}[${cliName}-cli]${ANSI.RESET}\n${outText.trim()}`);
205-
205+
206206
// Auto-reply to any [y/N] prompts from the CLI
207207
if (outText.toLowerCase().includes("[y/n]")) {
208208
child.stdin.write("y\n");
@@ -212,7 +212,7 @@ export function startUpdateChecker(log) {
212212
child.stderr.on("data", (data) => {
213213
const errText = data.toString();
214214
log.warn?.(`${ANSI.RED}[${cliName}-cli]${ANSI.RESET}\n${errText.trim()}`);
215-
215+
216216
// Some CLIs output interactive prompts to stderr instead of stdout
217217
if (errText.toLowerCase().includes("[y/n]")) {
218218
child.stdin.write("y\n");

apps/MemOS-Cloud-OpenClaw-Plugin/scripts/sync-version.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ const filesToUpdate = [
2020

2121
filesToUpdate.forEach(fileName => {
2222
const filePath = path.resolve(__dirname, '..', fileName);
23-
23+
2424
if (fs.existsSync(filePath)) {
2525
try {
2626
const content = JSON.parse(fs.readFileSync(filePath, 'utf8'));
27-
27+
2828
if (content.version !== newVersion) {
2929
content.version = newVersion;
3030
// Write back with 2 spaces indentation and a newline at the end

apps/MemOS-Cloud-OpenClaw-Plugin/test/query-strip.test.mjs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,16 @@ test("supports leading blank lines before inbound metadata", () => {
162162
});
163163

164164
test("strips Feishu injected prompt", () => {
165-
const input = `System: [2026-03-17 14:17:33 GMT+8] Feishu[default] DM from ou_37e8a1514c24e8afd9cfeca86f679980: 我叫什么名字
166-
167-
Conversation info (untrusted metadata):
168-
\`\`\`json
169-
{
170-
"timestamp": "Tue 2026-03-17 14:17 GMT+8"
171-
}
172-
\`\`\`
173-
174-
[message_id: om_x100b54bb510590dcc2998da17ca2c2b]
165+
const input = `System: [2026-03-17 14:17:33 GMT+8] Feishu[default] DM from ou_37e8a1514c24e8afd9cfeca86f679980: 我叫什么名字
166+
167+
Conversation info (untrusted metadata):
168+
\`\`\`json
169+
{
170+
"timestamp": "Tue 2026-03-17 14:17 GMT+8"
171+
}
172+
\`\`\`
173+
174+
[message_id: om_x100b54bb510590dcc2998da17ca2c2b]
175175
ou_37e8a1514c24e8afd9cfeca86f679980: 我叫什么名字 `;
176176

177177
assert.equal(stripOpenClawInjectedPrefix(input), "我叫什么名字");
@@ -191,7 +191,7 @@ ou_real: actual message`;
191191

192192
test("strips Feishu prompt without system header", () => {
193193
const input = `
194-
[message_id: om_x100b54bb510590dcc2998da17ca2c2b]
194+
[message_id: om_x100b54bb510590dcc2998da17ca2c2b]
195195
ou_37e8a1514c24e8afd9cfeca86f679980: 我叫什么名字 `;
196196
assert.equal(stripOpenClawInjectedPrefix(input), "我叫什么名字");
197197
});

apps/memos-local-openclaw/openclaw.plugin.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,7 @@
3333
"If better-sqlite3 fails to build, ensure you have C++ build tools: xcode-select --install (macOS) or build-essential (Linux)"
3434
]
3535
},
36-
"extensions": ["./index.ts"]
36+
"extensions": [
37+
"./index.ts"
38+
]
3739
}

apps/memos-local-openclaw/skill/browserwing-executor/SKILL.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,4 +507,3 @@ All operations return:
507507
"detail": "Detailed error message"
508508
}
509509
```
510-

apps/memos-local-openclaw/src/sharing/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,3 @@ export interface SkillBundle {
9999
metadata: SkillBundleMetadata;
100100
bundle: SkillGenerateOutput;
101101
}
102-

apps/memos-local-openclaw/src/viewer/html.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,7 @@ input,textarea,select{font-family:inherit;font-size:inherit}
14111411
<h3><span class="icon">\u{1F4CA}</span> <span data-i18n="chart.writes">Memory Writes per Day</span></h3>
14121412
<div class="chart-bars" id="chartWrites"></div>
14131413
</div>
1414-
1414+
14151415
<div class="analytics-section" id="toolPerfSection" style="position:relative">
14161416
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:20px">
14171417
<h3 style="margin-bottom:0"><span class="icon">\u26A1</span> <span data-i18n="chart.toolperf">Tool Response Time</span> <span style="font-size:10px;color:var(--text-muted);font-weight:500;text-transform:none;letter-spacing:0;margin-left:4px">(per minute avg)</span></h3>
@@ -1443,7 +1443,7 @@ input,textarea,select{font-family:inherit;font-size:inherit}
14431443
<select id="logToolFilter" onchange="onLogFilterChange()" style="font-size:12px;padding:4px 8px;border-radius:6px;border:1px solid var(--border);background:var(--card);color:var(--text);min-width:120px">
14441444
<option value="" data-i18n="logs.allTools">All Tools</option>
14451445
</select>
1446-
1446+
14471447
</div>
14481448
<div class="logs-toolbar-right">
14491449
<input type="checkbox" id="logAutoRefresh" style="display:none">
@@ -6722,7 +6722,7 @@ async function loadConfig(){
67226722
const embProv=(cfg.embedding||{}).provider;
67236723
const sumProv=(cfg.summarizer||{}).provider;
67246724
const skProv=((cfg.skillEvolution||{}).summarizer||{}).provider;
6725-
6725+
67266726

67276727
document.getElementById('cfgSharingEnabled').checked=!!sharing.enabled;
67286728
_sharingRole=sharing.role||'client';
@@ -7347,7 +7347,7 @@ function renderToolChart(data){
73477347
return '<linearGradient id="tg'+i+'" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="'+c+'" stop-opacity=".08"/><stop offset="1" stop-color="'+c+'" stop-opacity="0"/></linearGradient>'+
73487348
'';
73497349
}).join('')+'</defs>'+
7350-
7350+
73517351
gridHtml+labelsHtml+pathsHtml+dotsHtml+
73527352
'<line class="crosshair" x1="0" y1="'+pad.t+'" x2="0" y2="'+(pad.t+ch)+'" stroke="var(--text-muted)" stroke-width="0.5" stroke-dasharray="3 3" opacity="0" />'+
73537353
'<rect class="hover-rect" x="'+pad.l+'" y="'+pad.t+'" width="'+cw+'" height="'+ch+'" fill="transparent" />'+

0 commit comments

Comments
 (0)