From 986081f3775ee9e2101b5a1ac18f49735101e7e8 Mon Sep 17 00:00:00 2001 From: kevinwang Date: Fri, 24 Apr 2026 15:50:14 -0400 Subject: [PATCH 1/4] feat: Add defaultConfig and exampleConfigs and distro --- package.json | 2 +- ...et-resource-info-response-data-schema.json | 8 ++++ src/resource-schema.json | 41 +++++++++++++++---- src/types/index.ts | 7 ++++ 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 75aa5b6..bdeb35d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@codifycli/schemas", - "version": "1.0.0", + "version": "1.1.0-beta4", "description": "JSON Schemas and types that govern the message format and Codify config formats for Codify", "type": "module", "main": "dist/index.js", diff --git a/src/messages/get-resource-info-response-data-schema.json b/src/messages/get-resource-info-response-data-schema.json index f7d75dd..5fdfe53 100644 --- a/src/messages/get-resource-info-response-data-schema.json +++ b/src/messages/get-resource-info-response-data-schema.json @@ -70,6 +70,14 @@ }, "allowMultiple": { "type": "boolean" + }, + "defaultConfig": { + "type": "object", + "description": "The default config that should be added. This prefills some parameters for the user to make it easier for them" + }, + "exampleConfigs": { + "type": "object", + "description": "Some example configs. This makes it for the user." } }, "required": ["type", "plugin"] diff --git a/src/resource-schema.json b/src/resource-schema.json index a456fa5..e8de3f6 100644 --- a/src/resource-schema.json +++ b/src/resource-schema.json @@ -9,13 +9,6 @@ "type": "string", "pattern": "^[a-zA-Z][\\w-]+$" }, - "os": { - "type": "array", - "items": { - "enum": ["linux", "macOS", "windows"] - }, - "uniqueItems": true - }, "name": { "description": "Optional name. Useful for specifying multiple resources of the same type", "type": "string", @@ -27,6 +20,40 @@ "type": "string" }, "uniqueItems": true + }, + "os": { + "type": "array", + "items": { + "enum": ["linux", "macOS", "windows"] + }, + "uniqueItems": true + }, + "distro": { + "type": "array", + "items": { + "enum": [ + "debian-based", + "rpm-based", + "arch", + "centos", + "debian", + "fedora", + "rhel", + "ubuntu", + "alpine", + "amzn", + "opensuse", + "sles", + "manjaro", + "linuxmint", + "pop", + "elementary", + "kali", + "gentoo", + "slackware" + ] + }, + "uniqueItems": true } }, "required": ["type"] diff --git a/src/types/index.ts b/src/types/index.ts index b903e49..bb35fc0 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -25,6 +25,7 @@ export interface ResourceConfig extends Config { name?: string; dependsOn?: string[]; os?: Array; + distro?: Array } export enum MessageStatus { @@ -128,6 +129,11 @@ export interface GetResourceInfoResponseData { }, sensitiveParameters?: string[]; allowMultiple: boolean; + defaultConfig?: Record; + exampleConfigs?: { + example1?: Record; + example2?: Record; + }; } export interface MatchRequestData { @@ -198,6 +204,7 @@ export interface CommandRequestData { cwd?: string; interactive?: boolean; requiresRoot?: boolean; + requiresSudoAskpass?: boolean; stdin?: boolean; } & Omit } From 31cf7bf9e3d5dc77de291dc76c0147592d93d5a4 Mon Sep 17 00:00:00 2001 From: kevinwang Date: Sat, 25 Apr 2026 21:21:46 -0400 Subject: [PATCH 2/4] feat: Add requireSudoAskpass and minSupportedCliVersion --- package.json | 2 +- src/messages/command-request-data-schema.json | 4 ++++ src/messages/initialize-response-data-schema.json | 3 +++ src/types/index.ts | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index bdeb35d..ba49b8d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@codifycli/schemas", - "version": "1.1.0-beta4", + "version": "1.1.0-beta6", "description": "JSON Schemas and types that govern the message format and Codify config formats for Codify", "type": "module", "main": "dist/index.js", diff --git a/src/messages/command-request-data-schema.json b/src/messages/command-request-data-schema.json index de464c3..695fbb9 100644 --- a/src/messages/command-request-data-schema.json +++ b/src/messages/command-request-data-schema.json @@ -32,6 +32,10 @@ "stdin": { "type": "boolean", "description": "Whether or not this command requires stdin" + }, + "requiresSudoAskpass": { + "type": "boolean", + "description": "Whether to use SUDO_ASKPASS instead of sudo -S for password delivery" } }, "additionalProperties": true diff --git a/src/messages/initialize-response-data-schema.json b/src/messages/initialize-response-data-schema.json index 04d520b..2156cd7 100644 --- a/src/messages/initialize-response-data-schema.json +++ b/src/messages/initialize-response-data-schema.json @@ -5,6 +5,9 @@ "description": "Initialize the plugin", "type": "object", "properties": { + "minSupportedCliVersion": { + "type": "string" + }, "resourceDefinitions": { "type": "array", "items": { diff --git a/src/types/index.ts b/src/types/index.ts index bb35fc0..0e887a0 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -196,6 +196,7 @@ export interface InitializeRequestData { export interface InitializeResponseData { resourceDefinitions: Array; + minSupportedCliVersion?: string; } export interface CommandRequestData { From c46aa9bd7f3a5248dbf670c025ea1a2231ed5bc7 Mon Sep 17 00:00:00 2001 From: kevinwang Date: Thu, 4 Jun 2026 22:28:47 -0400 Subject: [PATCH 3/4] feat: Add apply notes and improved error response data schemas --- package.json | 2 +- src/index.ts | 2 ++ .../apply-note-request-data-schema.json | 19 +++++++++++++++++++ src/messages/commands.ts | 3 ++- src/messages/error-response-data-schema.json | 13 ++++++++++--- src/types/index.ts | 12 ++++++++++++ 6 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 src/messages/apply-note-request-data-schema.json diff --git a/package.json b/package.json index ba49b8d..d41dd35 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@codifycli/schemas", - "version": "1.1.0-beta6", + "version": "1.1.0-beta.10", "description": "JSON Schemas and types that govern the message format and Codify config formats for Codify", "type": "module", "main": "dist/index.js", diff --git a/src/index.ts b/src/index.ts index 894fb60..bd85a62 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,6 +23,7 @@ import PressKeyToContinueRequestDataSchema from './messages/press-key-to-continu import PressKeyToContinueResponseDataSchema from './messages/press-key-to-continue-response-data-schema.json' with {type: 'json'}; import SetVerbosityRequestDataSchema from './messages/set-verbosity-request-data-schema.json' with {type: 'json'}; import EmptyResponseDataSchema from './messages/empty-response-data-schema.json' with {type: 'json'}; +import ApplyNoteRequestDataSchema from './messages/apply-note-request-data-schema.json' with {type: 'json'}; export { ConfigFileSchema, @@ -50,6 +51,7 @@ export { PressKeyToContinueResponseDataSchema, SetVerbosityRequestDataSchema, EmptyResponseDataSchema, + ApplyNoteRequestDataSchema, } export * from './types/index.js'; diff --git a/src/messages/apply-note-request-data-schema.json b/src/messages/apply-note-request-data-schema.json new file mode 100644 index 0000000..04f6527 --- /dev/null +++ b/src/messages/apply-note-request-data-schema.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "https://www.codifycli.com/apply-note-request.json", + "title": "Apply note request", + "description": "Sent by a plugin to leave a post-apply note for the user", + "type": "object", + "properties": { + "message": { + "type": "string", + "maxLength": 500 + }, + "resourceType": { + "type": "string", + "maxLength": 100 + } + }, + "required": ["message"], + "additionalProperties": false +} diff --git a/src/messages/commands.ts b/src/messages/commands.ts index 23d7271..272c404 100644 --- a/src/messages/commands.ts +++ b/src/messages/commands.ts @@ -5,5 +5,6 @@ export enum MessageCmd { APPLY = 'apply', COMMAND_REQUEST = 'command_request', PRESS_KEY_TO_CONTINUE_REQUEST = 'press_key_to_continue_request', - CODIFY_CREDENTIALS_REQUEST = 'codify_credentials_request' + CODIFY_CREDENTIALS_REQUEST = 'codify_credentials_request', + APPLY_NOTE_REQUEST = 'apply_note_request', } diff --git a/src/messages/error-response-data-schema.json b/src/messages/error-response-data-schema.json index 014fcb0..8747363 100644 --- a/src/messages/error-response-data-schema.json +++ b/src/messages/error-response-data-schema.json @@ -4,10 +4,17 @@ "title": "Error Response Schema Data", "type": "object", "properties": { - "reason": { - "description": "A human read-able reason for the error", + "errorType": { + "description": "A string identifier for the error type (e.g. 'apply_validation', 'sudo_error', 'unknown')", "type": "string" + }, + "message": { + "description": "A human-readable error message, always present", + "type": "string" + }, + "data": { + "description": "Optional structured payload whose shape depends on errorType" } }, - "required": ["reason"] + "required": ["errorType", "message"] } diff --git a/src/types/index.ts b/src/types/index.ts index 0e887a0..acd9ae3 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -33,6 +33,12 @@ export enum MessageStatus { ERROR = 'error', } +export interface PluginErrorData { + errorType: string; + message: string; + data?: unknown; +} + export interface IpcMessage { cmd: string; status?: MessageStatus; @@ -106,6 +112,7 @@ export interface PlanResponseData { }> } + export interface GetResourceInfoRequestData { type: string; } @@ -228,6 +235,11 @@ export interface SetVerbosityRequestData { export interface EmptyResponseData {} +export interface ApplyNoteRequestData { + message: string; + resourceType?: string; +} + export enum SpawnStatus { SUCCESS = 'success', ERROR = 'error', From b220ad3a776f046b1911515b748cfaf4dc7c77ac Mon Sep 17 00:00:00 2001 From: kevinwang Date: Thu, 4 Jun 2026 22:31:32 -0400 Subject: [PATCH 4/4] chore: bump package version --- package.json | 2 +- src/messages/error-response-data-schema.test.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d41dd35..1c51b8e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@codifycli/schemas", - "version": "1.1.0-beta.10", + "version": "1.2.0", "description": "JSON Schemas and types that govern the message format and Codify config formats for Codify", "type": "module", "main": "dist/index.js", diff --git a/src/messages/error-response-data-schema.test.ts b/src/messages/error-response-data-schema.test.ts index ba85ce1..e4fc815 100644 --- a/src/messages/error-response-data-schema.test.ts +++ b/src/messages/error-response-data-schema.test.ts @@ -17,7 +17,8 @@ describe('Apply request data schema', () => { it("validates an error message", () => { const validate = ajv.compile(schema); expect(validate({ - reason: "This was an error" + errorType: "unknown", + message: "This was an error" })).to.be.true; }) })