opencode-supabase 0.1.2-alpha.0 → 0.1.2-alpha.1
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/package.json +1 -1
- package/src/server/index.ts +1 -1
- package/src/server/skills.ts +35 -8
package/package.json
CHANGED
package/src/server/index.ts
CHANGED
|
@@ -13,7 +13,7 @@ const server: Plugin = async (input, options) => {
|
|
|
13
13
|
return {
|
|
14
14
|
config: async (config) => {
|
|
15
15
|
registerSupabaseSkillPaths(config, options, {
|
|
16
|
-
warn:
|
|
16
|
+
warn: logger.warn,
|
|
17
17
|
});
|
|
18
18
|
},
|
|
19
19
|
auth: createSupabaseAuth(input, options, { logger }),
|
package/src/server/skills.ts
CHANGED
|
@@ -8,7 +8,7 @@ export const BUNDLED_SUPABASE_SKILLS = [
|
|
|
8
8
|
|
|
9
9
|
export type BundledSupabaseSkill = (typeof BUNDLED_SUPABASE_SKILLS)[number];
|
|
10
10
|
|
|
11
|
-
type Warn = (message: string, data?: unknown) =>
|
|
11
|
+
type Warn = (message: string, data?: Record<string, unknown>) => unknown;
|
|
12
12
|
|
|
13
13
|
type ResolverDeps = {
|
|
14
14
|
warn?: Warn;
|
|
@@ -21,17 +21,21 @@ type RegisterDeps = ResolverDeps & {
|
|
|
21
21
|
|
|
22
22
|
type ConfigWithSkills = object & {
|
|
23
23
|
skills?: {
|
|
24
|
-
paths?:
|
|
25
|
-
};
|
|
24
|
+
paths?: unknown;
|
|
25
|
+
} | false;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
type SkillsConfig = {
|
|
29
|
+
paths?: unknown;
|
|
30
|
+
} & Record<string, unknown>;
|
|
31
|
+
|
|
28
32
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
29
33
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
function pluginSkillsOption(options: unknown) {
|
|
33
37
|
if (!isRecord(options) || !("skills" in options)) return true;
|
|
34
|
-
return options.skills;
|
|
38
|
+
return (options as { skills?: unknown }).skills;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
export function resolveEnabledSupabaseSkills(options: unknown, deps: ResolverDeps = {}) {
|
|
@@ -48,6 +52,13 @@ export function resolveEnabledSupabaseSkills(options: unknown, deps: ResolverDep
|
|
|
48
52
|
for (const key of Object.keys(value)) {
|
|
49
53
|
if (!known.has(key)) {
|
|
50
54
|
deps.warn?.("unknown Supabase bundled skill option ignored", { skill: key });
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (value[key] !== undefined && typeof value[key] !== "boolean") {
|
|
58
|
+
deps.warn?.("invalid Supabase bundled skill option value", {
|
|
59
|
+
skill: key,
|
|
60
|
+
value: value[key] as unknown,
|
|
61
|
+
});
|
|
51
62
|
}
|
|
52
63
|
}
|
|
53
64
|
|
|
@@ -67,9 +78,24 @@ export function registerSupabaseSkillPaths(
|
|
|
67
78
|
const skillsRoot = deps.skillsRoot ?? defaultSkillsRoot();
|
|
68
79
|
const exists = deps.exists ?? fs.existsSync;
|
|
69
80
|
const enabled = resolveEnabledSupabaseSkills(options, deps);
|
|
81
|
+
const skillsConfig: SkillsConfig = isRecord(configWithSkills.skills)
|
|
82
|
+
? (configWithSkills.skills as SkillsConfig)
|
|
83
|
+
: {};
|
|
70
84
|
|
|
71
|
-
|
|
72
|
-
|
|
85
|
+
if (!isRecord(configWithSkills.skills)) {
|
|
86
|
+
configWithSkills.skills = skillsConfig;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!Array.isArray(skillsConfig.paths)) {
|
|
90
|
+
if (skillsConfig.paths !== undefined) {
|
|
91
|
+
deps.warn?.("invalid Supabase skills.paths value; resetting to array", {
|
|
92
|
+
value: skillsConfig.paths as unknown,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
skillsConfig.paths = [];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const paths = skillsConfig.paths as string[];
|
|
73
99
|
|
|
74
100
|
for (const skill of enabled) {
|
|
75
101
|
const skillPath = path.join(skillsRoot, skill);
|
|
@@ -77,8 +103,9 @@ export function registerSupabaseSkillPaths(
|
|
|
77
103
|
deps.warn?.("bundled Supabase skill directory not found", { skill, path: skillPath });
|
|
78
104
|
continue;
|
|
79
105
|
}
|
|
80
|
-
|
|
81
|
-
|
|
106
|
+
|
|
107
|
+
if (!paths.includes(skillPath)) {
|
|
108
|
+
paths.push(skillPath);
|
|
82
109
|
}
|
|
83
110
|
}
|
|
84
111
|
}
|