Method, system and computer readable medium for automatic generation and updating of description documents
Patent Information
- Application Number
- CN202611026337.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-10
- Publication Date
- 2026-10-13
AI Technical Summary
[0012]为了解决现有技术存在的问题,本发明目的在于一种多级结构化描述文档的自动生成与更新方法、系统及计算机可读介质,能解决现有技术文档结构化程度低的缺陷
[0014]与现有技术相比,本发明具有以下有益效果:基于代码仓库结构自动生成层级目录并形成多层级文档库,将内容精准写入对应目录节点,形成全景模块
细节逐级关联的完整文档体系,克服传统接口文档、单页README 结构扁平、缺乏架构层级的问题,显著提升项目可维护性。
Smart Images

Figure CN122903527A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of code documentation generation technology, and in particular to a method, system, and computer-readable medium for the automatic generation and updating of multi-level structured description documents. Background Technology
[0002] In modern software development, code documentation is a key asset for ensuring project maintainability, reducing the onboarding cost for new members, and promoting team collaboration. High-quality documentation helps developers understand system architecture, module responsibilities, core logic, and interface usage. However, with the continuous expansion of software system scale and the accelerating pace of iteration, traditional documentation maintenance methods face severe challenges: problems such as documentation being disconnected from code, time-consuming and laborious manual writing, difficulty in covering code details, and delayed updates are common.
[0003] To address the aforementioned issues, automated document generation technologies based on code analysis and artificial intelligence have experienced rapid development in recent years. In particular, with breakthroughs in large language models, leveraging the code understanding and generation capabilities of these models for automated document construction has become a research hotspot. Existing technologies have proposed various document generation schemes based on code analysis and large models, and their main technical approaches include: (1) Static code analysis and template filling: By parsing the abstract syntax tree, annotations, or comments of the source code, structured information such as classes, methods, and parameters is extracted and filled into a preset document template to generate API documentation or interface documentation. For example, traditional tools such as Javadoc and Sphinx, as well as annotation-based interface documentation generation technologies, all use this method.
[0004] (2) One-click document generation based on a large language model: Input the key code files or function summaries from the code repository into the large language model, and guide the model to generate project overviews, README documents, code comments, etc. through prompts. This method utilizes the semantic understanding capabilities of the large model to generate richer descriptions than static analysis.
[0005] (3) Automatic triggering mechanism based on code commit events: By listening to code commit events in the code repository, the document generation process is automatically triggered to achieve timely document updates.
[0006] Patent CN115113854B, entitled "Method, Apparatus, Device, and Computer-Readable Storage Medium for Generating Interface Documentation," employs the following technical solution: It acquires code commit information (including a list of changed files and project branches) sent by the code repository in response to a code commit event; queries the database for interface documentation information corresponding to the project branch and generates query results; if interface documentation information does not exist in the database (i.e., initial generation), it determines a list of files to be parsed based on a list of all code files corresponding to the project branch; if interface documentation information already exists in the database (i.e., incremental update), it determines a list of files to be parsed based on the list of changed files; it parses the source code files in the list of files to be parsed and updates the interface documentation information of the project branch; and in response to an interface documentation viewing event, it generates interface documentation based on the interface documentation information. This technology achieves document generation triggered by code commit events and distinguishes between two modes: full generation and incremental update based on changed files.
[0007] Publication number CN119829051A, titled "Method, Apparatus, and Electronic Device for Generating Interface Documentation," adopts the following technical solution: Upon detecting a code change in the code repository, it obtains target annotation information from the code repository (at least used to identify the service provided by the service provider, the service consumer, the service's interface class, and version number); it obtains initial interface information based on the target annotation information; it obtains interface configuration information corresponding to the service provider and the service consumer respectively; and it generates target interface documentation based on the initial interface information and the interface configuration information. This technology automatically extracts interface metadata through annotation information, realizing code change-driven interface documentation generation.
[0008] While the aforementioned existing technologies have achieved automated document generation or updating to some extent, they still have the following limitations: (1) Low degree of document structuring CN115113854B and CN119829051A primarily focus on generating interface documentation, outputting a document in the form of an interface list; CN119127296A mainly generates README documents, outputting a document in the form of a project overview. None of these three methods can generate a structured documentation system. This is because static annotation analysis struggles to extract dependencies between modules and business logic, while directly generating large models lacks in-depth analysis and hierarchical planning of the overall architecture.
[0009] (2) Coarse granularity of incremental update While CN115113854B can distinguish between initial generation and incremental updates, its incremental updates only determine the files to be parsed based on the list of changed files, without further analyzing the specific impact of the change types on the document, resulting in a relatively simplistic update strategy. This is because it lacks the ability to analyze the semantic impact of code changes and cannot establish a precise mapping between changed files and specific chapters of the document.
[0010] (3) The code-document interaction method is singular. Current technologies generally acquire information through static analysis or by inputting code into the model in a one-time manner. They lack standardized and reusable tool interfaces for interaction between AI and code repositories, making it difficult to support multi-round information queries and precise operations in complex document generation tasks. This is because an atomic toolset has not been built for AI to call, and the AI's behavior is limited by preset input formats.
[0011] (4) The model resource scheduling is extensive. Existing solutions generally use a single model to handle all document generation tasks, without hierarchical model scheduling based on the complexity of different sub-tasks (such as directory structure planning and detailed content generation). This is because there is a lack of a task-driven multi-model collaborative scheduling mechanism, leading to resource waste or limited effectiveness. Summary of the Invention
[0012] In order to address the problems existing in the prior art, the present invention aims to provide a method, system, and computer-readable medium for the automatic generation and updating of multi-level structured description documents, which can solve the deficiency of low document structuring in the prior art.
[0013] To achieve the above objectives, the present invention adopts the following technical solution: A method for automatically generating and updating multi-level structured description documents, comprising: Read the file list and core code files from the code repository to generate a hierarchical directory structure and save it to a multi-level document library; Retrieve file content from the code repository and write the file content into the directory node corresponding to the hierarchical directory structure; Get the commit events of the code repository and capture the list of changed files; Based on the updated file list, read the semantic type and modified content of the changed files; Based on semantic type and hierarchical directory structure, locate the affected document chapters from a multi-level document library; Partial editing of document chapters based on the modified content.
[0014] Compared with existing technologies, the present invention has the following advantages: it automatically generates hierarchical directories based on the code repository structure and forms a multi-level document library, accurately writing content into the corresponding directory nodes to form a comprehensive overview. Module A complete documentation system with hierarchical connections between details overcomes the problems of traditional interface documents, flat single-page README structures, and lack of architectural hierarchy, significantly improving project maintainability.
[0015] By capturing code commit events, parsing the semantic type and modified content of changed files, and combining the hierarchical directory structure to accurately locate the affected document chapters, only local editing is performed on the target chapters. This achieves a shift from file-level updates to precise chapter-level updates, solving the problems of coarse update granularity and simplistic strategies in existing technologies.
[0016] The directory and content are directly derived from the actual files in the code repository. All descriptions are based on verifiable source code, avoiding content distortion and illusion caused by freely generating large models, and ensuring a high degree of consistency between the documentation and the code.
[0017] The present invention also provides an automatic generation and updating system for multi-level structured description documents, for implementing the above-mentioned automatic generation and updating method, including: an input monitoring layer, a core processing layer, a tool execution layer, and an output layer; The input monitoring layer is used to obtain complete information about the code repository and a list of changed files. The core processing layer is used to create corresponding AI agent modules according to the task type, and several AI agent modules constitute an intelligent agent cluster. The tool execution layer is called by the intelligent agent cluster to realize the hierarchical directory structure writing, document content writing, and document content updating of the multi-level document library. The tool execution layer is equipped with a toolset. The output layer is used to store multi-level document libraries.
[0018] As a further improvement of the present invention, the input monitoring layer includes: Repository analyzer, used to obtain complete information about code repositories; A change listener is used to receive code commit events and capture a list of changed files from those events.
[0019] As a further improvement of the present invention, the intelligent agent cluster includes: a directory generation agent module, a content generation agent module, and an update agent module; The directory generation proxy module is used to write the hierarchical directory structure of the multi-level document library; The content generation proxy module is used to write document content to a multi-level document library; The update agent module is used to update the document content of a multi-level document library.
[0020] As a further improvement of the present invention, the directory generation proxy module is used to call the code source tool and the directory tool; During the process of writing the hierarchical directory structure, the code source tool reads the file list and core code files of the code repository through encapsulated atomic operations to obtain the structural information required to build the directory. The directory tool generates a hierarchical directory structure based on the structural information through encapsulated atomic operations, and saves the hierarchical directory structure to a multi-level document library.
[0021] As a further improvement of the present invention, the content generation proxy module is used to call code source tools, document tools, and mind mapping tools; During the document content writing process, the code source tool reads the corresponding file content from the code repository based on the file list through encapsulated atomic operations; The document tool uses encapsulated atomic operations to save file content to a multi-level document library; The mind mapping tool transforms file content into visual charts through encapsulated atomic operations and saves them to a multi-level document library.
[0022] As a further improvement of the present invention, the update proxy module is used to call the code source tool, the documentation tool, and the directory tool; The source code tool obtains the modified files through encapsulated atomic operations; The document tool uses encapsulated atomic operations to save the modified content in the change file to a multi-level document library to update the corresponding file chapters; The directory tool updates the directory based on the updated file chapters.
[0023] As a further improvement of the present invention, the intelligent agent cluster invokes tools and collects files from the code repository during the information collection phase; During the architecture analysis phase, the intelligent agent cluster analyzes the files in the code repository. During the document generation phase, the intelligent agent cluster saves the analysis results to a multi-level document library based on a preset multi-level template. The information gathering phase, architecture analysis phase, and document generation phase are executed sequentially.
[0024] Compared with existing technologies, this invention has the following beneficial effects: By coordinating the input monitoring layer and the core processing layer, this invention first reads the file list and core code files of the code repository, then generates a hierarchical directory structure and saves it to a multi-level document library. This method changes the traditional mode of directly generating content, adopting a method of first planning the skeleton and then filling in the content. By constructing a multi-level directory tree including a panoramic overview, module details, and core logic descriptions, it ensures that the generated documents are no longer scattered information piles, but a logically rigorous and clearly hierarchical structured system. This not only helps developers quickly locate information but also greatly reduces the understanding cost for new members. It achieves stable interaction between AI and the code repository through tool-based implementation, supporting multi-round queries and precise operations; by assigning corresponding AI agents according to task type, it realizes the division of labor and collaboration in directory planning, content generation, and incremental updates, optimizes model resource scheduling, avoids resource waste, and improves the efficiency and stability of document generation for complex projects.
[0025] The present invention also provides one or more computer-readable media having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the above-described automatic generation and update method. Attached Figure Description
[0026] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments.
[0027] Figure 1 This is a flowchart of the automatic generation and updating method described in this invention; Figure 2 This is a schematic diagram of the structure of the multi-level document library described in this invention; Figure 3 This is an architecture diagram of the automatic generation and update system described in this invention; Figure 4 This is an interaction sequence diagram of the automatic generation and update system described in this invention during implementation. Detailed Implementation
[0028] To make the technical problems solved by the present invention, the technical solutions adopted, and the technical effects achieved clearer, the technical solutions of the embodiments of the present invention will be further described in detail below. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0029] This invention provides a method for automatically generating and updating multi-level structured description documents, such as... Figure 1 As shown, it includes: S1. Read the file list and core code files from the code repository to generate a hierarchical directory structure and save it to a multi-level documentation library, such as... Figure 2 As shown.
[0030] Multi-level document libraries have strict hierarchical relationships: 1) First Layer (Overview): Includes project overview, technology stack, architecture diagram, quick start guide, and data flow diagram. This layer provides users with an overall understanding of the project.
[0031] 2) Second Layer (Module Details): Divided by functional modules, this layer includes module responsibility descriptions, core class diagrams, inter-module dependencies, a list of external interfaces, and data flow. This layer helps users understand the functions and interactions of each module.
[0032] 3) Third Layer (Core Logic Description): This layer includes the implementation logic of key functions, configuration parameter descriptions, exception handling mechanisms, usage examples, and source code reference anchors. This layer provides a reference for users who need to delve deeper into the implementation details.
[0033] Documents at different levels are interconnected through hyperlinks and references, allowing users to delve from a panoramic overview into specific implementation details. Documents can be exported as HTML or PDF, or stored in databases, knowledge base platforms such as Confluence. Furthermore, machine translation can automatically generate multilingual versions of documents, with linked and synchronized updates.
[0034] S2. Retrieve the file content from the code repository and write the file content into the directory node corresponding to the hierarchical directory structure; S3. Obtain the commit events of the code repository and capture the list of changed files. Here, you can listen for commit events or use a timed polling method instead of Webhook listening to periodically scan the code repository commit records and trigger updates.
[0035] S4. Based on the list of updated files, read the semantic type and modified content of the changed files; among which, the semantic type includes: API signature change, configuration change, new function, internal refactoring, etc.
[0036] S5. Based on semantic types and hierarchical directory structures, the affected document sections are located from multi-level document libraries. This allows for a precise mapping between changed files and document sections, achieving precise "point-to-point" updates rather than a full regeneration. For example, in the case of API signature changes, the corresponding interface document section is located; for internal refactoring, the impact on external interface descriptions is assessed.
[0037] S6. Perform partial editing of document chapters based on the modified content. For newly added modules, create new document chapters.
[0038] This invention provides an automatic generation and updating system for multi-level structured description documents, characterized in that it includes methods for implementing the aforementioned automatic generation and updating methods, such as... Figure 3 As shown, it includes: an input monitoring layer, a core processing layer, a tool execution layer, and an output layer; the input monitoring layer is used to obtain complete information about the code repository and a list of changed files; the core processing layer is used to create corresponding AI agent modules according to the task type, and several AI agent modules constitute an intelligent agent cluster; the tool execution layer is called by the intelligent agent cluster to realize the hierarchical directory structure writing, document content writing, and document content updating of the multi-level document library, and the tool execution layer is equipped with a toolset; the output layer is used to store the multi-level document library.
[0039] As one implementation, the input monitoring layer includes a repository analyzer and a change listener. The repository analyzer is used to obtain complete information about the code repository, and the change listener is used to obtain code commit events and capture a list of changed files from the code commit events.
[0040] The core processing layer includes: document generation service, agent generation module and intelligent agent cluster. The document generation service acts as the core coordinator and dynamically creates specialized AI agent modules based on task type through the agent generation module; each is responsible for generating tasks of different task types.
[0041] The tool execution layer includes: GitTool (code source tool), CatalogTool (catalog tool), DocTool (documentation tool), and MindMapTool (mind mapping tool). These toolsets encapsulate read and write operations of the code repository into standardized interfaces, providing atomic operations for the agent cluster to call. The toolsets can be implemented using other programming languages such as Python, Node.js, and Go, and communicate with the core processing layer through standardized interfaces.
[0042] The code source tool is responsible for code access operations, encapsulating atomic operations such as file reading (ReadFile), directory listing (ListFiles), and code searching (Grep), ensuring that the information acquired by the agent has a definite truth source.
[0043] The catalog tool manages the hierarchical structure of documents and supports the dynamic creation and modification of catalog trees (ReadCatalog, EditCatalog, WriteCatalog), enabling flexible adjustments to the document system.
[0044] The document tool is responsible for writing and editing documents, encapsulating the writing (WriteDoc), editing (EditDoc) and version management operations, and supporting precise content replacement rather than a full rewrite.
[0045] Mind mapping tools transform code structures into visual diagrams, generating architecture diagrams and flowcharts.
[0046] As one implementation method, the intelligent agent cluster includes: a directory generation agent module, a content generation agent module, and an update agent module; the directory generation agent module is used to write the hierarchical directory structure of the multi-level document library; the directory generation agent module adopts a low-cost lightweight model and is responsible for handling the repository structure analysis and directory planning to generate the skeleton structure of the document.
[0047] The content generation proxy module is used to write document content to a multi-level document library. The content generation proxy module adopts a high-performance large model and is responsible for generating detailed module descriptions, core logic analysis and architecture diagrams.
[0048] The update agent module is used to update document content in a multi-level document library. This module is specifically optimized for difference analysis, responsible for performing incremental updates, identifying the scope of impact of changes, and executing precise updates.
[0049] Different agents exchange information through standardized context interfaces. The directory structure output by the directory generation agent serves as the input for the content generation agent. The analysis results of the update agent guide the update operations of the content generation agent, forming a collaborative workflow.
[0050] The directory generation proxy module invokes the code source tool and the directory tool. During the writing of the hierarchical directory structure, the code source tool uses encapsulated atomic operations to read the file list and core code files of the code repository to obtain the structural information needed to build the directory. The directory tool, through encapsulated atomic operations, generates the hierarchical directory structure based on the structural information and saves it to a multi-level document library. Simultaneously, the directory tool returns "Directory saved" to the AI proxy module. By invoking these atomic tools and interacting with the code repository, the directory generation proxy module achieves deterministic interaction between behavior and the real code environment, avoiding information loss due to model context length limitations.
[0051] The content generation agent module is used to call the code source tool, document tool, and mind mapping tool. During the document content writing process, the code source tool reads the corresponding file content from the code repository based on the file list through encapsulated atomic operations. The document tool saves the file content to a multi-level document library. The mind mapping tool transforms the file content into a visual chart through encapsulated atomic operations and saves it to the multi-level document library. At the same time, the document tool returns "Document has been written" to the AI agent module.
[0052] The update agent module is used to call the code source tool, documentation tool, and table of contents tool. The code source tool obtains the changed files through encapsulated atomic operations. The documentation tool saves the modified content in the changed files to a multi-level document library through encapsulated atomic operations to update the corresponding file chapters. At the same time, the documentation tool returns "Document updated" to the AI agent module. The table of contents tool updates the table of contents based on the updated file chapters.
[0053] The specific implementation process is as follows: Figure 4 As shown: During the directory generation process: The directory generation proxy module uses the ListFiles(pattern) method of the code source tool to obtain a list of files in the code repository.
[0054] The directory generation agent module returns a list of files to the directory generation agent module.
[0055] The directory generation proxy module calls the ReadFile(path) method of the source code tool to obtain the contents of the file at the specified path.
[0056] The source code tool returns the file content to the directory generation proxy module.
[0057] The directory generation proxy module calls the WriteCatalog(structure) method of the directory tool to write the directory structure.
[0058] The directory tool returns "Directory saved" to the directory generation agent module.
[0059] Content generation stage: The content generation proxy module calls the Grep(pattern, path) method of the source code tool to perform content search.
[0060] The source code tool returns the search results to the content generation agent module.
[0061] The content generation proxy module calls the WriteDoc(content) method of the document tool to write the document content.
[0062] The document tool returns "Document written" to the content generation agent module.
[0063] The content generation proxy module calls the WriteMindMap(content) method of the mind mapping tool to write the mind map content.
[0064] The mind mapping tool returns "Mind map saved" to the content generation agent module.
[0065] Incremental update phase: The update agent module calls the ReadChangedFiles(files) method of the source code tool to read the changed files.
[0066] The source code tool returns the changes to the update agent module.
[0067] The update agent module calls the EditDoc(changes) method of the document tool to edit the document and apply the changes.
[0068] The document tool returns "Document updated" to the update agent module.
[0069] During the incremental update phase, updates are performed only on the affected documents. For minor changes, the EditDoc tool is used for local editing; for major changes or new modules, WriteDoc is used for rewriting or creation. After the update is complete, a change log is recorded to ensure that the synchronization status of the documents and code is traceable.
[0070] Specifically, the hierarchical directory structure and content population in the automatic generation and update system adopt a layered prompt word architecture. The behavior of the AI agent module is controlled by system-level commands to achieve the automated generation of a multi-level knowledge base. The AI agent module comprises two core prompt word modules: 1. Directory Building Phase: Constructing the document directory structure to achieve hierarchical organization, including: ① Dynamic parameter input: Includes structured information such as project type, file tree, and README content; ② Core instructions: Focus on project architecture analysis and structural understanding, generate tree-structured entities, and establish a hierarchical framework for documents.
[0071] 2. Content Filling Stage: A unified set of content generation prompts is used, dynamically adapting to different levels of needs. Specific requirements include the following: ①Constraint rules: Prohibit the creation of fake code examples, enforce source code tracing, prohibit guessing API signatures, require verification before document generation, mandate the use of tools, ensure that charts reflect the true structure, honestly handle missing information, and enforce multi-step thinking.
[0072] ② Three-stage execution process: Information collection - Architecture analysis - Documentation generation ③Document structure template: # {Title} ## Overview ## Architecture ## {Main Content Sections} ## Core Flow ## Usage Examples ## Configuration Options ## API Reference ## Related Links ④ Source code tracing mechanism: - Use {{file_base_url}} / <file_path> for linking to source files - Use {{file_base_url}} / <file_path>#L <line>for specific line references - Use{{file_base_url}} / <file_path>#L <start> -L <end>for line ranges ⑤ Hierarchical adaptation mechanism: 1) Panoramic overview layer adaptation: catalog_path: Root path (e.g., " / ") The content should focus on the overall project architecture, technology stack, and quick start guide. Charts should be a combination of various types.
[0073] 2) Module detail layer adaptation: catalog_path: The specific module path (e.g., " / services / user").
[0074] The content focuses on module responsibilities, core class diagrams, and dependencies.
[0075] The charts must be of a professional chart type.
[0076] 3) Core logic layer adaptation: catalog_path: The path to the feature page (e.g., " / services / user / auth") The content focuses on the implementation of key functions, configuration parameters, and exception handling.
[0077] Source code tracing uses precise line number citations.
[0078] To address the accuracy issue of content generated from large models, the content generation proxy module has implemented a mandatory three-stage execution process, which is formalized in the system prompts as insurmountable constraints: 1) GATHER Phase (Information Gathering): The system prohibits the model from directly generating conclusions, forcing it to first call toolsets (such as GitTool's ReadFile and ListFiles methods) to systematically collect target code files, dependencies, and cross-reference information. This phase only outputs a list of collected information and does not output any analysis conclusions.
[0079] 2) THINK Phase (Architecture Analysis): Based on the collected information, a deep analysis of the model is forced, including identifying component responsibilities and dependencies, designing the Mermaid diagram structure, and verifying the accuracy of the claims. This phase only outputs the analysis results and architecture design, not the final document.
[0080] 3) WRITE stage (document generation): Based on the architecture analysis results of the THINK stage, the final document is generated according to the preset multi-level template, and source code reference anchors are attached.
[0081] A verification gating mechanism is set up between the three stages. If the previous stage is not completed or the output does not meet the requirements, the system will prevent entry into the next stage, ensuring that each step of document generation has reliable evidence. Here, the non-skippable GATHER-THINK-WRITE three-stage execution logic is defined in the agent cluster prompt.
[0082] Verification gating is implemented through prompt word engineering, rather than traditional code-level control flow, and executes during the content generation phase of the entire system. Specifically, it includes: 1. Forced multi-step thinking: All three stages of GATHER-THINK-WRITE must be completed in sequence. Do not skip the in-depth analysis stage. Each stage is built on the output of the previous stage.
[0083] 2. Exit verification during the information collection phase: Before entering the architecture analysis phase, it is mandatory to complete six information gathering tasks: a list of all relevant source files, understanding of the components, dependencies, appropriate sample code snippets, and understanding of the component data flow.
[0084] 3. Exit verification during the architecture analysis phase: Before starting the documentation generation phase, the following must be verified: whether the source files have been read, whether the component purpose is clear, whether the dependencies have been mapped, whether the code example has been selected, whether the icon node has been verified, and whether the configuration options have been collected. Only when all verification items pass can the documentation generation phase begin; otherwise, the information collection phase and architecture analysis phase must be returned to collect information again.
[0085] 4. Error handling decision-making process: If a permission error occurs, the warning will be logged and skipped; if a file is too large error occurs, the grep tool will be automatically switched to search for the content; if a document write failure error occurs, a retry mechanism of up to 3 times will be provided.
[0086] Based on the same inventive concept, the present invention also provides one or more computer-readable media having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the automatic generation and update method as described above.
[0087] Optionally, the computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), solid-state drive (SSD), or optical disc, etc.
[0088] Random access memory can include resistive random access memory (ReRAM) and dynamic random access memory (DRAM).
[0089] In this description, references to terms such as "an embodiment," "example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, illustrative expressions of the above terms do not necessarily refer to the same embodiment or example.
[0090] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style of the specification is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
[0091] The technical principles of the present invention have been described above with reference to specific embodiments. These descriptions are merely for explaining the principles of the invention and should not be construed as limiting the scope of protection of the invention in any way. Based on this explanation, those skilled in the art can readily conceive of other specific embodiments of the invention without inventive effort, and these embodiments will all fall within the scope of protection of the present invention.< / end> < / start> < / line>
Claims
1. A method for automatically generating and updating multi-level structured descriptive documents, characterized in that, include: Read the file list and core code files from the code repository to generate a hierarchical directory structure and save it to a multi-level document library; Retrieve file content from the code repository and write the file content into the directory node corresponding to the hierarchical directory structure; Get the commit events of the code repository and capture the list of changed files; Based on the updated file list, read the semantic type and modified content of the changed files; Based on semantic type and hierarchical directory structure, locate the affected document chapters from a multi-level document library; Partial editing of document chapters based on the modified content.
2. A system for automatically generating and updating multi-level structured descriptive documents, characterized in that, The method for implementing the automatic generation and update method as described in claim 1 includes: an input monitoring layer, a core processing layer, a tool execution layer, and an output layer; The input monitoring layer is used to obtain complete information about the code repository and a list of changed files. The core processing layer is used to create corresponding AI agent modules according to the task type, and several AI agent modules constitute an intelligent agent cluster. The tool execution layer is called by the intelligent agent cluster to realize the hierarchical directory structure writing, document content writing, and document content updating of the multi-level document library. The tool execution layer is equipped with a toolset. The output layer is used to store multi-level document libraries.
3. The automatic generation and updating system according to claim 2, characterized in that, The input monitoring layer includes: Repository analyzer, used to obtain complete information about code repositories; A change listener is used to receive code commit events and capture a list of changed files from those events.
4. The automatic generation and updating system according to claim 2, characterized in that, The intelligent agent cluster includes: a directory generation agent module, a content generation agent module, and an update agent module; The directory generation proxy module is used to write the hierarchical directory structure of the multi-level document library; The content generation proxy module is used to write document content to a multi-level document library; The update agent module is used to update the document content of a multi-level document library.
5. The automatic generation and updating system according to claim 4, characterized in that, The directory generation proxy module is used to call the code source tool and the directory tool; During the process of writing the hierarchical directory structure, the code source tool reads the file list and core code files of the code repository through encapsulated atomic operations to obtain the structural information required to build the directory. The directory tool generates a hierarchical directory structure based on the structural information through encapsulated atomic operations, and saves the hierarchical directory structure to a multi-level document library.
6. The automatic generation and updating system according to claim 4, characterized in that, The content generation proxy module is used to call code source tools, document tools, and mind mapping tools; During the document content writing process, the code source tool reads the corresponding file content from the code repository based on the file list through encapsulated atomic operations; The document tool uses encapsulated atomic operations to save file content to a multi-level document library; The mind mapping tool transforms file content into visual charts through encapsulated atomic operations and saves them to a multi-level document library.
7. The automatic generation and updating system according to claim 4, characterized in that, The update proxy module is used to call the code source tool, documentation tool, and directory tool; The source code tool obtains the modified files through encapsulated atomic operations; The document tool uses encapsulated atomic operations to save the modified content in the change file to a multi-level document library to update the corresponding file chapters; The directory tool updates the directory based on the updated file chapters.
8. The automatic generation and updating system according to claim 2, characterized in that, During the information collection phase, the intelligent agent cluster invokes tools and collects files from the code repository. During the architecture analysis phase, the intelligent agent cluster analyzes the files in the code repository. During the document generation phase, the intelligent agent cluster saves the analysis results to a multi-level document library based on a preset multi-level template. The information gathering phase, architecture analysis phase, and document generation phase are executed sequentially.
9. One or more computer-readable media, characterized in that, It stores instructions that, when executed by one or more processors, cause the processors to perform the automatic generation and update method as described in any one of claims 1.
Citation Information
Patent Citations
Interface document generation method and device, equipment and computer readable storage medium
CN115113854B
README document automatic generation method for code warehouse
CN119127296A
Interface document generation method and device and electronic equipment
CN119829051A