{"id":17226767,"url":"https://github.com/dantleech/docbot","last_synced_at":"2025-04-14T01:13:04.156Z","repository":{"id":250345666,"uuid":"831680614","full_name":"dantleech/docbot","owner":"dantleech","description":"Documentation as Code","archived":false,"fork":false,"pushed_at":"2024-08-04T19:14:21.000Z","size":203,"stargazers_count":6,"open_issues_count":9,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T01:12:53.841Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dantleech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-21T10:00:59.000Z","updated_at":"2025-02-18T12:38:46.000Z","dependencies_parsed_at":"2024-08-03T15:22:15.655Z","dependency_job_id":"7ec36a92-5fa8-419a-bbdc-26bc34d60dc7","html_url":"https://github.com/dantleech/docbot","commit_stats":null,"previous_names":["dantleech/docbot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantleech%2Fdocbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantleech%2Fdocbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantleech%2Fdocbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantleech%2Fdocbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dantleech","download_url":"https://codeload.github.com/dantleech/docbot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248804825,"owners_count":21164135,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T04:17:11.982Z","updated_at":"2025-04-14T01:13:04.118Z","avatar_url":"https://github.com/dantleech.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"DTL Docbot\n==========\n\nDocbot **generates** up-to-date and accurate documentation by **executing** the\ndocumentation.\n\nStatus\n------\n\nI've hacked this together in 8 hours.\n\nHow it works\n------------\n\nEssentially:\n\n- You provide an article containing a set of delarative blocks.\n- The blocks are executed output is captured.\n- The documentation is rendered to a format of your choice (e.g. markdown).\n\nFeatures\n--------\n\n- Create and update files.\n- Execute shell commands and capture the output.\n- Apply assertions on the result of an executed block.\n- Add your own extensions to provide custom blocks.\n- Easily customise the output format to suit your project (e.g. Markdown,\n  Hugo, RsT, HTML, whatever).\n- Depend on other documents (pre-requisites).\n- Interact with web pages and capture screenshots (_planned_).\n- Lots of other stuff that I haven\\'t done yet.\n\nUsage\n-----\n\nCreate the following file at `docs/example.php`:\n\n```php\n\u003c?php\n\nuse DTL\\Docbot\\Article\\Article;\nuse DTL\\Docbot\\Extension\\Core\\Block\\CreateFileBlock;\nuse DTL\\Docbot\\Extension\\Core\\Block\\SectionBlock;\nuse DTL\\Docbot\\Extension\\Core\\Block\\ShellBlock;\nuse DTL\\Docbot\\Extension\\Core\\Block\\TextBlock;\n\nreturn Article::create('hello_world', 'Hello World', [\n    new SectionBlock('Running a shell command', [\n        new TextBlock(\n            'By default the documentation operates in a clean directory. ' .\n            'Create the file `%path%`:',\n            context: new CreateFileBlock('hello_world.txt', language: 'text', content: 'Hello World!'),\n        ),\n        'Now we can execute a shell command and show the contents of that file:',\n        new ShellBlock('cat hello_world.txt'),\n        'Note that the output from the shell command is shown.',\n    ]),\n]);\n```\nNow let's generate some docs!\n```shell\n$ docbot execute docs\nDocbot 0.x by Daniel Leech\nWorkspace: /home/daniel/www/dantleech/exedoc/workspace/workspace\n\n[         article] Article \"Hello World\" with 1 steps\n[         section] Section \"Running a shell command\" with 4 blocks\n[            text] By default the documentation operates in a clean directory. Create the file `%path%`:\n[     create_file] Creating text file at \"hello_world.txt\" with 12 bytes\n[            text] Now we can execute a shell command and show the contents of that file:\n[           shell] Cat hello_world.txt\n[            text] Note that the output from the shell command is shown.\n\nRendering article:\n\nWritten 417 bytes to /home/daniel/www/dantleech/exedoc/workspace/docs/hello_world.md\n\n```\nWe can view the output...\nNow we can view the generated document in `docs/hello_world.md`:\n``````text\n# docs/hello_world.md\nHello World\n===========\n\nRunning a shell command\n-----------------------\n\nBy default the documentation operates in a clean directory. Create the file `hello_world.txt`:\nCreate the following file at `hello_world.txt`:\n\n```text\nHello World!\n```\nNow we can execute a shell command and show the contents of that file:\n```shell\n$ cat hello_world.txt\nHello World!\n```\nNote that the output from the shell command is shown.\n\n\n``````\n\nInception\n---------\n\nOh no! It's a trap 😱! You're in code inception, the source for this file is in `../docs/README.php`:\n``````php\n# ../docs/README.php\n\u003c?php\n\nuse DTL\\Docbot\\Article\\Article;\nuse DTL\\Docbot\\Extension\\Core\\Block\\CreateFileBlock;\nuse DTL\\Docbot\\Extension\\Core\\Block\\SectionBlock;\nuse DTL\\Docbot\\Extension\\Core\\Block\\ShellBlock;\nuse DTL\\Docbot\\Extension\\Core\\Block\\ShowFileBlock;\nuse DTL\\Docbot\\Extension\\Core\\Block\\TextBlock;\n\nreturn Article::create('../README', 'DTL Docbot', [\n    \u003c\u003c\u003cTEXT\n    Docbot **generates** up-to-date and accurate documentation by **executing** the\n    documentation.\n    TEXT,\n    new SectionBlock('Status', [\n        'I\\'ve hacked this together in 8 hours.',\n    ]),\n    new SectionBlock('How it works', [\n        \u003c\u003c\u003cTEXT\n        Essentially:\n\n        - You provide an article containing a set of delarative blocks.\n        - The blocks are executed output is captured.\n        - The documentation is rendered to a format of your choice (e.g. markdown).\n        TEXT,\n    ]),\n    new SectionBlock('Features', [\n        \u003c\u003c\u003cTEXT\n        - Create and update files.\n        - Execute shell commands and capture the output.\n        - Apply assertions on the result of an executed block.\n        - Add your own extensions to provide custom blocks.\n        - Easily customise the output format to suit your project (e.g. Markdown,\n          Hugo, RsT, HTML, whatever).\n        - Depend on other documents (pre-requisites).\n        - Interact with web pages and capture screenshots (_planned_).\n        - Lots of other stuff that I haven\\'t done yet.\n        TEXT\n    ]),\n    new SectionBlock('Usage', [\n        new CreateFileBlock(path: 'docs/example.php', language: 'php', content: \u003c\u003c\u003c'PHP'\n            \u003c?php\n\n            use DTL\\Docbot\\Article\\Article;\n            use DTL\\Docbot\\Extension\\Core\\Block\\CreateFileBlock;\n            use DTL\\Docbot\\Extension\\Core\\Block\\SectionBlock;\n            use DTL\\Docbot\\Extension\\Core\\Block\\ShellBlock;\n            use DTL\\Docbot\\Extension\\Core\\Block\\TextBlock;\n\n            return Article::create('hello_world', 'Hello World', [\n                new SectionBlock('Running a shell command', [\n                    new TextBlock(\n                        'By default the documentation operates in a clean directory. ' .\n                        'Create the file `%path%`:',\n                        context: new CreateFileBlock('hello_world.txt', language: 'text', content: 'Hello World!'),\n                    ),\n                    'Now we can execute a shell command and show the contents of that file:',\n                    new ShellBlock('cat hello_world.txt'),\n                    'Note that the output from the shell command is shown.',\n                ]),\n            ]);\n            PHP,\n        ),\n        'Now let\\'s generate some docs!',\n        new ShellBlock('docbot execute docs', env: [\n            'PATH' =\u003e getenv('PATH', true).':'.__DIR__.'/../bin',\n        ]),\n        'We can view the output...',\n        new TextBlock(\n            'Now we can view the generated document in `%path%`:',\n            context: new ShowFileBlock('docs/hello_world.md', 'text'),\n        ),\n    ]),\n    new SectionBlock('Inception', [\n        new TextBlock(\n            'Oh no! It\\'s a trap 😱! You\\'re in code inception, the source for this file is in `%path%`:',\n            context: new ShowFileBlock('../docs/README.php', 'php'),\n        ),\n    ]),\n]);\n\n``````\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdantleech%2Fdocbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdantleech%2Fdocbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdantleech%2Fdocbot/lists"}