MCPcopy
hub / github.com/afar1/fieldtheory-cli / classifyNew

Function classifyNew

src/cli.ts:781–812  ·  view source on GitHub ↗
(override?: string)

Source from the content-addressed store, hash-verified

779 }
780
781 async function classifyNew(override?: string): Promise<void> {
782 const engine = await resolveEngine({ override });
783
784 const start = Date.now();
785 process.stderr.write(' Classifying new bookmarks (categories)...\n');
786 const catResult = await classifyWithLlm({
787 engine,
788 onBatch: (done: number, total: number) => {
789 const pct = total > 0 ? Math.round((done / total) * 100) : 0;
790 const elapsed = Math.round((Date.now() - start) / 1000);
791 process.stderr.write(` Categories: ${done}/${total} (${pct}%) \u2502 ${elapsed}s elapsed\n`);
792 },
793 });
794 if (catResult.classified > 0) {
795 process.stderr.write(` \u2713 ${catResult.classified} categorized\n`);
796 }
797
798 const domStart = Date.now();
799 process.stderr.write(' Classifying new bookmarks (domains)...\n');
800 const domResult = await classifyDomainsWithLlm({
801 engine,
802 all: false,
803 onBatch: (done: number, total: number) => {
804 const pct = total > 0 ? Math.round((done / total) * 100) : 0;
805 const elapsed = Math.round((Date.now() - domStart) / 1000);
806 process.stderr.write(` Domains: ${done}/${total} (${pct}%) \u2502 ${elapsed}s elapsed\n`);
807 },
808 });
809 if (domResult.classified > 0) {
810 process.stderr.write(` \u2713 ${domResult.classified} domains assigned\n`);
811 }
812 }
813
814 program
815 .name('ft')

Callers 1

buildCliFunction · 0.85

Calls 4

resolveEngineFunction · 0.85
classifyWithLlmFunction · 0.85
classifyDomainsWithLlmFunction · 0.85
writeMethod · 0.80

Tested by

no test coverage detected