@walvka-code/proj-doc-builder 0.0.0-stage → 4.5.2

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 (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +290 -3
  3. package/README.zh-CN.md +258 -0
  4. package/cordis.patch.yml +8 -0
  5. package/icon.svg +11 -0
  6. package/index.js +164 -0
  7. package/locale/en.json +6 -0
  8. package/locale/zh.json +6 -0
  9. package/package.json +59 -4
  10. package/skills/proj-doc-builder/SKILL.md +412 -0
  11. package/skills/proj-doc-builder/references/audit_script.md +103 -0
  12. package/skills/proj-doc-builder/references/batch-generation.md +55 -0
  13. package/skills/proj-doc-builder/references/checklist.md +90 -0
  14. package/skills/proj-doc-builder/references/exclusions.md +79 -0
  15. package/skills/proj-doc-builder/references/linking.md +83 -0
  16. package/skills/proj-doc-builder/references/migration.md +32 -0
  17. package/skills/proj-doc-builder/references/phase4.md +200 -0
  18. package/skills/proj-doc-builder/references/templates.md +212 -0
  19. package/skills/proj-doc-builder/tests/claims.json +76 -0
  20. package/skills/proj-doc-builder/tests/conftest.py +23 -0
  21. package/skills/proj-doc-builder/tests/test_claims_registry.py +81 -0
  22. package/skills/proj-doc-builder/tests/test_claude_doc_index.py +157 -0
  23. package/skills/proj-doc-builder/tests/test_e2e_fresh_project.py +156 -0
  24. package/skills/proj-doc-builder/tests/test_link_tools.py +279 -0
  25. package/skills/proj-doc-builder/tests/test_load_docs.py +353 -0
  26. package/skills/proj-doc-builder/tests/test_normalize_markers.py +120 -0
  27. package/skills/proj-doc-builder/tests/test_phase4_exit.py +3895 -0
  28. package/skills/proj-doc-builder/tests/test_project_docs_contract.py +812 -0
  29. package/skills/proj-doc-builder/tests/test_scan_dirs.py +1159 -0
  30. package/skills/proj-doc-builder/tests/test_stage1_stage2_upgrades.py +395 -0
  31. package/skills/proj-doc-builder/tests/test_sync_project_docs.py +2169 -0
  32. package/skills/proj-doc-builder/tests/test_v41_upgrades.py +614 -0
  33. package/skills/proj-doc-builder/tests/test_v42_upgrades.py +422 -0
  34. package/skills/proj-doc-builder/tests/test_v43_upgrades.py +198 -0
  35. package/skills/proj-doc-builder/tests/test_v44_upgrades.py +361 -0
  36. package/skills/proj-doc-builder/tests/test_v45_upgrades.py +212 -0
  37. package/skills/proj-doc-builder/tests/test_validate_doc.py +712 -0
  38. package/skills/proj-doc-builder/tools/_paths.py +39 -0
  39. package/skills/proj-doc-builder/tools/core/claude_doc_index.py +504 -0
  40. package/skills/proj-doc-builder/tools/core/compute_link.py +239 -0
  41. package/skills/proj-doc-builder/tools/core/proj_doc_config.py +460 -0
  42. package/skills/proj-doc-builder/tools/core/project_docs_contract.py +2725 -0
  43. package/skills/proj-doc-builder/tools/phase4/__init__.py +82 -0
  44. package/skills/proj-doc-builder/tools/phase4/cas_storage.py +25 -0
  45. package/skills/proj-doc-builder/tools/phase4/engine.py +35 -0
  46. package/skills/proj-doc-builder/tools/phase4/journal.py +29 -0
  47. package/skills/proj-doc-builder/tools/phase4/platform_handles.py +27 -0
  48. package/skills/proj-doc-builder/tools/phase4_exit.py +8565 -0
  49. package/skills/proj-doc-builder/tools/pipeline/gen_docs_from_scaffold.py +789 -0
  50. package/skills/proj-doc-builder/tools/pipeline/sync_project_docs.py +5531 -0
  51. package/skills/proj-doc-builder/tools/reader/load_docs.py +654 -0
  52. package/skills/proj-doc-builder/tools/scan/link_check.py +203 -0
  53. package/skills/proj-doc-builder/tools/scan/normalize_markers.py +211 -0
  54. package/skills/proj-doc-builder/tools/scan/scan_dirs.py +2735 -0
  55. package/skills/proj-doc-builder/tools/validate/validate_doc.py +1911 -0
@@ -0,0 +1,82 @@
1
+ # -*- coding: utf-8 -*-
2
+ """Phase 4 modular subpackage providing structured access to Phase 4 subsystems.
3
+
4
+ Submodules:
5
+ - ``platform_handles``: Platform-specific Win32/POSIX handles, locks, reparse points, and fsync.
6
+ - ``cas_storage``: Content-Addressable Storage, SHA-256 fingerprinting, receipts, and payloads.
7
+ - ``journal``: Crash-consistent transaction journal, state machine, and recovery.
8
+ - ``engine``: Candidate analysis, quarantine execution, receipt restoration, and coordinator integration.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import phase4_exit as _core
14
+
15
+ EXIT_OK = _core.EXIT_OK
16
+ EXIT_REFUSED = _core.EXIT_REFUSED
17
+ EXIT_OPERATIONAL_FAILURE = _core.EXIT_OPERATIONAL_FAILURE
18
+
19
+ AUTO_MARKER = _core.AUTO_MARKER
20
+ QUARANTINE_DIRNAME = _core.QUARANTINE_DIRNAME
21
+ RECEIPT_FILENAME = _core.RECEIPT_FILENAME
22
+ PAYLOAD_DIRNAME = _core.PAYLOAD_DIRNAME
23
+ QUARANTINE_REASON = _core.QUARANTINE_REASON
24
+
25
+ Phase4Refusal = _core.Phase4Refusal
26
+ Phase4OperationalError = _core.Phase4OperationalError
27
+ Phase4Error = _core.Phase4Refusal
28
+ ReceiptRecord = _core.ReceiptRecord
29
+ Analysis = _core.Analysis
30
+ ProjectAnalysis = _core.Analysis
31
+ SourceInventory = _core.SourceInventory
32
+
33
+ analyze_project = _core.analyze_project
34
+ analyze_snapshot = _core.analyze_snapshot
35
+ report_project = _core.report_project
36
+ apply_quarantine = _core.apply_quarantine
37
+ quarantine_candidates = _core.apply_quarantine
38
+ restore_receipt = _core.restore_receipt
39
+ pending_recovery_status = _core.pending_recovery_status
40
+ # ``_recover_pending_transaction`` is a private implementation name; expose it
41
+ # as an explicit alias so a rename in ``phase4_exit`` fails loudly at import
42
+ # instead of silently binding the alias to ``None`` (which would make
43
+ # ``--recover`` a no-op that reports nothing).
44
+ recover_pending_transactions = _core._recover_pending_transaction
45
+ main = _core.main
46
+
47
+ # Drift guard: every private name the facade re-exports must still exist on
48
+ # ``phase4_exit``. ``getattr(..., None)`` aliases in the submodules silently
49
+ # become ``None`` on rename, so we assert here once at package import.
50
+ assert hasattr(_core, "_recover_pending_transaction"), (
51
+ "phase4 facade drifted from phase4_exit; missing: "
52
+ + ", ".join(
53
+ n for n in ("_recover_pending_transaction",) if not hasattr(_core, n)
54
+ )
55
+ )
56
+
57
+ __all__ = [
58
+ "EXIT_OK",
59
+ "EXIT_REFUSED",
60
+ "EXIT_OPERATIONAL_FAILURE",
61
+ "AUTO_MARKER",
62
+ "QUARANTINE_DIRNAME",
63
+ "RECEIPT_FILENAME",
64
+ "PAYLOAD_DIRNAME",
65
+ "QUARANTINE_REASON",
66
+ "Phase4Refusal",
67
+ "Phase4OperationalError",
68
+ "Phase4Error",
69
+ "ReceiptRecord",
70
+ "Analysis",
71
+ "ProjectAnalysis",
72
+ "SourceInventory",
73
+ "analyze_project",
74
+ "analyze_snapshot",
75
+ "report_project",
76
+ "apply_quarantine",
77
+ "quarantine_candidates",
78
+ "restore_receipt",
79
+ "pending_recovery_status",
80
+ "recover_pending_transactions",
81
+ "main",
82
+ ]
@@ -0,0 +1,25 @@
1
+ # -*- coding: utf-8 -*-
2
+ """Content-Addressable Storage (CAS), payload snapshots, receipts, and hash verification."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import phase4_exit as _core
7
+
8
+ text_snapshot = _core._text_snapshot
9
+ write_exclusive_snapshot = _core._write_exclusive_snapshot
10
+ validate_manifest_snapshot = _core._validate_manifest_snapshot
11
+ require_receipt_closed_state = _core._require_receipt_closed_state
12
+
13
+ __all__ = [
14
+ "text_snapshot",
15
+ "write_exclusive_snapshot",
16
+ "validate_manifest_snapshot",
17
+ "require_receipt_closed_state",
18
+ ]
19
+
20
+ # Fail at import time if a private name the facade exposes was renamed
21
+ # or removed from ``phase4_exit`` — a silent ``None`` alias would turn
22
+ # recovery, journaling and fsync into no-ops that report nothing.
23
+ assert hasattr(_core, '_text_snapshot') and hasattr(_core, '_write_exclusive_snapshot') and hasattr(_core, '_validate_manifest_snapshot') and hasattr(_core, '_require_receipt_closed_state'), (
24
+ "phase4 facade drifted from phase4_exit; missing: " + ", ".join(n for n in ['_text_snapshot', '_write_exclusive_snapshot', '_validate_manifest_snapshot', '_require_receipt_closed_state'] if not hasattr(_core, n))
25
+ )
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+ """Phase 4 engine execution: analysis, quarantine, restore, and coordinator integration."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import phase4_exit as _core
7
+
8
+ analyze_project = _core.analyze_project
9
+ analyze_snapshot = _core.analyze_snapshot
10
+ report_project = _core.report_project
11
+ apply_quarantine = _core.apply_quarantine
12
+ quarantine_candidates = _core.apply_quarantine
13
+ restore_receipt = _core.restore_receipt
14
+ pending_recovery_status = _core.pending_recovery_status
15
+ recover_pending_transactions = _core._recover_pending_transaction
16
+ main = _core.main
17
+
18
+ __all__ = [
19
+ "analyze_project",
20
+ "analyze_snapshot",
21
+ "report_project",
22
+ "apply_quarantine",
23
+ "quarantine_candidates",
24
+ "restore_receipt",
25
+ "pending_recovery_status",
26
+ "recover_pending_transactions",
27
+ "main",
28
+ ]
29
+
30
+ # Fail at import time if a private name the facade exposes was renamed
31
+ # or removed from ``phase4_exit`` — a silent ``None`` alias would turn
32
+ # recovery, journaling and fsync into no-ops that report nothing.
33
+ assert hasattr(_core, '_recover_pending_transaction'), (
34
+ "phase4 facade drifted from phase4_exit; missing: " + ", ".join(n for n in ['_recover_pending_transaction'] if not hasattr(_core, n))
35
+ )
@@ -0,0 +1,29 @@
1
+ # -*- coding: utf-8 -*-
2
+ """Crash-consistent Phase 4 transaction journal, state machine, and atomic recovery."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import phase4_exit as _core
7
+
8
+ transaction_fault = _core._transaction_fault
9
+ new_transaction_id = _core._new_transaction_id
10
+ pending_transaction = _core._pending_transaction
11
+ clear_transaction_journal = _core._clear_transaction_journal
12
+ recover_pending_transaction = _core._recover_pending_transaction
13
+ recover_single_transaction = recover_pending_transaction
14
+
15
+ __all__ = [
16
+ "transaction_fault",
17
+ "new_transaction_id",
18
+ "pending_transaction",
19
+ "clear_transaction_journal",
20
+ "recover_pending_transaction",
21
+ "recover_single_transaction",
22
+ ]
23
+
24
+ # Fail at import time if a private name the facade exposes was renamed
25
+ # or removed from ``phase4_exit`` — a silent ``None`` alias would turn
26
+ # recovery, journaling and fsync into no-ops that report nothing.
27
+ assert hasattr(_core, '_transaction_fault') and hasattr(_core, '_new_transaction_id') and hasattr(_core, '_pending_transaction') and hasattr(_core, '_clear_transaction_journal') and hasattr(_core, '_recover_pending_transaction'), (
28
+ "phase4 facade drifted from phase4_exit; missing: " + ", ".join(n for n in ['_transaction_fault', '_new_transaction_id', '_pending_transaction', '_clear_transaction_journal', '_recover_pending_transaction'] if not hasattr(_core, n))
29
+ )
@@ -0,0 +1,27 @@
1
+ # -*- coding: utf-8 -*-
2
+ """Platform-specific filesystem handles, junctions, locks, and durability synchronization."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import phase4_exit as _core
7
+
8
+ fsync_directory = _core._fsync_directory
9
+ fsync_directory_windows = _core._fsync_directory_windows
10
+ identity_from_stat = _core._identity_from_stat
11
+ read_stable_regular_fd = _core._read_stable_regular_fd
12
+ rename_no_replace = _core._rename_no_replace
13
+
14
+ __all__ = [
15
+ "fsync_directory",
16
+ "fsync_directory_windows",
17
+ "identity_from_stat",
18
+ "read_stable_regular_fd",
19
+ "rename_no_replace",
20
+ ]
21
+
22
+ # Fail at import time if a private name the facade exposes was renamed
23
+ # or removed from ``phase4_exit`` — a silent ``None`` alias would turn
24
+ # recovery, journaling and fsync into no-ops that report nothing.
25
+ assert hasattr(_core, '_fsync_directory') and hasattr(_core, '_fsync_directory_windows') and hasattr(_core, '_identity_from_stat') and hasattr(_core, '_read_stable_regular_fd') and hasattr(_core, '_rename_no_replace'), (
26
+ "phase4 facade drifted from phase4_exit; missing: " + ", ".join(n for n in ['_fsync_directory', '_fsync_directory_windows', '_identity_from_stat', '_read_stable_regular_fd', '_rename_no_replace'] if not hasattr(_core, n))
27
+ )