@tidyfactor/doc 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/.tidyfactor +16 -0
  2. package/AGENTS.md +10 -0
  3. package/CHANGELOG.md +75 -0
  4. package/LICENSE +17 -0
  5. package/README.ar.md +180 -0
  6. package/README.de.md +44 -0
  7. package/README.es.md +44 -0
  8. package/README.fa.md +44 -0
  9. package/README.fr.md +44 -0
  10. package/README.md +198 -0
  11. package/README.pt.md +44 -0
  12. package/README.zh.md +44 -0
  13. package/SKILL.md +36 -0
  14. package/assets/hero-banner.png +0 -0
  15. package/assets/og-default.png +0 -0
  16. package/bin/add-skill.js +27 -0
  17. package/brand.json +13 -0
  18. package/package.json +59 -0
  19. package/references/commands/collect.md +15 -0
  20. package/references/commands/docsify.md +15 -0
  21. package/references/commands/generate.md +23 -0
  22. package/references/commands/init.md +15 -0
  23. package/references/commands/mkdocs.md +15 -0
  24. package/references/commands/site.md +23 -0
  25. package/references/memory/collection-sources.md +47 -0
  26. package/references/memory/doc-templates.md +73 -0
  27. package/references/memory/doc-tree.md +37 -0
  28. package/references/memory/docsify-config.md +273 -0
  29. package/references/memory/mkdocs-config.md +170 -0
  30. package/references/memory/site-engines.md +54 -0
  31. package/references/memory/stacks/js-ts.md +45 -0
  32. package/references/memory/stacks/php.md +33 -0
  33. package/references/memory/stacks/react-vue-next.md +50 -0
  34. package/references/workflows/collect.md +25 -0
  35. package/references/workflows/docsify.md +19 -0
  36. package/references/workflows/generate-api.md +21 -0
  37. package/references/workflows/generate-guide.md +20 -0
  38. package/references/workflows/generate-inline.md +20 -0
  39. package/references/workflows/generate-readme.md +20 -0
  40. package/references/workflows/init-docs.md +18 -0
  41. package/references/workflows/mkdocs.md +44 -0
  42. package/tools/build-skill.js +152 -0
  43. package/tools/validate_skill.py +124 -0
