mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-18 18:04:17 +00:00
fix(sync): isolate extension modules and condense diagnostics
Keep bundled CommonJS converters working inside ESM projects. Show concise sync failures with expandable original diagnostics and clarify that the last-sync card covers skills and agents only.
This commit is contained in:
+15
-1
@@ -36,9 +36,23 @@ Each reference extension is self-contained. Copy the whole directory when you wa
|
||||
extensions/gemini-commands/
|
||||
├── extension.yaml
|
||||
├── convert.js
|
||||
└── md-toml.js
|
||||
├── md-toml.js
|
||||
└── package.json
|
||||
```
|
||||
|
||||
The Codex and Gemini converters use CommonJS. Each includes a `package.json`
|
||||
with `"type": "commonjs"` so both `convert.js` and `md-toml.js` work when installed
|
||||
inside a project whose own `package.json` declares `"type": "module"`. Keep this
|
||||
file when copying an extension. OpenCode's converter uses no CommonJS APIs and
|
||||
works in either module scope.
|
||||
|
||||
Dashboard installation downloads the complete `extensions/<name>/` directory
|
||||
from the `runkids/skillshare` repository via the GitHub contents API. Updating
|
||||
the Skillshare binary does not update already installed extension files. To
|
||||
repair an older Codex or Gemini installation, add `package.json` containing
|
||||
`{"type":"commonjs"}` inside that extension's own directory, preserving any
|
||||
existing package fields. The project's root `package.json` does not need to change.
|
||||
|
||||
`extension.yaml` tells Skillshare how to run the extension:
|
||||
|
||||
```yaml
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
@@ -590,6 +590,45 @@ func TestBundledOpencodeAgentExtension_RequiresDescription(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBundledExtensions_InModuleProject(t *testing.T) {
|
||||
requireNode(t)
|
||||
root := testRepoRoot(t)
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
want string
|
||||
}{
|
||||
{"codex-agents", "developer_instructions = \"\"\"\nUse $ARGUMENTS\n\"\"\""},
|
||||
{"gemini-commands", "prompt = \"\"\"\nUse {{args}}\n\"\"\""},
|
||||
{"opencode-agents", "mode: subagent\n---\nUse $ARGUMENTS\n"},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
project := t.TempDir()
|
||||
if err := os.WriteFile(filepath.Join(project, "package.json"), []byte(`{"type":"module"}`), 0644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
extDir := filepath.Join(project, ".skillshare", "extensions", tc.name)
|
||||
if err := os.CopyFS(extDir, os.DirFS(filepath.Join(root, "extensions", tc.name))); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
spec, err := LoadExtensionSpec(extDir, tc.name)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
src := filepath.Join(project, "reviewer.md")
|
||||
if err := os.WriteFile(src, []byte("---\ndescription: Review code\n---\nUse $ARGUMENTS\n"), 0644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
out, err := runExtension(spec, src, map[string]string{"SS_REL_PATH": "reviewer.md"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.Contains(string(out), tc.want) {
|
||||
t.Fatalf("output = %q, want %q", out, tc.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func runBundledCodexAgentExtension(t *testing.T, input string) (string, error) {
|
||||
t.Helper()
|
||||
return runBundledExtension(t, "codex-agents", input)
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { useId, useState } from 'react';
|
||||
import { ChevronDown, ChevronRight } from 'lucide-react';
|
||||
import CopyButton from '../CopyButton';
|
||||
import { useT } from '../../i18n';
|
||||
|
||||
/** Keep external diagnostics intact, but do not inline an entire stack trace. */
|
||||
export default function SyncError({ error }: { error: string }) {
|
||||
const t = useT();
|
||||
const id = useId();
|
||||
const [open, setOpen] = useState(false);
|
||||
const lines = error.trim().split(/\r?\n/);
|
||||
const first = lines.find((line) => /^\s*[\w.]*Error:\s/.test(line))?.trim() || lines[0];
|
||||
const summary = first.length > 240 ? `${first.slice(0, 240)}…` : first;
|
||||
const condensed = summary !== error.trim();
|
||||
return (
|
||||
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
||||
<span className="break-words font-mono text-[12px] text-ink-2">{summary}</span>
|
||||
{condensed && (
|
||||
<>
|
||||
<button type="button" className="ss-btn ghost sm self-start" aria-expanded={open} aria-controls={id} onClick={() => setOpen(!open)}>
|
||||
{open ? <ChevronDown size={14} /> : <ChevronRight size={14} />}
|
||||
{t(open ? 'sync.error.hideDetails' : 'sync.error.showDetails')}
|
||||
</button>
|
||||
{open && (
|
||||
<div id={id} className="ss-pre min-w-0">
|
||||
<div className="mb-1 flex justify-end">
|
||||
<CopyButton value={error} unstyled className="ss-btn ghost sm" title={t('common.copy')} label={t('common.copy')} copiedLabel={t('doctor.copied')} errorMessage={t('memory.copyFailed')} />
|
||||
</div>
|
||||
<pre className="max-h-64 overflow-auto whitespace-pre-wrap break-words" tabIndex={0} aria-label={t('sync.error.showDetails')}>{error}</pre>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import AgentIcon from '../AgentIcon';
|
||||
import Button from '../Button';
|
||||
import { useT } from '../../i18n';
|
||||
import { failureExplanation, type SyncFailure } from './syncView';
|
||||
import SyncError from './SyncError';
|
||||
|
||||
const PART_TAG: Record<SyncFailure['part'], string> = { skill: 'Skills', agent: 'Agents', extra: 'Extras', config: 'Config' };
|
||||
|
||||
@@ -40,7 +41,7 @@ export default function SyncResult({ failures, warnings, synced, force, onForce
|
||||
<span className="ss-tag">{f.extra ? `${PART_TAG[f.part]} · ${f.extra}` : PART_TAG[f.part]}</span>
|
||||
</div>
|
||||
<Explanation failure={f} />
|
||||
<span className="break-words font-mono text-[12px] text-ink-2">{f.error}</span>
|
||||
<SyncError error={f.error} />
|
||||
</div>
|
||||
{f.conflict && !force && onForce ? (
|
||||
<Button size="sm" variant="secondary" onClick={onForce} title={t('sync.forceHint')}>{t('sync.result.useForce')}</Button>
|
||||
|
||||
@@ -1805,7 +1805,10 @@
|
||||
"sync.forceHint": "Dateien ersetzen, die in einem Ziel bearbeitet wurden",
|
||||
"sync.folderConflict.text": "{names} synchronisieren Skills mit unterschiedlichen Filtern in denselben Ordner {path}, sodass jede Synchronisierung die andere rückgängig macht.",
|
||||
"sync.folderConflict.stop": "Skills für {name} nicht mehr synchronisieren",
|
||||
"sync.last.title": "Letzte Synchronisierung",
|
||||
"sync.error.showDetails": "Diagnose anzeigen",
|
||||
"sync.error.hideDetails": "Diagnose ausblenden",
|
||||
"sync.last.title": "Letzte Skills-/Agents-Sync",
|
||||
"sync.last.scope": "Nur Skills und Agents. Extras, MCP und Hooks haben separate Synchronisierungslogs.",
|
||||
"sync.last.when": "Wann",
|
||||
"sync.last.targets": "Ziele",
|
||||
"sync.last.took": "Dauer",
|
||||
|
||||
@@ -1805,7 +1805,10 @@
|
||||
"sync.forceHint": "Replace files that were edited inside a target",
|
||||
"sync.folderConflict.text": "{names} sync skills to the same folder {path} with different filters, so each sync undoes the other.",
|
||||
"sync.folderConflict.stop": "Stop syncing skills for {name}",
|
||||
"sync.last.title": "Last sync",
|
||||
"sync.error.showDetails": "Show diagnostics",
|
||||
"sync.error.hideDetails": "Hide diagnostics",
|
||||
"sync.last.title": "Last skills and agents sync",
|
||||
"sync.last.scope": "Skills and agents only. Extras, MCP and Hooks have separate sync logs.",
|
||||
"sync.last.when": "When",
|
||||
"sync.last.targets": "Targets",
|
||||
"sync.last.took": "Took",
|
||||
|
||||
@@ -1805,7 +1805,10 @@
|
||||
"sync.forceHint": "Reemplazar archivos editados dentro de un destino",
|
||||
"sync.folderConflict.text": "{names} sincronizan skills en la misma carpeta {path} con filtros distintos, así que cada sincronización deshace la otra.",
|
||||
"sync.folderConflict.stop": "Dejar de sincronizar skills con {name}",
|
||||
"sync.last.title": "Última sincronización",
|
||||
"sync.error.showDetails": "Mostrar diagnóstico",
|
||||
"sync.error.hideDetails": "Ocultar diagnóstico",
|
||||
"sync.last.title": "Última sync de skills y agents",
|
||||
"sync.last.scope": "Solo skills y agents. Extras, MCP y Hooks tienen logs de sincronización independientes.",
|
||||
"sync.last.when": "Cuándo",
|
||||
"sync.last.targets": "Destinos",
|
||||
"sync.last.took": "Duración",
|
||||
|
||||
@@ -1805,7 +1805,10 @@
|
||||
"sync.forceHint": "فایلهایی را که داخل هدف ویرایش شدهاند جایگزین کن",
|
||||
"sync.folderConflict.text": "{names} Skills را با فیلترهای متفاوت در یک پوشه ({path}) همگامسازی میکنند، بنابراین هر همگامسازی کار دیگری را خنثی میکند.",
|
||||
"sync.folderConflict.stop": "توقف همگامسازی Skills برای {name}",
|
||||
"sync.last.title": "آخرین همگامسازی",
|
||||
"sync.error.showDetails": "نمایش جزئیات عیبیابی",
|
||||
"sync.error.hideDetails": "پنهان کردن جزئیات عیبیابی",
|
||||
"sync.last.title": "آخرین همگامسازی skills و agents",
|
||||
"sync.last.scope": "فقط Skills و agents. Extras، MCP و Hooks گزارش همگامسازی جداگانه دارند.",
|
||||
"sync.last.when": "زمان",
|
||||
"sync.last.targets": "هدفها",
|
||||
"sync.last.took": "مدت",
|
||||
|
||||
@@ -1805,7 +1805,10 @@
|
||||
"sync.forceHint": "Remplacer les fichiers modifiés dans une cible",
|
||||
"sync.folderConflict.text": "{names} synchronisent les skills dans le même dossier {path} avec des filtres différents : chaque synchronisation annule l’autre.",
|
||||
"sync.folderConflict.stop": "Arrêter de synchroniser les skills vers {name}",
|
||||
"sync.last.title": "Dernière synchronisation",
|
||||
"sync.error.showDetails": "Afficher le diagnostic",
|
||||
"sync.error.hideDetails": "Masquer le diagnostic",
|
||||
"sync.last.title": "Dernière synchro skills et agents",
|
||||
"sync.last.scope": "Skills et agents uniquement. Extras, MCP et Hooks ont des logs de synchronisation distincts.",
|
||||
"sync.last.when": "Quand",
|
||||
"sync.last.targets": "Cibles",
|
||||
"sync.last.took": "Durée",
|
||||
|
||||
@@ -1805,7 +1805,10 @@
|
||||
"sync.forceHint": "Ganti file yang diedit di dalam target",
|
||||
"sync.folderConflict.text": "{names} menyinkronkan skill ke folder yang sama {path} dengan filter berbeda, sehingga setiap sinkronisasi membatalkan yang lain.",
|
||||
"sync.folderConflict.stop": "Berhenti menyinkronkan skill ke {name}",
|
||||
"sync.last.title": "Sinkronisasi terakhir",
|
||||
"sync.error.showDetails": "Tampilkan diagnostik",
|
||||
"sync.error.hideDetails": "Sembunyikan diagnostik",
|
||||
"sync.last.title": "Sync skills dan agents terakhir",
|
||||
"sync.last.scope": "Hanya skills dan agents. Extras, MCP, dan Hooks memiliki log sinkronisasi terpisah.",
|
||||
"sync.last.when": "Kapan",
|
||||
"sync.last.targets": "Target",
|
||||
"sync.last.took": "Durasi",
|
||||
|
||||
@@ -1805,7 +1805,10 @@
|
||||
"sync.forceHint": "ターゲット内で編集されたファイルを置き換えます",
|
||||
"sync.folderConflict.text": "{names} は同じフォルダ {path} に異なるフィルターで Skills を同期しているため、同期のたびに互いの結果を打ち消します。",
|
||||
"sync.folderConflict.stop": "{name} の Skills の同期を停止",
|
||||
"sync.last.title": "前回の同期",
|
||||
"sync.error.showDetails": "診断情報を表示",
|
||||
"sync.error.hideDetails": "診断情報を隠す",
|
||||
"sync.last.title": "前回の skills・agents 同期",
|
||||
"sync.last.scope": "Skills と agents のみ。Extras、MCP、Hooks の同期ログは別に記録されます。",
|
||||
"sync.last.when": "日時",
|
||||
"sync.last.targets": "ターゲット",
|
||||
"sync.last.took": "所要時間",
|
||||
|
||||
@@ -1805,7 +1805,10 @@
|
||||
"sync.forceHint": "대상 안에서 수정된 파일을 교체합니다",
|
||||
"sync.folderConflict.text": "{names}이(가) 같은 폴더 {path}에 서로 다른 필터로 Skills를 동기화해서, 동기화할 때마다 서로의 결과를 되돌립니다.",
|
||||
"sync.folderConflict.stop": "{name}의 Skills 동기화 중지",
|
||||
"sync.last.title": "마지막 동기화",
|
||||
"sync.error.showDetails": "진단 표시",
|
||||
"sync.error.hideDetails": "진단 숨기기",
|
||||
"sync.last.title": "마지막 skills 및 agents 동기화",
|
||||
"sync.last.scope": "Skills와 agents만 포함합니다. Extras, MCP, Hooks에는 별도의 동기화 로그가 있습니다.",
|
||||
"sync.last.when": "시간",
|
||||
"sync.last.targets": "대상",
|
||||
"sync.last.took": "소요 시간",
|
||||
|
||||
@@ -1805,7 +1805,10 @@
|
||||
"sync.forceHint": "Substituir arquivos editados dentro de um destino",
|
||||
"sync.folderConflict.text": "{names} sincronizam skills na mesma pasta {path} com filtros diferentes, então cada sincronização desfaz a outra.",
|
||||
"sync.folderConflict.stop": "Parar de sincronizar skills com {name}",
|
||||
"sync.last.title": "Última sincronização",
|
||||
"sync.error.showDetails": "Mostrar diagnóstico",
|
||||
"sync.error.hideDetails": "Ocultar diagnóstico",
|
||||
"sync.last.title": "Última sync de skills e agents",
|
||||
"sync.last.scope": "Apenas skills e agents. Extras, MCP e Hooks têm logs de sincronização separados.",
|
||||
"sync.last.when": "Quando",
|
||||
"sync.last.targets": "Destinos",
|
||||
"sync.last.took": "Duração",
|
||||
|
||||
@@ -1805,7 +1805,10 @@
|
||||
"sync.forceHint": "替换在目标中修改过的文件",
|
||||
"sync.folderConflict.text": "{names} 同步到同一个文件夹 {path},但筛选不同,每次同步都会互相加回、删掉。",
|
||||
"sync.folderConflict.stop": "停止同步 {name} 的 Skills",
|
||||
"sync.last.title": "上次同步",
|
||||
"sync.error.showDetails": "显示诊断信息",
|
||||
"sync.error.hideDetails": "隐藏诊断信息",
|
||||
"sync.last.title": "上次 skills 与 agents 同步",
|
||||
"sync.last.scope": "仅包含 skills 与 agents。Extras、MCP 与 Hooks 各有独立的同步日志。",
|
||||
"sync.last.when": "时间",
|
||||
"sync.last.targets": "目标",
|
||||
"sync.last.took": "耗时",
|
||||
|
||||
@@ -1805,7 +1805,10 @@
|
||||
"sync.forceHint": "取代在目標中修改過的檔案",
|
||||
"sync.folderConflict.text": "{names} 同步到同一個資料夾 {path},但篩選不同,每次同步都會互相加回、刪掉。",
|
||||
"sync.folderConflict.stop": "停止同步 {name} 的 Skills",
|
||||
"sync.last.title": "上次同步",
|
||||
"sync.error.showDetails": "顯示診斷資訊",
|
||||
"sync.error.hideDetails": "隱藏診斷資訊",
|
||||
"sync.last.title": "上次 skills 與 agents 同步",
|
||||
"sync.last.scope": "僅包含 skills 與 agents。Extras、MCP 與 Hooks 各有獨立的同步日誌。",
|
||||
"sync.last.when": "時間",
|
||||
"sync.last.targets": "目標",
|
||||
"sync.last.took": "耗時",
|
||||
|
||||
@@ -13,7 +13,7 @@ import SyncPage from './SyncPage';
|
||||
|
||||
vi.mock('../api/client', async (load) => ({
|
||||
...await load<typeof import('../api/client')>(),
|
||||
api: { listTargets: vi.fn(), diff: vi.fn(), diffExtras: vi.fn(), listLog: vi.fn(), skillsOffPreview: vi.fn(), updateTarget: vi.fn() },
|
||||
api: { listTargets: vi.fn(), diff: vi.fn(), diffExtras: vi.fn(), listLog: vi.fn(), skillsOffPreview: vi.fn(), updateTarget: vi.fn(), sync: vi.fn(), syncExtras: vi.fn() },
|
||||
}));
|
||||
vi.mock('../api/mcp', async (load) => ({ ...await load<typeof import('../api/mcp')>(), mcpApi: { list: vi.fn() } }));
|
||||
vi.mock('../api/hooks', async (load) => ({ ...await load<typeof import('../api/hooks')>(), hooksApi: { list: vi.fn(() => Promise.reject(new Error('offline'))) } }));
|
||||
@@ -80,6 +80,60 @@ describe('Sync page last sync', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Sync page failure diagnostics', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
vi.mocked(api.listTargets).mockResolvedValue({ targets: [target('codex')], sourceSkillCount: 3 });
|
||||
vi.mocked(api.diff).mockResolvedValue({ diffs: [], ignored_count: 0, ignored_skills: [], ignore_root: '', ignore_repos: [] });
|
||||
vi.mocked(api.diffExtras).mockResolvedValue({ extras: [{ name: 'agents', target: '/home/me/.codex/agents', mode: 'copy', synced: false, items: [{ action: 'create', file: 'one.md', reason: 'missing' }] }] });
|
||||
vi.mocked(api.listLog).mockResolvedValue({ entries: [{ ts: '2026-09-30T00:00:00Z', cmd: 'sync', status: 'ok', args: { targets_total: 1 } }] } as never);
|
||||
vi.mocked(api.sync).mockResolvedValue({ results: [], ignored_count: 0, ignored_skills: [], ignore_root: '', ignore_repos: [] });
|
||||
vi.mocked(mcpApi.list).mockResolvedValue({ paths: {}, source: { targets: [], servers: {} } } as never);
|
||||
vi.mocked(hooksApi.list).mockRejectedValue(new Error('offline'));
|
||||
});
|
||||
|
||||
const renderPage = () => render(
|
||||
<MemoryRouter>
|
||||
<QueryClientProvider client={new QueryClient()}><I18nProvider><ToastProvider><SyncPage /></ToastProvider></I18nProvider></QueryClientProvider>
|
||||
</MemoryRouter>,
|
||||
);
|
||||
|
||||
it('summarizes repeated stacks, expands and copies every diagnostic, and scopes the resource OK', async () => {
|
||||
const reason = 'ReferenceError: require is not defined in ES module scope';
|
||||
const errors = Array.from({ length: 5 }, (_, i) => `${i}.md: extension codex-agents failed: exit status 1\nfile:///extensions/codex-agents:4\nconst fs = require("fs");\n${reason}\n at file:///extensions/codex-agents:4:12\n at ModuleJob.run (node:internal/modules/esm/module_job:343:25)`);
|
||||
vi.mocked(api.syncExtras).mockResolvedValue({ extras: [{ name: 'agents', targets: [{ target: '/home/me/.codex/agents', mode: 'copy', synced: 0, skipped: 0, pruned: 0, errors }] }] });
|
||||
const user = userEvent.setup();
|
||||
renderPage();
|
||||
await user.click(await screen.findByRole('button', { name: 'Sync 1 change' }));
|
||||
expect(await screen.findByText(reason)).toBeInTheDocument();
|
||||
expect(screen.getByRole('heading', { name: '1 target failed' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('heading', { name: 'Last skills and agents sync' }).parentElement).toHaveTextContent('OK');
|
||||
expect(screen.getByText(/Skills and agents only/)).toBeInTheDocument();
|
||||
const show = screen.getByRole('button', { name: 'Show diagnostics' });
|
||||
expect(show).toHaveAttribute('aria-expanded', 'false');
|
||||
expect(document.querySelector('pre')).toBeNull();
|
||||
await user.click(show);
|
||||
const detail = screen.getByLabelText('Show diagnostics');
|
||||
expect(detail.textContent).toBe(errors.join('; '));
|
||||
expect(detail).toHaveClass('max-h-64', 'overflow-auto');
|
||||
await user.click(screen.getByRole('button', { name: 'Copy' }));
|
||||
expect(await navigator.clipboard.readText()).toBe(errors.join('; '));
|
||||
await user.click(screen.getByRole('button', { name: 'Hide diagnostics' }));
|
||||
expect(document.querySelector('pre')).toBeNull();
|
||||
expect(screen.getByText(reason)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows a normal short error without an unnecessary disclosure', async () => {
|
||||
vi.mocked(api.syncExtras).mockResolvedValue({ extras: [{ name: 'agents', targets: [{ target: '/home/me/.codex/agents', mode: 'copy', synced: 0, skipped: 0, pruned: 0, error: 'permission denied' }] }] });
|
||||
const user = userEvent.setup();
|
||||
renderPage();
|
||||
await user.click(await screen.findByRole('button', { name: 'Sync 1 change' }));
|
||||
expect(await screen.findByText('permission denied')).toBeInTheDocument();
|
||||
expect(screen.getByText(/Check the folder's permissions/)).toBeInTheDocument();
|
||||
expect(screen.queryByRole('button', { name: 'Show diagnostics' })).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Sync page hooks conflicts', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
||||
@@ -16,6 +16,7 @@ import MCPNotices from '../components/mcp/MCPNotices';
|
||||
import { describeMessage, mcpClient, targetLabel } from '../components/mcp/mcpView';
|
||||
import { countChanges, countEdited, extraGroups, groupByFolder, groupInSync, HOOKS_CHANGED, hooksGroups, MCP_CHANGED, mcpGroups, otherWarnings, resourceGroups, runSync, type ChangeGroup, type Part, type RowIcon, type SyncFailure } from '../components/sync/syncView';
|
||||
import SyncResult from '../components/sync/SyncResult';
|
||||
import SyncError from '../components/sync/SyncError';
|
||||
import SkillsOffDialog from '../components/targets/SkillsOffDialog';
|
||||
import { joinList, refreshTargets } from '../components/targets/targetView';
|
||||
import { formatDateTime, formatRelativeTime, useI18n, useT } from '../i18n';
|
||||
@@ -194,7 +195,7 @@ export default function SyncPage() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{runError && <div className="ss-note bad"><AlertCircle size={16} /><span className="flex-1">{runError}</span></div>}
|
||||
{runError && <div className="ss-note bad"><AlertCircle size={16} /><SyncError key={runError} error={runError} /></div>}
|
||||
{parts.has('mcp') && plan?.blocked && (
|
||||
<div className="ss-note warn !items-center">
|
||||
<TriangleAlert size={16} />
|
||||
@@ -210,8 +211,8 @@ export default function SyncPage() {
|
||||
</div>
|
||||
)}
|
||||
{parts.has('mcp') && <MCPNotices notices={plan?.notices} />}
|
||||
{parts.has('hooks') && hooks.data?.previewError && <div className="ss-note bad"><AlertCircle size={16} /><span className="flex-1">{hooks.data.previewError}</span></div>}
|
||||
{parts.has('mcp') && mcp.data?.previewError && <div className="ss-note bad"><AlertCircle size={16} /><span className="flex-1">{mcp.data.previewError}</span></div>}
|
||||
{parts.has('hooks') && hooks.data?.previewError && <div className="ss-note bad"><AlertCircle size={16} /><SyncError error={hooks.data.previewError} /></div>}
|
||||
{parts.has('mcp') && mcp.data?.previewError && <div className="ss-note bad"><AlertCircle size={16} /><SyncError error={mcp.data.previewError} /></div>}
|
||||
<SyncResult failures={failures} warnings={otherWarnings(outcome)} synced={syncedTargets} force={force} onForce={() => setForce(true)} />
|
||||
{!!outcome?.path_overlap && (
|
||||
<div className="ss-note warn !items-center">
|
||||
@@ -236,7 +237,7 @@ export default function SyncPage() {
|
||||
{loading ? (
|
||||
<div className="ss-r gap-2 text-[13px] text-ink-2"><Spinner size="sm" />{t('sync.checking')}</div>
|
||||
) : diff.error ? (
|
||||
<div className="ss-r text-[13px] text-bad"><AlertCircle size={16} />{diff.error.message}</div>
|
||||
<div className="ss-r text-[13px] text-bad"><AlertCircle size={16} /><SyncError error={diff.error.message} /></div>
|
||||
) : diffs.length === 0 && groups.length === 0 ? (
|
||||
<div className="ss-r text-[13px] text-ink-2">
|
||||
<span className="flex-1">{t('sync.noTargets')}</span>
|
||||
@@ -396,6 +397,7 @@ export default function SyncPage() {
|
||||
<h3 className="text-[15px] font-semibold">{t('sync.last.title')}</h3>
|
||||
{last && <span className={`ss-st ${last.status === 'ok' ? 'ok' : last.status === 'partial' ? 'warn' : 'bad'}`}>{last.status === 'ok' ? 'OK' : last.status}</span>}
|
||||
</div>
|
||||
<p className="text-[12px] text-ink-3">{t('sync.last.scope')}</p>
|
||||
{last ? (
|
||||
<dl className="ss-kv !grid-cols-[80px_minmax(0,1fr)]">
|
||||
<dt>{t('sync.last.when')}</dt>
|
||||
@@ -409,7 +411,7 @@ export default function SyncPage() {
|
||||
</>
|
||||
)}
|
||||
{typeof last.ms === 'number' && <><dt>{t('sync.last.took')}</dt><dd className="font-mono">{(last.ms / 1000).toFixed(1)} s</dd></>}
|
||||
{last.msg && <><dt>{t('sync.last.error')}</dt><dd className="break-words text-bad">{last.msg}</dd></>}
|
||||
{last.msg && <><dt>{t('sync.last.error')}</dt><dd className="min-w-0 text-bad"><SyncError error={last.msg} /></dd></>}
|
||||
</dl>
|
||||
) : (
|
||||
<p className="text-[13px] text-ink-2">{t('sync.last.never')}</p>
|
||||
|
||||
Reference in New Issue
Block a user