@toloka-platform/sdk 0.2.0-preview.2 → 0.2.0-preview.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +10 -4
  2. package/dist/cli/toloka.js +159 -151
  3. package/dist/cli/toloka.js.jsc +0 -0
  4. package/dist/cli/toloka.js.jsc.sha256 +1 -1
  5. package/dist/cli/toloka.js.sha256 +1 -1
  6. package/docs/authoring.md +18 -1
  7. package/docs/cli-v2.md +4 -3
  8. package/docs/cli.md +29 -10
  9. package/docs/getting-started.md +3 -3
  10. package/docs/limitations.md +1 -1
  11. package/docs/testing.md +1 -1
  12. package/docs/troubleshooting.md +1 -1
  13. package/examples/face-image-collection/README.md +2 -2
  14. package/openapi/gen/api.ts +78 -0
  15. package/openapi/gen/models/checkReport.ts +2 -1
  16. package/openapi/gen/models/checkReportAnyOfTwoseven.ts +5 -0
  17. package/openapi/gen/models/checkReportAnyOfTwosevenResultsItem.ts +6 -0
  18. package/openapi/gen/models/checkReportAnyOfTwosevenResultsItemVerdict.ts +2 -0
  19. package/openapi/gen/models/currentUser.ts +1 -0
  20. package/openapi/gen/models/deliveryOrder.ts +9 -0
  21. package/openapi/gen/models/deliveryOrderClientName.ts +2 -0
  22. package/openapi/gen/models/getTrainingRunMetricHistoryParams.ts +4 -0
  23. package/openapi/gen/models/index.ts +19 -0
  24. package/openapi/gen/models/listDeliveryOrders200.ts +5 -0
  25. package/openapi/gen/models/trainingRunMetricHistory.ts +9 -0
  26. package/openapi/gen/models/trainingRunMetricHistoryMetric.ts +2 -0
  27. package/openapi/gen/models/trainingRunMetricHistoryPointsItem.ts +9 -0
  28. package/openapi/gen/models/trainingRunMetricHistoryPointsItemNonFinite.ts +2 -0
  29. package/openapi/gen/models/trainingRunMetricHistoryPointsItemValue.ts +2 -0
  30. package/openapi/gen/models/trainingRunMetrics.ts +9 -0
  31. package/openapi/gen/models/trainingRunMetricsMetricsItem.ts +8 -0
  32. package/openapi/gen/models/trainingRunMetricsMetricsItemLatest.ts +9 -0
  33. package/openapi/gen/models/trainingRunMetricsMetricsItemLatestNonFinite.ts +2 -0
  34. package/openapi/gen/models/trainingRunMetricsMetricsItemLatestValue.ts +2 -0
  35. package/openapi/gen/models/trainingRunMetricsMetricsItemMetric.ts +2 -0
  36. package/openapi/gen/models/trainingRunMetricsUnavailableReason.ts +2 -0
  37. package/package.json +2 -2
  38. package/skills/catalog.json +55 -7
  39. package/skills/toloka-build/SKILL.md +10 -7
  40. package/skills/toloka-build/references/node-semantics.md +6 -4
  41. package/skills/toloka-build/references/workflow-and-cli.md +21 -13
  42. package/skills/toloka-fine-tuning/SKILL.md +72 -0
  43. package/skills/toloka-get-started/SKILL.md +55 -0
  44. package/skills/toloka-gisting/SKILL.md +76 -0
  45. package/skills/toloka-report-issue/references/report-template.md +1 -1
  46. package/src/authoring/index.ts +14 -0
  47. package/src/checks/task-ui-typecheck.ts +12 -10
  48. package/src/cli/analytics.ts +52 -6
  49. package/src/cli/auth.ts +69 -16
  50. package/src/cli/auto-update.ts +24 -33
  51. package/src/cli/check.ts +12 -10
  52. package/src/cli/commands/auth.ts +89 -0
  53. package/src/cli/commands/config.ts +28 -0
  54. package/src/cli/commands/dataset.ts +75 -0
  55. package/src/cli/commands/delivery-order.ts +18 -0
  56. package/src/cli/commands/models.ts +122 -0
  57. package/src/cli/commands/pipeline.ts +132 -0
  58. package/src/cli/commands/project.ts +175 -0
  59. package/src/cli/commands/report.ts +39 -0
  60. package/src/cli/commands/secret.ts +39 -0
  61. package/src/cli/commands/skill.ts +36 -0
  62. package/src/cli/commands/source.ts +204 -0
  63. package/src/cli/commands/status.ts +18 -0
  64. package/src/cli/commands/training.ts +228 -0
  65. package/src/cli/commands/version.ts +14 -0
  66. package/src/cli/config.ts +5 -6
  67. package/src/cli/context.ts +213 -0
  68. package/src/cli/delivery-orders.ts +30 -0
  69. package/src/cli/environment.ts +26 -0
  70. package/src/cli/init.ts +1 -4
  71. package/src/cli/program.ts +168 -1344
  72. package/src/cli/project-context.ts +9 -11
  73. package/src/cli/sdk-version.ts +38 -0
  74. package/src/cli/skill.ts +6 -2
  75. package/src/cli/terminal-io.ts +103 -0
  76. package/src/cli/trainings.ts +118 -27
  77. package/src/cli/version.ts +1 -1
  78. package/src/client.ts +18 -0
  79. package/src/importer.ts +32 -2
