Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/import-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,9 @@ export async function importFromRepo(opts: ImportFromRepoOptions): Promise<void>
const existing = await fs.readFile(overviewPath, 'utf8').catch(() => '');
const aiNarrative = codebaseMd.replace(/^---[\s\S]*?---\n*/m, '');
const marker = '## AI Architecture Narrative';
const markerIdx = existing.indexOf(marker);
const oldMarker = '## AI 架构叙事';
let markerIdx = existing.indexOf(marker);
if (markerIdx < 0) markerIdx = existing.indexOf(oldMarker);
const base = markerIdx >= 0 ? existing.slice(0, markerIdx).trimEnd() : existing.trimEnd();
let combined: string;
if (!base || !base.startsWith('---')) {
Expand Down
13 changes: 7 additions & 6 deletions src/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { importFromRepo } from './import-repo.js';
import { importFromRepoList } from './import-repo-list.js';
import { importFromOrg } from './import-org.js';
import { importFromIWikiDual } from './iwiki-dual.js';
import { GlobalOptions } from './types.js';
import type { GlobalOptions, LearningDraft } from './types.js';
import { Listr, PRESET_TIMER } from 'listr2';
import { log } from './utils/logger.js';
import { log, setSilent } from './utils/logger.js';
import { autoPushTeamRepo } from './utils/git.js';

/**
Expand Down Expand Up @@ -235,7 +235,7 @@ export async function importCmd(opts: ImportOptions): Promise<void> {
task.skip('No existing evidence for this repo');
}
} catch (e) {
task.output = `Failed (non-blocking): ${(e as Error).message}`;
task.title = `Incremental update skipped: ${(e as Error).message}`;
}
},
rendererOptions: { persistentOutput: true },
Expand All @@ -256,10 +256,11 @@ export async function importCmd(opts: ImportOptions): Promise<void> {
},
], {
rendererOptions: { timer: PRESET_TIMER, collapseErrors: false },
exitOnError: false,
ctx: { learning: undefined as unknown, repoUrl: '' as string, didUpdate: false as boolean },
exitOnError: true,
ctx: { learning: undefined as LearningDraft | undefined, repoUrl: '', didUpdate: false },
});
await tasks.run();
setSilent(true);
try { await tasks.run(); } finally { setSilent(false); }
} else if (opts.dir) {
// 分支 3:--dir <path>,代码知识提取(等同于 --from-repo 但跳过 clone)
const dirPath = path.resolve(opts.dir);
Expand Down
Loading