diff --git a/apps/frontend/src/components/public-api/public.component.tsx b/apps/frontend/src/components/public-api/public.component.tsx index a27ec7a5..1a3eed98 100644 --- a/apps/frontend/src/components/public-api/public.component.tsx +++ b/apps/frontend/src/components/public-api/public.component.tsx @@ -358,13 +358,28 @@ const McpSection = ({ ); }; -const cliSteps = [ +const localCliSteps = [ { label: 'Install the CLI', code: 'npm install -g postiz', }, { - label: 'Set your API key, copy it to your secret files', + label: 'Run: postiz auth:login', + code: 'postiz auth:login', + }, + { + label: 'Install the Postiz skill for your AI agent', + code: 'npx skills add gitroomhq/postiz-agent', + }, +] as const; + +const ciCliSteps = [ + { + label: 'Install the CLI', + code: 'npm install -g postiz', + }, + { + label: 'Set your API key as an environment variable', code: 'export POSTIZ_API_KEY="{API_KEY}"', }, { @@ -373,31 +388,29 @@ const cliSteps = [ }, ] as const; -const CliSection = ({ - apiKey, - backendUrl, -}: { - apiKey: string; - backendUrl: string; -}) => { +const CliSection = ({ apiKey }: { apiKey: string }) => { const t = useT(); - const toaster = useToaster(); + const [mode, setMode] = useState<'local' | 'ci'>('local'); const [revealed, setRevealed] = useState(false); - const steps = cliSteps.map((step) => ({ - ...step, - code: step.code.replace('{API_KEY}', apiKey), - })); + const steps = + mode === 'local' + ? localCliSteps.map((step) => ({ ...step })) + : ciCliSteps.map((step) => ({ + ...step, + code: step.code.replace('{API_KEY}', apiKey), + })); - const maskedSteps = steps.map((step) => ({ - ...step, - code: revealed - ? step.code - : step.code.replace( - new RegExp(apiKey.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), - '*'.repeat(apiKey.length) - ), - })); + const displaySteps = + mode === 'ci' && !revealed + ? steps.map((step) => ({ + ...step, + code: step.code.replace( + new RegExp(apiKey.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), + '*'.repeat(apiKey.length) + ), + })) + : steps; return (