diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 1a1338408..0b1516029 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -86,14 +86,17 @@ jobs: pip install dist/*.tar.gz pip uninstall -y memoryos - # Ruff checks - - name: Install test group dependencies + # Ruff and Pre-commit checks + - name: Install test and dev group dependencies run: | - poetry install --no-interaction --with test + poetry install --no-interaction --with test --with dev - name: Ruff checks run: | poetry run ruff check poetry run ruff format --check + - name: Pre-commit checks + run: | + poetry run pre-commit run -a # PyTest checks - name: Install all extra dependencies diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d415eaa18..2056be8df 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,6 +12,7 @@ repos: - id: check-toml exclude: tests/fixtures/invalid_lock/poetry\.lock - id: check-yaml + exclude: ^deploy/helm/templates/ - id: pretty-format-json args: [--autofix, --no-ensure-ascii, --no-sort-keys] - id: check-ast diff --git a/Makefile b/Makefile index eb22e241d..79474817e 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,9 @@ format: pre_commit: poetry run pre-commit run -a +# Alias for pre_commit +precommit: pre_commit + serve: poetry run uvicorn memos.api.server_api:app diff --git a/apps/MemOS-Cloud-OpenClaw-Plugin/lib/check-update.js b/apps/MemOS-Cloud-OpenClaw-Plugin/lib/check-update.js index 906fdf314..56380c9ab 100644 --- a/apps/MemOS-Cloud-OpenClaw-Plugin/lib/check-update.js +++ b/apps/MemOS-Cloud-OpenClaw-Plugin/lib/check-update.js @@ -74,7 +74,7 @@ function compareVersions(v1, v2) { const split2 = v2.split("-"); const parts1 = split1[0].split(".").map(Number); const parts2 = split2[0].split(".").map(Number); - + // Compare major.minor.patch for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) { const p1 = parts1[i] || 0; @@ -82,22 +82,22 @@ function compareVersions(v1, v2) { if (p1 > p2) return 1; if (p1 < p2) return -1; } - + // If base versions are equal, compare pre-release tags. // A version WITH a pre-release tag is LOWER than a version WITHOUT one. // e.g. 0.1.8-beta is less than 0.1.8. 0.1.8 is the final release. const hasPre1 = split1.length > 1; const hasPre2 = split2.length > 1; - + if (hasPre1 && !hasPre2) return -1; // v1 is a beta, v2 is a full release if (!hasPre1 && hasPre2) return 1; // v1 is a full release, v2 is a beta if (!hasPre1 && !hasPre2) return 0; // both are full releases and equal - + // If both are pre-releases, do a basic string compare on the tag // "alpha" < "beta" < "rc" if (split1[1] > split2[1]) return 1; if (split1[1] < split2[1]) return -1; - + return 0; } diff --git a/apps/MemOS-Cloud-OpenClaw-Plugin/lib/config-ui/app.js b/apps/MemOS-Cloud-OpenClaw-Plugin/lib/config-ui/app.js index 576bc6431..254269d66 100644 --- a/apps/MemOS-Cloud-OpenClaw-Plugin/lib/config-ui/app.js +++ b/apps/MemOS-Cloud-OpenClaw-Plugin/lib/config-ui/app.js @@ -50,7 +50,7 @@ const elements = { pathBox: document.getElementById("pathBox"), copyPathButton: document.getElementById("copyPathButton"), saveButton: document.getElementById("saveButton"), - + reloadButton: document.getElementById("reloadButton"), layout: document.getElementById("layout"), overlay: document.getElementById("overlay"), @@ -340,7 +340,7 @@ function applyLanguageUi() { elements.copyPathButton.setAttribute("aria-label", uiText("copyPath")); elements.copyPathButton.setAttribute("title", uiText("copyPath")); elements.saveButton.textContent = uiText("save"); - + elements.reloadButton.textContent = uiText("reload"); elements.overlayTitle.textContent = uiText("overlayTitle"); elements.overlayText.textContent = uiText("overlayText"); @@ -1037,7 +1037,7 @@ function renderForm() { installSectionObserver(groups); elements.saveButton.disabled = hasErrors || !isDirty(); - + elements.reloadButton.disabled = !remoteState; refreshChrome(); } @@ -1045,7 +1045,7 @@ function renderForm() { function refreshChrome() { const { errors } = collectDraft(); elements.saveButton.disabled = Object.keys(errors).length > 0 || !isDirty(); - + elements.reloadButton.disabled = !remoteState; if (externalRefreshQueued) { setBanner("warn", uiText("bannerExternal")); @@ -1184,7 +1184,7 @@ async function loadRemote(initial = false) { } externalRefreshQueued = true; refreshChrome(); - + } refreshChrome(); @@ -1218,9 +1218,9 @@ async function saveConfig() { remoteState = result.state; draft = createDraftFromRemote(result.state); baselineSnapshot = getDraftSnapshot(); - - - + + + externalRefreshQueued = false; renderForm(); setOverlay(false, "", ""); diff --git a/apps/MemOS-Cloud-OpenClaw-Plugin/lib/config-ui/icon.svg b/apps/MemOS-Cloud-OpenClaw-Plugin/lib/config-ui/icon.svg index 4ff76399f..25d985e4e 100644 --- a/apps/MemOS-Cloud-OpenClaw-Plugin/lib/config-ui/icon.svg +++ b/apps/MemOS-Cloud-OpenClaw-Plugin/lib/config-ui/icon.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/apps/MemOS-Cloud-OpenClaw-Plugin/scripts/sync-version.js b/apps/MemOS-Cloud-OpenClaw-Plugin/scripts/sync-version.js index f98150d89..9adb2dc3b 100644 --- a/apps/MemOS-Cloud-OpenClaw-Plugin/scripts/sync-version.js +++ b/apps/MemOS-Cloud-OpenClaw-Plugin/scripts/sync-version.js @@ -20,11 +20,11 @@ const filesToUpdate = [ filesToUpdate.forEach(fileName => { const filePath = path.resolve(__dirname, '..', fileName); - + if (fs.existsSync(filePath)) { try { const content = JSON.parse(fs.readFileSync(filePath, 'utf8')); - + if (content.version !== newVersion) { content.version = newVersion; // Write back with 2 spaces indentation and a newline at the end diff --git a/apps/MemOS-Cloud-OpenClaw-Plugin/test/query-strip.test.mjs b/apps/MemOS-Cloud-OpenClaw-Plugin/test/query-strip.test.mjs index 8e5b97544..5926135cf 100644 --- a/apps/MemOS-Cloud-OpenClaw-Plugin/test/query-strip.test.mjs +++ b/apps/MemOS-Cloud-OpenClaw-Plugin/test/query-strip.test.mjs @@ -162,16 +162,16 @@ test("supports leading blank lines before inbound metadata", () => { }); test("strips Feishu injected prompt", () => { - const input = `System: [2026-03-17 14:17:33 GMT+8] Feishu[default] DM from ou_37e8a1514c24e8afd9cfeca86f679980: 我叫什么名字 - - Conversation info (untrusted metadata): - \`\`\`json - { - "timestamp": "Tue 2026-03-17 14:17 GMT+8" - } - \`\`\` - - [message_id: om_x100b54bb510590dcc2998da17ca2c2b] + const input = `System: [2026-03-17 14:17:33 GMT+8] Feishu[default] DM from ou_37e8a1514c24e8afd9cfeca86f679980: 我叫什么名字 + + Conversation info (untrusted metadata): + \`\`\`json + { + "timestamp": "Tue 2026-03-17 14:17 GMT+8" + } + \`\`\` + + [message_id: om_x100b54bb510590dcc2998da17ca2c2b] ou_37e8a1514c24e8afd9cfeca86f679980: 我叫什么名字 `; assert.equal(stripOpenClawInjectedPrefix(input), "我叫什么名字"); @@ -191,7 +191,7 @@ ou_real: actual message`; test("strips Feishu prompt without system header", () => { const input = ` -[message_id: om_x100b54bb510590dcc2998da17ca2c2b] +[message_id: om_x100b54bb510590dcc2998da17ca2c2b] ou_37e8a1514c24e8afd9cfeca86f679980: 我叫什么名字 `; assert.equal(stripOpenClawInjectedPrefix(input), "我叫什么名字"); }); diff --git a/apps/memos-local-openclaw/openclaw.plugin.json b/apps/memos-local-openclaw/openclaw.plugin.json index dfef6740f..4a7f2d0ba 100644 --- a/apps/memos-local-openclaw/openclaw.plugin.json +++ b/apps/memos-local-openclaw/openclaw.plugin.json @@ -33,5 +33,7 @@ "If better-sqlite3 fails to build, ensure you have C++ build tools: xcode-select --install (macOS) or build-essential (Linux)" ] }, - "extensions": ["./index.ts"] + "extensions": [ + "./index.ts" + ] } diff --git a/apps/memos-local-openclaw/skill/browserwing-executor/SKILL.md b/apps/memos-local-openclaw/skill/browserwing-executor/SKILL.md index 8aeafbd5a..53a5ec3c8 100644 --- a/apps/memos-local-openclaw/skill/browserwing-executor/SKILL.md +++ b/apps/memos-local-openclaw/skill/browserwing-executor/SKILL.md @@ -507,4 +507,3 @@ All operations return: "detail": "Detailed error message" } ``` - diff --git a/apps/memos-local-openclaw/src/sharing/types.ts b/apps/memos-local-openclaw/src/sharing/types.ts index aa97a5de1..92c4d2ec7 100644 --- a/apps/memos-local-openclaw/src/sharing/types.ts +++ b/apps/memos-local-openclaw/src/sharing/types.ts @@ -99,4 +99,3 @@ export interface SkillBundle { metadata: SkillBundleMetadata; bundle: SkillGenerateOutput; } - diff --git a/apps/memos-local-openclaw/src/viewer/html.ts b/apps/memos-local-openclaw/src/viewer/html.ts index 14aecc6fc..a976e42e8 100644 --- a/apps/memos-local-openclaw/src/viewer/html.ts +++ b/apps/memos-local-openclaw/src/viewer/html.ts @@ -1411,7 +1411,7 @@ input,textarea,select{font-family:inherit;font-size:inherit}