UNPKG

alwaysai

Version:

The alwaysAI command-line interface (CLI)

42 lines 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const alwayscli_1 = require("@alwaysai/alwayscli"); const t = require("io-ts"); const model_config_file_1 = require("./model-config-file"); const keyMirror = require("keymirror"); const semver_1 = require("semver"); const Level = keyMirror({ prerelease: null, patch: null, minor: null, major: null, }); exports.levelCodec = t.keyof(Level); exports.LEVELS = Object.keys(Level); exports.modelVersionIncrement = alwayscli_1.createLeaf({ name: 'increment', description: 'Increment the "version" in your model config file', args: alwayscli_1.createOneOfInput({ placeholder: '<level>', values: exports.LEVELS, required: true, }), async action(level) { const config = model_config_file_1.modelConfigFile.read(); const { version } = config; const newVersion = semver_1.inc(version, level); model_config_file_1.modelConfigFile.update(c => { if (!newVersion) { throw new Error('Failed to increment version'); } c.version = newVersion; }); return newVersion; }, }); exports.modelVersion = alwayscli_1.createBranch({ name: 'version', description: 'Commands for managing the model version', subcommands: [exports.modelVersionIncrement], }); //# sourceMappingURL=version.js.map