Handbooks
संदर्भ

पैकेज सूचकांक

ग्यारह npm पैकेज, हर एक क्या export करता है, और इनमें से कौन बिना किसी LLM के काम करते हैं।

Handbooks ग्यारह पैकेजों का monorepo है। इनमें से चार कभी किसी LLM को नहीं छूते और अपने आप में पूरी तरह उपयोगी हैं।

पैकेजभूमिकाLLM?दस्तावेज़
@handbooks/coreडेटा मॉडल, zod schemas, config registry, utilitiesREADME
@handbooks/analyzerबहु-भाषी static call graph निष्कर्षणREADME
@handbooks/llmOpenAI-संगत client, cache, actor–critic, mockREADME
@handbooks/pipelinegeneration pipeline, phases 1–3README
@handbooks/rendererMarkdown, HTML, agent index, llms.txtREADME
@handbooks/skillSKILL पैकेजिंग, सत्यापन, drift hashesREADME
@handbooks/plannerकेवल पढ़ने वाला planning agentREADME
@handbooks/patcherByte-सटीक apply, बैकअप, rollbackREADME
@handbooks/resyncवृद्धिशील roll-forwardREADME
@handbooks/studioस्थानीय वेब UIREADME
@handbooks/clihandbook कमांडREADME

अकेले सबसे उपयोगी तीन

@handbooks/analyzer — 18 भाषाओं के लिए एक call graph

import { registerBuiltinAdapters, discoverAll, getAdapter, buildGraph } from '@handbooks/analyzer';

registerBuiltinAdapters();
const byLanguage = discoverAll('/path/to/repo');
const analyses = [];
for (const [lang, files] of Object.entries(byLanguage)) {
  analyses.push(await getAdapter(lang).analyze(files, '/path/to/repo'));
}
const { graph, stats } = buildGraph(
  { functions: analyses.flatMap((a) => a.functions), edges: analyses.flatMap((a) => a.edges) },
  {
    sourceRoot: '/path/to/repo',
    scannedFiles: Object.values(byLanguage).flat(),
    language: 'multi',
    defaultExt: '',
  },
);

कोई LLM नहीं, कोई नेटवर्क नहीं, कोई native संकलन नहीं।

@handbooks/patcher — किसी edit योजना को सुरक्षित लागू करें

import { applyPlan, rollback, parsePlan } from '@handbooks/patcher';

const problems = parsePlan(planText).problems; // lint a plan without applying it
const dry = applyPlan({ sourceRoot, plan: planText, dryRun: true });
if (dry.ok) {
  const result = applyPlan({ sourceRoot, plan: planText });
  // rollback(result.backupDir!, { expectedSourceRoot: sourceRoot })
}

योजना का प्रारूप परिवर्तन लागू करना में दर्ज है। यह ज़रूरी नहीं कि योजना @handbooks/planner से ही आई हो — आप उसे हाथ से भी लिख सकते हैं।

@handbooks/renderer — किसी भी HandbookModel को रेंडर करें

import { renderMarkdownHandbook, renderAgentSite, renderLlmsTxt } from '@handbooks/renderer';

renderMarkdownHandbook(model, 'out/');
renderAgentSite(model, 'out/agent');
renderLlmsTxt(model, 'out/');

HandbookModel ही एकमात्र अनुबंध है। उसे जैसे चाहें भरें, और रेंडरिंग, skill पैकेजिंग और planning — सब काम कर जाते हैं।

मुख्य exports एक नज़र में

// @handbooks/core — the vocabulary
CodeGraph · FunctionNode · CallEdge · AdapterCapabilities
FileCard · Skeleton · Assignment · Organization · Narration · RegisterEntry
HandbookModel · StageTree · coerceRole
resolveConfig · settingsFor · envName · scopedEnvName · loadConfigFile · applyEnvFiles
writeFileAtomic · readValidatedJson · pLimit · withRetry · withDirLock · sha256Hex

// @handbooks/analyzer — the parser
registerBuiltinAdapters · registerAdapter · getAdapter · availableLanguages
discoverAll · adapterForFile · buildGraph · writeGraphArtifacts · buildNavPack

// @handbooks/llm — the model seam
ChatClient · OpenAiChatClient · CachedChatClient · MockChatClient
resolveLlmEnv · llmConfigFromValues · actorCriticLoop · ROLE_PROMPTS

// @handbooks/pipeline — generation
generateHandbook · loadHandbookModel · runPhase1 · generateCards
synthesizeSkeleton · synthesizeWithDoctor · assignFiles · organizeStages
narrate · extractRegisters · classifyMembers · WorkDir

// @handbooks/renderer — presentation
renderMarkdownHandbook · renderHtmlSite · renderSinglePageHtml
renderAgentSite · renderLlmsTxt · HandbookView · stageMapMermaid

// @handbooks/skill — packaging
buildSkill · validateSkill

// @handbooks/planner — localization
runPlanner · handbookDirFromSkill · parseDeclarations · ReadOnlyTools

// @handbooks/patcher — execution
applyPlan · rollback · listBackups · parsePlan

// @handbooks/resync — roll-forward
resyncHandbook · loadCase · diffGraphs · detectCardDetail · loadCorrections

// @handbooks/studio — the UI
startStudio · createStudioServer · StateStore · JobRunner

स्थापना

pnpm add @handbooks/analyzer     # or npm / yarn

हर पैकेज केवल ESM है ("type": "module"), type declarations भेजता है, Node ≥ 20.11 माँगता है, और MIT लाइसेंस वाला है। तीसरे पक्ष के संस्करण workspace catalog में एक ही बार पिन किए गए हैं, इसलिए दो पैकेज कभी एक ही library के दो संस्करणों पर नहीं पहुँच सकते।

इस पृष्ठ पर