mirror of
https://github.com/lmstudio-ai/lms.git
synced 2025-07-30 13:32:37 +08:00
git push takes description (#229)
This commit is contained in:
@ -10,7 +10,7 @@ import {
|
|||||||
virtualModelDefinitionSchema,
|
virtualModelDefinitionSchema,
|
||||||
} from "@lmstudio/lms-shared-types";
|
} from "@lmstudio/lms-shared-types";
|
||||||
import chalk from "chalk";
|
import chalk from "chalk";
|
||||||
import { boolean, command, flag } from "cmd-ts";
|
import { boolean, command, flag, option, optional, string, type Type } from "cmd-ts";
|
||||||
import { readFile, writeFile } from "fs/promises";
|
import { readFile, writeFile } from "fs/promises";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
import { cwd } from "process";
|
import { cwd } from "process";
|
||||||
@ -23,12 +23,31 @@ import { findProjectFolderOrExit } from "../findProjectFolder.js";
|
|||||||
import { formatSizeBytes1000 } from "../formatSizeBytes1000.js";
|
import { formatSizeBytes1000 } from "../formatSizeBytes1000.js";
|
||||||
import { createLogger, logLevelArgs } from "../logLevel.js";
|
import { createLogger, logLevelArgs } from "../logLevel.js";
|
||||||
|
|
||||||
|
const overridesType: Type<string, any> = {
|
||||||
|
async from(str) {
|
||||||
|
return JSON.parse(str);
|
||||||
|
},
|
||||||
|
displayName: "JSON",
|
||||||
|
description: "A JSON string",
|
||||||
|
};
|
||||||
|
|
||||||
export const push = command({
|
export const push = command({
|
||||||
name: "push",
|
name: "push",
|
||||||
description: "Uploads the plugin in the current folder to LM Studio Hub.",
|
description: "Uploads the plugin in the current folder to LM Studio Hub.",
|
||||||
args: {
|
args: {
|
||||||
...logLevelArgs,
|
...logLevelArgs,
|
||||||
...createClientArgs,
|
...createClientArgs,
|
||||||
|
description: option({
|
||||||
|
type: optional(string),
|
||||||
|
long: "description",
|
||||||
|
description: text`
|
||||||
|
Description of the artifact. If provided, will overwrite the existing description.
|
||||||
|
`,
|
||||||
|
}),
|
||||||
|
overrides: option({
|
||||||
|
type: optional(overridesType),
|
||||||
|
long: "overrides",
|
||||||
|
}),
|
||||||
yes: flag({
|
yes: flag({
|
||||||
type: boolean,
|
type: boolean,
|
||||||
long: "yes",
|
long: "yes",
|
||||||
@ -41,7 +60,7 @@ export const push = command({
|
|||||||
handler: async args => {
|
handler: async args => {
|
||||||
const logger = createLogger(args);
|
const logger = createLogger(args);
|
||||||
const client = await createClient(logger, args);
|
const client = await createClient(logger, args);
|
||||||
const { yes } = args;
|
const { yes, description, overrides } = args;
|
||||||
await ensureAuthenticated(client, logger, { yes });
|
await ensureAuthenticated(client, logger, { yes });
|
||||||
const currentPath = cwd();
|
const currentPath = cwd();
|
||||||
await maybeGenerateManifestJson(logger, currentPath);
|
await maybeGenerateManifestJson(logger, currentPath);
|
||||||
@ -65,6 +84,8 @@ export const push = command({
|
|||||||
|
|
||||||
await client.repository.pushArtifact({
|
await client.repository.pushArtifact({
|
||||||
path: projectPath,
|
path: projectPath,
|
||||||
|
description,
|
||||||
|
overrides,
|
||||||
onMessage: message => logger.info(message),
|
onMessage: message => logger.info(message),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user