accordproject / template-archive

Smart Legal Contracts & Templating System
https://accordproject.org/projects/cicero/
Apache License 2.0
282 stars 119 forks source link

Reimplememts `draft` command in cicero-cli #801

Open mttrbrts opened 1 year ago

mttrbrts commented 1 year ago

Closes #797

Reimplememts draft command in cicero-cli

Changes

Remaining tasks

-[ ] Add tests (taken from old code). The test run is currently failing because of low test coverage -[ ] Review command flags (utcOffset, offline, format, warning etc.). Some may no longer be necessary/possible. -[ ] Review the default target (markdown). Right now, the output includes in-lined JSON objects. I remember a bug around this, but I can't find a reference (@dselman ?). Example output:

 Late Delivery and Penalty. In case of delayed delivery except for Force Majeure cases, the Seller shall pay to the Buyer for every {"$class":"org.accordproject.time@0.3.0.Duration","amount":9,"unit":"days"} of delay penalty amounting to 7.0% of the total value of the Equipment whose delivery has been delayed. Any fractional part of a days is to be considered a full days. The total amount of penalty shall not however, exceed 2.0% of the total value of the Equipment involved in late delivery. If the delay is more than {"$class":"org.accordproject.time@0.3.0.Duration","amount":2,"unit":"weeks"}, the Buyer is entitled to terminate this Contract.

Author Checklist

dselman commented 1 year ago

The JSON output is expected for complex types that don't have specific draft code baked in (eg MometaryAmount). We used to inline the space separated fields which was a hack and not localisation friendly. The template should render the fields of the Duration or we could bake in Duration drafting but we would need VOC support for enum values as well as an "as" formatting string.