exportNamespace( $_POST['sf_namespace'], null, array( 'recursive' => !empty($_POST['sf_recursive']), 'include_media' => !empty($_POST['sf_include_media']) ) ); $this->message = 'Export created: ' . hsc($result['name']) . ' (' . (int)$result['count'] . ' pages).'; $this->download = $result['name']; } catch (Exception $e) { $this->message = 'SkillForge export failed: ' . hsc($e->getMessage()); } } } public function html() { /** @var helper_plugin_skillforge $helper */ $helper = plugin_load('helper', 'skillforge'); $namespaces = $helper ? $helper->listNamespaces() : array(); $selectedNamespace = isset($_POST['sf_namespace']) ? $_POST['sf_namespace'] : ''; ptln('

SkillForge

'); ptln('

Export a DokuWiki namespace as an AI-ready Markdown package with SKILL.md, index.md, skill.json and optional media. ZIP creation uses an internal ZIP writer and does not require PHP ZipArchive.

'); if ($this->message) ptln('
' . $this->message . '
'); if ($this->download) { global $ID; $url = wl($ID ?: 'start', array( 'do' => 'skillforge_download', 'sf_file' => $this->download, 'sectok' => getSecurityToken() ), false, '&'); ptln('

Download ZIP

'); ptln('

If the button does not start a download, copy/open this link in a new tab: ' . hsc($url) . '

'); } ptln('
'); formSecurityToken(); ptln(''); ptln(''); ptln(''); ptln(''); ptln(''); ptln('
Namespace'); if ($namespaces) { ptln(''); } else { ptln(''); ptln('
No namespaces were found automatically. Enter a namespace manually.'); } ptln('
SKILL source page' . hsc($this->getConf('default_skill_source')) . ' Configured in plugin settings.
Recursive
Media
'); ptln('

'); ptln('
'); ptln('

Metadata in configured source page

'); ptln('
<frontmatter>\nname: my-skill\ndescription: What this skill helps the AI do.\nversion: 1.0.0\ntags:\n  - ai\n  - dokuwiki\n</frontmatter>
'); } }