@@ -0,0 +1,204 @@
1
+ import { assert } from "es-toolkit";
2
+ import { writeFile } from "node:fs/promises";
3
+ import type { Command } from "commander";
4
+ import {
5
+ CHECK_RESULT_FILE_ENV,
6
+ checkProject,
7
+ watchProjectChecks,
8
+ runFreshCheck,
9
+ type CheckProjectOptions,
10
+ type CheckProjectResult,
11
+ } from "../check";
12
+ import { resolveContext, resolveInitRoot, resolveSourceRoot, type CommandHost } from "../context";
13
+ import { initProject } from "../init";
14
+ import { applyProject, importProject, planProject, validateProject } from "../project";
15
+ import { MISSING_PROJECT_ID_MESSAGE, resolveProjectContext } from "../project-context";
16
+ import { readTolokaState } from "../../state";
17
+
18
+ const runChecksInterruptibly = async (
19
+ options: CheckProjectOptions,
20
+ runner: (options: CheckProjectOptions) => Promise<CheckProjectResult>,
21
+ ): Promise<{ result: CheckProjectResult; interruptedExitCode?: number }> => {
22
+ const abortController = new AbortController();
23
+ let interruptedExitCode: number | undefined;
24
+ const interrupt = (code: number) => {
25
+ interruptedExitCode = code;
26
+ abortController.abort();
27
+ };
28
+ const interruptSigint = () => interrupt(130);
29
+ const interruptSigterm = () => interrupt(143);
30
+ process.on("SIGINT", interruptSigint);
31
+ process.on("SIGTERM", interruptSigterm);
32
+ try {
33
+ const result = await runner({ ...options, signal: abortController.signal });
34
+ return { result, ...(interruptedExitCode === undefined ? {} : { interruptedExitCode }) };
35
+ } finally {
36
+ process.off("SIGINT", interruptSigint);
37
+ process.off("SIGTERM", interruptSigterm);
38
+ }
39
+ };
40
+
41
+ export const registerSourceCommands = (program: Command, host: CommandHost): void => {
42
+ const { context, exitCode, globals } = host;
43
+ const runChecks = context.runChecks ?? checkProject;
44
+
45
+ program
46
+ .command("init")
47
+ .description("initialize this project directory and install the agent bootstrap")
48
+ .action(async () => {
49
+ const flags = globals();
50
+ const sourceRoot = resolveInitRoot(flags);
51
+ const state = await readTolokaState(sourceRoot);
52
+ const selected = resolveProjectContext({
53
+ flags,
54
+ environment: context.environment,
55
+ ...(state === undefined ? {} : { state }),
56
+ });
57
+ const result = await initProject(
58
+ sourceRoot,
59
+ selected === undefined ? {} : { projectId: selected.id },
60
+ );
61
+ context.io.stdout(result.output);
62
+ if (result.warning !== undefined) context.io.stderr(result.warning);
63
+ });
64
+
65
+ program
66
+ .command("import")
67
+ .argument(
68
+ "[projectId]",
69
+ "existing project to write into source; defaults to the selected project",
70
+ )
71
+ .option("-f, --force", "replace an existing pipelines/ directory", false)
72
+ .description("generate TypeScript source from a live project")
73
+ .action(async (projectId?: string, options?: { force?: boolean }) => {
74
+ const {
75
+ sourceRoot,
76
+ client,
77
+ projectId: selectedProjectId,
78
+ } = await resolveContext(globals(), context);
79
+ const id = projectId ?? selectedProjectId;
80
+ assert(id, MISSING_PROJECT_ID_MESSAGE);
81
+ const result = await importProject(client, {
82
+ sourceRoot,
83
+ projectId: id,
84
+ ...(options?.force === true ? { force: true } : {}),
85
+ });
86
+ context.io.stdout(result.output);
87
+ });
88
+
89
+ program
90
+ .command("plan")
91
+ .description("show what apply would change")
92
+ .action(async () => {
93
+ const { sourceRoot, client, projectId } = await resolveContext(globals(), context);
94
+ const result = await planProject(client, {
95
+ sourceRoot,
96
+ ...(projectId === undefined ? {} : { projectId }),
97
+ });
98
+ context.io.stdout(result.output);
99
+ });
100
+
101
+ program
102
+ .command("validate")
103
+ .description("run platform spec validation and report matching checks")
104
+ .action(async () => {
105
+ const { sourceRoot, client, projectId } = await resolveContext(globals(), context);
106
+ const result = await validateProject(client, {
107
+ sourceRoot,
108
+ ...(projectId === undefined ? {} : { projectId }),
109
+ });
110
+ context.io.stdout(result.output);
111
+ if (!result.valid) exitCode.value = 1;
112
+ });
113
+
114
+ program
115
+ .command("check")
116
+ .argument("[pipeline]", "pipeline source directory or name")
117
+ .option("--node <node>", "check one code or human-work node by name or id")
118
+ .option("--json", "print the structured check report", false)
119
+ .option("--watch", "rerun checks when project files change", false)
120
+ .description("run the complete local source, type, and test gate")
121
+ .action(
122
+ async (
123
+ pipeline: string | undefined,
124
+ options: { node?: string; json: boolean; watch: boolean },
125
+ ) => {
126
+ const sourceRoot = await resolveSourceRoot(globals(), context.io);
127
+ const checkOptions = {
128
+ environment: context.environment,
129
+ sourceRoot,
130
+ ...(pipeline === undefined ? {} : { pipeline }),
131
+ ...(options.node === undefined ? {} : { node: options.node }),
132
+ ...(options.json ? { json: true } : {}),
133
+ };
134
+ const writeCheckOutput = async (output: string): Promise<void> => {
135
+ const resultPath = context.environment[CHECK_RESULT_FILE_ENV];
136
+ if (resultPath === undefined) context.io.stdout(output);
137
+ else await writeFile(resultPath, output, "utf8");
138
+ };
139
+ const checkRunner =
140
+ context.runChecks === undefined &&
141
+ context.environment[CHECK_RESULT_FILE_ENV] === undefined
142
+ ? runFreshCheck
143
+ : runChecks;
144
+ if (options.watch) {
145
+ const abortController = new AbortController();
146
+ const stop = () => abortController.abort();
147
+ process.on("SIGINT", stop);
148
+ process.on("SIGTERM", stop);
149
+ try {
150
+ await watchProjectChecks(
151
+ checkOptions,
152
+ async (result) => {
153
+ await writeCheckOutput(result.output);
154
+ exitCode.value = result.exitCode;
155
+ },
156
+ undefined,
157
+ abortController.signal,
158
+ );
159
+ } finally {
160
+ process.off("SIGINT", stop);
161
+ process.off("SIGTERM", stop);
162
+ }
163
+ return;
164
+ }
165
+ const { result, interruptedExitCode } = await runChecksInterruptibly(
166
+ checkOptions,
167
+ checkRunner,
168
+ );
169
+ await writeCheckOutput(result.output);
170
+ exitCode.value = interruptedExitCode ?? result.exitCode;
171
+ },
172
+ );
173
+
174
+ program
175
+ .command("apply")
176
+ .description("check source, then make the platform match it")
177
+ .action(async () => {
178
+ const sourceRoot = await resolveSourceRoot(globals(), context.io);
179
+ const { result: checked, interruptedExitCode } = await runChecksInterruptibly(
180
+ {
181
+ sourceRoot,
182
+ environment: context.environment,
183
+ },
184
+ runChecks,
185
+ );
186
+ context.io.stdout(checked.output);
187
+ if (interruptedExitCode !== undefined) {
188
+ exitCode.value = interruptedExitCode;
189
+ return;
190
+ }
191
+ if (checked.exitCode !== 0) {
192
+ exitCode.value = checked.exitCode;
193
+ return;
194
+ }
195
+ assert(checked.source, "Passing checks must return project source");
196
+ const { client, projectId } = await resolveContext(globals(), context);
197
+ const result = await applyProject(client, {
198
+ sourceRoot,
199
+ source: checked.source,
200
+ ...(projectId === undefined ? {} : { projectId }),
201
+ });
202
+ context.io.stdout(result.output);
203
+ });
204
+ };
@@ -0,0 +1,18 @@
1
+ import { assert } from "es-toolkit";
2
+ import type { Command } from "commander";
3
+ import { resolveContext, type CommandHost } from "../context";
4
+ import { projectStatus } from "../project";
5
+ import { MISSING_PROJECT_ID_MESSAGE } from "../project-context";
6
+
7
+ export const registerStatusCommand = (program: Command, host: CommandHost): void => {
8
+ const { context, globals } = host;
9
+ program
10
+ .command("status")
11
+ .description("report project health: live counts and pending source changes")
12
+ .action(async () => {
13
+ const { sourceRoot, client, projectId } = await resolveContext(globals(), context);
14
+ assert(projectId, MISSING_PROJECT_ID_MESSAGE);
15
+ const result = await projectStatus(client, { sourceRoot, projectId });
16
+ context.io.stdout(result.output);
17
+ });
18
+ };
@@ -0,0 +1,228 @@
1
+ import { assert } from "es-toolkit";
2
+ import type { Command } from "commander";
3
+ import {
4
+ nonNegativeInteger,
5
+ positiveInteger,
6
+ resolveContext,
7
+ trainingDraftOptions,
8
+ trainingMethod,
9
+ trainingRegime,
10
+ type CommandHost,
11
+ type RawTrainingDraftOptions,
12
+ } from "../context";
13
+ import { parseBaseModelId } from "../models";
14
+ import { MISSING_PROJECT_ID_MESSAGE } from "../project-context";
15
+ import {
16
+ cancelTrainingRun,
17
+ createTraining,
18
+ createTrainingRun,
19
+ estimateTrainingCost,
20
+ getTraining,
21
+ getTrainingRun,
22
+ listTrainingRuns,
23
+ listTrainings,
24
+ readTrainingRunLogs,
25
+ readTrainingRunMetricHistory,
26
+ readTrainingRunMetrics,
27
+ resumeTrainingRun,
28
+ updateTraining,
29
+ } from "../trainings";
30
+
31
+ export const registerTrainingCommands = (program: Command, host: CommandHost): void => {
32
+ const { context, globals } = host;
33
+ const training = program.command("training").description("manage project Training drafts");
34
+ training
35
+ .command("list")
36
+ .option("--json", "print JSON", false)
37
+ .description("list active Trainings owned by the selected project")
38
+ .action(async (options: { json: boolean }) => {
39
+ const { client, projectId } = await resolveContext(globals(), context);
40
+ assert(projectId, MISSING_PROJECT_ID_MESSAGE);
41
+ await listTrainings(client, { projectId, json: options.json }, context.io);
42
+ });
43
+ training
44
+ .command("get")
45
+ .argument("<name-or-id>", "Training name or ID")
46
+ .option("--json", "print JSON", false)
47
+ .description("show one Training draft")
48
+ .action(async (nameOrId: string, options: { json: boolean }) => {
49
+ const { client, projectId } = await resolveContext(globals(), context);
50
+ assert(projectId, MISSING_PROJECT_ID_MESSAGE);
51
+ await getTraining(client, { projectId, nameOrId, json: options.json }, context.io);
52
+ });
53
+ training
54
+ .command("create")
55
+ .argument("<name>", "new Training name")
56
+ .option("--method <method>", "Training method", trainingMethod, "sft")
57
+ .option("--base-model <id>", "catalog Base Model source", parseBaseModelId)
58
+ .option("--model-version <id>", "exact Model Version source")
59
+ .requiredOption("--dataset <id>", "required training Dataset ID")
60
+ .option("--validation-dataset <id>", "optional validation Dataset ID")
61
+ .option("--train-filter <field=value>", "training Dataset field equality filter")
62
+ .option("--validation-filter <field=value>", "validation Dataset field equality filter")
63
+ .option("--regime <regime>", "Python training regime", trainingRegime)
64
+ .option("--epochs <count>", "training epochs", nonNegativeInteger)
65
+ .option("--eval-steps <count>", "SFT eval steps", positiveInteger)
66
+ .option("--prompt-file <path>", "gisting prompt text file")
67
+ .option("--json", "print JSON", false)
68
+ .description("create a normalized Training draft")
69
+ .action(async (name: string, options: RawTrainingDraftOptions & { json: boolean }) => {
70
+ const { client, projectId } = await resolveContext(globals(), context);
71
+ assert(projectId, MISSING_PROJECT_ID_MESSAGE);
72
+ await createTraining(
73
+ client,
74
+ {
75
+ ...trainingDraftOptions(options),
76
+ projectId,
77
+ name,
78
+ json: options.json,
79
+ },
80
+ context.io,
81
+ );
82
+ });
83
+ training
84
+ .command("update")
85
+ .argument("<name-or-id>", "Training name or ID")
86
+ .option("--base-model <id>", "catalog Base Model source", parseBaseModelId)
87
+ .option("--model-version <id>", "exact Model Version source")
88
+ .option("--dataset <id>", "required training Dataset ID")
89
+ .option("--validation-dataset <id>", "replacement validation Dataset ID")
90
+ .option("--train-filter <field=value>", "replacement training Dataset field equality filter")
91
+ .option(
92
+ "--validation-filter <field=value>",
93
+ "replacement validation Dataset field equality filter",
94
+ )
95
+ .option("--regime <regime>", "Python training regime", trainingRegime)
96
+ .option("--epochs <count>", "training epochs", nonNegativeInteger)
97
+ .option("--eval-steps <count>", "SFT eval steps", positiveInteger)
98
+ .option("--prompt-file <path>", "replacement gisting prompt text file")
99
+ .option("--json", "print JSON", false)
100
+ .description("replace the complete Training draft")
101
+ .action(async (nameOrId: string, options: RawTrainingDraftOptions & { json: boolean }) => {
102
+ const { client, projectId } = await resolveContext(globals(), context);
103
+ assert(projectId, MISSING_PROJECT_ID_MESSAGE);
104
+ await updateTraining(
105
+ client,
106
+ {
107
+ ...trainingDraftOptions(options),
108
+ projectId,
109
+ nameOrId,
110
+ json: options.json,
111
+ },
112
+ context.io,
113
+ );
114
+ });
115
+ training
116
+ .command("cost")
117
+ .argument("<name-or-id>", "Training name or ID")
118
+ .option("--idempotency-key <key>", "reuse one Cost Estimate input preparation")
119
+ .option("--json", "print JSON", false)
120
+ .description("validate Training inputs and calculate the maximum charge")
121
+ .action(async (nameOrId: string, options: { idempotencyKey?: string; json: boolean }) => {
122
+ const { client, projectId } = await resolveContext(globals(), context);
123
+ assert(projectId, MISSING_PROJECT_ID_MESSAGE);
124
+ await estimateTrainingCost(
125
+ client,
126
+ { projectId, nameOrId, idempotencyKey: options.idempotencyKey, json: options.json },
127
+ context.io,
128
+ );
129
+ });
130
+ training
131
+ .command("run")
132
+ .argument("<name-or-id>", "Training name or ID")
133
+ .option("--estimate-file <path>", "ready Training Cost Estimate JSON")
134
+ .option("--version-name <name>", "unique Model Version name for this run")
135
+ .option("--idempotency-key <key>", "reuse one Training Run creation")
136
+ .option("--json", "print JSON", false)
137
+ .description("calculate a ready Cost Estimate and create one queued Training Run")
138
+ .action(
139
+ async (
140
+ nameOrId: string,
141
+ options: {
142
+ estimateFile?: string;
143
+ versionName?: string;
144
+ idempotencyKey?: string;
145
+ json: boolean;
146
+ },
147
+ ) => {
148
+ const { client, projectId } = await resolveContext(globals(), context);
149
+ assert(projectId, MISSING_PROJECT_ID_MESSAGE);
150
+ await createTrainingRun(client, { projectId, nameOrId, ...options }, context.io);
151
+ },
152
+ );
153
+ training
154
+ .command("runs")
155
+ .argument("<name-or-id>", "Training name or ID")
156
+ .option("--json", "print JSON", false)
157
+ .description("list Training Run history")
158
+ .action(async (nameOrId: string, options: { json: boolean }) => {
159
+ const { client, projectId } = await resolveContext(globals(), context);
160
+ assert(projectId, MISSING_PROJECT_ID_MESSAGE);
161
+ await listTrainingRuns(client, { projectId, nameOrId, json: options.json }, context.io);
162
+ });
163
+ training
164
+ .command("status")
165
+ .argument("<training-run-id>", "Training Run ID")
166
+ .option("--json", "print JSON", false)
167
+ .description("show one Training Run")
168
+ .action(async (trainingRunId: string, options: { json: boolean }) => {
169
+ const { client } = await resolveContext(globals(), context);
170
+ await getTrainingRun(client, { trainingRunId, json: options.json }, context.io);
171
+ });
172
+ training
173
+ .command("resume")
174
+ .argument("<training-run-id>", "Training Run ID")
175
+ .option("--json", "print JSON", false)
176
+ .description("resume a Training Run blocked on funds or payment")
177
+ .action(async (trainingRunId: string, options: { json: boolean }) => {
178
+ const { client } = await resolveContext(globals(), context);
179
+ await resumeTrainingRun(client, { trainingRunId, json: options.json }, context.io);
180
+ });
181
+ training
182
+ .command("cancel")
183
+ .argument("<training-run-id>", "Training Run ID")
184
+ .option("--json", "print JSON", false)
185
+ .description("cancel a Training Run before provider work completes")
186
+ .action(async (trainingRunId: string, options: { json: boolean }) => {
187
+ const { client } = await resolveContext(globals(), context);
188
+ await cancelTrainingRun(client, { trainingRunId, json: options.json }, context.io);
189
+ });
190
+ training
191
+ .command("metrics")
192
+ .argument("<training-run-id>", "Training Run ID")
193
+ .option("--key <metric>", "read the point history of one metric instead of the summary")
194
+ .option("--resolution <count>", "history points to return, 2 to 500 (default 200)", positiveInteger)
195
+ .option("--json", "print JSON", false)
196
+ .description("read Training Run metrics")
197
+ .action(
198
+ async (
199
+ trainingRunId: string,
200
+ options: { key?: string; resolution?: number; json: boolean },
201
+ ) => {
202
+ const { client } = await resolveContext(globals(), context);
203
+ if (options.key === undefined) {
204
+ await readTrainingRunMetrics(client, { trainingRunId, json: options.json }, context.io);
205
+ return;
206
+ }
207
+ await readTrainingRunMetricHistory(
208
+ client,
209
+ {
210
+ trainingRunId,
211
+ metricKey: options.key,
212
+ resolution: options.resolution,
213
+ json: options.json,
214
+ },
215
+ context.io,
216
+ );
217
+ },
218
+ );
219
+ training
220
+ .command("logs")
221
+ .argument("<training-run-id>", "Training Run ID")
222
+ .option("--follow", "wait for new log entries until complete", false)
223
+ .description("read sanitized Training Run logs")
224
+ .action(async (trainingRunId: string, options: { follow: boolean }) => {
225
+ const { client } = await resolveContext(globals(), context);
226
+ await readTrainingRunLogs(client, { trainingRunId, follow: options.follow }, context.io);
227
+ });
228
+ };
@@ -0,0 +1,14 @@
1
+ import type { Command } from "commander";
2
+ import type { CommandHost } from "../context";
3
+ import { cliVersionInfo } from "../version";
4
+ import { SDK_VERSION } from "../sdk-version";
5
+
6
+ export const registerVersionCommand = (program: Command, host: CommandHost): void => {
7
+ program
8
+ .command("version")
9
+ .option("--json", "print version and build provenance as JSON", false)
10
+ .description("print the current CLI version")
11
+ .action((options: { json: boolean }) =>
12
+ host.context.io.stdout(options.json ? JSON.stringify(cliVersionInfo()) : SDK_VERSION),
13
+ );
14
+ };
package/src/cli/config.ts CHANGED
@@ -10,9 +10,8 @@ export type TolokaCliFlags = {
10
10
  };
