https://github.com/xyproto/projectinfo
Given a directory of source code, find the project name, contributors, collect the source code and output it all in JSON chunks with an upper token limit
https://github.com/xyproto/projectinfo
chunking go project-info
Last synced: 7 months ago
JSON representation
Given a directory of source code, find the project name, contributors, collect the source code and output it all in JSON chunks with an upper token limit
- Host: GitHub
- URL: https://github.com/xyproto/projectinfo
- Owner: xyproto
- License: bsd-3-clause
- Created: 2024-05-07T14:01:25.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-30T14:39:16.000Z (over 1 year ago)
- Last Synced: 2025-01-27T07:41:45.865Z (8 months ago)
- Topics: chunking, go, project-info
- Language: Go
- Homepage:
- Size: 48.8 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# projectinfo
[](https://goreportcard.com/report/github.com/xyproto/projectinfo) [](https://godoc.org/github.com/xyproto/projectinfo) [](https://raw.githubusercontent.com/xyproto/projectinfo/main/LICENSE)
Given a directory of source code, gather all sorts of info and output is as chunks of JSON.
Example usage:
```go
package mainimport (
"fmt"
"os""github.com/xyproto/projectinfo"
)func OutputChunks(dir string) error {
const printWarnings = true
pInfo, err := projectinfo.New(dir, printWarnings)
if err != nil {
return err
}
chunks, err := pInfo.Chunk(true, true)
if err != nil {
return err
}
for _, chunk := range chunks {
fmt.Println(chunk)
}
return nil
}func main() {
// Check for command line arguments
if len(os.Args) < 2 {
fmt.Println("Usage: info [directory]")
os.Exit(1)
}// The first argument should be the directory to scan
dir := os.Args[1]// Set the maximum token limit per chunk (approximate)
projectinfo.SetMaxTokensPerChunk(16 * 1024)if err := OutputChunks(dir); err != nil {
fmt.Printf("Failed to output project chunks: %v\n", err)
os.Exit(1)
}}
```## General info
* Version: 1.3.6
* License: BSD-3