ReMe/github-pages/scripts/generate-content.mjs
jinliyl fd2894f939
Some checks failed
NPM Format / Website checks (push) Has been cancelled
GitHub Pages Check / test-and-build (push) Has been cancelled
Package Check / distributions (push) Has been cancelled
Deploy ReMe documentation / build (push) Has been cancelled
Windows Smoke / CLI smoke - py3.11 (push) Has been cancelled
Pre-commit / run (ubuntu-latest) (push) Has been cancelled
Tests ReMe / Unit Tests - py3.11 (push) Has been cancelled
Tests ReMe / Unit Tests - py3.12 (push) Has been cancelled
Tests ReMe / Unit Tests - py3.13 (push) Has been cancelled
Deploy ReMe documentation / deploy (push) Has been cancelled
fix: harden the 0.4.1.7 release configuration (#456)
* fix(packaging): harden the Studio release workflow

* chore(daily-paper): tune scheduled discovery defaults

* fix(docs): link the ReMe blog to GitHub Pages

* fix(docs): increase Chinese hero title spacing

* refactor(docs): share hero title line spacing

* fix(docs): keep desktop hero copy on two lines

* fix(docs): widen the home hero description

* style(docs): loosen hero title line height

* fix(docs): hide Markdown frontmatter in rendered pages

* docs(readme): simplify installation and remove standalone ReMe Studio instructions

- Remove references to separate ReMe Studio package and static build steps
- Clarify that `core` extra includes common integrations including Studio
- Update installation instructions to use `pip install -e ".[core]"`
- Remove detailed Studio usage and frontend development instructions
- Note that Studio is included with `core` and optional via `web` extra
- Simplify Quick Start guide by removing Studio usage step
- Remove mentions of serving Studio with HTTP service when using extras
- Update both English and Chinese README files accordingly

* docs(readme): streamline and clarify memory design and operations

- Remove redundant explanations about core extra installation
- Simplify memory processing flow description for clarity
- Clarify memory workspace directory default and customization
- Condense automatic memory flow to emphasize rebuildable metadata
- Refine search functionality explanation with RRF fusion details
- Shorten and clarify agent integration description, removing redundancy
- Update and simplify the operations command list, removing less common commands
- Revise community and support section for conciseness and clarity
- Maintain parallel updates in both English and Chinese README files

* test(bump_version): add tests for version bumping and consistency checks

- Add dynamic loading of bump_version and package_studio scripts for testing
- Test that studio package and dependencies have matching versions
- Implement fixtures to write temporary version files for testing
- Add test ensuring bump_version updates all relevant files and dependencies
- Add test to reject inconsistent version sources before writing
- Refactor tests to use common REPOSITORY path variable
- Include imports and setup for pytest in test file

feat(bump_version): create script to update ReMe and Studio versions

- Implement version reading from __init__.py and pyproject.toml files
- Validate current versions are consistent across files before updating
- Update version strings atomically to avoid partial writes
- Ensure exact pinning of studio dependency in main package extras
- Validate new version format against a safe pattern
- Provide CLI interface to bump versions from command line
- Raise errors if expected version declarations or pins are missing or duplicated

* fix(release): validate split package publishing

* fix(release): improve validation diagnostics

* fix(release): sync docs and workflow inputs

* fix(release): split PyPI publish jobs
2026-08-13 17:22:00 +08:00

241 lines
7.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { cp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
const siteDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const repoDir = path.resolve(siteDir, "..");
const outputDir = path.join(siteDir, ".generated", "content");
const topicOrder = [
"quick_start",
"memory_as_file",
"memory_search",
"auto_memory",
"auto_resource",
"auto_link",
"auto_dream",
"proactive",
"reme_scene",
"framework",
"reme-blog",
"contributing",
];
const groups = {
quick_start: "start",
memory_as_file: "fundamentals",
memory_search: "fundamentals",
auto_memory: "automation",
auto_resource: "automation",
auto_link: "automation",
auto_dream: "automation",
proactive: "automation",
reme_scene: "concepts",
framework: "concepts",
"reme-blog": "concepts",
contributing: "development",
};
const localizedTitles = {
quick_start: { zh: "快速开始", en: "Quick Start" },
memory_as_file: { zh: "文件即记忆", en: "Memory as File" },
memory_search: { zh: "记忆检索", en: "Memory Search" },
auto_memory: { zh: "自动记忆", en: "Auto Memory" },
auto_resource: { zh: "自动资料整理", en: "Auto Resource" },
auto_link: { zh: "自动关联", en: "Auto Link" },
auto_dream: { zh: "自动沉淀", en: "Auto Dream" },
proactive: { zh: "主动发现", en: "Proactive" },
reme_scene: { zh: "ReMe 应用场景", en: "ReMe Application Scenarios" },
framework: { zh: "ReMe 代码框架", en: "ReMe Framework" },
"reme-blog": { zh: "ReMe 博客", en: "ReMe Blog" },
contributing: { zh: "开源与贡献", en: "Open Source and Contributing" },
};
const productDocuments = [
{
slug: "studio",
source: "website",
titles: { zh: "ReMe 工作台", en: "ReMe Studio" },
descriptions: {
zh: "浏览、编辑和搜索本地记忆,并探索记忆图谱。",
en: "Browse, edit, search, and explore local memory from the web workspace.",
},
group: "workspace",
},
{
slug: "daily-paper",
source: "cookbook/daily_paper",
titles: { zh: "每日论文", en: "Daily Paper" },
descriptions: {
zh: "发现论文、解析 PDF并生成阅读笔记与每日简报。",
en: "Discover papers, analyze PDFs, and produce reading notes and a daily brief.",
},
group: "cookbooks",
},
{
slug: "auto-fin",
source: "cookbook/auto-fin",
titles: { zh: "财经研究", en: "Auto Fin" },
descriptions: {
zh: "结合最新财联社新闻与本地历史记忆生成研究报告。",
en: "Research recent CLS news with historical context from local memory.",
},
group: "cookbooks",
},
{
slug: "beam",
source: "benchmark/beam",
titles: { zh: "BEAM", en: "BEAM" },
descriptions: {
zh: "评测大规模记忆检索能力。",
en: "Evaluate memory retrieval at scale.",
},
group: "benchmarks",
},
{
slug: "longmemeval",
source: "benchmark/longmemeval",
titles: { zh: "LongMemEval", en: "LongMemEval" },
descriptions: {
zh: "评测跨会话长期记忆问答能力。",
en: "Evaluate long-term, cross-session memory question answering.",
},
group: "benchmarks",
},
{
slug: "pibench",
source: "benchmark/pibench",
titles: { zh: "π-Bench", en: "π-Bench" },
descriptions: {
zh: "评测带持久记忆的个人智能体。",
en: "Evaluate personal agents with persistent memory.",
},
group: "benchmarks",
},
{
slug: "toolmemory",
source: "benchmark/toolmemory",
titles: { zh: "Tool Memory / ExpG", en: "Tool Memory / ExpG" },
descriptions: {
zh: "通过经验驱动的自适应指导增强 Agent 工具使用。",
en: "Improve agent tool use through experience-driven adaptive guidance.",
},
group: "benchmarks",
},
];
const sharedDocuments = [
{
id: "reme-memory-skill",
path: "skills/reme_memory/SKILL.md",
sourcePath: "skills/reme_memory/SKILL.md",
titles: {
zh: "ReMe 记忆技能",
en: "ReMe Memory Skill",
},
description: "Bootstrap, retrieve, write, and consolidate memory from an agent.",
group: "integration",
language: "shared",
},
{
id: "agents-guide",
path: "AGENTS.md",
sourcePath: "AGENTS.md",
titles: {
zh: "Agent 开发指南",
en: "Agent Development Guide",
},
description: "Repository contracts, lifecycle rules, safety boundaries, and validation.",
group: "development",
language: "shared",
},
];
async function markdownTitle(filePath) {
const source = await readFile(filePath, "utf8");
return source.match(/^#\s+(.+)$/m)?.[1]?.replace(/[`*_]/g, "") || path.basename(filePath, ".md");
}
async function buildManifest() {
const documents = [
{
id: "readme-zh",
path: "README_ZH.md",
sourcePath: "README_ZH.md",
title: "ReMe 项目介绍",
description: "核心理念、快速开始、使用场景与社区入口。",
group: "overview",
language: "zh",
},
{
id: "readme-en",
path: "README.md",
sourcePath: "README.md",
title: "Introducing ReMe",
description: "Core ideas, quick start, use cases, and community resources.",
group: "overview",
language: "en",
},
];
for (const language of ["zh", "en"]) {
for (const topic of topicOrder) {
const sourcePath = `docs/${language}/${topic}.md`;
documents.push({
id: `${language}-${topic}`,
path: sourcePath,
sourcePath,
title: localizedTitles[topic]?.[language] || (await markdownTitle(path.join(repoDir, sourcePath))),
description: "",
group: groups[topic],
language,
});
}
for (const product of productDocuments) {
const filename = language === "zh" ? "README_ZH.md" : "README.md";
documents.push({
id: `${product.slug}-${language}`,
path: `${product.source}/${filename}`,
sourcePath: `${product.source}/${filename}`,
title: product.titles[language],
description: product.descriptions[language],
group: product.group,
language,
});
}
}
return [...documents, ...sharedDocuments];
}
await rm(path.join(siteDir, ".generated"), { recursive: true, force: true });
await mkdir(outputDir, { recursive: true });
await cp(path.join(siteDir, "public", "favicon.svg"), path.join(siteDir, ".generated", "favicon.svg"));
await cp(path.join(siteDir, "public", "CNAME"), path.join(siteDir, ".generated", "CNAME"));
for (const file of ["README.md", "README_ZH.md", "AGENTS.md"]) {
await cp(path.join(repoDir, file), path.join(outputDir, file));
}
await cp(path.join(repoDir, "docs"), path.join(outputDir, "docs"), {
recursive: true,
filter: (source) => path.basename(source) !== ".DS_Store",
});
for (const product of productDocuments) {
await mkdir(path.join(outputDir, product.source), { recursive: true });
for (const filename of ["README.md", "README_ZH.md"]) {
await cp(path.join(repoDir, product.source, filename), path.join(outputDir, product.source, filename));
}
}
await mkdir(path.join(outputDir, "website", "public"), { recursive: true });
await cp(path.join(repoDir, "website", "public", "og.jpg"), path.join(outputDir, "website", "public", "og.jpg"));
await mkdir(path.join(outputDir, "skills", "reme_memory"), { recursive: true });
await cp(
path.join(repoDir, "skills", "reme_memory", "SKILL.md"),
path.join(outputDir, "skills", "reme_memory", "SKILL.md"),
);
await writeFile(
path.join(outputDir, "manifest.json"),
`${JSON.stringify({ documents: await buildManifest() }, null, 2)}\n`,
);