Skip to content

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

License

Notifications You must be signed in to change notification settings

xyproto/projectinfo

Repository files navigation

projectinfo

Go Report Card GoDoc License

Given a directory of source code, gather all sorts of info and output is as chunks of JSON.

Example usage:

package main

import (
    "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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages