bin/codebox.js
function(directory) {
    var git, gitRef, packagePath, packageInfos;
    packagePath = path.join(directory, "package.json");
    
    // Check directory is a git repository
    return Q.nfcall(exec, "cd "+directory+" && git config --get remote.origin.url").then(function(output) {
        git = output.join("").replace(/(\r\n|\n|\r)/gm, "");
        
        // Check package.json exists
        if (!fs.existsSync(packagePath)) {
            return Q.reject(new Error("package.json not found"));
        } else {
            return Q();
        }
    }).then(function() {
        // Read current commit
        return Q.nfcall(exec, "cd "+directory+" && git rev-parse HEAD").then(function(output) {
            gitRef = output.join("").replace(/(\r\n|\n|\r)/gm, "");
        });
    }).then(function() {
        // Read package.json
        return Q.nfcall(fs.readFile, packagePath, 'utf8');
    }).then(function(output) {
        packageInfos = JSON.parse(output);
        return Q({
            'git': git+"#"+gitRef,
            'package': packageInfos
        });
    });
}
function(directory) {
    var git, gitRef, packagePath, packageInfos;
    packagePath = path.join(directory, "package.json");
    
    // Check directory is a git repository
    return Q.nfcall(exec, "cd "+directory+" && git config --get remote.origin.url").then(function(output) {
        git = output.join("").replace(/(\r\n|\n|\r)/gm, "");
        
        // Check package.json exists
        if (!fs.existsSync(packagePath)) {
            return Q.reject(new Error("package.json not found"));
        } else {
            return Q();
        }
    }).then(function() {
        // Read current commit
        return Q.nfcall(exec, "cd "+directory+" && git rev-parse HEAD").then(function(output) {
            gitRef = output.join("").replace(/(\r\n|\n|\r)/gm, "");
        });
    }).then(function() {
        // Read package.json
        return Q.nfcall(fs.readFile, packagePath, 'utf8');
    }).then(function(output) {
        packageInfos = JSON.parse(output);
        return Q({
            'git': git+"#"+gitRef,
            'package': packageInfos
        });
    });
}
Return package info for addons