A method and system for generating intelligent code repositories based on hierarchical planning graphs
By adopting an intelligent code repository generation method based on hierarchical planning graphs, the semantic ambiguity and scalability issues of existing AI-assisted programming technologies in building complete software systems are solved. This achieves consistency and completeness from requirements to code generation, improves the reliability and maintainability of code generation, and supports the automated construction of large-scale complex software projects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- INSPUR ENTERPRISE CLOUD TECHNOLOGY (SHANDONG) CO LTD
- Filing Date
- 2026-01-14
- Publication Date
- 2026-05-26
AI Technical Summary
Existing AI-assisted programming technologies are insufficient for building complete software systems, exhibiting problems such as semantic ambiguity, information distortion, lack of a unified view, and poor scalability, making it difficult to build large-scale, complex software projects.
A hierarchical planning graph-based intelligent code repository generation method is adopted. By transforming unstructured natural language requirements into a structured information list, a high-level functional dependency directed acyclic graph (DAG) without logical conflicts is constructed and further refined into a detailed code repository planning graph (RPG). Functional nodes are decomposed into technical units, and the RPG graph is analyzed to schedule AI agents to generate code, test code, and documentation in the order of dependencies.
It achieves consistency and integrity from requirements to code generation, improves the reliability, maintainability and scalability of code generation, and supports the automated construction of large-scale complex software projects.
Smart Images

