<commit_before>
// do first just to ensure variables set
// export API_URL=https://buildcanary.visualstudio.com/DefaultCollection
// export export API_TOKEN=<<PASSWORD>>
// export API_PROJECT=test
import * as cm from './common';
import * as nodeApi from 'azure-devops-node-api';
import * as cApi from 'azure-devops-node-api/CoreApi';
import * as coreInterfaces from 'azure-devops-node-api/interfaces/CoreInterfaces'

let samples: string[] = require('./samples.json');
let coreApi: cApi.ICoreApi;
const maxLoops: number = 500;

let selection: string = process.argv[2];
if (selection) {
    if (samples.indexOf(selection) == -1) {
        console.error('Not a valid sample.  See list of samples');
        process.exit(1);
    }

    samples = [selection];
}

async function createProject(projectId: string): Promise<boolean> {
    console.log('Cleaning up from last run');
    if (!(await deleteProject(projectId))) {
        console.log('Failed to delete previous project');
        return false;
    }

    const projectToCreate: coreInterfaces.TeamProject = {name: projectId,
                                                         description: 'sample project created automatically by azure-devops-node-api.',
                                                         visibility: coreInterfaces.ProjectVisibility.Public,
                                                         capabilities: {versioncontrol: {sourceControlType: 'Git'}, 
                                                                        processTemplate: {templateTypeId: '6b724908-ef14-45cf-84f8-768b5384da45'}},
                                                         _links: null,
                                                         defaultTeam: null,
                                                         abbreviation: null,
                                                         id: null,
                                                         revision: null,
                                                         state: null,
                                                         url: null};
    await coreApi.queueCreateProject(projectToCreate);

    //Poll until project exists
    let project: coreInterfaces.TeamProject = null;
    console.log('Waiting for project to spin up');
    let numLoops = 0;<commit_msg>Changing project visibility to private<commit_after>
// do first just to ensure variables set
// export API_URL=https://buildcanary.visualstudio.com/DefaultCollection
// export export API_TOKEN=<<PASSWORD>>
// export API_PROJECT=test
import * as cm from './common';
import * as nodeApi from 'azure-devops-node-api';
import * as cApi from 'azure-devops-node-api/CoreApi';
import * as coreInterfaces from 'azure-devops-node-api/interfaces/CoreInterfaces'

let samples: string[] = require('./samples.json');
let coreApi: cApi.ICoreApi;
const maxLoops: number = 500;

let selection: string = process.argv[2];
if (selection) {
    if (samples.indexOf(selection) == -1) {
        console.error('Not a valid sample.  See list of samples');
        process.exit(1);
    }

    samples = [selection];
}

async function createProject(projectId: string): Promise<boolean> {
    console.log('Cleaning up from last run');
    if (!(await deleteProject(projectId))) {
        console.log('Failed to delete previous project');
        return false;
    }

    const projectToCreate: coreInterfaces.TeamProject = {name: projectId,
                                                         description: 'sample project created automatically by azure-devops-node-api.',
                                                         visibility: coreInterfaces.ProjectVisibility.Private,
                                                         capabilities: {versioncontrol: {sourceControlType: 'Git'}, 
                                                                        processTemplate: {templateTypeId: '6b724908-ef14-45cf-84f8-768b5384da45'}},
                                                         _links: null,
                                                         defaultTeam: null,
                                                         abbreviation: null,
                                                         id: null,
                                                         revision: null,
                                                         state: null,
                                                         url: null};
    await coreApi.queueCreateProject(projectToCreate);

    //Poll until project exists
    let project: coreInterfaces.TeamProject = null;
    console.log('Waiting for project to spin up');
    let numLoops = 0;
{'fraction_non_alphanumeric': 0.0888793473593817, 'fraction_numerical': 0.012881064834693002, 'mean_word_length': 1.4533965244865719, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 46, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6025055', 'n_tokens_mistral': 1044, 'n_tokens_neox': 1002, 'n_words': 283}