id = 'thinkrank/generate-llms-txt'; $this->label = __( 'Generate ThinkRank llms.txt Preview', 'thinkrank' ); $this->description = __( 'Generate a preview of the llms.txt content without publishing it to disk. Pass an empty user_input object to preview using the currently saved settings. Use publish-llms-txt to actually write it.', 'thinkrank' ); } /** * {@inheritDoc} * * @return array */ public function get_input_schema() { return [ 'type' => 'object', 'additionalProperties' => false, 'properties' => [ 'user_input' => [ 'type' => 'object', 'description' => __( 'Optional override values for the preview. When empty, saved settings are used.', 'thinkrank' ), ], ], ]; } /** * {@inheritDoc} * * @return array */ public function get_output_schema() { return [ 'type' => 'object', 'properties' => [ 'content' => [ 'type' => 'string' ], 'sections' => [ 'type' => [ 'array', 'object' ] ], 'metadata' => [ 'type' => 'object' ], 'validation' => [ 'type' => [ 'array', 'object' ] ], ], ]; } /** * Execute ability. * * @param array $input Ability input payload. * @return array */ public function execute( $input ) { $user_input = isset( $input['user_input'] ) && is_array( $input['user_input'] ) ? $input['user_input'] : []; $manager = new LLMs_Txt_Manager(); return $manager->generate_llms_txt( $user_input, [] ); } }