Skip to content

Commit d75ad24

Browse files
committed
new docs, clean up
1 parent 2c89c05 commit d75ad24

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2138
-4
lines changed

.autodoc/docs/data/args.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"space":"cosine","numDimensions":1536}

.autodoc/docs/data/docstore.json

+1
Large diffs are not rendered by default.

.autodoc/docs/data/hnswlib.index

197 KB
Binary file not shown.

.autodoc/docs/json/package.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"fileName": "package.json",
3+
"filePath": "package.json",
4+
"url": "https://github.com/context-labs/autodoc/blob/master/package.json",
5+
"summary": "The code above is a `package.json` file for the `autodoc` project. This file is used to define the project's metadata, dependencies, and scripts. \n\nThe `name` field specifies the name of the project, which is `@context-labs/autodoc`. The `version` field specifies the version of the project, which is `0.0.1`. The `description` field provides a brief description of the project, which is `autodoc`. The `type` field specifies that the project is a module. \n\nThe `main` field specifies the entry point of the project, which is `./dist/index.js`. The `exports` field specifies the module's exports, which is `./dist/src/index.js`. \n\nThe `publishConfig` field specifies the configuration for publishing the project to a registry. In this case, the `access` field is set to `public`, which means that the project can be accessed by anyone. \n\nThe `scripts` field specifies the scripts that can be run for the project. The `build` script runs the TypeScript compiler to build the project. The `dev` script builds the project and installs it globally. \n\nThe `bin` field specifies the command-line interface (CLI) for the project. In this case, the CLI is `doc`, which runs the `index.js` file in the `dist` directory. \n\nThe `prettier` field specifies the configuration for the Prettier code formatter. \n\nThe `repository` field specifies the URL of the project's repository. \n\nThe `author` field specifies the author of the project. \n\nThe `license` field specifies the license of the project, which is `MIT`. \n\nThe `dependencies` field specifies the project's dependencies. These are packages that the project requires to run. \n\nThe `devDependencies` field specifies the project's development dependencies. These are packages that are only required during development, such as testing and linting packages. \n\nOverall, this file is essential for managing the project's dependencies, scripts, and metadata. It allows developers to easily install and run the project, as well as publish it to a registry.",
6+
"questions": "1. What is the purpose of this code and what does it do?\n \n This code is a `package.json` file for a project called `autodoc`. It contains metadata about the project, such as its name, version, description, dependencies, and scripts.\n\n2. What are the dependencies and devDependencies used in this project?\n \n The dependencies used in this project include `@dqbd/tiktoken`, `chalk`, `cli-progress`, `commander`, `esbuild`, `hnswlib-node`, `inquirer`, `istextorbinary`, `langchain`, `marked`, `marked-terminal`, `minimatch`, and `ora`. The devDependencies used in this project include `@types/commander`, `@types/figlet`, `@types/inquirer`, `@types/marked`, `@types/marked-terminal`, `@types/node`, `@typescript-eslint/eslint-plugin`, `@typescript-eslint/parser`, `eslint`, `eslint-config-next`, `eslint-config-prettier`, `eslint-plugin-prettier`, `eslint-plugin-react`, `eslint-plugin-react-hooks`, `prettier`, and `typescript`.\n\n3. What is the purpose of the `bin` property in this code?\n \n The `bin` property specifies the location of the executable script for the `doc` command, which is located at `./dist/index.js`."
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"fileName": "index.ts",
3+
"filePath": "src/cli/commands/estimate/index.ts",
4+
"url": "https://github.com/context-labs/autodoc/blob/master/src/cli/commands/estimate/index.ts",
5+
"summary": "The `estimate` function in this file is a part of the larger autodoc project and is responsible for estimating the cost of indexing a given repository. The function takes in an object with several properties including the name of the repository, its URL, the root directory, the output directory, and some other optional parameters. \n\nThe function first sets the path for the output directory where the JSON files will be stored. It then runs a dry run of the `processRepository` command to estimate the cost of indexing the repository. The `processRepository` function is imported from the `processRepository.js` file located in the `index` directory. It takes in an object with the same properties as the `estimate` function and a boolean value indicating whether it should be a dry run or not. The function returns an object with details about the models that will be created during the indexing process.\n\nOnce the `processRepository` function has completed, the `estimate` function prints the details of the models that will be created and the estimated cost of indexing the repository. The `printModelDetails` function is imported from the `LLMUtil.js` file located in the `utils` directory and takes in an array of objects representing the models. The `totalIndexCostEstimate` function is also imported from the same file and takes in the same array of objects. It calculates the total cost of indexing the repository based on the estimated cost of each model.\n\nFinally, the function logs the estimated cost to the console using the `chalk` library to color the output. It reminds the user that the estimate is just an estimate and that the actual cost may vary. It also recommends setting a limit in the OpenAI account to prevent unexpected charges.\n\nOverall, the `estimate` function provides a convenient way for users of the autodoc project to estimate the cost of indexing a repository before actually doing so. This can help users make informed decisions about whether or not to proceed with the indexing process. \n\nExample usage:\n\n```\nimport { estimate } from 'autodoc';\n\nestimate({\n name: 'my-repo',\n repositoryUrl: 'https://github.com/my-username/my-repo.git',\n root: '/path/to/repo',\n output: '/path/to/output',\n llms: true,\n ignore: ['node_modules', 'dist'],\n});\n```",
6+
"questions": "1. What is the purpose of this code?\n - This code is used to estimate the cost of indexing a repository for the Autodoc project.\n2. What dependencies does this code use?\n - This code uses several dependencies including `path`, `chalk`, and custom modules from the `../../spinner.js`, `../index/processRepository.js`, and `../../utils/LLMUtil.js` files.\n3. What input parameters does the `estimate` function expect?\n - The `estimate` function expects an object with properties `name`, `repositoryUrl`, `root`, `output`, `llms`, and `ignore`, all of which are of type `AutodocRepoConfig`."
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"folderName": "estimate",
3+
"folderPath": ".autodoc/docs/json/src/cli/commands/estimate",
4+
"url": "https://github.com/context-labs/autodoc/tree/master/.autodoc/docs/json/src/cli/commands/estimate",
5+
"files": [
6+
{
7+
"fileName": "index.ts",
8+
"filePath": "src/cli/commands/estimate/index.ts",
9+
"url": "https://github.com/context-labs/autodoc/blob/master/src/cli/commands/estimate/index.ts",
10+
"summary": "The `estimate` function in this file is a part of the larger autodoc project and is responsible for estimating the cost of indexing a given repository. The function takes in an object with several properties including the name of the repository, its URL, the root directory, the output directory, and some other optional parameters. \n\nThe function first sets the path for the output directory where the JSON files will be stored. It then runs a dry run of the `processRepository` command to estimate the cost of indexing the repository. The `processRepository` function is imported from the `processRepository.js` file located in the `index` directory. It takes in an object with the same properties as the `estimate` function and a boolean value indicating whether it should be a dry run or not. The function returns an object with details about the models that will be created during the indexing process.\n\nOnce the `processRepository` function has completed, the `estimate` function prints the details of the models that will be created and the estimated cost of indexing the repository. The `printModelDetails` function is imported from the `LLMUtil.js` file located in the `utils` directory and takes in an array of objects representing the models. The `totalIndexCostEstimate` function is also imported from the same file and takes in the same array of objects. It calculates the total cost of indexing the repository based on the estimated cost of each model.\n\nFinally, the function logs the estimated cost to the console using the `chalk` library to color the output. It reminds the user that the estimate is just an estimate and that the actual cost may vary. It also recommends setting a limit in the OpenAI account to prevent unexpected charges.\n\nOverall, the `estimate` function provides a convenient way for users of the autodoc project to estimate the cost of indexing a repository before actually doing so. This can help users make informed decisions about whether or not to proceed with the indexing process. \n\nExample usage:\n\n```\nimport { estimate } from 'autodoc';\n\nestimate({\n name: 'my-repo',\n repositoryUrl: 'https://github.com/my-username/my-repo.git',\n root: '/path/to/repo',\n output: '/path/to/output',\n llms: true,\n ignore: ['node_modules', 'dist'],\n});\n```",
11+
"questions": "1. What is the purpose of this code?\n - This code is used to estimate the cost of indexing a repository for the Autodoc project.\n2. What dependencies does this code use?\n - This code uses several dependencies including `path`, `chalk`, and custom modules from the `../../spinner.js`, `../index/processRepository.js`, and `../../utils/LLMUtil.js` files.\n3. What input parameters does the `estimate` function expect?\n - The `estimate` function expects an object with properties `name`, `repositoryUrl`, `root`, `output`, `llms`, and `ignore`, all of which are of type `AutodocRepoConfig`."
12+
}
13+
],
14+
"folders": [],
15+
"summary": "The `estimate` function in `index.ts` is designed to estimate the cost of indexing a given repository within the autodoc project. It takes an object with properties such as the repository name, URL, root directory, output directory, and optional parameters.\n\n```javascript\nimport { estimate } from 'autodoc';\n\nestimate({\n name: 'my-repo',\n repositoryUrl: 'https://github.com/my-username/my-repo.git',\n root: '/path/to/repo',\n output: '/path/to/output',\n llms: true,\n ignore: ['node_modules', 'dist'],\n});\n```\n\nThe function sets the output directory path and runs a dry run of the `processRepository` command to estimate the indexing cost. The `processRepository` function is imported from the `processRepository.js` file and takes an object with the same properties as the `estimate` function, along with a boolean value for the dry run. It returns an object containing details about the models to be created during indexing.\n\nAfter the `processRepository` function completes, the `estimate` function prints the model details and the estimated indexing cost. The `printModelDetails` and `totalIndexCostEstimate` functions are imported from the `LLMUtil.js` file, both taking an array of objects representing the models. The latter calculates the total indexing cost based on each model's estimated cost.\n\nThe estimated cost is logged to the console using the `chalk` library for colored output. The function reminds users that the estimate is approximate and actual costs may vary. It also suggests setting a limit in the OpenAI account to avoid unexpected charges.\n\nIn summary, the `estimate` function offers a convenient way for autodoc users to estimate the cost of indexing a repository before proceeding, helping them make informed decisions about the indexing process.",
16+
"questions": ""
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"fileName": "convertJsonToMarkdown.ts",
3+
"filePath": "src/cli/commands/index/convertJsonToMarkdown.ts",
4+
"url": "https://github.com/context-labs/autodoc/blob/master/src/cli/commands/index/convertJsonToMarkdown.ts",
5+
"summary": "The `convertJsonToMarkdown` function in the `autodoc` project is responsible for converting JSON files to markdown files. The function takes an object with three properties: `name`, `root`, and `output`. The `name` property is the name of the project, `root` is the root directory of the project, and `output` is the output directory where the markdown files will be created.\n\nThe function first counts the number of files in the project by calling the `traverseFileSystem` function from the `utils` module. The `traverseFileSystem` function recursively traverses the file system and calls the `processFile` function for each file. In this case, the `processFile` function increments the `files` variable for each file it processes.\n\nNext, the function creates a markdown file for each code file in the project by calling `traverseFileSystem` again. This time, the `processFile` function reads the content of the file, creates a markdown file with the same name in the output directory, and writes the markdown content to the file. The markdown content is generated from the JSON content of the file. If the file is a `summary.json` file, the content is parsed as a `FolderSummary` object, otherwise it is parsed as a `FileSummary` object. The `FolderSummary` and `FileSummary` objects have a `summary` property that contains a summary of the file, and an optional `questions` property that contains a list of questions related to the file. The markdown content includes a link to the file on GitHub, the summary, and the questions (if any).\n\nFinally, the function updates the spinner text to indicate that it is creating the markdown files, and then calls `traverseFileSystem` again to create the markdown files. Once all the files have been processed, the function updates the spinner text again to indicate that it has finished creating the markdown files.\n\nThis function can be used in the larger `autodoc` project to generate documentation for a project. The JSON files can be generated automatically by other parts of the project, and then passed to this function to generate the markdown files. The markdown files can then be used to generate HTML or PDF documentation.",
6+
"questions": "1. What is the purpose of the `convertJsonToMarkdown` function?\n \n The `convertJsonToMarkdown` function creates markdown files for each code file in a project, based on the summary and questions provided in JSON files.\n\n2. What is the `traverseFileSystem` function used for in this code?\n \n The `traverseFileSystem` function is used twice in this code to iterate through the files and folders in a project directory, and perform a specified action on each file.\n\n3. What is the purpose of the `getFileName` function?\n \n The `getFileName` function is used to modify the file path of a code file to create a corresponding markdown file path, by replacing the file extension with `.md`."
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"fileName": "createVectorStore.ts",
3+
"filePath": "src/cli/commands/index/createVectorStore.ts",
4+
"url": "https://github.com/context-labs/autodoc/blob/master/src/cli/commands/index/createVectorStore.ts",
5+
"summary": "The code in this file is responsible for creating a vector store for a set of documents. The vector store is a data structure that allows for efficient similarity search between documents based on their embeddings. The input to this code is a directory containing the documents to be indexed, and the output is a file containing the vector store.\n\nThe code first imports several modules from the `langchain` package, including the `OpenAIEmbeddings` class for generating document embeddings, the `RecursiveCharacterTextSplitter` class for splitting documents into smaller chunks, and the `Document` and `BaseDocumentLoader` classes for representing and loading documents, respectively. It also imports the `fs` module for reading files from disk, the `path` module for manipulating file paths, and the `AutodocRepoConfig` type for specifying the input and output directories.\n\nThe `processFile` function reads a file from disk and creates a `Document` object from its contents. The `processDirectory` function recursively processes all files in a directory, calling `processFile` on each file and `processDirectory` on each subdirectory. The resulting `Document` objects are collected into an array and returned.\n\nThe `RepoLoader` class extends `BaseDocumentLoader` and overrides its `load` method to call `processDirectory` on the input directory and return the resulting `Document` array.\n\nThe `createVectorStore` function is the main entry point for this code. It takes an `AutodocRepoConfig` object as input, which specifies the input and output directories. It creates a `RepoLoader` object with the input directory, loads all documents using the `load` method, splits the documents into smaller chunks using the `RecursiveCharacterTextSplitter`, generates embeddings for each chunk using `OpenAIEmbeddings`, and creates a vector store using `HNSWLib.fromDocuments`. Finally, it saves the vector store to the output file.\n\nHere is an example of how this code might be used:\n\n```typescript\nimport { createVectorStore } from 'autodoc';\n\nconst config = {\n root: '/path/to/documents',\n output: '/path/to/vectorstore.bin',\n};\n\ncreateVectorStore(config)\n .then(() => console.log('Vector store created successfully'))\n .catch((err) => console.error('Error creating vector store:', err));\n```\n\nThis code would create a vector store for all documents in the `/path/to/documents` directory and save it to the file `/path/to/vectorstore.bin`. If successful, it would log a success message to the console. If an error occurred, it would log an error message with the details of the error.",
6+
"questions": "1. What is the purpose of the `langchain` library and how is it used in this code?\n- A super smart developer might ask what the `langchain` library is and how it is being used in this code. \n- The `langchain` library is being used to import various modules such as `embeddings`, `text_splitter`, `document`, `document_loaders`, and `hnswlib`. These modules are used to process text documents and create a vector store.\n\n2. What is the purpose of the `processFile` and `processDirectory` functions?\n- A super smart developer might ask what the `processFile` and `processDirectory` functions do. \n- The `processFile` function reads a file from a given file path, creates a `Document` object with the file contents and metadata, and returns the `Document`. \n- The `processDirectory` function reads all files in a given directory path, recursively processes each file using `processFile`, and returns an array of `Document` objects.\n\n3. What is the purpose of the `createVectorStore` function and how is it used?\n- A super smart developer might ask what the `createVectorStore` function does and how it is used. \n- The `createVectorStore` function takes in an `AutodocRepoConfig` object with a `root` directory and an `output` file path, loads all documents in the `root` directory using `RepoLoader` and `processDirectory`, splits the text of each document into chunks using `RecursiveCharacterTextSplitter`, creates a vector store using `HNSWLib` and `OpenAIEmbeddings`, and saves the vector store to the `output` file path."
7+
}

0 commit comments

Comments
 (0)