chore: 初始化仓库,导入项目基线代码

Academy v0.8.3 完整代码基线:Go 后端(internal/cmd/cli/mcp-server/docreader)、
Vue 前端(frontend)、数据库迁移(migrations)、部署编排(docker/helm/deploy)与文档。
今日开发的培训推送管理改动随后单独提交。
This commit is contained in:
runny committed 2026-11-16 18:12:23 +08:00
commit 7ec21f35b0
5767 files changed
+1436788

No files matched your search

@@ -0,0 +1,52 @@
import assert from 'node:assert/strict';
import { readFile, stat } from 'node:fs/promises';
import { join } from 'node:path';
const output = join(process.cwd(), 'out');
const html = await readFile(join(output, 'index.html'), 'utf8');
const visible = html.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g, '').replace(/<[^>]+>/g, '');
assert.equal((html.match(/<h1\b/g) || []).length, 1, 'The homepage must have one main heading');
for (const term of ['帮你找到答案', '并将知识付诸实践', 'v0.8.3', 'RAG', 'Agent', 'Wiki', 'ClawHub', 'SkillHub', 'Docker', 'E2B', 'Cube', '长期记忆', '交互终端', '图形桌面', '本机浏览器', 'BrowserSkill', 'MCP Server', '画廊', '多模态 Embedding', '腾讯 WeMM-Embedding', '内置 30 家厂商', '分叉或回滚', '原文引用定位', '附件按需读取', '平台用户管理', 'Seafile', 'Confluence', '钉钉', 'GitLab', '腾讯 IMA', 'LiteLLM', 'DeepSeek Harness']) {
assert.ok(visible.includes(term), `Missing product content: ${term}`);
}
for (const term of ['三套', '方案选择', '历史 Demo', '18K+', '成为行动力', '从零散文档', '到鲜活知识']) {
assert.ok(!visible.includes(term), `Retired content still visible: ${term}`);
}
assert.match(html, /<video[^>]+preload="none"/, 'Video should not load before user interaction');
assert.match(html, /https:\/\/github.com\/user-attachments\/assets\/2819598d-3140-4623-814a-8162a22b653c/, 'Use the README video');
assert.ok(!/<video[^>]+autoplay/i.test(html), 'Do not autoplay the product film');
const wiki = html.match(/<section id="wiki"[\s\S]*?<\/section>/)?.[0];
assert.ok(wiki, 'The homepage must include a dedicated Wiki section');
for (const term of ['/docs/_home/product/wiki-browser.png', '/docs/_home/product/wiki-graph-groups.png', '/docs/_home/product/wiki-revision-history.png', 'id="wiki-gallery"', '/docs/03-features/14-wiki.html', '来源引用', '知识图谱', '主题说明', '返回全图', '版本差异']) {
assert.ok(wiki.includes(term), `Missing Wiki showcase content: ${term}`);
}
// Release highlights and enduring capabilities must survive independently.
const release = html.match(/<section id="release"[\s\S]*?<\/section>/)?.[0];
for (const term of ['画廊', '多模态 Embedding', '腾讯 WeMM-Embedding', 'Wiki 图谱', '原文引用定位', '附件按需读取']) {
assert.ok(release?.includes(term), `Missing release highlight: ${term}`);
}
const browser = html.match(/<section id="agent-workflow"[\s\S]*?<\/section>/)?.[0];
assert.ok(browser?.includes('/docs/_home/product/local-browser-task.png') && browser.includes('BrowserSkill'), 'Keep the local browser showcase outside the release section');
for (const asset of ['browser-connection.png', 'browserskill.png']) {
assert.ok(browser.includes(asset), `Missing browser showcase asset: ${asset}`);
}
const ecosystem = html.match(/<section id="ecosystem"[\s\S]*?<\/section>/)?.[0];
assert.ok(ecosystem?.includes('通过 MCP Server 共享知识') && ecosystem.includes('/docs/03-features/08-mcp.html'), 'Keep MCP Server in the integrations section');
const ids = new Set([...html.matchAll(/\bid="([^"]+)"/g)].map(match => match[1]));
for (const [, anchor] of html.matchAll(/href="#([^"]+)"/g)) {
assert.ok(ids.has(anchor), `Missing navigation target: #${anchor}`);
}
const assets = new Set([...html.matchAll(/(?:src|href|poster)="(\/[^"?#]*)/g)].map(match => match[1]));
for (const asset of assets) {
const path = join(output, decodeURIComponent(asset));
let file = await stat(path);
if (file.isDirectory()) file = await stat(join(path, 'index.html'));
assert.ok(file.isFile() && file.size > 0, `Missing local asset: ${asset}`);
}
const pendingShots = [...html.matchAll(/website-docs\/homepage\/public(\/docs\/_home\/product\/[\w.-]+)/g)].map(match => match[1]);
// Gallery slides without a file render their placeholder only once selected; read the flag from the page data.
for (const [, image] of html.matchAll(/\\?"image\\?":\\?"([\w-]+)\\?"[^{}]*?\\?"available\\?":false/g)) pendingShots.push(`/docs/_home/product/${image}.png`);
if (pendingShots.length) console.warn(`Product screenshots still pending (placeholder shown): ${[...new Set(pendingShots)].join(', ')}`);
assert.match(html, /aria-controls="main-navigation"/);
assert.match(html, /aria-label="播放 Academy 产品介绍视频/);
console.log(`Homepage audit passed: product content, README video, navigation anchors, ${assets.size} local assets, and retired design choices.`);
@@ -0,0 +1,26 @@
import { copyFileSync, existsSync, readdirSync } from 'node:fs';
import { dirname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
// Documentation screenshots are authoritative; retain homepage-only assets.
export function syncProductScreenshots(source, destination) {
const aliases = { 'sandbox-terminal.png': 'sandbox-panel-terminal.png' };
let copied = 0;
for (const entry of readdirSync(destination, { withFileTypes: true })) {
if (!entry.isFile()) continue;
const original = join(source, aliases[entry.name] ?? entry.name);
if (!existsSync(original)) continue;
copyFileSync(original, join(destination, entry.name));
copied++;
}
return copied;
}
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
const homepage = resolve(dirname(fileURLToPath(import.meta.url)), '..');
const copied = syncProductScreenshots(
resolve(homepage, '../public/screenshots'),
resolve(homepage, 'public/docs/_home/product'),
);
console.log(`Synchronized ${copied} product screenshots from documentation sources.`);
}
@@ -0,0 +1,27 @@
import assert from 'node:assert/strict';
import { mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { test } from 'node:test';
import { syncProductScreenshots } from './sync-product-screenshots.mjs';
test('refreshes changed source images and aliases without replacing homepage-only assets', t => {
const root = mkdtempSync(join(tmpdir(), 'academy-shots-'));
t.after(() => rmSync(root, { recursive: true, force: true }));
const source = join(root, 'source');
const destination = join(root, 'product');
mkdirSync(source);
mkdirSync(destination);
writeFileSync(join(source, 'wiki-graph-groups.png'), 'new graph');
writeFileSync(join(source, 'sandbox-panel-terminal.png'), 'new terminal');
writeFileSync(join(destination, 'wiki-graph-groups.png'), 'old graph');
writeFileSync(join(destination, 'sandbox-terminal.png'), 'old terminal');
writeFileSync(join(destination, 'homepage-only.png'), 'keep this');
assert.equal(syncProductScreenshots(source, destination), 2);
assert.equal(readFileSync(join(destination, 'wiki-graph-groups.png'), 'utf8'), 'new graph');
assert.equal(readFileSync(join(destination, 'sandbox-terminal.png'), 'utf8'), 'new terminal');
assert.equal(readFileSync(join(destination, 'homepage-only.png'), 'utf8'), 'keep this');
writeFileSync(join(source, 'wiki-graph-groups.png'), 'updated graph again');
syncProductScreenshots(source, destination);
assert.equal(readFileSync(join(destination, 'wiki-graph-groups.png'), 'utf8'), 'updated graph again');
});