diff --git a/CHANGELOG.md b/CHANGELOG.md index a59aec29..24f525cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +* Feature: `pos-cli check update-docs` — download the latest platformOS Liquid documentation used by the linter, keeping checks like `UndefinedObject` and `UndefinedFilter` up to date. * Temporarily disabled: `pos-cli deploy --dry-run` is currently unavailable while the feature is being propagated to all servers. It will be re-enabled once the rollout is complete. ## 6.0.0-beta.8 diff --git a/README.md b/README.md index b21b1e20..82739b58 100644 --- a/README.md +++ b/README.md @@ -231,6 +231,14 @@ The configuration file controls: - File patterns to ignore - Check-specific settings +#### Update Docs + +To download the latest platformOS Liquid documentation used by the linter: + + pos-cli check update-docs + +The linter automatically checks whether its cached documentation is stale and updates it when needed. However, if you want to be sure you have the latest platformOS filters, tags, objects, and schema, you can use this command to force a download. + ### Language Server Protocol (LSP) pos-cli includes a Language Server Protocol (LSP) server for platformOS Liquid, enabling rich editor support such as autocompletion, diagnostics, hover documentation, and go-to-definition in any LSP-compatible editor. diff --git a/bin/pos-cli-check-update-docs.js b/bin/pos-cli-check-update-docs.js new file mode 100644 index 00000000..e09e83de --- /dev/null +++ b/bin/pos-cli-check-update-docs.js @@ -0,0 +1,35 @@ +#!/usr/bin/env node +import { program } from '../lib/program.js'; +import logger from '../lib/logger.js'; +import ora from 'ora'; + +program + .name('pos-cli check update-docs') + .description('download the latest platformOS Liquid documentation used by the linter') + .action(async () => { + let platformosCheck; + try { + platformosCheck = await import('@platformos/platformos-check-node'); + } catch { + await logger.Error( + 'The @platformos/platformos-check-node package is not installed.\n' + + 'Install it with: npm install @platformos/platformos-check-node' + ); + return; + } + + const spinner = ora({ text: 'Downloading platformOS Liquid docs...', stream: process.stdout }); + spinner.start(); + + try { + await platformosCheck.updateDocs((msg) => { + if (msg) spinner.text = msg; + }); + spinner.succeed('platformOS Liquid docs updated successfully.'); + } catch (error) { + spinner.fail('Failed to update docs.'); + await logger.Error(error.message); + } + }); + +program.parse(process.argv); diff --git a/bin/pos-cli-check.js b/bin/pos-cli-check.js index 2a094bad..c8871f7e 100755 --- a/bin/pos-cli-check.js +++ b/bin/pos-cli-check.js @@ -5,4 +5,5 @@ program .name('pos-cli check') .command('run [path]', 'check Liquid code quality with platformos-check linter') .command('init [path]', 'initialize .platformos-check.yml configuration file') + .command('update-docs', 'download the latest platformOS Liquid documentation used by the linter') .parse(process.argv); diff --git a/bin/pos-cli-lsp.js b/bin/pos-cli-lsp.js old mode 100644 new mode 100755