sketch-hq/sketch-assistant-core-rules

Add suggestion/static message rule

christianklotz opened this issue · 3 comments

Summary

We've been discussing various scenarios for assistants that don't strictly check a document for validity but rather offer a list of suggestions or a checklist. This could be something particularly useful for team onboarding and general workflow conventions.

More sophisticate variants of this could be the display of usage instructions when certain design system components are being used within a design but this is out of scope of this rule.

Options

messages

Set a list of messages with custom strings, e.g.

  • Save to Sketch Cloud
  • Run copy past the marketing team

severity

For discussion, should each item have its own severity or do we just go with the rule-wide severity? Is this part of the messages option?

Rule name

Not sure what would make a good rule name, report, report-always, report-custom-message, report-message-custom, @jedrichards?

@christianklotz So far we have severity able to be set Assistant wide, and optionally overridden per rule. I think setting a severity per message is possibly getting too granular. I think a rule like this could just be set initially to info?

I do wonder whether we could introduce an additional severity level, something like todo. Then it could be up to the Sketch UI to visualise that in whatever makes sense (e.g. rendering as a checkbox, and instead of ignoring it, it could be marked "done")

So all this rule would be doing is basically looping over its configured messages and raising a global/document-level violation for each one (aka a violation that isn't associated with a specific node).

We could name the rule todo or document-todos.

More sophisticated versions of this rule (perhaps not for us to implement, but for 3rd parties), could raise specific messages when it notices at least one usage of a specifically named symbol in the document and whatnot.

As discussed briefly last week, I'm hesitant to introduce another severity at this point – besides todo does sound more like a type than indicating a level of importance.

Also, for naming the rule, the purpose may be a todo item but could also be checklist for something else. Hence a more generic name would be preferable in my opinion.

Since the rule would be configured once, with multiple messages, something like result-messages-include would be good, also with the rest of the types?

Yeah agree with those points.

So my understanding now is that this should be a sort of MVP version of something that may turn into an "Assistant checklist" feature. So at this stage we don't necessarily want to introduce new data types, option types or terminology - rather we just work with what we got, and iterate if needed afterwards.

With that in mind the rule and config looks something like this:

Rule configuration

Uses the existing "string array" option type, to define a set of static messages:

[
  "Don't forget to add to Sketch Cloud",
  "Ensure all copy is run past the marketing team"
]

Rule implementation

Just loops over the message strings, and for each one reports a violation. Nothing more complex than that.