diff --git a/app/config/sdks.php b/app/config/sdks.php index 13fb444216..47dc8845b6 100644 --- a/app/config/sdks.php +++ b/app/config/sdks.php @@ -250,26 +250,16 @@ return [ ], ], ], - [ - 'key' => 'markdown', - 'name' => 'Markdown', - 'version' => '0.3.0', - 'url' => 'https://github.com/appwrite/sdk-for-md.git', - 'package' => 'https://www.npmjs.com/package/@appwrite.io/docs', - 'enabled' => true, - 'beta' => false, - 'dev' => false, - 'hidden' => false, - 'family' => APP_SDK_PLATFORM_CONSOLE, - 'prism' => 'markdown', - 'source' => \realpath(__DIR__ . '/../sdks/console-md'), - 'gitUrl' => 'git@github.com:appwrite/sdk-for-md.git', - 'gitRepoName' => 'sdk-for-md', - 'gitUserName' => 'appwrite', - 'gitBranch' => 'dev', - 'repoBranch' => 'main', - 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/md/CHANGELOG.md'), - ], + ], + ], + + APP_SDK_PLATFORM_STATIC => [ + 'key' => APP_SDK_PLATFORM_STATIC, + 'name' => 'Static', + 'description' => 'SDK artifacts for Appwrite integrations that do not require a generated platform API specification.', + 'enabled' => true, + 'beta' => false, + 'sdks' => [ [ 'key' => 'agent-skills', 'name' => 'AgentSkills', @@ -279,9 +269,10 @@ return [ 'beta' => false, 'dev' => false, 'hidden' => false, - 'family' => APP_SDK_PLATFORM_CONSOLE, + 'spec' => 'static', + 'family' => APP_SDK_PLATFORM_STATIC, 'prism' => 'agent-skills', - 'source' => \realpath(__DIR__ . '/../sdks/console-agent-skills'), + 'source' => \realpath(__DIR__ . '/../sdks/static-agent-skills'), 'gitUrl' => 'git@github.com:appwrite/agent-skills.git', 'gitRepoName' => 'agent-skills', 'gitUserName' => 'appwrite', @@ -298,9 +289,10 @@ return [ 'beta' => false, 'dev' => false, 'hidden' => false, - 'family' => APP_SDK_PLATFORM_CONSOLE, + 'spec' => 'static', + 'family' => APP_SDK_PLATFORM_STATIC, 'prism' => 'cursor-plugin', - 'source' => \realpath(__DIR__ . '/../sdks/console-cursor-plugin'), + 'source' => \realpath(__DIR__ . '/../sdks/static-cursor-plugin'), 'gitUrl' => 'git@github.com:appwrite/cursor-plugin.git', 'gitRepoName' => 'cursor-plugin', 'gitUserName' => 'appwrite', diff --git a/app/init/constants.php b/app/init/constants.php index 8fdd6d1a51..ab88be5854 100644 --- a/app/init/constants.php +++ b/app/init/constants.php @@ -97,6 +97,7 @@ const APP_COMPUTE_DEPLOYMENT_MAX_RETENTION = 100 * 365; // 100 years const APP_SDK_PLATFORM_SERVER = 'server'; const APP_SDK_PLATFORM_CLIENT = 'client'; const APP_SDK_PLATFORM_CONSOLE = 'console'; +const APP_SDK_PLATFORM_STATIC = 'static'; const APP_VCS_GITHUB_USERNAME = 'Appwrite'; const APP_VCS_GITHUB_EMAIL = 'team@appwrite.io'; const APP_VCS_GITHUB_URL = 'https://github.com/TeamAppwrite'; diff --git a/docs/sdks/markdown/CHANGELOG.md b/docs/sdks/markdown/CHANGELOG.md deleted file mode 100644 index 26fcb5bbce..0000000000 --- a/docs/sdks/markdown/CHANGELOG.md +++ /dev/null @@ -1,17 +0,0 @@ -# Change Log - -## 0.3.0 - -* Add `bytesMax` and `bytesUsed` properties to Collection and Table documentation -* Add `queries` parameter to `listKeys` and `keyId` parameter to `createKey` documentation -* Add `dart-3.10` and `flutter-3.38` runtimes -* Fix Teams membership docs to use `string[]` instead of `Roles[]` - -## 0.2.0 - -* Document array-based enum parameters in Markdown examples (e.g., `permissions: BrowserPermission[]`). -* Breaking change: `Output` enum has been removed; use `ImageFormat` instead. - -## 0.1.0 - -* Initial release diff --git a/src/Appwrite/Platform/Tasks/SDKs.php b/src/Appwrite/Platform/Tasks/SDKs.php index a7a5f0278f..ab6528cfe2 100644 --- a/src/Appwrite/Platform/Tasks/SDKs.php +++ b/src/Appwrite/Platform/Tasks/SDKs.php @@ -14,7 +14,6 @@ use Appwrite\SDK\Language\Flutter; use Appwrite\SDK\Language\Go; use Appwrite\SDK\Language\GraphQL; use Appwrite\SDK\Language\Kotlin; -use Appwrite\SDK\Language\Markdown; use Appwrite\SDK\Language\Node; use Appwrite\SDK\Language\PHP; use Appwrite\SDK\Language\Python; @@ -25,6 +24,7 @@ use Appwrite\SDK\Language\Rust; use Appwrite\SDK\Language\Swift; use Appwrite\SDK\Language\Web; use Appwrite\SDK\SDK; +use Appwrite\Spec\StaticSpec; use Appwrite\Spec\Swagger2; use CzProject\GitPhp\Git; use Utopia\Agents\Adapters\OpenAI; @@ -50,7 +50,10 @@ class SDKs extends Action public static function getPlatforms(): array { - return Specs::getPlatforms(); + return [ + ...Specs::getPlatforms(), + APP_SDK_PLATFORM_STATIC, + ]; } protected function getSdkConfigPath(): string @@ -171,16 +174,22 @@ class SDKs extends Action Console::log(''); Console::info("━━━ {$language['name']} SDK ({$platform['name']}, {$version}) ━━━"); - Console::log(' Fetching API spec...'); + $specFormat = $language['spec'] ?? 'swagger2'; + $spec = null; + if ($specFormat === 'static') { + Console::log(' Using static SDK spec...'); + } else { + Console::log(' Fetching API spec...'); - $specPath = __DIR__ . '/../../../../app/config/specs/swagger2-' . $version . '-' . $language['family'] . '.json'; + $specPath = __DIR__ . '/../../../../app/config/specs/swagger2-' . $version . '-' . $language['family'] . '.json'; - if (!file_exists($specPath)) { - throw new \Exception('Spec file not found: ' . $specPath . '. Please run "docker compose exec appwrite specs --version=' . $version . '" first to generate the specs.'); + if (!file_exists($specPath)) { + throw new \Exception('Spec file not found: ' . $specPath . '. Please run "docker compose exec appwrite specs --version=' . $version . '" first to generate the specs.'); + } + + $spec = file_get_contents($specPath); } - $spec = file_get_contents($specPath); - $cover = 'https://github.com/appwrite/appwrite/raw/main/public/images/github.png'; $result = \realpath(__DIR__ . '/../../../../app') . '/sdks/' . $key . '-' . $language['key']; $resultExamples = \realpath(__DIR__ . '/../../../..') . '/docs/examples/' . $version . '/' . $key . '-' . $language['key']; @@ -311,10 +320,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND case 'rest': $config = new REST(); break; - case 'markdown': - $config = new Markdown(); - $config->setNPMPackage('@appwrite.io/docs'); - break; case 'agent-skills': $config = new AgentSkills(); break; @@ -442,7 +447,18 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ? ' Generating examples...' : ' Generating SDK...'); - $sdk = new SDK($config, new Swagger2($spec)); + $sdk = new SDK( + $config, + $specFormat === 'static' + ? new StaticSpec( + title: 'Appwrite', + description: 'Appwrite backend as a service', + version: $version, + licenseName: 'BSD-3-Clause', + licenseURL: 'https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE', + ) + : new Swagger2($spec) + ); $sdk ->setName($language['name']) @@ -483,6 +499,9 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND try { $sdk->generate($result); + Console::success($examplesOnly + ? " Examples generated at {$result}" + : " SDK generated at {$result}"); } catch (\Throwable $exception) { Console::error($exception->getMessage()); }