package/README.md ADDED
@@ -0,0 +1,198 @@
1
+ <div align="center">
2
+
3
+ # 📚 TidyFactor Doc `v1.3.0`
4
+ ### Automated Codebase Interview, API Generator & Dual-Engine Publishing Platform (MkDocs Material & Docsify)
5
+
6
+ **Building accurate, maintainable, secure, and browsable documentation for the era of Human-Agent Collaboration.**
7
+
8
+ [![npm version](https://img.shields.io/npm/v/@tidyfactor/doc.svg?style=for-the-badge&color=4F46E5)](https://www.npmjs.com/package/@tidyfactor/doc)
9
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=for-the-badge)](LICENSE)
10
+ [![GitHub](https://img.shields.io/badge/GitHub-TidyFactor%2FDoc-181717.svg?style=for-the-badge&logo=github)](https://github.com/TidyFactor/Doc)
11
+ [![Security Redaction Certified](https://img.shields.io/badge/Security-Redaction%20Certified-emerald.svg?style=for-the-badge)](#-enterprise-security--sanitization-guarantees)
12
+ [![Clean Links Verified](https://img.shields.io/badge/Links-Clean%20%26%20Relative-cyan.svg?style=for-the-badge)](#-clean-relative-links--navigation-standards)
13
+ [![Universal AI Agents](https://img.shields.io/badge/AI%20Agents-Universal%20Compatibility-4285F4.svg?style=for-the-badge)](README.md)
14
+ [![RTL Ready](https://img.shields.io/badge/RTL-Native%20Arabic-emerald.svg?style=for-the-badge)](README.ar.md)
15
+
16
+ [🌐 Official Website](https://tidyfactor.com/) • [📚 Documentation](https://tidyfactor.com/documentation) • [🤝 Partner (Alwkala)](https://alwkala.com/) • [⚡ Commands](#-commands--the-4-phase-documentation-lifecycle) • [🛡️ Security Guarantees](#-enterprise-security--sanitization-guarantees) • [📖 Read in Arabic (بالعربية)](README.ar.md)
17
+
18
+ <br/><br/>
19
+
20
+ <p align="center">
21
+ <img src="assets/hero-banner.png" alt="TidyFactor Doc Hero Banner" width="100%" />
22
+ </p>
23
+
24
+ </div>
25
+
26
+ ---
27
+
28
+ > [!NOTE]
29
+ > **TidyFactor Doc** is a deterministic documentation engine and Docsify architecture suite built for AI coding agents (*Google Antigravity, Claude Code, Cursor, Codex, Windsurf*). It systematically interviews a codebase—parsing source AST docblocks, Git commit rationale, runtime environment variables, and error patterns—to produce pristine, browsable `/docs` portals with zero manual drift, zero credential leaks, and zero broken local paths.
30
+
31
+ ---
32
+
33
+ ## 🌟 Value Proposition & Why TidyFactor Doc?
34
+
35
+ | For Developers & Tech Leads | For AI Coding Agents | For Open-Source & Enterprise |
36
+ |---|---|---|
37
+ | **Zero Manual Writing**: Non-destructive codebase analysis extracts architecture, API signatures, and setup flows directly from source. | **Token-Efficient Routing**: Router `SKILL.md` (~350 tokens) dispatches isolated workflows with exact memory context. | **Instant Docsify Portal**: One command transforms `/docs` into a responsive, searchable documentation website. |
38
+ | **Zero Sensitive Leakage**: Enforces automated redaction of API keys, passwords, database credentials, and production IPs. | **Fact-Grounded Only**: Agents are constrained from hallucinating signatures or parameters—everything traces to findings. | **Universal Polyglot**: Native templates for PHP 8+, TypeScript, JavaScript ES Modules, and React/Vue/Next components. |
39
+ | **Clean Relative Linking**: Eliminates broken `file:///` and machine paths (`C:\...`), guaranteeing portable markdown. | **Deterministic Validation**: Every workflow has an explicit checklist and manifest tracking in `docs/.doc-manifest.json`. | **Bilingual by Design**: Native LTR/RTL support with curated typography pairings (Inter + Cairo/Tajawal). |
40
+
41
+ ---
42
+
43
+ ## 🔄 The 4-Phase Documentation Lifecycle
44
+
45
+ `tidyfactor-doc` structures documentation generation into 4 sequential, deterministic phases:
46
+
47
+ ```mermaid
48
+ graph LR
49
+ P1["1. Init (Scaffold)"] --> P2["2. Collect (Interview)"]
50
+ P2 --> P3["3. Generate (Authoring)"]
51
+ P3 --> P4["4. Docsify (Publish)"]
52
+ ```
53
+
54
+ ```
55
+ [ Phase 1: init ] ──> Creates /docs directory tree & .doc-manifest.json
56
+
57
+ [ Phase 2: collect ] ─> Gathers 5 dimensions (Code AST, Git History, Env, Personas, Errors) into docs/.collected/
58
+
59
+ [ Phase 3: generate ] ─> Produces API refs, Guides, Inline comments, or Root README from collected facts
60
+
61
+ [ Phase 4: docsify ] ─> Assembles index.html & _sidebar.md for instant static browser preview & hosting
62
+ ```
63
+
64
+ ---
65
+
66
+ ## 🏛️ Commands & Workflows Registry
67
+
68
+ | Intent & User Request | Command | Loaded Workflow & Memory | Output Artifact |
69
+ |---|---|---|---|
70
+ | **"Set up docs for this project"** / "scaffold /docs" | `init` | `workflows/init-docs.md`<br>`memory/doc-tree.md` | `/docs` scaffold, `docs/.doc-manifest.json`, `docs/README.md` |
71
+ | **"Document this codebase"** / "gather facts for module X" | `collect` | `workflows/collect.md`<br>`memory/collection-sources.md` | `docs/.collected/<target>.md` (5-dimensional structured analysis) |
72
+ | **"Write API reference"** / "generate docs for endpoints" | `generate` | `workflows/generate-api.md`<br>`memory/doc-templates.md`<br>`memory/stacks/*.md` | `docs/api/<target>.md` (parameter tables, returns, errors, examples) |
73
+ | **"Write setup guide"** / "create architecture runbook" | `generate` | `workflows/generate-guide.md`<br>`memory/doc-templates.md` | `docs/guides/<purpose-slug>.md` (focused, single-purpose guide) |
74
+ | **"Generate project README"** / "update root README" | `generate` | `workflows/generate-readme.md`<br>`memory/doc-templates.md` | Root `README.md` (overview, install, env vars, quick start) |
75
+ | **"Add inline docblocks"** / "document public functions" | `generate` | `workflows/generate-inline.md`<br>`memory/stacks/*.md` | Direct source code edit with PHPDoc / JSDoc / TSDoc comments |
76
+ | **"Turn /docs into Docsify site"** / "deploy doc portal" | `docsify` | `workflows/docsify.md`<br>`memory/docsify-config.md` | `docs/index.html` + `docs/_sidebar.md` (instant web portal) |
77
+
78
+ ---
79
+
80
+ ## 🛡️ Enterprise Security & Sanitization Guarantees
81
+
82
+ In modern AI agent workflows, sensitive credentials and private configurations frequently leak into documentation. `tidyfactor-doc` implements strict, non-negotiable redaction rules (**Constraint 6**):
83
+
84
+ | Secret / Sensitive Category | Prohibited Leaks | Mandatory Safe Replacement |
85
+ |---|---|---|
86
+ | **API Tokens & Secret Keys** | `sk_live_948f98a7c1b2...` | `EXAMPLE_TOKEN_1234567890ABCDEFGH` or `YOUR_API_KEY` |
87
+ | **Passwords & DB Credentials** | `RootP@ssw0rd2026!` | `your_secret_password` |
88
+ | **Server & Host IPs** | `192.168.1.50`, `45.33.21.99` | `203.0.113.1` (RFC 5737 documentation prefix) |
89
+ | **Workstation File URIs** | `file:///C:/path/to/project/...` | `./docs/guides/` or `project-root/` |
90
+ | **Internal Development URLs** | `http://localhost:8080/admin` | `https://api.example.com` or `http://localhost:PORT` |
91
+ | **User Home Directories** | `/home/developer/workspace/...` | `~/project` or `/path/to/project` |
92
+
93
+ ---
94
+
95
+ ## 🌐 Clean Relative Links & Navigation Standards
96
+
97
+ To guarantee that documentation renders flawlessly on GitHub, GitLab, Docsify, and local markdown viewers, `tidyfactor-doc` enforces **Constraint 7**:
98
+
99
+ - ❌ **Zero Absolute Drive Paths**: Never output `file:///` URLs or workstation drive letters (`C:\...`, `/Users/...`).
100
+ - ✅ **Clean Markdown Relative Links**: All internal document links use standard relative paths (e.g. `[Architecture Guide](./guides/architecture.md)`).
101
+ - ✅ **Docsify Persistent Subfolder Routing**: Configures `alias: { '/.*/_sidebar.md': '/_sidebar.md' }` with root-relative leading slashes (`/guides/...`, `/api/...`) to eliminate 404 broken sidebars when navigating deep routes.
102
+ - ✅ **Localized Docs Inside Root**: Localized files reside inside `/docs` (e.g. `docs/README.ar.md`), never linking outside the `/docs` boundary.
103
+
104
+ ---
105
+
106
+ ## 📁 Canonical `/docs` Folder Hierarchy
107
+
108
+ Every project initialized and maintained by `tidyfactor-doc` strictly adheres to the flattened, no-empty-structures hierarchy:
109
+
110
+ ```
111
+ project-root/
112
+ ├── README.md # Project overview & quick start (Root)
113
+ └── docs/ # Single documentation root
114
+ ├── README.md # Doc-site landing page & introduction
115
+ ├── README.ar.md # Arabic localized overview (optional)
116
+ ├── index.html # Docsify single-page application entry point
117
+ ├── _sidebar.md # Auto-generated categorized navigation tree
118
+ ├── .doc-manifest.json # Machine-readable sync & state manifest
119
+ ├── .collected/ # Raw interview findings (intermediate artifact)
120
+ │ ├── core.md
121
+ │ └── auth-module.md
122
+ ├── api/ # Public API & endpoint specifications
123
+ │ ├── authentication.md
124
+ │ └── billing.md
125
+ └── guides/ # Targeted developer & user guides
126
+ ├── architecture.md
127
+ ├── developer-setup.md
128
+ └── deployment-runbook.md
129
+ ```
130
+
131
+ ### `.doc-manifest.json` Schema
132
+ ```json
133
+ {
134
+ "project": "my-saas-platform",
135
+ "stacks": ["php", "ts", "react"],
136
+ "collected": {
137
+ "auth": "2026-08-20T14:30:00Z",
138
+ "core": "2026-08-20T14:32:00Z"
139
+ },
140
+ "generated": {
141
+ "docs/api/auth.md": "2026-08-20T14:35:00Z",
142
+ "docs/guides/developer-setup.md": "2026-08-20T14:36:00Z",
143
+ "README.md": "2026-08-20T14:37:00Z"
144
+ }
145
+ }
146
+ ```
147
+
148
+ ---
149
+
150
+ ## 🚀 Quick Start & Injection
151
+
152
+ ### 1. Inject Skill via NPM
153
+ Add `tidyfactor-doc` to your active workspace or global agent registry:
154
+
155
+ ```bash
156
+ npx @tidyfactor/cli-doc add-skill
157
+ ```
158
+
159
+ ### 2. Universal Agent Compatibility
160
+ Trigger the skill in your preferred AI Coding Assistant:
161
+
162
+ | Agent / IDE | Invocation Example |
163
+ |---|---|
164
+ | **Google Antigravity** | `/tidyfactor-doc` or "Document this codebase and build a Docsify site" |
165
+ | **Claude Code** | `/tidyfactor-doc init` or "Generate API docs for src/Core" |
166
+ | **Cursor & Windsurf** | `@tidyfactor-doc Set up /docs and interview this PHP module` |
167
+ | **Codex CLI** | `tidyfactor-doc generate API reference` |
168
+
169
+ ### 3. Local Preview
170
+ Preview your Docsify documentation portal in real time:
171
+
172
+ ```bash
173
+ # Using PHP built-in server
174
+ php -S localhost:3001 -t docs
175
+
176
+ # Or using Docsify CLI / Python
177
+ npx docsify-cli serve docs
178
+ python -m http.server 3001 -d docs
179
+ ```
180
+
181
+ ---
182
+
183
+ ## 👨‍💻 Organization & Support
184
+
185
+ - 🌐 **Official Website:** [https://tidyfactor.com/](https://tidyfactor.com/)
186
+ - 📚 **Official Documentation:** [https://tidyfactor.com/documentation](https://tidyfactor.com/documentation)
187
+ - 🤝 **Official Partner Website:** [Alwkala Digital Agency](https://alwkala.com/)
188
+ - 🐙 **GitHub Organization:** [github.com/TidyFactor](https://github.com/TidyFactor)
189
+ - 📧 **Business Inquiries:** [hello@tidyfactor.com](mailto:hello@tidyfactor.com)
190
+ - 📱 **WhatsApp:** [+20 101 665 6899](https://wa.me/201016656899)
191
+ - 📞 **Phone:** +20 101 665 6899
192
+ - 📍 **Location:** Cairo, Egypt
193
+
194
+ ---
195
+
196
+ ## 📜 License
197
+
198
+ Licensed under the **Apache License 2.0**. Copyright (c) 2026 [TidyFactor](https://tidyfactor.com) & [Alwkala](https://alwkala.com).
package/README.pt.md ADDED
@@ -0,0 +1,44 @@
1
+ <div align="center">
2
+
3
+ # tidyfactor-doc `v1.3.0`
4
+
5
+ **Construtor de Documentação de Código e Motor de Publicação Duplo (MkDocs & Docsify) para Agentes de IA**
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@tidyfactor/doc.svg?style=for-the-badge&color=0284C7)](https://www.npmjs.com/package/@tidyfactor/doc)
8
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg?style=for-the-badge)](LICENSE)
9
+
10
+ [ English ](README.md) • [ العربية ](README.ar.md) • [ فارسی ](README.fa.md) • [ Español ](README.es.md) • [ Português ](README.pt.md) • [ 简体中文 ](README.zh.md) • [ Deutsch ](README.de.md) • [ Français ](README.fr.md)
11
+
12
+ </div>
13
+
14
+ ---
15
+
16
+ ## ⚡ Início Rápido (Quickstart)
17
+
18
+ ```bash
19
+ # Instalação e execução via NPX
20
+ npx @tidyfactor/cli-doc
21
+ ```
22
+
23
+ Ou execute diretamente dentro do seu assistente de IA (*Google Antigravity, Claude Code, Cursor, Codex*):
24
+ ```text
25
+ /tidyfactor-doc
26
+ ```
27
+
28
+ ---
29
+
30
+ ## 📋 Matriz de Comandos Principais
31
+
32
+ | Comando | Objetivo e Resultado | Fluxo de Trabalho |
33
+ |---|---|---|
34
+ | `/init` | Inicialización de estructura de documentación | `workflows/init.md` |
35
+ | `/collect` | Entrevista y análisis de código fuente | `workflows/collect.md` |
36
+ | `/generate` | Generación de especificaciones API y READMEs | `workflows/generate.md` |
37
+ | `/mkdocs` | Compilación de portal estático MkDocs Material | `workflows/mkdocs.md` |
38
+ | `/docsify` | Despliegue de SPA ligera Docsify sin compilación | `workflows/docsify.md` |
39
+
40
+ ---
41
+
42
+ ## 📖 Especificação Técnica Canônica
43
+
44
+ Para a arquitetura detalhada, esquemas JSON completos e código fonte nativo, consulte a [Documentação Técnica Canônica em Inglês (README.md)](README.md).
package/README.zh.md ADDED
@@ -0,0 +1,44 @@
1
+ <div align="center">
2
+
3
+ # tidyfactor-doc `v1.3.0`
4
+
5
+ **面向 AI 智能体的代码库文档自动生成与双引擎发布平台 (MkDocs & Docsify)**
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@tidyfactor/doc.svg?style=for-the-badge&color=0284C7)](https://www.npmjs.com/package/@tidyfactor/doc)
8
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg?style=for-the-badge)](LICENSE)
9
+
10
+ [ English ](README.md) • [ العربية ](README.ar.md) • [ فارسی ](README.fa.md) • [ Español ](README.es.md) • [ Português ](README.pt.md) • [ 简体中文 ](README.zh.md) • [ Deutsch ](README.de.md) • [ Français ](README.fr.md)
11
+
12
+ </div>
13
+
14
+ ---
15
+
16
+ ## ⚡ 快速上手 (Quickstart)
17
+
18
+ ```bash
19
+ # 通过 NPX 快速运行
20
+ npx @tidyfactor/cli-doc
21
+ ```
22
+
23
+ 或在 AI 编码助手 (*Google Antigravity, Claude Code, Cursor, Codex*) 中调用:
24
+ ```text
25
+ /tidyfactor-doc
26
+ ```
27
+
28
+ ---
29
+
30
+ ## 📋 核心命令矩阵
31
+
32
+ | 命令 | 目标与产出 | 执行工作流 |
33
+ |---|---|---|
34
+ | `/init` | Inicialización de estructura de documentación | `workflows/init.md` |
35
+ | `/collect` | Entrevista y análisis de código fuente | `workflows/collect.md` |
36
+ | `/generate` | Generación de especificaciones API y READMEs | `workflows/generate.md` |
37
+ | `/mkdocs` | Compilación de portal estático MkDocs Material | `workflows/mkdocs.md` |
38
+ | `/docsify` | Despliegue de SPA ligera Docsify sin compilación | `workflows/docsify.md` |
39
+
40
+ ---
41
+
42
+ ## 📖 完整技术规范与文档
43
+
44
+ 如需查看深层架构设计、完整 JSON Schema 契约和原生代码,请参阅[英文权威技术文档 (README.md)](README.md)。
package/SKILL.md ADDED
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: tidyfactor-doc
3
+ description: "Code documentation builder and dual-engine publishing platform (MkDocs Material and Docsify). Generates comprehensive API references, READMEs, inline docblocks, and technical guides under /docs. Trigger on commands 'init', 'collect', 'generate', 'site', 'mkdocs', 'docsify', or requests like 'document this codebase', 'generate API docs', 'set up MkDocs', or 'set up Docsify'."
4
+ ---
5
+ # TidyFactor Doc
6
+
7
+ A command dispatcher. This file does not do the work itself — it routes to the right command, which routes to the right workflow, which injects the right memory.
8
+
9
+ ## Commands
10
+
11
+ | User intent | Command | What it loads |
12
+ |---|---|---|
13
+ | "Set up docs for this project" / "scaffold /docs" | `references/commands/init.md` | `workflows/init-docs.md` + `memory/doc-tree.md` |
14
+ | "Document this codebase" / "gather what's needed to document X" | `references/commands/collect.md` | `workflows/collect.md` + `memory/collection-sources.md` |
15
+ | "Write API docs" / "generate a README" / "add inline comments" / "write a guide" | `references/commands/generate.md` | `workflows/generate-api.md` (or `generate-readme.md` / `generate-inline.md` / `generate-guide.md`) + `memory/doc-templates.md` + matching `memory/stacks/*.md` |
16
+ | "Publish documentation portal" / "turn /docs into a doc site" (Interactive) | `references/commands/site.md` | `memory/site-engines.md` + interactive selection (`workflows/mkdocs.md` or `workflows/docsify.md`) |
17
+ | "Set up MkDocs Material" / "compile static documentation" | `references/commands/mkdocs.md` | `workflows/mkdocs.md` + `memory/mkdocs-config.md` |
18
+ | "Set up Docsify" / "build lightweight zero-build doc SPA" | `references/commands/docsify.md` | `workflows/docsify.md` + `memory/docsify-config.md` |
19
+
20
+ Read only the command file that matches the request. Do not read all commands simultaneously.
21
+
22
+ ## Non-negotiable constraints on every command
23
+
24
+ 1. **All generated documentation lives under `/docs`.** Never write API references, guides, or generated READMEs to another location. (`README.md` itself stays at the project root, per convention — everything else generated goes in `/docs`.)
25
+ 2. **`generate` never invents content.** It only writes docs from what `collect` gathered (or equivalent detail the user supplies directly in the conversation) — never from assumed signatures, assumed env vars, or assumed behavior. If required detail is missing, `generate` says what's missing and asks or falls back to running `collect` first.
26
+ 3. **Stack rules are looked up, never guessed.** Before writing any code-level doc (API reference, inline comments), load the matching file under `memory/stacks/` for the language/framework actually in use. Do not mix PHPDoc conventions into a TypeScript file or vice versa.
27
+ 4. **`site`, `mkdocs`, and `docsify` only organize and publish what's already in `/docs`.** They never author new documentation content — that's `generate`'s job.
28
+ - For **MkDocs Material**: Generate standard `mkdocs.yml`, configure Neo-Brutalist CSS tokens (`extra.css`), configure Arabic/English i18n (`*.ar.md` suffix), and build cleanly with `mkdocs build --strict`.
29
+ - For **Docsify**: Include `alias: { '/.*/_sidebar.md': '/_sidebar.md' }` and root-relative leading slashes `/` in `_sidebar.md` to guarantee persistent sidebar navigation across all subfolder routes.
30
+ 5. **Standalone.** This skill does not read or depend on any other `tidyfactor-*` skill's conventions, even when the project happens to be built on one of those tracks.
31
+ 6. **Zero Sensitive Data Leakage.** Under absolutely no circumstances should any real sensitive data (e.g., real API tokens, WHM/cPanel passwords, production server IPs, real DB credentials, secret keys, private auth tokens, or local absolute drive paths) be written into documentation. ALWAYS redact and replace these with safe generic placeholders.
32
+ 7. **Clean Relative Links Only.** Never include local machine filesystem URLs (such as `file:///C:/...`, `file:c:`, or absolute workstation paths) in documentation links or markdown cross-references. All document cross-links must use clean relative markdown paths or standard public web URLs (`https://...`).
33
+
34
+ ## Sequencing
35
+
36
+ `init` → `collect` → `generate` (repeatable, once per doc target) → `site` / `mkdocs` / `docsify` (optional, once /docs has real content).
Binary file
Binary file
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
5
+ const targetDir = process.cwd();
6
+ const skillSource = path.resolve(__dirname, '..');
7
+ const agentSkillsDir = path.join(targetDir, '.agents', 'skills', 'tidyfactor-doc');
8
+
9
+ fs.mkdirSync(agentSkillsDir, { recursive: true });
10
+
11
+ function copyRecursive(src, dest) {
12
+ const entries = fs.readdirSync(src, { withFileTypes: true });
13
+ for (const entry of entries) {
14
+ const srcPath = path.join(src, entry.name);
15
+ const destPath = path.join(dest, entry.name);
16
+ if (['.git', 'node_modules', 'bin'].includes(entry.name)) continue;
17
+ if (entry.isDirectory()) {
18
+ fs.mkdirSync(destPath, { recursive: true });
19
+ copyRecursive(srcPath, destPath);
20
+ } else {
21
+ fs.copyFileSync(srcPath, destPath);
22
+ }
23
+ }
24
+ }
25
+
26
+ copyRecursive(skillSource, agentSkillsDir);
27
+ console.log('✓ Successfully injected tidyfactor-doc skill into .agents/skills/tidyfactor-doc');
package/brand.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "TidyFactor Doc",
3
+ "version": "1.3.0",
4
+ "publisher": "TidyFactor Ecosystem",
5
+ "partner": "Alwkala Digital Agency (https://alwkala.com)",
6
+ "contact": {
7
+ "website": "https://tidyfactor.com",
8
+ "email": "hello@tidyfactor.com",
9
+ "whatsapp": "+201016656899",
10
+ "location": "Cairo, Egypt"
11
+ },
12
+ "license": "Apache-2.0"
13
+ }
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@tidyfactor/doc",
3
+ "version": "1.3.0",
4
+ "description": "TidyFactor Doc — Code Documentation Builder & Dual-Engine Publishing Platform (MkDocs Material & Docsify) for AI Coding Agents",
5
+ "main": "SKILL.md",
6
+ "bin": {
7
+ "tidyfactor-doc": "bin/add-skill.js",
8
+ "add-skill": "bin/add-skill.js",
9
+ "add-doc-skill": "bin/add-skill.js"
10
+ },
11
+ "keywords": [
12
+ "tidyfactor",
13
+ "docs",
14
+ "docsify",
15
+ "mkdocs",
16
+ "ai-agents",
17
+ "antigravity",
18
+ "claude-code",
19
+ "cursor",
20
+ "documentation-generator"
21
+ ],
22
+ "author": "TidyFactor <hello@tidyfactor.com> (https://tidyfactor.com)",
23
+ "license": "Apache-2.0",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/TidyFactor/Doc.git"
27
+ },
28
+ "scripts": {
29
+ "validate": "python tools/validate_skill.py",
30
+ "build": "node tools/build-skill.js",
31
+ "release": "python ../tools/release_skill.py ."
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "files": [
37
+ ".tidyfactor",
38
+ "AGENTS.md",
39
+ "CHANGELOG.md",
40
+ "LICENSE",
41
+ "README.ar.md",
42
+ "README.de.md",
43
+ "README.es.md",
44
+ "README.fa.md",
45
+ "README.fr.md",
46
+ "README.md",
47
+ "README.pt.md",
48
+ "README.zh.md",
49
+ "SKILL.md",
50
+ "assets",
51
+ "bin",
52
+ "brand.json",
53
+ "memory",
54
+ "references",
55
+ "scripts",
56
+ "templates",
57
+ "tools"
58
+ ]
59
+ }
@@ -0,0 +1,15 @@
1
+ # Command: collect
2
+
3
+ Runtime entry point for "document this codebase" / "gather what's needed to document X."
4
+
5
+ ## Dispatch steps
6
+
7
+ 1. Load `../memory/collection-sources.md` — the five collection dimensions and what to extract from each.
8
+ 2. Load `../workflows/collect.md` — the ordered interview/extraction sequence.
9
+ 3. Run the workflow against the target codebase (or the specific slice of it the user named — a single module, endpoint, or component).
10
+
11
+ ## Does NOT
12
+
13
+ - Does not write any files under `/docs`. `collect`'s output is structured source material (findings written to `docs/.collected/<target>.md`, per `collect.md`'s own step) — not a finished doc.
14
+ - Does not load `memory/doc-templates.md` or any `memory/stacks/*.md` file — formatting the findings into a stack-correct doc is `generate`'s job, not this one.
15
+ - Does not require `init` to have run first, but if `docs/.doc-manifest.json` doesn't exist yet, say so and offer to run `init` first rather than silently creating an ad hoc structure.
@@ -0,0 +1,15 @@
1
+ # Command: docsify
2
+
3
+ Runtime entry point for "turn /docs into a doc site" / "set up Docsify (Zero-Build SPA)."
4
+
5
+ ## Dispatch steps
6
+
7
+ 1. Load `../memory/docsify-config.md` — file layout, plugin defaults, sidebar-generation rule, deploy targets.
8
+ 2. Load `../workflows/docsify.md` — the setup sequence.
9
+ 3. Confirm `/docs` already has real content (at least one generated doc beyond the scaffold).
10
+ 4. Run `workflows/docsify.md`.
11
+
12
+ ## Does NOT
13
+
14
+ - Does not author any new page content — it wires up navigation (`_sidebar.md`), an entry point (`index.html`), and optionally a cover page over whatever already exists in `/docs`.
15
+ - Does not load `memory/doc-templates.md` or any `memory/stacks/*.md` file.
@@ -0,0 +1,23 @@
1
+ # Command: generate
2
+
3
+ Runtime entry point for "write API docs" / "generate a README" / "add inline comments" / "write a guide." A router within a router: figure out which doc type is wanted, then load exactly one workflow for it.
4
+
5
+ ## Dispatch steps
6
+
7
+ 1. **Identify the doc type.** If not obvious from the request, ask:
8
+ > "Which one — API reference, README, inline code comments, or a technical guide (setup/architecture/workflow)?"
9
+ 2. **Identify the stack** (PHP / JS / TS / React / Vue / Next). If not obvious from the project, ask or detect from file extensions / config files (`composer.json`, `package.json` + `tsconfig.json`, framework config files).
10
+ 3. Load the matching workflow — exactly one:
11
+ - API reference → `../workflows/generate-api.md`
12
+ - README → `../workflows/generate-readme.md`
13
+ - Inline comments → `../workflows/generate-inline.md`
14
+ - Guide → `../workflows/generate-guide.md`
15
+ 4. Load `../memory/doc-templates.md`.
16
+ 5. Load the matching stack file under `../memory/stacks/` — `php.md`, `js-ts.md`, or `react-vue-next.md`. Never load more than the stacks actually present in the target.
17
+ 6. Confirm `collect` has already run for this target (check for `docs/.collected/<target>.md`). If it hasn't, and the user hasn't supplied equivalent detail inline, stop and say so — do not generate from assumption. See constraint 2 in `SKILL.md`.
18
+ 7. Run the loaded workflow.
19
+
20
+ ## Does NOT
21
+
22
+ - Does not load more than one `workflows/generate-*.md` file per invocation. Multiple doc types requested at once → run this dispatch sequence once per type, sequentially.
23
+ - Does not load `memory/collection-sources.md` or `memory/docsify-config.md` — not this command's concern.
@@ -0,0 +1,15 @@
1
+ # Command: init
2
+
3
+ Runtime entry point for "set up docs for this project" / "scaffold /docs."
4
+
5
+ ## Dispatch steps
6
+
7
+ 1. Load `../memory/doc-tree.md` — the canonical `/docs` folder shape and the doc-manifest schema.
8
+ 2. Load `../workflows/init-docs.md` — the scaffolding sequence.
9
+ 3. Run the workflow.
10
+
11
+ ## Does NOT
12
+
13
+ - Does not write any actual documentation content (no API entries, no guide prose). That's `generate`.
14
+ - Does not run `collect`. If the user wants both, run `init` first, then hand off to `collect`.
15
+ - Does not load any `memory/stacks/*.md` file — stack detection here only decides which manifest fields to pre-fill, not how to document anything yet.
@@ -0,0 +1,15 @@
1
+ # Command: mkdocs
2
+
3
+ Runtime entry point for "set up MkDocs" / "build MkDocs Material site" / "compile static documentation".
4
+
5
+ ## Dispatch steps
6
+
7
+ 1. Load `../memory/mkdocs-config.md` — master YAML schema, theme tokens, extensions, i18n rules, and deploy options.
8
+ 2. Load `../workflows/mkdocs.md` — the setup and build sequence.
9
+ 3. Confirm `/docs` has real content.
10
+ 4. Run `workflows/mkdocs.md`.
11
+
12
+ ## Does NOT
13
+
14
+ - Does not author new documentation content — it generates `mkdocs.yml`, configures themes, and compiles the static site.
15
+ - Does not modify source markdown semantics, only removes incompatible raw HTML wrappers.
@@ -0,0 +1,23 @@
1
+ # Command: site
2
+
3
+ Runtime entry point for "turn /docs into a doc site" / "publish documentation portal" / "set up documentation site".
4
+
5
+ ## Dispatch steps
6
+
7
+ 1. Load `../memory/site-engines.md` — comparison between MkDocs Material and Docsify.
8
+ 2. Confirm `/docs` has real content (at least one generated doc beyond the scaffold).
9
+ 3. **Interactive Engine Selection:**
10
+ - Detect if Python is available via `python --version 2>&1`.
11
+ - If the user explicitly requested a specific engine (e.g., "use mkdocs" or "use docsify"), route directly:
12
+ - "mkdocs" → Dispatch `references/commands/mkdocs.md`.
13
+ - "docsify" → Dispatch `references/commands/docsify.md`.
14
+ - If no engine was specified:
15
+ - Present the two options to the user with the summary from `memory/site-engines.md`:
16
+ - **Option 1: MkDocs Material (Recommended for Production)**: Pre-compiled static HTML, 100/100 Core Web Vitals, bilingual (Arabic RTL + English LTR) parallel builds, offline search indexing, and Neo-Brutalist styling. Requires Python locally for building.
17
+ - **Option 2: Docsify (Zero-Build Lightweight SPA)**: Client-side SPA, zero build step, single `index.html` + `_sidebar.md` over CDN. Recommended when Python is not available or for internal repo prototyping.
18
+ - Prompt the user to pick their preference or proceed with the recommended engine based on detected toolchain.
19
+ 4. Execute the chosen workflow (`workflows/mkdocs.md` or `workflows/docsify.md`).
20
+
21
+ ## Does NOT
22
+
23
+ - Does not author any new markdown content — it structures, configures, and publishes what's already in `/docs`.
@@ -0,0 +1,47 @@
1
+ # Memory: collection-sources
2
+
3
+ The five dimensions `collect` runs against a target, and exactly what to pull from each. Operational — no rationale.
4
+
5
+ ## 1. Code parsing
6
+
7
+ - Extract existing docblocks/comments verbatim (don't paraphrase yet — that's `generate`'s job).
8
+ - List every public function, method, class, exported type, and (for components) prop/slot/event definition.
9
+ - Note which of these already have adequate comments vs. none vs. stale (comment doesn't match current signature).
10
+
11
+ ## 2. Commit history
12
+
13
+ - `git log --follow -- <path>` for the target's files: pull commit messages that explain *why*, not routine messages ("fix typo").
14
+ - Any available PR/MR descriptions touching the target: design decisions, rejected alternatives, known limitations mentioned by the author.
15
+ - Flag any TODO/FIXME/HACK comments found alongside — they're often undocumented known issues.
16
+
17
+ ## 3. Runtime & environment
18
+
19
+ - Every environment variable the target reads (grep for `getenv`/`process.env`/`$_ENV`/config-loader calls), with whether it's required or optional and any default.
20
+ - Software dependencies and version constraints from the manifest (`composer.json`, `package.json`) that the target actually uses — not the whole project's dependency list.
21
+ - Any stated hardware/resource limits (memory limits, timeout values, rate limits) found in config or comments.
22
+ - **Sanitization Rule**: Never collect real values of secrets (API keys, passwords, JWT secrets, private IP addresses, database credentials). Store only the variable name, description, and a synthetic example placeholder (e.g. `sk_test_EXAMPLE123456`, `203.0.113.10`).
23
+
24
+ ## 4. User persona tracing
25
+
26
+ - Classify the target's readership: **API consumer** (calls it from outside), **internal maintainer** (edits this code), **end-user** (uses a UI built on it), or a mix.
27
+ - For each persona present, note which facts from the other four dimensions matter to them — this list is what `generate` uses to prioritize content per doc type.
28
+
29
+ ## 5. Error patterns
30
+
31
+ - Every thrown exception / returned error code / rejected promise in the target, with the condition that triggers it.
32
+ - How each error is meant to be handled or surfaced (caught and logged? bubbled to caller? shown to end-user?) — from code and any logging statements found.
33
+ - Common failure modes mentioned in commit history or TODO comments that aren't yet reflected in actual error handling.
34
+ - **Scrubbing Rule**: Redact real database connection strings, local absolute file paths (e.g. `/home/user/project/...`), or authorization headers that might appear in error logs or exception messages.
35
+
36
+ ---
37
+
38
+ ## 🔒 Security & Link Sanitization Reference
39
+
40
+ | Item Category | Dangerous / Prohibited | Mandatory Safe Replacement |
41
+ |---|---|---|
42
+ | API Keys / Tokens | `sk_live_948f98a7c...` | `YOUR_API_KEY_HERE` or `EXAMPLE_TOKEN_123` |
43
+ | Passwords / DB Secrets | `P@ssw0rd2026!` | `your_secure_password` |
44
+ | Server IPs | `192.168.1.15`, `45.33.21.99` | `203.0.113.1` (RFC 5737 doc range) |
45
+ | Local Drive Paths | `file:///C:/path/to/project/...` | `./docs/guides/` or `project-root/` |
46
+ | Local Workstation URLs | `http://localhost:8080/secret` | `https://api.example.com` or `http://localhost:PORT` |
47
+ | User Home Dirs | `/home/developer/workspace/...` | `~/project` or `/path/to/project` |