technical-documentation
Generate and validate Gnosi's engineering portal from reviewed guides and deterministic source catalogs. Use for source-traceable documentation updates and pre-PR gates; never translate generated catalogs with a model.
- License 许可
- AGPL-3.0
- 所属仓库
- ismigar/Gnosi
- 最近更新
- 2026-11-15
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- technical-documentation
- description
- Generate and validate Gnosi's engineering portal from reviewed guides and deterministic source catalogs. Use for source-traceable documentation updates and pre-PR gates; never translate generated catalogs with a model.
02 资源文件 31
- 参考文档domains.json16.9 KB
- 脚本scripts/api_catalog.py20.0 KB
- 脚本scripts/backend_catalog.py3.8 KB
- 脚本scripts/catalog_common.py6.3 KB
- 脚本scripts/check_change_impact.py6.5 KB
- 脚本scripts/configuration_catalog.py6.5 KB
- 脚本scripts/domain_coverage.py3.6 KB
- 脚本scripts/frontend_catalog.py10.1 KB
- 脚本scripts/generate.py12.0 KB
- 脚本scripts/generated_localization.py12.4 KB
- 脚本scripts/inventory_catalogs.py8.5 KB
- 脚本scripts/localize.py24.1 KB
- 脚本scripts/model_catalog.py8.2 KB
- 脚本scripts/pre_pr.py6.3 KB
- 脚本scripts/reviewed_contracts.py6.1 KB
- 脚本scripts/validate.py11.0 KB
- 脚本tests/test_ai_guide_parity.py4.8 KB
- 脚本tests/test_catalog_path_boundaries.py4.8 KB
- 脚本tests/test_change_impact.py8.1 KB
- 脚本tests/test_ci_result_reuse.py16.7 KB
- 脚本tests/test_community_release.py1.2 KB
- 脚本tests/test_domain_traceability.py5.4 KB
- 脚本tests/test_frontend_routes.py10.7 KB
- 脚本tests/test_generate.py14.3 KB
- 脚本tests/test_generated_localization.py15.3 KB
- 脚本tests/test_generator_compatibility.py3.5 KB
- 脚本tests/test_localize.py2.1 KB
- 脚本tests/test_pre_pr.py3.9 KB
- 脚本tests/test_publication.py25.4 KB
- 脚本tests/test_reviewed_contracts.py7.8 KB
- 脚本tests/test_validate.py2.4 KB
03 SKILL.md 正文
SKILL: Technical documentation
ID: GNOSI-TECHNICAL-DOCUMENTATION-20260802 Status: ACTIVE
Purpose
Build and validate Gnosi's public engineering documentation from reviewed Markdown and deterministic source catalogs. The result must let an engineer trace product capabilities through frontend routes, backend operations, configuration, relational models, tests, skills, and source files without importing the runtime or reading local secrets.
Sources and outputs
- Reviewed portal:
docs/engineering/. - Generated reference:
docs/engineering/generated/. - Domain coverage configuration:
domains.json. - Shared domain loading, source matching and feature ownership guard:
scripts/domain_coverage.py. - Generator:
scripts/generate.py. - Catalog owners:
catalog_common.py,api_catalog.py,backend_catalog.py,model_catalog.py,frontend_catalog.py,configuration_catalog.py, andinventory_catalogs.pyunderscripts/. They never import the CLI. - Validator:
scripts/validate.py. - Functional change gate:
scripts/check_change_impact.py. - Portal configuration:
mkdocs.ymlat the application root. - Development rules and incident memory live in the private
WorkspaceToolsrepository and are intentionally absent from public checkouts.
Generated pages are committed so documentation changes can be reviewed as ordinary diffs. They must never be edited manually.
Commands
Run from the Gnosi/ repository root:
uv run --group docs python pipeline/skills/technical_documentation/scripts/pre_pr.py --base-ref origin/main
uv run --group docs python pipeline/skills/technical_documentation/scripts/generate.py
uv run --group docs python pipeline/skills/technical_documentation/scripts/generate.py --check
uv run --group docs python pipeline/skills/technical_documentation/scripts/localize.py --generated-only
uv run --group docs python pipeline/skills/technical_documentation/scripts/localize.py --check
uv run --group docs python pipeline/skills/technical_documentation/scripts/validate.py
uv run --group docs python pipeline/skills/technical_documentation/scripts/check_change_impact.py --base-ref <base-commit>
uv run --group docs mkdocs build --strict
The generator accepts --app-root and --domains only for isolated tests and
development. Normal runs auto-detect the application root from the script
location.
The pre-PR command is the mandatory local entry point for implementation
branches covered by the public documentation workflow. It regenerates catalogs
before checking them, runs the documentation-tool tests and change-impact gate,
validates localization and traceability, and builds every strict locale portal.
Use --check-only in read-only automation that must reject stale catalogs
without updating them. Update mode refreshes all three generated locale catalogs
immediately after English generation. Check-only mode sends portal builds to a
temporary directory, disables pytest/bytecode caches in the checkout, and never
refreshes documentation or configuration.
Generated-reference localization
scripts/generated_localization.pycontains the explicit Catalan, Spanish, and French vocabulary for known catalog titles, fixed section headings, table headers, regeneration instructions, and bullet labels.- All table body rows, source link labels/targets, inline code, API identifiers, numbers, paths, source-derived prose/headings, metadata and fenced code remain byte-identical to English. Unlisted prose and unknown files stay English; extend the explicit vocabulary when introducing a new catalog template.
localize.py --generated-onlyreads only the English generated subtree and updates only its locale counterparts, without constructing OfflineTranslator, importing translation models/application runtime, rewriting MkDocs configs, or touching reviewed guides/assets. Identical files are not rewritten.--path generated/<file>.mdmay narrow that refresh.--checkcompares exact expected generated bytes and reports missing, stale, mangled, or extra files;--generated-only --checklimits checking to generated references. Checks do not write. Extra generated files are reported, never silently deleted.- Full/reviewed localization remains an explicit separate operation using the offline translator; never invoke it to refresh generated catalogs.
Reviewed-guide convergence
Review localized prose against the full English guide and linked source;
correct malformed translation and missing caveats without retranslating
already-correct passages or generated catalogs. Run localize.py --check
after editing. For reviewed pages it compares exact front matter, code-span
multiplicity, fenced examples, Mermaid IDs/arrows/order, link targets and URLs.
Displayed node labels, edge/message captions and participant display names may
translate; structural IDs and executable examples may not. Local heading
fragments may differ. Diagnostics report the file and category, not raw values.
The checker supports this portal's Markdown conventions; it is not a general
Markdown parser or a proof of prose meaning. Keep the link/metadata validator,
strict portal builds and human/browser review as independent gates.
Generation rules
The CLI retains explicit compatibility exports and owns coverage diagnostics.
When extracting catalog logic, preserve existing signatures and exact output
bytes on identical inputs; source inventory changes are separate from rendering
changes. Use the pre-extraction synthetic golden test and compare all nine
catalogs against the immutable baseline. Run pnpm check:pipeline:structure
after staging: every indexed Python file, including tests, must remain within
800 lines and complexity 15. No local exclusion or suppression bypasses this gate.
- Inspect source only; never import
backend.serveror another runtime module. - Use Python AST for routers, functions, docstrings, and environment access.
Relational-model discovery must support both legacy
Column(...)assignments and SQLAlchemy 2Mapped[...] = mapped_column(...)annotated assignments, including inferred type and nullability. - Treat frontend route, export, and API-string discovery as conservative static signals rather than a complete call graph.
- Exclude dependencies, vendored code, local data, databases, caches, reports, and build output.
- Redact every default associated with a secret-bearing environment name.
- Sort all inputs and output rows so two unchanged runs are byte-identical.
- Keep domain classification explicit in
domains.json; do not infer product intent from file names in generated prose.
Adding or changing a domain
- Add or update its reviewed guide under
docs/engineering/domains/. - Update its
domains.jsonentry with owned source patterns, test patterns, and relevant directives. - Regenerate the catalogs.
- Confirm that the coverage page reports
coveredand that every pattern is accurate. - Run validation and the strict MkDocs build.
Generation and validation reject any owned frontend feature module with no
production JavaScript or TypeScript file matched by domain source patterns.
Tests, assets and excluded local artifacts cannot stand in for that source.
Assign a new feature to an accurate existing guide or add a reviewed domain;
include its tests, including shared or disposable-browser tests where relevant.
The covered status means guide/source presence and traceability. Test counts
are navigation signals; neither establishes runtime or daily-work acceptance.
The change-impact gate is intentionally limited to high-impact boundaries: backend APIs and services, integrations, desktop and native runtime code, deployment files, and frontend authentication, routing, providers, or application-shell code. Routine frontend component, page, styling, and test changes do not require a prose documentation edit when the existing contract remains accurate. High-impact changes must still change at least one public English engineering Markdown page; the locale mirror check then requires Catalan, Spanish, and French parity before the pull request can merge.
Dependency-only changes to supported manifests or lockfiles are exempt from the change-impact gate because they do not by themselves change the documented product contract. A dependency update combined with implementation changes still requires documentation evidence.
Restrictions and edge cases
-
Note: Do not add or remove inline-code literals in a reviewed English guide without applying the same literal set to its Catalan, Spanish, and French mirrors, because the locale parity gate rejects code-span drift even when the translated prose remains readable. Update all reviewed mirrors together, then run
localize.py --check; never weaken the parity check or regenerate reviewed prose automatically to hide the mismatch. -
Note: Do not run the automatic documentation build or Pages deployment on a GitHub-hosted runner, because the project intentionally operates without a hosted Actions budget. Use the provisioned self-hosted Linux ARM64 runner for both jobs and keep a source-level regression test for the runner labels.
-
Note: Do not install the default Gnosi runtime for documentation-only jobs. It needlessly downloads large packages such as Torch and AV and makes Pages depend on unrelated runtime network availability. Use frozen
--only-group docsfor Pages and the minimal--only-group docs-ci(documentation plus pytest) for the pre-PR gate, on bothuv syncand every subsequentuv run. Keep workflow contract tests that reject falling back to--group docs. -
Note: Do not let a public fork pull request reach any self-hosted runner, because checked-out PR code can execute arbitrary commands on the owner machine. Require the exact same-repository head condition on every shared CI job, combine it with the documentation candidate condition, and keep source-level regression tests that reject removing or weakening the guard.
-
Note: Do not classify source using absolute ancestor names, because a checkout below
tests,e2e,vendoror a scratch directory changes public catalogs. Instead, classify paths relative to the explicit scan/application root, while retaining all exclusions inside it. Verify identical catalog bytes across differently named parent directories and preserve the immutable goldens. -
Note: Do not count or parse local
sandbox,private_skills,.tmp,.viteor.ruff_cachetrees in public catalogs, because ignored migration helpers make local output differ from a clean CI checkout and may expose private source. Apply the same exclusions to source discovery, inventory and domain coverage; test catalog invariance after adding local scratch fixtures. -
Note: Do not exclude only the literal
.venvand.venv-pythondirectory names, because architecture or relocation diagnostics such as.venv-arm64-relocatedthen leak thousands of dependency tests into the generated public catalog. Treat every path component beginning with.venvas a local runtime artifact and prove source, frontend, inventory and coverage discovery stay invariant when suffixed environments exist. -
Note: Do not machine-translate generated catalogs or accept presence/marker checks as parity, because source labels and paths can be mangled while French copies become stale. Instead, generate localized fixed labels deterministically and compare the complete expected bytes for every locale.
-
Note: Do not translate matching words globally, because a source directory, domain heading or data cell can share a fixed label. Instead, restrict headings by catalog and section position and translate only recognized table headers followed by a separator, preserving all body rows verbatim.
-
Note: Do not infer heterogeneous locale settings as an untyped dictionary, because filesystem paths and optional model names then become
objectin static checks. Instead, use LocaleConfig to distinguish paths from text. -
Note: Do not build an all-catalog fixture with API strings but no React Router declaration, because the frontend catalog correctly rejects an empty route inventory. Instead, include a literal Route imported from react-router-dom in synthetic production source; never weaken the generator to accommodate a test.
-
Note: Do not import the same helper under both a relative and a standalone module name, because focused mypy reports a duplicate definition. Instead, bootstrap the repository import root only for direct CLI execution and use one canonical package import.
-
Static routes with dynamically computed path strings are labeled
<dynamic-path>and require runtime OpenAPI review. -
Decorator and router dependency lists are reported as source expressions; middleware and dependencies introduced inside service functions are not inferred.
-
Literal frontend
/api/strings are a lower bound because helpers often construct paths dynamically. -
Test signal counts help navigation; only pytest, Vitest, and Playwright collection determine executable test totals.
-
Environment names may appear in tests or legacy tools. Presence in the catalog does not make a variable a supported public configuration contract.
-
The generator must not read
.env,.env_shared, Keychain, SQLite, vault, or log contents. -
Public source links target the canonical
ismigar/Gnosirepository root; local source paths remain in page metadata for validation. -
mapped_column(...)declarations are represented byast.AnnAssign, notast.Assign. A passing portal build is insufficient evidence of a complete model catalog; regression fixtures must assert mapped table and column counts.
Verification
- Run the pre-PR command before the final implementation commit and again after staging the generated output; the second run must create no further diff.
- Run the generator twice and compare the tree; the second run must be clean.
- Run
generate.py --check. - Run
validate.py. - Build MkDocs with strict warnings.
- Open the built site and verify navigation, tables, code blocks, and Mermaid diagrams.
- Run the application frontend build because documentation tooling must not disturb the shipped dependency graph.
04 同仓库更多 Skills
zotero-sync-compatibility
Preserve the historical Zotero reference-table configuration path after Gnosi replaced bidirectional Zotero synchronization with its native reference manager.
zotero-schema
Generate Gnosi's Python and TypeScript item-type constants from the repository-pinned Zotero schema, or perform an explicitly requested pinned schema refresh. Use for mapping or generated-constant maintenance, not runtime downloads.
vault-core
Preserve Gnosi vault identifiers, internal links and active-vault context during file or metadata changes. Use for vault integrity work, not blanket normalization or cleanup of user documents.
translate-row
Translate configured table-row fields and Markdown into language children, updating existing translations in place. Use for the explicit translate-row action or maintenance of its provider adapters.
translate-page
Translate a Vault page title and Markdown body into language children, updating existing translations and preserving Gnosi directives. Use for the explicit translate-page action or Markdown segmentation maintenance.
suggest-connections
Maintain Gnosi's evidence-backed Brain connection proposal queue and graph overlay. Use for proposal generation or review behavior, not automatic note creation or unrequested model calls.