skyboard-cli 0.1.0

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.
@@ -0,0 +1,97 @@
1
+ // Synced from ../src/lib/schemas.ts
2
+ import { z } from "zod";
3
+
4
+ const MAX_STRING = 50_000;
5
+ const MAX_EMOJI = 32;
6
+ const MAX_COLUMNS = 100;
7
+ const MAX_LABELS = 200;
8
+ const MAX_LABEL_IDS = 200;
9
+ const MAX_ORDER = 10_000;
10
+
11
+ const ColumnSchema = z.object({
12
+ id: z.string().max(MAX_STRING),
13
+ name: z.string().max(MAX_STRING),
14
+ order: z.number(),
15
+ });
16
+
17
+ const LabelSchema = z.object({
18
+ id: z.string().max(MAX_STRING),
19
+ name: z.string().max(MAX_STRING),
20
+ color: z.string().max(MAX_STRING),
21
+ description: z.string().max(MAX_STRING).optional(),
22
+ });
23
+
24
+ export const BoardRecordSchema = z.object({
25
+ name: z.string().max(MAX_STRING),
26
+ description: z.string().max(MAX_STRING).optional(),
27
+ columns: z.array(ColumnSchema).max(MAX_COLUMNS),
28
+ labels: z.array(LabelSchema).max(MAX_LABELS).optional(),
29
+ open: z.boolean().optional(),
30
+ createdAt: z.string().max(MAX_STRING),
31
+ });
32
+
33
+ export const TaskRecordSchema = z.object({
34
+ title: z.string().max(MAX_STRING),
35
+ description: z.string().max(MAX_STRING).optional(),
36
+ columnId: z.string().max(MAX_STRING),
37
+ boardUri: z.string().max(MAX_STRING),
38
+ position: z.string().max(MAX_STRING).optional(),
39
+ labelIds: z.array(z.string().max(MAX_STRING)).max(MAX_LABEL_IDS).optional(),
40
+ order: z.number().int().min(0).max(MAX_ORDER).optional(),
41
+ createdAt: z.string().max(MAX_STRING),
42
+ updatedAt: z.string().max(MAX_STRING).optional(),
43
+ });
44
+
45
+ const OpFieldsSchema = z.object({
46
+ title: z.string().max(MAX_STRING).optional(),
47
+ description: z.string().max(MAX_STRING).optional(),
48
+ columnId: z.string().max(MAX_STRING).optional(),
49
+ position: z.string().max(MAX_STRING).optional(),
50
+ labelIds: z.array(z.string().max(MAX_STRING)).max(MAX_LABEL_IDS).optional(),
51
+ order: z.number().int().min(0).max(MAX_ORDER).optional(),
52
+ });
53
+
54
+ export const OpRecordSchema = z.object({
55
+ targetTaskUri: z.string().max(MAX_STRING),
56
+ boardUri: z.string().max(MAX_STRING),
57
+ fields: OpFieldsSchema,
58
+ createdAt: z.string().max(MAX_STRING),
59
+ });
60
+
61
+ export const TrustRecordSchema = z.object({
62
+ trustedDid: z.string().max(MAX_STRING),
63
+ boardUri: z.string().max(MAX_STRING),
64
+ createdAt: z.string().max(MAX_STRING),
65
+ });
66
+
67
+ export const CommentRecordSchema = z.object({
68
+ targetTaskUri: z.string().max(MAX_STRING),
69
+ boardUri: z.string().max(MAX_STRING),
70
+ text: z.string().max(MAX_STRING),
71
+ createdAt: z.string().max(MAX_STRING),
72
+ });
73
+
74
+ export const ApprovalRecordSchema = z.object({
75
+ targetUri: z.string().max(MAX_STRING),
76
+ boardUri: z.string().max(MAX_STRING),
77
+ createdAt: z.string().max(MAX_STRING),
78
+ });
79
+
80
+ export const ReactionRecordSchema = z.object({
81
+ targetTaskUri: z.string().max(MAX_STRING),
82
+ boardUri: z.string().max(MAX_STRING),
83
+ emoji: z.string().max(MAX_EMOJI),
84
+ createdAt: z.string().max(MAX_STRING),
85
+ });
86
+
87
+ export function safeParse<T>(
88
+ schema: z.ZodType<T>,
89
+ data: unknown,
90
+ label: string,
91
+ ): T | null {
92
+ const result = schema.safeParse(data);
93
+ if (!result.success) {
94
+ return null;
95
+ }
96
+ return result.data;
97
+ }
package/src/lib/tid.ts ADDED
@@ -0,0 +1,22 @@
1
+ // Synced from ../src/lib/tid.ts
2
+ import { TID } from "@atproto/common-web";
3
+
4
+ export const BOARD_COLLECTION = "dev.skyboard.board";
5
+ export const TASK_COLLECTION = "dev.skyboard.task";
6
+ export const OP_COLLECTION = "dev.skyboard.op";
7
+ export const TRUST_COLLECTION = "dev.skyboard.trust";
8
+ export const COMMENT_COLLECTION = "dev.skyboard.comment";
9
+ export const APPROVAL_COLLECTION = "dev.skyboard.approval";
10
+ export const REACTION_COLLECTION = "dev.skyboard.reaction";
11
+
12
+ export function generateTID(): string {
13
+ return TID.nextStr();
14
+ }
15
+
16
+ export function buildAtUri(
17
+ did: string,
18
+ collection: string,
19
+ rkey: string,
20
+ ): string {
21
+ return `at://${did}/${collection}/${rkey}`;
22
+ }
@@ -0,0 +1,144 @@
1
+ // Synced from ../src/lib/types.ts — stripped of Dexie auto-increment id fields
2
+
3
+ export interface Column {
4
+ id: string;
5
+ name: string;
6
+ order: number;
7
+ }
8
+
9
+ export interface Label {
10
+ id: string;
11
+ name: string;
12
+ color: string;
13
+ description?: string;
14
+ }
15
+
16
+ export interface Board {
17
+ rkey: string;
18
+ did: string;
19
+ name: string;
20
+ description?: string;
21
+ columns: Column[];
22
+ labels?: Label[];
23
+ open?: boolean;
24
+ createdAt: string;
25
+ }
26
+
27
+ export interface Task {
28
+ rkey: string;
29
+ did: string;
30
+ title: string;
31
+ description?: string;
32
+ columnId: string;
33
+ boardUri: string;
34
+ position?: string;
35
+ labelIds?: string[];
36
+ order?: number;
37
+ createdAt: string;
38
+ updatedAt?: string;
39
+ }
40
+
41
+ export interface BoardRecord {
42
+ $type: "dev.skyboard.board";
43
+ name: string;
44
+ description?: string;
45
+ columns: Column[];
46
+ labels?: Label[];
47
+ open?: boolean;
48
+ createdAt: string;
49
+ }
50
+
51
+ export interface TaskRecord {
52
+ $type: "dev.skyboard.task";
53
+ title: string;
54
+ description?: string;
55
+ columnId: string;
56
+ boardUri: string;
57
+ position?: string;
58
+ labelIds?: string[];
59
+ order?: number;
60
+ createdAt: string;
61
+ updatedAt?: string;
62
+ }
63
+
64
+ export interface OpFields {
65
+ title?: string;
66
+ description?: string;
67
+ columnId?: string;
68
+ position?: string;
69
+ labelIds?: string[];
70
+ order?: number;
71
+ }
72
+
73
+ export interface Op {
74
+ rkey: string;
75
+ did: string;
76
+ targetTaskUri: string;
77
+ boardUri: string;
78
+ fields: OpFields;
79
+ createdAt: string;
80
+ }
81
+
82
+ export interface OpRecord {
83
+ $type: "dev.skyboard.op";
84
+ targetTaskUri: string;
85
+ boardUri: string;
86
+ fields: OpFields;
87
+ createdAt: string;
88
+ }
89
+
90
+ export interface Trust {
91
+ rkey: string;
92
+ did: string;
93
+ trustedDid: string;
94
+ boardUri: string;
95
+ createdAt: string;
96
+ }
97
+
98
+ export interface TrustRecord {
99
+ $type: "dev.skyboard.trust";
100
+ trustedDid: string;
101
+ boardUri: string;
102
+ createdAt: string;
103
+ }
104
+
105
+ export interface Comment {
106
+ rkey: string;
107
+ did: string;
108
+ targetTaskUri: string;
109
+ boardUri: string;
110
+ text: string;
111
+ createdAt: string;
112
+ }
113
+
114
+ export interface CommentRecord {
115
+ $type: "dev.skyboard.comment";
116
+ targetTaskUri: string;
117
+ boardUri: string;
118
+ text: string;
119
+ createdAt: string;
120
+ }
121
+
122
+ export interface MaterializedTask {
123
+ rkey: string;
124
+ did: string;
125
+ title: string;
126
+ description?: string;
127
+ columnId: string;
128
+ boardUri: string;
129
+ position?: string;
130
+ order?: number;
131
+ createdAt: string;
132
+ updatedAt?: string;
133
+ sourceTask: Task;
134
+ appliedOps: Op[];
135
+ pendingOps: Op[];
136
+ effectiveTitle: string;
137
+ effectiveDescription?: string;
138
+ effectiveColumnId: string;
139
+ effectivePosition: string;
140
+ effectiveLabelIds: string[];
141
+ ownerDid: string;
142
+ lastModifiedBy: string;
143
+ lastModifiedAt: string;
144
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "Node16",
5
+ "moduleResolution": "Node16",
6
+ "outDir": "dist",
7
+ "rootDir": "src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "declaration": true,
12
+ "sourceMap": true
13
+ },
14
+ "include": ["src"]
15
+ }
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from "vitest/config";
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ include: ["src/__tests__/**/*.test.ts"],
6
+ },
7
+ });