@open-agreements/open-agreements 0.2.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.
- package/LICENSE +21 -0
- package/README.md +359 -0
- package/bin/open-agreements.js +4 -0
- package/content/external/LICENSE +27 -0
- package/content/external/README.md +38 -0
- package/content/external/yc-safe-discount/README.md +16 -0
- package/content/external/yc-safe-discount/clean.json +4 -0
- package/content/external/yc-safe-discount/metadata.yaml +67 -0
- package/content/external/yc-safe-discount/replacements.json +13 -0
- package/content/external/yc-safe-discount/template.docx +0 -0
- package/content/external/yc-safe-mfn/README.md +16 -0
- package/content/external/yc-safe-mfn/clean.json +4 -0
- package/content/external/yc-safe-mfn/metadata.yaml +64 -0
- package/content/external/yc-safe-mfn/replacements.json +12 -0
- package/content/external/yc-safe-mfn/template.docx +0 -0
- package/content/external/yc-safe-pro-rata-side-letter/README.md +16 -0
- package/content/external/yc-safe-pro-rata-side-letter/clean.json +4 -0
- package/content/external/yc-safe-pro-rata-side-letter/metadata.yaml +49 -0
- package/content/external/yc-safe-pro-rata-side-letter/replacements.json +9 -0
- package/content/external/yc-safe-pro-rata-side-letter/template.docx +0 -0
- package/content/external/yc-safe-valuation-cap/README.md +16 -0
- package/content/external/yc-safe-valuation-cap/clean.json +4 -0
- package/content/external/yc-safe-valuation-cap/metadata.yaml +64 -0
- package/content/external/yc-safe-valuation-cap/replacements.json +12 -0
- package/content/external/yc-safe-valuation-cap/template.docx +0 -0
- package/content/recipes/nvca-certificate-of-incorporation/clean.json +8 -0
- package/content/recipes/nvca-certificate-of-incorporation/metadata.yaml +43 -0
- package/content/recipes/nvca-certificate-of-incorporation/replacements.json +9 -0
- package/content/recipes/nvca-indemnification-agreement/clean.json +17 -0
- package/content/recipes/nvca-indemnification-agreement/metadata.yaml +79 -0
- package/content/recipes/nvca-indemnification-agreement/replacements.json +17 -0
- package/content/recipes/nvca-investors-rights-agreement/clean.json +12 -0
- package/content/recipes/nvca-investors-rights-agreement/metadata.yaml +71 -0
- package/content/recipes/nvca-investors-rights-agreement/replacements.json +18 -0
- package/content/recipes/nvca-management-rights-letter/clean.json +7 -0
- package/content/recipes/nvca-management-rights-letter/metadata.yaml +47 -0
- package/content/recipes/nvca-management-rights-letter/replacements.json +11 -0
- package/content/recipes/nvca-rofr-co-sale-agreement/clean.json +7 -0
- package/content/recipes/nvca-rofr-co-sale-agreement/metadata.yaml +76 -0
- package/content/recipes/nvca-rofr-co-sale-agreement/replacements.json +17 -0
- package/content/recipes/nvca-stock-purchase-agreement/clean.json +13 -0
- package/content/recipes/nvca-stock-purchase-agreement/computed.json +103 -0
- package/content/recipes/nvca-stock-purchase-agreement/metadata.yaml +138 -0
- package/content/recipes/nvca-stock-purchase-agreement/normalize.json +83 -0
- package/content/recipes/nvca-stock-purchase-agreement/replacements.json +41 -0
- package/content/recipes/nvca-voting-agreement/README.md +53 -0
- package/content/recipes/nvca-voting-agreement/clean.json +7 -0
- package/content/recipes/nvca-voting-agreement/metadata.yaml +66 -0
- package/content/recipes/nvca-voting-agreement/replacements.json +18 -0
- package/content/templates/bonterms-mutual-nda/README.md +27 -0
- package/content/templates/bonterms-mutual-nda/metadata.yaml +58 -0
- package/content/templates/bonterms-mutual-nda/source.json +18 -0
- package/content/templates/bonterms-mutual-nda/template.docx +0 -0
- package/content/templates/bonterms-professional-services-agreement/README.md +24 -0
- package/content/templates/bonterms-professional-services-agreement/metadata.yaml +45 -0
- package/content/templates/bonterms-professional-services-agreement/selections.json +12 -0
- package/content/templates/bonterms-professional-services-agreement/source.json +18 -0
- package/content/templates/bonterms-professional-services-agreement/template.docx +0 -0
- package/content/templates/closing-checklist/metadata.yaml +39 -0
- package/content/templates/closing-checklist/template.docx +0 -0
- package/content/templates/common-paper-ai-addendum/README.md +23 -0
- package/content/templates/common-paper-ai-addendum/metadata.yaml +31 -0
- package/content/templates/common-paper-ai-addendum/template.docx +0 -0
- package/content/templates/common-paper-ai-addendum-in-app/README.md +21 -0
- package/content/templates/common-paper-ai-addendum-in-app/metadata.yaml +21 -0
- package/content/templates/common-paper-ai-addendum-in-app/template.docx +0 -0
- package/content/templates/common-paper-amendment/README.md +27 -0
- package/content/templates/common-paper-amendment/metadata.yaml +53 -0
- package/content/templates/common-paper-amendment/template.docx +0 -0
- package/content/templates/common-paper-business-associate-agreement/README.md +29 -0
- package/content/templates/common-paper-business-associate-agreement/metadata.yaml +56 -0
- package/content/templates/common-paper-business-associate-agreement/replacements.json +3 -0
- package/content/templates/common-paper-business-associate-agreement/template.docx +0 -0
- package/content/templates/common-paper-cloud-service-agreement/README.md +32 -0
- package/content/templates/common-paper-cloud-service-agreement/metadata.yaml +354 -0
- package/content/templates/common-paper-cloud-service-agreement/template.docx +0 -0
- package/content/templates/common-paper-csa-click-through/README.md +33 -0
- package/content/templates/common-paper-csa-click-through/metadata.yaml +73 -0
- package/content/templates/common-paper-csa-click-through/template.docx +0 -0
- package/content/templates/common-paper-csa-with-ai/README.md +49 -0
- package/content/templates/common-paper-csa-with-ai/metadata.yaml +143 -0
- package/content/templates/common-paper-csa-with-ai/replacements.json +7 -0
- package/content/templates/common-paper-csa-with-ai/template.docx +0 -0
- package/content/templates/common-paper-csa-with-sla/README.md +53 -0
- package/content/templates/common-paper-csa-with-sla/metadata.yaml +159 -0
- package/content/templates/common-paper-csa-with-sla/replacements.json +7 -0
- package/content/templates/common-paper-csa-with-sla/template.docx +0 -0
- package/content/templates/common-paper-csa-without-sla/README.md +47 -0
- package/content/templates/common-paper-csa-without-sla/metadata.yaml +135 -0
- package/content/templates/common-paper-csa-without-sla/replacements.json +7 -0
- package/content/templates/common-paper-csa-without-sla/template.docx +0 -0
- package/content/templates/common-paper-data-processing-agreement/README.md +46 -0
- package/content/templates/common-paper-data-processing-agreement/metadata.yaml +130 -0
- package/content/templates/common-paper-data-processing-agreement/replacements.json +3 -0
- package/content/templates/common-paper-data-processing-agreement/template.docx +0 -0
- package/content/templates/common-paper-design-partner-agreement/README.md +29 -0
- package/content/templates/common-paper-design-partner-agreement/metadata.yaml +59 -0
- package/content/templates/common-paper-design-partner-agreement/replacements.json +4 -0
- package/content/templates/common-paper-design-partner-agreement/template.docx +0 -0
- package/content/templates/common-paper-independent-contractor-agreement/README.md +27 -0
- package/content/templates/common-paper-independent-contractor-agreement/metadata.yaml +55 -0
- package/content/templates/common-paper-independent-contractor-agreement/template.docx +0 -0
- package/content/templates/common-paper-letter-of-intent/README.md +25 -0
- package/content/templates/common-paper-letter-of-intent/metadata.yaml +42 -0
- package/content/templates/common-paper-letter-of-intent/template.docx +0 -0
- package/content/templates/common-paper-mutual-nda/README.md +29 -0
- package/content/templates/common-paper-mutual-nda/metadata.yaml +59 -0
- package/content/templates/common-paper-mutual-nda/selections.json +38 -0
- package/content/templates/common-paper-mutual-nda/template.docx +0 -0
- package/content/templates/common-paper-one-way-nda/README.md +27 -0
- package/content/templates/common-paper-one-way-nda/metadata.yaml +59 -0
- package/content/templates/common-paper-one-way-nda/template.docx +0 -0
- package/content/templates/common-paper-order-form/README.md +36 -0
- package/content/templates/common-paper-order-form/metadata.yaml +87 -0
- package/content/templates/common-paper-order-form/replacements.json +5 -0
- package/content/templates/common-paper-order-form/template.docx +0 -0
- package/content/templates/common-paper-order-form-with-sla/README.md +42 -0
- package/content/templates/common-paper-order-form-with-sla/metadata.yaml +111 -0
- package/content/templates/common-paper-order-form-with-sla/replacements.json +5 -0
- package/content/templates/common-paper-order-form-with-sla/template.docx +0 -0
- package/content/templates/common-paper-partnership-agreement/README.md +34 -0
- package/content/templates/common-paper-partnership-agreement/metadata.yaml +78 -0
- package/content/templates/common-paper-partnership-agreement/replacements.json +7 -0
- package/content/templates/common-paper-partnership-agreement/template.docx +0 -0
- package/content/templates/common-paper-pilot-agreement/README.md +34 -0
- package/content/templates/common-paper-pilot-agreement/metadata.yaml +100 -0
- package/content/templates/common-paper-pilot-agreement/replacements.json +4 -0
- package/content/templates/common-paper-pilot-agreement/selections.json +37 -0
- package/content/templates/common-paper-pilot-agreement/template.docx +0 -0
- package/content/templates/common-paper-professional-services-agreement/README.md +44 -0
- package/content/templates/common-paper-professional-services-agreement/metadata.yaml +124 -0
- package/content/templates/common-paper-professional-services-agreement/replacements.json +8 -0
- package/content/templates/common-paper-professional-services-agreement/template.docx +0 -0
- package/content/templates/common-paper-software-license-agreement/README.md +18 -0
- package/content/templates/common-paper-software-license-agreement/metadata.yaml +13 -0
- package/content/templates/common-paper-software-license-agreement/template.docx +0 -0
- package/content/templates/common-paper-statement-of-work/README.md +32 -0
- package/content/templates/common-paper-statement-of-work/metadata.yaml +71 -0
- package/content/templates/common-paper-statement-of-work/replacements.json +3 -0
- package/content/templates/common-paper-statement-of-work/template.docx +0 -0
- package/content/templates/common-paper-term-sheet/README.md +22 -0
- package/content/templates/common-paper-term-sheet/metadata.yaml +28 -0
- package/content/templates/common-paper-term-sheet/template.docx +0 -0
- package/content/templates/openagreements-employee-ip-inventions-assignment/README.md +31 -0
- package/content/templates/openagreements-employee-ip-inventions-assignment/metadata.yaml +71 -0
- package/content/templates/openagreements-employee-ip-inventions-assignment/template.docx +0 -0
- package/content/templates/openagreements-employee-ip-inventions-assignment/template.md +80 -0
- package/content/templates/openagreements-employment-confidentiality-acknowledgement/README.md +30 -0
- package/content/templates/openagreements-employment-confidentiality-acknowledgement/metadata.yaml +60 -0
- package/content/templates/openagreements-employment-confidentiality-acknowledgement/template.docx +0 -0
- package/content/templates/openagreements-employment-confidentiality-acknowledgement/template.md +51 -0
- package/content/templates/openagreements-employment-offer-letter/README.md +33 -0
- package/content/templates/openagreements-employment-offer-letter/metadata.yaml +75 -0
- package/content/templates/openagreements-employment-offer-letter/template.docx +0 -0
- package/content/templates/openagreements-employment-offer-letter/template.md +90 -0
- package/content/templates/working-group-list/metadata.yaml +22 -0
- package/content/templates/working-group-list/template.docx +0 -0
- package/dist/cli/index.d.ts +4 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +199 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/commands/checklist.d.ts +22 -0
- package/dist/commands/checklist.d.ts.map +1 -0
- package/dist/commands/checklist.js +222 -0
- package/dist/commands/checklist.js.map +1 -0
- package/dist/commands/fill.d.ts +18 -0
- package/dist/commands/fill.d.ts.map +1 -0
- package/dist/commands/fill.js +119 -0
- package/dist/commands/fill.js.map +1 -0
- package/dist/commands/list.d.ts +7 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +247 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/recipe.d.ts +24 -0
- package/dist/commands/recipe.d.ts.map +1 -0
- package/dist/commands/recipe.js +96 -0
- package/dist/commands/recipe.js.map +1 -0
- package/dist/commands/scan.d.ts +28 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +138 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/validate.d.ts +6 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +158 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/core/checklist/index.d.ts +38 -0
- package/dist/core/checklist/index.d.ts.map +1 -0
- package/dist/core/checklist/index.js +229 -0
- package/dist/core/checklist/index.js.map +1 -0
- package/dist/core/checklist/patch-apply.d.ts +65 -0
- package/dist/core/checklist/patch-apply.d.ts.map +1 -0
- package/dist/core/checklist/patch-apply.js +274 -0
- package/dist/core/checklist/patch-apply.js.map +1 -0
- package/dist/core/checklist/patch-schemas.d.ts +86 -0
- package/dist/core/checklist/patch-schemas.d.ts.map +1 -0
- package/dist/core/checklist/patch-schemas.js +89 -0
- package/dist/core/checklist/patch-schemas.js.map +1 -0
- package/dist/core/checklist/patch-validator.d.ts +76 -0
- package/dist/core/checklist/patch-validator.d.ts.map +1 -0
- package/dist/core/checklist/patch-validator.js +404 -0
- package/dist/core/checklist/patch-validator.js.map +1 -0
- package/dist/core/checklist/schemas.d.ts +270 -0
- package/dist/core/checklist/schemas.d.ts.map +1 -0
- package/dist/core/checklist/schemas.js +229 -0
- package/dist/core/checklist/schemas.js.map +1 -0
- package/dist/core/checklist/test-utils.d.ts +7 -0
- package/dist/core/checklist/test-utils.d.ts.map +1 -0
- package/dist/core/checklist/test-utils.js +13 -0
- package/dist/core/checklist/test-utils.js.map +1 -0
- package/dist/core/command-generation/adapters/claude.d.ts +11 -0
- package/dist/core/command-generation/adapters/claude.d.ts.map +1 -0
- package/dist/core/command-generation/adapters/claude.js +91 -0
- package/dist/core/command-generation/adapters/claude.js.map +1 -0
- package/dist/core/command-generation/types.d.ts +14 -0
- package/dist/core/command-generation/types.d.ts.map +1 -0
- package/dist/core/command-generation/types.js +2 -0
- package/dist/core/command-generation/types.js.map +1 -0
- package/dist/core/employment/jurisdiction-rules.d.ts +20 -0
- package/dist/core/employment/jurisdiction-rules.d.ts.map +1 -0
- package/dist/core/employment/jurisdiction-rules.js +57 -0
- package/dist/core/employment/jurisdiction-rules.js.map +1 -0
- package/dist/core/employment/memo.d.ts +57 -0
- package/dist/core/employment/memo.d.ts.map +1 -0
- package/dist/core/employment/memo.js +589 -0
- package/dist/core/employment/memo.js.map +1 -0
- package/dist/core/engine.d.ts +13 -0
- package/dist/core/engine.d.ts.map +1 -0
- package/dist/core/engine.js +182 -0
- package/dist/core/engine.js.map +1 -0
- package/dist/core/external/index.d.ts +8 -0
- package/dist/core/external/index.d.ts.map +1 -0
- package/dist/core/external/index.js +50 -0
- package/dist/core/external/index.js.map +1 -0
- package/dist/core/external/types.d.ts +18 -0
- package/dist/core/external/types.d.ts.map +1 -0
- package/dist/core/external/types.js +2 -0
- package/dist/core/external/types.js.map +1 -0
- package/dist/core/fill-pipeline.d.ts +64 -0
- package/dist/core/fill-pipeline.d.ts.map +1 -0
- package/dist/core/fill-pipeline.js +350 -0
- package/dist/core/fill-pipeline.js.map +1 -0
- package/dist/core/fill-utils.d.ts +39 -0
- package/dist/core/fill-utils.d.ts.map +1 -0
- package/dist/core/fill-utils.js +127 -0
- package/dist/core/fill-utils.js.map +1 -0
- package/dist/core/metadata.d.ts +194 -0
- package/dist/core/metadata.d.ts.map +1 -0
- package/dist/core/metadata.js +197 -0
- package/dist/core/metadata.js.map +1 -0
- package/dist/core/recipe/bracket-normalizer.d.ts +46 -0
- package/dist/core/recipe/bracket-normalizer.d.ts.map +1 -0
- package/dist/core/recipe/bracket-normalizer.js +354 -0
- package/dist/core/recipe/bracket-normalizer.js.map +1 -0
- package/dist/core/recipe/cleaner.d.ts +27 -0
- package/dist/core/recipe/cleaner.d.ts.map +1 -0
- package/dist/core/recipe/cleaner.js +345 -0
- package/dist/core/recipe/cleaner.js.map +1 -0
- package/dist/core/recipe/computed.d.ts +136 -0
- package/dist/core/recipe/computed.d.ts.map +1 -0
- package/dist/core/recipe/computed.js +225 -0
- package/dist/core/recipe/computed.js.map +1 -0
- package/dist/core/recipe/downloader.d.ts +8 -0
- package/dist/core/recipe/downloader.d.ts.map +1 -0
- package/dist/core/recipe/downloader.js +58 -0
- package/dist/core/recipe/downloader.js.map +1 -0
- package/dist/core/recipe/index.d.ts +17 -0
- package/dist/core/recipe/index.d.ts.map +1 -0
- package/dist/core/recipe/index.js +90 -0
- package/dist/core/recipe/index.js.map +1 -0
- package/dist/core/recipe/ooxml-parts.d.ts +21 -0
- package/dist/core/recipe/ooxml-parts.d.ts.map +1 -0
- package/dist/core/recipe/ooxml-parts.js +33 -0
- package/dist/core/recipe/ooxml-parts.js.map +1 -0
- package/dist/core/recipe/patcher.d.ts +34 -0
- package/dist/core/recipe/patcher.d.ts.map +1 -0
- package/dist/core/recipe/patcher.js +423 -0
- package/dist/core/recipe/patcher.js.map +1 -0
- package/dist/core/recipe/replacement-keys.d.ts +33 -0
- package/dist/core/recipe/replacement-keys.d.ts.map +1 -0
- package/dist/core/recipe/replacement-keys.js +53 -0
- package/dist/core/recipe/replacement-keys.js.map +1 -0
- package/dist/core/recipe/source-drift.d.ts +33 -0
- package/dist/core/recipe/source-drift.d.ts.map +1 -0
- package/dist/core/recipe/source-drift.js +113 -0
- package/dist/core/recipe/source-drift.js.map +1 -0
- package/dist/core/recipe/types.d.ts +33 -0
- package/dist/core/recipe/types.d.ts.map +1 -0
- package/dist/core/recipe/types.js +2 -0
- package/dist/core/recipe/types.js.map +1 -0
- package/dist/core/recipe/verifier.d.ts +24 -0
- package/dist/core/recipe/verifier.d.ts.map +1 -0
- package/dist/core/recipe/verifier.js +158 -0
- package/dist/core/recipe/verifier.js.map +1 -0
- package/dist/core/selector.d.ts +41 -0
- package/dist/core/selector.d.ts.map +1 -0
- package/dist/core/selector.js +323 -0
- package/dist/core/selector.js.map +1 -0
- package/dist/core/unified-pipeline.d.ts +53 -0
- package/dist/core/unified-pipeline.d.ts.map +1 -0
- package/dist/core/unified-pipeline.js +107 -0
- package/dist/core/unified-pipeline.js.map +1 -0
- package/dist/core/validation/external.d.ts +16 -0
- package/dist/core/validation/external.d.ts.map +1 -0
- package/dist/core/validation/external.js +114 -0
- package/dist/core/validation/external.js.map +1 -0
- package/dist/core/validation/license.d.ts +15 -0
- package/dist/core/validation/license.d.ts.map +1 -0
- package/dist/core/validation/license.js +30 -0
- package/dist/core/validation/license.js.map +1 -0
- package/dist/core/validation/output.d.ts +12 -0
- package/dist/core/validation/output.d.ts.map +1 -0
- package/dist/core/validation/output.js +47 -0
- package/dist/core/validation/output.js.map +1 -0
- package/dist/core/validation/recipe.d.ts +19 -0
- package/dist/core/validation/recipe.d.ts.map +1 -0
- package/dist/core/validation/recipe.js +159 -0
- package/dist/core/validation/recipe.js.map +1 -0
- package/dist/core/validation/scan-metadata.d.ts +21 -0
- package/dist/core/validation/scan-metadata.d.ts.map +1 -0
- package/dist/core/validation/scan-metadata.js +70 -0
- package/dist/core/validation/scan-metadata.js.map +1 -0
- package/dist/core/validation/template.d.ts +11 -0
- package/dist/core/validation/template.d.ts.map +1 -0
- package/dist/core/validation/template.js +248 -0
- package/dist/core/validation/template.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/paths.d.ts +43 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +149 -0
- package/dist/utils/paths.js.map +1 -0
- package/package.json +148 -0
- package/skills/cloud-service-agreement/CONNECTORS.md +19 -0
- package/skills/cloud-service-agreement/SKILL.md +172 -0
- package/skills/data-privacy-agreement/CONNECTORS.md +19 -0
- package/skills/data-privacy-agreement/SKILL.md +158 -0
- package/skills/delaware-franchise-tax/CONNECTORS.md +16 -0
- package/skills/delaware-franchise-tax/SKILL.md +206 -0
- package/skills/delaware-franchise-tax/reference/ecorp-portal-playwright-notes.md +136 -0
- package/skills/delaware-franchise-tax/reference/faq.md +101 -0
- package/skills/delaware-franchise-tax/reference/filing-instructions.md +111 -0
- package/skills/delaware-franchise-tax/reference/tax-calculation.md +167 -0
- package/skills/employment-contract/CONNECTORS.md +19 -0
- package/skills/employment-contract/SKILL.md +157 -0
- package/skills/nda/CONNECTORS.md +19 -0
- package/skills/nda/SKILL.md +153 -0
- package/skills/open-agreements/CONNECTORS.md +19 -0
- package/skills/open-agreements/SKILL.md +182 -0
- package/skills/safe/CONNECTORS.md +19 -0
- package/skills/safe/SKILL.md +161 -0
- package/skills/services-agreement/CONNECTORS.md +19 -0
- package/skills/services-agreement/SKILL.md +156 -0
- package/skills/unit-test-philosophy/SKILL.md +113 -0
- package/skills/unit-test-philosophy/references/allure-test-spec-writing-guide.md +164 -0
- package/skills/venture-financing/CONNECTORS.md +19 -0
- package/skills/venture-financing/SKILL.md +169 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import AdmZip from 'adm-zip';
|
|
2
|
+
import { writeFileSync } from 'node:fs';
|
|
3
|
+
import { DOMParser, XMLSerializer } from '@xmldom/xmldom';
|
|
4
|
+
import { enumerateTextParts, getGeneralTextPartNames } from './ooxml-parts.js';
|
|
5
|
+
import { BLANK_PLACEHOLDER } from '../fill-utils.js';
|
|
6
|
+
const W_NS = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main';
|
|
7
|
+
/**
|
|
8
|
+
* Normalize residual bracket artifacts in generated recipe documents.
|
|
9
|
+
*
|
|
10
|
+
* Strategy:
|
|
11
|
+
* - Unbracket simple single-level clauses (`[text]` -> `text`)
|
|
12
|
+
* - Remove complex/nested segments with unresolved placeholders
|
|
13
|
+
* - Remove orphan bracket characters and punctuation artifacts
|
|
14
|
+
* - Drop paragraphs that collapse to punctuation-only content
|
|
15
|
+
*/
|
|
16
|
+
export async function normalizeBracketArtifacts(inputPath, outputPath, options) {
|
|
17
|
+
const zip = new AdmZip(inputPath);
|
|
18
|
+
const parser = new DOMParser();
|
|
19
|
+
const serializer = new XMLSerializer();
|
|
20
|
+
const parts = enumerateTextParts(zip);
|
|
21
|
+
const partNames = getGeneralTextPartNames(parts);
|
|
22
|
+
const stats = {
|
|
23
|
+
unbracketedSegments: 0,
|
|
24
|
+
removedSegments: 0,
|
|
25
|
+
removedParagraphs: 0,
|
|
26
|
+
normalizedParagraphs: 0,
|
|
27
|
+
declarativeRuleApplications: 0,
|
|
28
|
+
declarativeRuleMatchCounts: {},
|
|
29
|
+
declarativeRuleMutationCounts: {},
|
|
30
|
+
declarativeRuleExpectationFailures: [],
|
|
31
|
+
declarativeRuleExamples: [],
|
|
32
|
+
};
|
|
33
|
+
const rules = options?.rules ?? [];
|
|
34
|
+
const fieldValues = options?.fieldValues ?? {};
|
|
35
|
+
const blankPlaceholder = options?.blankPlaceholder ?? BLANK_PLACEHOLDER;
|
|
36
|
+
const hasDeclarativeRules = rules.length > 0;
|
|
37
|
+
for (const rule of rules) {
|
|
38
|
+
if (!(rule.id in stats.declarativeRuleMatchCounts)) {
|
|
39
|
+
stats.declarativeRuleMatchCounts[rule.id] = 0;
|
|
40
|
+
stats.declarativeRuleMutationCounts[rule.id] = 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
for (const partName of partNames) {
|
|
44
|
+
const entry = zip.getEntry(partName);
|
|
45
|
+
if (!entry)
|
|
46
|
+
continue;
|
|
47
|
+
const xml = entry.getData().toString('utf-8');
|
|
48
|
+
const doc = parser.parseFromString(xml, 'text/xml');
|
|
49
|
+
const paragraphs = doc.getElementsByTagNameNS(W_NS, 'p');
|
|
50
|
+
const toRemove = [];
|
|
51
|
+
let lastHeading = '';
|
|
52
|
+
for (let i = 0; i < paragraphs.length; i++) {
|
|
53
|
+
const para = paragraphs[i];
|
|
54
|
+
const original = extractParagraphText(para);
|
|
55
|
+
if (!original.trim())
|
|
56
|
+
continue;
|
|
57
|
+
const trimmedOriginal = original.trim();
|
|
58
|
+
if (isHeadingLike(trimmedOriginal)) {
|
|
59
|
+
lastHeading = trimmedOriginal;
|
|
60
|
+
}
|
|
61
|
+
const declarativeResult = applyDeclarativeRulesToParagraph({
|
|
62
|
+
text: original,
|
|
63
|
+
heading: lastHeading,
|
|
64
|
+
rules,
|
|
65
|
+
fieldValues,
|
|
66
|
+
blankPlaceholder,
|
|
67
|
+
});
|
|
68
|
+
if (declarativeResult.applied) {
|
|
69
|
+
stats.declarativeRuleApplications += 1;
|
|
70
|
+
}
|
|
71
|
+
if (declarativeResult.rule_id) {
|
|
72
|
+
const ruleId = declarativeResult.rule_id;
|
|
73
|
+
stats.declarativeRuleMatchCounts[ruleId] =
|
|
74
|
+
(stats.declarativeRuleMatchCounts[ruleId] ?? 0) + 1;
|
|
75
|
+
if (declarativeResult.text !== original) {
|
|
76
|
+
stats.declarativeRuleMutationCounts[ruleId] =
|
|
77
|
+
(stats.declarativeRuleMutationCounts[ruleId] ?? 0) + 1;
|
|
78
|
+
}
|
|
79
|
+
const existingExamples = stats.declarativeRuleExamples.filter((example) => example.rule_id === ruleId).length;
|
|
80
|
+
if (existingExamples < 2) {
|
|
81
|
+
stats.declarativeRuleExamples.push({
|
|
82
|
+
rule_id: ruleId,
|
|
83
|
+
heading: lastHeading,
|
|
84
|
+
before: original,
|
|
85
|
+
after: declarativeResult.text,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// If declarative rules are provided, prefer targeted mutation only.
|
|
90
|
+
// This avoids broad paragraph rewrites that can shift inline styling.
|
|
91
|
+
if (hasDeclarativeRules) {
|
|
92
|
+
if (declarativeResult.text !== original) {
|
|
93
|
+
setParagraphText(para, declarativeResult.text);
|
|
94
|
+
stats.normalizedParagraphs += 1;
|
|
95
|
+
}
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const normalized = normalizeParagraphText(declarativeResult.text, stats);
|
|
99
|
+
if (normalized === null) {
|
|
100
|
+
toRemove.push(para);
|
|
101
|
+
stats.removedParagraphs += 1;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (normalized !== original) {
|
|
105
|
+
setParagraphText(para, normalized);
|
|
106
|
+
stats.normalizedParagraphs += 1;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
for (const para of toRemove) {
|
|
110
|
+
para.parentNode?.removeChild(para);
|
|
111
|
+
}
|
|
112
|
+
zip.updateFile(partName, Buffer.from(serializer.serializeToString(doc), 'utf-8'));
|
|
113
|
+
}
|
|
114
|
+
for (const rule of rules) {
|
|
115
|
+
if (rule.expected_min_matches === undefined)
|
|
116
|
+
continue;
|
|
117
|
+
const actualMatches = stats.declarativeRuleMatchCounts[rule.id] ?? 0;
|
|
118
|
+
if (actualMatches < rule.expected_min_matches) {
|
|
119
|
+
stats.declarativeRuleExpectationFailures.push(`${rule.id}: expected at least ${rule.expected_min_matches} match(es), found ${actualMatches}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const outZip = new AdmZip();
|
|
123
|
+
for (const entry of zip.getEntries()) {
|
|
124
|
+
outZip.addFile(entry.entryName, entry.getData());
|
|
125
|
+
}
|
|
126
|
+
writeFileSync(outputPath, outZip.toBuffer());
|
|
127
|
+
return stats;
|
|
128
|
+
}
|
|
129
|
+
function isHeadingLike(text) {
|
|
130
|
+
return !text.startsWith('.') && !text.includes('[') && text.replaceAll('.', '').trim().length > 0;
|
|
131
|
+
}
|
|
132
|
+
function applyDeclarativeRulesToParagraph(params) {
|
|
133
|
+
const { text, heading, rules, fieldValues, blankPlaceholder } = params;
|
|
134
|
+
let mutated = text;
|
|
135
|
+
let matchedRule = false;
|
|
136
|
+
let matchedRuleId;
|
|
137
|
+
for (const rule of rules) {
|
|
138
|
+
if (!matchesHeading(rule, heading))
|
|
139
|
+
continue;
|
|
140
|
+
if (!mutated.includes(rule.paragraph_contains))
|
|
141
|
+
continue;
|
|
142
|
+
if (rule.paragraph_end_contains && !mutated.includes(rule.paragraph_end_contains))
|
|
143
|
+
continue;
|
|
144
|
+
matchedRule = true;
|
|
145
|
+
matchedRuleId = rule.id;
|
|
146
|
+
for (const [token, template] of Object.entries(rule.replacements ?? {})) {
|
|
147
|
+
const resolved = resolveTemplateValue(template, fieldValues, blankPlaceholder);
|
|
148
|
+
mutated = mutated.split(token).join(resolved);
|
|
149
|
+
}
|
|
150
|
+
if (rule.trim_unmatched_trailing_bracket) {
|
|
151
|
+
const openCount = (mutated.match(/\[/g) ?? []).length;
|
|
152
|
+
const closeCount = (mutated.match(/\]/g) ?? []).length;
|
|
153
|
+
if (closeCount > openCount) {
|
|
154
|
+
mutated = mutated.replace(/\]+$/g, '');
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
mutated = mutated
|
|
158
|
+
.replace(/\s{2,}/g, ' ')
|
|
159
|
+
.replace(/\s+\./g, '.')
|
|
160
|
+
.replace(/^\.\s*/, '')
|
|
161
|
+
.trim();
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
// Lightweight fallback cleanup for declarative mode:
|
|
165
|
+
// 1) Preserve bracket-prefixed heading labels by removing only leading '['.
|
|
166
|
+
// 2) Trim unmatched trailing ']' artifacts that remain after option pruning.
|
|
167
|
+
mutated = normalizeBracketPrefixedHeading(mutated);
|
|
168
|
+
mutated = trimUnmatchedTrailingBrackets(mutated);
|
|
169
|
+
return { text: mutated, applied: matchedRule || mutated !== text, rule_id: matchedRuleId };
|
|
170
|
+
}
|
|
171
|
+
function matchesHeading(rule, heading) {
|
|
172
|
+
if (rule.ignore_heading)
|
|
173
|
+
return true;
|
|
174
|
+
if (heading.includes(rule.section_heading))
|
|
175
|
+
return true;
|
|
176
|
+
for (const alias of rule.section_heading_any ?? []) {
|
|
177
|
+
if (heading.includes(alias))
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
function resolveTemplateValue(template, fieldValues, blankPlaceholder) {
|
|
183
|
+
return template.replace(/\{([a-zA-Z0-9_]+)\}/g, (_full, key) => {
|
|
184
|
+
const value = fieldValues[key];
|
|
185
|
+
if (typeof value === 'boolean')
|
|
186
|
+
return value ? 'true' : 'false';
|
|
187
|
+
if (typeof value === 'string' && value.trim().length > 0)
|
|
188
|
+
return value;
|
|
189
|
+
return blankPlaceholder;
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function normalizeBracketPrefixedHeading(text) {
|
|
193
|
+
const trimmed = text.trim();
|
|
194
|
+
if (!trimmed.startsWith('['))
|
|
195
|
+
return text;
|
|
196
|
+
if (trimmed.includes(']'))
|
|
197
|
+
return text;
|
|
198
|
+
if (trimmed.length > 90)
|
|
199
|
+
return text;
|
|
200
|
+
if (trimmed.includes('_'))
|
|
201
|
+
return text;
|
|
202
|
+
if (/[.:;!?].+[.:;!?]/.test(trimmed))
|
|
203
|
+
return text;
|
|
204
|
+
if (!/^\[[A-Z][A-Za-z0-9 ,&()'’/.-]+$/.test(trimmed))
|
|
205
|
+
return text;
|
|
206
|
+
return trimmed.slice(1).trim();
|
|
207
|
+
}
|
|
208
|
+
function trimUnmatchedTrailingBrackets(text) {
|
|
209
|
+
let out = text;
|
|
210
|
+
const openCount = (out.match(/\[/g) ?? []).length;
|
|
211
|
+
let closeCount = (out.match(/\]/g) ?? []).length;
|
|
212
|
+
while (closeCount > openCount && /\]\s*$/.test(out)) {
|
|
213
|
+
out = out.replace(/\]\s*$/, '').trimEnd();
|
|
214
|
+
closeCount -= 1;
|
|
215
|
+
}
|
|
216
|
+
return out;
|
|
217
|
+
}
|
|
218
|
+
function normalizeParagraphText(text, stats) {
|
|
219
|
+
let out = text;
|
|
220
|
+
// First pass: handle complete same-paragraph bracket segments.
|
|
221
|
+
const segments = extractTopLevelSegments(out);
|
|
222
|
+
if (segments.length > 0) {
|
|
223
|
+
const ordered = [...segments].sort((a, b) => b.start - a.start);
|
|
224
|
+
for (const seg of ordered) {
|
|
225
|
+
const replacement = shouldRemoveSegment(seg.inner) ? '' : seg.inner.trim();
|
|
226
|
+
out = `${out.slice(0, seg.start)}${replacement}${out.slice(seg.end + 1)}`;
|
|
227
|
+
if (replacement === '') {
|
|
228
|
+
stats.removedSegments += 1;
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
stats.unbracketedSegments += 1;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
// Second pass: remove orphan bracket chars from cross-paragraph constructs.
|
|
236
|
+
out = out.replaceAll('[', '').replaceAll(']', '');
|
|
237
|
+
// Punctuation/spacing normalization for artifacts created by bracket deletion.
|
|
238
|
+
out = out
|
|
239
|
+
.replace(/^\s*[.;:,]\s*/, '')
|
|
240
|
+
.replace(/\s+,/g, ',')
|
|
241
|
+
.replace(/\s+;/g, ';')
|
|
242
|
+
.replace(/\s+\./g, '.')
|
|
243
|
+
.replace(/\bfrom,\s+counsel\b/gi, 'from counsel')
|
|
244
|
+
.replace(/\(\s+/g, '(')
|
|
245
|
+
.replace(/\s+\)/g, ')')
|
|
246
|
+
.replace(/\s{2,}/g, ' ')
|
|
247
|
+
.trim();
|
|
248
|
+
// Prefer a single deterministic costs clause when both alternatives are present.
|
|
249
|
+
if (out.includes('If any action at law or in equity') &&
|
|
250
|
+
out.includes('Each party will bear its own costs in respect of any disputes arising under this Agreement.')) {
|
|
251
|
+
out = 'Each party will bear its own costs in respect of any disputes arising under this Agreement.';
|
|
252
|
+
}
|
|
253
|
+
// Drop known degenerate artifacts produced when optional bracket blocks are stripped.
|
|
254
|
+
if (/^A minimum of\s+Shares must be sold at the Initial Closing\.?$/i.test(out)) {
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
if (/^As of the Initial Closing, the authorized size of the Board of Directors shall be, and the Board of Directors shall be comprised of\.?$/i.test(out)) {
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
// Drop degenerate paragraphs that are now effectively empty.
|
|
261
|
+
if (!out || /^[.,;:]+$/.test(out)) {
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
return out;
|
|
265
|
+
}
|
|
266
|
+
function shouldRemoveSegment(inner) {
|
|
267
|
+
const normalized = inner.trim();
|
|
268
|
+
if (!normalized)
|
|
269
|
+
return true;
|
|
270
|
+
// Nested bracket segments are usually unresolved alternatives; drop them.
|
|
271
|
+
if (normalized.includes('[') || normalized.includes(']'))
|
|
272
|
+
return true;
|
|
273
|
+
// Placeholder blanks and underscore markers should be removed.
|
|
274
|
+
if (normalized.includes('_'))
|
|
275
|
+
return true;
|
|
276
|
+
// Known placeholder-only tokens.
|
|
277
|
+
if (/^(date|specify|state|initial|applicable|audited|unaudited)$/i.test(normalized))
|
|
278
|
+
return true;
|
|
279
|
+
if (/^\(?[ivx]+\)?$/i.test(normalized))
|
|
280
|
+
return true;
|
|
281
|
+
if (/^\d+$/.test(normalized))
|
|
282
|
+
return true;
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
function extractTopLevelSegments(text) {
|
|
286
|
+
const out = [];
|
|
287
|
+
let depth = 0;
|
|
288
|
+
let start = -1;
|
|
289
|
+
for (let i = 0; i < text.length; i++) {
|
|
290
|
+
const ch = text[i];
|
|
291
|
+
if (ch === '[') {
|
|
292
|
+
if (depth === 0)
|
|
293
|
+
start = i;
|
|
294
|
+
depth += 1;
|
|
295
|
+
}
|
|
296
|
+
else if (ch === ']') {
|
|
297
|
+
if (depth > 0)
|
|
298
|
+
depth -= 1;
|
|
299
|
+
if (depth === 0 && start !== -1) {
|
|
300
|
+
const raw = text.slice(start, i + 1);
|
|
301
|
+
out.push({ start, end: i, raw, inner: raw.slice(1, -1) });
|
|
302
|
+
start = -1;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return out;
|
|
307
|
+
}
|
|
308
|
+
function extractParagraphText(para) {
|
|
309
|
+
const tElements = para.getElementsByTagNameNS(W_NS, 't');
|
|
310
|
+
const parts = [];
|
|
311
|
+
for (let i = 0; i < tElements.length; i++) {
|
|
312
|
+
parts.push(tElements[i].textContent ?? '');
|
|
313
|
+
}
|
|
314
|
+
return parts.join('');
|
|
315
|
+
}
|
|
316
|
+
function setParagraphText(para, text) {
|
|
317
|
+
const doc = para.ownerDocument;
|
|
318
|
+
const tElements = para.getElementsByTagNameNS(W_NS, 't');
|
|
319
|
+
if (tElements.length === 0) {
|
|
320
|
+
const run = doc.createElementNS(W_NS, 'w:r');
|
|
321
|
+
const t = doc.createElementNS(W_NS, 'w:t');
|
|
322
|
+
t.textContent = text;
|
|
323
|
+
run.appendChild(t);
|
|
324
|
+
para.appendChild(run);
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
// Preserve existing run-level formatting by distributing normalized text
|
|
328
|
+
// across current text nodes using original node-length quotas.
|
|
329
|
+
const originalLengths = [];
|
|
330
|
+
for (let i = 0; i < tElements.length; i++) {
|
|
331
|
+
originalLengths.push((tElements[i].textContent ?? '').length);
|
|
332
|
+
}
|
|
333
|
+
let cursor = 0;
|
|
334
|
+
const total = text.length;
|
|
335
|
+
for (let i = 0; i < tElements.length; i++) {
|
|
336
|
+
const quota = i === tElements.length - 1
|
|
337
|
+
? total - cursor
|
|
338
|
+
: Math.min(originalLengths[i], Math.max(0, total - cursor));
|
|
339
|
+
if (quota > 0) {
|
|
340
|
+
tElements[i].textContent = text.slice(cursor, cursor + quota);
|
|
341
|
+
cursor += quota;
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
tElements[i].textContent = '';
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
// If the paragraph grew beyond original capacity, append the tail to
|
|
348
|
+
// the last node to avoid creating new runs and style surprises.
|
|
349
|
+
if (cursor < total) {
|
|
350
|
+
const last = tElements[tElements.length - 1];
|
|
351
|
+
last.textContent = (last.textContent ?? '') + text.slice(cursor);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
//# sourceMappingURL=bracket-normalizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bracket-normalizer.js","sourceRoot":"","sources":["../../../src/core/recipe/bracket-normalizer.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,IAAI,GAAG,8DAA8D,CAAC;AAgD5E;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,SAAiB,EACjB,UAAkB,EAClB,OAAqC;IAErC,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;IAC/B,MAAM,UAAU,GAAG,IAAI,aAAa,EAAE,CAAC;IACvC,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAEjD,MAAM,KAAK,GAA8B;QACvC,mBAAmB,EAAE,CAAC;QACtB,eAAe,EAAE,CAAC;QAClB,iBAAiB,EAAE,CAAC;QACpB,oBAAoB,EAAE,CAAC;QACvB,2BAA2B,EAAE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,CAAC,KAAK,GAAG,MAAM;YAChB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC;QAC9D,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACd,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC;YAC9D,MAAM,IAAI,KAAK,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,GAAG,EAAE,CAAC;QAChC,CAAC;IACH,CAAC;IAED,qEAAqE;IACrE,gEAAgE;IAChE,IAAI,MAAM,GAAG,KAAK,EAAE,CAAC;QACnB,MAAM,IAAI,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACnE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CleanConfig, GuidanceOutput } from '../metadata.js';
|
|
2
|
+
export interface CleanResult {
|
|
3
|
+
outputPath: string;
|
|
4
|
+
guidance?: GuidanceOutput;
|
|
5
|
+
}
|
|
6
|
+
export interface CleanOptions {
|
|
7
|
+
extractGuidance?: boolean;
|
|
8
|
+
/** Pre-computed hashes for guidance staleness detection */
|
|
9
|
+
sourceHash?: string;
|
|
10
|
+
configHash?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Clean a DOCX document by removing footnotes, pattern-matched paragraphs,
|
|
14
|
+
* and clearing specified parts.
|
|
15
|
+
* Operates at the OOXML level to preserve formatting of retained content.
|
|
16
|
+
*
|
|
17
|
+
* Processes all general OOXML text parts (document, headers, footers, endnotes).
|
|
18
|
+
* Footnotes.xml is handled separately with its separator/continuationSeparator logic.
|
|
19
|
+
*
|
|
20
|
+
* When options.extractGuidance is true, captures the text content of all
|
|
21
|
+
* removed elements before deletion and returns them as structured guidance data.
|
|
22
|
+
*
|
|
23
|
+
* Note: Helpers use xmldom's own `Document`/`Element`/`Node` types to avoid
|
|
24
|
+
* incompatibilities with the global DOM lib declarations.
|
|
25
|
+
*/
|
|
26
|
+
export declare function cleanDocument(inputPath: string, outputPath: string, config: CleanConfig, options?: CleanOptions): Promise<CleanResult>;
|
|
27
|
+
//# sourceMappingURL=cleaner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleaner.d.ts","sourceRoot":"","sources":["../../../src/core/recipe/cleaner.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAiB,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAKjF,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CACjC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,WAAW,EACnB,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,WAAW,CAAC,CAmItB"}
|