Dedupe and organize skills/sources (#8731)

This commit is contained in:
Jack Amadeo
2026-04-23 15:07:45 -04:00
committed by GitHub
parent 586fa2b3c8
commit 5dd9f08d57
28 changed files with 1245 additions and 786 deletions
+24 -20
View File
@@ -403,7 +403,7 @@ export type UnarchiveSessionRequest = {
};
/**
* Create a new source (global or project-scoped).
* Create a new source in an explicit target scope (global or project-scoped).
*/
export type CreateSourceRequest = {
type: SourceType;
@@ -420,15 +420,15 @@ export type CreateSourceRequest = {
/**
* The type of source entity.
*/
export type SourceType = 'skill';
export type SourceType = 'skill' | 'builtinSkill' | 'recipe' | 'subrecipe' | 'agent';
export type CreateSourceResponse = {
source: SourceEntry;
};
/**
* A source — a user-editable entity backed by an on-disk directory. Sources
* may be either `global` (shared across all projects) or project-specific.
* A source discovered by Goose and backed by an on-disk path. Sources may be
* either `global` (shared across all projects) or project-specific.
*/
export type SourceEntry = {
type: SourceType;
@@ -436,7 +436,8 @@ export type SourceEntry = {
description: string;
content: string;
/**
* Absolute path to the source's directory on disk.
* Absolute path to the source on disk. A directory for skills, a file for
* recipes and agents.
*/
directory: string;
/**
@@ -444,11 +445,19 @@ export type SourceEntry = {
* when it lives inside a specific project.
*/
global: boolean;
/**
* Paths (absolute) of additional files that live alongside the source.
* Only skills currently populate this; empty for other source types.
*/
supportingFiles?: Array<string>;
};
/**
* List sources. If `type` is omitted, sources of all known types are returned.
* Both global and project-scoped sources are included when `project_dir` is set.
* List discovered sources.
*
* Today this endpoint only returns skills. If `type` is omitted, it defaults
* to listing skill sources. Both global and project-scoped skills are included
* when `project_dir` is set.
*/
export type ListSourcesRequest = {
type?: SourceType | null;
@@ -460,15 +469,14 @@ export type ListSourcesResponse = {
};
/**
* Update an existing source's description and content.
* Update an existing source's name, description, and content by absolute path.
*/
export type UpdateSourceRequest = {
type: SourceType;
path: string;
name: string;
description: string;
content: string;
global: boolean;
projectDir?: string | null;
};
export type UpdateSourceResponse = {
@@ -476,23 +484,19 @@ export type UpdateSourceResponse = {
};
/**
* Delete a source and its on-disk directory.
* Delete a source and its on-disk directory by absolute path.
*/
export type DeleteSourceRequest = {
type: SourceType;
name: string;
global: boolean;
projectDir?: string | null;
path: string;
};
/**
* Export a source as a portable JSON payload.
* Export a source at an absolute path as a portable JSON payload.
*/
export type ExportSourceRequest = {
type: SourceType;
name: string;
global: boolean;
projectDir?: string | null;
path: string;
};
export type ExportSourceResponse = {
@@ -502,8 +506,8 @@ export type ExportSourceResponse = {
/**
* Import a source from a JSON export payload produced by `_goose/sources/export`.
* The imported source is written under the given scope; on name collisions a
* `-imported` suffix is appended.
* The imported source is written into the explicit target scope; on name
* collisions a `-imported` suffix is appended.
*/
export type ImportSourcesRequest = {
data: string;
+26 -30
View File
@@ -345,10 +345,16 @@ export const zUnarchiveSessionRequest = z.object({
/**
* The type of source entity.
*/
export const zSourceType = z.enum(['skill']);
export const zSourceType = z.enum([
'skill',
'builtinSkill',
'recipe',
'subrecipe',
'agent'
]);
/**
* Create a new source (global or project-scoped).
* Create a new source in an explicit target scope (global or project-scoped).
*/
export const zCreateSourceRequest = z.object({
type: zSourceType,
@@ -363,8 +369,8 @@ export const zCreateSourceRequest = z.object({
});
/**
* A source — a user-editable entity backed by an on-disk directory. Sources
* may be either `global` (shared across all projects) or project-specific.
* A source discovered by Goose and backed by an on-disk path. Sources may be
* either `global` (shared across all projects) or project-specific.
*/
export const zSourceEntry = z.object({
type: zSourceType,
@@ -372,7 +378,8 @@ export const zSourceEntry = z.object({
description: z.string(),
content: z.string(),
directory: z.string(),
global: z.boolean()
global: z.boolean(),
supportingFiles: z.array(z.string()).optional()
});
export const zCreateSourceResponse = z.object({
@@ -380,8 +387,11 @@ export const zCreateSourceResponse = z.object({
});
/**
* List sources. If `type` is omitted, sources of all known types are returned.
* Both global and project-scoped sources are included when `project_dir` is set.
* List discovered sources.
*
* Today this endpoint only returns skills. If `type` is omitted, it defaults
* to listing skill sources. Both global and project-scoped skills are included
* when `project_dir` is set.
*/
export const zListSourcesRequest = z.object({
type: z.union([
@@ -399,18 +409,14 @@ export const zListSourcesResponse = z.object({
});
/**
* Update an existing source's description and content.
* Update an existing source's name, description, and content by absolute path.
*/
export const zUpdateSourceRequest = z.object({
type: zSourceType,
path: z.string(),
name: z.string(),
description: z.string(),
content: z.string(),
global: z.boolean(),
projectDir: z.union([
z.string(),
z.null()
]).optional()
content: z.string()
});
export const zUpdateSourceResponse = z.object({
@@ -418,29 +424,19 @@ export const zUpdateSourceResponse = z.object({
});
/**
* Delete a source and its on-disk directory.
* Delete a source and its on-disk directory by absolute path.
*/
export const zDeleteSourceRequest = z.object({
type: zSourceType,
name: z.string(),
global: z.boolean(),
projectDir: z.union([
z.string(),
z.null()
]).optional()
path: z.string()
});
/**
* Export a source as a portable JSON payload.
* Export a source at an absolute path as a portable JSON payload.
*/
export const zExportSourceRequest = z.object({
type: zSourceType,
name: z.string(),
global: z.boolean(),
projectDir: z.union([
z.string(),
z.null()
]).optional()
path: z.string()
});
export const zExportSourceResponse = z.object({
@@ -450,8 +446,8 @@ export const zExportSourceResponse = z.object({
/**
* Import a source from a JSON export payload produced by `_goose/sources/export`.
* The imported source is written under the given scope; on name collisions a
* `-imported` suffix is appended.
* The imported source is written into the explicit target scope; on name
* collisions a `-imported` suffix is appended.
*/
export const zImportSourcesRequest = z.object({
data: z.string(),