11
11
 
12
12
  export type TolokaEnvironment = Readonly<Record<string, string | undefined>> & {
13
- readonly POTATO_API_KEY?: string;
14
- readonly POTATO_BASE_URL?: string;
15
- readonly POTATO_PROJECT_ID?: string;
13
+ readonly TOLOKA_API_KEY?: string;
14
+ readonly TOLOKA_BASE_URL?: string;
16
15
  readonly TOLOKA_PROJECT_ID?: string;
17
16
  };
18
17
 
@@ -54,7 +53,7 @@ const missingApiKeyMessage = [
54
53
  " toloka login",
55
54
  "",
56
55
  "It explains how to generate an API key and where it is saved. To override per command,",
57
- "pass --api-key or set POTATO_API_KEY. Run toloka auth-status to see what is in effect.",
56
+ "pass --api-key or set TOLOKA_API_KEY. Run toloka auth-status to see what is in effect.",
58
57
  ].join("\n");
59
58
 
60
59
  export function resolveTolokaConfig(
@@ -63,10 +62,10 @@ export function resolveTolokaConfig(
63
62
  environment: TolokaEnvironment,
64
63
  stored?: StoredCredentials,
65
64
  ): ResolvedTolokaConfig {
66
- const apiKey = flags.apiKey ?? environment.POTATO_API_KEY ?? stored?.apiKey;
65
+ const apiKey = flags.apiKey ?? environment.TOLOKA_API_KEY ?? stored?.apiKey;
67
66
  const baseUrl =
68
67
  flags.baseUrl ??
69
- environment.POTATO_BASE_URL ??
68
+ environment.TOLOKA_BASE_URL ??
70
69
  resolveInternalBaseUrl(environment) ??
71
70
  stored?.baseUrl ??
72
71
  PRODUCTION_BASE_URL;