orizu 0.0.4 → 0.0.5
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.
- package/dist/index.js +10 -6
- package/package.json +1 -1
- package/src/index.ts +11 -6
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { clearCredentials, loadCredentials, saveCredentials } from './credential
|
|
|
10
10
|
import { parseDatasetFile } from './file-parser.js';
|
|
11
11
|
import { authedFetch, getBaseUrl } from './http.js';
|
|
12
12
|
function printUsage() {
|
|
13
|
-
console.log(`orizu commands:\n\n orizu login\n orizu logout\n orizu whoami\n orizu teams list\n orizu teams create [--name <name>]\n orizu teams members list [--team <teamSlug>]\n orizu teams members add --email <email> [--team <teamSlug>]\n orizu teams members remove --email <email> [--team <teamSlug>]\n orizu teams members role --team <teamSlug> --email <email> --role <admin|member>\n orizu projects list [--team <teamSlug>]\n orizu projects create --name <name> [--team <teamSlug>]\n orizu apps list [--project <team/project>]\n orizu apps create --project <team/project> --name <name> --file <path> --input-schema <json-path> --output-schema <json-path> [--component <name>]\n orizu apps update [--app <appId>] [--project <team/project>] --file <path> --input-schema <json-path> --output-schema <json-path> [--component <name>]\n orizu apps link-dataset --dataset <datasetId> [--app <appId>] [--project <team/project>] [--version <n>]\n orizu tasks list [--project <team/project>]\n orizu tasks create --project <team/project> --dataset <datasetId> --app <appId> --title <title> [--instructions <text>] [--labels-per-item <n>]\n orizu tasks assign --task <taskId> --assignees <userId1,userId2>\n orizu tasks status --task <taskId> [--json]\n orizu datasets upload --file <path> [--project <team/project>] [--name <name>]\n orizu tasks export [--task <taskId>] [--format <csv|json|jsonl>] [--out <path>]`);
|
|
13
|
+
console.log(`orizu commands:\n\n orizu login\n orizu logout\n orizu whoami\n orizu teams list\n orizu teams create [--name <name>]\n orizu teams members list [--team <teamSlug>]\n orizu teams members add --email <email> [--team <teamSlug>]\n orizu teams members remove --email <email> [--team <teamSlug>]\n orizu teams members role --team <teamSlug> --email <email> --role <admin|member>\n orizu projects list [--team <teamSlug>]\n orizu projects create --name <name> [--team <teamSlug>]\n orizu apps list [--project <team/project>]\n orizu apps create --project <team/project> --name <name> --dataset <datasetId> --file <path> --input-schema <json-path> --output-schema <json-path> [--component <name>]\n orizu apps update [--app <appId>] [--project <team/project>] --file <path> --input-schema <json-path> --output-schema <json-path> [--component <name>]\n orizu apps link-dataset --dataset <datasetId> [--app <appId>] [--project <team/project>] [--version <n>]\n orizu tasks list [--project <team/project>]\n orizu tasks create --project <team/project> --dataset <datasetId> --app <appId> --title <title> --assignees <userId1,userId2> [--instructions <text>] [--labels-per-item <n>]\n orizu tasks assign --task <taskId> --assignees <userId1,userId2>\n orizu tasks status --task <taskId> [--json]\n orizu datasets upload --file <path> [--project <team/project>] [--name <name>]\n orizu tasks export [--task <taskId>] [--format <csv|json|jsonl>] [--out <path>]`);
|
|
14
14
|
}
|
|
15
15
|
function getArg(name) {
|
|
16
16
|
const index = process.argv.indexOf(name);
|
|
@@ -504,12 +504,13 @@ function readJsonFile(pathArg) {
|
|
|
504
504
|
async function createAppFromFile() {
|
|
505
505
|
const project = getArg('--project');
|
|
506
506
|
const name = getArg('--name');
|
|
507
|
+
const datasetId = getArg('--dataset');
|
|
507
508
|
const filePath = getArg('--file');
|
|
508
509
|
const inputSchemaPath = getArg('--input-schema');
|
|
509
510
|
const outputSchemaPath = getArg('--output-schema');
|
|
510
511
|
const component = getArg('--component') || undefined;
|
|
511
|
-
if (!project || !name || !filePath || !inputSchemaPath || !outputSchemaPath) {
|
|
512
|
-
throw new Error('Usage: orizu apps create --project <team/project> --name <name> --file <path> --input-schema <json-path> --output-schema <json-path> [--component <name>]');
|
|
512
|
+
if (!project || !name || !datasetId || !filePath || !inputSchemaPath || !outputSchemaPath) {
|
|
513
|
+
throw new Error('Usage: orizu apps create --project <team/project> --name <name> --dataset <datasetId> --file <path> --input-schema <json-path> --output-schema <json-path> [--component <name>]');
|
|
513
514
|
}
|
|
514
515
|
const sourceCode = readSourceFile(filePath);
|
|
515
516
|
const inputJsonSchema = readJsonFile(inputSchemaPath);
|
|
@@ -520,6 +521,7 @@ async function createAppFromFile() {
|
|
|
520
521
|
body: JSON.stringify({
|
|
521
522
|
projectSlug: project,
|
|
522
523
|
name,
|
|
524
|
+
datasetId,
|
|
523
525
|
sourceCode,
|
|
524
526
|
componentName: component,
|
|
525
527
|
inputJsonSchema,
|
|
@@ -612,11 +614,12 @@ async function createTask() {
|
|
|
612
614
|
const datasetId = getArg('--dataset');
|
|
613
615
|
const appId = getArg('--app');
|
|
614
616
|
const title = getArg('--title');
|
|
617
|
+
const assignees = parseCommaSeparated(getArg('--assignees'));
|
|
615
618
|
const instructions = getArg('--instructions');
|
|
616
619
|
const labelsPerItemArg = getArg('--labels-per-item');
|
|
617
620
|
const labelsPerItem = labelsPerItemArg ? Number(labelsPerItemArg) : 1;
|
|
618
|
-
if (!projectSlug || !datasetId || !appId || !title) {
|
|
619
|
-
throw new Error('Usage: orizu tasks create --project <team/project> --dataset <datasetId> --app <appId> --title <title> [--instructions <text>] [--labels-per-item <n>]');
|
|
621
|
+
if (!projectSlug || !datasetId || !appId || !title || assignees.length === 0) {
|
|
622
|
+
throw new Error('Usage: orizu tasks create --project <team/project> --dataset <datasetId> --app <appId> --title <title> --assignees <userId1,userId2> [--instructions <text>] [--labels-per-item <n>]');
|
|
620
623
|
}
|
|
621
624
|
const response = await authedFetch('/api/cli/tasks', {
|
|
622
625
|
method: 'POST',
|
|
@@ -626,6 +629,7 @@ async function createTask() {
|
|
|
626
629
|
datasetId,
|
|
627
630
|
appId,
|
|
628
631
|
title,
|
|
632
|
+
memberIds: assignees,
|
|
629
633
|
instructions,
|
|
630
634
|
requiredAssignmentsPerRow: labelsPerItem,
|
|
631
635
|
}),
|
|
@@ -634,7 +638,7 @@ async function createTask() {
|
|
|
634
638
|
throw new Error(`Failed to create task: ${await response.text()}`);
|
|
635
639
|
}
|
|
636
640
|
const data = await parseJsonResponse(response, 'Task create');
|
|
637
|
-
console.log(`Created task ${data.task.title} (${data.task.id}) [${data.task.status}], labels/item=${data.task.requiredAssignmentsPerRow}`);
|
|
641
|
+
console.log(`Created task ${data.task.title} (${data.task.id}) [${data.task.status}], labels/item=${data.task.requiredAssignmentsPerRow}, assignments=${data.assignmentsCreated}`);
|
|
638
642
|
}
|
|
639
643
|
async function assignTask() {
|
|
640
644
|
const taskId = getArg('--task');
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -91,7 +91,7 @@ interface TaskStatusPayload {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
function printUsage() {
|
|
94
|
-
console.log(`orizu commands:\n\n orizu login\n orizu logout\n orizu whoami\n orizu teams list\n orizu teams create [--name <name>]\n orizu teams members list [--team <teamSlug>]\n orizu teams members add --email <email> [--team <teamSlug>]\n orizu teams members remove --email <email> [--team <teamSlug>]\n orizu teams members role --team <teamSlug> --email <email> --role <admin|member>\n orizu projects list [--team <teamSlug>]\n orizu projects create --name <name> [--team <teamSlug>]\n orizu apps list [--project <team/project>]\n orizu apps create --project <team/project> --name <name> --file <path> --input-schema <json-path> --output-schema <json-path> [--component <name>]\n orizu apps update [--app <appId>] [--project <team/project>] --file <path> --input-schema <json-path> --output-schema <json-path> [--component <name>]\n orizu apps link-dataset --dataset <datasetId> [--app <appId>] [--project <team/project>] [--version <n>]\n orizu tasks list [--project <team/project>]\n orizu tasks create --project <team/project> --dataset <datasetId> --app <appId> --title <title> [--instructions <text>] [--labels-per-item <n>]\n orizu tasks assign --task <taskId> --assignees <userId1,userId2>\n orizu tasks status --task <taskId> [--json]\n orizu datasets upload --file <path> [--project <team/project>] [--name <name>]\n orizu tasks export [--task <taskId>] [--format <csv|json|jsonl>] [--out <path>]`)
|
|
94
|
+
console.log(`orizu commands:\n\n orizu login\n orizu logout\n orizu whoami\n orizu teams list\n orizu teams create [--name <name>]\n orizu teams members list [--team <teamSlug>]\n orizu teams members add --email <email> [--team <teamSlug>]\n orizu teams members remove --email <email> [--team <teamSlug>]\n orizu teams members role --team <teamSlug> --email <email> --role <admin|member>\n orizu projects list [--team <teamSlug>]\n orizu projects create --name <name> [--team <teamSlug>]\n orizu apps list [--project <team/project>]\n orizu apps create --project <team/project> --name <name> --dataset <datasetId> --file <path> --input-schema <json-path> --output-schema <json-path> [--component <name>]\n orizu apps update [--app <appId>] [--project <team/project>] --file <path> --input-schema <json-path> --output-schema <json-path> [--component <name>]\n orizu apps link-dataset --dataset <datasetId> [--app <appId>] [--project <team/project>] [--version <n>]\n orizu tasks list [--project <team/project>]\n orizu tasks create --project <team/project> --dataset <datasetId> --app <appId> --title <title> --assignees <userId1,userId2> [--instructions <text>] [--labels-per-item <n>]\n orizu tasks assign --task <taskId> --assignees <userId1,userId2>\n orizu tasks status --task <taskId> [--json]\n orizu datasets upload --file <path> [--project <team/project>] [--name <name>]\n orizu tasks export [--task <taskId>] [--format <csv|json|jsonl>] [--out <path>]`)
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
function getArg(name: string): string | null {
|
|
@@ -783,13 +783,14 @@ function readJsonFile(pathArg: string): Record<string, unknown> {
|
|
|
783
783
|
async function createAppFromFile() {
|
|
784
784
|
const project = getArg('--project')
|
|
785
785
|
const name = getArg('--name')
|
|
786
|
+
const datasetId = getArg('--dataset')
|
|
786
787
|
const filePath = getArg('--file')
|
|
787
788
|
const inputSchemaPath = getArg('--input-schema')
|
|
788
789
|
const outputSchemaPath = getArg('--output-schema')
|
|
789
790
|
const component = getArg('--component') || undefined
|
|
790
791
|
|
|
791
|
-
if (!project || !name || !filePath || !inputSchemaPath || !outputSchemaPath) {
|
|
792
|
-
throw new Error('Usage: orizu apps create --project <team/project> --name <name> --file <path> --input-schema <json-path> --output-schema <json-path> [--component <name>]')
|
|
792
|
+
if (!project || !name || !datasetId || !filePath || !inputSchemaPath || !outputSchemaPath) {
|
|
793
|
+
throw new Error('Usage: orizu apps create --project <team/project> --name <name> --dataset <datasetId> --file <path> --input-schema <json-path> --output-schema <json-path> [--component <name>]')
|
|
793
794
|
}
|
|
794
795
|
|
|
795
796
|
const sourceCode = readSourceFile(filePath)
|
|
@@ -801,6 +802,7 @@ async function createAppFromFile() {
|
|
|
801
802
|
body: JSON.stringify({
|
|
802
803
|
projectSlug: project,
|
|
803
804
|
name,
|
|
805
|
+
datasetId,
|
|
804
806
|
sourceCode,
|
|
805
807
|
componentName: component,
|
|
806
808
|
inputJsonSchema,
|
|
@@ -922,12 +924,13 @@ async function createTask() {
|
|
|
922
924
|
const datasetId = getArg('--dataset')
|
|
923
925
|
const appId = getArg('--app')
|
|
924
926
|
const title = getArg('--title')
|
|
927
|
+
const assignees = parseCommaSeparated(getArg('--assignees'))
|
|
925
928
|
const instructions = getArg('--instructions')
|
|
926
929
|
const labelsPerItemArg = getArg('--labels-per-item')
|
|
927
930
|
const labelsPerItem = labelsPerItemArg ? Number(labelsPerItemArg) : 1
|
|
928
931
|
|
|
929
|
-
if (!projectSlug || !datasetId || !appId || !title) {
|
|
930
|
-
throw new Error('Usage: orizu tasks create --project <team/project> --dataset <datasetId> --app <appId> --title <title> [--instructions <text>] [--labels-per-item <n>]')
|
|
932
|
+
if (!projectSlug || !datasetId || !appId || !title || assignees.length === 0) {
|
|
933
|
+
throw new Error('Usage: orizu tasks create --project <team/project> --dataset <datasetId> --app <appId> --title <title> --assignees <userId1,userId2> [--instructions <text>] [--labels-per-item <n>]')
|
|
931
934
|
}
|
|
932
935
|
|
|
933
936
|
const response = await authedFetch('/api/cli/tasks', {
|
|
@@ -938,6 +941,7 @@ async function createTask() {
|
|
|
938
941
|
datasetId,
|
|
939
942
|
appId,
|
|
940
943
|
title,
|
|
944
|
+
memberIds: assignees,
|
|
941
945
|
instructions,
|
|
942
946
|
requiredAssignmentsPerRow: labelsPerItem,
|
|
943
947
|
}),
|
|
@@ -949,9 +953,10 @@ async function createTask() {
|
|
|
949
953
|
|
|
950
954
|
const data = await parseJsonResponse<{
|
|
951
955
|
task: { id: string; title: string; status: string; requiredAssignmentsPerRow: number }
|
|
956
|
+
assignmentsCreated: number
|
|
952
957
|
}>(response, 'Task create')
|
|
953
958
|
console.log(
|
|
954
|
-
`Created task ${data.task.title} (${data.task.id}) [${data.task.status}], labels/item=${data.task.requiredAssignmentsPerRow}`
|
|
959
|
+
`Created task ${data.task.title} (${data.task.id}) [${data.task.status}], labels/item=${data.task.requiredAssignmentsPerRow}, assignments=${data.assignmentsCreated}`
|
|
955
960
|
)
|
|
956
961
|
}
|
|
957
962
|
|