@geminilight/mindos 0.1.9 → 0.2.0
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/README.md +39 -9
- package/app/app/api/sync/route.ts +124 -0
- package/app/components/SettingsModal.tsx +3 -0
- package/app/components/settings/SyncTab.tsx +219 -0
- package/app/components/settings/types.ts +1 -1
- package/app/lib/i18n.ts +2 -2
- package/app/lib/settings.ts +1 -1
- package/bin/cli.js +193 -10
- package/bin/lib/config.js +12 -1
- package/bin/lib/sync.js +367 -0
- package/package.json +6 -2
- package/scripts/release.sh +56 -0
- package/scripts/setup.js +23 -5
|
@@ -0,0 +1,56 @@
|
|
|
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. Bump version (creates commit + tag automatically)
|
|
22
|
+
echo "📦 Bumping version ($BUMP)..."
|
|
23
|
+
npm version "$BUMP" -m "%s"
|
|
24
|
+
VERSION="v$(node -p "require('./package.json').version")"
|
|
25
|
+
echo " Version: $VERSION"
|
|
26
|
+
echo ""
|
|
27
|
+
|
|
28
|
+
# 4. Push commit + tag
|
|
29
|
+
echo "🚀 Pushing to origin..."
|
|
30
|
+
git push origin main
|
|
31
|
+
git push origin "$VERSION"
|
|
32
|
+
echo ""
|
|
33
|
+
|
|
34
|
+
# 5. Wait for CI (if gh is available)
|
|
35
|
+
if command -v gh &>/dev/null; then
|
|
36
|
+
echo "⏳ Waiting for CI publish workflow..."
|
|
37
|
+
TIMEOUT=120
|
|
38
|
+
ELAPSED=0
|
|
39
|
+
RUN_ID=""
|
|
40
|
+
|
|
41
|
+
# Wait for the workflow run to appear
|
|
42
|
+
while [ -z "$RUN_ID" ] && [ "$ELAPSED" -lt 30 ]; do
|
|
43
|
+
sleep 3
|
|
44
|
+
ELAPSED=$((ELAPSED + 3))
|
|
45
|
+
RUN_ID=$(gh run list --workflow=publish-npm.yml --limit=1 --json databaseId,headBranch --jq ".[0].databaseId" 2>/dev/null || true)
|
|
46
|
+
done
|
|
47
|
+
|
|
48
|
+
if [ -n "$RUN_ID" ]; then
|
|
49
|
+
gh run watch "$RUN_ID" --exit-status && echo "✅ Published $VERSION to npm" || echo "❌ CI failed — check: gh run view $RUN_ID --log"
|
|
50
|
+
else
|
|
51
|
+
echo "⚠️ Could not find CI run. Check manually: https://github.com/GeminiLight/mindos-dev/actions"
|
|
52
|
+
fi
|
|
53
|
+
else
|
|
54
|
+
echo "💡 Install 'gh' CLI to auto-watch CI status."
|
|
55
|
+
echo " Check publish status: https://github.com/GeminiLight/mindos-dev/actions"
|
|
56
|
+
fi
|
package/scripts/setup.js
CHANGED
|
@@ -44,8 +44,8 @@ const T = {
|
|
|
44
44
|
// step labels
|
|
45
45
|
step: { en: (n, total) => `Step ${n}/${total}`, zh: (n, total) => `步骤 ${n}/${total}` },
|
|
46
46
|
stepTitles: {
|
|
47
|
-
en: ['Knowledge Base', 'Template', 'Ports', 'Auth Token', 'Web Password', 'AI Provider'],
|
|
48
|
-
zh: ['知识库', '模板', '端口', 'Auth Token', 'Web 密码', 'AI 服务商'],
|
|
47
|
+
en: ['Knowledge Base', 'Template', 'Ports', 'Auth Token', 'Web Password', 'AI Provider', 'Start Mode'],
|
|
48
|
+
zh: ['知识库', '模板', '端口', 'Auth Token', 'Web 密码', 'AI 服务商', '启动方式'],
|
|
49
49
|
},
|
|
50
50
|
|
|
51
51
|
// path
|
|
@@ -97,6 +97,12 @@ const T = {
|
|
|
97
97
|
|
|
98
98
|
// config
|
|
99
99
|
cfgExists: { en: (p) => `${p} already exists. Overwrite?`, zh: (p) => `${p} 已存在,是否覆盖?` },
|
|
100
|
+
|
|
101
|
+
// start mode
|
|
102
|
+
startModePrompt: { en: 'Start Mode', zh: '启动方式' },
|
|
103
|
+
startModeOpts: { en: ['Background service (recommended, auto-start on boot)', 'Foreground (manual start each time)'], zh: ['后台服务(推荐,开机自启)', '前台运行(每次手动启动)'] },
|
|
104
|
+
startModeVals: ['daemon', 'start'],
|
|
105
|
+
startModeSkip: { en: ' → Daemon not supported on this platform, using foreground mode', zh: ' → 当前平台不支持后台服务,使用前台模式' },
|
|
100
106
|
cfgKept: { en: '✔ Keeping existing config', zh: '✔ 保留现有配置' },
|
|
101
107
|
cfgKeptNote: { en: ' Settings from this session were not saved', zh: ' 本次填写的设置未保存' },
|
|
102
108
|
cfgSaved: { en: '✔ Config saved', zh: '✔ 配置已保存' },
|
|
@@ -153,7 +159,7 @@ const tf = (key, ...args) => {
|
|
|
153
159
|
|
|
154
160
|
// ── Step header ───────────────────────────────────────────────────────────────
|
|
155
161
|
|
|
156
|
-
const TOTAL_STEPS =
|
|
162
|
+
const TOTAL_STEPS = 7;
|
|
157
163
|
function stepHeader(n) {
|
|
158
164
|
const title = T.stepTitles[uiLang][n - 1] ?? T.stepTitles.en[n - 1];
|
|
159
165
|
const stepLabel = tf('step', n, TOTAL_STEPS);
|
|
@@ -639,13 +645,25 @@ async function main() {
|
|
|
639
645
|
}
|
|
640
646
|
}
|
|
641
647
|
|
|
648
|
+
// ── Step 7: Start Mode ──────────────────────────────────────────────────
|
|
649
|
+
write('\n');
|
|
650
|
+
stepHeader(7);
|
|
651
|
+
|
|
652
|
+
let startMode = 'start';
|
|
653
|
+
const daemonPlatform = process.platform === 'darwin' || process.platform === 'linux';
|
|
654
|
+
if (daemonPlatform) {
|
|
655
|
+
startMode = await select('startModePrompt', 'startModeOpts', 'startModeVals');
|
|
656
|
+
} else {
|
|
657
|
+
write(c.dim(t('startModeSkip') + '\n'));
|
|
658
|
+
}
|
|
659
|
+
|
|
642
660
|
const config = {
|
|
643
661
|
mindRoot: mindDir,
|
|
644
662
|
port: webPort,
|
|
645
663
|
mcpPort: mcpPort,
|
|
646
664
|
authToken: authToken,
|
|
647
665
|
webPassword: webPassword || '',
|
|
648
|
-
startMode:
|
|
666
|
+
startMode: startMode,
|
|
649
667
|
ai: {
|
|
650
668
|
provider: isSkip ? existingAiProvider : (isAnthropic ? 'anthropic' : 'openai'),
|
|
651
669
|
providers: existingProviders,
|
|
@@ -656,7 +674,7 @@ async function main() {
|
|
|
656
674
|
writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2) + '\n');
|
|
657
675
|
console.log(`\n${c.green(t('cfgSaved'))}: ${c.dim(CONFIG_PATH)}`);
|
|
658
676
|
|
|
659
|
-
const installDaemon = process.argv.includes('--install-daemon');
|
|
677
|
+
const installDaemon = startMode === 'daemon' || process.argv.includes('--install-daemon');
|
|
660
678
|
finish(mindDir, config.startMode, config.mcpPort, config.authToken, installDaemon);
|
|
661
679
|
}
|
|
662
680
|
|