@geminilight/mindos 0.7.2 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_standalone/.mindos-build-version +1 -1
- package/_standalone/.next/BUILD_ID +1 -1
- package/_standalone/.next/app-path-routes-manifest.json +19 -19
- package/_standalone/.next/build-manifest.json +3 -3
- package/_standalone/.next/cache/.previewinfo +1 -1
- package/_standalone/.next/cache/.rscinfo +1 -1
- package/_standalone/.next/cache/config.json +3 -3
- package/_standalone/.next/prerender-manifest.json +3 -3
- package/_standalone/.next/react-loadable-manifest.json +4 -4
- package/_standalone/.next/server/app/.well-known/agent-card.json/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/_global-error.html +2 -2
- package/_standalone/.next/server/app/_global-error.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/_standalone/.next/server/app/_not-found/page.js +1 -1
- package/_standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/agents/[agentKey]/page.js +1 -1
- package/_standalone/.next/server/app/agents/[agentKey]/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/agents/[agentKey]/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/agents/page.js +1 -1
- package/_standalone/.next/server/app/agents/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/agents/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/agents/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/delegations/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/discover/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/config/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/detect/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/install/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/registry/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/session/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/agent-activity/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/agents/copy-skill/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/agents/custom/detect/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/agents/custom/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/ask/route.js +4 -4
- package/_standalone/.next/server/app/api/ask/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/ask-sessions/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/auth/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/backlinks/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/bootstrap/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/changes/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/channels/verify/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/connect/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/embedding/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/export/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/extract-docx/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/extract-pdf/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/file/import/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/file/raw/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/file/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/graph/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/im/activity/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/im/config/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/im/feishu/long-connection/event/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/im/feishu/long-connection/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/im/status/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/im/test/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/im/webhook/feishu/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/im/webhook-status/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/inbox/clip/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/inbox/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/lint/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/agents/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/direct-tools/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/install/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/install-skill/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/restart/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/status/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/tools/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/uninstall/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/monitoring/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/obsidian/compat-report/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/obsidian/import/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/recent-files/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/search/prewarm/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/list-models/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/reset-token/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/test-key/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/check-path/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/check-port/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/generate-token/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/ls/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/space-overview/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/sync/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/tree-version/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/uninstall/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/update-check/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/update-status/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/workflows/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/capture/history/page.js +1 -1
- package/_standalone/.next/server/app/capture/history/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/capture/history/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/capture/page.js +1 -1
- package/_standalone/.next/server/app/capture/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/capture/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/changelog/page.js +1 -1
- package/_standalone/.next/server/app/changelog/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/changelog/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/changes/page.js +1 -1
- package/_standalone/.next/server/app/changes/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/changes/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/echo/[segment]/page.js +1 -1
- package/_standalone/.next/server/app/echo/[segment]/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/echo/[segment]/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/echo/page.js +1 -1
- package/_standalone/.next/server/app/echo/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/echo/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/explore/page.js +1 -1
- package/_standalone/.next/server/app/explore/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/explore/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/help/page.js +1 -1
- package/_standalone/.next/server/app/help/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/help/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/inbox/history/page.js +1 -1
- package/_standalone/.next/server/app/inbox/history/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/inbox/history/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/login/page.js +1 -1
- package/_standalone/.next/server/app/login/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/page.js +1 -1
- package/_standalone/.next/server/app/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/setup/page.js +1 -1
- package/_standalone/.next/server/app/setup/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/todo/page.js +1 -1
- package/_standalone/.next/server/app/todo/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/todo/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/trash/page.js +2 -2
- package/_standalone/.next/server/app/trash/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/view/[...path]/page.js +2 -2
- package/_standalone/.next/server/app/view/[...path]/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/view/[...path]/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/wiki/page.js +2 -0
- package/_standalone/.next/server/app/wiki/page.js.nft.json +1 -0
- package/_standalone/.next/server/app/wiki/page_client-reference-manifest.js +1 -0
- package/_standalone/.next/server/app-paths-manifest.json +19 -19
- package/_standalone/.next/server/chunks/2250.js +1 -1
- package/_standalone/.next/server/chunks/{1057.js → 3861.js} +2 -2
- package/_standalone/.next/server/chunks/4802.js +30 -30
- package/_standalone/.next/server/chunks/8388.js +1 -1
- package/_standalone/.next/server/middleware-build-manifest.js +1 -1
- package/_standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/_standalone/.next/server/pages/500.html +2 -2
- package/_standalone/.next/server/server-reference-manifest.js +1 -1
- package/_standalone/.next/server/server-reference-manifest.json +1 -1
- package/_standalone/.next/static/chunks/{5581-bae715e40d227b5f.js → 5581-beecbc4ca5625aa9.js} +2 -2
- package/_standalone/.next/static/chunks/6762.c871d0bf3f45ba87.js +1 -0
- package/_standalone/.next/static/chunks/{8064-e65acd2762132099.js → 8064-acac37daf946082b.js} +1 -1
- package/_standalone/.next/static/chunks/{3985.695651f6b5cd768c.js → 8984.91fb8cde1983c564.js} +2 -2
- package/_standalone/.next/static/chunks/app/{layout-0cf6f2a65f605a0d.js → layout-20faba3bc0af7cd2.js} +19 -19
- package/_standalone/.next/static/chunks/app/trash/page-0c2c67929b71ef71.js +1 -0
- package/_standalone/.next/static/chunks/app/view/[...path]/not-found-fd06cc989103ebe7.js +1 -0
- package/_standalone/.next/static/chunks/app/view/[...path]/page-dba70888697ba910.js +12 -0
- package/_standalone/.next/static/chunks/app/wiki/page-9bc1fec84d343290.js +14 -0
- package/_standalone/.next/static/chunks/webpack-3c1d0331f1da64b8.js +1 -0
- package/_standalone/.next/trace +97 -97
- package/_standalone/MINDOS_ARCHITECTURE_DIAGRAM.md +488 -0
- package/_standalone/MINDOS_EXPLORATION_SUMMARY.md +229 -0
- package/_standalone/MINDOS_INFRASTRUCTURE_ANALYSIS.md +732 -0
- package/_standalone/__tests__/api/mcp-install.test.ts +8 -2
- package/_standalone/__tests__/core/embedding-provider.test.ts +78 -0
- package/_standalone/__tests__/skills/mindos-skill-copy-alignment.test.ts +10 -4
- package/_standalone/components/ask/AskHeader.tsx +25 -18
- package/_standalone/components/ask/SessionHistoryPanel.tsx +21 -12
- package/_standalone/components/settings/AiTab.tsx +3 -0
- package/_standalone/data/skills/mindos/SKILL.md +269 -0
- package/_standalone/data/skills/mindos/references/write-supplement.md +119 -0
- package/_standalone/data/skills/mindos-zh/SKILL.md +227 -0
- package/_standalone/data/skills/mindos-zh/references/write-supplement.md +119 -0
- package/app/__tests__/api/mcp-install.test.ts +8 -2
- package/app/__tests__/core/embedding-provider.test.ts +78 -0
- package/app/__tests__/skills/mindos-skill-copy-alignment.test.ts +10 -4
- package/app/app/api/ask/route.ts +14 -9
- package/app/app/view/[...path]/ViewPageClient.tsx +15 -12
- package/app/app/view/[...path]/not-found.tsx +9 -5
- package/app/components/ask/AskHeader.tsx +25 -18
- package/app/components/ask/SessionHistoryPanel.tsx +21 -12
- package/app/components/settings/AiTab.tsx +3 -0
- package/app/eslint.config.mjs +18 -0
- package/app/lib/core/embedding-provider.ts +12 -4
- package/app/lib/i18n/modules/settings.ts +2 -0
- package/app/package-lock.json +20214 -0
- package/app/tsconfig.tsbuildinfo +1 -0
- package/app/vitest.config.ts +14 -0
- package/assets/demo-flow-zh.html +622 -0
- package/assets/images/demo-flow-dark.png +0 -0
- package/assets/images/demo-flow-dark.webp +0 -0
- package/assets/images/demo-flow-light.png +0 -0
- package/assets/images/demo-flow-light.webp +0 -0
- package/assets/images/demo-flow-zh-dark.png +0 -0
- package/assets/images/demo-flow-zh-dark.webp +0 -0
- package/assets/images/demo-flow-zh-light.png +0 -0
- package/assets/images/demo-flow-zh-light.webp +0 -0
- package/assets/images/gui-sync-cv.png +0 -0
- package/assets/images/gui-sync-cv.webp +0 -0
- package/assets/images/mindos-chat.png +0 -0
- package/assets/images/mindos-chat.webp +0 -0
- package/assets/images/mindos-dashboard.png +0 -0
- package/assets/images/mindos-dashboard.webp +0 -0
- package/assets/images/mindos-echo.png +0 -0
- package/assets/images/mindos-echo.webp +0 -0
- package/assets/images/mindos-home.png +0 -0
- package/assets/images/mindos-home.webp +0 -0
- package/assets/images/wechat-qr.png +0 -0
- package/bin/lib/mcp-build.js +8 -0
- package/mcp/package-lock.json +2202 -0
- package/mcp/src/index.ts +783 -0
- package/package.json +13 -1
- package/.env.local.example +0 -38
- package/.playwright-cli/page-2026-04-12T12-26-53-393Z.yml +0 -6
- package/.playwright-cli/page-2026-04-12T12-27-20-256Z.yml +0 -120
- package/.syncinclude +0 -105
- package/MINDOS_SEARCH_DIAGRAM.txt +0 -243
- package/_standalone/.next/static/chunks/576.3cae31209383ddbd.js +0 -1
- package/_standalone/.next/static/chunks/app/trash/page-085f121c0815d542.js +0 -1
- package/_standalone/.next/static/chunks/app/view/[...path]/not-found-2a6eec67e91eaaf9.js +0 -1
- package/_standalone/.next/static/chunks/app/view/[...path]/page-faeaf8c09c1c6d7c.js +0 -12
- package/_standalone/.next/static/chunks/webpack-a1bb35f2d540e463.js +0 -1
- package/scripts/build-runtime-archive.sh +0 -151
- package/scripts/fix-postcss-deps.cjs +0 -75
- package/scripts/gen-renderer-index.js +0 -64
- package/scripts/hooks/block-public-merge.sh +0 -42
- package/scripts/hooks/pre-merge-commit +0 -4
- package/scripts/hooks/pre-push +0 -37
- package/scripts/hooks/prepare-commit-msg +0 -12
- package/scripts/migrate-agent-audit-log.js +0 -170
- package/scripts/migrate-agent-diff.js +0 -146
- package/scripts/parse-syncinclude.sh +0 -92
- package/scripts/prepare-standalone.mjs +0 -83
- package/scripts/release.sh +0 -145
- package/scripts/setup.js +0 -1427
- package/scripts/test-oss-upload.sh +0 -100
- package/scripts/verify-standalone.mjs +0 -129
- package/scripts/write-build-stamp.js +0 -40
- /package/_standalone/.next/static/{q5RP_Mx8BrCfvVDnLpRRc → 0UlbV2rA2i4B-8YYg41wQ}/_buildManifest.js +0 -0
- /package/_standalone/.next/static/{q5RP_Mx8BrCfvVDnLpRRc → 0UlbV2rA2i4B-8YYg41wQ}/_ssgManifest.js +0 -0
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* One-shot migration helper:
|
|
4
|
-
* Import legacy Agent-Audit.md and .agent-log.json into .mindos/agent-audit-log.json.
|
|
5
|
-
*
|
|
6
|
-
* Usage:
|
|
7
|
-
* node scripts/migrate-agent-audit-log.js --mind-root /abs/path/to/mindRoot
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import fs from 'fs';
|
|
11
|
-
import path from 'path';
|
|
12
|
-
|
|
13
|
-
const MAX_EVENTS = 1000;
|
|
14
|
-
|
|
15
|
-
function parseArgs(argv) {
|
|
16
|
-
let mindRoot = '';
|
|
17
|
-
for (let i = 0; i < argv.length; i++) {
|
|
18
|
-
if (argv[i] === '--mind-root') {
|
|
19
|
-
mindRoot = argv[i + 1] || '';
|
|
20
|
-
i += 1;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return { mindRoot };
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function nowIso() {
|
|
27
|
-
return new Date().toISOString();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function validIso(ts) {
|
|
31
|
-
if (typeof ts !== 'string') return nowIso();
|
|
32
|
-
const ms = new Date(ts).getTime();
|
|
33
|
-
return Number.isFinite(ms) ? new Date(ms).toISOString() : nowIso();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function normalizeMessage(message) {
|
|
37
|
-
if (typeof message !== 'string') return undefined;
|
|
38
|
-
return message.slice(0, 2000);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function readJson(file, fallback) {
|
|
42
|
-
try {
|
|
43
|
-
if (!fs.existsSync(file)) return fallback;
|
|
44
|
-
return JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
45
|
-
} catch {
|
|
46
|
-
return fallback;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function parseMdBlocks(raw) {
|
|
51
|
-
const blocks = [];
|
|
52
|
-
const re = /```agent-op\s*\n([\s\S]*?)```/g;
|
|
53
|
-
let match;
|
|
54
|
-
while ((match = re.exec(raw)) !== null) {
|
|
55
|
-
try {
|
|
56
|
-
blocks.push(JSON.parse(match[1].trim()));
|
|
57
|
-
} catch {
|
|
58
|
-
// Keep migration best-effort.
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return blocks;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function parseJsonLines(raw) {
|
|
65
|
-
const lines = [];
|
|
66
|
-
for (const line of raw.split('\n')) {
|
|
67
|
-
const trimmed = line.trim();
|
|
68
|
-
if (!trimmed || trimmed.startsWith('#') || trimmed.startsWith('//')) continue;
|
|
69
|
-
try {
|
|
70
|
-
lines.push(JSON.parse(trimmed));
|
|
71
|
-
} catch {
|
|
72
|
-
// Ignore malformed line.
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return lines;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function toEvent(entry, op, idx) {
|
|
79
|
-
const tool = typeof entry?.tool === 'string' && entry.tool.trim() ? entry.tool.trim() : 'unknown-tool';
|
|
80
|
-
return {
|
|
81
|
-
id: `legacy-script-${Date.now().toString(36)}-${idx.toString(36)}`,
|
|
82
|
-
ts: validIso(entry?.ts),
|
|
83
|
-
tool,
|
|
84
|
-
params: entry?.params && typeof entry.params === 'object' ? entry.params : {},
|
|
85
|
-
result: entry?.result === 'error' ? 'error' : 'ok',
|
|
86
|
-
message: normalizeMessage(entry?.message),
|
|
87
|
-
durationMs: typeof entry?.durationMs === 'number' ? entry.durationMs : undefined,
|
|
88
|
-
op,
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function main() {
|
|
93
|
-
const { mindRoot } = parseArgs(process.argv.slice(2));
|
|
94
|
-
if (!mindRoot) {
|
|
95
|
-
console.error('Missing --mind-root');
|
|
96
|
-
process.exit(1);
|
|
97
|
-
}
|
|
98
|
-
const root = path.resolve(mindRoot);
|
|
99
|
-
if (!fs.existsSync(root) || !fs.statSync(root).isDirectory()) {
|
|
100
|
-
console.error('Invalid mind root:', root);
|
|
101
|
-
process.exit(1);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const legacyMd = path.join(root, 'Agent-Audit.md');
|
|
105
|
-
const legacyJsonl = path.join(root, '.agent-log.json');
|
|
106
|
-
if (!fs.existsSync(legacyMd) && !fs.existsSync(legacyJsonl)) {
|
|
107
|
-
console.log('No legacy Agent-Audit.md or .agent-log.json found. Nothing to migrate.');
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const logDir = path.join(root, '.mindos');
|
|
112
|
-
const logFile = path.join(logDir, 'agent-audit-log.json');
|
|
113
|
-
const state = readJson(logFile, {
|
|
114
|
-
version: 1,
|
|
115
|
-
events: [],
|
|
116
|
-
legacy: { mdImportedCount: 0, jsonlImportedCount: 0, lastImportedAt: null },
|
|
117
|
-
});
|
|
118
|
-
const baseEvents = Array.isArray(state.events) ? state.events : [];
|
|
119
|
-
const legacy = {
|
|
120
|
-
mdImportedCount: Number(state?.legacy?.mdImportedCount || 0),
|
|
121
|
-
jsonlImportedCount: Number(state?.legacy?.jsonlImportedCount || 0),
|
|
122
|
-
lastImportedAt: typeof state?.legacy?.lastImportedAt === 'string' ? state.legacy.lastImportedAt : null,
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const imported = [];
|
|
126
|
-
|
|
127
|
-
if (fs.existsSync(legacyMd)) {
|
|
128
|
-
const blocks = parseMdBlocks(fs.readFileSync(legacyMd, 'utf-8'));
|
|
129
|
-
if (blocks.length > legacy.mdImportedCount) {
|
|
130
|
-
const incoming = blocks.slice(legacy.mdImportedCount);
|
|
131
|
-
imported.push(...incoming.map((entry, idx) => toEvent(entry, 'legacy_agent_audit_md_import', idx)));
|
|
132
|
-
legacy.mdImportedCount = blocks.length;
|
|
133
|
-
legacy.lastImportedAt = nowIso();
|
|
134
|
-
}
|
|
135
|
-
if (blocks.length > 0) fs.rmSync(legacyMd, { force: true });
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (fs.existsSync(legacyJsonl)) {
|
|
139
|
-
const lines = parseJsonLines(fs.readFileSync(legacyJsonl, 'utf-8'));
|
|
140
|
-
if (lines.length > legacy.jsonlImportedCount) {
|
|
141
|
-
const incoming = lines.slice(legacy.jsonlImportedCount);
|
|
142
|
-
imported.push(...incoming.map((entry, idx) => toEvent(entry, 'legacy_agent_log_jsonl_import', idx)));
|
|
143
|
-
legacy.jsonlImportedCount = lines.length;
|
|
144
|
-
legacy.lastImportedAt = nowIso();
|
|
145
|
-
}
|
|
146
|
-
if (lines.length > 0) fs.rmSync(legacyJsonl, { force: true });
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (imported.length === 0) {
|
|
150
|
-
console.log('No new legacy entries to import.');
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const merged = [...baseEvents, ...imported]
|
|
155
|
-
.sort((a, b) => new Date(b.ts).getTime() - new Date(a.ts).getTime())
|
|
156
|
-
.slice(0, MAX_EVENTS);
|
|
157
|
-
|
|
158
|
-
const next = {
|
|
159
|
-
version: 1,
|
|
160
|
-
events: merged,
|
|
161
|
-
legacy,
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
fs.mkdirSync(logDir, { recursive: true });
|
|
165
|
-
fs.writeFileSync(logFile, JSON.stringify(next, null, 2), 'utf-8');
|
|
166
|
-
console.log(`Imported ${imported.length} legacy entry(s) into ${logFile}`);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
main();
|
|
170
|
-
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* One-shot migration helper:
|
|
4
|
-
* Import legacy Agent-Diff.md ```agent-diff blocks into .mindos/change-log.json.
|
|
5
|
-
*
|
|
6
|
-
* Usage:
|
|
7
|
-
* node scripts/migrate-agent-diff.js --mind-root /abs/path/to/mindRoot
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import fs from 'fs';
|
|
11
|
-
import path from 'path';
|
|
12
|
-
|
|
13
|
-
const MAX_EVENTS = 500;
|
|
14
|
-
const MAX_TEXT_CHARS = 12_000;
|
|
15
|
-
|
|
16
|
-
function parseArgs(argv) {
|
|
17
|
-
let mindRoot = '';
|
|
18
|
-
for (let i = 0; i < argv.length; i++) {
|
|
19
|
-
if (argv[i] === '--mind-root') {
|
|
20
|
-
mindRoot = argv[i + 1] || '';
|
|
21
|
-
i += 1;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return { mindRoot };
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function normalizeText(value) {
|
|
28
|
-
if (typeof value !== 'string') return { value: undefined, truncated: false };
|
|
29
|
-
if (value.length <= MAX_TEXT_CHARS) return { value, truncated: false };
|
|
30
|
-
return { value: value.slice(0, MAX_TEXT_CHARS), truncated: true };
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function nowIso() {
|
|
34
|
-
return new Date().toISOString();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function validIso(ts) {
|
|
38
|
-
if (typeof ts !== 'string') return nowIso();
|
|
39
|
-
const ms = new Date(ts).getTime();
|
|
40
|
-
return Number.isFinite(ms) ? new Date(ms).toISOString() : nowIso();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function parseLegacyBlocks(raw) {
|
|
44
|
-
const blocks = [];
|
|
45
|
-
const re = /```agent-diff\s*\n([\s\S]*?)```/g;
|
|
46
|
-
let m;
|
|
47
|
-
while ((m = re.exec(raw)) !== null) {
|
|
48
|
-
try {
|
|
49
|
-
blocks.push(JSON.parse(m[1].trim()));
|
|
50
|
-
} catch {
|
|
51
|
-
// Keep migration best-effort.
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return blocks;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function readJson(file, fallback) {
|
|
58
|
-
try {
|
|
59
|
-
if (!fs.existsSync(file)) return fallback;
|
|
60
|
-
return JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
61
|
-
} catch {
|
|
62
|
-
return fallback;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function main() {
|
|
67
|
-
const { mindRoot } = parseArgs(process.argv.slice(2));
|
|
68
|
-
if (!mindRoot) {
|
|
69
|
-
console.error('Missing --mind-root');
|
|
70
|
-
process.exit(1);
|
|
71
|
-
}
|
|
72
|
-
const root = path.resolve(mindRoot);
|
|
73
|
-
if (!fs.existsSync(root) || !fs.statSync(root).isDirectory()) {
|
|
74
|
-
console.error('Invalid mind root:', root);
|
|
75
|
-
process.exit(1);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const legacyFile = path.join(root, 'Agent-Diff.md');
|
|
79
|
-
if (!fs.existsSync(legacyFile)) {
|
|
80
|
-
console.log('No Agent-Diff.md found. Nothing to migrate.');
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const logDir = path.join(root, '.mindos');
|
|
85
|
-
const logFile = path.join(logDir, 'change-log.json');
|
|
86
|
-
const state = readJson(logFile, {
|
|
87
|
-
version: 1,
|
|
88
|
-
lastSeenAt: null,
|
|
89
|
-
events: [],
|
|
90
|
-
legacy: { agentDiffImportedCount: 0, lastImportedAt: null },
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
const raw = fs.readFileSync(legacyFile, 'utf-8');
|
|
94
|
-
const blocks = parseLegacyBlocks(raw);
|
|
95
|
-
const importedCount = Number(state?.legacy?.agentDiffImportedCount || 0);
|
|
96
|
-
if (blocks.length <= importedCount) {
|
|
97
|
-
if (blocks.length > 0) {
|
|
98
|
-
fs.rmSync(legacyFile, { force: true });
|
|
99
|
-
console.log('Legacy Agent-Diff.md already migrated; removed legacy file.');
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
console.log('No new legacy blocks to import.');
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const incoming = blocks.slice(importedCount);
|
|
107
|
-
const imported = incoming.map((entry, idx) => {
|
|
108
|
-
const before = normalizeText(entry?.before);
|
|
109
|
-
const after = normalizeText(entry?.after);
|
|
110
|
-
const tool = typeof entry?.tool === 'string' && entry.tool.trim() ? entry.tool.trim() : 'unknown-tool';
|
|
111
|
-
const targetPath = typeof entry?.path === 'string' && entry.path.trim() ? entry.path : 'Agent-Diff.md';
|
|
112
|
-
return {
|
|
113
|
-
id: `legacy-script-${Date.now().toString(36)}-${idx.toString(36)}`,
|
|
114
|
-
ts: validIso(entry?.ts),
|
|
115
|
-
op: 'legacy_agent_diff_import',
|
|
116
|
-
path: targetPath,
|
|
117
|
-
source: 'agent',
|
|
118
|
-
summary: `Imported legacy agent diff (${tool})`,
|
|
119
|
-
before: before.value,
|
|
120
|
-
after: after.value,
|
|
121
|
-
truncated: before.truncated || after.truncated || undefined,
|
|
122
|
-
};
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
const merged = [...(Array.isArray(state.events) ? state.events : []), ...imported].sort(
|
|
126
|
-
(a, b) => new Date(b.ts).getTime() - new Date(a.ts).getTime(),
|
|
127
|
-
).slice(0, MAX_EVENTS);
|
|
128
|
-
|
|
129
|
-
const next = {
|
|
130
|
-
version: 1,
|
|
131
|
-
lastSeenAt: typeof state.lastSeenAt === 'string' ? state.lastSeenAt : null,
|
|
132
|
-
events: merged,
|
|
133
|
-
legacy: {
|
|
134
|
-
agentDiffImportedCount: blocks.length,
|
|
135
|
-
lastImportedAt: nowIso(),
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
fs.mkdirSync(logDir, { recursive: true });
|
|
140
|
-
fs.writeFileSync(logFile, JSON.stringify(next, null, 2), 'utf-8');
|
|
141
|
-
fs.rmSync(legacyFile, { force: true });
|
|
142
|
-
console.log(`Imported ${imported.length} legacy block(s) into ${logFile}`);
|
|
143
|
-
console.log('Removed legacy Agent-Diff.md');
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
main();
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
# parse-syncinclude.sh — Parse .syncinclude and export shell variables.
|
|
4
|
-
#
|
|
5
|
-
# Usage:
|
|
6
|
-
# eval "$(scripts/parse-syncinclude.sh)"
|
|
7
|
-
# # Now you have: SYNC_DIRS, ROOT_FILES, WIKI_EXCLUDES, GLOBAL_EXCLUDES, BLOCKED_PATTERNS
|
|
8
|
-
#
|
|
9
|
-
# Or source it:
|
|
10
|
-
# source <(scripts/parse-syncinclude.sh)
|
|
11
|
-
#
|
|
12
|
-
set -euo pipefail
|
|
13
|
-
|
|
14
|
-
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
15
|
-
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
16
|
-
SYNCFILE="$REPO_ROOT/.syncinclude"
|
|
17
|
-
|
|
18
|
-
if [ ! -f "$SYNCFILE" ]; then
|
|
19
|
-
echo "echo '::error::.syncinclude not found at $SYNCFILE'" >&2
|
|
20
|
-
exit 1
|
|
21
|
-
fi
|
|
22
|
-
|
|
23
|
-
# ─── Parser ───────────────────────────────────────────────────────────────────
|
|
24
|
-
# Simple YAML-subset parser: reads "section:" headers and " - value" items.
|
|
25
|
-
# No external dependencies (no yq/python needed).
|
|
26
|
-
|
|
27
|
-
current_section=""
|
|
28
|
-
DIRS=()
|
|
29
|
-
FILES=()
|
|
30
|
-
WIKI_EX=()
|
|
31
|
-
GLOBAL_EX=()
|
|
32
|
-
BLOCKED=()
|
|
33
|
-
|
|
34
|
-
while IFS= read -r line; do
|
|
35
|
-
# Skip comments and blank lines
|
|
36
|
-
[[ "$line" =~ ^[[:space:]]*# ]] && continue
|
|
37
|
-
[[ -z "${line// /}" ]] && continue
|
|
38
|
-
|
|
39
|
-
# Section header (no leading whitespace, ends with colon)
|
|
40
|
-
if [[ "$line" =~ ^([a-z_]+): ]]; then
|
|
41
|
-
current_section="${BASH_REMATCH[1]}"
|
|
42
|
-
continue
|
|
43
|
-
fi
|
|
44
|
-
|
|
45
|
-
# List item (leading whitespace + dash)
|
|
46
|
-
if [[ "$line" =~ ^[[:space:]]+-[[:space:]]+(.*) ]]; then
|
|
47
|
-
value="${BASH_REMATCH[1]}"
|
|
48
|
-
# Strip surrounding quotes
|
|
49
|
-
value="${value#\"}"
|
|
50
|
-
value="${value%\"}"
|
|
51
|
-
value="${value#\'}"
|
|
52
|
-
value="${value%\'}"
|
|
53
|
-
|
|
54
|
-
case "$current_section" in
|
|
55
|
-
directories) DIRS+=("$value") ;;
|
|
56
|
-
root_files) FILES+=("$value") ;;
|
|
57
|
-
wiki_exclude) WIKI_EX+=("$value") ;;
|
|
58
|
-
global_exclude) GLOBAL_EX+=("$value") ;;
|
|
59
|
-
blocked_patterns) BLOCKED+=("$value") ;;
|
|
60
|
-
esac
|
|
61
|
-
fi
|
|
62
|
-
done < "$SYNCFILE"
|
|
63
|
-
|
|
64
|
-
# ─── Output ───────────────────────────────────────────────────────────────────
|
|
65
|
-
# Print shell variable assignments that can be eval'd by the caller.
|
|
66
|
-
|
|
67
|
-
# Space-separated lists (for simple iteration)
|
|
68
|
-
echo "SYNC_DIRS='${DIRS[*]:-}'"
|
|
69
|
-
echo "ROOT_FILES='${FILES[*]:-}'"
|
|
70
|
-
|
|
71
|
-
# Build rsync --exclude flags
|
|
72
|
-
wiki_excludes=""
|
|
73
|
-
for ex in "${WIKI_EX[@]:-}"; do
|
|
74
|
-
[ -n "$ex" ] && wiki_excludes="$wiki_excludes --exclude='$ex'"
|
|
75
|
-
done
|
|
76
|
-
echo "WIKI_EXCLUDES='$wiki_excludes'"
|
|
77
|
-
|
|
78
|
-
global_excludes=""
|
|
79
|
-
for ex in "${GLOBAL_EX[@]:-}"; do
|
|
80
|
-
[ -n "$ex" ] && global_excludes="$global_excludes --exclude='$ex'"
|
|
81
|
-
done
|
|
82
|
-
echo "GLOBAL_EXCLUDES='$global_excludes'"
|
|
83
|
-
|
|
84
|
-
# Newline-separated for safe iteration (patterns may contain spaces/globs)
|
|
85
|
-
blocked_str=""
|
|
86
|
-
for pat in "${BLOCKED[@]:-}"; do
|
|
87
|
-
[ -n "$pat" ] && blocked_str="$blocked_str$pat"$'\n'
|
|
88
|
-
done
|
|
89
|
-
# Use heredoc-style to safely pass patterns with special chars
|
|
90
|
-
cat <<BLOCKED_EOF
|
|
91
|
-
BLOCKED_PATTERNS='$(echo -n "$blocked_str")'
|
|
92
|
-
BLOCKED_EOF
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* prepare-standalone.mjs — Materialize Next.js standalone build into _standalone/
|
|
4
|
-
*
|
|
5
|
-
* Called during `npm pack` (via prepack script) to bundle prebuilt production
|
|
6
|
-
* server into the npm package. Users who install via npm get a ready-to-run
|
|
7
|
-
* server without needing `npm install` + `next build` on their machine.
|
|
8
|
-
*
|
|
9
|
-
* Prerequisites: `cd app && npx next build --webpack` must have been run first.
|
|
10
|
-
*/
|
|
11
|
-
import { cpSync, rmSync, writeFileSync, readFileSync, existsSync } from 'node:fs';
|
|
12
|
-
import { resolve, dirname } from 'node:path';
|
|
13
|
-
import { fileURLToPath } from 'node:url';
|
|
14
|
-
|
|
15
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
16
|
-
const root = resolve(__dirname, '..');
|
|
17
|
-
const appDir = resolve(root, 'app');
|
|
18
|
-
const standaloneAppDir = resolve(appDir, '.next', 'standalone');
|
|
19
|
-
const standaloneServerJs = resolve(standaloneAppDir, 'server.js');
|
|
20
|
-
const destDir = resolve(root, '_standalone');
|
|
21
|
-
|
|
22
|
-
// ── Guard: ensure standalone build exists ────────────────────────────────────
|
|
23
|
-
if (!existsSync(standaloneServerJs)) {
|
|
24
|
-
console.error(
|
|
25
|
-
`[prepare-standalone] Missing ${standaloneServerJs}\n` +
|
|
26
|
-
`Run: cd app && npx next build --webpack`
|
|
27
|
-
);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// ── Step 1: Materialize static + public into standalone dir ──────────────────
|
|
32
|
-
// Reuse the same logic Desktop uses.
|
|
33
|
-
import { materializeStandaloneAssets } from '../desktop/scripts/prepare-mindos-bundle.mjs';
|
|
34
|
-
materializeStandaloneAssets(appDir);
|
|
35
|
-
|
|
36
|
-
// ── Step 2: Copy standalone to top-level _standalone/ ────────────────────────
|
|
37
|
-
console.log('[prepare-standalone] Copying standalone build to _standalone/ ...');
|
|
38
|
-
rmSync(destDir, { recursive: true, force: true });
|
|
39
|
-
cpSync(standaloneAppDir, destDir, { recursive: true });
|
|
40
|
-
|
|
41
|
-
// ── Step 3: Write version stamp ──────────────────────────────────────────────
|
|
42
|
-
const version = JSON.parse(readFileSync(resolve(root, 'package.json'), 'utf-8')).version;
|
|
43
|
-
writeFileSync(resolve(destDir, '.mindos-build-version'), version, 'utf-8');
|
|
44
|
-
|
|
45
|
-
// ── Step 4: Verify server.js ─────────────────────────────────────────────────
|
|
46
|
-
const destServerJs = resolve(destDir, 'server.js');
|
|
47
|
-
if (!existsSync(destServerJs)) {
|
|
48
|
-
console.error('[prepare-standalone] FAILED: _standalone/server.js not found after copy');
|
|
49
|
-
process.exit(1);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// ── Step 5: Verify every route declared in app-paths-manifest actually exists ─
|
|
53
|
-
// Root cause of the /wiki 500 bug: manifest listed the route but the page.js
|
|
54
|
-
// file was missing from the standalone build. A static checklist can go stale
|
|
55
|
-
// when new pages are added, so we read the manifest directly — zero maintenance.
|
|
56
|
-
const manifestPath = resolve(destDir, '.next', 'server', 'app-paths-manifest.json');
|
|
57
|
-
if (!existsSync(manifestPath)) {
|
|
58
|
-
console.error('[prepare-standalone] FAILED: app-paths-manifest.json not found in standalone build');
|
|
59
|
-
process.exit(1);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));
|
|
63
|
-
const serverDir = resolve(destDir, '.next', 'server');
|
|
64
|
-
const missingFiles = [];
|
|
65
|
-
|
|
66
|
-
for (const [route, relPath] of Object.entries(manifest)) {
|
|
67
|
-
const absPath = resolve(serverDir, relPath);
|
|
68
|
-
if (!existsSync(absPath)) {
|
|
69
|
-
missingFiles.push({ route, file: relPath });
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (missingFiles.length > 0) {
|
|
74
|
-
console.error(
|
|
75
|
-
`[prepare-standalone] FAILED: ${missingFiles.length} route(s) declared in app-paths-manifest.json but file missing:\n` +
|
|
76
|
-
missingFiles.map(({ route, file }) => ` ${route} → ${file}`).join('\n') + '\n' +
|
|
77
|
-
'This will cause 500 errors at runtime. Check the Next.js build output for errors.'
|
|
78
|
-
);
|
|
79
|
-
process.exit(1);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const pageRoutes = Object.keys(manifest).filter(r => r.endsWith('/page'));
|
|
83
|
-
console.log(`[prepare-standalone] OK — server.js + ${Object.keys(manifest).length} manifest entries verified (${pageRoutes.length} pages, v${version})`);
|
package/scripts/release.sh
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
# ── Usage ────────────────────────────────────────────────────────────────
|
|
5
|
-
# npm run release [patch|minor|major] (default: patch)
|
|
6
|
-
# ─────────────────────────────────────────────────────────────────────────
|
|
7
|
-
|
|
8
|
-
BUMP="${1:-patch}"
|
|
9
|
-
|
|
10
|
-
# 1. Ensure clean working tree
|
|
11
|
-
if ! git diff --quiet || ! git diff --cached --quiet; then
|
|
12
|
-
echo "❌ Working tree is not clean. Commit or stash changes first."
|
|
13
|
-
exit 1
|
|
14
|
-
fi
|
|
15
|
-
|
|
16
|
-
# 2. Run tests
|
|
17
|
-
echo "🧪 Running tests..."
|
|
18
|
-
npm test
|
|
19
|
-
echo ""
|
|
20
|
-
|
|
21
|
-
# 3. Verify Next.js build
|
|
22
|
-
echo "🔨 Verifying Next.js build..."
|
|
23
|
-
cd app
|
|
24
|
-
if npx next build --webpack 2>&1 | tail -5; then
|
|
25
|
-
echo " ✅ Next.js build succeeded"
|
|
26
|
-
else
|
|
27
|
-
echo "❌ Next.js build failed"
|
|
28
|
-
exit 1
|
|
29
|
-
fi
|
|
30
|
-
cd ..
|
|
31
|
-
echo "🩺 Verifying standalone server (/api/health)..."
|
|
32
|
-
if node scripts/verify-standalone.mjs; then
|
|
33
|
-
echo " ✅ Standalone smoke OK"
|
|
34
|
-
else
|
|
35
|
-
echo "❌ Standalone verify failed (trace / serverExternalPackages?)"
|
|
36
|
-
exit 1
|
|
37
|
-
fi
|
|
38
|
-
# Restore any files modified by next build (e.g. next-env.d.ts)
|
|
39
|
-
git checkout -- . 2>/dev/null || true
|
|
40
|
-
echo ""
|
|
41
|
-
|
|
42
|
-
# 4. Smoke test: pack → install in temp dir → verify CLI works
|
|
43
|
-
echo "🔍 Smoke testing package..."
|
|
44
|
-
SMOKE_DIR=$(mktemp -d)
|
|
45
|
-
TARBALL=$(npm pack --pack-destination "$SMOKE_DIR" 2>/dev/null | tail -1)
|
|
46
|
-
TARBALL_PATH="$SMOKE_DIR/$TARBALL"
|
|
47
|
-
|
|
48
|
-
if [ ! -f "$TARBALL_PATH" ]; then
|
|
49
|
-
echo "❌ npm pack failed — tarball not found"
|
|
50
|
-
rm -rf "$SMOKE_DIR"
|
|
51
|
-
exit 1
|
|
52
|
-
fi
|
|
53
|
-
|
|
54
|
-
TARBALL_SIZE=$(du -sh "$TARBALL_PATH" | cut -f1)
|
|
55
|
-
echo " 📦 Tarball: $TARBALL ($TARBALL_SIZE)"
|
|
56
|
-
|
|
57
|
-
# Install from tarball in isolation (production deps only)
|
|
58
|
-
cd "$SMOKE_DIR"
|
|
59
|
-
npm init -y --silent >/dev/null 2>&1
|
|
60
|
-
npm install "$TARBALL_PATH" --ignore-scripts >/dev/null 2>&1
|
|
61
|
-
|
|
62
|
-
# Verify bin entry exists and is executable
|
|
63
|
-
if [ ! -f "$SMOKE_DIR/node_modules/.bin/mindos" ]; then
|
|
64
|
-
echo "❌ 'mindos' binary not found after install"
|
|
65
|
-
rm -rf "$SMOKE_DIR"
|
|
66
|
-
exit 1
|
|
67
|
-
fi
|
|
68
|
-
|
|
69
|
-
# Verify --version works
|
|
70
|
-
INSTALLED_VERSION=$("$SMOKE_DIR/node_modules/.bin/mindos" --version 2>&1 || true)
|
|
71
|
-
if [ -z "$INSTALLED_VERSION" ]; then
|
|
72
|
-
echo "❌ 'mindos --version' returned empty"
|
|
73
|
-
rm -rf "$SMOKE_DIR"
|
|
74
|
-
exit 1
|
|
75
|
-
fi
|
|
76
|
-
echo " ✅ mindos --version → $INSTALLED_VERSION"
|
|
77
|
-
|
|
78
|
-
# Verify --help works (exits 0, produces output)
|
|
79
|
-
HELP_OUTPUT=$("$SMOKE_DIR/node_modules/.bin/mindos" --help 2>&1 || true)
|
|
80
|
-
if ! echo "$HELP_OUTPUT" | grep -qi "mindos"; then
|
|
81
|
-
echo "❌ 'mindos --help' did not produce expected output"
|
|
82
|
-
rm -rf "$SMOKE_DIR"
|
|
83
|
-
exit 1
|
|
84
|
-
fi
|
|
85
|
-
echo " ✅ mindos --help works"
|
|
86
|
-
|
|
87
|
-
# Verify key files are present in the installed package
|
|
88
|
-
for f in bin/cli.js app/package.json app/next.config.ts skills/mindos/SKILL.md; do
|
|
89
|
-
if [ ! -f "$SMOKE_DIR/node_modules/@geminilight/mindos/$f" ]; then
|
|
90
|
-
echo "❌ Missing file in package: $f"
|
|
91
|
-
rm -rf "$SMOKE_DIR"
|
|
92
|
-
exit 1
|
|
93
|
-
fi
|
|
94
|
-
done
|
|
95
|
-
echo " ✅ Key files present"
|
|
96
|
-
|
|
97
|
-
# Cleanup
|
|
98
|
-
rm -rf "$SMOKE_DIR"
|
|
99
|
-
cd - >/dev/null
|
|
100
|
-
echo " 🟢 Smoke test passed"
|
|
101
|
-
echo ""
|
|
102
|
-
|
|
103
|
-
# 5. Bump version (creates commit + tag automatically)
|
|
104
|
-
echo "📦 Bumping version ($BUMP)..."
|
|
105
|
-
npm version "$BUMP" -m "%s"
|
|
106
|
-
VERSION="v$(node -p "require('./package.json').version")"
|
|
107
|
-
echo " Version: $VERSION"
|
|
108
|
-
echo ""
|
|
109
|
-
|
|
110
|
-
# 6. Push commit + tag
|
|
111
|
-
echo "🚀 Pushing to origin..."
|
|
112
|
-
git push origin main
|
|
113
|
-
git push origin "$VERSION"
|
|
114
|
-
echo ""
|
|
115
|
-
|
|
116
|
-
# 7. Wait for CI
|
|
117
|
-
# Flow: tag push → sync-to-mindos (syncs code + tag to public repo) → public repo publish-npm
|
|
118
|
-
if command -v gh &>/dev/null; then
|
|
119
|
-
echo "⏳ Waiting for sync → publish pipeline..."
|
|
120
|
-
echo " mindos-dev tag push → sync-to-mindos → GeminiLight/MindOS tag → npm publish"
|
|
121
|
-
TIMEOUT=120
|
|
122
|
-
ELAPSED=0
|
|
123
|
-
RUN_ID=""
|
|
124
|
-
|
|
125
|
-
# Watch the sync workflow on mindos-dev
|
|
126
|
-
while [ -z "$RUN_ID" ] && [ "$ELAPSED" -lt 30 ]; do
|
|
127
|
-
sleep 3
|
|
128
|
-
ELAPSED=$((ELAPSED + 3))
|
|
129
|
-
RUN_ID=$(gh run list --workflow=sync-to-mindos.yml --limit=1 --json databaseId,headBranch --jq ".[0].databaseId" 2>/dev/null || true)
|
|
130
|
-
done
|
|
131
|
-
|
|
132
|
-
if [ -n "$RUN_ID" ]; then
|
|
133
|
-
gh run watch "$RUN_ID" --exit-status && echo "✅ Synced $VERSION to GeminiLight/MindOS" || echo "❌ Sync failed — check: gh run view $RUN_ID --log"
|
|
134
|
-
echo " npm publish will be triggered on GeminiLight/MindOS."
|
|
135
|
-
echo " Check: https://github.com/GeminiLight/MindOS/actions"
|
|
136
|
-
else
|
|
137
|
-
echo "⚠️ Could not find CI run. Check manually:"
|
|
138
|
-
echo " Sync: https://github.com/GeminiLight/mindos-dev/actions"
|
|
139
|
-
echo " Publish: https://github.com/GeminiLight/MindOS/actions"
|
|
140
|
-
fi
|
|
141
|
-
else
|
|
142
|
-
echo "💡 Release pipeline: mindos-dev → sync → GeminiLight/MindOS → npm publish"
|
|
143
|
-
echo " Check sync: https://github.com/GeminiLight/mindos-dev/actions"
|
|
144
|
-
echo " Check publish: https://github.com/GeminiLight/MindOS/actions"
|
|
145
|
-
fi
|