Figure CN122086378A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and software engineering automation technology, specifically to a method and system for generating intelligent code repositories based on hierarchical planning diagrams. Background Technology
[0002] Existing AI-assisted programming technologies, such as GitHub Copilot and CodeWhisperer, primarily focus on code snippet completion or function-level generation, making them ill-suited for building complete software systems. Current research attempts to simulate software teams through multi-agent collaboration, but its communication relies on natural language memos, which suffer from fatal flaws such as semantic ambiguity, information decay and drift, lack of a unified view, and limited scalability. Natural language descriptions are prone to ambiguity, and the original requirements gradually become distorted in multi-turn dialogues. The understanding of each AI agent is scattered throughout the text, failing to form a globally consistent structured blueprint. As project scale increases, text descriptions explode, coordination costs soar, and ultimately, system crashes. Therefore, there is an urgent need for a unified, structured, and scalable intermediate representation as a precise blueprint for AI-generated code, enabling the automated construction from a single requirement to a runnable software system. Summary of the Invention
[0003] The technical objective of this invention is to address the above-mentioned shortcomings by providing an intelligent code repository generation method and system based on a hierarchical planning graph, which can significantly improve the reliability, maintainability, and scalability of code generation and support the automated construction of large-scale complex software projects.
[0004] The technical solution adopted by this invention to solve its technical problem is: A method for generating intelligent code repositories based on hierarchical planning graphs, the implementation of which includes the following steps: Transform unstructured natural language requirements into a list of structured information containing functional requirements, constraints, and intents. Using the structured information list as input, construct a high-level functional dependency directed acyclic graph (DAG) without logical conflicts. The Directed Acyclic Graph (DAG) is refined into a Detailed Repository Planning Graph (RPG) that can guide code generation, and functional nodes are broken down into technical units and core attributes are defined. Analyze the code repository planning graph (RPG) and schedule AI agents to execute tasks according to dependency order; Generate target code, test code, and documentation.
[0005] This method derives a structured list by parsing natural language requirements, constructing a high-level directed acyclic graph (DAG) with no logical conflicts. The DAG is then refined into an reactive graph (RPG), breaking down functional nodes into technical units and defining core attributes to build an RPG graph containing specific nodes and edges. The RPG is then parsed, and AI agents are scheduled to serially generate code, test code, and documentation based on dependencies. This method replaces natural language communication with a hierarchical planning graph, ensuring interface consistency and correct data flow, improving code reliability and maintainability, and supporting automated construction of large-scale complex software.
[0006] Furthermore, the process of constructing a high-level functional dependency DAG includes: Multi-path retrieval matching: Results from BM25 keyword retrieval and Embedding vector retrieval are merged and then re-ranked by Reranker to select the TOP N candidates; Analyze high-level dependencies and update the inventory; A high-level directed acyclic graph (DAG) of functional dependencies is constructed with functional goals as nodes and dependencies as edges. Cyclic dependency detection and functional coverage verification ensure that there are no logical conflicts.
[0007] Obtain the "Functional Requirements" field from the structured requirements list and extract the text description of each function; The keyword retrieval (BM25) is a retrieval function knowledge base that iteratively retrieves the functional requirements and scores of the previous step. Vector retrieval (Embedding): Convert the "functional requirements" text into vectors, calculate the cosine similarity with the vectors pre-stored in the knowledge base, and select the top K candidates; Merged retrieval: The candidate scores of keyword and vector retrieval are weighted and the top K candidates are selected; Candidate module reordering: Based on the Reranker model, the retrieved candidates are reordered and merged, and the top N candidates are selected.
[0008] Dependency Analysis: Based on the reordering candidates and the structured information list, analyze and generate the high-level dependencies required by the target code repository. Update List: Update the high-level dependencies to the structured requirement list.
[0009] Based on the "structured requirements list with dependencies", high-level functional goals and logical dependency directions are extracted. Using functional goals as nodes and dependencies as edges, a directed acyclic graph (DAG) is constructed using the NetworkX library. Only the node names and dependency directions are retained, without involving technical implementation details.
[0010] Two types of verification are used to ensure the rationality of strategic planning: first, loop dependency detection to check for the existence of closed loops such as "function A → function B → function A"; second, function coverage verification to confirm that the core functional requirements in the requirements correspond to the nodes in the diagram and that no functions are omitted.
[0011] Furthermore, the process of refining the directed acyclic graph into a detailed code repository planning graph (RPG) that can guide code generation includes: The functional nodes of the directed acyclic graph (DAG) are broken down into the smallest technical units (such as file loading units). Define three core attributes for the technical unit: file path, function description, and interface protocol. File path: A unique storage path is assigned according to the project architecture specifications; Function description: Follow the syntax of the target programming language, and define the function name, functional logic, parameter list, and return value type; Interface protocol: Defines the input data format, output data format, and exception handling rules for the function; Match test case types according to technology unit types; Using "files, functions, interface protocols, and test cases" as four types of nodes and "data flow, dependency relationship, and call relationship" as three types of edges, construct a code repository planning graph (RPG) structure and output a JSON format RPG file containing a list of nodes, a list of edges, and version information.
[0012] Node attributes: File nodes contain the path and dependent libraries, function nodes contain the signature and the file to which it belongs, interface protocol nodes contain input and output rules, and test case nodes contain the test scenario and expected results.
[0013] Edge relationships: File node → Function node ("Containment" relationship), Function node → Interface protocol node ("Compliance" relationship), Function node → Test case node ("Tested" relationship), Upstream function node → Downstream function node ("Data flow" relationship).
[0014] The completed RPG graph structure is stored in JSON format, including a list of nodes, a list of edges, and version information, to ensure that the AI agent can parse and call it.
[0015] Furthermore, the matching of test case types according to technical unit type: File operation technology unit: matching unit test + exception test, covering scenarios such as normal file reading, file not found, encoding error, etc.; Cross-module call technology unit: matching interface test + integration test to verify the correctness of interaction with the data preprocessing unit and the compliance of output results.
[0016] Furthermore, the code repository planning graph (RPG) is parsed and AI agents are scheduled to execute tasks according to dependency order; the process includes: The code repository planning graph RPG in JSON format is parsed to extract all functional nodes and their dependencies. A linear execution queue is formed according to the dependency order to ensure that each functional node is executed only after its dependent nodes have been processed. Call each functional node in the queue sequentially.
[0017] Furthermore, for each functional node in the queue, perform three operations sequentially: Code generation: Invoke the code generation agent to generate the corresponding code file based on the file path, function description, and interface protocol of the node in the code repository planning diagram RPG; Test generation: Invoke the test case agent to generate corresponding test code based on the generated code and the test case type definitions in the code repository planning diagram RPG; Documentation generation: Call the documentation generation agent to generate the documentation for this feature node based on the code implementation and interface rules.
[0018] Furthermore, the process of transforming unstructured natural language requirements into a structured information list involves a three-stage process: input preprocessing, core element extraction, and structured integration. This process integrates an input cleaning component, a requirement element extraction engine, and a structured list generation component. The input cleaning component standardizes the format of the natural language input from the user and filters out redundant information to ensure that the text is clear and readable. The requirement element extraction engine, based on the Large Language Model (LLM), extracts three major elements from the cleaned requirement text: core functional requirements, non-functional constraints, and requirement intent. The structured list generation component uses a preset JSON format template and defines required fields to integrate the extracted required elements in a fixed format to generate a structured information list.
[0019] This invention also claims a hierarchical planning graph-based intelligent code repository generation system, comprising: Natural Language Requirements Parsing Module: Used to parse natural language requirements into a structured information list; High-level functional dependency graph construction module: Constructs a high-level functional dependency directed acyclic graph (DAG) without logical conflicts based on a structured information list; Detailed Repository Planning Graph (RPG) Generation Module: Used to refine a Directed Acyclic Graph (DAG) into a Repository Planning Graph (RPG) that can guide code generation; AI Agent Co-scheduling Module: Used to parse the code repository planning graph (RPG) and schedule AI agents according to their dependency order; Code and documentation generation execution module: generates code, test code, and documentation; This system can implement the above methods. The present invention also claims a smart code repository generation device based on a hierarchical planning graph, comprising: at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is used to call the machine-readable program to implement the above method.
[0020] The present invention also claims a computer-readable medium storing computer instructions that, when executed by a processor, enable the implementation of the above-described method.
[0021] Compared with existing technologies, the intelligent code repository generation method and system based on hierarchical planning graphs of the present invention have the following advantages: 1. This invention employs a unified structured planning diagram, significantly reducing semantic ambiguity and distortion during information transmission. As the sole reliable source for all AI agents to collaborate, the planning diagram ensures consistency throughout the entire process from requirements to code generation, avoiding issues such as interface mismatches between modules.
[0022] 2. The two-stage planning mechanism proposed in this invention achieves automated connection from strategic goals to tactical implementation. A high-level functional dependency graph macroscopically defines the system architecture, while a detailed code repository planning graph precisely guides code generation. This layered refinement method significantly improves the completeness and functionality of the generated code repository.
[0023] 3. The planning diagram structure of this invention has dynamic growth and version control capabilities. When user requirements change or expand, the system can efficiently perform incremental updates and dependency replanning, demonstrating excellent scalability and maintainability. Attached Figure Description
[0024] Figure 1 This is a flowchart illustrating the intelligent code repository generation method based on a hierarchical planning diagram provided in this embodiment of the invention. Figure 2 This is a flowchart of the high-level functional dependency graph construction provided in the embodiments of the present invention. Detailed Implementation
[0025] The present invention will be further described below with reference to the accompanying drawings and specific embodiments.
[0026] A method for generating intelligent code repositories based on hierarchical planning graphs, the implementation of which includes the following steps: Natural Language Requirements Analysis: Transforming unstructured natural language requirements into a structured list of information containing functional requirements, constraints, and intents. High-level functional dependency graph construction: Using the structured information list as input, construct a high-level functional dependency directed acyclic graph (DAG) without logical conflicts. RPG generation: The Directed Acyclic Graph (DAG) is refined into a detailed code repository planning graph (RPG) that can guide code generation, and functional nodes are broken down into technical units and core attributes are defined; AI agent collaborative execution: Parse the code repository planning graph (RPG) and schedule AI agents to execute tasks according to dependency order; Generate target code, test code, and documentation.
[0027] Among them, the natural language requirement solution generates a list through the process of "input preprocessing - core element extraction - structured integration", integrating input cleaning, LLM requirement extraction, and JSON template structured components.
[0028] The process of constructing a high-level functional dependency DAG includes: Multi-path retrieval and matching module: Merges results from BM25 keyword retrieval and Embedding vector retrieval, and selects TOP N candidates by re-ranking using Reranker; Analyze high-level dependencies and update the inventory; A Directed Acyclic Graph (DAG) is constructed using functional goals as nodes and dependencies as edges. Loop dependency detection and functional coverage verification ensure that there are no logical conflicts.
[0029] The RPG generation process includes: The DAG functional nodes are broken down into the smallest technical units; Define the three core attributes of the technical unit: file path, function description, and interface protocol; Match test case types according to technical unit types (file operation classes are matched with unit + exception tests, cross-module classes are matched with interface + integration tests). Construct an RPG graph structure with "files / functions / interface protocols / test cases" as nodes and "data flows / dependencies / calls" as edges, and output a JSON-formatted RPG file containing a list of nodes, a list of edges, and version information.
[0030] The AI agent collaborative scheduling process includes: Parse JSON-formatted RPGs and form a linear execution queue according to their dependencies; For each functional node in the queue, the code generation agent generates code, the test case agent generates test code, and the documentation generation agent generates documentation in sequence.
[0031] By constructing a hierarchical structured planning diagram as an intermediate representation, the system can automatically generate a complete code repository from natural language requirements.
[0032] 1. Natural Language Requirements Analysis The system integrates an input cleaning component, a requirement element extraction engine, and a structured list generation component through a three-stage process: input preprocessing, core element extraction, and structured integration. Component configurations are shown in Table 1.
[0033] Table 1 Component Configuration Table
[0034] Taking "developing a machine learning analysis tool" as an example, Table 2 shows a configuration example of the "structured manifest generation component". This configuration includes functional requirements, constraints, and related metadata, as detailed in the table below: Table 2 Configuration Table for Structured Inventory Generation Components
[0035] 2. Construction of high-level functional dependency graph Through a four-stage process of "multi-way retrieval matching functional modules - dependency analysis - graph structure generation - validity verification," a high-level functional dependency graph is constructed, ultimately generating a directed acyclic graph (DAG) without logical conflicts. This provides a functional blueprint for the subsequent generation of a detailed code repository planning diagram. The flowchart is as follows: Figure 2 As shown.
[0036] Step 1: Multi-path search and matching function module Input reception: Obtain the "Functional Requirements" field from the structured requirements list and extract the text description of each function. Keyword retrieval (BM25): A knowledge base for retrieval functions, iteratively retrieving the functional requirements and scores of the previous step;
[0037] Vector retrieval (Embedding): Convert the "functional requirements" text into vectors, calculate the cosine similarity with pre-stored vectors in the knowledge base, and select the top TOPK candidates.
[0038] Merged retrieval: The candidate scores of keywords and vector searches are weighted and the top K candidates are selected.
[0039] Candidate module reordering: Based on the Reranker model, the retrieved candidates are reordered and merged, and the top N candidates are selected.
[0040] Step 2: Dependency Analysis Dependency analysis: Based on the reordering candidates from step 1 and the structured list from the previous module, analyze and generate the high-level dependencies required by the target code repository.
[0041] Update list: Update high-level dependencies to the structured requirements list.
[0042] Step 3: Graph Structure Generation and Verification DAG Generation: Based on the "structured requirements list with dependencies", high-level functional goals and logical dependency directions are extracted. Using functional goals as nodes and dependencies as edges, a directed acyclic graph (DAG) is constructed using the NetworkX library. Only the node names and dependency directions are retained, without involving technical implementation details.
[0043] Verification: Two types of verification are used to ensure the rationality of strategic planning: First, loop dependency detection to check for the existence of closed loops such as "Function A → Function B → Function A"; second, function coverage verification to confirm that the core functional requirements in the requirements correspond to the nodes in the diagram and that no functions are omitted.
[0044] 3. RPG generation The high-level functional dependency graph (DAG) is refined into a detailed code repository planning graph (RPG) that can guide code generation. Each functional node in the high-level functional dependency graph is broken down into specific technical implementation units. The process is as follows: (1) Breakdown of technical units: Break down the functional nodes in the DAG graph into the smallest technical units (such as file loading units).
[0045] (2) Define core technology attributes: For each technical unit, three categories of core technical attributes are defined to provide a precise basis for code generation: File path: A unique storage path is assigned according to the project architecture specifications.
[0046] Function description: Follow the syntax of the target programming language to define the function name, functional logic, parameter list and return value type.
[0047] Interface protocol: Defines the input data format, output data format, and exception handling rules for the function. (3) Matching test case types: Based on the functional characteristics and interface type of the technical unit, match the corresponding test case type: File operation technology unit: matching unit test + exception test, covering scenarios such as normal file reading, file not found, encoding error, etc.; Cross-module call technology unit: matching interface test + integration test to verify the correctness of interaction with the data preprocessing unit and the compliance of output results.
[0048] (4) Constructing the RPG graph structure: Construct an RPG graph structure with four types of nodes: "file path, function, interface protocol, and test case," and three types of edges: "data flow, dependency relationship, and call relationship." Node attributes: File nodes contain the path and dependent libraries, function nodes contain the signature and the file to which it belongs, interface protocol nodes contain input and output rules, and test case nodes contain the test scenario and expected results.
[0049] Edge relationships: File node → Function node ("Containment" relationship), Function node → Interface protocol node ("Compliance" relationship), Function node → Test case node ("Tested" relationship), Upstream function node → Downstream function node ("Data flow" relationship).
[0050] (5) Output JSON format RPG file: The completed RPG graph structure is stored in JSON format, including a list of nodes, a list of edges, and version information, to ensure that the AI agent can parse and call it.
[0051] 4. AI agent collaborative execution The system receives a detailed code repository plan output from the RPG generation module. It employs a fully sequential execution mode, completing code generation, test code generation, and documentation generation sequentially according to functional nodes. The process is as follows: (1) RPG Analysis and Task Sorting: The RPG structure is parsed, all functional nodes and their dependencies are extracted, and a linear execution queue is formed according to the dependency order to ensure that each functional node is executed only after its dependent nodes have been processed.
[0052] (2) AI agent serial execution: For each functional node in the queue, perform the following three operations in sequence: Code generation: Invoke the code generation agent to generate the corresponding code file based on the file path, function description, and interface protocol of the node in the RPG graph; Test generation: Invoke the test case agent to generate corresponding test code based on the generated code and the test case type definition in the RPG diagram; Documentation generation: Call the documentation generation agent to generate the documentation for this feature node based on the code implementation and interface rules.
[0053] Existing technologies rely on natural language for communication between multiple agents, leading to problems such as semantic ambiguity, information distortion, lack of a unified planning view, and poor scalability. This method introduces a structured planning graph as the core coordination mechanism, replacing natural language communication to achieve automated and scalable generation from high-level requirements to executable code repositories. This method can generate unified and accurate software system blueprints, ensuring consistency of interfaces between modules and correctness of data flow. Leveraging the powerful coding capabilities of current language models, it significantly improves the reliability, maintainability, and scalability of code generation, supporting the automated construction of large-scale complex software projects.
[0054] This invention also claims a hierarchical planning graph-based intelligent code repository generation system, comprising: Natural Language Requirements Parsing Module: Used to parse natural language requirements into a structured information list; High-level functional dependency graph construction module: Constructs a high-level functional dependency directed acyclic graph (DAG) without logical conflicts based on a structured information list; Detailed Repository Planning Graph (RPG) Generation Module: Used to refine a Directed Acyclic Graph (DAG) into a Repository Planning Graph (RPG) that can guide code generation; AI Agent Co-scheduling Module: Used to parse the code repository planning graph (RPG) and schedule AI agents according to their dependency order; Code and documentation generation execution module: generates code, test code, and documentation; This system can implement the intelligent code repository generation method based on hierarchical planning graphs described in the above embodiments.
[0055] 1. Natural Language Requirement Parsing Module: This module, serving as the system requirement entry processing unit, transforms unstructured natural language requirements input by users into a structured information list containing functional demands, constraints, and requirement intents, providing standardized input for the next module (the high-level functional dependency graph construction module). The module integrates three core units—an input cleaning component, a requirement element extraction engine, and a structured list generation component—through a three-stage process: "input preprocessing - core element extraction - structured integration." The input cleaning component standardizes the format of the natural language input from the user and filters out redundant information to ensure that the text is clear and readable. The requirement element extraction engine, based on the Large Language Model (LLM), extracts three major elements from the cleaned requirement text: core functional requirements, non-functional constraints, and requirement intent. The structured list generation component uses a preset JSON format template and defines required fields to integrate the extracted required elements in a fixed format to generate a structured information list.
[0056] 2. High-level functional dependency graph construction module: This module takes the structured requirement list output by the natural language requirement parsing module as input, and constructs a high-level functional dependency graph through a four-stage process of "multi-way retrieval matching functional modules - dependency analysis - graph structure generation - validity verification". Finally, it generates a directed acyclic graph (DAG) without logical conflicts, providing a functional blueprint for the subsequent generation of detailed code repository planning diagrams.
[0057] Step 1: Multi-path search and matching function module: Input reception: Obtain the "Functional Requirements" field from the structured requirements list and extract the text description of each function. Keyword retrieval (BM25): The retrieval function knowledge base iterates through the functional requirements and scores of the previous step.
[0058] Vector retrieval (Embedding): Convert the "functional requirements" text into vectors, calculate the cosine similarity with pre-stored vectors in the knowledge base, and select the top TOPK candidates.
[0059] Merged retrieval: The candidate scores of keywords and vector searches are weighted and the top K candidates are selected.
[0060] Candidate module reordering: Based on the Reranker model, the retrieved candidates are reordered and merged, and the top N candidates are selected.
[0061] Step 2: Dependency Analysis Dependency analysis: Based on the reordering candidates from step 1 and the structured list from the previous module, analyze and generate the high-level dependencies required by the target code repository.
[0062] Update list: Update high-level dependencies to the structured requirements list.
[0063] Step 3: Graph Structure Generation and Verification DAG Generation: Based on the "structured requirements list with dependencies", high-level functional goals and logical dependency directions are extracted. Using functional goals as nodes and dependencies as edges, a directed acyclic graph (DAG) is constructed using the NetworkX library. Only the node names and dependency directions are retained, without involving technical implementation details.
[0064] Verification: Two types of verification are used to ensure the rationality of strategic planning: First, loop dependency detection to check for the existence of closed loops such as "Function A → Function B → Function A"; second, function coverage verification to confirm that the core functional requirements in the requirements correspond to the nodes in the diagram and that no functions are omitted.
[0065] 3. RPG generation module: This module refines the high-level functional dependency graph (DAG) into a detailed code repository planning graph (RPG) that can guide code generation. Each functional node in the high-level functional dependency graph is broken down into specific technical implementation units, as follows: (1) Breakdown of technical units: Break down the functional nodes in the DAG graph into the smallest technical units (such as file loading units).
[0066] (2) Define core technology attributes: For each technical unit, three categories of core technical attributes are defined to provide a precise basis for code generation: File path: A unique storage path is assigned according to the project architecture specifications.
[0067] Function description: Follow the syntax of the target programming language to define the function name, functional logic, parameter list and return value type.
[0068] Interface protocol: Defines the input data format, output data format, and exception handling rules for the function. (3) Matching test case types: Based on the functional characteristics and interface type of the technical unit, match the corresponding test case type: File operation technology unit: matching unit test + exception test, covering scenarios such as normal file reading, file not found, encoding error, etc.; Cross-module call technology unit: matching interface test + integration test to verify the correctness of interaction with the data preprocessing unit and the compliance of output results.
[0069] (4) Constructing the RPG graph structure: An RPG graph structure is constructed using "file path, function, interface protocol, and test case" as four types of nodes and "data flow, dependency relationship, and call relationship" as three types of edges: Node attributes: File nodes contain the path and dependent libraries, function nodes contain the signature and the file to which it belongs, interface protocol nodes contain input and output rules, and test case nodes contain the test scenario and expected results.
[0070] Edge relationships: File node → Function node ("Containment" relationship), Function node → Interface protocol node ("Compliance" relationship), Function node → Test case node ("Tested" relationship), Upstream function node → Downstream function node ("Data flow" relationship).
[0071] (5) Output JSON format RPG file: The completed RPG graph structure is stored in JSON format, including a list of nodes, a list of edges, and version information, to ensure that the AI agent can parse and call it.
[0072] 4. AI Agent Collaborative Execution Module: This module receives a detailed code repository plan from the RPG generation module and uses a fully sequential execution mode to complete code generation, test code generation, and documentation generation sequentially according to functional nodes. The process is as follows: (1) RPG analysis and task sorting: The RPG structure is parsed, all functional nodes and their dependencies are extracted, and a linear execution queue is formed according to the dependency order to ensure that each functional node is executed only after its dependent nodes have been processed.
[0073] (2) AI agent serial execution: For each functional node in the queue, perform the following three operations in sequence: Code generation: Invoke the code generation agent to generate the corresponding code file based on the file path, function description, and interface protocol of the node in the RPG graph; Test generation: Invoke the test case agent to generate corresponding test code based on the generated code and the test case type definition in the RPG diagram; Documentation generation: Call the documentation generation agent to generate the documentation for this feature node based on the code implementation and interface rules.
[0074] The present invention also claims a smart code repository generation device based on a hierarchical planning graph, comprising: at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is used to call the machine-readable program to implement the intelligent code repository generation method based on hierarchical planning graphs described in the above embodiments.
[0075] This invention also provides a computer-readable medium storing computer instructions. When executed by a processor, the computer instructions cause the processor to perform the intelligent code repository generation method based on hierarchical planning graphs described in the above embodiments. Specifically, a system or apparatus equipped with a storage medium storing software program code that implements the functions of any of the embodiments described above, and enabling the computer (or CPU or MPU) of the system or apparatus to read and execute the program code stored in the storage medium.
[0076] In this case, the program code read from the storage medium can itself implement the function of any of the above embodiments, and therefore the program code and the storage medium storing the program code constitute part of the present invention.
[0077] Storage media embodiments for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, program code can be downloaded from a server computer via a communication network.
[0078] Furthermore, it should be clear that not only can the program code read by the computer be executed, but also the operating system or other components operating on the computer can be instructed based on the program code to perform some or all of the actual operations, thereby realizing the function of any of the embodiments described above.
[0079] Furthermore, it is understood that the program code read from the storage medium is written to the memory set in the expansion board inserted into the computer or to the memory set in the expansion unit connected to the computer. Then, based on the instructions of the program code, the CPU or other components installed on the expansion board or expansion unit execute some and all of the actual operations, thereby realizing the function of any of the embodiments described above.
[0080] The present invention has been shown and described in detail above with reference to the accompanying drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above embodiments, those skilled in the art will know that more embodiments of the present invention can be obtained by combining the code review methods in the different embodiments. These embodiments are also within the protection scope of the present invention.
Claims
1. A method for generating intelligent code repositories based on hierarchical planning diagrams, characterized in that, The implementation of this method includes the following steps: Transform unstructured natural language requirements into a list of structured information containing functional requirements, constraints, and intents. Using the structured information list as input, construct a high-level functional dependency directed acyclic graph without logical conflicts; The directed acyclic graph is refined into a detailed code repository planning diagram that can guide code generation, and functional nodes are broken down into technical units and core attributes are defined. Analyze the code repository planning diagram and schedule AI agents to execute tasks according to dependency order; Generate target code, test code, and documentation.
2. The intelligent code repository generation method based on hierarchical planning graphs according to claim 1, characterized in that, The process of constructing a high-level directed acyclic graph of functional dependencies includes: Multi-path retrieval matching: Results from BM25 keyword retrieval and Embedding vector retrieval are merged and then re-ranked by Reranker to select the TOP N candidates; Analyze high-level dependencies and update the inventory; A high-level directed acyclic graph of functional dependencies is constructed with functional goals as nodes and dependencies as edges. Cyclic dependency detection and functional coverage verification ensure that there are no logical conflicts.
3. The intelligent code repository generation method based on hierarchical planning graphs according to claim 1, characterized in that, The process of refining the directed acyclic graph into a detailed code repository planning diagram that can guide code generation includes: The functional nodes of the directed acyclic graph are decomposed into the smallest technical unit; Define the three core attributes of the technical unit: file path, function description, and interface protocol; Match test case types according to technology unit types; Using "files, functions, interface protocols, and test cases" as four types of nodes and "data flow, dependency relationship, and call relationship" as three types of edges, construct a code repository planning graph structure and output a JSON-formatted RPG file containing a list of nodes, a list of edges, and version information.
4. The intelligent code repository generation method based on hierarchical planning graphs according to claim 3, characterized in that, The method of matching test case types according to technical unit type: File operation technology unit: matching unit test + exception test, covering normal file reading, file non-existent, and encoding error scenarios; Cross-module call technology unit: matching interface test + integration test to verify the correctness of interaction with the data preprocessing unit and the compliance of output results.
5. The intelligent code repository generation method based on hierarchical planning graphs according to claim 1, characterized in that, Parse the code repository planning diagram and schedule AI agents to execute tasks according to dependency order; the process includes: Parse the JSON-formatted code repository planning diagram and form a linear execution queue according to the dependency order; Call each functional node in the queue sequentially.
6. A method for generating an intelligent code repository based on a hierarchical planning graph according to claim 1 or 5, characterized in that, For each functional node in the queue, perform the following three operations in sequence: Code generation: Invoke the code generation agent to generate the corresponding code file based on the file path, function description, and interface protocol of the node in the code repository planning diagram; Test generation: Invoke the test case agent to generate corresponding test code based on the generated code and the test case type definitions in the code repository planning diagram; Documentation generation: Call the documentation generation agent to generate the documentation for this feature node based on the code implementation and interface rules.
7. The intelligent code repository generation method based on hierarchical planning graphs according to claim 1, characterized in that, The process of transforming unstructured natural language requirements into a structured information list involves a three-stage workflow: input preprocessing, core element extraction, and structured integration. This workflow integrates an input cleaning component, a requirement element extraction engine, and a structured list generation component. The input cleaning component standardizes the format of the natural language input from the user and filters out redundant information to ensure that the text is clear and readable. The requirement element extraction engine, based on a large language model, extracts three major elements from the cleaned requirement text: core functional requirements, non-functional constraints, and requirement intent. The structured list generation component uses a preset JSON format template and defines required fields to integrate the extracted required elements in a fixed format to generate a structured information list.
8. An intelligent code repository generation system based on hierarchical planning graphs, characterized in that, include: Natural Language Requirements Parsing Module: Used to parse natural language requirements into a structured information list; High-level functional dependency graph construction module: Constructs a directed acyclic graph of high-level functional dependencies without logical conflicts based on a structured information list; Detailed code repository planning diagram generation module: used to refine a directed acyclic graph into a code repository planning diagram that can guide code generation; AI Agent Co-scheduling Module: Used to parse the code repository planning graph (RPG) and schedule AI agents according to their dependency order; Code and documentation generation execution module: generates code, test code, and documentation; The system is capable of implementing the method described in any one of claims 1 to 7.
9. A smart code repository generation device based on hierarchical planning diagrams, characterized in that, include: At least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is configured to invoke the machine-readable program to implement the method according to any one of claims 1 to 7.
10. A computer-readable medium, characterized in that, The computer-readable medium stores computer instructions that, when executed by a processor, enable the implementation of the method described in any one of claims 1 to 7.